buildr-gemjar 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.braids +8 -0
- data/.gitignore +5 -0
- data/.rvmrc +1 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +4 -0
- data/LICENSE +20 -0
- data/README.md +98 -0
- data/Rakefile +8 -0
- data/buildr-gemjar.gemspec +42 -0
- data/lib/buildr-gemjar.rb +162 -0
- data/lib/buildr-gemjar/version.rb +3 -0
- data/meta.rakefile +30 -0
- data/spec/buildr-gemjar/version_spec.rb +11 -0
- data/spec/buildr-gemjar_spec.rb +179 -0
- data/spec/repo_builder.rb +59 -0
- data/spec/spec_helper.rb +44 -0
- data/vendor/buildr/.gitignore +17 -0
- data/vendor/buildr/CHANGELOG +1283 -0
- data/vendor/buildr/Gemfile +4 -0
- data/vendor/buildr/LICENSE +176 -0
- data/vendor/buildr/NOTICE +26 -0
- data/vendor/buildr/README.rdoc +134 -0
- data/vendor/buildr/Rakefile +44 -0
- data/vendor/buildr/_buildr +35 -0
- data/vendor/buildr/_jbuildr +35 -0
- data/vendor/buildr/addon/buildr/antlr.rb +65 -0
- data/vendor/buildr/addon/buildr/bnd.rb +147 -0
- data/vendor/buildr/addon/buildr/cobertura.rb +22 -0
- data/vendor/buildr/addon/buildr/drb.rb +281 -0
- data/vendor/buildr/addon/buildr/emma.rb +22 -0
- data/vendor/buildr/addon/buildr/hibernate.rb +149 -0
- data/vendor/buildr/addon/buildr/javacc.rb +85 -0
- data/vendor/buildr/addon/buildr/jaxb_xjc.rb +72 -0
- data/vendor/buildr/addon/buildr/jdepend.rb +60 -0
- data/vendor/buildr/addon/buildr/jetty.rb +248 -0
- data/vendor/buildr/addon/buildr/jibx.rb +86 -0
- data/vendor/buildr/addon/buildr/nailgun.rb +221 -0
- data/vendor/buildr/addon/buildr/openjpa.rb +88 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/BuildrNail.java +41 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/JettyWrapper.java +144 -0
- data/vendor/buildr/addon/buildr/protobuf.rb +88 -0
- data/vendor/buildr/addon/buildr/xmlbeans.rb +93 -0
- data/vendor/buildr/all-in-one/_buildr +19 -0
- data/vendor/buildr/all-in-one/buildr +368 -0
- data/vendor/buildr/all-in-one/buildr.cmd +1 -0
- data/vendor/buildr/bin/buildr +19 -0
- data/vendor/buildr/buildr.buildfile +58 -0
- data/vendor/buildr/buildr.gemspec +74 -0
- data/vendor/buildr/doc/_config.yml +1 -0
- data/vendor/buildr/doc/_layouts/default.html +90 -0
- data/vendor/buildr/doc/_layouts/preface.html +22 -0
- data/vendor/buildr/doc/artifacts.textile +217 -0
- data/vendor/buildr/doc/building.textile +276 -0
- data/vendor/buildr/doc/contributing.textile +268 -0
- data/vendor/buildr/doc/css/default.css +236 -0
- data/vendor/buildr/doc/css/print.css +101 -0
- data/vendor/buildr/doc/css/syntax.css +23 -0
- data/vendor/buildr/doc/download.textile +138 -0
- data/vendor/buildr/doc/extending.textile +212 -0
- data/vendor/buildr/doc/images/1442160941-frontcover.jpg +0 -0
- data/vendor/buildr/doc/images/asf-logo.gif +0 -0
- data/vendor/buildr/doc/images/asf-logo.png +0 -0
- data/vendor/buildr/doc/images/buildr-hires.png +0 -0
- data/vendor/buildr/doc/images/buildr.png +0 -0
- data/vendor/buildr/doc/images/favicon.png +0 -0
- data/vendor/buildr/doc/images/growl-icon.tiff +0 -0
- data/vendor/buildr/doc/images/note.png +0 -0
- data/vendor/buildr/doc/images/project-structure.png +0 -0
- data/vendor/buildr/doc/images/tip.png +0 -0
- data/vendor/buildr/doc/images/zbuildr.png +0 -0
- data/vendor/buildr/doc/images/zbuildr.tif +0 -0
- data/vendor/buildr/doc/index.textile +69 -0
- data/vendor/buildr/doc/installing.textile +284 -0
- data/vendor/buildr/doc/languages.textile +599 -0
- data/vendor/buildr/doc/mailing_lists.textile +29 -0
- data/vendor/buildr/doc/more_stuff.textile +845 -0
- data/vendor/buildr/doc/packaging.textile +618 -0
- data/vendor/buildr/doc/preface.textile +54 -0
- data/vendor/buildr/doc/projects.textile +276 -0
- data/vendor/buildr/doc/quick_start.textile +210 -0
- data/vendor/buildr/doc/releasing.textile +117 -0
- data/vendor/buildr/doc/scripts/buildr-git.rb +512 -0
- data/vendor/buildr/doc/scripts/gitflow.rb +296 -0
- data/vendor/buildr/doc/scripts/install-jruby.sh +44 -0
- data/vendor/buildr/doc/scripts/install-linux.sh +73 -0
- data/vendor/buildr/doc/scripts/install-osx.sh +52 -0
- data/vendor/buildr/doc/settings_profiles.textile +287 -0
- data/vendor/buildr/doc/testing.textile +247 -0
- data/vendor/buildr/etc/KEYS +189 -0
- data/vendor/buildr/lib/buildr.rb +44 -0
- data/vendor/buildr/lib/buildr/clojure.rb +34 -0
- data/vendor/buildr/lib/buildr/clojure/shell.rb +52 -0
- data/vendor/buildr/lib/buildr/core.rb +34 -0
- data/vendor/buildr/lib/buildr/core/application.rb +700 -0
- data/vendor/buildr/lib/buildr/core/build.rb +516 -0
- data/vendor/buildr/lib/buildr/core/cc.rb +166 -0
- data/vendor/buildr/lib/buildr/core/checks.rb +253 -0
- data/vendor/buildr/lib/buildr/core/common.rb +151 -0
- data/vendor/buildr/lib/buildr/core/compile.rb +622 -0
- data/vendor/buildr/lib/buildr/core/doc.rb +276 -0
- data/vendor/buildr/lib/buildr/core/environment.rb +129 -0
- data/vendor/buildr/lib/buildr/core/filter.rb +404 -0
- data/vendor/buildr/lib/buildr/core/generate.rb +197 -0
- data/vendor/buildr/lib/buildr/core/help.rb +119 -0
- data/vendor/buildr/lib/buildr/core/jrebel.rb +42 -0
- data/vendor/buildr/lib/buildr/core/linux.rb +30 -0
- data/vendor/buildr/lib/buildr/core/osx.rb +46 -0
- data/vendor/buildr/lib/buildr/core/progressbar.rb +161 -0
- data/vendor/buildr/lib/buildr/core/project.rb +975 -0
- data/vendor/buildr/lib/buildr/core/run.rb +43 -0
- data/vendor/buildr/lib/buildr/core/shell.rb +137 -0
- data/vendor/buildr/lib/buildr/core/test.rb +843 -0
- data/vendor/buildr/lib/buildr/core/transports.rb +565 -0
- data/vendor/buildr/lib/buildr/core/util.rb +537 -0
- data/vendor/buildr/lib/buildr/groovy.rb +20 -0
- data/vendor/buildr/lib/buildr/groovy/bdd.rb +106 -0
- data/vendor/buildr/lib/buildr/groovy/compiler.rb +153 -0
- data/vendor/buildr/lib/buildr/groovy/doc.rb +76 -0
- data/vendor/buildr/lib/buildr/groovy/shell.rb +57 -0
- data/vendor/buildr/lib/buildr/ide.rb +19 -0
- data/vendor/buildr/lib/buildr/ide/eclipse.rb +427 -0
- data/vendor/buildr/lib/buildr/ide/eclipse/java.rb +53 -0
- data/vendor/buildr/lib/buildr/ide/eclipse/plugin.rb +71 -0
- data/vendor/buildr/lib/buildr/ide/eclipse/scala.rb +68 -0
- data/vendor/buildr/lib/buildr/ide/idea.rb +576 -0
- data/vendor/buildr/lib/buildr/java.rb +25 -0
- data/vendor/buildr/lib/buildr/java/ant.rb +94 -0
- data/vendor/buildr/lib/buildr/java/bdd.rb +460 -0
- data/vendor/buildr/lib/buildr/java/cobertura.rb +297 -0
- data/vendor/buildr/lib/buildr/java/commands.rb +223 -0
- data/vendor/buildr/lib/buildr/java/compiler.rb +135 -0
- data/vendor/buildr/lib/buildr/java/deprecated.rb +141 -0
- data/vendor/buildr/lib/buildr/java/doc.rb +86 -0
- data/vendor/buildr/lib/buildr/java/ecj.rb +69 -0
- data/vendor/buildr/lib/buildr/java/emma.rb +244 -0
- data/vendor/buildr/lib/buildr/java/external.rb +73 -0
- data/vendor/buildr/lib/buildr/java/jruby.rb +122 -0
- data/vendor/buildr/lib/buildr/java/jtestr_result.rb +295 -0
- data/vendor/buildr/lib/buildr/java/jtestr_runner.rb.erb +116 -0
- data/vendor/buildr/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
- data/vendor/buildr/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +142 -0
- data/vendor/buildr/lib/buildr/java/packaging.rb +734 -0
- data/vendor/buildr/lib/buildr/java/pom.rb +178 -0
- data/vendor/buildr/lib/buildr/java/rjb.rb +154 -0
- data/vendor/buildr/lib/buildr/java/test_result.rb +101 -0
- data/vendor/buildr/lib/buildr/java/tests.rb +362 -0
- data/vendor/buildr/lib/buildr/java/version_requirement.rb +172 -0
- data/vendor/buildr/lib/buildr/packaging.rb +25 -0
- data/vendor/buildr/lib/buildr/packaging/archive.rb +535 -0
- data/vendor/buildr/lib/buildr/packaging/artifact.rb +903 -0
- data/vendor/buildr/lib/buildr/packaging/artifact_namespace.rb +984 -0
- data/vendor/buildr/lib/buildr/packaging/artifact_search.rb +140 -0
- data/vendor/buildr/lib/buildr/packaging/gems.rb +105 -0
- data/vendor/buildr/lib/buildr/packaging/package.rb +249 -0
- data/vendor/buildr/lib/buildr/packaging/tar.rb +189 -0
- data/vendor/buildr/lib/buildr/packaging/version_requirement.rb +192 -0
- data/vendor/buildr/lib/buildr/packaging/zip.rb +178 -0
- data/vendor/buildr/lib/buildr/packaging/ziptask.rb +356 -0
- data/vendor/buildr/lib/buildr/resources/buildr.icns +0 -0
- data/vendor/buildr/lib/buildr/resources/completed.png +0 -0
- data/vendor/buildr/lib/buildr/resources/failed.png +0 -0
- data/vendor/buildr/lib/buildr/resources/icons-license.txt +17 -0
- data/vendor/buildr/lib/buildr/run.rb +195 -0
- data/vendor/buildr/lib/buildr/scala.rb +26 -0
- data/vendor/buildr/lib/buildr/scala/bdd.rb +118 -0
- data/vendor/buildr/lib/buildr/scala/compiler.rb +242 -0
- data/vendor/buildr/lib/buildr/scala/doc.rb +142 -0
- data/vendor/buildr/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
- data/vendor/buildr/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.java +57 -0
- data/vendor/buildr/lib/buildr/scala/shell.rb +52 -0
- data/vendor/buildr/lib/buildr/scala/tests.rb +171 -0
- data/vendor/buildr/lib/buildr/shell.rb +185 -0
- data/vendor/buildr/lib/buildr/version.rb +18 -0
- data/vendor/buildr/rakelib/all-in-one.rake +113 -0
- data/vendor/buildr/rakelib/checks.rake +57 -0
- data/vendor/buildr/rakelib/doc.rake +137 -0
- data/vendor/buildr/rakelib/metrics.rake +39 -0
- data/vendor/buildr/rakelib/package.rake +73 -0
- data/vendor/buildr/rakelib/release.rake +161 -0
- data/vendor/buildr/rakelib/rspec.rake +101 -0
- data/vendor/buildr/rakelib/setup.rake +66 -0
- data/vendor/buildr/rakelib/stage.rake +220 -0
- data/vendor/buildr/spec/addon/bnd_spec.rb +330 -0
- data/vendor/buildr/spec/addon/drb_spec.rb +328 -0
- data/vendor/buildr/spec/addon/jaxb_xjc_spec.rb +125 -0
- data/vendor/buildr/spec/core/application_spec.rb +631 -0
- data/vendor/buildr/spec/core/build_spec.rb +837 -0
- data/vendor/buildr/spec/core/cc_spec.rb +224 -0
- data/vendor/buildr/spec/core/checks_spec.rb +519 -0
- data/vendor/buildr/spec/core/common_spec.rb +725 -0
- data/vendor/buildr/spec/core/compile_spec.rb +658 -0
- data/vendor/buildr/spec/core/doc_spec.rb +195 -0
- data/vendor/buildr/spec/core/extension_spec.rb +201 -0
- data/vendor/buildr/spec/core/generate_spec.rb +33 -0
- data/vendor/buildr/spec/core/project_spec.rb +772 -0
- data/vendor/buildr/spec/core/run_spec.rb +93 -0
- data/vendor/buildr/spec/core/shell_spec.rb +146 -0
- data/vendor/buildr/spec/core/test_spec.rb +1320 -0
- data/vendor/buildr/spec/core/transport_spec.rb +544 -0
- data/vendor/buildr/spec/core/util_spec.rb +141 -0
- data/vendor/buildr/spec/groovy/bdd_spec.rb +80 -0
- data/vendor/buildr/spec/groovy/compiler_spec.rb +251 -0
- data/vendor/buildr/spec/groovy/doc_spec.rb +65 -0
- data/vendor/buildr/spec/ide/eclipse_spec.rb +739 -0
- data/vendor/buildr/spec/ide/idea_spec.rb +1144 -0
- data/vendor/buildr/spec/java/ant_spec.rb +37 -0
- data/vendor/buildr/spec/java/bdd_spec.rb +374 -0
- data/vendor/buildr/spec/java/cobertura_spec.rb +112 -0
- data/vendor/buildr/spec/java/commands_spec.rb +93 -0
- data/vendor/buildr/spec/java/compiler_spec.rb +252 -0
- data/vendor/buildr/spec/java/doc_spec.rb +56 -0
- data/vendor/buildr/spec/java/ecj_spec.rb +115 -0
- data/vendor/buildr/spec/java/emma_spec.rb +121 -0
- data/vendor/buildr/spec/java/external_spec.rb +56 -0
- data/vendor/buildr/spec/java/java_spec.rb +132 -0
- data/vendor/buildr/spec/java/packaging_spec.rb +1270 -0
- data/vendor/buildr/spec/java/run_spec.rb +78 -0
- data/vendor/buildr/spec/java/test_coverage_helper.rb +257 -0
- data/vendor/buildr/spec/java/tests_spec.rb +497 -0
- data/vendor/buildr/spec/packaging/archive_spec.rb +775 -0
- data/vendor/buildr/spec/packaging/artifact_namespace_spec.rb +743 -0
- data/vendor/buildr/spec/packaging/artifact_spec.rb +1066 -0
- data/vendor/buildr/spec/packaging/packaging_helper.rb +63 -0
- data/vendor/buildr/spec/packaging/packaging_spec.rb +719 -0
- data/vendor/buildr/spec/sandbox.rb +165 -0
- data/vendor/buildr/spec/scala/bdd_spec.rb +124 -0
- data/vendor/buildr/spec/scala/compiler_spec.rb +289 -0
- data/vendor/buildr/spec/scala/doc_spec.rb +88 -0
- data/vendor/buildr/spec/scala/scala.rb +38 -0
- data/vendor/buildr/spec/scala/tests_spec.rb +283 -0
- data/vendor/buildr/spec/spec_helpers.rb +369 -0
- data/vendor/buildr/spec/version_requirement_spec.rb +143 -0
- data/vendor/buildr/spec/xpath_matchers.rb +121 -0
- data/vendor/buildr/tests/BUILDR-320/Buildfile +29 -0
- data/vendor/buildr/tests/JavaSystemProperty/Buildfile +18 -0
- data/vendor/buildr/tests/JavaSystemProperty/src/test/java/FooTest.java +24 -0
- data/vendor/buildr/tests/compile_with_parent/Buildfile +18 -0
- data/vendor/buildr/tests/compile_with_parent/child/src/main/java/Foo.java +23 -0
- data/vendor/buildr/tests/helloWorld/Buildfile +20 -0
- data/vendor/buildr/tests/helloWorld/src/main/java/HelloWorld.java +23 -0
- data/vendor/buildr/tests/integration_testing.rb +56 -0
- data/vendor/buildr/tests/junit3/Buildfile +9 -0
- data/vendor/buildr/tests/junit3/src/main/java/Foo.java +23 -0
- data/vendor/buildr/tests/junit3/src/test/java/FooTest.java +28 -0
- data/vendor/buildr/tests/package_war_as_jar/Buildfile +15 -0
- data/vendor/buildr/tests/package_war_as_jar/src/main/java/Foo.java +19 -0
- metadata +524 -0
@@ -0,0 +1,224 @@
|
|
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.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers'))
|
18
|
+
|
19
|
+
module CCHelper
|
20
|
+
|
21
|
+
# monkey-patch task instance to track number of times it is run
|
22
|
+
def instrument_task(task)
|
23
|
+
class << task
|
24
|
+
attr_accessor :run_count
|
25
|
+
end
|
26
|
+
task.run_count = 0
|
27
|
+
task.enhance do |t|
|
28
|
+
t.run_count += 1
|
29
|
+
end
|
30
|
+
task
|
31
|
+
end
|
32
|
+
|
33
|
+
def instrument_project(project)
|
34
|
+
instrument_task project.compile
|
35
|
+
instrument_task project.test.compile
|
36
|
+
instrument_task project.resources
|
37
|
+
project
|
38
|
+
end
|
39
|
+
|
40
|
+
def define_foo()
|
41
|
+
@foo = define('foo')
|
42
|
+
instrument_project @foo
|
43
|
+
@foo
|
44
|
+
end
|
45
|
+
|
46
|
+
def foo()
|
47
|
+
@foo
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
describe Buildr::CCTask do
|
53
|
+
include CCHelper
|
54
|
+
|
55
|
+
it 'should default to a delay of 0.2' do
|
56
|
+
define('foo').cc.delay.should == 0.2
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'should compile and test:compile on initial start' do
|
60
|
+
['Test1.java', 'Test2.java'].map { |f| File.join('src/main/java/thepackage', f) }.
|
61
|
+
each { |src| write src, "package thepackage; class #{src.pathmap('%n')} {}" }
|
62
|
+
|
63
|
+
['Test1.java', 'Test2.java'].map { |f| File.join('src/test/java/thepackage', f) }.
|
64
|
+
each { |src| write src, "package thepackage; class #{src.pathmap('%n')} {}" }
|
65
|
+
|
66
|
+
['Test1.html', 'Test2.html'].map { |f| File.join('src/main/resources', f) }.
|
67
|
+
each { |src| write src, '<html></html>' }
|
68
|
+
|
69
|
+
define_foo()
|
70
|
+
|
71
|
+
thread = Thread.new do
|
72
|
+
foo.cc.invoke
|
73
|
+
end
|
74
|
+
|
75
|
+
sleep 1
|
76
|
+
|
77
|
+
foo.compile.run_count.should == 1
|
78
|
+
foo.test.compile.run_count.should == 1
|
79
|
+
|
80
|
+
thread.exit
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'should detect a file change' do |spec|
|
84
|
+
write 'src/main/resources/my.properties', "# comment"
|
85
|
+
write 'src/main/java/Example.java', "public class Example {}"
|
86
|
+
write 'src/test/java/ExampleTest.java', "public class ExampleTest {}"
|
87
|
+
|
88
|
+
define_foo
|
89
|
+
|
90
|
+
thread = Thread.new do
|
91
|
+
begin
|
92
|
+
foo.cc.invoke
|
93
|
+
rescue => e
|
94
|
+
p "unexpected exception #{e.inspect}"
|
95
|
+
p e.backtrace.join("\n").inspect
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
sleep 1
|
100
|
+
|
101
|
+
foo.compile.run_count.should == 1
|
102
|
+
foo.test.compile.run_count.should == 1
|
103
|
+
foo.resources.run_count.should == 1
|
104
|
+
|
105
|
+
sleep 1 # Wait one sec as the timestamp needs to be different.
|
106
|
+
|
107
|
+
touch File.join(Dir.pwd, 'src/main/java/Example.java')
|
108
|
+
|
109
|
+
sleep 1
|
110
|
+
|
111
|
+
foo.compile.run_count.should == 2
|
112
|
+
foo.test.compile.run_count.should == 2
|
113
|
+
foo.resources.run_count.should == 2
|
114
|
+
|
115
|
+
thread.exit
|
116
|
+
end
|
117
|
+
|
118
|
+
it 'should support subprojects' do |spec|
|
119
|
+
write 'foo/src/main/java/Example.java', "public class Example {}"
|
120
|
+
write 'foo/src/test/java/ExampleTest.java', "public class ExampleTest {}"
|
121
|
+
|
122
|
+
define 'container' do
|
123
|
+
define('foo')
|
124
|
+
end
|
125
|
+
|
126
|
+
foo = instrument_project project("container:foo")
|
127
|
+
|
128
|
+
thread = Thread.new do
|
129
|
+
begin
|
130
|
+
project("container").cc.invoke
|
131
|
+
rescue => e
|
132
|
+
p "unexpected exception #{e.inspect}"
|
133
|
+
p e.backtrace.join("\n").inspect
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
sleep 1
|
138
|
+
|
139
|
+
foo.compile.run_count.should == 1
|
140
|
+
foo.test.compile.run_count.should == 1
|
141
|
+
foo.resources.run_count.should == 1
|
142
|
+
|
143
|
+
file("foo/target/classes/Example.class").should exist
|
144
|
+
tstamp = File.mtime("foo/target/classes/Example.class")
|
145
|
+
touch File.join(Dir.pwd, 'foo/src/main/java/Example.java')
|
146
|
+
|
147
|
+
sleep 1
|
148
|
+
|
149
|
+
foo.compile.run_count.should == 2
|
150
|
+
foo.test.compile.run_count.should == 2
|
151
|
+
foo.resources.run_count.should == 2
|
152
|
+
File.mtime("foo/target/classes/Example.class").should_not == tstamp
|
153
|
+
|
154
|
+
thread.exit
|
155
|
+
end
|
156
|
+
|
157
|
+
it 'should support parent and subprojects' do |spec|
|
158
|
+
write 'foo/src/main/java/Example.java', "public class Example {}"
|
159
|
+
write 'foo/src/test/java/ExampleTest.java', "public class ExampleTest {}"
|
160
|
+
|
161
|
+
write 'bar/src/main/java/Example.java', "public class Example {}"
|
162
|
+
write 'bar/src/test/java/ExampleTest.java', "public class ExampleTest {}"
|
163
|
+
|
164
|
+
write 'src/main/java/Example.java', "public class Example {}"
|
165
|
+
write 'src/test/java/ExampleTest.java', "public class ExampleTest {}"
|
166
|
+
|
167
|
+
write 'src/main/resources/foo.txt', "content"
|
168
|
+
|
169
|
+
define 'container' do
|
170
|
+
define('foo')
|
171
|
+
define('bar')
|
172
|
+
end
|
173
|
+
|
174
|
+
all = projects("container", "container:foo", "container:bar")
|
175
|
+
all.each { |p| instrument_project(p) }
|
176
|
+
|
177
|
+
thread = Thread.new do
|
178
|
+
begin
|
179
|
+
project("container").cc.invoke
|
180
|
+
rescue => e
|
181
|
+
p "unexpected exception #{e.inspect}"
|
182
|
+
p e.backtrace.join("\n").inspect
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
sleep 2
|
187
|
+
|
188
|
+
all.each do |p|
|
189
|
+
p.compile.run_count.should == 1
|
190
|
+
p.test.compile.run_count.should == 1
|
191
|
+
p.resources.run_count.should == 1
|
192
|
+
end
|
193
|
+
|
194
|
+
file("foo/target/classes/Example.class").should exist
|
195
|
+
tstamp = File.mtime("foo/target/classes/Example.class")
|
196
|
+
|
197
|
+
touch 'foo/src/main/java/Example.java'
|
198
|
+
p "after touch"
|
199
|
+
sleep 2
|
200
|
+
|
201
|
+
project("container:foo").tap do |p|
|
202
|
+
p.compile.run_count.should == 2
|
203
|
+
p.test.compile.run_count.should == 2
|
204
|
+
p.resources.run_count.should == 2
|
205
|
+
end
|
206
|
+
project("container").tap do |p|
|
207
|
+
p.compile.run_count.should == 1 # not_needed
|
208
|
+
p.test.compile.run_count.should == 1 # not_needed
|
209
|
+
p.resources.run_count.should == 2
|
210
|
+
end
|
211
|
+
File.mtime("foo/target/classes/Example.class").should_not == tstamp
|
212
|
+
|
213
|
+
touch 'src/main/java/Example.java'
|
214
|
+
sleep 2
|
215
|
+
|
216
|
+
project("container").tap do |p|
|
217
|
+
p.compile.run_count.should == 2
|
218
|
+
p.test.compile.run_count.should == 2
|
219
|
+
p.resources.run_count.should == 3
|
220
|
+
end
|
221
|
+
|
222
|
+
thread.exit
|
223
|
+
end
|
224
|
+
end
|
@@ -0,0 +1,519 @@
|
|
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.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers'))
|
18
|
+
|
19
|
+
|
20
|
+
describe Project, 'check task' do
|
21
|
+
|
22
|
+
it "should execute last thing from package task" do
|
23
|
+
task 'action'
|
24
|
+
define 'foo', :version=>'1.0' do
|
25
|
+
package :jar
|
26
|
+
task('package').enhance { task('action').invoke }
|
27
|
+
end
|
28
|
+
lambda { project('foo').task('package').invoke }.should run_tasks(['foo:package', 'action', 'foo:check'])
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should execute all project's expectations" do
|
32
|
+
task 'expectation'
|
33
|
+
define 'foo', :version=>'1.0' do
|
34
|
+
check { task('expectation').invoke }
|
35
|
+
end
|
36
|
+
lambda { project('foo').task('package').invoke }.should run_task('expectation')
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should succeed if there are no expectations" do
|
40
|
+
define 'foo', :version=>'1.0'
|
41
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should succeed if all expectations passed" do
|
45
|
+
define 'foo', :version=>'1.0' do
|
46
|
+
check { true }
|
47
|
+
check { false }
|
48
|
+
end
|
49
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should fail if any expectation failed" do
|
53
|
+
define 'foo', :version=>'1.0' do
|
54
|
+
check
|
55
|
+
check { fail 'sorry' }
|
56
|
+
check
|
57
|
+
end
|
58
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
describe Project, '#check' do
|
64
|
+
|
65
|
+
it "should add expectation" do
|
66
|
+
define 'foo' do
|
67
|
+
expectations.should be_empty
|
68
|
+
check
|
69
|
+
expectations.size.should be(1)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should treat no arguments as expectation against project" do
|
74
|
+
define 'foo' do
|
75
|
+
subject = self
|
76
|
+
check do
|
77
|
+
it.should be(subject)
|
78
|
+
description.should eql(subject.to_s)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should treat single string argument as description, expectation against project" do
|
85
|
+
define 'foo' do
|
86
|
+
subject = self
|
87
|
+
check "should be project" do
|
88
|
+
it.should be(subject)
|
89
|
+
description.should eql("#{subject} should be project")
|
90
|
+
end
|
91
|
+
end
|
92
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should treat single object argument as subject" do
|
96
|
+
define 'foo' do
|
97
|
+
subject = Object.new
|
98
|
+
check subject do
|
99
|
+
it.should be(subject)
|
100
|
+
description.should eql(subject.to_s)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should treat first object as subject, second object as description" do
|
107
|
+
define 'foo' do
|
108
|
+
subject = Object.new
|
109
|
+
check subject, "should exist" do
|
110
|
+
it.should be(subject)
|
111
|
+
description.should eql("#{subject} should exist")
|
112
|
+
end
|
113
|
+
end
|
114
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
115
|
+
end
|
116
|
+
|
117
|
+
it "should work without block" do
|
118
|
+
define 'foo' do
|
119
|
+
check "implement later"
|
120
|
+
end
|
121
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
122
|
+
end
|
123
|
+
|
124
|
+
it 'should pass method calls to context' do
|
125
|
+
define 'foo', :version=>'1.0' do
|
126
|
+
subject = self
|
127
|
+
check "should be project" do
|
128
|
+
it.should be(subject)
|
129
|
+
name.should eql(subject.name)
|
130
|
+
package(:jar).should eql(subject.package(:jar))
|
131
|
+
end
|
132
|
+
end
|
133
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
|
138
|
+
describe Buildr::Checks::Expectation, 'matchers' do
|
139
|
+
|
140
|
+
it "should include Buildr matchers exist and contain" do
|
141
|
+
define 'foo' do
|
142
|
+
check do
|
143
|
+
self.should respond_to(:exist)
|
144
|
+
self.should respond_to(:contain)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
148
|
+
end
|
149
|
+
|
150
|
+
it "should include RSpec matchers like be and eql" do
|
151
|
+
define 'foo' do
|
152
|
+
check do
|
153
|
+
self.should respond_to(:be)
|
154
|
+
self.should respond_to(:eql)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
158
|
+
end
|
159
|
+
|
160
|
+
it "should include RSpec predicates like be_nil and be_empty" do
|
161
|
+
define 'foo' do
|
162
|
+
check do
|
163
|
+
nil.should be_nil
|
164
|
+
[].should be_empty
|
165
|
+
end
|
166
|
+
end
|
167
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
|
172
|
+
describe Buildr::Checks::Expectation, 'exist' do
|
173
|
+
|
174
|
+
it "should pass if file exists" do
|
175
|
+
define 'foo' do
|
176
|
+
build file('test') { |task| write task.name }
|
177
|
+
check(file('test')) { it.should exist }
|
178
|
+
end
|
179
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
180
|
+
end
|
181
|
+
|
182
|
+
it "should fail if file does not exist" do
|
183
|
+
define 'foo' do
|
184
|
+
check(file('test')) { it.should exist }
|
185
|
+
end
|
186
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
187
|
+
end
|
188
|
+
|
189
|
+
it "should not attempt to invoke task" do
|
190
|
+
define 'foo' do
|
191
|
+
file('test') { |task| write task.name }
|
192
|
+
check(file('test')) { it.should exist }
|
193
|
+
end
|
194
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
|
199
|
+
describe Buildr::Checks::Expectation, " be_empty" do
|
200
|
+
|
201
|
+
it "should pass if file has no content" do
|
202
|
+
define 'foo' do
|
203
|
+
build file('test') { write 'test' }
|
204
|
+
check(file('test')) { it.should be_empty }
|
205
|
+
end
|
206
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
207
|
+
end
|
208
|
+
|
209
|
+
it "should fail if file has content" do
|
210
|
+
define 'foo' do
|
211
|
+
build file('test') { write 'test', "something" }
|
212
|
+
check(file('test')) { it.should be_empty }
|
213
|
+
end
|
214
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
215
|
+
end
|
216
|
+
|
217
|
+
it "should fail if file does not exist" do
|
218
|
+
define 'foo' do
|
219
|
+
check(file('test')) { it.should be_empty }
|
220
|
+
end
|
221
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
222
|
+
end
|
223
|
+
|
224
|
+
it "should pass if directory is empty" do
|
225
|
+
define 'foo' do
|
226
|
+
build file('test') { mkpath 'test' }
|
227
|
+
check(file('test')) { it.should be_empty }
|
228
|
+
end
|
229
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
230
|
+
end
|
231
|
+
|
232
|
+
it "should fail if directory has any files" do
|
233
|
+
define 'foo' do
|
234
|
+
build file('test') { write 'test/file' }
|
235
|
+
check(file('test')) { it.should be_empty }
|
236
|
+
end
|
237
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
|
242
|
+
describe Buildr::Checks::Expectation, " contain(file)" do
|
243
|
+
|
244
|
+
it "should pass if file content matches string" do
|
245
|
+
define 'foo' do
|
246
|
+
build file('test') { write 'test', 'something' }
|
247
|
+
check(file('test')) { it.should contain('thing') }
|
248
|
+
end
|
249
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
250
|
+
end
|
251
|
+
|
252
|
+
it "should pass if file content matches pattern" do
|
253
|
+
define 'foo' do
|
254
|
+
build file('test') { write 'test', "something\nor\nanother" }
|
255
|
+
check(file('test')) { it.should contain(/or/) }
|
256
|
+
end
|
257
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
258
|
+
end
|
259
|
+
|
260
|
+
it "should pass if file content matches all arguments" do
|
261
|
+
define 'foo' do
|
262
|
+
build file('test') { write 'test', "something\nor\nanother" }
|
263
|
+
check(file('test')) { it.should contain(/or/, /other/) }
|
264
|
+
end
|
265
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
266
|
+
end
|
267
|
+
|
268
|
+
it "should fail unless file content matchs all arguments" do
|
269
|
+
define 'foo' do
|
270
|
+
build file('test') { write 'test', 'something' }
|
271
|
+
check(file('test')) { it.should contain(/some/, /other/) }
|
272
|
+
end
|
273
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
274
|
+
end
|
275
|
+
|
276
|
+
it "should fail if file content does not match" do
|
277
|
+
define 'foo' do
|
278
|
+
build file('test') { write 'test', "something" }
|
279
|
+
check(file('test')) { it.should contain(/other/) }
|
280
|
+
end
|
281
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
282
|
+
end
|
283
|
+
|
284
|
+
it "should fail if file does not exist" do
|
285
|
+
define 'foo' do
|
286
|
+
check(file('test')) { it.should contain(/anything/) }
|
287
|
+
end
|
288
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
292
|
+
|
293
|
+
describe Buildr::Checks::Expectation, 'contain(directory)' do
|
294
|
+
|
295
|
+
it "should pass if directory contains file" do
|
296
|
+
write 'resources/test'
|
297
|
+
define 'foo' do
|
298
|
+
check(file('resources')) { it.should contain('test') }
|
299
|
+
end
|
300
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
301
|
+
end
|
302
|
+
|
303
|
+
it "should pass if directory contains glob pattern" do
|
304
|
+
write 'resources/with/test'
|
305
|
+
define 'foo' do
|
306
|
+
check(file('resources')) { it.should contain('**/t*st') }
|
307
|
+
end
|
308
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
309
|
+
end
|
310
|
+
|
311
|
+
it "should pass if directory contains all arguments" do
|
312
|
+
write 'resources/with/test'
|
313
|
+
define 'foo' do
|
314
|
+
check(file('resources')) { it.should contain('**/test', '**/*') }
|
315
|
+
end
|
316
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
317
|
+
end
|
318
|
+
|
319
|
+
it "should fail unless directory contains all arguments" do
|
320
|
+
write 'resources/test'
|
321
|
+
define 'foo' do
|
322
|
+
check(file('resources')) { it.should contain('test', 'or-not') }
|
323
|
+
end
|
324
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
325
|
+
end
|
326
|
+
|
327
|
+
it "should fail if directory is empty" do
|
328
|
+
mkpath 'resources'
|
329
|
+
define 'foo' do
|
330
|
+
check(file('resources')) { it.should contain('test') }
|
331
|
+
end
|
332
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
333
|
+
end
|
334
|
+
|
335
|
+
it "should fail if directory does not exist" do
|
336
|
+
define 'foo' do
|
337
|
+
check(file('resources')) { it.should contain }
|
338
|
+
end
|
339
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
340
|
+
end
|
341
|
+
end
|
342
|
+
|
343
|
+
|
344
|
+
describe Buildr::Checks::Expectation do
|
345
|
+
|
346
|
+
shared_examples_for 'all archive types' do
|
347
|
+
|
348
|
+
before do
|
349
|
+
archive = @archive
|
350
|
+
define 'foo', :version=>'1.0' do
|
351
|
+
package(archive).include('resources')
|
352
|
+
end
|
353
|
+
end
|
354
|
+
|
355
|
+
def check *args, &block
|
356
|
+
project('foo').check *args, &block
|
357
|
+
end
|
358
|
+
|
359
|
+
def package
|
360
|
+
project('foo').package(@archive)
|
361
|
+
end
|
362
|
+
|
363
|
+
describe '#exist' do
|
364
|
+
|
365
|
+
it "should pass if archive path exists" do
|
366
|
+
write 'resources/test'
|
367
|
+
check(package.path('resources')) { it.should exist }
|
368
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
369
|
+
end
|
370
|
+
|
371
|
+
it "should fail if archive path does not exist" do
|
372
|
+
mkpath 'resources'
|
373
|
+
check(package) { it.path('not-resources').should exist }
|
374
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
375
|
+
end
|
376
|
+
|
377
|
+
it "should pass if archive entry exists" do
|
378
|
+
write 'resources/test'
|
379
|
+
check(package.entry('resources/test')) { it.should exist }
|
380
|
+
check(package.path('resources').entry('test')) { it.should exist }
|
381
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
382
|
+
end
|
383
|
+
|
384
|
+
it "should fail if archive path does not exist" do
|
385
|
+
mkpath 'resources'
|
386
|
+
check(package.entry('resources/test')) { it.should exist }
|
387
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
388
|
+
end
|
389
|
+
end
|
390
|
+
|
391
|
+
describe '#be_empty' do
|
392
|
+
it "should pass if archive path is empty" do
|
393
|
+
mkpath 'resources'
|
394
|
+
check(package.path('resources')) { it.should be_empty }
|
395
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
396
|
+
end
|
397
|
+
|
398
|
+
it "should fail if archive path has any entries" do
|
399
|
+
write 'resources/test'
|
400
|
+
check(package.path('resources')) { it.should be_empty }
|
401
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
402
|
+
end
|
403
|
+
|
404
|
+
it "should pass if archive entry has no content" do
|
405
|
+
write 'resources/test'
|
406
|
+
check(package.entry('resources/test')) { it.should be_empty }
|
407
|
+
check(package.path('resources').entry('test')) { it.should be_empty }
|
408
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
409
|
+
end
|
410
|
+
|
411
|
+
it "should fail if archive entry has content" do
|
412
|
+
write 'resources/test', 'something'
|
413
|
+
check(package.entry('resources/test')) { it.should be_empty }
|
414
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
415
|
+
end
|
416
|
+
|
417
|
+
it "should fail if archive entry does not exist" do
|
418
|
+
mkpath 'resources'
|
419
|
+
check(package.entry('resources/test')) { it.should be_empty }
|
420
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
421
|
+
end
|
422
|
+
end
|
423
|
+
|
424
|
+
describe '#contain(entry)' do
|
425
|
+
|
426
|
+
it "should pass if archive entry content matches string" do
|
427
|
+
write 'resources/test', 'something'
|
428
|
+
check(package.entry('resources/test')) { it.should contain('thing') }
|
429
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
430
|
+
end
|
431
|
+
|
432
|
+
it "should pass if archive entry content matches pattern" do
|
433
|
+
write 'resources/test', "something\nor\another"
|
434
|
+
check(package.entry('resources/test')) { it.should contain(/or/) }
|
435
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
436
|
+
end
|
437
|
+
|
438
|
+
it "should pass if archive entry content matches all arguments" do
|
439
|
+
write 'resources/test', "something\nor\nanother"
|
440
|
+
check(package.entry('resources/test')) { it.should contain(/or/, /other/) }
|
441
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
442
|
+
end
|
443
|
+
|
444
|
+
it "should fail unless archive path contains all arguments" do
|
445
|
+
write 'resources/test', 'something'
|
446
|
+
check(package.entry('resources/test')) { it.should contain(/some/, /other/) }
|
447
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
448
|
+
end
|
449
|
+
|
450
|
+
it "should fail if archive entry content does not match" do
|
451
|
+
write 'resources/test', 'something'
|
452
|
+
check(package.entry('resources/test')) { it.should contain(/other/) }
|
453
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
454
|
+
end
|
455
|
+
|
456
|
+
it "should fail if archive entry does not exist" do
|
457
|
+
mkpath 'resources'
|
458
|
+
check(package.entry('resources/test')) { it.should contain(/anything/) }
|
459
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
460
|
+
end
|
461
|
+
end
|
462
|
+
|
463
|
+
describe '#contain(path)' do
|
464
|
+
|
465
|
+
it "should pass if archive path contains file" do
|
466
|
+
write 'resources/test'
|
467
|
+
check(package.path('resources')) { it.should contain('test') }
|
468
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
469
|
+
end
|
470
|
+
|
471
|
+
it "should handle deep nesting" do
|
472
|
+
write 'resources/test/test2.efx'
|
473
|
+
check(package) { it.should contain('resources/test/test2.efx') }
|
474
|
+
check(package.path('resources')) { it.should contain('test/test2.efx') }
|
475
|
+
check(package.path('resources/test')) { it.should contain('test2.efx') }
|
476
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
477
|
+
end
|
478
|
+
|
479
|
+
it "should pass if archive path contains pattern" do
|
480
|
+
write 'resources/with/test'
|
481
|
+
check(package.path('resources')) { it.should contain('**/t*st') }
|
482
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
483
|
+
end
|
484
|
+
|
485
|
+
it "should pass if archive path contains all arguments" do
|
486
|
+
write 'resources/with/test'
|
487
|
+
check(package.path('resources')) { it.should contain('**/test', '**/*') }
|
488
|
+
lambda { project('foo').task('package').invoke }.should_not raise_error
|
489
|
+
end
|
490
|
+
|
491
|
+
it "should fail unless archive path contains all arguments" do
|
492
|
+
write 'resources/test'
|
493
|
+
check(package.path('resources')) { it.should contain('test', 'or-not') }
|
494
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
495
|
+
end
|
496
|
+
|
497
|
+
it "should fail if archive path is empty" do
|
498
|
+
mkpath 'resources'
|
499
|
+
check(package.path('resources')) { it.should contain('test') }
|
500
|
+
lambda { project('foo').task('package').invoke }.should raise_error(RuntimeError, /Checks failed/)
|
501
|
+
end
|
502
|
+
end
|
503
|
+
end
|
504
|
+
|
505
|
+
describe 'ZIP' do
|
506
|
+
before { @archive = :jar }
|
507
|
+
it_should_behave_like 'all archive types'
|
508
|
+
end
|
509
|
+
|
510
|
+
describe 'tar' do
|
511
|
+
before { @archive = :tar }
|
512
|
+
it_should_behave_like 'all archive types'
|
513
|
+
end
|
514
|
+
|
515
|
+
describe 'tgz' do
|
516
|
+
before { @archive = :tgz }
|
517
|
+
it_should_behave_like 'all archive types'
|
518
|
+
end
|
519
|
+
end
|