buildr 1.3.5-x86-mswin32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. data/CHANGELOG +998 -0
  2. data/LICENSE +176 -0
  3. data/NOTICE +26 -0
  4. data/README.rdoc +134 -0
  5. data/Rakefile +45 -0
  6. data/_buildr +29 -0
  7. data/_jbuildr +29 -0
  8. data/addon/buildr/antlr.rb +65 -0
  9. data/addon/buildr/cobertura.rb +22 -0
  10. data/addon/buildr/drb.rb +281 -0
  11. data/addon/buildr/emma.rb +22 -0
  12. data/addon/buildr/hibernate.rb +142 -0
  13. data/addon/buildr/javacc.rb +85 -0
  14. data/addon/buildr/jdepend.rb +60 -0
  15. data/addon/buildr/jetty.rb +248 -0
  16. data/addon/buildr/jibx.rb +86 -0
  17. data/addon/buildr/nailgun.rb +221 -0
  18. data/addon/buildr/openjpa.rb +90 -0
  19. data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
  20. data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
  21. data/addon/buildr/org/apache/buildr/BuildrNail.java +41 -0
  22. data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
  23. data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
  24. data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
  25. data/addon/buildr/org/apache/buildr/JettyWrapper.java +144 -0
  26. data/addon/buildr/xmlbeans.rb +93 -0
  27. data/bin/buildr +19 -0
  28. data/buildr.buildfile +58 -0
  29. data/buildr.gemspec +65 -0
  30. data/doc/_config.yml +1 -0
  31. data/doc/_layouts/default.html +88 -0
  32. data/doc/_layouts/preface.html +22 -0
  33. data/doc/artifacts.textile +211 -0
  34. data/doc/building.textile +244 -0
  35. data/doc/contributing.textile +252 -0
  36. data/doc/css/default.css +236 -0
  37. data/doc/css/print.css +101 -0
  38. data/doc/css/syntax.css +23 -0
  39. data/doc/download.textile +79 -0
  40. data/doc/extending.textile +186 -0
  41. data/doc/images/1442160941-frontcover.jpg +0 -0
  42. data/doc/images/asf-logo.gif +0 -0
  43. data/doc/images/asf-logo.png +0 -0
  44. data/doc/images/buildr-hires.png +0 -0
  45. data/doc/images/buildr.png +0 -0
  46. data/doc/images/favicon.png +0 -0
  47. data/doc/images/growl-icon.tiff +0 -0
  48. data/doc/images/note.png +0 -0
  49. data/doc/images/project-structure.png +0 -0
  50. data/doc/images/tip.png +0 -0
  51. data/doc/images/zbuildr.png +0 -0
  52. data/doc/images/zbuildr.tif +0 -0
  53. data/doc/index.textile +69 -0
  54. data/doc/installing.textile +266 -0
  55. data/doc/languages.textile +459 -0
  56. data/doc/mailing_lists.textile +25 -0
  57. data/doc/more_stuff.textile +457 -0
  58. data/doc/packaging.textile +430 -0
  59. data/doc/preface.textile +54 -0
  60. data/doc/projects.textile +271 -0
  61. data/doc/quick_start.textile +210 -0
  62. data/doc/scripts/buildr-git.rb +512 -0
  63. data/doc/scripts/gitflow.rb +296 -0
  64. data/doc/scripts/install-jruby.sh +44 -0
  65. data/doc/scripts/install-linux.sh +72 -0
  66. data/doc/scripts/install-osx.sh +52 -0
  67. data/doc/settings_profiles.textile +280 -0
  68. data/doc/testing.textile +222 -0
  69. data/etc/KEYS +151 -0
  70. data/lib/buildr.rb +36 -0
  71. data/lib/buildr/core.rb +35 -0
  72. data/lib/buildr/core/application.rb +656 -0
  73. data/lib/buildr/core/build.rb +452 -0
  74. data/lib/buildr/core/checks.rb +254 -0
  75. data/lib/buildr/core/common.rb +150 -0
  76. data/lib/buildr/core/compile.rb +608 -0
  77. data/lib/buildr/core/environment.rb +129 -0
  78. data/lib/buildr/core/filter.rb +362 -0
  79. data/lib/buildr/core/generate.rb +195 -0
  80. data/lib/buildr/core/help.rb +119 -0
  81. data/lib/buildr/core/osx.rb +46 -0
  82. data/lib/buildr/core/progressbar.rb +156 -0
  83. data/lib/buildr/core/project.rb +866 -0
  84. data/lib/buildr/core/shell.rb +198 -0
  85. data/lib/buildr/core/test.rb +723 -0
  86. data/lib/buildr/core/transports.rb +559 -0
  87. data/lib/buildr/core/util.rb +449 -0
  88. data/lib/buildr/groovy.rb +19 -0
  89. data/lib/buildr/groovy/bdd.rb +106 -0
  90. data/lib/buildr/groovy/compiler.rb +138 -0
  91. data/lib/buildr/groovy/shell.rb +48 -0
  92. data/lib/buildr/ide.rb +19 -0
  93. data/lib/buildr/ide/eclipse.rb +334 -0
  94. data/lib/buildr/ide/eclipse/java.rb +53 -0
  95. data/lib/buildr/ide/eclipse/plugin.rb +68 -0
  96. data/lib/buildr/ide/eclipse/scala.rb +66 -0
  97. data/lib/buildr/ide/idea.ipr.template +300 -0
  98. data/lib/buildr/ide/idea.rb +190 -0
  99. data/lib/buildr/ide/idea7x.ipr.template +290 -0
  100. data/lib/buildr/ide/idea7x.rb +212 -0
  101. data/lib/buildr/java.rb +23 -0
  102. data/lib/buildr/java/ant.rb +94 -0
  103. data/lib/buildr/java/bdd.rb +459 -0
  104. data/lib/buildr/java/cobertura.rb +274 -0
  105. data/lib/buildr/java/commands.rb +213 -0
  106. data/lib/buildr/java/compiler.rb +349 -0
  107. data/lib/buildr/java/deprecated.rb +141 -0
  108. data/lib/buildr/java/emma.rb +244 -0
  109. data/lib/buildr/java/jruby.rb +117 -0
  110. data/lib/buildr/java/jtestr_runner.rb.erb +116 -0
  111. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  112. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +137 -0
  113. data/lib/buildr/java/packaging.rb +716 -0
  114. data/lib/buildr/java/pom.rb +174 -0
  115. data/lib/buildr/java/rjb.rb +155 -0
  116. data/lib/buildr/java/test_result.rb +353 -0
  117. data/lib/buildr/java/tests.rb +333 -0
  118. data/lib/buildr/java/version_requirement.rb +172 -0
  119. data/lib/buildr/packaging.rb +24 -0
  120. data/lib/buildr/packaging/archive.rb +488 -0
  121. data/lib/buildr/packaging/artifact.rb +749 -0
  122. data/lib/buildr/packaging/artifact_namespace.rb +972 -0
  123. data/lib/buildr/packaging/artifact_search.rb +140 -0
  124. data/lib/buildr/packaging/gems.rb +102 -0
  125. data/lib/buildr/packaging/package.rb +238 -0
  126. data/lib/buildr/packaging/tar.rb +186 -0
  127. data/lib/buildr/packaging/version_requirement.rb +172 -0
  128. data/lib/buildr/packaging/zip.rb +73 -0
  129. data/lib/buildr/packaging/ziptask.rb +316 -0
  130. data/lib/buildr/resources/buildr.icns +0 -0
  131. data/lib/buildr/scala.rb +25 -0
  132. data/lib/buildr/scala/bdd.rb +109 -0
  133. data/lib/buildr/scala/compiler.rb +195 -0
  134. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner$.class +0 -0
  135. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
  136. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.scala +35 -0
  137. data/lib/buildr/scala/shell.rb +55 -0
  138. data/lib/buildr/scala/tests.rb +157 -0
  139. data/lib/buildr/shell.rb +180 -0
  140. data/rakelib/checks.rake +57 -0
  141. data/rakelib/doc.rake +92 -0
  142. data/rakelib/jekylltask.rb +120 -0
  143. data/rakelib/package.rake +73 -0
  144. data/rakelib/release.rake +149 -0
  145. data/rakelib/rspec.rake +73 -0
  146. data/rakelib/setup.rake +54 -0
  147. data/rakelib/stage.rake +213 -0
  148. data/rakelib/stage.rake~ +213 -0
  149. data/spec/addon/drb_spec.rb +328 -0
  150. data/spec/core/application_spec.rb +502 -0
  151. data/spec/core/build_spec.rb +677 -0
  152. data/spec/core/checks_spec.rb +519 -0
  153. data/spec/core/common_spec.rb +670 -0
  154. data/spec/core/compile_spec.rb +583 -0
  155. data/spec/core/extension_spec.rb +93 -0
  156. data/spec/core/generate_spec.rb +33 -0
  157. data/spec/core/project_spec.rb +762 -0
  158. data/spec/core/test_spec.rb +1098 -0
  159. data/spec/core/transport_spec.rb +537 -0
  160. data/spec/core/util_spec.rb +67 -0
  161. data/spec/groovy/bdd_spec.rb +80 -0
  162. data/spec/groovy/compiler_spec.rb +240 -0
  163. data/spec/ide/eclipse_spec.rb +501 -0
  164. data/spec/ide/idea7x_spec.rb +84 -0
  165. data/spec/java/ant_spec.rb +33 -0
  166. data/spec/java/bdd_spec.rb +382 -0
  167. data/spec/java/cobertura_spec.rb +85 -0
  168. data/spec/java/compiler_spec.rb +446 -0
  169. data/spec/java/emma_spec.rb +119 -0
  170. data/spec/java/java_spec.rb +124 -0
  171. data/spec/java/packaging_spec.rb +1134 -0
  172. data/spec/java/test_coverage_helper.rb +257 -0
  173. data/spec/java/tests_spec.rb +493 -0
  174. data/spec/packaging/archive_spec.rb +527 -0
  175. data/spec/packaging/artifact_namespace_spec.rb +654 -0
  176. data/spec/packaging/artifact_spec.rb +795 -0
  177. data/spec/packaging/packaging_helper.rb +63 -0
  178. data/spec/packaging/packaging_spec.rb +684 -0
  179. data/spec/sandbox.rb +142 -0
  180. data/spec/scala/bdd_spec.rb +119 -0
  181. data/spec/scala/compiler_spec.rb +284 -0
  182. data/spec/scala/scala.rb +38 -0
  183. data/spec/scala/tests_spec.rb +261 -0
  184. data/spec/spec_helpers.rb +340 -0
  185. data/spec/version_requirement_spec.rb +129 -0
  186. metadata +383 -0
