buildr 1.3.3-java → 1.3.4-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +76 -0
- data/NOTICE +1 -1
- data/README.rdoc +9 -21
- data/Rakefile +17 -34
- data/_buildr +3 -12
- data/{doc/print.toc.yaml → _jbuildr} +14 -14
- data/addon/buildr/cobertura.rb +5 -219
- data/addon/buildr/drb.rb +281 -0
- data/addon/buildr/emma.rb +5 -221
- data/addon/buildr/nailgun.rb +93 -689
- data/bin/buildr +0 -9
- data/buildr.buildfile +4 -4
- data/buildr.gemspec +27 -21
- data/doc/_layouts/default.html +82 -0
- data/doc/_layouts/preface.html +22 -0
- data/doc/{pages/artifacts.textile → artifacts.textile} +82 -42
- data/doc/{pages/building.textile → building.textile} +89 -47
- data/doc/{pages/contributing.textile → contributing.textile} +53 -45
- data/doc/css/default.css +6 -5
- data/doc/css/print.css +17 -24
- data/doc/css/syntax.css +7 -36
- data/doc/download.textile +68 -0
- data/doc/{pages/extending.textile → extending.textile} +45 -24
- data/doc/{pages/getting_started.textile → getting_started.textile} +158 -88
- data/doc/images/asf-logo.gif +0 -0
- data/doc/images/note.png +0 -0
- data/doc/index.textile +47 -0
- data/doc/{pages/languages.textile → languages.textile} +108 -54
- data/doc/mailing_lists.textile +25 -0
- data/doc/{pages/more_stuff.textile → more_stuff.textile} +152 -73
- data/doc/{pages/packaging.textile → packaging.textile} +181 -96
- data/doc/preface.textile +28 -0
- data/doc/{pages/projects.textile → projects.textile} +55 -40
- data/doc/scripts/buildr-git.rb +364 -264
- data/doc/scripts/gitflow.rb +296 -0
- data/doc/scripts/install-jruby.sh +2 -2
- data/doc/scripts/install-linux.sh +6 -6
- data/doc/scripts/install-osx.sh +2 -2
- data/doc/{pages/settings_profiles.textile → settings_profiles.textile} +83 -45
- data/doc/{pages/testing.textile → testing.textile} +77 -41
- data/lib/buildr.rb +5 -5
- data/lib/buildr/core.rb +2 -0
- data/lib/buildr/core/application.rb +321 -151
- data/lib/buildr/core/build.rb +298 -167
- data/lib/buildr/core/checks.rb +4 -132
- data/lib/buildr/core/common.rb +1 -5
- data/lib/buildr/core/compile.rb +3 -9
- data/lib/buildr/core/environment.rb +12 -3
- data/lib/buildr/core/filter.rb +20 -18
- data/lib/buildr/core/generate.rb +36 -36
- data/lib/buildr/core/help.rb +2 -1
- data/lib/buildr/core/osx.rb +46 -0
- data/lib/buildr/core/progressbar.rb +1 -1
- data/lib/buildr/core/project.rb +7 -34
- data/lib/buildr/core/test.rb +12 -6
- data/lib/buildr/core/transports.rb +13 -11
- data/lib/buildr/core/util.rb +14 -23
- data/lib/buildr/groovy/bdd.rb +3 -2
- data/lib/buildr/groovy/compiler.rb +1 -1
- data/lib/buildr/ide/eclipse.rb +31 -21
- data/lib/buildr/ide/idea.rb +3 -2
- data/lib/buildr/ide/idea7x.rb +6 -4
- data/lib/buildr/java/ant.rb +3 -1
- data/lib/buildr/java/bdd.rb +9 -7
- data/lib/buildr/java/cobertura.rb +243 -0
- data/lib/buildr/java/compiler.rb +5 -4
- data/lib/buildr/java/emma.rb +244 -0
- data/lib/buildr/java/packaging.rb +11 -8
- data/lib/buildr/java/pom.rb +0 -4
- data/lib/buildr/java/rjb.rb +1 -1
- data/lib/buildr/java/test_result.rb +5 -7
- data/lib/buildr/java/tests.rb +17 -11
- data/lib/buildr/packaging.rb +5 -2
- data/lib/buildr/packaging/archive.rb +488 -0
- data/lib/buildr/packaging/artifact.rb +48 -29
- data/lib/buildr/packaging/artifact_namespace.rb +6 -6
- data/lib/buildr/packaging/gems.rb +4 -4
- data/lib/buildr/packaging/package.rb +3 -2
- data/lib/buildr/packaging/tar.rb +85 -3
- data/lib/buildr/packaging/version_requirement.rb +172 -0
- data/lib/buildr/packaging/zip.rb +24 -682
- data/lib/buildr/packaging/ziptask.rb +313 -0
- data/lib/buildr/scala.rb +5 -0
- data/lib/buildr/scala/bdd.rb +100 -0
- data/lib/buildr/scala/compiler.rb +45 -4
- data/lib/buildr/scala/tests.rb +12 -59
- data/rakelib/checks.rake +57 -0
- data/rakelib/doc.rake +58 -68
- data/rakelib/jekylltask.rb +110 -0
- data/rakelib/package.rake +35 -37
- data/rakelib/release.rake +119 -35
- data/rakelib/rspec.rake +29 -39
- data/rakelib/setup.rake +21 -59
- data/rakelib/stage.rake +184 -26
- data/spec/addon/drb_spec.rb +328 -0
- data/spec/core/application_spec.rb +32 -25
- data/spec/core/build_spec.rb +336 -126
- data/spec/core/checks_spec.rb +292 -310
- data/spec/core/common_spec.rb +8 -2
- data/spec/core/compile_spec.rb +17 -1
- data/spec/core/generate_spec.rb +3 -3
- data/spec/core/project_spec.rb +18 -10
- data/spec/core/test_spec.rb +8 -1
- data/spec/core/transport_spec.rb +40 -3
- data/spec/core/util_spec.rb +67 -0
- data/spec/ide/eclipse_spec.rb +96 -28
- data/spec/ide/idea7x_spec.rb +84 -0
- data/spec/java/ant.rb +5 -0
- data/spec/java/bdd_spec.rb +12 -3
- data/spec/{addon → java}/cobertura_spec.rb +6 -6
- data/spec/{addon → java}/emma_spec.rb +5 -6
- data/spec/java/java_spec.rb +12 -2
- data/spec/java/packaging_spec.rb +31 -2
- data/spec/{addon → java}/test_coverage_spec.rb +3 -3
- data/spec/java/tests_spec.rb +5 -0
- data/spec/packaging/archive_spec.rb +11 -1
- data/spec/{core → packaging}/artifact_namespace_spec.rb +10 -2
- data/spec/packaging/artifact_spec.rb +44 -3
- data/spec/packaging/packaging_spec.rb +1 -1
- data/spec/sandbox.rb +17 -14
- data/spec/scala/bdd_spec.rb +150 -0
- data/spec/scala/compiler_spec.rb +27 -0
- data/spec/scala/scala.rb +38 -0
- data/spec/scala/tests_spec.rb +78 -33
- data/spec/spec_helpers.rb +29 -5
- data/spec/version_requirement_spec.rb +6 -0
- metadata +176 -172
- data/DISCLAIMER +0 -7
- data/doc/images/apache-incubator-logo.png +0 -0
- data/doc/pages/download.textile +0 -51
- data/doc/pages/index.textile +0 -42
- data/doc/pages/mailing_lists.textile +0 -17
- data/doc/pages/recipes.textile +0 -103
- data/doc/pages/troubleshooting.textile +0 -103
- data/doc/pages/whats_new.textile +0 -323
- data/doc/print.haml +0 -51
- data/doc/site.haml +0 -56
- data/doc/site.toc.yaml +0 -47
- data/etc/git-svn-authors +0 -16
- data/lib/buildr/core/application_cli.rb +0 -139
- data/rakelib/apache.rake +0 -191
- data/rakelib/changelog.rake +0 -57
- data/rakelib/rubyforge.rake +0 -53
- data/rakelib/scm.rake +0 -49
data/lib/buildr/core/checks.rb
CHANGED
|
@@ -15,10 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
require 'buildr/core/project'
|
|
18
|
-
|
|
19
|
-
#require 'test/unit'
|
|
20
|
-
require 'spec/matchers'
|
|
21
|
-
require 'spec/expectations'
|
|
18
|
+
autoload :Spec, 'spec'
|
|
22
19
|
|
|
23
20
|
|
|
24
21
|
module Buildr
|
|
@@ -93,7 +90,7 @@ module Buildr
|
|
|
93
90
|
@description = args.pop if String === args.last
|
|
94
91
|
@subject = args.shift
|
|
95
92
|
raise ArgumentError, "Expecting subject followed by description, and either one is optional. Not quite sure what to do with this list of arguments." unless args.empty?
|
|
96
|
-
@block = block || lambda {
|
|
93
|
+
@block = block || lambda { info "Pending: #{description}" }
|
|
97
94
|
end
|
|
98
95
|
|
|
99
96
|
# :call-seq:
|
|
@@ -118,8 +115,8 @@ module Buildr
|
|
|
118
115
|
# - All matchers defined by Buildr and RSpec.
|
|
119
116
|
klass = Class.new
|
|
120
117
|
klass.instance_eval do
|
|
121
|
-
context.class.instance_methods
|
|
122
|
-
define_method(method) { |*args| context.send(method, *args) }
|
|
118
|
+
context.class.instance_methods.each do |method|
|
|
119
|
+
define_method(method) { |*args| context.send(method, *args) } unless instance_methods.include?(method)
|
|
123
120
|
end
|
|
124
121
|
define_method(:it) { subject }
|
|
125
122
|
define_method(:description) { description }
|
|
@@ -252,131 +249,6 @@ module Rake #:nodoc:
|
|
|
252
249
|
end
|
|
253
250
|
|
|
254
251
|
|
|
255
|
-
module Zip #:nodoc:
|
|
256
|
-
class ZipEntry
|
|
257
|
-
|
|
258
|
-
# :call-seq:
|
|
259
|
-
# exist() => boolean
|
|
260
|
-
#
|
|
261
|
-
# Returns true if this entry exists.
|
|
262
|
-
def exist?()
|
|
263
|
-
Zip::ZipFile.open(zipfile) { |zip| zip.file.exist?(@name) }
|
|
264
|
-
end
|
|
265
|
-
|
|
266
|
-
# :call-seq:
|
|
267
|
-
# empty?() => boolean
|
|
268
|
-
#
|
|
269
|
-
# Returns true if this entry is empty.
|
|
270
|
-
def empty?()
|
|
271
|
-
Zip::ZipFile.open(zipfile) { |zip| zip.file.read(@name) }.empty?
|
|
272
|
-
end
|
|
273
|
-
|
|
274
|
-
# :call-seq:
|
|
275
|
-
# contain(patterns*) => boolean
|
|
276
|
-
#
|
|
277
|
-
# Returns true if this ZIP file entry matches against all the arguments. An argument may be
|
|
278
|
-
# a string or regular expression.
|
|
279
|
-
def contain?(*patterns)
|
|
280
|
-
content = Zip::ZipFile.open(zipfile) { |zip| zip.file.read(@name) }
|
|
281
|
-
patterns.map { |pattern| Regexp === pattern ? pattern : Regexp.new(Regexp.escape(pattern.to_s)) }.
|
|
282
|
-
all? { |pattern| content =~ pattern }
|
|
283
|
-
end
|
|
284
|
-
|
|
285
|
-
end
|
|
286
|
-
end
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
class Buildr::ArchiveTask
|
|
290
|
-
|
|
291
|
-
class Path #:nodoc:
|
|
292
|
-
|
|
293
|
-
# :call-seq:
|
|
294
|
-
# exist() => boolean
|
|
295
|
-
#
|
|
296
|
-
# Returns true if this path exists. This only works if the path has any entries in it,
|
|
297
|
-
# so exist on path happens to be the opposite of empty.
|
|
298
|
-
def exist?()
|
|
299
|
-
!entries.empty?
|
|
300
|
-
end
|
|
301
|
-
|
|
302
|
-
# :call-seq:
|
|
303
|
-
# empty?() => boolean
|
|
304
|
-
#
|
|
305
|
-
# Returns true if this path is empty (has no other entries inside).
|
|
306
|
-
def empty?()
|
|
307
|
-
entries.all? { |entry| entry.empty? }
|
|
308
|
-
end
|
|
309
|
-
|
|
310
|
-
# :call-seq:
|
|
311
|
-
# contain(file*) => boolean
|
|
312
|
-
#
|
|
313
|
-
# Returns true if this ZIP file path contains all the specified files. You can use relative
|
|
314
|
-
# file names and glob patterns (using *, **, etc).
|
|
315
|
-
def contain?(*files)
|
|
316
|
-
files.all? { |file| entries.detect { |entry| File.fnmatch(file, entry.to_s, File::FNM_PATHNAME) } }
|
|
317
|
-
end
|
|
318
|
-
|
|
319
|
-
# :call-seq:
|
|
320
|
-
# entry(name) => ZipEntry
|
|
321
|
-
#
|
|
322
|
-
# Returns a ZIP file entry. You can use this to check if the entry exists and its contents,
|
|
323
|
-
# for example:
|
|
324
|
-
# package(:jar).path("META-INF").entry("LICENSE").should contain(/Apache Software License/)
|
|
325
|
-
def entry(name)
|
|
326
|
-
root.entry("#{@path}#{name}")
|
|
327
|
-
end
|
|
328
|
-
|
|
329
|
-
protected
|
|
330
|
-
|
|
331
|
-
def entries() #:nodoc:
|
|
332
|
-
return root.entries unless @path
|
|
333
|
-
@entries ||= root.entries.inject([]) { |selected, entry|
|
|
334
|
-
selected << entry.name.sub(@path, "") if entry.name.index(@path) == 0
|
|
335
|
-
selected
|
|
336
|
-
}
|
|
337
|
-
end
|
|
338
|
-
|
|
339
|
-
end
|
|
340
|
-
|
|
341
|
-
# :call-seq:
|
|
342
|
-
# empty?() => boolean
|
|
343
|
-
#
|
|
344
|
-
# Returns true if this ZIP file is empty (has no other entries inside).
|
|
345
|
-
def empty?()
|
|
346
|
-
path("").empty
|
|
347
|
-
end
|
|
348
|
-
|
|
349
|
-
# :call-seq:
|
|
350
|
-
# contain(file*) => boolean
|
|
351
|
-
#
|
|
352
|
-
# Returns true if this ZIP file contains all the specified files. You can use absolute
|
|
353
|
-
# file names and glob patterns (using *, **, etc).
|
|
354
|
-
def contain?(*files)
|
|
355
|
-
path("").contain?(*files)
|
|
356
|
-
end
|
|
357
|
-
|
|
358
|
-
end
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
class Buildr::ZipTask #:nodoc:
|
|
362
|
-
|
|
363
|
-
# :call-seq:
|
|
364
|
-
# entry(name) => Entry
|
|
365
|
-
#
|
|
366
|
-
# Returns a ZIP file entry. You can use this to check if the entry exists and its contents,
|
|
367
|
-
# for example:
|
|
368
|
-
# package(:jar).entry("META-INF/LICENSE").should contain(/Apache Software License/)
|
|
369
|
-
def entry(entry_name)
|
|
370
|
-
::Zip::ZipEntry.new(name, entry_name)
|
|
371
|
-
end
|
|
372
|
-
|
|
373
|
-
def entries() #:nodoc:
|
|
374
|
-
@entries ||= Zip::ZipFile.open(name) { |zip| zip.entries }
|
|
375
|
-
end
|
|
376
|
-
|
|
377
|
-
end
|
|
378
|
-
|
|
379
|
-
|
|
380
252
|
class Buildr::Project
|
|
381
253
|
include Buildr::Checks
|
|
382
254
|
end
|
data/lib/buildr/core/common.rb
CHANGED
|
@@ -15,11 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
require 'rake'
|
|
18
|
-
require 'tempfile'
|
|
19
|
-
require 'open-uri'
|
|
20
|
-
$LOADED_FEATURES << 'rubygems/open-uri.rb' # avoid loading rubygems' open-uri
|
|
21
18
|
require 'buildr/core/util'
|
|
22
|
-
require 'buildr/core/transports'
|
|
23
19
|
|
|
24
20
|
|
|
25
21
|
module Buildr
|
|
@@ -55,7 +51,7 @@ module Buildr
|
|
|
55
51
|
# For example:
|
|
56
52
|
# write('README') { read('README').sub("${build}", Time.now) }
|
|
57
53
|
def write(name, content = nil)
|
|
58
|
-
mkpath File.dirname(name)
|
|
54
|
+
mkpath File.dirname(name)
|
|
59
55
|
content = yield if block_given?
|
|
60
56
|
File.open(name.to_s, 'wb') { |file| file.write content.to_s }
|
|
61
57
|
content.to_s
|
data/lib/buildr/core/compile.rb
CHANGED
|
@@ -224,12 +224,12 @@ module Buildr
|
|
|
224
224
|
unless sources.empty?
|
|
225
225
|
raise 'No compiler selected and can\'t determine which compiler to use' unless compiler
|
|
226
226
|
raise 'No target directory specified' unless target
|
|
227
|
-
mkpath target.to_s
|
|
227
|
+
mkpath target.to_s
|
|
228
228
|
info "Compiling #{task.name.gsub(/:[^:]*$/, '')} into #{target.to_s}"
|
|
229
229
|
@compiler.compile(sources.map(&:to_s), target.to_s, dependencies.map(&:to_s))
|
|
230
230
|
# By touching the target we let other tasks know we did something,
|
|
231
231
|
# and also prevent recompiling again for dependencies.
|
|
232
|
-
touch target.to_s
|
|
232
|
+
touch target.to_s
|
|
233
233
|
end
|
|
234
234
|
end
|
|
235
235
|
end
|
|
@@ -407,7 +407,7 @@ module Buildr
|
|
|
407
407
|
@filter = Buildr::Filter.new
|
|
408
408
|
@filter.using Buildr.settings.profile['filter'] if Hash === Buildr.settings.profile['filter']
|
|
409
409
|
enhance do
|
|
410
|
-
|
|
410
|
+
target.invoke if target
|
|
411
411
|
end
|
|
412
412
|
end
|
|
413
413
|
|
|
@@ -490,12 +490,6 @@ module Buildr
|
|
|
490
490
|
end
|
|
491
491
|
|
|
492
492
|
after_define do |project|
|
|
493
|
-
# TODO: Is this necessary?
|
|
494
|
-
#if project.resources.target
|
|
495
|
-
# file project.resources.target.to_s=>project.resources do |task|
|
|
496
|
-
# mkpath task.name, :verbose=>false
|
|
497
|
-
# end
|
|
498
|
-
#end
|
|
499
493
|
if project.compile.target
|
|
500
494
|
# This comes last because the target path is set inside the project definition.
|
|
501
495
|
project.build project.compile.target
|
|
@@ -14,9 +14,6 @@
|
|
|
14
14
|
# the License.
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
require 'yaml'
|
|
18
|
-
|
|
19
|
-
|
|
20
17
|
module Buildr
|
|
21
18
|
|
|
22
19
|
# Collection of options for controlling Buildr.
|
|
@@ -46,6 +43,7 @@ module Buildr
|
|
|
46
43
|
|
|
47
44
|
# Wraps around the proxy environment variables:
|
|
48
45
|
# * :http -- HTTP_PROXY
|
|
46
|
+
# * :https -- HTTPS_PROXY
|
|
49
47
|
# * :exclude -- NO_PROXY
|
|
50
48
|
class Proxies
|
|
51
49
|
|
|
@@ -60,6 +58,17 @@ module Buildr
|
|
|
60
58
|
ENV['HTTP_PROXY'] = url
|
|
61
59
|
end
|
|
62
60
|
|
|
61
|
+
# Returns the HTTPS_PROXY URL.
|
|
62
|
+
def https
|
|
63
|
+
ENV['HTTPS_PROXY'] || ENV['https_proxy']
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Sets the HTTPS_PROXY URL.
|
|
67
|
+
def https=(url)
|
|
68
|
+
ENV['https_proxy'] = nil
|
|
69
|
+
ENV['HTTPS_PROXY'] = url
|
|
70
|
+
end
|
|
71
|
+
|
|
63
72
|
# Returns list of hosts to exclude from proxying (NO_PROXY).
|
|
64
73
|
def exclude
|
|
65
74
|
@exclude ||= EnvArray.new('NO_PROXY')
|
data/lib/buildr/core/filter.rb
CHANGED
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
# License for the specific language governing permissions and limitations under
|
|
14
14
|
# the License.
|
|
15
15
|
|
|
16
|
+
|
|
17
|
+
require 'erb'
|
|
18
|
+
|
|
19
|
+
|
|
16
20
|
module Buildr
|
|
17
21
|
|
|
18
22
|
# A filter knows how to copy files from one directory to another, applying mappings to the
|
|
@@ -161,11 +165,11 @@ module Buildr
|
|
|
161
165
|
copy_map = sources.flatten.map(&:to_s).inject({}) do |map, source|
|
|
162
166
|
files = Util.recursive_with_dot_files(source).
|
|
163
167
|
map { |file| Util.relative_path(file, source) }.
|
|
164
|
-
select { |file| @include.empty? || @include.any? { |pattern| File.fnmatch(pattern, file
|
|
165
|
-
reject { |file| @exclude.any? { |pattern| File.fnmatch(pattern, file
|
|
168
|
+
select { |file| @include.empty? || @include.any? { |pattern| File.fnmatch(pattern, file) } }.
|
|
169
|
+
reject { |file| @exclude.any? { |pattern| File.fnmatch(pattern, file) } }
|
|
166
170
|
files.each do |file|
|
|
167
171
|
src, dest = File.expand_path(file, source), File.expand_path(file, target.to_s)
|
|
168
|
-
map[file] = src if !File.exist?(dest) || File.stat(src).mtime
|
|
172
|
+
map[file] = src if !File.exist?(dest) || File.stat(src).mtime >= File.stat(dest).mtime
|
|
169
173
|
end
|
|
170
174
|
map
|
|
171
175
|
end
|
|
@@ -173,24 +177,22 @@ module Buildr
|
|
|
173
177
|
mkpath target.to_s
|
|
174
178
|
return false if copy_map.empty?
|
|
175
179
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
File.chmod(0664, dest)
|
|
189
|
-
end
|
|
180
|
+
copy_map.each do |path, source|
|
|
181
|
+
dest = File.expand_path(path, target.to_s)
|
|
182
|
+
if File.directory?(source)
|
|
183
|
+
mkpath dest
|
|
184
|
+
else
|
|
185
|
+
mkpath File.dirname(dest)
|
|
186
|
+
if @mapper.mapper_type
|
|
187
|
+
mapped = @mapper.transform(File.open(source, 'rb') { |file| file.read }, path)
|
|
188
|
+
File.open(dest, 'wb') { |file| file.write mapped }
|
|
189
|
+
else # no mapping
|
|
190
|
+
cp source, dest
|
|
191
|
+
File.chmod(0664, dest)
|
|
190
192
|
end
|
|
191
193
|
end
|
|
192
|
-
touch target.to_s
|
|
193
194
|
end
|
|
195
|
+
touch target.to_s
|
|
194
196
|
true
|
|
195
197
|
end
|
|
196
198
|
|
data/lib/buildr/core/generate.rb
CHANGED
|
@@ -20,13 +20,13 @@ require 'buildr/java/pom'
|
|
|
20
20
|
module Buildr
|
|
21
21
|
module Generate #:nodoc:
|
|
22
22
|
|
|
23
|
-
task
|
|
23
|
+
task 'generate' do
|
|
24
24
|
script = nil
|
|
25
25
|
choose do |menu|
|
|
26
26
|
menu.header = "To use Buildr you need a buildfile. Do you want me to create one?"
|
|
27
27
|
|
|
28
|
-
menu.choice("From maven2 pom file") { script = Generate.from_maven2_pom(
|
|
29
|
-
menu.choice("From directory structure") { script = Generate.from_directory(
|
|
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
30
|
menu.choice("Skip") { }
|
|
31
31
|
end
|
|
32
32
|
|
|
@@ -39,15 +39,14 @@ module Buildr
|
|
|
39
39
|
|
|
40
40
|
class << self
|
|
41
41
|
|
|
42
|
-
|
|
43
42
|
HEADER = "# Generated by Buildr #{Buildr::VERSION}, change to your liking\n\n"
|
|
44
43
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
|
51
50
|
# Version number for this release
|
|
52
51
|
VERSION_NUMBER = "1.0.0"
|
|
53
52
|
# Group identifier for your projects
|
|
@@ -63,34 +62,35 @@ define "#{name}" do
|
|
|
63
62
|
project.version = VERSION_NUMBER
|
|
64
63
|
project.group = GROUP
|
|
65
64
|
manifest["Implementation-Vendor"] = COPYRIGHT
|
|
66
|
-
EOF
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
65
|
+
EOF
|
|
66
|
+
script += header.split("\n")
|
|
67
|
+
else
|
|
68
|
+
script = [ %{define "#{name}" do} ]
|
|
69
|
+
end
|
|
70
|
+
script << " compile.with # Add classpath dependencies" if File.exist?("src/main/java")
|
|
71
|
+
script << " resources" if File.exist?("src/main/resources")
|
|
72
|
+
script << " test.compile.with # Add classpath dependencies" if File.exist?("src/test/java")
|
|
73
|
+
script << " test.resources" if File.exist?("src/test/resources")
|
|
74
|
+
if File.exist?("src/main/webapp")
|
|
75
|
+
script << " package(:war)"
|
|
76
|
+
elsif File.exist?("src/main/java")
|
|
77
|
+
script << " package(:jar)"
|
|
78
|
+
end
|
|
79
|
+
dirs = FileList["*"].exclude("src", "target", "report").
|
|
80
|
+
select { |file| File.directory?(file) && File.exist?(File.join(file, "src")) }
|
|
81
|
+
unless dirs.empty?
|
|
82
|
+
script << ""
|
|
83
|
+
dirs.sort.each do |dir|
|
|
84
|
+
script << from_directory(dir, false).flatten.map { |line| " " + line } << ""
|
|
85
|
+
end
|
|
86
86
|
end
|
|
87
|
+
script << "end"
|
|
88
|
+
script.flatten
|
|
87
89
|
end
|
|
88
|
-
script << "end"
|
|
89
|
-
script.flatten
|
|
90
90
|
end
|
|
91
91
|
|
|
92
|
-
def from_maven2_pom(root =
|
|
93
|
-
pom = Buildr::POM.load(
|
|
92
|
+
def from_maven2_pom(path = 'pom.xml', root = true)
|
|
93
|
+
pom = Buildr::POM.load(path)
|
|
94
94
|
project = pom.project
|
|
95
95
|
|
|
96
96
|
artifactId = project['artifactId'].first
|
|
@@ -124,7 +124,7 @@ EOF
|
|
|
124
124
|
legacy = repository["layout"].to_s =~ /legacy/
|
|
125
125
|
!legacy
|
|
126
126
|
} rescue nil
|
|
127
|
-
repositories = [{"name" => "Standard maven2 repository", "url" => "http://www.ibiblio.org/maven2
|
|
127
|
+
repositories = [{"name" => "Standard maven2 repository", "url" => "http://www.ibiblio.org/maven2"}] if repositories.nil? || repositories.empty?
|
|
128
128
|
repositories.each do |repository|
|
|
129
129
|
name, url = repository["name"], repository["url"]
|
|
130
130
|
script << "# #{name}"
|
|
@@ -183,7 +183,7 @@ EOF
|
|
|
183
183
|
if modules
|
|
184
184
|
script << ""
|
|
185
185
|
modules.each do |mod|
|
|
186
|
-
|
|
186
|
+
script << from_maven2_pom(File.join(File.dirname(path), mod, 'pom.xml'), false).flatten.map { |line| " " + line } << ""
|
|
187
187
|
end
|
|
188
188
|
end
|
|
189
189
|
script << "end"
|
data/lib/buildr/core/help.rb
CHANGED
|
@@ -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
|
+
notify = lambda do |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| notify['Completed', title, message] if verbose }
|
|
45
|
+
Buildr.application.on_failure { |title, message, ex| notify['Failed', title, message] if verbose }
|
|
46
|
+
end
|