whirr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From k..@apache.org
Subject svn commit: r1245354 - /whirr/trunk/build-tools/update-versions
Date Fri, 17 Feb 2012 09:09:41 GMT
Author: kve
Date: Fri Feb 17 09:09:41 2012
New Revision: 1245354

URL: http://svn.apache.org/viewvc?rev=1245354&view=rev
Log:
Don't update /project/parent/version for the root pom


Modified:
    whirr/trunk/build-tools/update-versions

Modified: whirr/trunk/build-tools/update-versions
URL: http://svn.apache.org/viewvc/whirr/trunk/build-tools/update-versions?rev=1245354&r1=1245353&r2=1245354&view=diff
==============================================================================
--- whirr/trunk/build-tools/update-versions (original)
+++ whirr/trunk/build-tools/update-versions Fri Feb 17 09:09:41 2012
@@ -53,31 +53,35 @@ def edit_pom(file)
   pom = read_pom(file)
   yield pom
   write(file, pom)
+  find_modules(pom).sort.each do |mod_name|
+    child_file = "#{File.dirname(file)}/#{mod_name}/pom.xml"
+    edit_pom(child_file) do |pom|
+      update_element(pom.at("/project/version"))
+      update_element(pom.at("/project/parent/version"))
+    end
+  end
 end
 
-def edit_pom_tree(file)
-  edit_pom(file) do |pom|
-    puts File.dirname(file)
-    modules = []
-    # Add submodules
-    (pom/"project/modules/module").each { |elem| modules << elem.inner_html }
-    # Add submodules which are activated via a profile
-    (pom/"project/profiles/profile/modules/module").each { |elem| modules << elem.inner_html
}
-
-    modules.sort.each do |mod_name|
-      pom_file = "#{File.dirname(file)}/#{mod_name}/pom.xml"
-      edit_pom_tree(pom_file)
-    end
+def find_modules(pom)
+  modules = []
+  # Add submodules
+  (pom/"project/modules/module").each { |elem| modules << elem.inner_html }
+  # Add submodules which are activated via a profile
+  (pom/"project/profiles/profile/modules/module").each { |elem| modules << elem.inner_html
}
 
-    update_element(pom.at("/project/version"))
-    update_element(pom.at("/project/parent/version"))
-  end
+  modules
 end
 
 def update_element(el)
     el.inner_html = $version if el
 end
 
+def update_poms()
+  edit_pom("pom.xml") do |pom|
+    update_element(pom.at("/project/version"))
+  end
+end
+
 puts "Updating to version #{$version} ..."
-edit_pom_tree("pom.xml")
+update_poms()
 



Mime
View raw message