buildr 1.4.12 → 1.4.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +15 -0
  2. data/CHANGELOG +62 -0
  3. data/addon/buildr/checkstyle.rb +6 -4
  4. data/addon/buildr/gpg.rb +9 -2
  5. data/addon/buildr/gwt.rb +1 -0
  6. data/buildr.gemspec +18 -20
  7. data/doc/download.textile +30 -6
  8. data/doc/index.textile +21 -9
  9. data/doc/packaging.textile +29 -0
  10. data/lib/buildr.rb +3 -0
  11. data/lib/buildr/core/application.rb +24 -0
  12. data/lib/buildr/core/assets.rb +93 -0
  13. data/lib/buildr/core/build.rb +3 -2
  14. data/lib/buildr/core/common.rb +3 -2
  15. data/lib/buildr/core/compile.rb +0 -1
  16. data/lib/buildr/core/generate.rb +2 -2
  17. data/lib/buildr/core/project.rb +1 -1
  18. data/lib/buildr/core/shell.rb +1 -1
  19. data/lib/buildr/core/transports.rb +4 -1
  20. data/lib/buildr/core/util.rb +8 -0
  21. data/lib/buildr/ide/idea.rb +267 -114
  22. data/lib/buildr/java/commands.rb +16 -2
  23. data/lib/buildr/java/packaging.rb +6 -4
  24. data/lib/buildr/java/pom.rb +1 -1
  25. data/lib/buildr/java/tests.rb +3 -3
  26. data/lib/buildr/packaging/archive.rb +4 -3
  27. data/lib/buildr/packaging/package.rb +0 -2
  28. data/lib/buildr/packaging/ziptask.rb +1 -1
  29. data/lib/buildr/version.rb +2 -2
  30. data/rakelib/rspec.rake +5 -49
  31. data/rakelib/stage.rake +7 -5
  32. data/spec/addon/jaxb_xjc_spec.rb +2 -2
  33. data/spec/core/application_spec.rb +8 -8
  34. data/spec/core/build_spec.rb +41 -41
  35. data/spec/core/common_spec.rb +3 -2
  36. data/spec/core/test_spec.rb +34 -34
  37. data/spec/core/transport_spec.rb +21 -17
  38. data/spec/ide/idea_spec.rb +707 -4
  39. data/spec/java/packaging_spec.rb +20 -0
  40. data/spec/java/tests_spec.rb +2 -2
  41. data/spec/packaging/packaging_spec.rb +0 -22
  42. metadata +54 -114
@@ -43,7 +43,7 @@ module Java
43
43
  def java(*args, &block)
44
44
  options = Hash === args.last ? args.pop : {}
45
45
  options[:verbose] ||= trace?(:java)
46
- rake_check_options options, :classpath, :java_args, :properties, :name, :verbose
46
+ rake_check_options options, :classpath, :java_args, :properties, :name, :verbose, :dir
47
47
 
48
48
  name = options[:name]
49
49
  if name.nil?
@@ -63,7 +63,21 @@ module Java
63
63
  end
64
64
  cmd_args << path_to_bin('java')
65
65
  cp = classpath_from(options)
66
- cmd_args << '-classpath' << cp.join(File::PATH_SEPARATOR) unless cp.empty?
66
+ paths = cp.map do |c|
67
+ path = File.directory?(c) && !c.end_with?('/') ? "#{c}/" : c.to_s
68
+ Buildr::Util.win_os? ? "/#{path}" : path
69
+ end
70
+ manifest = Buildr::Packaging::Java::Manifest.new([{'Class-Path' => paths.join(" ")}])
71
+
72
+ tjar = Tempfile.new(['javacmd', '.jar'])
73
+ Zip::ZipOutputStream.open(tjar.path) do |zos|
74
+ zos.put_next_entry('META-INF/MANIFEST.MF')
75
+ zos.write manifest.to_s
76
+ zos.write "\n"
77
+ end
78
+ tjar.close
79
+
80
+ cmd_args << '-classpath' << tjar.path
67
81
  options[:properties].each { |k, v| cmd_args << "-D#{k}=#{v}" } if options[:properties]
68
82
  cmd_args += (options[:java_args] || (ENV['JAVA_OPTS'] || ENV['JAVA_OPTIONS']).to_s.split).flatten
