buildr 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +8 -0
- data/lib/buildr.rb +1 -1
- data/lib/core/checks.rb +1 -1
- data/lib/core/common.rb +60 -12
- data/lib/core/project.rb +2 -6
- data/lib/core/transports.rb +3 -3
- data/lib/tasks/zip.rb +7 -10
- metadata +3 -3
data/CHANGELOG
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
1.2.2 (7/18/2007)
|
2
|
+
* Added: resources.using and filter.using now accepts a format as the first argument, default being :maven, but you can also use :ant, :ruby or pass a regular expression (http://groups.google.com/group/buildr-talk/browse_thread/thread/5216d5ae8bfff29b).
|
3
|
+
* Fixed: Sleek upload with changelog for each release courtesy of Anatol Pomozov.
|
4
|
+
* Fixed: Zip.path.contains fails on paths with more than one directory (http://groups.google.com/group/buildr-talk/browse_thread/thread/5d305bbeeb814d1).
|
5
|
+
* Fixed: Speed of sorting entries when creating new Zip file (http://groups.google.com/group/buildr-talk/browse_thread/thread/8b4d1b0e983f32f).
|
6
|
+
* Fixed: Uploading using SFTP creates directory for uploaded file (http://groups.google.com/group/buildr-talk/browse_thread/thread/80021d35cecfecdc).
|
7
|
+
|
1
8
|
1.2.1 (7/12/2007)
|
2
9
|
* Added: Proxy exclusion, use environment variable NO_PROXY, or options.proxy.exclude = <url> || [<url>] (http://groups.google.com/group/buildr-talk/t/9f1e988e0dbeea9f).
|
3
10
|
* Added: You can now copy resources from multiple source directories, using resources.from (http://groups.google.com/group/buildr-talk/browse_thread/thread/4f2867a6dbbc19d4).
|
@@ -9,6 +16,7 @@
|
|
9
16
|
* Fixed: buildr command does not recognize project tasks (foo:compile) or default task (http://groups.google.com/group/buildr-talk/t/660061a0bc81989a).
|
10
17
|
* Fixed: Upload fails on SFTP permissions.
|
11
18
|
* Fixed: Hibernate.schema_export not passing Ant task when yielding.
|
19
|
+
* Fixed: IntelliJ Idea project files generation for projects more than two degrees deep.
|
12
20
|
|
13
21
|
1.2.0 (6/6/2007)
|
14
22
|
* Added: Artifact.list returns specs for all registered artifacts (those created with artifact or package).
|
data/lib/buildr.rb
CHANGED
data/lib/core/checks.rb
CHANGED
@@ -317,7 +317,7 @@ module Buildr
|
|
317
317
|
unless @cached_entries
|
318
318
|
if @path
|
319
319
|
base = Regexp.new("^" + Regexp.escape(@path || ""))
|
320
|
-
@cached_entries = root.path(
|
320
|
+
@cached_entries = root.path(nil).check.select { |entry| entry.name =~ base }.map { |entry| entry.name.sub(base, "") }
|
321
321
|
else
|
322
322
|
@cached_entries = Zip::ZipFile.open(root.name) { |zip| zip.entries }
|
323
323
|
end
|
data/lib/core/common.rb
CHANGED
@@ -250,7 +250,7 @@ module Buildr
|
|
250
250
|
# Since temporary file exists, force a download.
|
251
251
|
class << task ; def needed?() ; true ; end ; end
|
252
252
|
task.sources << args
|
253
|
-
task.enhance { args.download temp
|
253
|
+
task.enhance { args.download temp }
|
254
254
|
end
|
255
255
|
else
|
256
256
|
# Download to a file created by the task.
|
@@ -258,7 +258,7 @@ module Buildr
|
|
258
258
|
uri = URI.parse(args.values.first.to_s)
|
259
259
|
file_create(args.keys.first).tap do |task|
|
260
260
|
task.sources << uri
|
261
|
-
task.enhance { uri.download task.name
|
261
|
+
task.enhance { uri.download task.name }
|
262
262
|
end
|
263
263
|
end
|
264
264
|
|
@@ -362,21 +362,46 @@ module Buildr
|
|
362
362
|
# The mapping. See #using.
|
363
363
|
attr_accessor :mapping
|
364
364
|
|
365
|
+
# The mapper to use. See #using.
|
366
|
+
attr_accessor :mapper
|
367
|
+
|
365
368
|
# :call-seq:
|
366
369
|
# using(mapping) => self
|
367
370
|
# using() { |file_name, contents| ... } => self
|
368
371
|
#
|
369
372
|
# Specifies the mapping to use and returns self.
|
370
373
|
#
|
371
|
-
# The mapping
|
372
|
-
#
|
373
|
-
#
|
374
|
+
# The most typical mapping uses a Hash, and the default mapping uses the Maven style, so
|
375
|
+
# <code>${key}</code> are mapped to the values. You can change that by passing a different
|
376
|
+
# format as the first argument. Currently supports:
|
377
|
+
# * :ant -- Map <code>@key@</code>.
|
378
|
+
# * :maven -- Map <code>${key}</code> (default).
|
379
|
+
# * :ruby -- Map <code>#{key}</code>.
|
380
|
+
# * Regexp -- Maps the matched data (e.g. <code>/=(.*?)=/</code>
|
374
381
|
#
|
375
382
|
# For example:
|
376
383
|
# filter.using "version"=>"1.2"
|
377
|
-
#
|
378
|
-
|
379
|
-
|
384
|
+
# Is the same as:
|
385
|
+
# filter.using :maven, "version"=>"1.2"
|
386
|
+
#
|
387
|
+
# You can also pass a proc or method. It will be called with the file name and content,
|
388
|
+
# to return the mapped content.
|
389
|
+
#
|
390
|
+
# Without any mapping, all files are copied as is.
|
391
|
+
def using(*args, &block)
|
392
|
+
case args.first
|
393
|
+
when Hash # Maven hash mapping
|
394
|
+
using :maven, *args
|
395
|
+
when Symbol # Mapping from a method
|
396
|
+
raise ArgumentError, "Expected mapper type followed by mapping hash" unless args.size == 2 && Hash === args[1]
|
397
|
+
@mapper, @mapping = *args
|
398
|
+
when Regexp # Mapping using a regular expression
|
399
|
+
raise ArgumentError, "Expected regular expression followed by mapping hash" unless args.size == 2 && Hash === args[1]
|
400
|
+
@mapper, @mapping = *args
|
401
|
+
else
|
402
|
+
raise ArgumentError, "Expected proc, method or a block" if args.size > 1 || (args.first && block)
|
403
|
+
@mapping = args.first || block
|
404
|
+
end
|
380
405
|
self
|
381
406
|
end
|
382
407
|
|
@@ -414,8 +439,13 @@ module Buildr
|
|
414
439
|
mapped = mapping.call(path, File.open(source, "rb") { |file| file.read })
|
415
440
|
File.open(dest, "wb") { |file| file.write mapped }
|
416
441
|
when Hash # Map ${key} to value
|
417
|
-
|
418
|
-
|
442
|
+
content = File.open(source, "rb") { |file| file.read }
|
443
|
+
if Symbol === @mapper
|
444
|
+
mapped = send("#{@mapper}_mapper", content) { |key| mapping[key] }
|
445
|
+
else
|
446
|
+
mapped = regexp_mapper(content) { |key| mapping[key] }
|
447
|
+
end
|
448
|
+
#gsub(/\$\{[^}]*\}/) { |str| mapping[str[2..-2]] || str }
|
419
449
|
File.open(dest, "wb") { |file| file.write mapped }
|
420
450
|
when nil # No mapping.
|
421
451
|
cp source, dest
|
@@ -431,8 +461,26 @@ module Buildr
|
|
431
461
|
# Returns the target directory.
|
432
462
|
def to_s()
|
433
463
|
@target.to_s
|
434
|
-
end
|
435
|
-
|
464
|
+
end
|
465
|
+
|
466
|
+
private
|
467
|
+
|
468
|
+
def maven_mapper(content)
|
469
|
+
content.gsub(/\$\{.*?\}/) { |str| yield(str[2..-2]) || str }
|
470
|
+
end
|
471
|
+
|
472
|
+
def ant_mapper(content)
|
473
|
+
content.gsub(/@.*?@/) { |str| yield(str[1..-2]) || str }
|
474
|
+
end
|
475
|
+
|
476
|
+
def ruby_mapper(content)
|
477
|
+
content.gsub(/#\{.*?\}/) { |str| yield(str[2..-2]) || str }
|
478
|
+
end
|
479
|
+
|
480
|
+
def regexp_mapper(content)
|
481
|
+
content.gsub(@mapper) { |str| yield(str.scan(@mapper).join) || str }
|
482
|
+
end
|
483
|
+
|
436
484
|
end
|
437
485
|
|
438
486
|
# :call-seq:
|
data/lib/core/project.rb
CHANGED
@@ -304,10 +304,6 @@ module Buildr
|
|
304
304
|
@parent = task(split[0...-1].join(":"))
|
305
305
|
raise "No parent project #{split[0...-1].join(":")}" unless @parent && Project === parent
|
306
306
|
end
|
307
|
-
# We only need this because each task (and a project is a task) already has
|
308
|
-
# a @base_dir variable (and base_dir method), and we want it lazily evaluated.
|
309
|
-
# See all the logic that happens when we call base_dir.
|
310
|
-
@base_dir = nil
|
311
307
|
end
|
312
308
|
|
313
309
|
# :call-seq:
|
@@ -325,10 +321,10 @@ module Buildr
|
|
325
321
|
# /home/foo/bar <-- sub-project "foo:bar"
|
326
322
|
def base_dir()
|
327
323
|
if @base_dir.nil?
|
328
|
-
if
|
324
|
+
if parent
|
329
325
|
# For sub-project, a good default is a directory in the parent's base_dir,
|
330
326
|
# using the same name as the project.
|
331
|
-
@base_dir = File.join(
|
327
|
+
@base_dir = File.join(parent.base_dir, name.split(":").last)
|
332
328
|
else
|
333
329
|
# For top-level project, a good default is the directory where we found the Buildfile.
|
334
330
|
@base_dir = Dir.pwd
|
data/lib/core/transports.rb
CHANGED
@@ -206,8 +206,8 @@ module URI
|
|
206
206
|
raise NotFoundError, "No source file/directory to upload." unless File.exist?(source)
|
207
207
|
if File.directory?(source)
|
208
208
|
Dir.glob("#{source}/**/*").reject { |file| File.directory?(file) }.each do |file|
|
209
|
-
|
210
|
-
|
209
|
+
uri = self + (File.join(self.path, file.sub(source, "")))
|
210
|
+
uri.upload file, {:digests=>[]}.merge(options)
|
211
211
|
end
|
212
212
|
else
|
213
213
|
File.open(source, "rb") { |input| upload input, options }
|
@@ -397,7 +397,7 @@ module URI
|
|
397
397
|
# To create a path, we need to create all its parent. We use realpath to determine if
|
398
398
|
# the path already exists, otherwise mkdir fails.
|
399
399
|
puts "Creating path #{@base_path}" if Rake.application.options.trace
|
400
|
-
path.split("/").inject("") do |base, part|
|
400
|
+
File.dirname(path).split("/").inject("") do |base, part|
|
401
401
|
combined = base + part
|
402
402
|
sftp.realpath combined rescue sftp.mkdir combined, {}
|
403
403
|
"#{combined}/"
|
data/lib/tasks/zip.rb
CHANGED
@@ -579,17 +579,14 @@ end
|
|
579
579
|
|
580
580
|
|
581
581
|
module Zip #:nodoc:
|
582
|
-
class ZipEntrySet #:nodoc:
|
583
582
|
|
584
|
-
|
585
|
-
#
|
586
|
-
def
|
587
|
-
|
583
|
+
class ZipCentralDirectory #:nodoc:
|
584
|
+
# Patch to add entries in alphabetical order.
|
585
|
+
def write_to_stream(io)
|
586
|
+
offset = io.tell
|
587
|
+
@entrySet.sort { |a,b| a.name <=> b.name }.each { |entry| entry.write_c_dir_entry(io) }
|
588
|
+
write_e_o_c_d(io, offset)
|
588
589
|
end
|
589
|
-
|
590
|
-
def each(&block)
|
591
|
-
entries.each(&block)
|
592
|
-
end
|
593
|
-
|
594
590
|
end
|
591
|
+
|
595
592
|
end
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.
|
2
|
+
rubygems_version: 0.9.4
|
3
3
|
specification_version: 1
|
4
4
|
name: buildr
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.2.
|
7
|
-
date: 2007-07-
|
6
|
+
version: 1.2.2
|
7
|
+
date: 2007-07-18 00:00:00 -07:00
|
8
8
|
summary: A build system that doesn't suck
|
9
9
|
require_paths:
|
10
10
|
- lib
|