buildr 1.4.9-java → 1.4.10-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -137,7 +137,7 @@ module Buildr::Scala
137
137
  when Buildr::Scala.version?("2.9")
138
138
  '1.11'
139
139
  else
140
- fail "No default specs2 version for Scala #{Scala.version_without_build}"
140
+ '1.12.3' # default for Scala 2.10 and beyond
141
141
  end
142
142
 
143
143
  class << self
@@ -84,30 +84,6 @@ module Buildr::Scala
84
84
  DEFAULT_SBT_VERSION = '0.12.0'
85
85
  DEFAULT_JLINE_VERSION = '1.0'
86
86
 
87
- # The scalac compiler jars are added to classpath at load time,
88
- # if you want to customize artifact versions, you must set them on the
89
- #
90
- # artifact_ns['Buildr::Compiler::Scalac'].library = '2.7.5'
91
- #
92
- # namespace before this file is required. This is of course, only
93
- # if SCALA_HOME is not set or invalid.
94
- REQUIRES = ArtifactNamespace.for(self) do |ns|
95
- version = Buildr.settings.build['scala.version'] || DEFAULT_VERSION
96
- ns.library! 'org.scala-lang:scala-library:jar:>=' + version
97
- ns.compiler! 'org.scala-lang:scala-compiler:jar:>=' + version
98
- end
99
-
100
- ZINC_REQUIRES = ArtifactNamespace.for(self) do |ns|
101
- zinc_version = Buildr.settings.build['zinc.version'] || DEFAULT_ZINC_VERSION
102
- sbt_version = Buildr.settings.build['sbt.version'] || DEFAULT_SBT_VERSION
103
- jline_version = Buildr.settings.build['jline.version'] || DEFAULT_JLINE_VERSION
104
- ns.zinc! "com.typesafe.zinc:zinc:jar:>=#{zinc_version}"
105
- ns.sbt_interface! "com.typesafe.sbt:sbt-interface:jar:>=#{sbt_version}"
106
- ns.incremental! "com.typesafe.sbt:incremental-compiler:jar:>=#{sbt_version}"
107
- ns.compiler_interface_sources! "com.typesafe.sbt:compiler-interface:jar:sources:>=#{sbt_version}"
108
- ns.jline! "jline:jline:jar:>=#{jline_version}"
109
- end
110
-
111
87
  class << self
112
88
  def scala_home
113
89
  env_home = ENV['SCALA_HOME']
@@ -140,7 +116,7 @@ module Buildr::Scala
140
116
 
141
117
  zinc_dependencies = ZINC_REQUIRES.artifacts.map(&:to_s)
142
118
 
143
- scala_dependencies + zinc_dependencies
119
+ (scala_dependencies + zinc_dependencies).compact
144
120
  end
145
121
 
146
122
  def use_fsc
@@ -156,6 +132,35 @@ module Buildr::Scala
156
132
  end
157
133
  end
158
134
 
135
+ # The scalac compiler jars are added to classpath at load time,
136
+ # if you want to customize artifact versions, you must set them on the
137
+ #
138
+ # artifact_ns['Buildr::Compiler::Scalac'].library = '2.7.5'
139
+ #
140
+ # namespace before this file is required. This is of course, only
141
+ # if SCALA_HOME is not set or invalid.
142
+ REQUIRES = ArtifactNamespace.for(self) do |ns|
143
+ version = Buildr.settings.build['scala.version'] || DEFAULT_VERSION
144
+ ns.library! 'org.scala-lang:scala-library:jar:>=' + version
145
+ ns.compiler! 'org.scala-lang:scala-compiler:jar:>=' + version
146
+ unless Buildr::Scala.version?(2.7, 2.8, 2.9)
147
+ # added in Scala 2.10
148
+ ns.reflect! 'org.scala-lang:scala-reflect:jar:>=' + version
149
+ ns.actors! 'org.scala-lang:scala-actors:jar:>=' + version
150
+ end
151
+ end
152
+
153
+ ZINC_REQUIRES = ArtifactNamespace.for(self) do |ns|
154
+ zinc_version = Buildr.settings.build['zinc.version'] || DEFAULT_ZINC_VERSION
155
+ sbt_version = Buildr.settings.build['sbt.version'] || DEFAULT_SBT_VERSION
156
+ jline_version = Buildr.settings.build['jline.version'] || DEFAULT_JLINE_VERSION
157
+ ns.zinc! "com.typesafe.zinc:zinc:jar:>=#{zinc_version}"
158
+ ns.sbt_interface! "com.typesafe.sbt:sbt-interface:jar:>=#{sbt_version}"
159
+ ns.incremental! "com.typesafe.sbt:incremental-compiler:jar:>=#{sbt_version}"
160
+ ns.compiler_interface_sources! "com.typesafe.sbt:compiler-interface:jar:sources:>=#{sbt_version}"
161
+ ns.jline! "jline:jline:jar:>=#{jline_version}"
162
+ end
163
+
159
164
  Javac = Buildr::Compiler::Javac
160
165
 
161
166
  OPTIONS = [:warnings, :deprecation, :optimise, :target, :debug, :other, :javac]
@@ -239,8 +244,6 @@ module Buildr::Scala
239
244
 
240
245
  def compile_with_zinc(sources, target, dependencies) #:nodoc:
241
246
 
242
- java_sources = java_sources(sources)
243
-
244
247
  dependencies.unshift target
245
248
 
246
249
  cmd_args = []
