You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by as...@apache.org on 2008/05/19 23:49:49 UTC

svn commit: r657998 - /incubator/buildr/trunk/rakelib/release.rake

Author: assaf
Date: Mon May 19 14:49:49 2008
New Revision: 657998

URL: http://svn.apache.org/viewvc?rev=657998&view=rev
Log:
next_version tasks now updates version number in buildr.rb and buildr.gemspec.

Modified:
    incubator/buildr/trunk/rakelib/release.rake

Modified: incubator/buildr/trunk/rakelib/release.rake
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/rakelib/release.rake?rev=657998&r1=657997&r2=657998&view=diff
==============================================================================
--- incubator/buildr/trunk/rakelib/release.rake (original)
+++ incubator/buildr/trunk/rakelib/release.rake Mon May 19 14:49:49 2008
@@ -38,10 +38,11 @@
 
 
 task 'next_version' do
+  next_version = spec.version.to_s.split('.').map { |v| v.to_i }.
+    zip([0, 0, 1]).map { |a| a.inject(0) { |t,i| t + i } }.join('.')
+
   ver_file = "lib/#{spec.name}.rb"
   if File.exist?(ver_file)
-    next_version = spec.version.to_s.split('.').map { |v| v.to_i }.
-      zip([0, 0, 1]).map { |a| a.inject(0) { |t,i| t + i } }.join('.')
     print "Updating #{ver_file} to next version number (#{next_version}) ... "
     modified = File.read(ver_file).sub(/(VERSION\s*=\s*)(['"])(.*)\2/) { |line| "#{$1}#{$2}#{next_version}#{$2}" } 
     File.open ver_file, 'w' do |file|
@@ -49,6 +50,16 @@
     end
     puts 'Done'
   end
+
+  spec_file = "#{spec.name}.gemspec"
+  if File.exist?(spec_file)
+    print "Updating #{spec_file} to next version number (#{next_version}) ... "
+    modified = File.read(spec_file).sub(/(s(?:pec)?\.version\s*=\s*)(['"])(.*)\2/) { |line| "#{$1}#{$2}#{next_version}#{$2}" } 
+    File.open spec_file, 'w' do |file|
+      file.write modified
+    end
+    puts 'Done'
+  end
 end
 
 task 'release:wrapup'=>'next_version'