69
83
  cmd_args += args.flatten.compact
@@ -671,8 +671,6 @@ module Buildr #:nodoc:
671
671
  end
672
672
  end
673
673
 
674
- protected
675
-
676
674
  def package_as_jar(file_name) #:nodoc:
677
675
  Java::JarTask.define_task(file_name).tap do |jar|
678
676
  jar.with :manifest=>manifest, :meta_inf=>meta_inf
@@ -687,8 +685,12 @@ module Buildr #:nodoc:
687
685
  war.with :classes=>[compile.target, resources.target].compact
688
686
  war.with :libs=>compile.dependencies
689
687
  # Add included files, or the webapp directory.
690
- webapp = path_to(:source, :main, :webapp)
691
- war.with webapp if File.exist?(webapp)
688
+ assets.paths.each do |asset|
689
+ war.tap do |war|
690
+ war.enhance([asset])
691
+ end
692
+ war.include asset, :as => '.'
693
+ end
692
694
  end
693
695
  end
694
696
 
@@ -179,7 +179,7 @@ module Buildr
179
179
  spec[pair.first] = value_of(element[pair.last], substitute) if element[pair.last]
180
180
  spec
181
181
  }
182
- { :type=>"jar" }.merge(hash)
182
+ {:scope => "compile", :type => "jar"}.merge(hash)
183
183
  end
184
184
 
185
185
  end
@@ -233,7 +233,7 @@ module Buildr #:nodoc:
233
233
  forking = {}
234
234
  when :each
235
235
  forking = { :fork=>true, :forkmode=>'perTest' }
236
- when true, :once
236
+ when nil, true, :once
237
237
  forking = { :fork=>true, :forkmode=>'once' }
238
238
  else
239
239
  fail 'Option fork must be :once, :each or false.'
@@ -296,7 +296,7 @@ module Buildr #:nodoc:
296
296
  # * :args -- Arguments passed to the TestNG command line runner.
297
297
  class TestNG < TestFramework::Java
298
298
 
299
- VERSION = '6.8'
299
+ VERSION = '6.8.5'
300
300
 
301
301
  class << self
302
302
  def version
@@ -389,7 +389,7 @@ module Buildr #:nodoc:
389
389
  fail "Missing :frameworks option" unless options[:frameworks]
390
390
  @frameworks = options[:frameworks].map do |f|
391
391
  framework_options = (options[:options] || {})[f.to_sym] || {}
392
- f.new(task, options)
392
+ f.new(task, framework_options)
393
393
  end
394
394
  end
395
395
 
@@ -312,7 +312,7 @@ module Buildr #:nodoc:
312
312
 
313
313
  # Make sure we're the last enhancements, so other enhancements can add content.
314
314
  enhance do
315
- @file_map = {}
315
+ @file_map = OrderedHash.new
316
316
  enhance do
317
317
  send 'create' if respond_to?(:create)
318
318
  # We're here because the archive file does not exist, or one of the files is newer than the archive contents;
@@ -345,7 +345,8 @@ module Buildr #:nodoc:
345
345
  #
346
346
  # package(:jar).clean.include path_to('desired/content')
347
347
  def clean
348
- @paths = { '' => Path.new(self, '') }
348
+ @paths = OrderedHash.new
349
+ @paths[''] = Path.new(self, '')
349
350
  @prepares = []
350
351
  self
351
352
  end
@@ -469,7 +470,7 @@ module Buildr #:nodoc:
469
470
  @prepares.each { |prepare| prepare.call(self) }
470
471
  @prepares.clear
471
472
 
472
- file_map = {}
473
+ file_map = OrderedHash.new
473
474
  @paths.each do |name, path|
474
475
  path.add_files(file_map)
475
476
  end
@@ -214,8 +214,6 @@ module Buildr #:nodoc:
214
214
  @packages ||= []
215
215
  end
216
216
 
217
- protected
218
-
219
217
  def package_as_zip(file_name) #:nodoc:
220
218
  ZipTask.define_task(file_name)
221
219
  end
@@ -27,7 +27,7 @@ module Buildr #:nodoc:
27
27
  # See Buildr#zip and ArchiveTask.