data/etc/KEYS ADDED
@@ -0,0 +1,151 @@
1
+ This file contains the PGP keys of various developers.
2
+
3
+ Users: pgp < KEYS
4
+ gpg --import KEYS
5
+ Developers:
6
+ pgp -kxa <your name> and append it to this file.
7
+ (pgpk -ll <your name> && pgpk -xa <your name>) >> this file.
8
+ (gpg --list-sigs <your name>
9
+ && gpg --armor --export <your name>) >> this file.
10
+
11
+
12
+ pub 1024D/4A9EA70E 2007-08-27
13
+ uid Matthieu Riou (CODE SIGNING KEY) <mriou@apache.org>
14
+ sig 3 4A9EA70E 2007-08-27 Matthieu Riou (CODE SIGNING KEY) <mriou@apache.org>
15
+ sub 2048g/2BB53026 2007-08-27
16
+ sig 4A9EA70E 2007-08-27 Matthieu Riou (CODE SIGNING KEY) <mriou@apache.org>
17
+
18
+ -----BEGIN PGP PUBLIC KEY BLOCK-----
19
+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
36
+ Fls3Xa/FyXfaeXQVKp9w3WLr5ONMLhUmJxPnG+mvdUJgR6yebKdYZVFpXfwOeMhM
37
+ ZdAYT/Hg7HmfwJpoJONrtlejR1VmNYY1rzb9jVplTqCCm1BDJDsJWUfPkiI7T/bx
38
+ o8l4Rq7hNESfvjGOTO7OwBYkIR0GossAAwUIALvlj5JTYFWoj+u/pa5qovgx702G
39
+ Rrw4dgMiqKdVYWJZahjmUjs9uqCI1nVROKeSHs3j+3kxH8YGHBlkJo/6yicrZpIm
40
+ mO74Abxi0+yjN9T7GpuZ9rYnYNvBSUA5hqEuMGFOeSU8ZznPsG7fBTWhuknxxOrU
41
+ mGjHGOQZXwcq0GSzZwVGkBZ1gIb0a4wwsk86uMubi5bD3I0MSVWh2ZUBZfAr5MPg
42
+ dQ1PI9tib1G6J0JhKY+95yOwujdqrmpBxdRtxN3IMIzpe2nBwlkP9CDNKhJn+sKB
43
+ MRClYk6vHp6Q+W4ikln/P62H0CrOfh3jzAYfNcW/lxlp6ZbsRVrwhr+nM3mISQQY
44
+ EQIACQUCRtMnvQIbDAAKCRD6yNe+Sp6nDppoAJ0ZNcruq5Jc0aZ1yvNLQORewQa7
45
+ WQCgn7JcUG0i3/7Kk4101XIhgfNgXww=
46
+ =dGgn
47
+ -----END PGP PUBLIC KEY BLOCK-----
48
+
49
+
50
+ pub 1024D/2EED13CE 2007-05-09
51
+ uid Alex Boisvert (CODE SIGNING KEY) <alex.boisvert@gmail.com>
52
+ sig 3 2EED13CE 2007-05-09 Alex Boisvert (CODE SIGNING KEY) <alex.boisvert@gmail.com>
53
+ sub 1024g/54BC5E9F 2007-05-09
54
+ sig 2EED13CE 2007-05-09 Alex Boisvert (CODE SIGNING KEY) <alex.boisvert@gmail.com>
55
+
56
+
57
+ -----BEGIN PGP PUBLIC KEY BLOCK-----
58
+ Version: GnuPG v1.4.6 (GNU/Linux)
59
+
60
+ mQGiBEZCQ80RBACdngN/JZod5XLn8Was2AbSutxP/H5WssX/StS+0BL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za9z7/i/4DLPsTUuc+ZgBLWuv+lNitD
77
+ UeieigodJqbr8EFNj6MlhJyUeGxbFmkngR80nZX06sAIILyISQQYEQIACQUCRkJD
78
+ zgIbDAAKCRD2wlUSLu0TzhPzAJ93zO3DP6/fcA1yfbFSSbgLGI7+/wCdFMH1Ptl8
79
+ sGH4v6GYUVHyfKnWKbg=
80
+ =X6Yk
81
+ -----END PGP PUBLIC KEY BLOCK-----
82
+
83
+
84
+ pub 1024D/14A8A2BA 2007-06-12
85
+ uid Assaf Arkin <assaf@apache.org>
86
+ sig 3 14A8A2BA 2007-06-12 Assaf Arkin <assaf@apache.org>
87
+ sub 2048g/8CA2779E 2007-06-12
88
+ sig 14A8A2BA 2007-06-12 Assaf Arkin <assaf@apache.org>
89
+
90
+ -----BEGIN PGP PUBLIC KEY BLOCK-----
91
+ Version: GnuPG v1.4.7 (GNU/Linux)
92
+
93
+ mQGiBEZvELsRBADBaOF4FVOIkkzA6XlK4lX8TbV5J3crP4M+1I5BWuKsA5oZYCkX
94
+ ARjYfSC62K2fsTSwGTU6M684M+DOKljhjFhs24bL7Yr/1iAEh1RC+aQJ0HJw8ME4
95
+ yxU/WSez6KzQJ8fV7M6MOg9fwI3pf27USf91cdbjLMdi4mvAIbkA/ECi7wCgveA6
96
+ nXpXF8fsKkr+Ijl5FBWYlA0EAIQRzcX12CkFOtJsGHkzZpcInKZkimBKUxrL0lK0
97
+ /EahOPpWjzHdV64OVspgnFECmipwQBLzNAH16XEb9ikwum0PCKj4BnIgkmFjZfFA
98
+ lHLQTqN+JeSCDHI1vxwPfKh2MOrCbCU3EBQgcWhO/WakK/AXyu9bertGum1oNAc/
99
+ LkFkA/sE1/7A2ZMyQVYxwigcYjI5FpfA3PI/Irxup38bQ4atuQrLx/vLbNrDPStw
100
+ yECB6oo3/acjGDkoEH9dergxyID4aZaGb3vJmtuzNrxJzxIkHepodTN0hXi2kLft
101
+ K0B6Vo6Ufv9eaeHnEf/1460JbDAq7w2g5JTnFkRnnW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+ T6Y=
118
+ =uoUw
119
+ -----END PGP PUBLIC KEY BLOCK-----
120
+
121
+
122
+ pub 1024D/E81722E2 2008-02-26
123
+ uid Victor Hugo Borja <vborja@apache.org>
124
+ sig 3 E81722E2 2008-02-26 Victor Hugo Borja <vborja@apache.org>
125
+ sub 1024g/699A572F 2008-02-26
126
+ sig E81722E2 2008-02-26 Victor Hugo Borja <vborja@apache.org>
127
+
128
+ -----BEGIN PGP PUBLIC KEY BLOCK-----
129
+ Version: GnuPG v2.0.7 (GNU/Linux)
130
+
131
+ mQGiBEfEVisRBACR0KeNHllX/Vc8nSe/MSLRqjdPpbH4GR8UBZ18+CUBbx+Q98IQ
132
+ INOAOMNGcPdBoM9yzz01DBEfml6+DMlBGrUc375ZuxaML/UuD4V1kMqgHb7AaMNF
133
+ Wnyk1OMUHiYOiK3ycrYBvr955OLFX3EhUj9F6vJ9URiWczqyze3d5TJdpwCg6ar2
134
+ dAOdxAqhK8qRPSwU3Kt1K8EEAIGB9wifaDoaJmbHn1iV7ixnePh9I9/ZR1ZkaYS2
135
+ uiKprkG57H9b2D04hV178JGT4scCHMXkIYi0VscceDGSgcK0wbC51K8x9h+1rCev
136
+ ZwYm7jewE0luZiD0qN3yz0MHduiTbT7E/mzVRBgkM+xsiJ+miCUniIzZLqz3uKGf
137
+ bMk7A/wM1lQHJL1xNlHU38jYB+NiRTVSJhB8oxofJp21abDHfIPz/qQqswQRSTYb
138
+ G8RvfW5z2oo4AUCYCcKZ+UWR8bSVP2EJqCdu9reTd+6uXm+hv2c2nvZn/jMFWkXW
139
+ JW+aaZWUe3N3/OPXFG8ttpl19Un+FH0OGR7l+9AWoMS/I3Htr7QlVmljdG9yIEh1
140
+ Z28gQm9yamEgPHZib3JqYUBhcGFjaGUub3JnPohgBBMRAgAgBQJHxFYrAhsjBgsJ
141
+ CAcDAgQVAggDBBYCAwECHgECF4AACgkQkUCoHegXIuJL9ACfebcPLROkKM6XBYXL
142
+ M39R32m/NgkAn1i3x/Lp8Dzmt1uSIAQPwUXao/O+uQENBEfEVisQBAD97+MoNSit
143
+ YyGYtpXmYa30SB8rirX6zad+l2Vo6uPtT8xH8zOsmCLQuiLakbuia9QsWFkguw02
144
+ tfZsuAQ8Q4IJvWyPsoFIYXo6Ta4MSDFO2ids6LEJ6GRT2cc7zE4b77RuZkIYNSFO
145
+ XL10qAGQmbCnSWiYADnNv2jyp/NXEVz22wADBQP/T1tmohMlY2Q93cj8amBWP3ko
146
+ dYlP6WJj80iSjLOO5NGlw89aPG2K5mw2WpN729ImZYhzP13rx7uFovb4+103nrJQ
147
+ Ajt5Ierk8kbjO9yM75Y2+84McRiR8JCld2WJFNXXwKCIWuh6+UtGPqafxHccKQYv
148
+ 54Cy+AeemCKSdSlc3VqISQQYEQIACQUCR8RWKwIbDAAKCRCRQKgd6Bci4pE1AKCC
149
+ QKtVPfIqp4oI8qSfsZ0gMafFRwCfTqvRMVFyLEnygWnhpxgJRYk+8Fc=
150
+ =ryOG
151
+ -----END PGP PUBLIC KEY BLOCK-----
data/lib/buildr.rb ADDED
@@ -0,0 +1,36 @@
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
+ VERSION = '1.3.5'.freeze
18
+ end
19
+
20
+ require 'buildr/core'
21
+ require 'buildr/packaging'
22
+ require 'buildr/java'
23
+ require 'buildr/ide'
24
+ require 'buildr/shell'
25
+
26
+ # Methods defined in Buildr are both instance methods (e.g. when included in Project)
27
+ # and class methods when invoked like Buildr.artifacts().
28
+ module Buildr ; extend self ; end
29
+ # The Buildfile object (self) has access to all the Buildr methods and constants.
30
+ class << self ; include Buildr ; end
31
+ class Object #:nodoc:
32
+ Buildr.constants.each do |name|
33
+ const = Buildr.const_get(name)
34
+ const_set name, const if const.is_a?(Module)
35
+ end
36
+ end
@@ -0,0 +1,35 @@
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
+ # TODO: Antwrap 0.7 requires this monkeypatch, have it fixed.
18
+ class Array #:nodoc:
19
+ alias :nitems :size
20
+ end
21
+
22
+ require 'buildr/core/common'
23
+ require 'buildr/core/application'
24
+ require 'buildr/core/project'
25
+ require 'buildr/core/environment'
26
+ require 'buildr/core/help'
27
+ require 'buildr/core/build'
28
+ require 'buildr/core/filter'
29
+ require 'buildr/core/compile'
30
+ require 'buildr/core/test'
31
+ require 'buildr/core/shell'
32
+ require 'buildr/core/checks'
33
+ require 'buildr/core/transports'
34
+ require 'buildr/core/generate'
35
+ require 'buildr/core/osx' if RUBY_PLATFORM =~ /darwin/
@@ -0,0 +1,656 @@
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
+ # Portion of this file derived from Rake.
18
+ # Copyright (c) 2003, 2004 Jim Weirich
19
+ #
20
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
21
+ # of this software and associated documentation files (the "Software"), to deal
22
+ # in the Software without restriction, including without limitation the rights
23
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
24
+ # copies of the Software, and to permit persons to whom the Software is
25
+ # furnished to do so, subject to the following conditions:
26
+ #
27
+ # The above copyright notice and this permission notice shall be included in
28
+ # all copies or substantial portions of the Software.
29
+ #
30
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
33
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
35
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
36
+ # SOFTWARE.
37
+
38
+
39
+ require 'rake'
40
+ require 'highline/import'
41
+ require 'rubygems/source_info_cache'
42
+ require 'buildr/core/util'
43
+ Gem.autoload :SourceInfoCache, 'rubygems/source_info_cache'
44
+
45
+
46
+ # Gem::user_home is nice, but ENV['HOME'] lets you override from the environment.
47
+ ENV['HOME'] ||= File.expand_path(Gem::user_home)
48
+ ENV['BUILDR_ENV'] ||= 'development'
49
+
50
+
51
+ module Buildr
52
+
53
+ # Provide settings that come from three sources.
54
+ #
55
+ # User settings are placed in the .buildr/settings.yaml file located in the user's home directory.
56
+ # They should only be used for settings that are specific to the user and applied the same way
57
+ # across all builds. Example for user settings are preferred repositories, path to local repository,
58
+ # user/name password for uploading to remote repository.
59
+ #
60
+ # Build settings are placed in the build.yaml file located in the build directory. They help keep
61
+ # the buildfile and build.yaml file simple and readable, working to the advantages of each one.
62
+ # Example for build settings are gems, repositories and artifacts used by that build.
63
+ #
64
+ # Profile settings are placed in the profiles.yaml file located in the build directory. They provide
65
+ # settings that differ in each environment the build runs in. For example, URLs and database
66
+ # connections will be different when used in development, test and production environments.
67
+ # The settings for the current environment are obtained by calling #profile.
68
+ class Settings
69
+
70
+ def initialize(application) #:nodoc:
71
+ @application = application
72
+ end
73
+
74
+ # User settings loaded from setting.yaml file in user's home directory.
75
+ def user
76
+ @user ||= load_from('settings', @application.home_dir)
77
+ end
78
+
79
+ # Build settings loaded from build.yaml file in build directory.
80
+ def build
81
+ @build ||= load_from('build')
82
+ end
83
+
84
+ # Profiles loaded from profiles.yaml file in build directory.
85
+ def profiles
86
+ @profiles ||= load_from('profiles')
87
+ end
88
+
89
+ # :call-seq:
90
+ # profile => hash
91
+ #
92
+ # Returns the profile for the current environment.
93
+ def profile
94
+ profiles[@application.environment] ||= {}
95
+ end
96
+
97
+ private
98
+
99
+ def load_from(name, path = nil)
100
+ unless path
101
+ fail "Internal error: attempting to access local setting before buildfile located" unless @application.rakefile
102
+ path = File.dirname(@application.rakefile)
103
+ end
104
+ file_name = ['yaml', 'yml'].map { |ext| File.join(path, "#{name}.#{ext}") }.find { |fn| File.exist?(fn) }
105
+ return {} unless file_name
106
+ yaml = YAML.load(File.read(file_name)) || {}
107
+ fail "Expecting #{file_name} to be a map (name: value)!" unless Hash === yaml
108
+ @application.buildfile.enhance [file_name]
109
+ yaml
110
+ end
111
+
112
+ end
113
+
114
+
115
+ class Application < Rake::Application #:nodoc:
116
+
117
+ # Deprecated: rakefile/Rakefile, removed in 1.5
118
+ DEFAULT_BUILDFILES = ['buildfile', 'Buildfile'] + DEFAULT_RAKEFILES
119
+
120
+ attr_reader :rakefiles, :requires
121
+ private :rakefiles, :requires
122
+
123
+ def initialize
124
+ super
125
+ @rakefiles = DEFAULT_BUILDFILES.dup
126
+ @top_level_tasks = []
127
+ @home_dir = File.expand_path('.buildr', ENV['HOME'])
128
+ mkpath @home_dir unless File.exist?(@home_dir)
129
+ @settings = Settings.new(self)
130
+ @on_completion = []
131
+ @on_failure = []
132
+ end
133
+
134
+ def run
135
+ standard_exception_handling do
136
+ init 'Buildr'
137
+ load_buildfile
138
+ top_level
139
+ end
140
+ end
141
+
142
+ # Not for external consumption.
143
+ def switch_to_namespace(names) #:nodoc:
144
+ current, @scope = @scope, names
145
+ begin
146
+ yield
147
+ ensure
148
+ @scope = current
149
+ end
150
+ end
151
+
152
+ # Returns list of Gems associated with this buildfile, as listed in build.yaml.
153
+ # Each entry is of type Gem::Specification.
154
+ attr_reader :gems
155
+
156
+ # Buildr home directory, .buildr under user's home directory.
157
+ attr_reader :home_dir
158
+
159
+ # Copied from BUILD_ENV.
160
+ def environment
161
+ ENV['BUILDR_ENV']
162
+ end
163
+
164
+ # Returns the Settings associated with this build.
165
+ attr_reader :settings
166
+
167
+ # :call-seq:
168
+ # buildfile
169
+ # Returns the buildfile as a task that you can use as a dependency.
170
+ def buildfile
171
+ @buildfile_task ||= BuildfileTask.define_task(File.expand_path(rakefile))
172
+ end
173
+
174
+ # Files that complement the buildfile itself
175
+ def build_files #:nodoc:
176
+ deprecated 'Please call buildfile.prerequisites instead'
177
+ buildfile.prerequisites
178
+ end
179
+
180
+ # Yields to block on successful completion. Primarily used for notifications.
181
+ def on_completion(&block)
182
+ @on_completion << block
183
+ end
184
+
185
+ # Yields to block on failure with exception. Primarily used for notifications.
186
+ def on_failure(&block)
187
+ @on_failure << block
188
+ end
189
+
190
+ # :call-seq:
191
+ # deprecated(message)
192
+ #
193
+ # Use with deprecated methods and classes. This method automatically adds the file name and line number,
194
+ # and the text 'Deprecated' before the message, and eliminated duplicate warnings. It only warns when
195
+ # running in verbose mode.
196
+ #
197
+ # For example:
198
+ # deprecated 'Please use new_foo instead of foo.'
199
+ def deprecated(message) #:nodoc:
200
+ return unless verbose
201
+ "#{caller[1]}: Deprecated: #{message}".tap do |message|
202
+ @deprecated ||= {}
203
+ unless @deprecated[message]
204
+ @deprecated[message] = true
205
+ warn message
206
+ end
207
+ end
208
+ end
209
+
210
+ protected
211
+
212
+ def load_buildfile # replaces load_rakefile
213
+ standard_exception_handling do
214
+ find_buildfile
215
+ load_gems
216
+ load_artifact_ns
217
+ load_tasks
218
+ raw_load_buildfile
219
+ end
220
+ end
221
+
222
+ def top_level # adds on_completion hook
223
+ standard_exception_handling do
224
+ if options.show_tasks
225
+ display_tasks_and_comments
226
+ elsif options.show_prereqs
227
+ display_prerequisites
228
+ elsif options.execute
229
+ eval options.execute
230
+ else
231
+ @start = Time.now
232
+ top_level_tasks.each { |task_name| invoke_task(task_name) }
233
+ if verbose
234
+ elapsed = Time.now - @start
235
+ real = []
236
+ real << ('%ih' % (elapsed / 3600)) if elapsed >= 3600
237
+ real << ('%im' % ((elapsed / 60) % 60)) if elapsed >= 60
238
+ real << ('%.3fs' % (elapsed % 60))
239
+ puts $terminal.color("Completed in #{real.join}", :green)
240
+ end
241
+ # On OS X this will load Cocoa and Growl which takes half a second we
242
+ # don't want to measure, so put this after the console message.
243
+ title, message = "Your build has completed", "#{Dir.pwd}\nbuildr #{@top_level_tasks.join(' ')}"
244
+ @on_completion.each do |block|
245
+ block.call(title, message) rescue nil
246
+ end
247
+ end
248
+ end
249
+ end
250
+
251
+ def handle_options
252
+ options.rakelib = ['tasks']
253
+
254
+ OptionParser.new do |opts|
255
+ opts.banner = "buildr [-f rakefile] {options} targets..."
256
+ opts.separator ""
257
+ opts.separator "Options are ..."
258
+
259
+ opts.on_tail("-h", "--help", "-H", "Display this help message.") do
260
+ puts opts
261
+ exit
262
+ end
263
+ standard_buildr_options.each { |args| opts.on(*args) }
264
+ end.parse!
265
+ end
266
+
267
+ def standard_buildr_options # replaces standard_rake_options
268
+ [
269
+ ['--describe', '-D [PATTERN]', "Describe the tasks (matching optional PATTERN), then exit.",
270
+ lambda { |value|
271
+ options.show_tasks = true
272
+ options.full_description = true
273
+ options.show_task_pattern = Regexp.new(value || '')
274
+ }
275
+ ],
276
+ ['--execute', '-E CODE',
277
+ "Execute some Ruby code after loading the buildfile",
278
+ lambda { |value| options.execute = value }
279
+ ],
280
+ ['--environment', '-e ENV',
281
+ "Environment name (e.g. development, test, production).",
282
+ lambda { |value| ENV['BUILDR_ENV'] = value }
283
+ ],
284
+ ['--generate [PATH]',
285
+ "Generate buildfile from either pom.xml file or directory path.",
286
+ lambda { |value|
287
+ value ||= File.exist?('pom.xml') ? 'pom.xml' : Dir.pwd
288
+ raw_generate_buildfile value
289
+ exit
290
+ }
291
+ ],
292
+ ['--libdir', '-I LIBDIR', "Include LIBDIR in the search path for required modules.",
293
+ lambda { |value| $:.push(value) }
294
+ ],
295
+ ['--prereqs', '-P [PATTERN]', "Display the tasks and dependencies (matching optional PATTERN), then exit.",
296
+ lambda { |value|
297
+ options.show_prereqs = true
298
+ options.show_task_pattern = Regexp.new(value || '')
299
+ }
300
+ ],
301
+ ['--quiet', '-q', "Do not log messages to standard output.",
302
+ lambda { |value| verbose(false) }
303
+ ],
304
+ ['--buildfile', '-f FILE', "Use FILE as the buildfile.",
305
+ lambda { |value|
306
+ @rakefiles.clear
307
+ @rakefiles << value
308
+ }
309
+ ],
310
+ ['--rakelibdir', '--rakelib', '-R PATH',
311
+ "Auto-import any .rake files in PATH. (default is 'tasks')",
312
+ lambda { |value| options.rakelib = value.split(':') }
313
+ ],
314
+ ['--require', '-r MODULE', "Require MODULE before executing rakefile.",
315
+ lambda { |value|
316
+ begin
317
+ require value
318
+ rescue LoadError => ex
319
+ begin
320
+ rake_require value
321
+ rescue LoadError => ex2
322
+ raise ex
323
+ end
324
+ end
325
+ }
326
+ ],
327
+ ['--rules', "Trace the rules resolution.",
328
+ lambda { |value| options.trace_rules = true }
329
+ ],
330
+ ['--no-search', '--nosearch', '-N', "Do not search parent directories for the Rakefile.",
331
+ lambda { |value| options.nosearch = true }
332
+ ],
333
+ ['--silent', '-s', "Like --quiet, but also suppresses the 'in directory' announcement.",
334
+ lambda { |value|
335
+ verbose(false)
336
+ options.silent = true
337
+ }
338
+ ],
339
+ ['--tasks', '-T [PATTERN]', "Display the tasks (matching optional PATTERN) with descriptions, then exit.",
340
+ lambda { |value|
341
+ options.show_tasks = true
342
+ options.show_task_pattern = Regexp.new(value || '')
343
+ options.full_description = false
344
+ }
345
+ ],
346
+ ['--trace', '-t', "Turn on invoke/execute tracing, enable full backtrace.",
347
+ lambda { |value|
348
+ options.trace = true
349
+ verbose(true)
350
+ }
351
+ ],
352
+ ['--verbose', '-v', "Log message to standard output (default).",
353
+ lambda { |value| verbose(true) }
354
+ ],
355
+ ['--version', '-V', "Display the program version.",
356
+ lambda { |value|
357
+ puts "Buildr #{Buildr::VERSION} #{RUBY_PLATFORM[/java/] && '(JRuby '+JRUBY_VERSION+')'}"
358
+ exit
359
+ }
360
+ ]
361
+ ]
362
+ end
363
+
364
+ def find_buildfile
365
+ buildfile, location = find_rakefile_location || (tty_output? && ask_generate_buildfile)
366
+ fail "No Buildfile found (looking for: #{@rakefiles.join(', ')})" if buildfile.nil?
367
+ @rakefile = buildfile
368
+ Dir.chdir(location)
369
+ end
370
+
371
+ def ask_generate_buildfile
372
+ source = choose do |menu|
373
+ menu.header = "To use Buildr you need a buildfile. Do you want me to create one?"
374
+ menu.choice("From Maven2 POM file") { 'pom.xml' } if File.exist?('pom.xml')
375
+ menu.choice("From directory structure") { Dir.pwd }
376
+ menu.choice("Cancel") { }
377
+ end
378
+ if source
379
+ buildfile = raw_generate_buildfile(source)
380
+ [buildfile, File.dirname(buildfile)]
381
+ end
382
+ end
383
+
384
+ def raw_generate_buildfile(source)
385
+ # We need rakefile to be known, for settings.build to be accessible.
386
+ @rakefile = File.expand_path(DEFAULT_BUILDFILES.first)
387
+ fail "Buildfile already exists" if File.exist?(@rakefile) && !(tty_output? && agree('Buildfile exists, overwrite?'))
388
+ script = File.directory?(source) ? Generate.from_directory(source) : Generate.from_maven2_pom(source)
389
+ File.open @rakefile, 'w' do |file|
390
+ file.puts script
391
+ end
392
+ puts "Created #{@rakefile}" if verbose
393
+ @rakefile
394
+ end
395
+
396
+ def raw_load_buildfile # replaces raw_load_rakefile
397
+ puts "(in #{Dir.pwd}, #{environment})" unless options.silent
398
+ load File.expand_path(@rakefile) if @rakefile && @rakefile != ''
399
+ load_imports
400
+ Buildr.projects
401
+ end
402
+
403
+ # Load/install all Gems specified in build.yaml file.
404
+ def load_gems #:nodoc:
405
+ missing_deps, installed = listed_gems.partition { |gem| gem.is_a?(Gem::Dependency) }
406
+ unless missing_deps.empty?
407
+ newly_installed = Util::Gems.install(*missing_deps)
408
+ installed += newly_installed
409
+ end
410
+ installed.each do |spec|
411
+ if gem(spec.name, spec.version.to_s)
412
+ # TODO: is this intended to load rake tasks from the installed gems?
413
+ # We should use a convention like .. if the gem has a _buildr.rb file, load it.
414
+
415
+ #FileList[spec.require_paths.map { |path| File.expand_path("#{path}/*.rb", spec.full_gem_path) }].
416
+ # map { |path| File.basename(path) }.each { |file| require file }
417
+ #FileList[File.expand_path('tasks/*.rake', spec.full_gem_path)].each do |file|
418
+ # Buildr.application.add_import file
419
+ #end
420
+ end
421
+ end
422
+ @gems = installed
423
+ end
424
+
425
+ # Returns Gem::Specification for every listed and installed Gem, Gem::Dependency
426
+ # for listed and uninstalled Gem, which is the installed before loading the buildfile.
427
+ def listed_gems #:nodoc:
428
+ Array(settings.build['gems']).map do |dep|
429
+ name, trail = dep.scan(/^\s*(\S*)\s*(.*)\s*$/).first
430
+ versions = trail.scan(/[=><~!]{0,2}\s*[\d\.]+/)
431
+ versions = ['>= 0'] if versions.empty?
432
+ dep = Gem::Dependency.new(name, versions)
433
+ Gem::SourceIndex.from_installed_gems.search(dep).last || dep
434
+ end
435
+ end
436
+
437
+ # Load artifact specs from the build.yaml file, making them available
438
+ # by name ( ruby symbols ).
439
+ def load_artifact_ns #:nodoc:
440
+ hash = settings.build['artifacts']
441
+ return unless hash
442
+ raise "Expected 'artifacts' element to be a hash" unless Hash === hash
443
+ # Currently we only use one artifact namespace to rule them all. (the root NS)
444
+ Buildr::ArtifactNamespace.load(:root => hash)
445
+ end
446
+
447
+ # Loads buildr.rb files from users home directory and project directory.
448
+ # Loads custom tasks from .rake files in tasks directory.
449
+ def load_tasks #:nodoc:
450
+ # TODO: this might need to be split up, look for deprecated features, better method name.
451
+ files = [ File.expand_path('buildr.rb', ENV['HOME']), 'buildr.rb' ].select { |file| File.exist?(file) }
452
+ files += [ File.expand_path('buildr.rake', ENV['HOME']), File.expand_path('buildr.rake') ].
453
+ select { |file| File.exist?(file) }.each { |file| warn "Please use '#{file.ext('rb')}' instead of '#{file}'" }
454
+ files += (options.rakelib || []).collect { |rlib| Dir["#{rlib}/*.rake"] }.flatten
455
+
456
+ files.each do |file|
457
+ unless $LOADED_FEATURES.include?(file)
458
+ load file
459
+ $LOADED_FEATURES << file
460
+ end
461
+ end
462
+ buildfile.enhance files
463
+ true
464
+ end
465
+
466
+ def display_tasks_and_comments
467
+ displayable_tasks = tasks.select { |t| t.comment && t.name =~ options.show_task_pattern }
468
+ if options.full_description
469
+ displayable_tasks.each do |t|
470
+ puts "buildr #{t.name_with_args}"
471
+ t.full_comment.split("\n").each do |line|
472
+ puts " #{line}"
473
+ end
474
+ puts
475
+ end
476
+ else
477
+ width = displayable_tasks.collect { |t| t.name_with_args.length }.max || 10
478
+ max_column = truncate_output? ? terminal_width - name.size - width - 7 : nil
479
+ displayable_tasks.each do |t|
480
+ printf "#{name} %-#{width}s # %s\n",
481
+ t.name_with_args, max_column ? truncate(t.comment, max_column) : t.comment
482
+ end
483
+ end
484
+ end
485
+
486
+ def display_prerequisites
487
+ displayable_tasks = tasks.select { |t| t.name =~ options.show_task_pattern }
488
+ displayable_tasks.each do |t|
489
+ puts "buildr #{t.name}"
490
+ t.prerequisites.each { |pre| puts " #{pre}" }
491
+ end
492
+ end
493
+
494
+ def standard_exception_handling # adds on_failure hook
495
+ begin
496
+ yield
497
+ rescue SystemExit => ex
498
+ # Exit silently with current status
499
+ exit(ex.status)
500
+ rescue OptionParser::ParseError => ex
501
+ $stderr.puts $terminal.color(ex.message, :red)
502
+ exit(1)
503
+ rescue Exception => ex
504
+ title, message = "Your build failed with an error", "#{Dir.pwd}:\n#{ex.message}"
505
+ @on_failure.each do |block|
506
+ block.call(title, message, ex) rescue nil
507
+ end
508
+ # Exit with error message
509
+ $stderr.puts "Buildr aborted!"
510
+ $stderr.puts $terminal.color(ex.message, :red)
511
+ if options.trace
512
+ $stderr.puts ex.backtrace.join("\n")
513
+ else
514
+ $stderr.puts ex.backtrace.select { |str| str =~ /#{rakefile}/ }.map { |line| $terminal.color(line, :red) }.join("\n") if rakefile
515
+ $stderr.puts "(See full trace by running task with --trace)"
516
+ end
517
+ exit(1)
518
+ end
519
+ end
520
+
521
+ end
522
+
523
+
524
+ # This task stands for the buildfile and all its associated helper files (e.g., buildr.rb, build.yaml).
525
+ # By using this task as a prerequisite for other tasks, you can ensure these tasks will be needed
526
+ # whenever the buildfile changes.
527
+ class BuildfileTask < Rake::FileTask #:nodoc:
528
+
529
+ def timestamp
530
+ ([name] + prerequisites).map { |f| File.stat(f).mtime }.max rescue Time.now
531
+ end
532
+ end
533
+
534
+
535
+ class << self
536
+
537
+ # Returns the Buildr::Application object.
538
+ def application
539
+ Rake.application
540
+ end
541
+
542
+ def application=(app) #:nodoc:
543
+ Rake.application = app
544
+ end
545
+
546
+ # Returns the Settings associated with this build.
547
+ def settings
548
+ Buildr.application.settings
549
+ end
550
+
551
+ # Copied from BUILD_ENV.
552
+ def environment
553
+ Buildr.application.environment
554
+ end
555
+
556
+ end
557
+
558
+ Buildr.application = Buildr::Application.new
559
+
560
+ end
561
+
562
+
563
+ # Add a touch of color when available and running in terminal.
564
+ if $stdout.isatty
565
+ begin
566
+ require 'Win32/Console/ANSI' if Config::CONFIG['host_os'] =~ /mswin/
567
+ HighLine.use_color = true
568
+ rescue LoadError
569
+ end
570
+ else
571
+ HighLine.use_color = false
572
+ end
573
+
574
+
575
+ alias :warn_without_color :warn
576
+
577
+ # Show warning message.
578
+ def warn(message)
579
+ warn_without_color $terminal.color(message.to_s, :blue) if verbose
580
+ end
581
+
582
+ # Show error message. Use this when you need to show an error message and not throwing
583
+ # an exception that will stop the build.
584
+ def error(message)
585
+ puts $terminal.color(message.to_s, :red)
586
+ end
587
+
588
+ # Show optional information. The message is printed only when running in verbose
589
+ # mode (the default).
590
+ def info(message)
591
+ puts message if verbose
592
+ end
593
+
594
+ # Show message. The message is printed out only when running in trace mode.
595
+ def trace(message)
596
+ puts message if Buildr.application.options.trace
597
+ end
598
+
599
+
600
+ module Rake #:nodoc
601
+ # Rake's circular dependency checks (InvocationChain) only applies to task prerequisites,
602
+ # all other cases result in the non too-descriptive thread sleeping error. This change can
603
+ # deal with circular dependencies that occur from direct task invocation, e.g:
604
+ # task 'foo'=>'bar'
605
+ # task 'bar' do
606
+ # task('foo').invoke
607
+ # end
608
+ class Task #:nodoc:
609
+ def invoke(*args)
610
+ task_args = TaskArguments.new(arg_names, args)
611
+ invoke_with_call_chain(task_args, Thread.current[:rake_chain] || InvocationChain::EMPTY)
612
+ end
613
+
614
+ def invoke_with_call_chain(task_args, invocation_chain)
615
+ new_chain = InvocationChain.append(self, invocation_chain)
616
+ @lock.synchronize do
617
+ if application.options.trace
618
+ puts "** Invoke #{name} #{format_trace_flags}"
619
+ end
620
+ return if @already_invoked
621
+ @already_invoked = true
622
+ begin
623
+ invoke_prerequisites(task_args, new_chain)
624
+ rescue
625
+ trace "Exception while invoking prerequisites of task #{self.inspect}"
626
+ raise
627
+ end
628
+ begin
629
+ old_chain, Thread.current[:rake_chain] = Thread.current[:rake_chain], new_chain
630
+ execute(task_args) if needed?
631
+ ensure
632
+ Thread.current[:rake_chain] = nil
633
+ end
634
+ end
635
+ end
636
+ end
637
+ end
638
+
639
+
640
+ module RakeFileUtils #:nodoc:
641
+ FileUtils::OPT_TABLE.each do |name, opts|
642
+ default_options = []
643
+ if opts.include?(:verbose) || opts.include?("verbose")
644
+ default_options << ':verbose => RakeFileUtils.verbose_flag == true'
645
+ end
646
+ next if default_options.empty?
647
+ module_eval(<<-EOS, __FILE__, __LINE__ + 1)
648
+ def #{name}( *args, &block )
649
+ super(
650
+ *rake_merge_option(args,
651
+ #{default_options.join(', ')}
652
+ ), &block)
653
+ end
654
+ EOS
655
+ end
656
+ end