buildr 1.3.5-java → 1.4.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. data/CHANGELOG +153 -8
  2. data/README.rdoc +1 -1
  3. data/addon/buildr/antlr.rb +5 -5
  4. data/addon/buildr/drb.rb +18 -18
  5. data/addon/buildr/hibernate.rb +18 -14
  6. data/addon/buildr/javacc.rb +4 -4
  7. data/addon/buildr/jetty.rb +5 -5
  8. data/addon/buildr/nailgun.rb +23 -23
  9. data/addon/buildr/openjpa.rb +1 -1
  10. data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
  11. data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
  12. data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
  13. data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
  14. data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
  15. data/addon/buildr/protobuf.rb +75 -0
  16. data/addon/buildr/xmlbeans.rb +5 -5
  17. data/buildr.buildfile +2 -2
  18. data/buildr.gemspec +8 -7
  19. data/doc/_layouts/default.html +2 -2
  20. data/doc/artifacts.textile +4 -4
  21. data/doc/building.textile +35 -3
  22. data/doc/contributing.textile +5 -0
  23. data/doc/download.textile +16 -5
  24. data/doc/extending.textile +38 -12
  25. data/doc/installing.textile +6 -5
  26. data/doc/languages.textile +182 -42
  27. data/doc/more_stuff.textile +2 -2
  28. data/doc/packaging.textile +14 -15
  29. data/doc/projects.textile +7 -2
  30. data/doc/quick_start.textile +4 -4
  31. data/doc/scripts/buildr-git.rb +63 -63
  32. data/doc/scripts/gitflow.rb +21 -21
  33. data/doc/settings_profiles.textile +9 -2
  34. data/doc/testing.textile +16 -5
  35. data/etc/KEYS +38 -0
  36. data/lib/buildr.rb +1 -1
  37. data/lib/buildr/core.rb +1 -0
  38. data/lib/buildr/core/application.rb +33 -27
  39. data/lib/buildr/core/build.rb +41 -28
  40. data/lib/buildr/core/cc.rb +172 -0
  41. data/lib/buildr/core/checks.rb +1 -1
  42. data/lib/buildr/core/common.rb +7 -6
  43. data/lib/buildr/core/compile.rb +7 -8
  44. data/lib/buildr/core/doc.rb +263 -0
  45. data/lib/buildr/core/environment.rb +6 -6
  46. data/lib/buildr/core/filter.rb +77 -35
  47. data/lib/buildr/core/generate.rb +7 -7
  48. data/lib/buildr/core/help.rb +1 -1
  49. data/lib/buildr/core/osx.rb +6 -6
  50. data/lib/buildr/core/progressbar.rb +4 -4
  51. data/lib/buildr/core/project.rb +144 -36
  52. data/lib/buildr/core/shell.rb +34 -34
  53. data/lib/buildr/core/test.rb +89 -20
  54. data/lib/buildr/core/transports.rb +8 -7
  55. data/lib/buildr/core/util.rb +77 -23
  56. data/lib/buildr/groovy/bdd.rb +5 -5
  57. data/lib/buildr/groovy/compiler.rb +19 -15
  58. data/lib/buildr/groovy/shell.rb +6 -6
  59. data/lib/buildr/ide/eclipse.rb +148 -75
  60. data/lib/buildr/ide/eclipse/java.rb +3 -3
  61. data/lib/buildr/ide/eclipse/plugin.rb +8 -5
  62. data/lib/buildr/ide/eclipse/scala.rb +4 -2
  63. data/lib/buildr/ide/idea.rb +2 -2
  64. data/lib/buildr/ide/idea7x.rb +23 -4
  65. data/lib/buildr/java.rb +1 -0
  66. data/lib/buildr/java/ant.rb +4 -4
  67. data/lib/buildr/java/bdd.rb +51 -54
  68. data/lib/buildr/java/cobertura.rb +57 -35
  69. data/lib/buildr/java/commands.rb +14 -5
  70. data/lib/buildr/java/compiler.rb +3 -217
  71. data/lib/buildr/java/deprecated.rb +4 -4
  72. data/lib/buildr/java/doc.rb +70 -0
  73. data/lib/buildr/java/emma.rb +22 -22
  74. data/lib/buildr/java/jruby.rb +4 -4
  75. data/lib/buildr/java/jtestr_runner.rb.erb +27 -25
  76. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  77. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +8 -3
  78. data/lib/buildr/java/packaging.rb +30 -29
  79. data/lib/buildr/java/pom.rb +4 -4
  80. data/lib/buildr/java/rjb.rb +6 -6
  81. data/lib/buildr/java/test_result.rb +61 -85
  82. data/lib/buildr/java/tests.rb +44 -27
  83. data/lib/buildr/java/version_requirement.rb +8 -8
  84. data/lib/buildr/packaging/archive.rb +55 -22
  85. data/lib/buildr/packaging/artifact.rb +75 -36
  86. data/lib/buildr/packaging/artifact_namespace.rb +90 -78
  87. data/lib/buildr/packaging/artifact_search.rb +5 -5
  88. data/lib/buildr/packaging/gems.rb +11 -7
  89. data/lib/buildr/packaging/package.rb +10 -7
  90. data/lib/buildr/packaging/tar.rb +14 -14
  91. data/lib/buildr/packaging/version_requirement.rb +30 -10
  92. data/lib/buildr/packaging/ziptask.rb +51 -13
  93. data/lib/buildr/scala.rb +1 -0
  94. data/lib/buildr/scala/bdd.rb +25 -20
  95. data/lib/buildr/scala/compiler.rb +87 -40
  96. data/lib/buildr/scala/doc.rb +106 -0
  97. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
  98. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.java +57 -0
  99. data/lib/buildr/scala/shell.rb +14 -9
  100. data/lib/buildr/scala/tests.rb +33 -26
  101. data/lib/buildr/shell.rb +33 -33
  102. data/rakelib/all-in-one.rake +113 -0
  103. data/rakelib/checks.rake +1 -1
  104. data/rakelib/doc.rake +7 -0
  105. data/rakelib/package.rake +1 -1
  106. data/rakelib/release.rake +9 -6
  107. data/rakelib/rspec.rake +26 -7
  108. data/rakelib/setup.rake +15 -3
  109. data/rakelib/stage.rake +18 -11
  110. data/spec/addon/drb_spec.rb +25 -25
  111. data/spec/core/application_spec.rb +111 -21
  112. data/spec/core/build_spec.rb +16 -15
  113. data/spec/core/cc_spec.rb +174 -0
  114. data/spec/core/checks_spec.rb +34 -34
  115. data/spec/core/common_spec.rb +51 -5
  116. data/spec/core/compile_spec.rb +89 -14
  117. data/spec/core/extension_spec.rb +127 -19
  118. data/spec/core/generate_spec.rb +2 -2
  119. data/spec/core/project_spec.rb +10 -10
  120. data/spec/core/test_spec.rb +144 -35
  121. data/spec/core/transport_spec.rb +8 -8
  122. data/spec/core/util_spec.rb +63 -5
  123. data/spec/groovy/bdd_spec.rb +5 -5
  124. data/spec/groovy/compiler_spec.rb +29 -18
  125. data/spec/ide/eclipse_spec.rb +185 -9
  126. data/spec/ide/idea7x_spec.rb +22 -10
  127. data/spec/java/ant_spec.rb +9 -5
  128. data/spec/java/bdd_spec.rb +29 -37
  129. data/spec/java/cobertura_spec.rb +12 -12
  130. data/spec/java/commands_spec.rb +34 -0
  131. data/spec/java/compiler_spec.rb +53 -53
  132. data/spec/java/emma_spec.rb +11 -11
  133. data/spec/java/java_spec.rb +10 -10
  134. data/spec/java/packaging_spec.rb +67 -20
  135. data/spec/java/test_coverage_helper.rb +18 -18
  136. data/spec/java/tests_spec.rb +13 -9
  137. data/spec/packaging/archive_spec.rb +187 -20
  138. data/spec/packaging/artifact_namespace_spec.rb +172 -83
  139. data/spec/packaging/artifact_spec.rb +83 -18
  140. data/spec/packaging/packaging_spec.rb +41 -14
  141. data/spec/sandbox.rb +23 -12
  142. data/spec/scala/bdd_spec.rb +13 -8
  143. data/spec/scala/compiler_spec.rb +18 -13
  144. data/spec/scala/scala.rb +3 -3
  145. data/spec/scala/tests_spec.rb +46 -24
  146. data/spec/spec_helpers.rb +28 -10
  147. data/spec/version_requirement_spec.rb +25 -11
  148. metadata +148 -132
  149. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner$.class +0 -0
  150. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.scala +0 -35
  151. data/rakelib/stage.rake~ +0 -213