28
28
  class ZipTask < ArchiveTask
29
29
 
30
- # Compression leve for this Zip.
30
+ # Compression level for this Zip.
31
31
  attr_accessor :compression_level
32
32
 
33
33
  def initialize(*args) #:nodoc:
@@ -14,5 +14,5 @@
14
14
  # the License.
15
15
 
16
16
  module Buildr #:nodoc:
17
- VERSION = '1.4.12'.freeze
18
- end
17
+ VERSION = '1.4.13'.freeze
18
+ end
@@ -17,7 +17,7 @@ require 'rspec/core/rake_task'
17
17
  directory '_reports'
18
18
 
19
19
  def default_spec_opts
20
- default = %w{--format documentation --out _reports/specs.txt --backtrace}
20
+ default = %w{--order random:123 --format documentation --out _reports/specs.txt --backtrace}
21
21
  default << '--colour' if $stdout.isatty && !(RbConfig::CONFIG['host_os'] =~ /mswin|win32|dos/i)
22
22
  default
23
23
  end
@@ -34,24 +34,13 @@ end
34
34
  desc 'Run all specs'
35
35
  RSpec::Core::RakeTask.new :spec => ['_reports', :compile] do |task|
36
36
  ENV['USE_FSC'] = 'no'
37
- task.rspec_files = FileList['spec/**/*_spec.rb']
38
- task.rspec_files.exclude('spec/groovy/*') if RUBY_PLATFORM[/java/]
39
- task.rspec_opts = default_spec_opts
40
- task.rspec_opts = %w{--format html --out _reports/specs.html --backtrace}
37
+ files = FileList['spec/**/*_spec.rb']
38
+ files = files.delete_if {|f| f =~ /^spec\/groovy\//} if RUBY_PLATFORM[/java/]
39
+ task.rspec_files = files
40
+ task.rspec_opts = %w{--order random:123 --format html --out _reports/specs.html --backtrace}
41
41
  end
42
42
  file('_reports/specs.html') { task(:spec).invoke }
43
43
 
44
- desc 'Run RSpec and generate Spec and coverage reports (slow)'
45
- RSpec::Core::RakeTask.new :coverage => ['_reports', :compile] do |task|
46
- ENV['USE_FSC'] = 'no'
47
- task.rspec_files = FileList['spec/**/*_spec.rb']
48
- task.rspec_files.exclude('spec/groovy/*') if RUBY_PLATFORM[/java/]
49
- task.rspec_opts = default_spec_opts
50
- task.rcov = true
51
- task.rcov_opts = %w{-o _reports/coverage --exclude / --include-file ^lib --text-summary}
52
- end
53
- file('_reports/coverage') { task(:coverage).invoke }
54
-
55
44
  task :load_ci_reporter do
56
45
  gem 'ci_reporter'
57
46
  ENV['CI_REPORTS'] = '_reports/ci'
@@ -64,39 +53,6 @@ end
64
53
  desc 'Run all specs with CI reporter'
65
54
  task 'ci' => %w(clobber load_ci_reporter spec)
66
55
 
67
- def rvm_run_in(version, command)
68
- if !(RbConfig::CONFIG['host_os'] =~ /mswin|win32|dos/i)
69
- cmd_prefix = "rvm #{version} exec"
70
- sh "rm -f Gemfile.lock; #{cmd_prefix} bundle install; #{cmd_prefix} bundle exec #{command}"
71
- else
72
- sh "#{version =~ /jruby/ ? "j" : ""}ruby -S #{command}"
73
- end
74
- end
75
-
76
- # Useful for testing with JRuby when using Ruby and vice versa.
77
- namespace 'spec' do
78
- desc 'Run all specs specifically with Ruby 1.9'
79
- task 'ruby_1_9' do
80
- puts 'Running test suite using Ruby ...'
81
- rvm_run_in('ruby-1.9.2-p320@buildr', 'rake spec')
82
- end
83
-
84
- desc 'Run all specs specifically with Ruby 1.8'
85
- task 'ruby_1_8' do
86
- puts 'Running test suite using Ruby ...'
87
- rvm_run_in('ruby-1.8.7-p358@buildr', 'rake spec')
88
- end
89
-
90
- desc 'Run all specs specifically with JRuby'
91
- task 'jruby' do
92
- puts 'Running test suite using JRuby ...'
93
- rvm_run_in('jruby-1.6.7@buildr', 'rake spec')
94
- end
95
-
96
- desc 'Run all specs across various rubies'
97
- task 'all' => %w(jruby ruby_1_8 ruby_1_9)
98
- end
99
-
100
56
  task 'clobber' do
101
57
  rm_f 'failed'
102
58
  rm_rf '_reports'
@@ -19,6 +19,8 @@ require 'digest/sha1'
19
19
 
20
20
  gpg_cmd = 'gpg2'
21
21
 
22
+ STAGE_DATE = '2013-10-02'
23
+
22
24
  task 'prepare' do |task, args|
23
25
  gpg_arg = args.gpg || ENV['gpg']
24
26
 
@@ -45,12 +47,12 @@ task 'prepare' do |task, args|
45
47
  git = `git status -s`
46
48
  fail "Cannot release unless all local changes are in Git:\n#{git}" if git[/^ M/] && ENV["IGNORE_GIT"].nil?
47
49
  puts '[X] There are no local changes, everything is in source control'
48
- end.call
50
+ end.call if false
49
51
 
50
52
  # Make sure we have a valid CHANGELOG entry for this release.
51
53
  lambda do
52
54
  puts 'Checking that CHANGELOG indicates most recent version and today''s date ... '
53
- expecting = "#{spec.version} (#{Time.now.strftime('%Y-%m-%d')})"
55
+ expecting = "#{spec.version} (#{STAGE_DATE})"
54
56
  header = File.readlines('CHANGELOG').first.chomp
55
57
  fail "Expecting CHANGELOG to start with #{expecting}, but found #{header} instead" unless expecting == header
56
58
  puts '[x] CHANGELOG indicates most recent version and today''s date'
@@ -59,7 +61,7 @@ task 'prepare' do |task, args|
59
61
  # Make sure we have a valid CHANGELOG entry for this release.
60
62
  lambda do
61
63
  puts 'Checking that doc/index.textile indicates most recent version and today''s date ... '
62
- expecting = "Highlights from Buildr #{spec.version} (#{Time.now.strftime('%Y-%m-%d')})"
64
+ expecting = "Highlights from Buildr #{spec.version} (#{STAGE_DATE})"
63
65
  content = IO.read('doc/index.textile')
64
66
  fail "Expecting doc/index.textile to contain #{expecting}" unless content.include?(expecting)
65
67
  puts '[x] doc/index.textile indicates most recent version and today''s date'
@@ -116,7 +118,7 @@ task 'stage' => %w(clobber prepare) do |task, args|
116
118
  current = changes[spec.version.to_s]
117
119
  fail "No changeset found for version #{spec.version}" unless current
118
120
  File.open '_staged/CHANGES', 'w' do |file|
119
- file.write "#{spec.version} (#{Time.now.strftime('%Y-%m-%d')})\n"
121
+ file.write "#{spec.version} (#{STAGE_DATE})\n"
120
122
  file.write current
121
123
  end
122
124
  puts '[X] Listed most recent changed in _staged/CHANGES'
@@ -151,7 +153,7 @@ task 'stage' => %w(clobber prepare) do |task, args|
151
153
  %{| "#{name}":#{mirror}/#{name} | "#{md5}":#{official}/#{name}.md5 | "Sig":#{official}/#{name}.asc |}
152
154
  }
153
155
  textile = <<-TEXTILE
154
- h3. #{spec.name} #{spec.version} (#{Time.now.strftime('%Y-%m-%d')})
156
+ h3. #{spec.name} #{spec.version} (#{STAGE_DATE})
155
157
 
156
158
  |_. Package |_. MD5 Checksum |_. PGP |
157
159
  #{rows.join("\n")}
@@ -13,9 +13,9 @@
13
13
  # License for the specific language governing permissions and limitations under
14
14
  # the License.
15
15
 
16
- if Java.java.lang.System.getProperty("java.runtime.version") >= "1.6"
17
-
18
16
  require File.expand_path('../spec_helpers', File.dirname(__FILE__))
17
+
18
+ if Java.java.lang.System.getProperty("java.runtime.version") >= "1.6"
19
19
  Sandbox.require_optional_extension 'buildr/jaxb_xjc'
20
20
 
21
21
  XSD_CONTENT = <<XSD
@@ -33,7 +33,7 @@ describe Buildr::Application do
33
33
  it 'should execute *_load methods in order' do
34
34
  order = [:load_gems, :load_artifact_ns, :load_tasks, :raw_load_buildfile]
35
35
  order.each { |method| Buildr.application.should_receive(method).ordered }
36
- Buildr.application.stub!(:exit) # With this, shows the correct error instead of SystemExit.
36
+ Buildr.application.stub(:exit) # With this, shows the correct error instead of SystemExit.
37
37
  Buildr.application.run
38
38
  end
39
39
 
@@ -43,7 +43,7 @@ describe Buildr::Application do
43
43
  Buildr.application.should_receive(:load_imports)
44
44
  method.call
45
45
  end
46
- Buildr.application.stub!(:exit) # With this, shows the correct error instead of SystemExit.
46
+ Buildr.application.stub(:exit) # With this, shows the correct error instead of SystemExit.
47
47
  Buildr.application.run
48
48
  end
49
49
 
@@ -51,7 +51,7 @@ describe Buildr::Application do
51
51
  Buildr.application.should_receive(:load_imports) do
52
52
  Buildr.should_receive(:projects)
53
53
  end
54
- Buildr.application.stub!(:exit) # With this, shows the correct error instead of SystemExit.
54
+ Buildr.application.stub(:exit) # With this, shows the correct error instead of SystemExit.
55
55
  Buildr.application.run
56
56
  end
57
57
  end
@@ -174,7 +174,7 @@ describe Buildr::Application do
174
174
  spec.name = 'buildr-foo'
175
175
  spec.version = '1.2'
176
176
  end
177
- $stdout.stub!(:isatty).and_return(true)
177
+ $stdout.stub(:isatty).and_return(true)
178
178
  end
179
179
 
180
180
  it 'should do nothing if no gems specified' do
@@ -495,19 +495,19 @@ describe Buildr, 'settings' do
495
495
  end
496
496
 
497
497
  it 'should have the same timestamp as the buildfile' do
498
- Buildr.application.buildfile.timestamp.should be_close(@buildfile_time, 1)
498
+ Buildr.application.buildfile.timestamp.should be_within(1).of(@buildfile_time)
499
499
  end
500
500
 
501
501
  it 'should have the same timestamp as build.yaml if the latter is newer' do
502
502
  write 'build.yaml'; File.utime(@buildfile_time + 5, @buildfile_time + 5, 'build.yaml')
503
503
  Buildr.application.run
504
- Buildr.application.buildfile.timestamp.should be_close(@buildfile_time + 5, 1)
504
+ Buildr.application.buildfile.timestamp.should be_within(1).of(@buildfile_time + 5)
505
505
  end
506
506
 
507
507
  it 'should have the same timestamp as the buildfile if build.yaml is older' do
508
508
  write 'build.yaml'; File.utime(@buildfile_time - 5, @buildfile_time - 5, 'build.yaml')
509
509
  Buildr.application.run
510
- Buildr.application.buildfile.timestamp.should be_close(@buildfile_time, 1)
510
+ Buildr.application.buildfile.timestamp.should be_within(1).of(@buildfile_time)
511
511
  end
512
512
 
513
513
  it 'should have the same timestamp as build.rb in home dir if the latter is newer (until version 1.6)' do
@@ -530,7 +530,7 @@ describe Buildr, 'settings' do
530
530
  def buildfile_should_have_same_timestamp_as(file)
531
531
  write file; File.utime(@buildfile_time + 5, @buildfile_time + 5, file)
532
532
  Buildr.application.send :load_tasks
533
- Buildr.application.buildfile.timestamp.should be_close(@buildfile_time + 5, 1)
533
+ Buildr.application.buildfile.timestamp.should be_within(1).of(@buildfile_time + 5)
534
534
  end
535
535
  end
536
536
  end
@@ -335,16 +335,16 @@ end # of Git
335
335
  describe Svn do
336
336
  describe '#tag' do
337
337
  it 'should remove any existing tag with the same name' do
338
- Svn.stub!(:repo_url).and_return('http://my.repo.org/foo/trunk')
339
- Svn.stub!(:copy)
338
+ Svn.stub(:repo_url).and_return('http://my.repo.org/foo/trunk')
339
+ Svn.stub(:copy)
340
340
  Svn.should_receive(:remove).with('http://my.repo.org/foo/tags/1.0.0', 'Removing old copy')
341
341
 
342
342
  Svn.tag '1.0.0'
343
343
  end
344
344
 
345
345
  it 'should do an svn copy with the release version' do
346
- Svn.stub!(:repo_url).and_return('http://my.repo.org/foo/trunk')
347
- Svn.stub!(:remove)
346
+ Svn.stub(:repo_url).and_return('http://my.repo.org/foo/trunk')
347
+ Svn.stub(:remove)
348
348
  Svn.should_receive(:copy).with(Dir.pwd, 'http://my.repo.org/foo/tags/1.0.0', 'Release 1.0.0')
349
349
 
350
350
  Svn.tag '1.0.0'
@@ -444,47 +444,47 @@ shared_examples_for 'a release process' do
444
444
  before do
445
445
  write 'buildfile', "VERSION_NUMBER = '1.0.0-SNAPSHOT'"
446
446
  # Prevent a real call to a spawned buildr process.
447
- @release.stub!(:buildr)
448
- @release.stub!(:check)
449
- @release.should_receive(:ruby).with('-S', 'buildr', "_#{Buildr::VERSION}_", '--buildfile', File.expand_path('buildfile.next'),
447
+ @release.stub(:buildr)
448
+ @release.stub(:check)
449
+ @release.should_receive(:sh).with('buildr', '--buildfile', File.expand_path('buildfile.next'),
450
450
  '--environment', 'development', 'clean', 'upload', 'DEBUG=no')
451
451
  end
452
452
 
453
453
  it 'should tag a release with the release version' do
454
- @release.stub!(:update_version_to_next)
454
+ @release.stub(:update_version_to_next)
455
455
  @release.should_receive(:tag_release).with('1.0.0')
456
456
  @release.make
457
457
  end
458
458
 
459
459
  it 'should not alter the buildfile before tagging' do
460
- @release.stub!(:update_version_to_next)
460
+ @release.stub(:update_version_to_next)
461
461
  @release.should_receive(:tag_release).with('1.0.0')
462
462
  @release.make
463
463
  file('buildfile').should contain('VERSION_NUMBER = "1.0.0"')
464
464
  end
465
465
 
466
466
  it 'should update the buildfile with the next version number' do
467
- @release.stub!(:tag_release)
467
+ @release.stub(:tag_release)
468
468
  @release.make
469
469
  file('buildfile').should contain('VERSION_NUMBER = "1.0.1-SNAPSHOT"')
470
470
  end
471
471
 
472
472
  it 'should keep leading zeros in the next version number' do
473
473
  write 'buildfile', "VERSION_NUMBER = '1.0.001-SNAPSHOT'"
474
- @release.stub!(:tag_release)
474
+ @release.stub(:tag_release)
475
475
  @release.make
476
476
  file('buildfile').should contain('VERSION_NUMBER = "1.0.002-SNAPSHOT"')
477
477
  end
478
478
 
479
479
  it 'should commit the updated buildfile' do
480
- @release.stub!(:tag_release)
480
+ @release.stub(:tag_release)
481
481
  @release.make
482
482
  file('buildfile').should contain('VERSION_NUMBER = "1.0.1-SNAPSHOT"')
483
483
  end
484
484
 
485
485
  it 'should not consider "-rc" as "-SNAPSHOT"' do
486
486
  write 'buildfile', "VERSION_NUMBER = '1.0.0-rc1'"
487
- @release.stub!(:tag_release)
487
+ @release.stub(:tag_release)
488
488
  @release.make
489
489
  file('buildfile').should contain('VERSION_NUMBER = "1.0.0-rc1"')
490
490
  end
@@ -492,7 +492,7 @@ shared_examples_for 'a release process' do
492
492
  it 'should only commit the updated buildfile if the version changed' do
493
493
  write 'buildfile', "VERSION_NUMBER = '1.0.0-rc1'"
494
494
  @release.should_not_receive(:update_version_to_next)
495
- @release.stub!(:tag_release)
495
+ @release.stub(:tag_release)
496
496
  @release.make
497
497
  end
498
498
  end
@@ -631,7 +631,7 @@ shared_examples_for 'a release process' do
631
631
 
632
632
  describe '#resolve_tag' do
633
633
  before do
634
- @release.stub!(:extract_version).and_return('1.0.0')
634
+ @release.stub(:extract_version).and_return('1.0.0')
635
635
  end
636
636
 
637
637
  it 'should return tag specified by tag_name' do
@@ -648,7 +648,7 @@ shared_examples_for 'a release process' do
648
648
 
649
649
  describe '#tag_release' do
650
650
  it 'should inform the user' do
651
- @release.stub!(:extract_version).and_return('1.0.0')
651
+ @release.stub(:extract_version).and_return('1.0.0')
652
652
  lambda { @release.tag_release('1.0.0') }.should show_info('Tagging release 1.0.0')
653
653
  end
654
654
  end
@@ -682,7 +682,7 @@ shared_examples_for 'a release process' do
682
682
 
683
683
  describe '#with_release_candidate_version' do
684
684
  before do
685
- Buildr.application.stub!(:buildfile).and_return(file('buildfile'))
685
+ Buildr.application.stub(:buildfile).and_return(file('buildfile'))
686
686
  write 'buildfile', "THIS_VERSION = '1.1.0-SNAPSHOT'"
687
687
  end
688
688
 
@@ -741,7 +741,7 @@ shared_examples_for 'a release process' do
741
741
  describe '#check' do
742
742
  before { @release.send(:this_version=, "1.0.0-SNAPSHOT") }
743
743
  it 'should fail if THIS_VERSION equals the next_version' do
744
- @release.stub!(:resolve_next_version).and_return('1.0.0-SNAPSHOT')
744
+ @release.stub(:resolve_next_version).and_return('1.0.0-SNAPSHOT')
745
745
  lambda { @release.check }.should raise_error("The next version can't be equal to the current version 1.0.0-SNAPSHOT.\nUpdate THIS_VERSION/VERSION_NUMBER, specify Release.next_version or use NEXT_VERSION env var")
746
746
  end
747
747
  end
@@ -754,9 +754,9 @@ describe HgRelease do
754
754
  before do
755
755
  write 'buildfile', "VERSION_NUMBER = '1.0.0-SNAPSHOT'"
756
756
  @release = HgRelease.new
757
- Hg.stub!(:hg)
758
- Hg.stub!(:remote).and_return('https://bitbucket.org/sample-repo')
759
- Hg.stub!(:current_branch).and_return('default')
757
+ Hg.stub(:hg)
758
+ Hg.stub(:remote).and_return('https://bitbucket.org/sample-repo')
759
+ Hg.stub(:current_branch).and_return('default')
760
760
  end
761
761
 
762
762
  describe '#applies_to?' do
@@ -806,8 +806,8 @@ describe GitRelease do
806
806
  before do
807
807
  write 'buildfile', "VERSION_NUMBER = '1.0.0-SNAPSHOT'"
808
808
  @release = GitRelease.new
809
- Git.stub!(:git)
810
- Git.stub!(:current_branch).and_return('master')
809
+ Git.stub(:git)
810
+ Git.stub(:current_branch).and_return('master')
811
811
  end
812
812
 
813
813
  describe '#applies_to?' do
@@ -866,13 +866,13 @@ EOF
866
866
  describe '#tag_release' do
867
867
  before do
868
868
  @release = GitRelease.new
869
- @release.stub!(:extract_version).and_return('1.0.1')
870
- @release.stub!(:resolve_tag).and_return('TEST_TAG')
871
- Git.stub!(:git).with('tag', '-a', 'TEST_TAG', '-m', '[buildr] Cutting release TEST_TAG')
872
- Git.stub!(:git).with('push', 'origin', 'tag', 'TEST_TAG')
873
- Git.stub!(:commit)
874
- Git.stub!(:push)
875
- Git.stub!(:remote).and_return('origin')
869
+ @release.stub(:extract_version).and_return('1.0.1')
870
+ @release.stub(:resolve_tag).and_return('TEST_TAG')
871
+ Git.stub(:git).with('tag', '-a', 'TEST_TAG', '-m', '[buildr] Cutting release TEST_TAG')
872
+ Git.stub(:git).with('push', 'origin', 'tag', 'TEST_TAG')
873
+ Git.stub(:commit)
874
+ Git.stub(:push)
875
+ Git.stub(:remote).and_return('origin')
876
876
  end
877
877
 
878
878
  it 'should delete any existing tag with the same name' do
@@ -895,7 +895,7 @@ EOF
895
895
  end
896
896
 
897
897
  it 'should NOT push the tag if no remote is tracked' do
898
- Git.stub!(:remote).and_return(nil)
898
+ Git.stub(:remote).and_return(nil)
899
899
  Git.should_not_receive(:git).with('push', 'origin', 'tag', 'TEST_TAG')
900
900
  @release.tag_release 'TEST_TAG'
901
901
  end
@@ -909,9 +909,9 @@ describe SvnRelease do
909
909
  before do
910
910
  write 'buildfile', "VERSION_NUMBER = '1.0.0-SNAPSHOT'"
911
911
  @release = SvnRelease.new
912
- Svn.stub!(:svn)
913
- Svn.stub!(:repo_url).and_return('http://my.repo.org/foo/trunk')
914
- Svn.stub!(:tag)
912
+ Svn.stub(:svn)
913
+ Svn.stub(:repo_url).and_return('http://my.repo.org/foo/trunk')
914
+ Svn.stub(:tag)
915
915
  end
916
916
 
917
917
  describe '#applies_to?' do
@@ -927,34 +927,34 @@ describe SvnRelease do
927
927
 
928
928
  describe '#check' do
929
929
  before do
930
- Svn.stub!(:uncommitted_files).and_return([])
930
+ Svn.stub(:uncommitted_files).and_return([])
931
931
  @release = SvnRelease.new
932
932
  @release.send(:this_version=, "1.0.0-SNAPSHOT")
933
933
  end
934
934
 
935
935
  it 'should accept to release from the trunk' do
936
- Svn.stub!(:repo_url).and_return('http://my.repo.org/foo/trunk')
936
+ Svn.stub(:repo_url).and_return('http://my.repo.org/foo/trunk')
937
937
  lambda { @release.check }.should_not raise_error
938
938
  end
939
939
 
940
940
  it 'should accept to release from a branch' do
941
- Svn.stub!(:repo_url).and_return('http://my.repo.org/foo/branches/1.0')
941
+ Svn.stub(:repo_url).and_return('http://my.repo.org/foo/branches/1.0')
942
942
  lambda { @release.check }.should_not raise_error
943
943
  end
944
944
 
945
945
  it 'should reject releasing from a tag' do
946
- Svn.stub!(:repo_url).and_return('http://my.repo.org/foo/tags/1.0.0')
946
+ Svn.stub(:repo_url).and_return('http://my.repo.org/foo/tags/1.0.0')
947
947
  lambda { @release.check }.should raise_error(RuntimeError, "SVN URL must contain 'trunk' or 'branches/...'")
948
948
  end
949
949
 
950
950
  it 'should reject a non standard repository layout' do
951
- Svn.stub!(:repo_url).and_return('http://my.repo.org/foo/bar')
951
+ Svn.stub(:repo_url).and_return('http://my.repo.org/foo/bar')
952
952
  lambda { @release.check }.should raise_error(RuntimeError, "SVN URL must contain 'trunk' or 'branches/...'")
953
953
  end
954
954
 
955
955
  it 'should reject an uncommitted file' do
956
- Svn.stub!(:repo_url).and_return('http://my.repo.org/foo/trunk')
957
- Svn.stub!(:uncommitted_files).and_return(['foo.rb'])
956
+ Svn.stub(:repo_url).and_return('http://my.repo.org/foo/trunk')
957
+ Svn.stub(:uncommitted_files).and_return(['foo.rb'])
958
958
  lambda { @release.check }.should raise_error(RuntimeError,
959
959
  "Uncommitted files violate the First Principle Of Release!\n" +
960
960
  "foo.rb")