@@ -262,9 +265,8 @@ module Buildr::Scala
262
265
  unless Buildr.application.options.dryrun
263
266
  trace((['com.typesafe.zinc.Main.main'] + cmd_args).join(' '))
264
267
 
265
- Java.load
266
268
  begin
267
- Java.com.typesafe.zinc.Main.main(cmd_args.to_java(Java.java.lang.String))
269
+ Java::Commands.java 'com.typesafe.zinc.Main', *(cmd_args + [{ :classpath => Scalac.dependencies}])
268
270
  rescue => e
269
271
  fail "Zinc compiler crashed:\n#{e.inspect}\n#{e.backtrace.join("\n")}"
270
272
  end
@@ -88,7 +88,6 @@ module Buildr
88
88
  when Buildr::Scala.version?("2.7")
89
89
  [ "org.scala-tools:vscaladoc:jar:#{VERSION}" ]
90
90
  else
91
- warn "VScaladoc does not support Scala 2.8+"
92
91
  []
93
92
  end
94
93
  end
@@ -14,5 +14,5 @@
14
14
  # the License.
15
15
 
16
16
  module Buildr
17
- VERSION = '1.4.9'.freeze
17
+ VERSION = '1.4.10'.freeze
18
18
  end
@@ -22,12 +22,12 @@ task 'all-in-one' => 'all-in-one:all-in-one'
22
22
 
23
23
  namespace 'all-in-one' do
24
24
 
25
- version = '1.6.7'
25
+ version = '1.7.0'
26
26
  jruby_distro = "jruby-bin-#{version}.tar.gz"
27
27
  url = "http://jruby.org.s3.amazonaws.com/downloads/#{version}/#{jruby_distro}"
28
28
  dir = "jruby-#{version}"
29
29
 
30
- task 'all-in-one' => %w(gem prepare download_and_extract clean_dist install_dependencies add_execs package)
30
+ task 'all-in-one' => %w(gem prepare download_and_extract install_dependencies clean_dist package)
31
31
 
32
32
  desc 'Prepare to run'
33
33
  task 'prepare' do
@@ -60,44 +60,24 @@ namespace 'all-in-one' do
60
60
  desc 'Cleanup JRuby distribution'
61
61
  task 'clean_dist' do
62
62
  puts 'Cleaning...'
63
+ mv 'tool/nailgun/ng.exe', 'bin'
64
+ rm_rf 'tool'
63
65
  rm_rf 'docs'
64
- mkpath 'jruby-docs'
65
- mv Dir['COPYING*'], 'jruby-docs'
66
- mv Dir['LICENSE*'], 'jruby-docs'
67
- mv 'README', 'jruby-docs'
68
- rm_rf 'lib/ruby/1.9'
69
- rm_rf 'lib/ruby/gems/1.8/doc'
66
+ rm_rf 'lib/ruby/1.8'
67
+ rm_rf 'lib/ruby/gems/1.9/doc'
68
+ rm_rf 'lib/ruby/gems/shared/doc'
70
69
  rm_rf 'samples'
71
- rm_rf 'share'
72
70
  end
73
71
 
74
72
  desc 'Install Buildr gem and dependencies'
75
73
  task 'install_dependencies' do
76
- puts 'Install ffi-ncurses'
77
- sh 'bin/jruby -S gem install -b ffi-ncurses --version 0.4.0'
78
-
79
- puts 'Install rubygems-update'
80
- sh 'bin/jruby -S gem install -b rubygems-update'
81
-
82
- # Disabled until we can figure out why it does not work in the CI
83
- #puts 'Upgrade Rubygems'
84
- #sh 'bin/jruby -S gem update --system'
85
-
86
74
  puts 'Install Buildr gem ...'
87
- sh 'bin/jruby', '-S', 'gem', 'install', FileList['../../pkg/*-java.gem'].first,
88
- '--no-rdoc', '--no-ri'
75
+ java_gem = FileList["../../pkg/buildr-#{spec.version}-java.gem"].first
76
+ command = ['bin/jruby', '-S', 'gem', 'install', java_gem, '--no-rdoc', '--no-ri', '--env-shebang']
77
+ system({'GEM_HOME' => nil, 'GEM_PATH' => nil, 'MY_RUBY_HOME' => nil, 'RUBYOPT' => nil}, *command)
89
78
  puts '[X] Install Buildr gem'
90
79
  end
91
80
 
92
- desc 'Add Buildr executables/scripts'
93
- task 'add_execs' do
94
- cp 'bin/jruby.exe', 'bin/_buildr.exe'
95
- cp "#{workspace_dir}/all-in-one/buildr", 'bin/buildr'
96
- cp "#{workspace_dir}/all-in-one/_buildr", 'bin/_buildr'
97
- cp "#{workspace_dir}/all-in-one/buildr.cmd", 'bin/buildr.cmd'
98
- File.chmod(0500, 'bin/_buildr', 'bin/buildr')
99
- end
100
-
101
81
  desc 'Package distribution'
102
82
  task 'package' do
103
83
  pkg_dir = "#{workspace_dir}/pkg"
@@ -105,7 +85,13 @@ namespace 'all-in-one' do
105
85
  puts 'Zipping distribution ...'
106
86
  cd '..'
107
87
  new_dir = "#{spec.name}-all-in-one-#{spec.version}"