@@ -20,7 +20,7 @@ require 'fileutils'
20
20
 
21
21
  module GitFlow
22
22
  extend self
23
-
23
+
24
24
  attr_accessor :should_run, :trace, :program
25
25
 
26
26
  self.program = 'gitflow'
@@ -34,7 +34,7 @@ It is generic enougth to be used on any git based project besides Apache Buildr.
34
34
  OVERVIEW:
35
35
 
36
36
  gitflow is intended to help developers with their daily git workflow,
37
- performing repetitive git commands for them. It is implemented in
37
+ performing repetitive git commands for them. It is implemented in
38
38
  ruby so you can do anything, from invoking rake tasks to telling
39
39
  people on twitter you are having trouble with their code :P.
40
40
 
@@ -53,7 +53,7 @@ After that you can use
53
53
 
54
54
  EXTENDING YOUR WORKFLOW:
55
55
 
56
- You can create your own gitflow commands, to adapt your development
56
+ You can create your own gitflow commands, to adapt your development
57
57
  workflow.
58
58
 
59
59
  Simply create a ruby script somewhere say ~/.buildr/gitflow.rb
@@ -66,17 +66,17 @@ A sample command would look like this.. (you may want to look at buildr-git.rb)
66
66
 
67
67
  #!/usr/bin/env ruby
