You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by bo...@apache.org on 2009/07/30 23:14:42 UTC

svn commit: r799441 - in /buildr/trunk: CHANGELOG lib/buildr/core/build.rb spec/core/build_spec.rb

Author: boisvert
Date: Thu Jul 30 21:14:42 2009
New Revision: 799441

URL: http://svn.apache.org/viewvc?rev=799441&view=rev
Log:
BUILDR-282: release goal should not strip leading '0' digits from version numbers

Modified:
    buildr/trunk/CHANGELOG
    buildr/trunk/lib/buildr/core/build.rb
    buildr/trunk/spec/core/build_spec.rb

Modified: buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=799441&r1=799440&r2=799441&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Thu Jul 30 21:14:42 2009
@@ -11,6 +11,7 @@
 * Change: Updated to Rake 0.8.7, RSpec 1.2.6 and JRuby-openssl 0.5.1.
 * Fixed:  BUILDR-292 Workaround for JRUBY-3381 on FileUtils.mv
 * Fixed:  BUILDR-23 Support for setting file mode when packaging (Ittay Dror).
+* Fixed:  BUILDR-282 release goal should not strip leading '0' digits from version numbers.
 * Fixed:  BUILDR-290 Dependencies cannot be downloaded over SSL.
 * Fixed:  BUILDR-291 Local tasks do not support arguments (Ittay Dror).
 

Modified: buildr/trunk/lib/buildr/core/build.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/build.rb?rev=799441&r1=799440&r2=799441&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/build.rb (original)
+++ buildr/trunk/lib/buildr/core/build.rb Thu Jul 30 21:14:42 2009
@@ -311,7 +311,7 @@
     # for the release buildfile.
     def with_release_candidate_version
       release_candidate_buildfile = Buildr.application.buildfile.to_s + '.next'
-      release_candidate_buildfile_contents = change_version { |version| version[-1] = version[-1].to_i }
+      release_candidate_buildfile_contents = change_version { |version| version[-1] = version[-1].split('-')[0] }
       File.open(release_candidate_buildfile, 'w') { |file| file.write release_candidate_buildfile_contents }
       begin
         yield release_candidate_buildfile
@@ -348,7 +348,7 @@
 
     # Move the version to next and save the updated buildfile
     def update_buildfile
-      buildfile = change_version { |version| version[-1] = (version[-1].to_i + 1).to_s + '-SNAPSHOT' }
+      buildfile = change_version { |version| version[-1] = sprintf("%0#{version[-1].size}d", version[-1].to_i + 1) + '-SNAPSHOT' }
       File.open(Buildr.application.buildfile.to_s, 'w') { |file| file.write buildfile }
     end
 

Modified: buildr/trunk/spec/core/build_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/core/build_spec.rb?rev=799441&r1=799440&r2=799441&view=diff
==============================================================================
--- buildr/trunk/spec/core/build_spec.rb (original)
+++ buildr/trunk/spec/core/build_spec.rb Thu Jul 30 21:14:42 2009
@@ -383,6 +383,13 @@
       file('buildfile').should contain('VERSION_NUMBER = "1.0.1-SNAPSHOT"')
     end
 
+    it 'should keep leading zeros in the next version number' do
+      write 'buildfile', "VERSION_NUMBER = '1.0.001-SNAPSHOT'"
+      @release.stub!(:tag_release)
+      @release.make
+      file('buildfile').should contain('VERSION_NUMBER = "1.0.002-SNAPSHOT"')
+    end
+
     it 'should commit the updated buildfile' do
       @release.stub!(:tag_release)
       @release.make