108
- mv dir, new_dir
88
+ rm_rf new_dir
89
+ mkdir new_dir
90
+ mv dir, "#{new_dir}/embedded"
91
+ mkdir "#{new_dir}/bin"
92
+ cp "#{workspace_dir}/all-in-one/buildr", "#{new_dir}/bin/buildr"
93
+ cp "#{workspace_dir}/all-in-one/buildr.cmd", "#{new_dir}/bin/buildr.cmd"
94
+ File.chmod(0500, "#{new_dir}/bin/buildr", "#{new_dir}/bin/buildr.cmd")
109
95
  zip = "#{pkg_dir}/#{new_dir}.zip"
110
96
  rm zip if File.exist? zip
111
97
  sh 'zip', '-q', '-r', zip, new_dir
data/rakelib/release.rake CHANGED
@@ -132,7 +132,7 @@ task 'release' do
132
132
  </Version>
133
133
  </release>
134
134
  DOAP
135
- modified = File.read(doap_file).sub(/^ \<category.* \/\>$/) { |category_line| "#{category_line}\n#{textile}" }
135
+ modified = File.read(doap_file).sub(/^ \<category.* \/\>$/) { |category_line| "#{category_line}\n#{doap_entry}" }
136
136
  File.open doap_file, 'w' do |file|
137
137
  file.write modified
138
138
  end
data/rakelib/stage.rake CHANGED
@@ -45,7 +45,7 @@ task 'prepare' do |task, args|
45
45
  git = `git status -s`
46
46
  fail "Cannot release unless all local changes are in Git:\n#{git}" if git[/^ M/] && ENV["IGNORE_GIT"].nil?
47
47
  puts '[X] There are no local changes, everything is in source control'
48
- end.call
48
+ end
49
49
 
50
50
  # Make sure we have a valid CHANGELOG entry for this release.
51
51
  lambda do
@@ -54,7 +54,7 @@ task 'prepare' do |task, args|
54
54
  header = File.readlines('CHANGELOG').first.chomp
55
55
  fail "Expecting CHANGELOG to start with #{expecting}, but found #{header} instead" unless expecting == header
56
56
  puts '[x] CHANGELOG indicates most recent version and today''s date'
57
- end.call
57
+ end
58
58
 
59
59
  # Need GPG to sign the packages.
60
60
  lambda do
@@ -92,6 +92,13 @@ task 'stage' => %w(clobber prepare) do |task, args|
92
92
  gpg_arg = args.gpg || ENV['gpg']
93
93
  mkpath '_staged'
94
94
 
95
+ lambda do
96
+ puts 'Ensuring all files have appropraite group and other permissions...'
97
+ sh 'find . -type f | xargs chmod go+r'
98
+ sh 'find . -type d | xargs chmod go+rx'
99
+ puts '[X] File permissions updated/validted.'
100
+ end.call
101
+
95
102
  # Start by figuring out what has changed.
96
103
  lambda do
97
104
  puts 'Looking for changes between this release and previous one ...'
@@ -296,7 +296,7 @@ describe Buildr::Application do
296
296
  it 'should not load files from the rakelib more than once' do
297
297
  write_task 'tasks/new_one.rake'
298
298
  write_task 'tasks/already.rake'
299
- $LOADED_FEATURES << 'tasks/already.rake'
299
+ $LOADED_FEATURES << File.expand_path('tasks/already.rake')
300
300
 
301
301
  loaded_tasks.should have(1).task
302
302
  loaded_tasks.first.should =~ %r{tasks/new_one\.rake$}
data/spec/core/cc_spec.rb CHANGED
@@ -225,7 +225,6 @@ describe Buildr::CCTask do
225
225
 
226
226
  project("container").tap do |p|
227
227
  p.compile.run_count.should == 1 # not_needed
228
- p.test.compile.run_count.should == 1 # not_needed
229
228
  p.resources.run_count.should == 2
230
229
  end
231
230
  File.mtime("foo/target/classes/Example.class").should_not == tstamp
@@ -236,7 +235,6 @@ describe Buildr::CCTask do
236
235
 
237
236
  project("container").tap do |p|
238
237
  p.compile.run_count.should == 2
239
- p.test.compile.run_count.should == 2
240
238
  p.resources.run_count.should == 3
241
239
  end
242
240
 
@@ -671,22 +671,22 @@ describe Buildr::TestTask, '#invoke' do
671
671
  end
672
672
 
673
673
  it 'should not run tests if nothing changed' do
674
- lambda { test_task.invoke }.should_not run_task('foo:test')
674
+ lambda { test_task.invoke; sleep 1 }.should_not run_task('foo:test')
675
675
  end
676
676
 
677
677
  it 'should run tests if options.test is :all' do
678
678
  Buildr.options.test = :all
679
- lambda { test_task.invoke }.should run_task('foo:test')
679
+ lambda { test_task.invoke; sleep 1 }.should run_task('foo:test')
680
680
  end
681
681
 
682
682
  it 'should run tests if main compile target changed' do
683
683
  touch project('foo').compile.target.to_s
684
- lambda { test_task.invoke }.should run_task('foo:test')
684
+ lambda { test_task.invoke; sleep 1 }.should run_task('foo:test')
685
685
  end
686
686
 
687
687
  it 'should run tests if test compile target changed' do
688
688
  touch test_task.compile.target.to_s
689
- lambda { test_task.invoke }.should run_task('foo:test')
689
+ lambda { test_task.invoke; sleep 1 }.should run_task('foo:test')
690
690
  end
691
691
 
692
692
  it 'should run tests if main resources changed' do
@@ -696,27 +696,27 @@ describe Buildr::TestTask, '#invoke' do
696
696
 