68
68
  require /path/to/gitflow.rb
69
-
69
+
70
70
  class MyCommand < GitFlow/'my-flow'
71
-
71
+
72
72
  @help = "Summary to be displayed when listing commands"
73
73
  @documentation = "Very long help that will be paged if necessary. (for --help)"
74
-
74
+
75
75
  # takes an openstruct to place default values and option values.
76
76
  # returns an array of arguments given to optparse.on
77
77
  def options(opts)
78
78
  opts.something = 'default'
79
- [
79
+ [
80
80
  ['--name NAME', lambda { |n| opts.name = n }],
81
81
  ['--yes', lambda { |n| opts.yes = true }]
82
82
  ]
@@ -94,7 +94,7 @@ A sample command would look like this.. (you may want to look at buildr-git.rb)
94
94
  class SubCommand < MyCommand/'sub-work'
95
95
  ... # implement a subcommand
96
96
  end
97
-
97
+
98
98
  end
99
99
 
100
100
  You would then get help for your command with
@@ -203,26 +203,26 @@ HELP
203
203
 
204
204
  # Override this method in your command class if it
205
205
  # needs to parse command line options.
206
- #
206
+ #
207
207
  # This method takes an openstruct object as argument
208
- # allowing you to store default values on it, and
208
+ # allowing you to store default values on it, and
209
209
  # set option values.
210
210
  #
211
- # The return value must be an array of arguments
211
+ # The return value must be an array of arguments
212
212
  # given to optparse.on
213
213
  def options(opt)
214
214
  []
215
215
  end
216
-
216
+
217
217
  # Override this method in your command class to implement
218
218
  # the command.
219
219
  # First argument is the openstruct object after
220
- # it has been populated by the option parser.
220
+ # it has been populated by the option parser.
221
221
  # Second argument is the array of non-option arguments.
222
222
  def execute(opt, argv)
223
223
  fail "#{self.class.command} not implemented"
224
224
  end
225
-
225
+
226
226
  # Run the command line given on argv
227
227
  def run(*argv, &block)
228
228
  GitFlow.run(*argv, &block)
@@ -233,11 +233,11 @@ HELP
233
233
  GitFlow.pager
234
234
  yield
235
235
  end
236
-
236
+
237
237
  def trace(*str)
238
238
  STDERR.puts(*str) if GitFlow.trace
239
239
  end
240
-
240
+
241
241
  def git(*args)
242
242
  cmd = 'git ' + args.map { |arg| arg[' '] ? %Q{"#{arg}"} : arg }.join(' ')
243
243
  trace cmd
@@ -245,13 +245,13 @@ HELP
245
245
  fail "GIT command `#{cmd}` failed with status #{$?.exitstatus}" unless $?.exitstatus == 0
246
246
  }
247
247
  end
248
-
248
+
249
249
  def sh(*args)
250
250
  `#{args.join(' ')}`.tap {
251
251
  fail "Shell command `#{args.join(' ')}` failed with status #{$?.exitstatus}" unless $?.exitstatus == 0
252
252
  }
253
253
  end
254
-
254
+
255
255
  def expand_path(path, dir=Dir.pwd)
