buildr 1.3.3-java → 1.3.4-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +76 -0
- data/NOTICE +1 -1
- data/README.rdoc +9 -21
- data/Rakefile +17 -34
- data/_buildr +3 -12
- data/{doc/print.toc.yaml → _jbuildr} +14 -14
- data/addon/buildr/cobertura.rb +5 -219
- data/addon/buildr/drb.rb +281 -0
- data/addon/buildr/emma.rb +5 -221
- data/addon/buildr/nailgun.rb +93 -689
- data/bin/buildr +0 -9
- data/buildr.buildfile +4 -4
- data/buildr.gemspec +27 -21
- data/doc/_layouts/default.html +82 -0
- data/doc/_layouts/preface.html +22 -0
- data/doc/{pages/artifacts.textile → artifacts.textile} +82 -42
- data/doc/{pages/building.textile → building.textile} +89 -47
- data/doc/{pages/contributing.textile → contributing.textile} +53 -45
- data/doc/css/default.css +6 -5
- data/doc/css/print.css +17 -24
- data/doc/css/syntax.css +7 -36
- data/doc/download.textile +68 -0
- data/doc/{pages/extending.textile → extending.textile} +45 -24
- data/doc/{pages/getting_started.textile → getting_started.textile} +158 -88
- data/doc/images/asf-logo.gif +0 -0
- data/doc/images/note.png +0 -0
- data/doc/index.textile +47 -0
- data/doc/{pages/languages.textile → languages.textile} +108 -54
- data/doc/mailing_lists.textile +25 -0
- data/doc/{pages/more_stuff.textile → more_stuff.textile} +152 -73
- data/doc/{pages/packaging.textile → packaging.textile} +181 -96
- data/doc/preface.textile +28 -0
- data/doc/{pages/projects.textile → projects.textile} +55 -40
- data/doc/scripts/buildr-git.rb +364 -264
- data/doc/scripts/gitflow.rb +296 -0
- data/doc/scripts/install-jruby.sh +2 -2
- data/doc/scripts/install-linux.sh +6 -6
- data/doc/scripts/install-osx.sh +2 -2
- data/doc/{pages/settings_profiles.textile → settings_profiles.textile} +83 -45
- data/doc/{pages/testing.textile → testing.textile} +77 -41
- data/lib/buildr.rb +5 -5
- data/lib/buildr/core.rb +2 -0
- data/lib/buildr/core/application.rb +321 -151
- data/lib/buildr/core/build.rb +298 -167
- data/lib/buildr/core/checks.rb +4 -132
- data/lib/buildr/core/common.rb +1 -5
- data/lib/buildr/core/compile.rb +3 -9
- data/lib/buildr/core/environment.rb +12 -3
- data/lib/buildr/core/filter.rb +20 -18
- data/lib/buildr/core/generate.rb +36 -36
- data/lib/buildr/core/help.rb +2 -1
- data/lib/buildr/core/osx.rb +46 -0
- data/lib/buildr/core/progressbar.rb +1 -1
- data/lib/buildr/core/project.rb +7 -34
- data/lib/buildr/core/test.rb +12 -6
- data/lib/buildr/core/transports.rb +13 -11
- data/lib/buildr/core/util.rb +14 -23
- data/lib/buildr/groovy/bdd.rb +3 -2
- data/lib/buildr/groovy/compiler.rb +1 -1
- data/lib/buildr/ide/eclipse.rb +31 -21
- data/lib/buildr/ide/idea.rb +3 -2
- data/lib/buildr/ide/idea7x.rb +6 -4
- data/lib/buildr/java/ant.rb +3 -1
- data/lib/buildr/java/bdd.rb +9 -7
- data/lib/buildr/java/cobertura.rb +243 -0
- data/lib/buildr/java/compiler.rb +5 -4
- data/lib/buildr/java/emma.rb +244 -0
- data/lib/buildr/java/packaging.rb +11 -8
- data/lib/buildr/java/pom.rb +0 -4
- data/lib/buildr/java/rjb.rb +1 -1
- data/lib/buildr/java/test_result.rb +5 -7
- data/lib/buildr/java/tests.rb +17 -11
- data/lib/buildr/packaging.rb +5 -2
- data/lib/buildr/packaging/archive.rb +488 -0
- data/lib/buildr/packaging/artifact.rb +48 -29
- data/lib/buildr/packaging/artifact_namespace.rb +6 -6
- data/lib/buildr/packaging/gems.rb +4 -4
- data/lib/buildr/packaging/package.rb +3 -2
- data/lib/buildr/packaging/tar.rb +85 -3
- data/lib/buildr/packaging/version_requirement.rb +172 -0
- data/lib/buildr/packaging/zip.rb +24 -682
- data/lib/buildr/packaging/ziptask.rb +313 -0
- data/lib/buildr/scala.rb +5 -0
- data/lib/buildr/scala/bdd.rb +100 -0
- data/lib/buildr/scala/compiler.rb +45 -4
- data/lib/buildr/scala/tests.rb +12 -59
- data/rakelib/checks.rake +57 -0
- data/rakelib/doc.rake +58 -68
- data/rakelib/jekylltask.rb +110 -0
- data/rakelib/package.rake +35 -37
- data/rakelib/release.rake +119 -35
- data/rakelib/rspec.rake +29 -39
- data/rakelib/setup.rake +21 -59
- data/rakelib/stage.rake +184 -26
- data/spec/addon/drb_spec.rb +328 -0
- data/spec/core/application_spec.rb +32 -25
- data/spec/core/build_spec.rb +336 -126
- data/spec/core/checks_spec.rb +292 -310
- data/spec/core/common_spec.rb +8 -2
- data/spec/core/compile_spec.rb +17 -1
- data/spec/core/generate_spec.rb +3 -3
- data/spec/core/project_spec.rb +18 -10
- data/spec/core/test_spec.rb +8 -1
- data/spec/core/transport_spec.rb +40 -3
- data/spec/core/util_spec.rb +67 -0
- data/spec/ide/eclipse_spec.rb +96 -28
- data/spec/ide/idea7x_spec.rb +84 -0
- data/spec/java/ant.rb +5 -0
- data/spec/java/bdd_spec.rb +12 -3
- data/spec/{addon → java}/cobertura_spec.rb +6 -6
- data/spec/{addon → java}/emma_spec.rb +5 -6
- data/spec/java/java_spec.rb +12 -2
- data/spec/java/packaging_spec.rb +31 -2
- data/spec/{addon → java}/test_coverage_spec.rb +3 -3
- data/spec/java/tests_spec.rb +5 -0
- data/spec/packaging/archive_spec.rb +11 -1
- data/spec/{core → packaging}/artifact_namespace_spec.rb +10 -2
- data/spec/packaging/artifact_spec.rb +44 -3
- data/spec/packaging/packaging_spec.rb +1 -1
- data/spec/sandbox.rb +17 -14
- data/spec/scala/bdd_spec.rb +150 -0
- data/spec/scala/compiler_spec.rb +27 -0
- data/spec/scala/scala.rb +38 -0
- data/spec/scala/tests_spec.rb +78 -33
- data/spec/spec_helpers.rb +29 -5
- data/spec/version_requirement_spec.rb +6 -0
- metadata +176 -172
- data/DISCLAIMER +0 -7
- data/doc/images/apache-incubator-logo.png +0 -0
- data/doc/pages/download.textile +0 -51
- data/doc/pages/index.textile +0 -42
- data/doc/pages/mailing_lists.textile +0 -17
- data/doc/pages/recipes.textile +0 -103
- data/doc/pages/troubleshooting.textile +0 -103
- data/doc/pages/whats_new.textile +0 -323
- data/doc/print.haml +0 -51
- data/doc/site.haml +0 -56
- data/doc/site.toc.yaml +0 -47
- data/etc/git-svn-authors +0 -16
- data/lib/buildr/core/application_cli.rb +0 -139
- data/rakelib/apache.rake +0 -191
- data/rakelib/changelog.rake +0 -57
- data/rakelib/rubyforge.rake +0 -53
- data/rakelib/scm.rake +0 -49
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with this
|
|
3
|
+
# work for additional information regarding copyright ownership. The ASF
|
|
4
|
+
# licenses this file to you under the Apache License, Version 2.0 (the
|
|
5
|
+
# "License"); you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
12
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
13
|
+
# License for the specific language governing permissions and limitations under
|
|
14
|
+
# the License.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
require File.join(File.dirname(__FILE__), '../spec_helpers')
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
module Idea7xHelper
|
|
21
|
+
def ipr_xml_elements
|
|
22
|
+
task('idea7x').invoke
|
|
23
|
+
REXML::Document.new(File.read("#{@project_name}-7x.ipr")).root.elements
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def ipr_module_elements
|
|
27
|
+
ipr_xml_elements.to_a("//component[@name='ProjectModuleManager']/modules/module")
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def ipr_module_filepaths
|
|
31
|
+
ipr_module_elements.collect { |m| m.attributes['filepath'] }
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def ipr_module_fileurls
|
|
35
|
+
ipr_module_elements.collect { |m| m.attributes['fileurl'] }
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
describe Idea7x do
|
|
41
|
+
include Idea7xHelper
|
|
42
|
+
|
|
43
|
+
describe "the project file" do
|
|
44
|
+
before do
|
|
45
|
+
@project_name = 'alphabet'
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it "includes a module for the root project" do
|
|
49
|
+
# Current behavior is to only generate IMLs for packaged projects
|
|
50
|
+
define(@project_name) { project.version = '0.0.0'; package(:jar) }
|
|
51
|
+
ipr_module_elements.should have(1).element
|
|
52
|
+
ipr_module_filepaths.should == ["$PROJECT_DIR$/alphabet-7x.iml"]
|
|
53
|
+
ipr_module_fileurls.should == ["file://$PROJECT_DIR$/alphabet-7x.iml"]
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it "includes an IML for a subproject" do
|
|
57
|
+
mkpath 'h'
|
|
58
|
+
define(@project_name) do
|
|
59
|
+
project.version = '0.0.0'; package(:jar)
|
|
60
|
+
define('h') do
|
|
61
|
+
package(:jar)
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
ipr_module_elements.should have(2).elements
|
|
66
|
+
ipr_module_filepaths.should include("$PROJECT_DIR$/h/alphabet-h-7x.iml")
|
|
67
|
+
ipr_module_fileurls.should include("file://$PROJECT_DIR$/h/alphabet-h-7x.iml")
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
it "pays attention to the base_dir for a subproject" do
|
|
71
|
+
mkpath 'aitch'
|
|
72
|
+
define(@project_name) do
|
|
73
|
+
project.version = '0.0.0'; package(:jar)
|
|
74
|
+
define('h', :base_dir => 'aitch') do
|
|
75
|
+
package(:jar)
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
ipr_module_elements.should have(2).elements
|
|
80
|
+
ipr_module_filepaths.should include("$PROJECT_DIR$/aitch/alphabet-h-7x.iml")
|
|
81
|
+
ipr_module_fileurls.should include("file://$PROJECT_DIR$/aitch/alphabet-h-7x.iml")
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
data/spec/java/ant.rb
CHANGED
|
@@ -24,5 +24,10 @@ describe Buildr::Ant do
|
|
|
24
24
|
write 'build.yaml', 'ant: 1.2.3'
|
|
25
25
|
Buildr::Ant.dependencies.should include("org.apache.ant:ant:jar:1.2.3")
|
|
26
26
|
end
|
|
27
|
+
|
|
28
|
+
it 'should have REQUIRES up to version 1.5 since it was deprecated in version 1.3.3' do
|
|
29
|
+
Buildr::VERSION.should < '1.5'
|
|
30
|
+
lambda { Ant::REQUIRES }.should_not raise_error
|
|
31
|
+
end
|
|
27
32
|
|
|
28
33
|
end
|
data/spec/java/bdd_spec.rb
CHANGED
|
@@ -32,7 +32,16 @@ describe Buildr::RSpec do
|
|
|
32
32
|
foo { test.framework.should eql(:rspec) }
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
-
it 'should
|
|
35
|
+
it 'should read passed specs from result yaml' do
|
|
36
|
+
success = File.expand_path('src/spec/ruby/success_spec.rb')
|
|
37
|
+
write(success, 'describe("success") { it("is true") { nil.should be_nil } }')
|
|
38
|
+
foo do
|
|
39
|
+
test.invoke
|
|
40
|
+
test.passed_tests.should eql([success])
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it 'should read result yaml to obtain the list of failed specs' do
|
|
36
45
|
success = File.expand_path('src/spec/ruby/success_spec.rb')
|
|
37
46
|
write(success, 'describe("success") { it("is true") { nil.should be_nil } }')
|
|
38
47
|
failure = File.expand_path('src/spec/ruby/failure_spec.rb')
|
|
@@ -42,8 +51,8 @@ describe Buildr::RSpec do
|
|
|
42
51
|
foo do
|
|
43
52
|
lambda { test.invoke }.should raise_error(/Tests failed/)
|
|
44
53
|
test.tests.should include(success, failure, error)
|
|
45
|
-
test.failed_tests.should
|
|
46
|
-
test.passed_tests.should
|
|
54
|
+
test.failed_tests.sort.should eql([failure, error].sort)
|
|
55
|
+
test.passed_tests.should eql([success])
|
|
47
56
|
end
|
|
48
57
|
end
|
|
49
58
|
|
|
@@ -15,15 +15,15 @@
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
require File.join(File.dirname(__FILE__), 'test_coverage_spec')
|
|
18
|
-
Sandbox.
|
|
19
|
-
|
|
20
|
-
Buildr::Cobertura::requires
|
|
18
|
+
Sandbox.require_optional_extension 'buildr/java/cobertura'
|
|
19
|
+
artifacts(Buildr::Cobertura::dependencies).map(&:invoke)
|
|
21
20
|
|
|
22
21
|
|
|
23
22
|
describe Buildr::Cobertura do
|
|
24
23
|
before do
|
|
25
|
-
# Reloading the
|
|
26
|
-
|
|
24
|
+
# Reloading the extension because the sandbox removes all its actions
|
|
25
|
+
Buildr.module_eval { remove_const :Cobertura }
|
|
26
|
+
load File.expand_path('../lib/buildr/java/cobertura.rb')
|
|
27
27
|
@tool_module = Buildr::Cobertura
|
|
28
28
|
end
|
|
29
29
|
|
|
@@ -74,4 +74,4 @@ describe Buildr::Cobertura do
|
|
|
74
74
|
end
|
|
75
75
|
end
|
|
76
76
|
end
|
|
77
|
-
end
|
|
77
|
+
end
|
|
@@ -15,16 +15,15 @@
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
require File.join(File.dirname(__FILE__), 'test_coverage_spec')
|
|
18
|
-
Sandbox.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
Buildr::Emma::requires
|
|
18
|
+
Sandbox.require_optional_extension 'buildr/java/emma'
|
|
19
|
+
artifacts(Buildr::Emma::dependencies).map(&:invoke)
|
|
22
20
|
|
|
23
21
|
|
|
24
22
|
describe Buildr::Emma do
|
|
25
23
|
before do
|
|
26
|
-
# Reloading the
|
|
27
|
-
|
|
24
|
+
# Reloading the extension because the sandbox removes all its actions
|
|
25
|
+
Buildr.module_eval { remove_const :Emma }
|
|
26
|
+
load File.expand_path('../lib/buildr/java/emma.rb')
|
|
28
27
|
@tool_module = Buildr::Emma
|
|
29
28
|
end
|
|
30
29
|
|
data/spec/java/java_spec.rb
CHANGED
|
@@ -13,13 +13,15 @@
|
|
|
13
13
|
# License for the specific language governing permissions and limitations under
|
|
14
14
|
# the License.
|
|
15
15
|
|
|
16
|
+
|
|
16
17
|
require File.join(File.dirname(__FILE__), '../spec_helpers')
|
|
17
18
|
|
|
19
|
+
|
|
18
20
|
unless RUBY_PLATFORM =~ /java/
|
|
19
21
|
describe ENV, 'JAVA_HOME on OS X' do
|
|
20
22
|
before do
|
|
21
23
|
@old_home, ENV['JAVA_HOME'] = ENV['JAVA_HOME'], nil
|
|
22
|
-
@old_env_java = ENV_JAVA
|
|
24
|
+
@old_env_java = Object.module_eval { remove_const :ENV_JAVA }
|
|
23
25
|
Config::CONFIG.should_receive(:[]).with('host_os').and_return('darwin0.9')
|
|
24
26
|
end
|
|
25
27
|
|
|
@@ -85,4 +87,12 @@ describe Java, '#tools_jar' do
|
|
|
85
87
|
after do
|
|
86
88
|
ENV['JAVA_HOME'] = @old_home
|
|
87
89
|
end
|
|
88
|
-
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
describe Java::JavaWrapper do
|
|
94
|
+
it 'should be removed in version 1.5 since it was deprecated in version 1.3' do
|
|
95
|
+
Buildr::VERSION.should < '1.5'
|
|
96
|
+
lambda { Java::JavaWrapper }.should_not raise_error
|
|
97
|
+
end
|
|
98
|
+
end
|
data/spec/java/packaging_spec.rb
CHANGED
|
@@ -96,6 +96,18 @@ shared_examples_for 'package with manifest' do
|
|
|
96
96
|
end
|
|
97
97
|
end
|
|
98
98
|
|
|
99
|
+
it 'should generate a new manifest for a file that does not have one' do
|
|
100
|
+
Zip::ZipFile.open("tmp.zip", Zip::ZipFile::CREATE).close
|
|
101
|
+
begin
|
|
102
|
+
manifest = Buildr::Packaging::Java::Manifest.from_zip('tmp.zip')
|
|
103
|
+
manifest.each do |key, val|
|
|
104
|
+
Buildr::Packaging::Java::Manifest::STANDARD_HEADER.should include(key)
|
|
105
|
+
end
|
|
106
|
+
ensure
|
|
107
|
+
rm 'tmp.zip'
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
99
111
|
it 'should map manifest from hash' do
|
|
100
112
|
package_with_manifest 'Foo'=>1, :bar=>'Bar'
|
|
101
113
|
inspect_manifest do |manifest|
|
|
@@ -170,11 +182,28 @@ shared_examples_for 'package with manifest' do
|
|
|
170
182
|
package_with_manifest 'MANIFEST.MF'
|
|
171
183
|
inspect_manifest do |manifest|
|
|
172
184
|
manifest.sections.size.should be(1)
|
|
173
|
-
manifest.main['Manifest-Version'].should eql('1.0')
|
|
174
185
|
manifest.main['Meta'].should eql('data')
|
|
175
186
|
end
|
|
176
187
|
end
|
|
177
188
|
|
|
189
|
+
it 'should not add manifest version twice' do
|
|
190
|
+
write 'MANIFEST.MF', 'Manifest-Version: 1.9'
|
|
191
|
+
package_with_manifest 'MANIFEST.MF'
|
|
192
|
+
package ||= project('foo').package(@packaging)
|
|
193
|
+
package.invoke
|
|
194
|
+
Zip::ZipFile.open(package.to_s) do |zip|
|
|
195
|
+
zip.read('META-INF/MANIFEST.MF').scan(/(Manifest-Version)/m).size.should == 1
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
it 'should give precedence to version specified in manifest file' do
|
|
200
|
+
write 'MANIFEST.MF', 'Manifest-Version: 1.9'
|
|
201
|
+
package_with_manifest 'MANIFEST.MF'
|
|
202
|
+
inspect_manifest do |manifest|
|
|
203
|
+
manifest.main['Manifest-Version'].should == '1.9'
|
|
204
|
+
end
|
|
205
|
+
end
|
|
206
|
+
|
|
178
207
|
it 'should create manifest from task' do
|
|
179
208
|
file 'MANIFEST.MF' do |task|
|
|
180
209
|
write task.to_s, 'Meta: data'
|
|
@@ -709,7 +738,7 @@ describe Packaging, 'ear' do
|
|
|
709
738
|
inspect_ear { |files| files.should include('ejb/foo-1.0.jar') }
|
|
710
739
|
end
|
|
711
740
|
|
|
712
|
-
it 'should accept component and its type as type=>
|
|
741
|
+
it 'should accept component and its type as type=>artifact' do
|
|
713
742
|
define 'foo', :version=>'1.0' do
|
|
714
743
|
package(:ear).add :ejb=>package(:jar)
|
|
715
744
|
end
|
|
@@ -150,7 +150,7 @@ describe 'test coverage tool', :shared=>true do
|
|
|
150
150
|
|
|
151
151
|
it 'should have the test coverage tools artifacts' do
|
|
152
152
|
define('foo')
|
|
153
|
-
@tool_module.
|
|
153
|
+
artifacts(@tool_module.dependencies).each { |artifact| project('foo').test.dependencies.should include(artifact) }
|
|
154
154
|
end
|
|
155
155
|
end
|
|
156
156
|
|
|
@@ -249,7 +249,7 @@ describe 'test coverage tool', :shared=>true do
|
|
|
249
249
|
|
|
250
250
|
it 'should not add the test coverage tools artifacts to the testing classpath' do
|
|
251
251
|
define('foo')
|
|
252
|
-
@tool_module.
|
|
252
|
+
@tool_module.dependencies.each { |artifact| project('foo').test.dependencies.should_not include(artifact) }
|
|
253
253
|
end
|
|
254
254
|
end
|
|
255
|
-
end
|
|
255
|
+
end
|
data/spec/java/tests_spec.rb
CHANGED
|
@@ -40,6 +40,11 @@ describe Buildr::JUnit do
|
|
|
40
40
|
project('foo').test.dependencies.should include(artifact("junit:junit:jar:#{JUnit.version}"))
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
+
it 'should have REQUIRES up to version 1.5 since it was deprecated in 1.3.3' do
|
|
44
|
+
Buildr::VERSION.should < '1.5'
|
|
45
|
+
lambda { JUnit::REQUIRES }.should_not raise_error
|
|
46
|
+
end
|
|
47
|
+
|
|
43
48
|
it 'should pick JUnit version from junit build settings' do
|
|
44
49
|
Buildr::JUnit.instance_eval { @dependencies = nil }
|
|
45
50
|
write 'build.yaml', 'junit: 1.2.3'
|
|
@@ -80,7 +80,7 @@ describe 'ArchiveTask', :shared=>true do
|
|
|
80
80
|
it 'should invoke and archive file tasks' do
|
|
81
81
|
file = file('included') { write 'included' }
|
|
82
82
|
lambda { archive(@archive).include(file).invoke }.should change { File.exist?(file.to_s) }.to(true)
|
|
83
|
-
inspect_archive.should include('included')
|
|
83
|
+
inspect_archive.keys.should include('included')
|
|
84
84
|
end
|
|
85
85
|
|
|
86
86
|
it 'should include entry for directory' do
|
|
@@ -237,6 +237,16 @@ describe 'ArchiveTask', :shared=>true do
|
|
|
237
237
|
end
|
|
238
238
|
end
|
|
239
239
|
|
|
240
|
+
it 'should expand another archive file with nested exclude pattern' do
|
|
241
|
+
@files = %w{Test1.txt Text2.html}.map { |file| File.join(@dir, "foo", file) }.
|
|
242
|
+
each { |file| write file, content_for(file) }
|
|
243
|
+
zip(@archive + '.src').include(@dir).tap do |task|
|
|
244
|
+
archive(@archive).merge(task).exclude('test/*')
|
|
245
|
+
archive(@archive).invoke
|
|
246
|
+
inspect_archive.should be_empty
|
|
247
|
+
end
|
|
248
|
+
end
|
|
249
|
+
|
|
240
250
|
it 'should expand another archive file into path' do
|
|
241
251
|
create_for_merge do |src|
|
|
242
252
|
archive(@archive).path('test').merge(src)
|
|
@@ -281,6 +281,14 @@ describe Buildr::ArtifactNamespace do
|
|
|
281
281
|
artifact_ns(:moo).foo_bar.should == artifact_ns(:foo).bar
|
|
282
282
|
end
|
|
283
283
|
|
|
284
|
+
it 'should handle symbols with dashes and periods' do
|
|
285
|
+
[:'a-b', :'a.b'].each do |symbol|
|
|
286
|
+
artifact_ns.use symbol => 'a:b:c:1'
|
|
287
|
+
artifact_ns[symbol].version.should == '1'
|
|
288
|
+
artifact_ns[symbol].id.should == 'b'
|
|
289
|
+
end
|
|
290
|
+
end
|
|
291
|
+
|
|
284
292
|
end
|
|
285
293
|
|
|
286
294
|
describe '#values' do
|
|
@@ -464,7 +472,7 @@ describe Buildr do
|
|
|
464
472
|
artifact_ns.use 'some:other:jar:1.0'
|
|
465
473
|
artifact_ns.use 'bat:man:jar:1.0'
|
|
466
474
|
compile.with :cool, :other, :'bat:man:jar'
|
|
467
|
-
compile.
|
|
475
|
+
compile.dependencies.map(&:to_spec).should include('cool:aid:jar:1.0', 'some:other:jar:1.0', 'bat:man:jar:1.0')
|
|
468
476
|
end
|
|
469
477
|
end
|
|
470
478
|
|
|
@@ -472,7 +480,7 @@ describe Buildr do
|
|
|
472
480
|
artifact_ns(:moo).muu = 'moo:muu:jar:1.0'
|
|
473
481
|
define 'foo' do
|
|
474
482
|
compile.with artifact_ns(:moo)
|
|
475
|
-
compile.
|
|
483
|
+
compile.dependencies.map(&:to_spec).should include('moo:muu:jar:1.0')
|
|
476
484
|
end
|
|
477
485
|
end
|
|
478
486
|
end
|
|
@@ -71,10 +71,14 @@ describe Artifact do
|
|
|
71
71
|
@artifact.pom.to_hash.should == @artifact.to_hash.merge(:type=>:pom)
|
|
72
72
|
end
|
|
73
73
|
|
|
74
|
-
it 'should have one artifact for all classifiers' do
|
|
74
|
+
it 'should have one POM artifact for all classifiers' do
|
|
75
75
|
@classified.pom.to_hash.should == @classified.to_hash.merge(:type=>:pom).except(:classifier)
|
|
76
76
|
end
|
|
77
|
-
|
|
77
|
+
|
|
78
|
+
it 'should have associated sources artifact' do
|
|
79
|
+
@artifact.sources_artifact.to_hash.should == @artifact.to_hash.merge(:classifier=>'sources')
|
|
80
|
+
end
|
|
81
|
+
|
|
78
82
|
it 'should download file if file does not exist' do
|
|
79
83
|
lambda { @artifact.invoke }.should raise_error(Exception, /No remote repositories/)
|
|
80
84
|
lambda { @classified.invoke }.should raise_error(Exception, /No remote repositories/)
|
|
@@ -430,7 +434,7 @@ describe Buildr, '#artifact' do
|
|
|
430
434
|
artifacts:
|
|
431
435
|
j2ee: geronimo-spec:geronimo-spec-j2ee:jar:1.4-rc4
|
|
432
436
|
YAML
|
|
433
|
-
Buildr.application.send
|
|
437
|
+
Buildr.application.send(:load_artifact_ns)
|
|
434
438
|
artifact(:j2ee).to_s.pathmap('%f').should == 'geronimo-spec-j2ee-1.4-rc4.jar'
|
|
435
439
|
end
|
|
436
440
|
end
|
|
@@ -638,6 +642,43 @@ describe Rake::Task, ' artifacts' do
|
|
|
638
642
|
end
|
|
639
643
|
|
|
640
644
|
|
|
645
|
+
describe Rake::Task, ' artifacts:sources' do
|
|
646
|
+
|
|
647
|
+
before do
|
|
648
|
+
task('artifacts:sources').clear
|
|
649
|
+
repositories.remote = 'http://example.com'
|
|
650
|
+
end
|
|
651
|
+
|
|
652
|
+
it 'should download sources for all specified artifacts' do
|
|
653
|
+
artifact 'group:id:jar:1.0'
|
|
654
|
+
URI.should_receive(:download).any_number_of_times.and_return { |uri, target| write target }
|
|
655
|
+
lambda { task('artifacts:sources').invoke }.should change { File.exist?('home/.m2/repository/group/id/1.0/id-1.0-sources.jar') }.to(true)
|
|
656
|
+
end
|
|
657
|
+
|
|
658
|
+
it "should not try to download sources for the project's artifacts" do
|
|
659
|
+
define('foo', :version=>'1.0') { package(:jar) }
|
|
660
|
+
URI.should_not_receive(:download)
|
|
661
|
+
task('artifacts:sources').invoke
|
|
662
|
+
end
|
|
663
|
+
|
|
664
|
+
describe 'when the source artifact does not exist' do
|
|
665
|
+
|
|
666
|
+
before do
|
|
667
|
+
artifact 'group:id:jar:1.0'
|
|
668
|
+
URI.should_receive(:download).any_number_of_times.and_raise(URI::NotFoundError)
|
|
669
|
+
end
|
|
670
|
+
|
|
671
|
+
it 'should not fail' do
|
|
672
|
+
lambda { task('artifacts:sources').invoke }.should_not raise_error
|
|
673
|
+
end
|
|
674
|
+
|
|
675
|
+
it 'should inform the user' do
|
|
676
|
+
lambda { task('artifacts:sources').invoke }.should show_info('Failed to download group:id:jar:sources:1.0. Skipping it.')
|
|
677
|
+
end
|
|
678
|
+
end
|
|
679
|
+
end
|
|
680
|
+
|
|
681
|
+
|
|
641
682
|
describe Buildr, '#transitive' do
|
|
642
683
|
before do
|
|
643
684
|
repositories.remote = 'http://example.com'
|
|
@@ -75,7 +75,7 @@ describe Project, '#package' do
|
|
|
75
75
|
end
|
|
76
76
|
end
|
|
77
77
|
|
|
78
|
-
it 'should default to composed
|
|
78
|
+
it 'should default to composed id for nested projects' do
|
|
79
79
|
define('foo', :version=>'1.0') do
|
|
80
80
|
define 'bar' do
|
|
81
81
|
package(:jar).id.should eql('foo-bar')
|
data/spec/sandbox.rb
CHANGED
|
@@ -21,12 +21,14 @@ Buildr.application.instance_eval { @rakefile = File.expand_path('buildfile') }
|
|
|
21
21
|
repositories.remote << 'http://repo1.maven.org/maven2'
|
|
22
22
|
repositories.remote << 'http://scala-tools.org/repo-releases'
|
|
23
23
|
|
|
24
|
+
# Add a 'require' here only for optional extensions, not for extensions that should be loaded by default.
|
|
24
25
|
require 'buildr/groovy'
|
|
25
26
|
require 'buildr/scala'
|
|
26
27
|
|
|
27
28
|
Java.load # Anything added to the classpath.
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
artifacts(TestFramework.frameworks.map(&:dependencies).flatten, JUnit.ant_taskdef).each do |path|
|
|
30
|
+
file(path).invoke
|
|
31
|
+
end
|
|
30
32
|
|
|
31
33
|
ENV['HOME'] = File.expand_path('tmp/home')
|
|
32
34
|
|
|
@@ -42,13 +44,13 @@ module Sandbox
|
|
|
42
44
|
spec.after(:each) { reset }
|
|
43
45
|
end
|
|
44
46
|
|
|
45
|
-
# Require an
|
|
46
|
-
def
|
|
47
|
-
|
|
47
|
+
# Require an optional extension without letting its callbacks pollute the Project class.
|
|
48
|
+
def require_optional_extension(extension_require_path)
|
|
49
|
+
project_callbacks_without_extension = Project.class_eval { @callbacks }.dup
|
|
48
50
|
begin
|
|
49
|
-
require
|
|
51
|
+
require extension_require_path
|
|
50
52
|
ensure
|
|
51
|
-
Project.class_eval { @callbacks =
|
|
53
|
+
Project.class_eval { @callbacks = project_callbacks_without_extension }
|
|
52
54
|
end
|
|
53
55
|
end
|
|
54
56
|
end
|
|
@@ -72,17 +74,18 @@ module Sandbox
|
|
|
72
74
|
# for projects, compilation. We need a place that does not depend
|
|
73
75
|
# on the current directory.
|
|
74
76
|
@_sandbox[:original_dir] = Dir.pwd
|
|
75
|
-
temp = File.join(File.dirname(__FILE__), '../tmp')
|
|
76
|
-
FileUtils.mkpath temp
|
|
77
|
-
Dir.chdir temp
|
|
77
|
+
@temp = File.join(File.dirname(__FILE__), '../tmp')
|
|
78
|
+
FileUtils.mkpath @temp
|
|
79
|
+
Dir.chdir @temp
|
|
78
80
|
|
|
81
|
+
ARGV.clear
|
|
79
82
|
Buildr.application = Buildr::Application.new
|
|
80
83
|
Sandbox.tasks.each { |block| block.call }
|
|
81
84
|
Buildr.application.instance_variable_set :@rules, Sandbox.rules.clone
|
|
82
85
|
Buildr.application.instance_eval { @rakefile = File.expand_path('buildfile') }
|
|
83
86
|
|
|
84
87
|
@_sandbox[:load_path] = $LOAD_PATH.clone
|
|
85
|
-
|
|
88
|
+
#@_sandbox[:loaded_features] = $LOADED_FEATURES.clone
|
|
86
89
|
|
|
87
90
|
# Later on we'll want to lose all the on_define created during the test.
|
|
88
91
|
@_sandbox[:on_define] = Project.class_eval { (@on_define || []).dup }
|
|
@@ -95,9 +98,10 @@ module Sandbox
|
|
|
95
98
|
@_sandbox[:artifacts] = Artifact.class_eval { @artifacts }.clone
|
|
96
99
|
Buildr.repositories.local = File.expand_path('repository')
|
|
97
100
|
ENV['HOME'] = File.expand_path('home')
|
|
101
|
+
ENV['BUILDR_ENV'] = 'development'
|
|
98
102
|
|
|
99
103
|
@_sandbox[:env_keys] = ENV.keys
|
|
100
|
-
['DEBUG', 'TEST', 'HTTP_PROXY', 'USER'].each { |k| ENV.delete(k) ; ENV.delete(k.downcase) }
|
|
104
|
+
['DEBUG', 'TEST', 'HTTP_PROXY', 'HTTPS_PROXY', 'USER'].each { |k| ENV.delete(k) ; ENV.delete(k.downcase) }
|
|
101
105
|
|
|
102
106
|
# Remove testing local repository, and reset all repository settings.
|
|
103
107
|
Buildr.repositories.instance_eval do
|
|
@@ -121,8 +125,7 @@ module Sandbox
|
|
|
121
125
|
Layout.default = @_sandbox[:layout].clone
|
|
122
126
|
|
|
123
127
|
$LOAD_PATH.replace @_sandbox[:load_path]
|
|
124
|
-
|
|
125
|
-
FileUtils.rm_rf Dir.pwd
|
|
128
|
+
FileUtils.rm_rf @temp
|
|
126
129
|
|
|
127
130
|
# Get rid of all artifacts.
|
|
128
131
|
@_sandbox[:artifacts].tap { |artifacts| Artifact.class_eval { @artifacts = artifacts } }
|