697
697
  it 'should run tests if test resources changed' do
698
698
  touch test_task.resources.target.to_s
699
- lambda { test_task.invoke }.should run_task('foo:test')
699
+ lambda { test_task.invoke; sleep 1 }.should run_task('foo:test')
700
700
  end
701
701
 
702
702
  it 'should run tests if compile-dependent project changed' do
703
703
  write 'bar/src/main/java/Bar.java', 'public class Bar {}'
704
704
  define('bar', :version=>'1.0', :base_dir=>'bar') { package :jar }
705
705
  project('foo').compile.with project('bar')
706
- lambda { test_task.invoke }.should run_task('foo:test')
706
+ lambda { test_task.invoke; sleep 1 }.should run_task('foo:test')
707
707
  end
708
708
 
709
709
  it 'should run tests if test-dependent project changed' do
710
710
  write 'bar/src/main/java/Bar.java', 'public class Bar {}'
711
711
  define('bar', :version=>'1.0', :base_dir=>'bar') { package :jar }
712
712
  test_task.with project('bar')
713
- lambda { test_task.invoke }.should run_task('foo:test')
713
+ lambda { test_task.invoke; sleep 1 }.should run_task('foo:test')
714
714
  end
715
715
 
716
716
  it 'should run tests if buildfile changed' do
717
717
  touch 'buildfile'
718
718
  test_task.should_receive(:run_tests)
719
- lambda { test_task.invoke }.should run_task('foo:test')
719
+ lambda { test_task.invoke; sleep 1 }.should run_task('foo:test')
720
720
  end
721
721
 
722
722
  it 'should not run tests if buildfile changed but IGNORE_BUILDFILE is true' do
@@ -18,7 +18,7 @@ require 'fileutils'
18
18
 
19
19
  describe Buildr::POM do
20
20
  before do
21
- repositories.remote = 'http://example.com'
21
+ repositories.remote = 'http://buildr.apache.org/repository/noexist'
22
22
  @app = 'group:pomapp:jar:1.0'
23
23
  write artifact(@app).pom.to_s, <<-XML
24
24
  <project>
@@ -70,7 +70,7 @@ end
70
70
 
71
71
  describe Buildr::POM do
72
72
  before do
73
- repositories.remote = 'http://example.com'
73
+ repositories.remote = 'http://buildr.apache.org/repository/noexist'
74
74
  @app = 'group:app:jar:1.0'
75
75
  write artifact(@app).pom.to_s, <<-XML
76
76
  <project>
@@ -368,13 +368,26 @@ describe Buildr::TestNG do
368
368
  project('foo:bar').test.framework.should eql(:testng)
369
369
  end
370
370
 
371
- it 'should include TestNG dependencies' do
371
+ it 'should include TestNG dependencies for old version' do
372
+ begin
373
+ Buildr.settings.build['testng'] = '5.10'
374
+ define('foo') { test.using :testng }
375
+ project('foo').test.compile.dependencies.should include(artifact("org.testng:testng:jar:jdk15:#{TestNG.version}"))
376
+ project('foo').test.dependencies.should include(artifact("org.testng:testng:jar:jdk15:#{TestNG.version}"))
377
+ ensure
378
+ Buildr.settings.build['testng'] = nil
379
+ end
380
+ end
381
+
382
+ it 'should include TestNG dependencies for old version' do
372
383
  define('foo') { test.using :testng }
373
- project('foo').test.compile.dependencies.should include(artifact("org.testng:testng:jar:jdk15:#{TestNG.version}"))
374
- project('foo').test.dependencies.should include(artifact("org.testng:testng:jar:jdk15:#{TestNG.version}"))
384
+ project('foo').test.compile.dependencies.should include(artifact("org.testng:testng:jar:#{TestNG.version}"))
385
+ project('foo').test.compile.dependencies.should include(artifact("com.beust:jcommander:jar:1.27"))
386
+ project('foo').test.dependencies.should include(artifact("org.testng:testng:jar:#{TestNG.version}"))
387
+ project('foo').test.dependencies.should include(artifact("com.beust:jcommander:jar:1.27"))
375
388
  end
376
389
 
377
- it 'should include TestNG dependencies' do
390
+ it 'should include jmock dependencies' do
378
391
  define('foo') { test.using :testng }
379
392
  two_or_later = JMock.version[0,1].to_i >= 2
380
393
  group = two_or_later ? "org.jmock" : "jmock"
@@ -492,7 +505,7 @@ describe Buildr::TestNG do
492
505
  }
493
506
  JAVA
494
507
  define('foo') { test.using(:testng) }
495
- lambda { project('foo').test.invoke }.should change { File.exist?('reports/testng/foo/index.html') }.to(true)
508
+ lambda { project('foo').test.invoke }.should change { File.exist?('reports/testng/index.html') }.to(true)
496
509
  end
497
510
 
498
511
  it 'should include classes using TestNG annotations marked with a specific group' do
@@ -547,9 +560,9 @@ describe Buildr::MultiTest do
547
560
  it 'should include dependencies of whichever test framework(s) are selected' do
548
561
  define('foo') { test.using :multitest, :frameworks => [ Buildr::JUnit, Buildr::TestNG ] }
549
562
  project('foo').test.compile.dependencies.should include(artifact("junit:junit:jar:#{JUnit.version}"))
550
- project('foo').test.compile.dependencies.should include(artifact("org.testng:testng:jar:jdk15:#{TestNG.version}"))
563
+ project('foo').test.compile.dependencies.should include(artifact("org.testng:testng:jar:#{TestNG.version}"))
551
564
  project('foo').test.dependencies.should include(artifact("junit:junit:jar:#{JUnit.version}"))