256
256
  File.expand_path(path, dir)
257
257
  end
@@ -259,7 +259,7 @@ HELP
259
259
 
260
260
  class NoSuchCommand < GitFlow/nil
261
261
  @documentation = HELP
262
-
262
+
263
263
  def execute(opts, argv)
264
264
  page do
265
265
  puts "Command not found: #{argv.join(' ').inspect}"
@@ -271,7 +271,7 @@ HELP
271
271
  class HelpCommand < GitFlow/:help
272
272
  @help = "Display help for a command or show command list"
273
273
  @documentation = "Displays help for the command given as argument"
274
-
274
+
275
275
  def execute(opts, argv)
276
276
  if argv.empty?
277
277
  opt = GitFlow.optparse
@@ -290,7 +290,7 @@ HELP
290
290
  end
291
291
  end
292
292
  end
293
-
293
+
294
294
  end
295
295
 
296
296
  at_exit { GitFlow.run(*ARGV) if GitFlow.should_run }
@@ -41,6 +41,7 @@ Buildr supports the following environment variables:
41
41
  | @HOME@ | Your home directory. |
42
42
  | @HTTP_PROXY@ | URL for HTTP proxy server (see "Specifying Repositories":artifacts.html#repositories). |
43
43
  | @HTTPS_PROXY@ | URL for HTTPS proxy server (see "Specifying Repositories":artifacts.html#repositories). |
44
+ | @IGNORE_BUILDFILE@ | Set to "true" or "yes" to ignore changes in Buildfile or its dependencies when running tests. |
44
45
  | @JAVA_HOME@ | Points to your JDK, required when using Java and Ant. |
45
46
  | @JAVA_OPTS@ | Command line options to pass to the JDK (e.g. @'-Xms1g'@). |
46
47
  | @M2_REPO@ | Location of the Maven2 local repository. Defaults to the @.m2@ directory in your home directory (@ENV['HOME']@). |
@@ -165,9 +166,9 @@ Build settings can be retreived using the @Buildr.settings.build@ accessor.
165
166
 
166
167
  h2(#variable). Non constant settings
167
168
 
168
- Before loading the Buildfile, Buildr will attempt to load two other files: the @buildr.rb@ file it finds in your home directory, followed by the @buildr.rb@ file it finds in the build directory.
169
+ Before loading the Buildfile, Buildr will attempt to load two other files: the @buildr.rb@ file in the @.buildr@ directory under your home directory, followed by the @buildr.rb@ file it finds in the build directory.
169
170
 
170
- The loading order allows you to place global settings that affect all your builds in your home directory's @buildr.rb@, but also over-ride those with settings for a given project.
171
+ The loading order allows you to place global settings that affect all your builds in your @buildr.rb@, but also over-ride those with settings for a given project.
171
172
 
172
173
  Here's an example @buildr.rb@:
173
174
 
@@ -179,6 +180,12 @@ repositories.upload_to[:password] = 'supersecret'
179
180
  repositories.remote << 'http://inside-the-firewall'
180
181
  {% endhighlight %}
181
182
 
183
+ p(note). Buildr 1.3 and earlier used the file @buildr.rb@ directly in your home directory. Starting with version 1.4, Buildr loads @buildr.rb@ from the @.buildr@ directory under your home directory in preference. If you use Buildr 1.3 and earlier and don't want to duplicate your settings, you can move you existing @buildr.rb@ under the @.buildr@ directory and create a new @buildr.rb@ in your home directory containing:
184
+
185
+ {% highlight ruby %}
186
+ # Backward compatibility: Buildr 1.4+ uses $HOME/.buildr/buildr.rb
187
+ load File.expand_path('buildr.rb', Buildr.application.home_dir)
188
+ {% endhighlight %}
182
189
 
183
190
  h2(#environments). Environments
184
191
 
data/doc/testing.textile CHANGED
@@ -4,7 +4,7 @@ title: Testing
4
4
  ---
5
5
 
6
6
 
7
- Untested code is broken code, so we take testing seriously. Off the bat you get to use either JUnit or TestNG for writing unit tests and integration tests. And you can also add your own framework, or even script tests using Ruby. But= first, let's start with the basics.
7
+ Untested code is broken code, so we take testing seriously. Off the bat you get to use either JUnit or TestNG for writing unit tests and integration tests. And you can also add your own framework, or even script tests using Ruby. But first, let's start with the basics.
8
8
 
9
9
 
10
10
  h2(#writing). Writing Tests
@@ -44,15 +44,15 @@ When tests fail, Buildr fails the @test@ task. This is usually a good thing, bu
44
44
  test.using :fail_on_failure=>false
45
45
  {% endhighlight %}
46
46
 
47
- Besides giving you a free pass to ignore failures, you can use it for other causes, for example, to be somewhat forgiving:
47
+ Besides giving you a free pass to ignore failures, you can use it for other causes, for example, as a gentle reminder:
48
48
 
49
49
  {% highlight ruby %}
50
50
  test do
51
- fail 'More than 3 tests failed!' if test.failed_tests.size > 3
51
+ warn "Did you forget something?" if test.tests.nil? || test.tests.empty?
52
52
  end
53
53
  {% endhighlight %}
54
54
 
55
- The @failed_tests@ collection holds the names of all classes with failed tests. And there's @classes@, which holds the names of all test classes. Ruby arithmetic allows you to get the name of all passed test classes with a simple @test.classes – test.failed_tests@. We'll let you imagine creative use for these two.
55
+ The @tests@ collection holds the names of all classes with tests, if any. And there's @classes@, which holds the names of all test classes. We'll let you imagine creative use for these two.
56
56
 
57
57
 
58
58
  h2(#running). Running Tests
@@ -106,6 +106,17 @@ $ buildr package test=all
106
106
 
107
107
  We're using @package@ and not @build@ above. When using a continuous build system, you want to make sure that packages are created, contain the right files, and also run the integration tests.
108
108
 
109
+ During development, if you want to re-run only tests that have failed during the last test execution, you can execute:
110
+
111
+ {% highlight sh %}
112
+ $ buildr test:failed
113
+ {% endhighlight %}
114
+
115
+ One last note on running tests. By default when you run tests, Buildr will automatically run all transitive test dependencies. This mean if you run "buildr test" inside project @bar@ and @bar@ depends on project @foo@, Buildr will first run tests in project @foo@ if there have been any changes affecting @foo@ that haven't been taken into account yet. This behavior often surprises people, especially when they are trying to get things done and only care about tests in @bar@ at that moment. For those times when you'd like to focus your testing on specific projects, Buildr has the @only@ option that will only run tests for projects specified on the command line,
116
+
117
+ {% highlight sh %}
118
+ $ buildr test=only bar:test
119
+ {% endhighlight %}
109
120
 
110
121
  h2(#integration). Integration Tests
111
122
 
@@ -170,7 +181,7 @@ end
170
181
  check package(:war).path('WEB-INF'), 'should contain files' do
171
182
  it.should_not be_empty
172
183
  end
173
- check package(:war).path('WEB-INF/classes'), 'should contain classes' do
184
+ check package(:war).path('WEB-INF/classes'), 'should contain classes' do
174
185
  it.should contain('**/*.class')
175
186
  end
176
187
  check package(:war).entry('META-INF/MANIFEST'), 'should have license' do
data/etc/KEYS CHANGED
@@ -149,3 +149,41 @@ Ajt5Ierk8kbjO9yM75Y2+84McRiR8JCld2WJFNXXwKCIWuh6+UtGPqafxHccKQYv
149
149
  QKtVPfIqp4oI8qSfsZ0gMafFRwCfTqvRMVFyLEnygWnhpxgJRYk+8Fc=
150
150
  =ryOG
151
151
  -----END PGP PUBLIC KEY BLOCK-----
152
+
153
+
154
+ pub 2048R/191DFA62 2010-03-15
155
+ uid Antoine Toulme <antoine@lunar-ocean.com>
156
+ sig 3 191DFA62 2010-03-15 Antoine Toulme <antoine@lunar-ocean.com>
157
+ sub 2048R/F82CCCA4 2010-03-15
158
+ sig 191DFA62 2010-03-15 Antoine Toulme <antoine@lunar-ocean.com>
159
+
160
+ -----BEGIN PGP PUBLIC KEY BLOCK-----
161
+ Version: GnuPG v1.4.10 (Darwin)
162
+
163
+ mQENBEud3FYBCACjGYLotue6+saF39/Yim+UrSnLgsM6hwPETpwOawQOKUuEd8/N
164
+ I07bCXI7HHgeBHQ0ENTWqH4hO1CoyKDsIChY37GYLZkx7KS8HVCxg/b6DNVp5vTi
165
+ oHm8XTGvdVzkvoKj4Se0T+jpTfVYoiq8CRY0jH3Wqxs8QGfVGVkVJ9hgz8UyJUyB
166
+ 7PidE0P4U/xmZ3lMzxWr9d1TabNjCQmtgRgoi8auX3VP0TXJbedPXPF3xuhbFSWl
167
+ LAZhujzZwefGvJk9XX1lsA2BnMvTBC9PJqCbfaRE+3/bl3Cwq8CtyOjJ4O9i1ie8
168
+ +exUX8RSitlP3uxMJoFR2z/qHeRTors5d1DfABEBAAG0KEFudG9pbmUgVG91bG1l
169
+ IDxhbnRvaW5lQGx1bmFyLW9jZWFuLmNvbT6JATgEEwECACIFAkud3FYCGwMGCwkI
170
+ BwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEO7QCd8ZHfpiNL4H/3oe0+MVB72FR7Bg
171
+ IRoNTxnsGb1kSarTMyYQHhWMQqUiH1hEqP0R0oPDcOumw08m91jmZFPEgk53fpZJ
172
+ OL0T8UnG4XoIHilRqc55OiFkXgDFivS1RQLG6ZkLnslD70+hURiU26JJ3tQO4Jh9
173
+ E9fAUy6KFGvwgAC9KMaw0wVgPZ9Ippd4lDE8VOPIOqZqvJ5kcYzi983I/b7eUhL9
174
+ IMLGRRftG9VKMCxV+1mIIv+62KTaC0SlzOqaGpaC52HjJt3ogOyIjKqyoU+U+fXY
175
+ AaP3iwHqXD2ojgbz89A5cckf99YImJlLGoWEiCNyhNh5EfuUH1QyuFssitJXsZS2
176
+ PBzhr0G5AQ0ES53cVgEIAM/nSJsPWIq4GuLjTdOA1LyN/k2a/L2fU4jGu5VVrAJu
177
+ 2e4BEBfte9WubzubOL7JMnS/v4ilZe9PQnQkXWWIZUbkK2lsqws8J5rzk2OyzjJj
178
+ aosoQfMJKgyLC0qmwhWElzlAbOU5ISCw58hCuATO5DnVCB4f3ltsLPyJ6T8RPb24
179
+ YbBWzdxKdXrsqKhTlLkWUpBIg+yD+Z7EIBJtCOjU3/F/H+OBnyFdnT+9zR0QKzeB
180
+ v3pRvQiBiMPNtOME+kjVJqTqjpCy8xh1AFjmOPjgOpQXv8YeCj/B4OcpyGpqJdL4
181
+ TYIvwu/HFXSrCTAPlu7Jk4hMnsHRlVaTAkKBGP5KAAUAEQEAAYkBHwQYAQIACQUC
182
+ S53cVgIbDAAKCRDu0AnfGR36YlhKB/46x/wrVl89i/jBa5iSVcIOpHhypLylGXaG
183
+ J7a9ICfyVwmL0DNpdWOKlmPXEM3NEmELfJXiOZhzGKOE8y/JM/lS+z09rXngCm96
184
+ CAzjwjNb6FC9wMZGsQGp7M/7VthyAjS/wlhS2PExCIWHglmsaPPj4NBAQxg/M8Na
185
+ n5F6Rq2K6rOE1x882i5wNsgAEb1iOFEUE1ctYSNbmO6JQfFyvz0cKpdmW52/iC41
186
+ sIHg4pUCB3Z7wT6vvSs/eQ3jARt7mok3JE56JL0sV2+Z2SePiFUn/ixKdn1lKP8d
187
+ +THIYJ/ZdpxUZeNKy7f1djoctqAk5T7ujVJh2d6xRXwqvQcJKoeW
188
+ =6E9O
189
+ -----END PGP PUBLIC KEY BLOCK-----
data/lib/buildr.rb CHANGED
@@ -14,7 +14,7 @@
14
14
  # the License.
15
15
 
16
16
  module Buildr
17
- VERSION = '1.3.5'.freeze
17
+ VERSION = '1.4.0'.freeze
18
18
  end
19
19
 
20
20
  require 'buildr/core'
data/lib/buildr/core.rb CHANGED
@@ -32,4 +32,5 @@ require 'buildr/core/shell'
32
32
  require 'buildr/core/checks'
33
33
  require 'buildr/core/transports'
34
34
  require 'buildr/core/generate'
35
+ require 'buildr/core/cc'
35
36
  require 'buildr/core/osx' if RUBY_PLATFORM =~ /darwin/
@@ -115,8 +115,8 @@ module Buildr
115
115
  class Application < Rake::Application #:nodoc:
116
116
 
117
117
  # Deprecated: rakefile/Rakefile, removed in 1.5
118
- DEFAULT_BUILDFILES = ['buildfile', 'Buildfile'] + DEFAULT_RAKEFILES
119
-
118
+ DEFAULT_BUILDFILES = ['buildfile', 'Buildfile', 'buildfile.rb', 'Buildfile.rb'] + DEFAULT_RAKEFILES
119
+
120
120
  attr_reader :rakefiles, :requires
121
121
  private :rakefiles, :requires
122
122
 
@@ -125,7 +125,7 @@ module Buildr
125
125
  @rakefiles = DEFAULT_BUILDFILES.dup
126
126
  @top_level_tasks = []
127
127
  @home_dir = File.expand_path('.buildr', ENV['HOME'])
128
- mkpath @home_dir unless File.exist?(@home_dir)
128
+ mkpath @home_dir if !File.exist?(@home_dir) && File.writable?(ENV['HOME'])
129
129
  @settings = Settings.new(self)
130
130
  @on_completion = []
131
131
  @on_failure = []
@@ -173,7 +173,7 @@ module Buildr
173
173
 
174
174
  # Files that complement the buildfile itself
175
175
  def build_files #:nodoc:
176
- deprecated 'Please call buildfile.prerequisites instead'
176
+ deprecated 'Please call buildfile.prerequisites instead'
177
177
  buildfile.prerequisites
178
178
  end
179
179
 
@@ -208,7 +208,7 @@ module Buildr
208
208
  end
209
209
 
210
210
  protected
211
-
211
+
212
212
  def load_buildfile # replaces load_rakefile
213
213
  standard_exception_handling do
214
214
  find_buildfile
@@ -255,10 +255,10 @@ module Buildr
255
255
  opts.banner = "buildr [-f rakefile] {options} targets..."
256
256
  opts.separator ""
257
257
  opts.separator "Options are ..."
258
-
258
+
259
259
  opts.on_tail("-h", "--help", "-H", "Display this help message.") do
260
260
  puts opts
261
- exit
261
+ exit 0
262
262
  end
263
263
  standard_buildr_options.each { |args| opts.on(*args) }
264
264
  end.parse!
@@ -275,18 +275,18 @@ module Buildr
275
275
  ],
276
276
  ['--execute', '-E CODE',
277
277
  "Execute some Ruby code after loading the buildfile",
278
- lambda { |value| options.execute = value }
278
+ lambda { |value| options.execute = value }
279
279
  ],
280
280
  ['--environment', '-e ENV',
281
281
  "Environment name (e.g. development, test, production).",
282
- lambda { |value| ENV['BUILDR_ENV'] = value }
282
+ lambda { |value| ENV['BUILDR_ENV'] = value }
283
283
  ],
284
284
  ['--generate [PATH]',
285
285
  "Generate buildfile from either pom.xml file or directory path.",
286
286
  lambda { |value|
287
287
  value ||= File.exist?('pom.xml') ? 'pom.xml' : Dir.pwd
288
288
  raw_generate_buildfile value
289
- exit
289
+ exit 0
290
290
  }
291
291
  ],
292
292
  ['--libdir', '-I LIBDIR', "Include LIBDIR in the search path for required modules.",
@@ -302,8 +302,8 @@ module Buildr
302
302
  lambda { |value| verbose(false) }
303
303
  ],
304
304
  ['--buildfile', '-f FILE', "Use FILE as the buildfile.",
305
- lambda { |value|
306
- @rakefiles.clear
305
+ lambda { |value|
306
+ @rakefiles.clear
307
307
  @rakefiles << value
308
308
  }
309
309
  ],
@@ -354,8 +354,8 @@ module Buildr
354
354
  ],
355
355
  ['--version', '-V', "Display the program version.",
356
356
  lambda { |value|
357
- puts "Buildr #{Buildr::VERSION} #{RUBY_PLATFORM[/java/] && '(JRuby '+JRUBY_VERSION+')'}"
358
- exit
357
+ puts "Buildr #{Buildr::VERSION}#{RUBY_PLATFORM[/java/] ? " (JRuby #{JRUBY_VERSION})" : ""}"
358
+ exit 0
359
359
  }
360
360
  ]
361
361
  ]
@@ -434,7 +434,7 @@ module Buildr
434
434
  end
435
435
  end
436
436
 
437
- # Load artifact specs from the build.yaml file, making them available
437
+ # Load artifact specs from the build.yaml file, making them available
438
438
  # by name ( ruby symbols ).
439
439
  def load_artifact_ns #:nodoc:
440
440
  hash = settings.build['artifacts']
@@ -443,12 +443,18 @@ module Buildr
443
443
  # Currently we only use one artifact namespace to rule them all. (the root NS)
444
444
  Buildr::ArtifactNamespace.load(:root => hash)
445
445
  end
446
-
447
- # Loads buildr.rb files from users home directory and project directory.
446
+
447
+ # Loads buildr.rb files from home/.buildr directory and project directory.
448
448
  # Loads custom tasks from .rake files in tasks directory.
449
449
  def load_tasks #:nodoc:
450
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) }
451
+ old = File.expand_path('buildr.rb', ENV['HOME'])
452
+ new = File.expand_path('buildr.rb', home_dir)
453
+ if File.exist?(old) && !File.exist?(new)
454
+ warn "Deprecated: Please move buildr.rb from your home directory to the .buildr directory in your home directory"
455
+ end
456
+ # Load home/.buildr/buildr.rb in preference
457
+ files = [ File.exist?(new) ? new : old, 'buildr.rb' ].select { |file| File.exist?(file) }
452
458
  files += [ File.expand_path('buildr.rake', ENV['HOME']), File.expand_path('buildr.rake') ].
453
459
  select { |file| File.exist?(file) }.each { |file| warn "Please use '#{file.ext('rb')}' instead of '#{file}'" }
454
460
  files += (options.rakelib || []).collect { |rlib| Dir["#{rlib}/*.rake"] }.flatten
@@ -501,13 +507,14 @@ module Buildr
501
507
  $stderr.puts $terminal.color(ex.message, :red)
502
508
  exit(1)
503
509
  rescue Exception => ex
504
- title, message = "Your build failed with an error", "#{Dir.pwd}:\n#{ex.message}"
510
+ ex_msg = ex.class.name == "Exception" ? ex.message : "#{ex.class.name} : #{ex.message}"
511
+ title, message = "Your build failed with an error", "#{Dir.pwd}:\n#{ex_msg}"
505
512
  @on_failure.each do |block|
506
513
  block.call(title, message, ex) rescue nil
507
514
  end
508
515
  # Exit with error message
509
516
  $stderr.puts "Buildr aborted!"
510
- $stderr.puts $terminal.color(ex.message, :red)
517
+ $stderr.puts $terminal.color(ex_msg, :red)
511
518
  if options.trace
512
519
  $stderr.puts ex.backtrace.join("\n")
513
520
  else
@@ -519,13 +526,13 @@ module Buildr
519
526
  end
520
527
 
521
528
  end
522
-
523
-
529
+
530
+
524
531
  # This task stands for the buildfile and all its associated helper files (e.g., buildr.rb, build.yaml).
525
532
  # By using this task as a prerequisite for other tasks, you can ensure these tasks will be needed
526
533
  # whenever the buildfile changes.
527
534
  class BuildfileTask < Rake::FileTask #:nodoc:
528
-
535
+
529
536
  def timestamp
530
537
  ([name] + prerequisites).map { |f| File.stat(f).mtime }.max rescue Time.now
531
538
  end
@@ -561,14 +568,13 @@ end
561
568
 
562
569
 
563
570
  # Add a touch of color when available and running in terminal.
571
+ HighLine.use_color = false
564
572
  if $stdout.isatty
565
573
  begin
566
- require 'Win32/Console/ANSI' if Config::CONFIG['host_os'] =~ /mswin/
574
+ require 'Win32/Console/ANSI' if Config::CONFIG['host_os'] =~ /mswin|win32|dos|cygwin|mingw/i
567
575
  HighLine.use_color = true
568
576
  rescue LoadError
569
577
  end
570
- else
571
- HighLine.use_color = false
572
578
  end
573
579
 
574
580
 
@@ -629,7 +635,7 @@ module Rake #:nodoc
629
635
  old_chain, Thread.current[:rake_chain] = Thread.current[:rake_chain], new_chain
630
636
  execute(task_args) if needed?
631
637
  ensure
632
- Thread.current[:rake_chain] = nil
638
+ Thread.current[:rake_chain] = old_chain
633
639
  end
634
640
  end
635
641
  end