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,197 @@
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 'buildr/java/pom'
18
+
19
+
20
+ module Buildr
21
+ module Generate #:nodoc:
22
+
23
+ task 'generate' do
24
+ script = nil
25
+ choose do |menu|
26
+ menu.header = "To use Buildr you need a buildfile. Do you want me to create one?"
27
+
28
+ menu.choice("From maven2 pom file") { script = Generate.from_maven2_pom('pom.xml').join("\n") } if File.exists?("pom.xml")
29
+ menu.choice("From directory structure") { script = Generate.from_directory(Dir.pwd).join("\n") }
30
+ menu.choice("Skip") { }
31
+ end
32
+
33
+ if script
34
+ buildfile = File.expand_path(Buildr::Application::DEFAULT_BUILDFILES.first)
35
+ File.open(buildfile, "w") { |file| file.write script }
36
+ puts "Created #{buildfile}"
37
+ end
38
+ end
39
+
40
+ class << self
41
+
42
+ HEADER = "# Generated by Buildr #{Buildr::VERSION}, change to your liking\n\n"
43
+
44
+ def from_directory(path = Dir.pwd, root = true)
45
+ Dir.chdir(path) do
46
+ name = File.basename(path)
47
+ if root
48
+ script = HEADER.split("\n")
49
+ header = <<-EOF
50
+ #{"require 'buildr/scala'\n" if Dir.glob(path + "/**/*.scala").size > 0}
51
+ #{"require 'buildr/groovy'\n" if Dir.glob(path + "/**/*.groovy").size > 0}
52
+ # Version number for this release
53
+ VERSION_NUMBER = "1.0.0"
54
+ # Group identifier for your projects
55
+ GROUP = "#{name}"
56
+ COPYRIGHT = ""
57
+
58
+ # Specify Maven 2.0 remote repositories here, like this:
59
+ repositories.remote << "http://www.ibiblio.org/maven2/"
60
+
61
+ desc "The #{name.capitalize} project"
62
+ define "#{name}" do
63
+
64
+ project.version = VERSION_NUMBER
65
+ project.group = GROUP
66
+ manifest["Implementation-Vendor"] = COPYRIGHT
67
+ EOF
68
+ script += header.split("\n")
69
+ else
70
+ script = [ %{define "#{name}" do} ]
71
+ end
72
+ script << " compile.with # Add classpath dependencies" if File.exist?("src/main/java")
73
+ script << " resources" if File.exist?("src/main/resources")
74
+ script << " test.compile.with # Add classpath dependencies" if File.exist?("src/test/java")
75
+ script << " test.resources" if File.exist?("src/test/resources")
76
+ if File.exist?("src/main/webapp")
77
+ script << " package(:war)"
78
+ elsif File.exist?("src/main/java")
79
+ script << " package(:jar)"
80
+ end
81
+ dirs = FileList["*"].exclude("src", "target", "report").
82
+ select { |file| File.directory?(file) && File.exist?(File.join(file, "src")) }
83
+ unless dirs.empty?
84
+ script << ""
85
+ dirs.sort.each do |dir|
86
+ script << from_directory(dir, false).flatten.map { |line| " " + line } << ""
87
+ end
88
+ end
89
+ script << "end"
90
+ script.flatten
91
+ end
92
+ end
93
+
94
+ def from_maven2_pom(path = 'pom.xml', root = true)
95
+ pom = Buildr::POM.load(path)
96
+ project = pom.project
97
+
98
+ artifactId = project['artifactId'].first
99
+ description = project['name'] || "The #{artifactId} project"
100
+ project_name = File.basename(Dir.pwd)
101
+
102
+ if root
103
+ script = HEADER.split("\n")
104
+
105
+ settings_file = ENV["M2_SETTINGS"] || File.join(ENV['HOME'], ".m2/settings.xml")
106
+ settings = XmlSimple.xml_in(IO.read(settings_file)) if File.exists?(settings_file)
107
+
108
+ if settings
109
+ proxy = settings['proxies'].first['proxy'].find { |proxy|
110
+ proxy["active"].nil? || proxy["active"].to_s =~ /true/
111
+ } rescue nil
112
+
113
+ if proxy
114
+ url = %{#{proxy["protocol"].first}://#{proxy["host"].first}:#{proxy["port"].first}}
115
+ exclude = proxy["nonProxyHosts"].to_s.gsub("|", ",") if proxy["nonProxyHosts"]
116
+ script << "options.proxy.http = '#{url}'"
117
+ script << "options.proxy.exclude << '#{exclude}'" if exclude
118
+ script << ''
119
+ # In addition, we need to use said proxies to download artifacts.
120
+ Buildr.options.proxy.http = url
121
+ Buildr.options.proxy.exclude << exclude if exclude
122
+ end
123
+ end
124
+
125
+ repositories = project["repositories"].first["repository"].select { |repository|
126
+ legacy = repository["layout"].to_s =~ /legacy/
127
+ !legacy
128
+ } rescue nil
129
+ repositories = [{"name" => "Standard maven2 repository", "url" => "http://www.ibiblio.org/maven2"}] if repositories.nil? || repositories.empty?
130
+ repositories.each do |repository|
131
+ name, url = repository["name"], repository["url"]
132
+ script << "# #{name}"
133
+ script << "repositories.remote << '#{url}'"
134
+ # In addition we need to use said repositores to download artifacts.
135
+ Buildr.repositories.remote << url.to_s
136
+ end
137
+ script << ""
138
+ else
139
+ script = []
140
+ end
141
+
142
+ script << "desc '#{description}'"
143
+ script << "define '#{project_name}' do"
144
+
145
+ groupId = project['groupId']
146
+ script << " project.group = '#{groupId}'" if groupId
147
+
148
+ version = project['version']
149
+ script << " project.version = '#{version}'" if version
150
+
151
+ #get plugins configurations
152
+ plugins = project['build'].first['plugins'].first['plugin'] rescue {}
153
+ if plugins
154
+ compile_plugin = plugins.find{|pl| (pl['groupId'].nil? or pl['groupId'].first == 'org.apache.maven.plugins') and pl['artifactId'].first == 'maven-compiler-plugin'}
155
+ if compile_plugin
156
+ source = compile_plugin.first['configuration'].first['source'] rescue nil
157
+ target = compile_plugin.first['configuration'].first['target'] rescue nil
158
+
159
+ script << " compile.options.source = '#{source}'" if source
160
+ script << " compile.options.target = '#{target}'" if target
161
+ end
162
+ end
163
+
164
+ compile_dependencies = pom.dependencies
165
+ dependencies = compile_dependencies.sort.map{|d| "'#{d}'"}.join(', ')
166
+ script << " compile.with #{dependencies}" unless dependencies.empty?
167
+
168
+ test_dependencies = (pom.dependencies(['test']) - compile_dependencies).reject{|d| d =~ /^junit:junit:jar:/ }
169
+ #check if we have testng
170
+ use_testng = test_dependencies.find{|d| d =~ /^org.testng:testng:jar:/}
171
+ if use_testng
172
+ script << " test.using :testng"
173
+ test_dependencies = pom.dependencies(['test']).reject{|d| d =~ /^org.testng:testng:jar:/ }
174
+ end
175
+
176
+ test_dependencies = test_dependencies.sort.map{|d| "'#{d}'"}.join(', ')
177
+ script << " test.with #{test_dependencies}" unless test_dependencies.empty?
178
+
179
+ packaging = project['packaging'] ? project['packaging'].first : 'jar'
180
+ if %w(jar war).include?(packaging)
181
+ script << " package :#{packaging}, :id => '#{artifactId}'"
182
+ end
183
+
184
+ modules = project['modules'].first['module'] rescue nil
185
+ if modules
186
+ script << ""
187
+ modules.each do |mod|
188
+ script << from_maven2_pom(File.join(File.dirname(path), mod, 'pom.xml'), false).flatten.map { |line| " " + line } << ""
189
+ end
190
+ end
191
+ script << "end"
192
+ script.flatten
193
+ end
194
+
195
+ end
196
+ end
197
+ end
@@ -0,0 +1,119 @@
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 'buildr/core/common'
18
+ require 'buildr/core/project'
19
+
20
+
21
+ module Buildr
22
+
23
+ module Help #:nodoc:
24
+ class << self
25
+
26
+ def <<(arg)
27
+ if arg.respond_to?(:call)
28
+ texters << arg
29
+ else
30
+ texters << lambda { arg }
31
+ end
32
+ end
33
+
34
+ def to_s
35
+ texters.map(&:call).join("\n")
36
+ end
37
+
38
+ protected
39
+ def texters
40
+ @texters ||= []
41
+ end
42
+
43
+ end
44
+ end
45
+
46
+ class << self
47
+ def help(&block)
48
+ Help << block if block_given?
49
+ Help
50
+ end
51
+ end
52
+
53
+ end
54
+
55
+
56
+ task 'help' do
57
+ # Greeater.
58
+ puts 'Usage:'
59
+ puts ' buildr [-f rakefile] {options} targets...'
60
+ puts
61
+
62
+ # Show only the top-level projects.
63
+ projects.reject(&:parent).tap do |top_level|
64
+ unless top_level.empty?
65
+ puts 'Top-level projects (buildr help:projects for full list):'
66
+ width = [top_level.map(&:name).map(&:size), 20].flatten.max
67
+ top_level.each do |project|
68
+ puts project.comment.to_s.empty? ? project.name : (" %-#{width}s # %s" % [project.name, project.comment])
69
+ end
70
+ puts
71
+ end
72
+ end
73
+
74
+ # Show all the top-level tasks, excluding projects.
75
+ puts 'Common tasks:'
76
+ task('help:tasks').invoke
77
+ puts
78
+ puts 'For help on command line options:'
79
+ puts ' buildr --help'
80
+ puts Buildr.help.to_s
81
+ end
82
+
83
+
84
+ module Buildr
85
+
86
+ # :call-seq:
87
+ # help() { ... }
88
+ #
89
+ # Use this to enhance the help task, e.g. to print some important information about your build,
90
+ # configuration options, build instructions, etc.
91
+ def help(&block)
92
+ Buildr.help << block
93
+ end
94
+
95
+ end
96
+
97
+
98
+ namespace 'help' do
99
+
100
+ desc 'List all projects defined by this buildfile'
101
+ task 'projects' do
102
+ width = projects.map(&:name).map(&:size).max
103
+ projects.each do |project|
104
+ puts project.comment.to_s.empty? ? " #{project.name}" : (" %-#{width}s # %s" % [project.name, project.comment])
105
+ end
106
+ end
107
+
108
+ desc 'List all tasks available from this buildfile'
109
+ task 'tasks' do
110
+ Buildr.application.tasks.select(&:comment).reject { |task| Project === task }.tap do |tasks|
111
+ width = [tasks.map(&:name).map(&:size), 20].flatten.max
112
+ tasks.each do |task|
113
+ printf " %-#{width}s # %s\n", task.name, task.comment
114
+ end
115
+ puts
116
+ end
117
+ end
118
+
119
+ end
@@ -0,0 +1,42 @@
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
+ module Buildr
17
+ module JRebel
18
+ def jrebel_home
19
+ unless @jrebel_home
20
+ @jrebel_home = ENV['REBEL_HOME'] || ENV['JREBEL'] || ENV['JREBEL_HOME']
21
+ end
22
+
23
+ (@jrebel_home && File.exists?(@jrebel_home)) ? @jrebel_home : nil
24
+ end
25
+
26
+ def rebel_jar
27
+ if jrebel_home
28
+ # jrebel_home may point to jrebel.jar directly
29
+ File.directory?(jrebel_home) ? File.join(jrebel_home, 'jrebel.jar') : jrebel_home
30
+ end
31
+ end
32
+
33
+ def jrebel_args
34
+ rebel_jar ? [ '-noverify', "-javaagent:#{rebel_jar}" ] : []
35
+ end
36
+
37
+ def jrebel_props(project)
38
+ {}
39
+ end
40
+ end
41
+ end
42
+
@@ -0,0 +1,30 @@
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
+ # Let's see if we can use notify-send. Must be running from console in verbose mode.
18
+ if $stdout.isatty && verbose
19
+ system("which notify-send > /dev/null 2>/dev/null")
20
+ if $?.exitstatus == 0
21
+ def notify_send(type, title, message)
22
+ icon = File.join(File.dirname(__FILE__), '../resources/', type.to_s + '.png')
23
+ system "notify-send -i #{icon} \"#{title}\" \"#{message}\""
24
+ end
25
+
26
+ Buildr.application.on_completion { |title, message| notify_send(:completed, title, message) if verbose }
27
+ Buildr.application.on_failure { |title, message, ex| notify_send(:failed, title, message) if verbose }
28
+ end
29
+ end
30
+
@@ -0,0 +1,46 @@
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
+ # Let's see if we can use Growl. Must be running from console in verbose mode.
18
+ if $stdout.isatty && verbose
19
+ def growl_notify(type, title, message)
20
+ begin
21
+ # Loading Ruby Cocoa can slow the build down (hooks on Object class), so we're
22
+ # saving the best for last and only requiring it at the very end.
23
+ require 'osx/cocoa'
24
+ icon = OSX::NSApplication.sharedApplication.applicationIconImage
25
+ icon = OSX::NSImage.alloc.initWithContentsOfFile(File.join(File.dirname(__FILE__), '../resources/buildr.icns'))
26
+
27
+ # Register with Growl, that way you can turn notifications on/off from system preferences.
28
+ OSX::NSDistributedNotificationCenter.defaultCenter.
29
+ postNotificationName_object_userInfo_deliverImmediately(:GrowlApplicationRegistrationNotification, nil,
30
+ { :ApplicationName=>'Buildr', :AllNotifications=>['Completed', 'Failed'],
31
+ :ApplicationIcon=>icon.TIFFRepresentation }, true)
32
+
33
+ OSX::NSDistributedNotificationCenter.defaultCenter.
34
+ postNotificationName_object_userInfo_deliverImmediately(:GrowlNotification, nil,
35
+ { :ApplicationName=>'Buildr', :NotificationName=>type,
36
+ :NotificationTitle=>title, :NotificationDescription=>message }, true)
37
+ rescue Exception
38
+ # We get here in two cases: system doesn't have Growl installed so one of the OSX
39
+ # calls raises an exception; system doesn't have osx/cocoa, e.g. MacPorts Ruby 1.9,
40
+ # so we also need to rescue LoadError.
41
+ end
42
+ end
43
+
44
+ Buildr.application.on_completion { |title, message| growl_notify('Completed', title, message) if verbose }
45
+ Buildr.application.on_failure { |title, message, ex| growl_notify('Failed', title, message) if verbose }
46
+ end
@@ -0,0 +1,161 @@
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
+ class ProgressBar
18
+
19
+ class << self
20
+
21
+ def start(args, &block)
22
+ new(args).start &block
23
+ end
24
+
25
+ def width
26
+ @width ||= $terminal.output_cols || 0
27
+ end
28
+
29
+ end
30
+
31
+ def initialize(args = {})
32
+ @title = args[:title] || ''
33
+ @total = args[:total] || 0
34
+ @mark = args[:mark] || '.'
35
+ @format = args[:format] || default_format
36
+ @output = args[:output] || $stderr unless args[:hidden] || !$stdout.isatty
37
+ clear
38
+ end
39
+
40
+ def start
41
+ @start = @last_time = Time.now
42
+ @count = 0
43
+ @finished = false
44
+ render
45
+ if block_given?
46
+ result = yield(self) if block_given?
47
+ finish
48
+ result
49
+ else
50
+ self
51
+ end
52
+ end
53
+
54
+ def inc(count)
55
+ set @count + count
56
+ end
57
+
58
+ def <<(bytes)
59
+ inc bytes.size
60
+ end
61
+
62
+ def set(count)
63
+ @count = [count, 0].max
64
+ @count = [count, @total].min unless @total == 0
65
+ render if changed?
66
+ end
67
+
68
+ def title
69
+ return @title if ProgressBar.width <= 10
70
+ @title.size > ProgressBar.width / 5 ? (@title[0, ProgressBar.width / 5 - 2] + '..') : @title
71
+ end
72
+
73
+ def count
74
+ human(@count)
75
+ end
76
+
77
+ def total
78
+ human(@total)
79
+ end
80
+
81
+ def percentage
82
+ '%3d%%' % (@total == 0 ? 100 : (@count * 100 / @total))
83
+ end
84
+
85
+ def time
86
+ @finished ? elapsed : eta
87
+ end
88
+
89
+ def eta
90
+ return 'ETA: --:--:--' if @count == 0
91
+ elapsed = Time.now - @start
92
+ eta = elapsed * @total / @count - elapsed
93
+ 'ETA: %s' % duration(eta.ceil)
94
+ end
95
+
96
+ def elapsed
97
+ 'Time: %s' % duration(Time.now - @start)
98
+ end
99
+
100
+ def rate
101
+ '%s/s' % human(@count / (Time.now - @start))
102
+ end
103
+
104
+ def progress(width)
105
+ width -= 2
106
+ marks = @total == 0 ? width : (@count * width / @total)
107
+ "|%-#{width}s|" % (@mark * marks)
108
+ end
109
+
110
+ def human(bytes)
111
+ magnitude = (0..3).find { |i| bytes < (1024 << i * 10) } || 3
112
+ return '%dB' % bytes if magnitude == 0
113
+ return '%.1f%s' % [ bytes.to_f / (1 << magnitude * 10), [nil, 'KB', 'MB', 'GB'][magnitude] ]
114
+ end
115
+
116
+ def duration(seconds)
117
+ '%02d:%02d:%02d' % [seconds / 3600, (seconds / 60) % 60, seconds % 60]
118
+ end
119
+
120
+ def finish
121
+ unless @finished
122
+ @finished = true
123
+ render
124
+ end
125
+ end
126
+
127
+ protected
128
+
129
+ def clear
130
+ return if @output == nil || ProgressBar.width <= 0
131
+ @output.print "\r", " " * (ProgressBar.width - 1), "\r"
132
+ @output.flush
133
+ end
134
+
135
+ def render
136
+ return unless @output
137
+ format, *args = @format
138
+ line = format % args.map { |arg| send(arg) }
139
+ if ProgressBar.width >= line.size
140
+ @output.print line.sub('|--|') { progress(ProgressBar.width - line.size + 3) }
141
+ else
142
+ @output.print line.sub('|--|', '')
143
+ end
144
+ @output.print @finished ? "\n" : "\r"
145
+ @output.flush
146
+ @previous = @count
147
+ @last_time = Time.now
148
+ end
149
+
150
+ def changed?
151
+ return false unless @output && Time.now - @last_time > 0.1
152
+ return human(@count) != human(@previous) if @total == 0
153
+ return true if (@count - @previous) >= @total / 100
154
+ return Time.now - @last_time > 1
155
+ end
156
+
157
+ def default_format
158
+ @total == 0 ? ['%s %8s %s', :title, :count, :elapsed] : ['%s: %s |--| %8s/%s %s', :title, :percentage, :count, :total, :time]
159
+ end
160
+
161
+ end