552
- project('foo').test.dependencies.should include(artifact("org.testng:testng:jar:jdk15:#{TestNG.version}"))
565
+ project('foo').test.dependencies.should include(artifact("org.testng:testng:jar:#{TestNG.version}"))
553
566
  end
554
567
 
555
568
  it 'should include classes of given test framework(s)' do
@@ -636,8 +649,7 @@ describe Buildr::MultiTest do
636
649
  JAVA
637
650
  define('foo') { test.using :multitest, :frameworks => [ Buildr::JUnit, Buildr::TestNG ] }
638
651
  lambda { project('foo').test.invoke }.should change {
639
- p Dir['./**/*'].inspect
640
- File.exist?('reports/multitest/foo/index.html') }.to(true)
652
+ File.exist?('reports/multitest/index.html') }.to(true)
641
653
  end
642
654
 
643
655
  it 'should include classes using TestNG annotations marked with a specific group' do
@@ -99,20 +99,20 @@ describe Artifact do
99
99
  end
100
100
 
101
101
  it 'should handle lack of POM gracefully' do
102
- repositories.remote = 'http://example.com'
102
+ repositories.remote = 'http://buildr.apache.org/repository/noexist'
103
103
  URI.should_receive(:download).twice { |*args| raise URI::NotFoundError if args[0].to_s.end_with?('.pom') }
104
104
  lambda { @artifact.invoke }.should_not raise_error
105
105
  end
106
106
 
107
107
  it 'should pass if POM provided' do
108
- repositories.remote = 'http://example.com'
109
- @artifact.pom.enhance { |task| write task.name, @artifact.pom_xml }
108
+ repositories.remote = 'http://buildr.apache.org/repository/noexist'
109
+ @artifact.pom.enhance { |task| write task.name, @artifact.pom_xml.call }
110
110
  write repositories.locate(@artifact)
111
111
  lambda { @artifact.invoke }.should_not raise_error
112
112
  end
113
113
 
114
114
  it 'should pass if POM not required' do
115
- repositories.remote = 'http://example.com'
115
+ repositories.remote = 'http://buildr.apache.org/repository/noexist'
116
116
  class << @artifact ; def pom() ; end ; end
117
117
  write repositories.locate(@artifact)
118
118
  lambda { @artifact.invoke }.should_not raise_error
@@ -239,14 +239,14 @@ describe Repositories, 'remote' do
239
239
  end
240
240
 
241
241
  it 'should be used to download artifact' do
242
- repositories.remote = 'http://example.com'
242
+ repositories.remote = 'http://buildr.apache.org/repository/noexist'
243
243
  URI.should_receive(:download).twice.and_return { |uri, target, options| write target }
244
244
  lambda { artifact('com.example:library:jar:2.0').invoke }.
245
245
  should change { File.exist?(File.join(repositories.local, 'com/example/library/2.0/library-2.0.jar')) }.to(true)
246
246
  end
247
247
 
248
248
  it 'should lookup in array order' do
249
- repositories.remote = [ 'http://example.com', 'http://example.org' ]
249
+ repositories.remote = [ 'http://buildr.apache.org/repository/noexist', 'http://example.org' ]
250
250
  order = ['com', 'org']
251
251
  URI.should_receive(:download).any_number_of_times do |uri, target, options|
252
252
  order.shift if order.first && uri.to_s[order.first]
@@ -257,33 +257,33 @@ describe Repositories, 'remote' do
257
257
  end
258
258
 
259
259
  it 'should fail if artifact not found' do
260
- repositories.remote = 'http://example.com'
260
+ repositories.remote = 'http://buildr.apache.org/repository/noexist'
261
261
  URI.should_receive(:download).once.ordered.and_return { fail URI::NotFoundError }
262
262
  lambda { artifact('com.example:library:jar:2.0').invoke }.should raise_error(RuntimeError, /Failed to download/)
263
263
  File.exist?(File.join(repositories.local, 'com/example/library/2.0/library-2.0.jar')).should be_false
264
264
  end
265
265
 
266
266
  it 'should support artifact classifier' do
267
- repositories.remote = 'http://example.com'
267
+ repositories.remote = 'http://buildr.apache.org/repository/noexist'
268
268
  URI.should_receive(:download).once.and_return { |uri, target, options| write target }
269
269
  lambda { artifact('com.example:library:jar:all:2.0').invoke }.
270
270
  should change { File.exist?(File.join(repositories.local, 'com/example/library/2.0/library-2.0-all.jar')) }.to(true)
271
271
  end
272
272
 
273
273
  it 'should deal well with repositories URL that lack the last slash' do
274
- repositories.remote = 'http://example.com/base'
274
+ repositories.remote = 'http://buildr.apache.org/repository/noexist/base'
275
275
  uri = nil
276
276
  URI.should_receive(:download).twice.and_return { |_uri, args| uri = _uri }
277
277
  artifact('group:id:jar:1.0').invoke
278
- uri.to_s.should eql('http://example.com/base/group/id/1.0/id-1.0.pom')
278
+ uri.to_s.should eql('http://buildr.apache.org/repository/noexist/base/group/id/1.0/id-1.0.pom')
279
279
  end
280
280
 
281
281
  it 'should deal well with repositories URL that have the last slash' do
