buildr-gemjar 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (252) hide show
  1. data/.braids +8 -0
  2. data/.gitignore +5 -0
  3. data/.rvmrc +1 -0
  4. data/CHANGELOG.md +4 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE +20 -0
  7. data/README.md +98 -0
  8. data/Rakefile +8 -0
  9. data/buildr-gemjar.gemspec +42 -0
  10. data/lib/buildr-gemjar.rb +162 -0
  11. data/lib/buildr-gemjar/version.rb +3 -0
  12. data/meta.rakefile +30 -0
  13. data/spec/buildr-gemjar/version_spec.rb +11 -0
  14. data/spec/buildr-gemjar_spec.rb +179 -0
  15. data/spec/repo_builder.rb +59 -0
  16. data/spec/spec_helper.rb +44 -0
  17. data/vendor/buildr/.gitignore +17 -0
  18. data/vendor/buildr/CHANGELOG +1283 -0
  19. data/vendor/buildr/Gemfile +4 -0
  20. data/vendor/buildr/LICENSE +176 -0
  21. data/vendor/buildr/NOTICE +26 -0
  22. data/vendor/buildr/README.rdoc +134 -0
  23. data/vendor/buildr/Rakefile +44 -0
  24. data/vendor/buildr/_buildr +35 -0
  25. data/vendor/buildr/_jbuildr +35 -0
  26. data/vendor/buildr/addon/buildr/antlr.rb +65 -0
  27. data/vendor/buildr/addon/buildr/bnd.rb +147 -0
  28. data/vendor/buildr/addon/buildr/cobertura.rb +22 -0
  29. data/vendor/buildr/addon/buildr/drb.rb +281 -0
  30. data/vendor/buildr/addon/buildr/emma.rb +22 -0
  31. data/vendor/buildr/addon/buildr/hibernate.rb +149 -0
  32. data/vendor/buildr/addon/buildr/javacc.rb +85 -0
  33. data/vendor/buildr/addon/buildr/jaxb_xjc.rb +72 -0
  34. data/vendor/buildr/addon/buildr/jdepend.rb +60 -0
  35. data/vendor/buildr/addon/buildr/jetty.rb +248 -0
  36. data/vendor/buildr/addon/buildr/jibx.rb +86 -0
  37. data/vendor/buildr/addon/buildr/nailgun.rb +221 -0
  38. data/vendor/buildr/addon/buildr/openjpa.rb +88 -0
  39. data/vendor/buildr/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
  40. data/vendor/buildr/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
  41. data/vendor/buildr/addon/buildr/org/apache/buildr/BuildrNail.java +41 -0
  42. data/vendor/buildr/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
  43. data/vendor/buildr/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
  44. data/vendor/buildr/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
  45. data/vendor/buildr/addon/buildr/org/apache/buildr/JettyWrapper.java +144 -0
  46. data/vendor/buildr/addon/buildr/protobuf.rb +88 -0
  47. data/vendor/buildr/addon/buildr/xmlbeans.rb +93 -0
  48. data/vendor/buildr/all-in-one/_buildr +19 -0
  49. data/vendor/buildr/all-in-one/buildr +368 -0
  50. data/vendor/buildr/all-in-one/buildr.cmd +1 -0
  51. data/vendor/buildr/bin/buildr +19 -0
  52. data/vendor/buildr/buildr.buildfile +58 -0
  53. data/vendor/buildr/buildr.gemspec +74 -0
  54. data/vendor/buildr/doc/_config.yml +1 -0
  55. data/vendor/buildr/doc/_layouts/default.html +90 -0
  56. data/vendor/buildr/doc/_layouts/preface.html +22 -0
  57. data/vendor/buildr/doc/artifacts.textile +217 -0
  58. data/vendor/buildr/doc/building.textile +276 -0
  59. data/vendor/buildr/doc/contributing.textile +268 -0
  60. data/vendor/buildr/doc/css/default.css +236 -0
  61. data/vendor/buildr/doc/css/print.css +101 -0
  62. data/vendor/buildr/doc/css/syntax.css +23 -0
  63. data/vendor/buildr/doc/download.textile +138 -0
  64. data/vendor/buildr/doc/extending.textile +212 -0
  65. data/vendor/buildr/doc/images/1442160941-frontcover.jpg +0 -0
  66. data/vendor/buildr/doc/images/asf-logo.gif +0 -0
  67. data/vendor/buildr/doc/images/asf-logo.png +0 -0
  68. data/vendor/buildr/doc/images/buildr-hires.png +0 -0
  69. data/vendor/buildr/doc/images/buildr.png +0 -0
  70. data/vendor/buildr/doc/images/favicon.png +0 -0
  71. data/vendor/buildr/doc/images/growl-icon.tiff +0 -0
  72. data/vendor/buildr/doc/images/note.png +0 -0
  73. data/vendor/buildr/doc/images/project-structure.png +0 -0
  74. data/vendor/buildr/doc/images/tip.png +0 -0
  75. data/vendor/buildr/doc/images/zbuildr.png +0 -0
  76. data/vendor/buildr/doc/images/zbuildr.tif +0 -0
  77. data/vendor/buildr/doc/index.textile +69 -0
  78. data/vendor/buildr/doc/installing.textile +284 -0
  79. data/vendor/buildr/doc/languages.textile +599 -0
  80. data/vendor/buildr/doc/mailing_lists.textile +29 -0
  81. data/vendor/buildr/doc/more_stuff.textile +845 -0
  82. data/vendor/buildr/doc/packaging.textile +618 -0
  83. data/vendor/buildr/doc/preface.textile +54 -0
  84. data/vendor/buildr/doc/projects.textile +276 -0
  85. data/vendor/buildr/doc/quick_start.textile +210 -0
  86. data/vendor/buildr/doc/releasing.textile +117 -0
  87. data/vendor/buildr/doc/scripts/buildr-git.rb +512 -0
  88. data/vendor/buildr/doc/scripts/gitflow.rb +296 -0
  89. data/vendor/buildr/doc/scripts/install-jruby.sh +44 -0
  90. data/vendor/buildr/doc/scripts/install-linux.sh +73 -0
  91. data/vendor/buildr/doc/scripts/install-osx.sh +52 -0
  92. data/vendor/buildr/doc/settings_profiles.textile +287 -0
  93. data/vendor/buildr/doc/testing.textile +247 -0
  94. data/vendor/buildr/etc/KEYS +189 -0
  95. data/vendor/buildr/lib/buildr.rb +44 -0
  96. data/vendor/buildr/lib/buildr/clojure.rb +34 -0
  97. data/vendor/buildr/lib/buildr/clojure/shell.rb +52 -0
  98. data/vendor/buildr/lib/buildr/core.rb +34 -0
  99. data/vendor/buildr/lib/buildr/core/application.rb +700 -0
  100. data/vendor/buildr/lib/buildr/core/build.rb +516 -0
  101. data/vendor/buildr/lib/buildr/core/cc.rb +166 -0
  102. data/vendor/buildr/lib/buildr/core/checks.rb +253 -0
  103. data/vendor/buildr/lib/buildr/core/common.rb +151 -0
  104. data/vendor/buildr/lib/buildr/core/compile.rb +622 -0
  105. data/vendor/buildr/lib/buildr/core/doc.rb +276 -0
  106. data/vendor/buildr/lib/buildr/core/environment.rb +129 -0
  107. data/vendor/buildr/lib/buildr/core/filter.rb +404 -0
  108. data/vendor/buildr/lib/buildr/core/generate.rb +197 -0
  109. data/vendor/buildr/lib/buildr/core/help.rb +119 -0
  110. data/vendor/buildr/lib/buildr/core/jrebel.rb +42 -0
  111. data/vendor/buildr/lib/buildr/core/linux.rb +30 -0
  112. data/vendor/buildr/lib/buildr/core/osx.rb +46 -0
  113. data/vendor/buildr/lib/buildr/core/progressbar.rb +161 -0
  114. data/vendor/buildr/lib/buildr/core/project.rb +975 -0
  115. data/vendor/buildr/lib/buildr/core/run.rb +43 -0
  116. data/vendor/buildr/lib/buildr/core/shell.rb +137 -0
  117. data/vendor/buildr/lib/buildr/core/test.rb +843 -0
  118. data/vendor/buildr/lib/buildr/core/transports.rb +565 -0
  119. data/vendor/buildr/lib/buildr/core/util.rb +537 -0
  120. data/vendor/buildr/lib/buildr/groovy.rb +20 -0
  121. data/vendor/buildr/lib/buildr/groovy/bdd.rb +106 -0
  122. data/vendor/buildr/lib/buildr/groovy/compiler.rb +153 -0
  123. data/vendor/buildr/lib/buildr/groovy/doc.rb +76 -0
  124. data/vendor/buildr/lib/buildr/groovy/shell.rb +57 -0
  125. data/vendor/buildr/lib/buildr/ide.rb +19 -0
  126. data/vendor/buildr/lib/buildr/ide/eclipse.rb +427 -0
  127. data/vendor/buildr/lib/buildr/ide/eclipse/java.rb +53 -0
  128. data/vendor/buildr/lib/buildr/ide/eclipse/plugin.rb +71 -0
  129. data/vendor/buildr/lib/buildr/ide/eclipse/scala.rb +68 -0
  130. data/vendor/buildr/lib/buildr/ide/idea.rb +576 -0
  131. data/vendor/buildr/lib/buildr/java.rb +25 -0
  132. data/vendor/buildr/lib/buildr/java/ant.rb +94 -0
  133. data/vendor/buildr/lib/buildr/java/bdd.rb +460 -0
  134. data/vendor/buildr/lib/buildr/java/cobertura.rb +297 -0
  135. data/vendor/buildr/lib/buildr/java/commands.rb +223 -0
  136. data/vendor/buildr/lib/buildr/java/compiler.rb +135 -0
  137. data/vendor/buildr/lib/buildr/java/deprecated.rb +141 -0
  138. data/vendor/buildr/lib/buildr/java/doc.rb +86 -0
  139. data/vendor/buildr/lib/buildr/java/ecj.rb +69 -0
  140. data/vendor/buildr/lib/buildr/java/emma.rb +244 -0
  141. data/vendor/buildr/lib/buildr/java/external.rb +73 -0
  142. data/vendor/buildr/lib/buildr/java/jruby.rb +122 -0
  143. data/vendor/buildr/lib/buildr/java/jtestr_result.rb +295 -0
  144. data/vendor/buildr/lib/buildr/java/jtestr_runner.rb.erb +116 -0
  145. data/vendor/buildr/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  146. data/vendor/buildr/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +142 -0
  147. data/vendor/buildr/lib/buildr/java/packaging.rb +734 -0
  148. data/vendor/buildr/lib/buildr/java/pom.rb +178 -0
  149. data/vendor/buildr/lib/buildr/java/rjb.rb +154 -0
  150. data/vendor/buildr/lib/buildr/java/test_result.rb +101 -0
  151. data/vendor/buildr/lib/buildr/java/tests.rb +362 -0
  152. data/vendor/buildr/lib/buildr/java/version_requirement.rb +172 -0
  153. data/vendor/buildr/lib/buildr/packaging.rb +25 -0
  154. data/vendor/buildr/lib/buildr/packaging/archive.rb +535 -0
  155. data/vendor/buildr/lib/buildr/packaging/artifact.rb +903 -0
  156. data/vendor/buildr/lib/buildr/packaging/artifact_namespace.rb +984 -0
  157. data/vendor/buildr/lib/buildr/packaging/artifact_search.rb +140 -0
  158. data/vendor/buildr/lib/buildr/packaging/gems.rb +105 -0
  159. data/vendor/buildr/lib/buildr/packaging/package.rb +249 -0
  160. data/vendor/buildr/lib/buildr/packaging/tar.rb +189 -0
  161. data/vendor/buildr/lib/buildr/packaging/version_requirement.rb +192 -0
  162. data/vendor/buildr/lib/buildr/packaging/zip.rb +178 -0
  163. data/vendor/buildr/lib/buildr/packaging/ziptask.rb +356 -0
  164. data/vendor/buildr/lib/buildr/resources/buildr.icns +0 -0
  165. data/vendor/buildr/lib/buildr/resources/completed.png +0 -0
  166. data/vendor/buildr/lib/buildr/resources/failed.png +0 -0
  167. data/vendor/buildr/lib/buildr/resources/icons-license.txt +17 -0
  168. data/vendor/buildr/lib/buildr/run.rb +195 -0
  169. data/vendor/buildr/lib/buildr/scala.rb +26 -0
  170. data/vendor/buildr/lib/buildr/scala/bdd.rb +118 -0
  171. data/vendor/buildr/lib/buildr/scala/compiler.rb +242 -0
  172. data/vendor/buildr/lib/buildr/scala/doc.rb +142 -0
  173. data/vendor/buildr/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
  174. data/vendor/buildr/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.java +57 -0
  175. data/vendor/buildr/lib/buildr/scala/shell.rb +52 -0
  176. data/vendor/buildr/lib/buildr/scala/tests.rb +171 -0
  177. data/vendor/buildr/lib/buildr/shell.rb +185 -0
  178. data/vendor/buildr/lib/buildr/version.rb +18 -0
  179. data/vendor/buildr/rakelib/all-in-one.rake +113 -0
  180. data/vendor/buildr/rakelib/checks.rake +57 -0
  181. data/vendor/buildr/rakelib/doc.rake +137 -0
  182. data/vendor/buildr/rakelib/metrics.rake +39 -0
  183. data/vendor/buildr/rakelib/package.rake +73 -0
  184. data/vendor/buildr/rakelib/release.rake +161 -0
  185. data/vendor/buildr/rakelib/rspec.rake +101 -0
  186. data/vendor/buildr/rakelib/setup.rake +66 -0
  187. data/vendor/buildr/rakelib/stage.rake +220 -0
  188. data/vendor/buildr/spec/addon/bnd_spec.rb +330 -0
  189. data/vendor/buildr/spec/addon/drb_spec.rb +328 -0
  190. data/vendor/buildr/spec/addon/jaxb_xjc_spec.rb +125 -0
  191. data/vendor/buildr/spec/core/application_spec.rb +631 -0
  192. data/vendor/buildr/spec/core/build_spec.rb +837 -0
  193. data/vendor/buildr/spec/core/cc_spec.rb +224 -0
  194. data/vendor/buildr/spec/core/checks_spec.rb +519 -0
  195. data/vendor/buildr/spec/core/common_spec.rb +725 -0
  196. data/vendor/buildr/spec/core/compile_spec.rb +658 -0
  197. data/vendor/buildr/spec/core/doc_spec.rb +195 -0
  198. data/vendor/buildr/spec/core/extension_spec.rb +201 -0
  199. data/vendor/buildr/spec/core/generate_spec.rb +33 -0
  200. data/vendor/buildr/spec/core/project_spec.rb +772 -0
  201. data/vendor/buildr/spec/core/run_spec.rb +93 -0
  202. data/vendor/buildr/spec/core/shell_spec.rb +146 -0
  203. data/vendor/buildr/spec/core/test_spec.rb +1320 -0
  204. data/vendor/buildr/spec/core/transport_spec.rb +544 -0
  205. data/vendor/buildr/spec/core/util_spec.rb +141 -0
  206. data/vendor/buildr/spec/groovy/bdd_spec.rb +80 -0
  207. data/vendor/buildr/spec/groovy/compiler_spec.rb +251 -0
  208. data/vendor/buildr/spec/groovy/doc_spec.rb +65 -0
  209. data/vendor/buildr/spec/ide/eclipse_spec.rb +739 -0
  210. data/vendor/buildr/spec/ide/idea_spec.rb +1144 -0
  211. data/vendor/buildr/spec/java/ant_spec.rb +37 -0
  212. data/vendor/buildr/spec/java/bdd_spec.rb +374 -0
  213. data/vendor/buildr/spec/java/cobertura_spec.rb +112 -0
  214. data/vendor/buildr/spec/java/commands_spec.rb +93 -0
  215. data/vendor/buildr/spec/java/compiler_spec.rb +252 -0
  216. data/vendor/buildr/spec/java/doc_spec.rb +56 -0
  217. data/vendor/buildr/spec/java/ecj_spec.rb +115 -0
  218. data/vendor/buildr/spec/java/emma_spec.rb +121 -0
  219. data/vendor/buildr/spec/java/external_spec.rb +56 -0
  220. data/vendor/buildr/spec/java/java_spec.rb +132 -0
  221. data/vendor/buildr/spec/java/packaging_spec.rb +1270 -0
  222. data/vendor/buildr/spec/java/run_spec.rb +78 -0
  223. data/vendor/buildr/spec/java/test_coverage_helper.rb +257 -0
  224. data/vendor/buildr/spec/java/tests_spec.rb +497 -0
  225. data/vendor/buildr/spec/packaging/archive_spec.rb +775 -0
  226. data/vendor/buildr/spec/packaging/artifact_namespace_spec.rb +743 -0
  227. data/vendor/buildr/spec/packaging/artifact_spec.rb +1066 -0
  228. data/vendor/buildr/spec/packaging/packaging_helper.rb +63 -0
  229. data/vendor/buildr/spec/packaging/packaging_spec.rb +719 -0
  230. data/vendor/buildr/spec/sandbox.rb +165 -0
  231. data/vendor/buildr/spec/scala/bdd_spec.rb +124 -0
  232. data/vendor/buildr/spec/scala/compiler_spec.rb +289 -0
  233. data/vendor/buildr/spec/scala/doc_spec.rb +88 -0
  234. data/vendor/buildr/spec/scala/scala.rb +38 -0
  235. data/vendor/buildr/spec/scala/tests_spec.rb +283 -0
  236. data/vendor/buildr/spec/spec_helpers.rb +369 -0
  237. data/vendor/buildr/spec/version_requirement_spec.rb +143 -0
  238. data/vendor/buildr/spec/xpath_matchers.rb +121 -0
  239. data/vendor/buildr/tests/BUILDR-320/Buildfile +29 -0
  240. data/vendor/buildr/tests/JavaSystemProperty/Buildfile +18 -0
  241. data/vendor/buildr/tests/JavaSystemProperty/src/test/java/FooTest.java +24 -0
  242. data/vendor/buildr/tests/compile_with_parent/Buildfile +18 -0
  243. data/vendor/buildr/tests/compile_with_parent/child/src/main/java/Foo.java +23 -0
  244. data/vendor/buildr/tests/helloWorld/Buildfile +20 -0
  245. data/vendor/buildr/tests/helloWorld/src/main/java/HelloWorld.java +23 -0
  246. data/vendor/buildr/tests/integration_testing.rb +56 -0
  247. data/vendor/buildr/tests/junit3/Buildfile +9 -0
  248. data/vendor/buildr/tests/junit3/src/main/java/Foo.java +23 -0
  249. data/vendor/buildr/tests/junit3/src/test/java/FooTest.java +28 -0
  250. data/vendor/buildr/tests/package_war_as_jar/Buildfile +15 -0
  251. data/vendor/buildr/tests/package_war_as_jar/src/main/java/Foo.java +19 -0
  252. metadata +524 -0