282
- repositories.remote = 'http://example.com/base/'
282
+ repositories.remote = 'http://buildr.apache.org/repository/noexist/base/'
283
283
  uri = nil
284
284
  URI.should_receive(:download).twice.and_return { |_uri, args| uri = _uri }
285
285
  artifact('group:id:jar:1.0').invoke
286
- uri.to_s.should eql('http://example.com/base/group/id/1.0/id-1.0.pom')
286
+ uri.to_s.should eql('http://buildr.apache.org/repository/noexist/base/group/id/1.0/id-1.0.pom')
287
287
  end
288
288
 
289
289
  it 'should resolve m2-style deployed snapshots' do
@@ -302,7 +302,7 @@ describe Repositories, 'remote' do
302
302
  </versioning>
303
303
  </metadata>
304
304
  XML
305
- repositories.remote = 'http://example.com'
305
+ repositories.remote = 'http://buildr.apache.org/repository/noexist'
306
306
  URI.should_receive(:download).twice.with(uri(/2.1-SNAPSHOT\/library-2.1-SNAPSHOT.(jar|pom)$/), anything()).
307
307
  and_return { fail URI::NotFoundError }
308
308
  URI.should_receive(:download).twice.with(uri(/2.1-SNAPSHOT\/maven-metadata.xml$/), duck_type(:write)).
@@ -329,7 +329,7 @@ describe Repositories, 'remote' do
329
329
  </versioning>
330
330
  </metadata>
331
331
  XML
332
- repositories.remote = 'http://example.com'
332
+ repositories.remote = 'http://buildr.apache.org/repository/noexist'
333
333
  URI.should_receive(:download).once.with(uri(/2.1-SNAPSHOT\/library-2.1-20071012.190008-8-classifier.jar$/), anything()).
334
334
  and_return { |uri, target, options| write target }
335
335
  URI.should_receive(:download).once.with(uri(/2.1-SNAPSHOT\/maven-metadata.xml$/), duck_type(:write)).
@@ -354,7 +354,7 @@ describe Repositories, 'remote' do
354
354
  </versioning>
355
355
  </metadata>
356
356
  XML
357
- repositories.remote = 'http://example.com'
357
+ repositories.remote = 'http://buildr.apache.org/repository/noexist'
358
358
  URI.should_receive(:download).once.with(uri(/2.1-SNAPSHOT\/library-2.1-SNAPSHOT.(jar|pom)$/), anything()).
359
359
  and_return { fail URI::NotFoundError }
360
360
  URI.should_receive(:download).once.with(uri(/2.1-SNAPSHOT\/maven-metadata.xml$/), duck_type(:write)).
@@ -380,7 +380,7 @@ describe Repositories, 'remote' do
380
380
  </versioning>
381
381
  </metadata>
382
382
  XML
383
- repositories.remote = 'http://example.com'
383
+ repositories.remote = 'http://buildr.apache.org/repository/noexist'
384
384
  URI.should_receive(:download).once.with(uri(/2.1-SNAPSHOT\/library-2.1-SNAPSHOT.(jar|pom)$/), anything()).
385
385
  and_return { fail URI::NotFoundError }
386
386
  URI.should_receive(:download).once.with(uri(/2.1-SNAPSHOT\/maven-metadata.xml$/), duck_type(:write)).
@@ -392,7 +392,7 @@ describe Repositories, 'remote' do
392
392
  end
393
393
 
394
394
  it 'should handle missing maven metadata by reporting the artifact unavailable' do
395
- repositories.remote = 'http://example.com'
395
+ repositories.remote = 'http://buildr.apache.org/repository/noexist'
396
396
  URI.should_receive(:download).with(uri(/2.1-SNAPSHOT\/library-2.1-SNAPSHOT.jar$/), anything()).
397
397
  and_return { fail URI::NotFoundError }
398
398
  URI.should_receive(:download).with(uri(/2.1-SNAPSHOT\/maven-metadata.xml$/), duck_type(:write)).
@@ -417,7 +417,7 @@ describe Repositories, 'remote' do
417
417
  </versioning>
418
418
  </metadata>
419
419
  XML
420
- repositories.remote = 'http://example.com'
420
+ repositories.remote = 'http://buildr.apache.org/repository/noexist'
421
421
  URI.should_receive(:download).with(uri(/2.1-SNAPSHOT\/library-2.1-SNAPSHOT.jar$/), anything()).
422
422
  and_return { fail URI::NotFoundError }
423
423
  URI.should_receive(:download).with(uri(/2.1-SNAPSHOT\/maven-metadata.xml$/), duck_type(:write)).
@@ -432,81 +432,81 @@ describe Repositories, 'remote' do
432
432
  write 'home/.buildr/settings.yaml', <<-YAML
433
433
  repositories:
434
434
  remote:
435
- - http://example.com
435
+ - http://buildr.apache.org/repository/noexist
436
436
  - http://example.org
437
437
  YAML
438
- repositories.remote.should include('http://example.com', 'http://example.org')
438
+ repositories.remote.should include('http://buildr.apache.org/repository/noexist', 'http://example.org')
439
439
  end
440
440
 
441
441
  it 'should load with all repositories specified in build.yaml file' do
442
442
  write 'build.yaml', <<-YAML
443
443
  repositories:
444
444
  remote:
445
- - http://example.com
445
+ - http://buildr.apache.org/repository/noexist
446
446
  - http://example.org
447
447
  YAML
448
- repositories.remote.should include('http://example.com', 'http://example.org')
448
+ repositories.remote.should include('http://buildr.apache.org/repository/noexist', 'http://example.org')
449
449
  end
450
450
 
451
451
  it 'should load with all repositories specified in settings and build.yaml files' do
452
452
  write 'home/.buildr/settings.yaml', <<-YAML
453
453
  repositories:
454
454
  remote:
455
- - http://example.com
455
+ - http://buildr.apache.org/repository/noexist
456
456
  YAML
457
457
  write 'build.yaml', <<-YAML
458
458
  repositories:
459
459
  remote:
460
460
  - http://example.org
461
461
  YAML
462
- repositories.remote.should include('http://example.com', 'http://example.org')
462
+ repositories.remote.should include('http://buildr.apache.org/repository/noexist', 'http://example.org')
463
463
  end
464
464
  end
465
465
 
466
466
 
467
467
  describe Repositories, 'release_to' do
468
468
  it 'should accept URL as first argument' do
469
- repositories.release_to = 'http://example.com'
470
- repositories.release_to.should == { :url=>'http://example.com' }
469
+ repositories.release_to = 'http://buildr.apache.org/repository/noexist'
470
+ repositories.release_to.should == { :url=>'http://buildr.apache.org/repository/noexist' }
471
471
  end
472
472
 
473
473
  it 'should accept hash with options' do
474
- repositories.release_to = { :url=>'http://example.com', :username=>'john' }
475
- repositories.release_to.should == { :url=>'http://example.com', :username=>'john' }
474
+ repositories.release_to = { :url=>'http://buildr.apache.org/repository/noexist', :username=>'john' }
475
+ repositories.release_to.should == { :url=>'http://buildr.apache.org/repository/noexist', :username=>'john' }
476
476
  end
477
477
 
478
478
  it 'should allow the hash to be manipulated' do
479
- repositories.release_to = 'http://example.com'
480
- repositories.release_to.should == { :url=>'http://example.com' }
479
+ repositories.release_to = 'http://buildr.apache.org/repository/noexist'
480
+ repositories.release_to.should == { :url=>'http://buildr.apache.org/repository/noexist' }
481
481
  repositories.release_to[:username] = 'john'
482
- repositories.release_to.should == { :url=>'http://example.com', :username=>'john' }
482
+ repositories.release_to.should == { :url=>'http://buildr.apache.org/repository/noexist', :username=>'john' }
483
483
  end
484
484
 
485
485
  it 'should load URL from settings file' do
486
486
  write 'home/.buildr/settings.yaml', <<-YAML
487
487
  repositories:
488
- release_to: http://john:secret@example.com
488
+ release_to: http://john:secret@buildr.apache.org/repository/noexist
489
489
  YAML
490
- repositories.release_to.should == { :url=>'http://john:secret@example.com' }
490
+ repositories.release_to.should == { :url=>'http://john:secret@buildr.apache.org/repository/noexist' }
491
491
  end
492
492
 
493
493
  it 'should load URL from build settings file' do
494
494
  write 'build.yaml', <<-YAML
495
495
  repositories:
496
- release_to: http://john:secret@example.com
496
+ release_to: http://john:secret@buildr.apache.org/repository/noexist
497
497
  YAML
498
- repositories.release_to.should == { :url=>'http://john:secret@example.com' }
498
+ repositories.release_to.should == { :url=>'http://john:secret@buildr.apache.org/repository/noexist' }
499
499
  end
500
500
 
501
501
  it 'should load URL, username and password from settings file' do
502
502
  write 'home/.buildr/settings.yaml', <<-YAML
503
503
  repositories:
504
504
  release_to:
505
- url: http://example.com
505
+ url: http://buildr.apache.org/repository/noexist
506
506
  username: john
507
507
  password: secret
508
508
  YAML
509
- repositories.release_to.should == { :url=>'http://example.com', :username=>'john', :password=>'secret' }
509
+ repositories.release_to.should == { :url=>'http://buildr.apache.org/repository/noexist', :username=>'john', :password=>'secret' }
510
510
  end
511
511
  end
512
512
 
@@ -652,7 +652,7 @@ describe Buildr, '#artifact' do
652
652
  end
653
653
 
654
654
  def run_with_repo
655
- repositories.remote = 'http://example.com'
655
+ repositories.remote = 'http://buildr.apache.org/repository/noexist'
656
656
  end
657
657
 
658
658
  end
@@ -788,7 +788,7 @@ describe Buildr, '#install' do
788
788
  end
789
789
 
790
790
  it 'should download snapshot to temporary location' do
791
- repositories.remote = 'http://example.com'
791
+ repositories.remote = 'http://buildr.apache.org/repository/noexist'
792
792
  snapshot = artifact(@snapshot_spec)
793
793
  same_time = Time.new
794
794
  download_file = "#{Dir.tmpdir}/#{File.basename(snapshot.name)}#{same_time.to_i}"
@@ -831,7 +831,7 @@ describe Buildr, '#upload' do
831
831
  before do
832
832
  @spec = 'group:id:jar:1.0'
833
833
  write @file = 'test.jar'
834
- repositories.release_to = 'sftp://example.com/base'
834
+ repositories.release_to = 'sftp://buildr.apache.org/repository/noexist/base'
835
835
  end
836
836
 
837
837
  it 'should return the upload task' do
@@ -847,9 +847,9 @@ describe Buildr, '#upload' do
847
847
  write @file
848
848
  upload artifact(@spec).from(@file)
849
849
  URI.should_receive(:upload).once.