@@ -0,0 +1,143 @@
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
+ describe Buildr::VersionRequirement, '.create' do
20
+ def create(str)
21
+ Buildr::VersionRequirement.create(str)
22
+ end
23
+
24
+ it 'should complain on invalid input' do
25
+ lambda { create }.should raise_error(Exception)
26
+ lambda { create('%') }.should raise_error(Exception, /invalid character/)
27
+ lambda { create('1#{0}') }.should raise_error(Exception, /invalid character/)
28
+ lambda { create('1.0rc`exit`') }.should raise_error(Exception, /invalid character/)
29
+ lambda { create(1.0) }.should raise_error(Exception)
30
+ lambda { create('1.0') }.should_not raise_error(Exception)
31
+ lambda { create('1.0rc3') }.should_not raise_error(Exception)
32
+ end
33
+
34
+ it 'should allow versions using hyphen' do
35
+ lambda { create('1.0-rc3') }.should_not raise_error(Exception)
36
+ end
37
+
38
+ it 'should create a single version requirement' do
39
+ create('1.0').should_not be_composed
40
+ end
41
+
42
+ it 'should create a composed version requirement' do
43
+ create('1.0 | 2.1').should be_composed
44
+ end
45
+ end
46
+
47
+ =begin
48
+ # TODO: Fix this.
49
+ # 1. Can't use should_satisfy, this breaks under RSpec 1.2
50
+ # 2. These should_satisfy calls are not proper specs since the subject is
51
+ # the satistifed_by? method. satisfied_by should satisfy???
52
+ describe Buildr::VersionRequirement, '#satisfied_by?' do
53
+ def should_satisfy(str, valids = [], invalids = [])
54
+ req = Buildr::VersionRequirement.create(str)
55
+ valids.each { |v| req.should be_satisfied_by(v) }
56
+ invalids.each { |v| req.should_not be_satisfied_by(v) }
57
+ end
58
+
59
+ it 'should accept Gem version operators' do
60
+ should_satisfy '1.0', %w(1 1.0), %w(1.1 0.1)
61
+ should_satisfy '=1.0', %w(1 1.0), %w(1.1 0.1)
62
+ should_satisfy '= 1.0', %w(1 1.0), %w(1.1 0.1)
63
+ should_satisfy '!= 1.0', %w(0.9 1.1 2), %w(1 1.0 1.0.0)
64
+
65
+ should_satisfy '>1.0', %w(1.0.1), %w(1 1.0 0.1)
66
+ should_satisfy '>=1.0', %w(1.0.1 1 1.0), %w(0.9)
67
+
68
+ should_satisfy '<1.0', %w(0.9 0.9.9), %w(1 1.0 1.1 2)
69
+ should_satisfy '<=1.0', %w(0.9 0.9.9 1 1.0), %w(1.1 2)
70
+
71
+ should_satisfy '~> 1.2.3', %w(1.2.3 1.2.3.4 1.2.4), %w(1.2.1 0.9 1.4 2)
72
+ end
73
+
74
+ it 'should accept logic not operator' do
75
+ should_satisfy 'not 0.5', %w(0 1), %w(0.5)
76
+ should_satisfy '! 0.5', %w(0 1), %w(0.5)
77
+ should_satisfy '!= 0.5', %w(0 1), %w(0.5)
78
+ should_satisfy '!<= 0.5', %w(0.5.1 2), %w(0.5)
79
+ end
80
+
81
+ it 'should accept logic or operator' do
82
+ should_satisfy '0.5 or 2.0', %w(0.5 2.0), %w(1.0 0.5.1 2.0.9)
83
+ should_satisfy '0.5 | 2.0', %w(0.5 2.0), %w(1.0 0.5.1 2.0.9)
84
+ end
85
+
86
+ it 'should accept logic and operator' do
87
+ should_satisfy '>1.5 and <2.0', %w(1.6 1.9), %w(1.5 2 2.0)
88
+ should_satisfy '>1.5 & <2.0', %w(1.6 1.9), %w(1.5 2 2.0)
89
+ end
90
+
91
+ it 'should assume logic and if missing operator between expressions' do
92
+ should_satisfy '>1.5 <2.0', %w(1.6 1.9), %w(1.5 2 2.0)
93
+ end
94
+
95
+ it 'should allow combining logic operators' do
96
+ should_satisfy '>1.0 | <2.0 | =3.0', %w(1.5 3.0 1 2 4)
97
+ should_satisfy '>1.0 & <2.0 | =3.0', %w(1.3 3.0), %w(1 2)
98
+ should_satisfy '=1.0 | <2.0 & =0.5', %w(0.5 1.0), %w(1.1 0.1 2)
99
+ should_satisfy '~>1.1 | ~>1.3 | ~>1.5 | 2.0', %w(2 1.5.6 1.1.2 1.1.3), %w(1.0.9 0.5 2.2.1)
100
+ should_satisfy 'not(2) | 1', %w(1 3), %w(2)
101
+ end
102
+
103
+ it 'should allow using parens to group logic expressions' do
104
+ should_satisfy '(1.0)', %w(1 1.0), %w(0.9 1.1)
105
+ should_satisfy '!( !(1.0) )', %w(1 1.0), %w(0.9 1.1)
106
+ should_satisfy '1 | !(2 | 3)', %w(1), %w(2 3)
107
+ should_satisfy '!(2 | 3) | 1', %w(1), %w(2 3)
108
+ end
109
+ end
110
+ =end
111
+
112
+ describe Buildr::VersionRequirement, '#default' do
113
+ it 'should return nil if missing default requirement' do
114
+ Buildr::VersionRequirement.create('>1').default.should be_nil
115
+ Buildr::VersionRequirement.create('<1').default.should be_nil
116
+ Buildr::VersionRequirement.create('!1').default.should be_nil
117
+ Buildr::VersionRequirement.create('!<=1').default.should be_nil
118
+ end
119
+
120
+ it 'should return the last version with a = requirement' do
121
+ Buildr::VersionRequirement.create('1').default.should == '1'
122
+ Buildr::VersionRequirement.create('=1').default.should == '1'
123
+ Buildr::VersionRequirement.create('<=1').default.should == '1'
124
+ Buildr::VersionRequirement.create('>=1').default.should == '1'
125
+ Buildr::VersionRequirement.create('1 | 2 | 3').default.should == '3'
126
+ Buildr::VersionRequirement.create('1 2 | 3').default.should == '3'
127
+ Buildr::VersionRequirement.create('1 & 2 | 3').default.should == '3'
128
+ end
129
+ end
130
+
131
+ describe Buildr::VersionRequirement, '#version?' do
132
+ it 'should identify valid versions' do
133
+ Buildr::VersionRequirement.version?('1').should be_true
134
+ Buildr::VersionRequirement.version?('1a').should be_true
135
+ Buildr::VersionRequirement.version?('1.0').should be_true
136
+ Buildr::VersionRequirement.version?('11.0').should be_true
137
+ Buildr::VersionRequirement.version?(' 11.0 ').should be_true
138
+ Buildr::VersionRequirement.version?('11.0-alpha').should be_true
139
+
140
+ Buildr::VersionRequirement.version?('a').should be_false
141
+ Buildr::VersionRequirement.version?('a1').should be_false
142
+ end
143
+ end
@@ -0,0 +1,121 @@
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
+ require 'rexml/document'
17
+ require 'rexml/element'
18
+
19
+ module RSpec
20
+ module Matchers
21
+
22
+ # check if the xpath exists one or more times
23
+ class HaveXpath
24
+ def initialize(xpath)
25
+ @xpath = xpath
26
+ end
27
+
28
+ def matches?(response)
29
+ @response = response
30
+ doc = response.is_a?(REXML::Document) ? response : REXML::Document.new(@response)
31
+ match = REXML::XPath.match(doc, @xpath)
32
+ not match.empty?
33
+ end
34
+
35
+ def failure_message
36
+ "Did not find expected xpath #{@xpath}"
37
+ end
38
+
39
+ def negative_failure_message
40
+ "Did find unexpected xpath #{@xpath}"
41
+ end
42
+
43
+ def description
44
+ "match the xpath expression #{@xpath}"
45
+ end
46
+ end
47
+
48
+ def have_xpath(xpath)
49
+ HaveXpath.new(xpath)
50
+ end
51
+
52
+ # check if the xpath has the specified value
53
+ # value is a string and there must be a single result to match its
54
+ # equality against
55
+ class MatchXpath
56
+ def initialize(xpath, val)
57
+ @xpath = xpath
58
+ @val= val
59
+ end
60
+
61
+ def matches?(response)
62
+ @response = response
63
+ doc = response.is_a?(REXML::Document) ? response : REXML::Document.new(@response)
64
+ ok = true
65
+ REXML::XPath.each(doc, @xpath) do |e|
66
+ @actual_val = case e
67
+ when REXML::Attribute
68
+ e.to_s
69
+ when REXML::Element
70
+ e.text
71
+ else
72
+ e.to_s
73
+ end
74
+ return false unless @val == @actual_val
75
+ end
76
+ return ok
77
+ end
78
+
79
+ def failure_message
80
+ "The xpath #{@xpath} did not have the value '#{@val}' It was '#{@actual_val}'"
81
+ end
82
+
83
+ def description
84
+ "match the xpath expression #{@xpath} with #{@val}"
85
+ end
86
+ end
87
+
88
+ def match_xpath(xpath, val)
89
+ MatchXpath.new(xpath, val)
90
+ end
91
+
92
+ # checks if the given xpath occurs num times
93
+ class HaveNodes #:nodoc:
94
+ def initialize(xpath, num)
95
+ @xpath= xpath
96
+ @num = num
97
+ end
98
+
99
+ def matches?(response)
100
+ @response = response
101
+ doc = response.is_a?(REXML::Document) ? response : REXML::Document.new(@response)
102
+ match = REXML::XPath.match(doc, @xpath)
103
+ @num_found= match.size
104
+ @num_found == @num
105
+ end
106
+
107
+ def failure_message
108
+ "Did not find expected number of nodes #{@num} in xpath #{@xpath} Found #{@num_found}"
109
+ end
110
+
111
+ def description
112
+ "match the number of nodes #{@num}"
113
+ end
114
+ end
115
+
116
+ def have_nodes(xpath, num)
117
+ HaveNodes.new(xpath, num)
118
+ end
119
+
120
+ end
121
+ end
@@ -0,0 +1,29 @@
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
+ define "whole" do
17
+ define 'sub' do
18
+ define 'C' do
19
+ compile.with project('sub:B')
20
+ end
21
+
22
+ define 'A' do
23
+ end
24
+
25
+ define 'B' do
26
+ compile.with project('sub:A')
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,18 @@
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
+ define "proj" do
17
+ Java.java.lang.System.setProperty("foo", "bar")
18
+ end
@@ -0,0 +1,24 @@
1
+ /*
2
+ * Licensed to the Apache Software Foundation (ASF) under one or more
3
+ * contributor license agreements. See the NOTICE file distributed with this
4
+ * work for additional information regarding copyright ownership. The ASF
5
+ * licenses this file to you under the Apache License, Version 2.0 (the
6
+ * "License"); you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
+ * License for the specific language governing permissions and limitations under
15
+ * the License.
16
+ */
17
+
18
+ import org.junit.Test;
19
+
20
+ public class FooTest {
21
+
22
+ @Test
23
+ public void testSomething() {}
24
+ }
@@ -0,0 +1,18 @@
1
+
2
+ repositories.remote << "http://repo1.maven.org/maven2"
3
+
4
+ LOG4J = artifact("log4j:log4j:jar:1.2.16")
5
+ unless File.exist? File.join("lib", File.basename(LOG4J.to_s))
6
+ LOG4J.invoke
7
+ cp LOG4J.to_s, "lib"
8
+ end
9
+
10
+ define "parent" do
11
+
12
+ define "child" do
13
+
14
+ compile.with project.parent.path_to(File.join("lib", File.basename(LOG4J.to_s)))
15
+
16
+ end
17
+ end
18
+
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Licensed to the Apache Software Foundation (ASF) under one or more
3
+ * contributor license agreements. See the NOTICE file distributed with this
4
+ * work for additional information regarding copyright ownership. The ASF
5
+ * licenses this file to you under the Apache License, Version 2.0 (the
6
+ * "License"); you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
+ * License for the specific language governing permissions and limitations under
15
+ * the License.
16
+ */
17
+
18
+ import org.apache.log4j.Logger;
19
+
20
+ public class Foo {
21
+
22
+ private static final Logger _logger = Logger.getLogger(Foo.class);
23
+ }
@@ -0,0 +1,20 @@
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
+ define "helloWorld", :version => "1.0", :group => "org.buildr" do
17
+
18
+ package(:jar)
19
+
20
+ end
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Licensed to the Apache Software Foundation (ASF) under one or more
3
+ * contributor license agreements. See the NOTICE file distributed with this
4
+ * work for additional information regarding copyright ownership. The ASF
5
+ * licenses this file to you under the Apache License, Version 2.0 (the
6
+ * "License"); you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
+ * License for the specific language governing permissions and limitations under
15
+ * the License.
16
+ */
17
+
18
+ public class HelloWorld {
19
+
20
+ public void foo() {
21
+ System.err.println("bar");
22
+ }
23
+ }
@@ -0,0 +1,56 @@
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
+ BUILDR = ENV['BUILDR'] || File.join(File.expand_path(File.dirname(__FILE__)), "..", "_buildr")
17
+
18
+ require 'test/unit'
19
+
20
+ def test(folder, cmd)
21
+ eval <<-TEST
22
+ class #{folder.sub("-", "").capitalize} < Test::Unit::TestCase
23
+
24
+ def test_#{folder.sub("-", "")}
25
+ result = %x[cd #{File.join(File.expand_path(File.dirname(__FILE__)), "#{folder}")} ; #{cmd} ; #{BUILDR} clean]
26
+ assert($?.success?)
27
+ end
28
+
29
+ end
30
+ TEST
31
+
32
+ end
33
+
34
+ class Buildr320 < Test::Unit::TestCase
35
+
36
+ def test_circular_dependency
37
+ result = %x[cd #{File.join(File.expand_path(File.dirname(__FILE__)), "BUILDR-320")} ; #{BUILDR} --trace -P]
38
+ assert($?.success?)
39
+ end
40
+ end
41
+
42
+ test("JavaSystemProperty", "#{BUILDR} test")
43
+ test("helloWorld", "#{BUILDR} package")
44
+ test("compile_with_parent", "#{BUILDR} compile")
45
+ test("junit3", "#{BUILDR} test")
46
+
47
+ class Package_war_as_jar < Test::Unit::TestCase
48
+
49
+ def test_war_extension_is_jar
50
+ result = %x[cd #{File.join(File.expand_path(File.dirname(__FILE__)), "package_war_as_jar")} ; #{BUILDR} package]
51
+ assert($?.success?)
52
+ assert(File.exist? File.join(File.expand_path(File.dirname(__FILE__)), "package_war_as_jar", "target", "webapp-1.0.jar"))
53
+ %x[cd #{File.join(File.expand_path(File.dirname(__FILE__)), "package_war_as_jar")} ; #{BUILDR} clean]
54
+ assert($?.success?)
55
+ end
56
+ end