850
- with(URI.parse('sftp://example.com/base/group/id/1.0/id-1.0.jar'), artifact(@spec).to_s, anything)
850
+ with(URI.parse('sftp://buildr.apache.org/repository/noexist/base/group/id/1.0/id-1.0.jar'), artifact(@spec).to_s, anything)
851
851
  URI.should_receive(:upload).once.
852
- with(URI.parse('sftp://example.com/base/group/id/1.0/id-1.0.pom'), artifact(@spec).pom.to_s, anything)
852
+ with(URI.parse('sftp://buildr.apache.org/repository/noexist/base/group/id/1.0/id-1.0.pom'), artifact(@spec).pom.to_s, anything)
853
853
  upload.invoke
854
854
  end
855
855
  end
@@ -862,10 +862,10 @@ describe ActsAsArtifact, '#upload' do
862
862
  write repositories.locate(artifact)
863
863
  write repositories.locate(artifact.pom)
864
864
  URI.should_receive(:upload).once.
865
- with(URI.parse('sftp://example.com/base/com/example/library/2.0/library-2.0.pom'), artifact.pom.to_s, anything)
865
+ with(URI.parse('sftp://buildr.apache.org/repository/noexist/base/com/example/library/2.0/library-2.0.pom'), artifact.pom.to_s, anything)
866
866
  URI.should_receive(:upload).once.
867
- with(URI.parse('sftp://example.com/base/com/example/library/2.0/library-2.0.jar'), artifact.to_s, anything)
868
- verbose(false) { artifact.upload(:url=>'sftp://example.com/base') }
867
+ with(URI.parse('sftp://buildr.apache.org/repository/noexist/base/com/example/library/2.0/library-2.0.jar'), artifact.to_s, anything)
868
+ verbose(false) { artifact.upload(:url=>'sftp://buildr.apache.org/repository/noexist/base') }
869
869
  end
870
870
 
871
871
  it 'should support artifact classifier and should not upload pom if artifact has classifier' do
@@ -873,8 +873,8 @@ describe ActsAsArtifact, '#upload' do
873
873
  # Prevent artifact from downloading anything.
874
874
  write repositories.locate(artifact)
875
875
  URI.should_receive(:upload).exactly(:once).
876
- with(URI.parse('sftp://example.com/base/com/example/library/2.0/library-2.0-all.jar'), artifact.to_s, anything)
877
- verbose(false) { artifact.upload(:url=>'sftp://example.com/base') }
876
+ with(URI.parse('sftp://buildr.apache.org/repository/noexist/base/com/example/library/2.0/library-2.0-all.jar'), artifact.to_s, anything)
877
+ verbose(false) { artifact.upload(:url=>'sftp://buildr.apache.org/repository/noexist/base') }
878
878
  end
879
879
 
880
880
  it 'should complain without any repository configuration' do
@@ -891,7 +891,7 @@ describe ActsAsArtifact, '#upload' do
891
891
  write repositories.locate(artifact)
892
892
  write repositories.locate(artifact.pom)
893
893
  URI.should_receive(:upload).at_least(:once)
894
- repositories.release_to = 'sftp://example.com/base'
894
+ repositories.release_to = 'sftp://buildr.apache.org/repository/noexist/base'
895
895
  artifact.upload
896
896
  lambda { artifact.upload }.should_not raise_error
897
897
  end
@@ -908,7 +908,7 @@ describe Rake::Task, ' artifacts' do
908
908
 
909
909
  it 'should download all specified artifacts' do
910
910
  artifact 'group:id:jar:1.0'
911
- repositories.remote = 'http://example.com'
911
+ repositories.remote = 'http://buildr.apache.org/repository/noexist'
912
912
  URI.should_receive(:download).twice.and_return { |uri, target, options| write target }
913
913
  task('artifacts').invoke
914
914
  end
@@ -934,7 +934,7 @@ describe Rake::Task, ' artifacts:sources' do
934
934
  @local = @remote = @release_to = nil
935
935
  end
936
936
  task('artifacts:sources').clear
937
- repositories.remote = 'http://example.com'
937
+ repositories.remote = 'http://buildr.apache.org/repository/noexist'
938
938
  end
939
939
 
940
940
  it 'should download sources for all specified artifacts' do
@@ -973,7 +973,7 @@ describe Rake::Task, ' artifacts:javadoc' do
973
973
  @local = @remote = @release_to = nil
974
974
  end
975
975
  task('artifacts:javadoc').clear
976
- repositories.remote = 'http://example.com'
976
+ repositories.remote = 'http://buildr.apache.org/repository/noexist'
977
977
  end
978
978
 
979
979
  it 'should download javadoc for all specified artifacts' do
@@ -1007,9 +1007,9 @@ end
1007
1007
 
1008
1008
  describe Buildr, '#transitive' do
1009
1009
  before do
1010
- repositories.remote = 'http://example.com'
1010
+ repositories.remote = 'http://buildr.apache.org/repository/noexist'
1011
1011
  @simple = [ 'saxon:saxon:jar:8.4', 'saxon:saxon-dom:jar:8.4', 'saxon:saxon-xpath:jar:8.4' ]
1012
- @simple.map { |spec| artifact(spec).pom }.each { |task| write task.name, task.pom_xml }
1012
+ @simple.map { |spec| artifact(spec).pom }.each { |task| write task.name, task.pom_xml.call }
1013
1013
  @provided = @simple.first
1014
1014
  @complex = 'group:app:jar:1.0'
1015
1015
  write artifact(@complex).pom.to_s, <<-XML