buildr 1.1.3 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -29,15 +29,15 @@ module Buildr
29
29
  expand_src = proc { (@files || []).map(&:to_s).uniq }
30
30
  @sources = [ expand_src ]
31
31
  @actions = [] << proc do |zip|
32
- expand_src.call.each do |file|
33
- if File.directory?(file)
34
- in_directory(file, @files) do |file, rel_path|
32
+ expand_src.call.each do |path|
33
+ if File.directory?(path)
34
+ in_directory(path, @files) do |file, rel_path|
35
35
  puts "Adding #{@path}#{rel_path}" if Rake.application.options.trace
36
36
  zip.add("#{@path}#{rel_path}", file) { true }
37
37
  end
38
38
  else
39
- puts "Adding #{@path}#{File.basename(file)}" if Rake.application.options.trace
40
- zip.add("#{@path}#{File.basename(file)}", file) { true }
39
+ puts "Adding #{@path}#{File.basename(path)}" if Rake.application.options.trace
40
+ zip.add("#{@path}#{File.basename(path)}", path) { true }
41
41
  end
42
42
  end
43
43
  end
@@ -58,6 +58,10 @@ module Buildr
58
58
  raise "You can only use the :as option in combination with the :path option" unless options.keys.size == 1
59
59
  raise "You can only use one file with the :as option" unless files.size == 1
60
60
  include_as(files.first.to_s, options[:as])
61
+ elsif options[:from]
62
+ raise "You can only use the :from option in combination with the :path option" unless options.keys.size == 1
63
+ raise "You canont use the :from option with file names" unless files.empty?
64
+ [options[:from]].flatten.each { |path| include_as(path.to_s, ".") }
61
65
  elsif options[:merge]
62
66
  raise "You can only use the :merge option in combination with the :path option" unless options.keys.size == 1
63
67
  files.each { |file| merge file }
@@ -109,6 +113,10 @@ module Buildr
109
113
  @sources.map(&:call).flatten
110
114
  end
111
115
 
116
+ def to_s()
117
+ @path || ""
118
+ end
119
+
112
120
  protected
113
121
 
114
122
  def include_as(source, as)
@@ -210,7 +218,7 @@ module Buildr
210
218
  # This method accepts three options. You can use :path to include files under
211
219
  # a specific path, for example:
212
220
  # zip(..).include("foo", :path=>"bar")
213
- # includes the file bar as foo/bar. See also #path.
221
+ # includes the file bar as bar/foo. See also #path.
214
222
  #
215
223
  # You can use :as to include a file under a different name, for example:
216
224
  # zip(..).include("foo", :as=>"bar")
@@ -295,24 +303,23 @@ module Buildr
295
303
  # package(:jar).with(:manifest=>"MANIFEST_MF")
296
304
  def with(options)
297
305
  options.each do |key, value|
298
- self[key] = value
306
+ begin
307
+ send "#{key}=", value
308
+ rescue NameError
309
+ if respond_to?(:[]=) # Backward compatible with Buildr 1.1.
310
+ warn_deprecated "The []= method is deprecated, please use attribute accessors instead."
311
+ self[key] = value
312
+ else
313
+ raise ArgumentError, "This task does not support the option #{key}."
314
+ end
315
+ end
299
316
  end
300
317
  self
301
318
  end
302
319
 
303
- # :call-seq:
304
- # [name] = value
305
- #
306
- # Used by with method to set specific options. For example:
307
- # package(:jar).with(:manifest=>"MANIFEST_MF")
308
- # Or:
309
- # package(:jar)[:manifest] = "MANIFEST_MF"
310
- def []=(key, value)
311
- raise ArgumentError, "#{self.class} does not support the option #{key}"
312
- end
313
-
314
- def prerequisites() #:nodoc:
315
- super + @paths.collect { |name, path| path.sources }.flatten.each { |src| file(src) }
320
+ def invoke_prerequisites() #:nodoc:
321
+ prerequisites.concat @paths.collect { |name, path| path.sources }.flatten
322
+ super
316
323
  end
317
324
 
318
325
  def needed?() #:nodoc:
@@ -341,6 +348,10 @@ module Buildr
341
348
  @paths.each { |name, obj| obj.actions.each { |action| action[zip] } }
342
349
  end
343
350
 
351
+ def []=(key, value) #:nodoc:
352
+ raise ArgumentError, "This task does not support the option #{key}."
353
+ end
354
+
344
355
  end
345
356
 
346
357
  # :call-seq:
@@ -396,7 +407,7 @@ module Buildr
396
407
  # If no paths specified, then no include/exclude patterns
397
408
  # specified. Nothing will happen unless we include all files.
398
409
  if @paths.empty?
399
- @paths[nil] = FromPath.new(nil)
410
+ @paths[nil] = FromPath.new(self, nil)
400
411
  @paths[nil].include "*"
401
412
  end
402
413
 
@@ -468,7 +479,17 @@ module Buildr
468
479
  # unzip(Dir.pwd=>"test.jar").include("etc/LICENSE")
469
480
  # which unzips etc/LICENSE into ./etc/LICENSE.
470
481
  def from_path(name)
471
- @paths[name] ||= FromPath.new(name)
482
+ @paths[name] ||= FromPath.new(self, name)
483
+ end
484
+ alias :path :from_path
485
+
486
+ # :call-seq:
487
+ # root() => Unzip
488
+ #
489
+ # Returns the root path, essentially the Unzip object itself. In case you are wondering
490
+ # down paths and want to go back.
491
+ def root()
492
+ self
472
493
  end
473
494
 
474
495
  # Returns the path to the target directory.
@@ -478,7 +499,8 @@ module Buildr
478
499
 
479
500
  class FromPath #:nodoc:
480
501
 
481
- def initialize(path)
502
+ def initialize(unzip, path)
503
+ @unzip = unzip
482
504
  if path
483
505
  @path = path[-1] == ?/ ? path : path + "/"
484
506
  else
@@ -513,6 +535,16 @@ module Buildr
513
535
  end
514
536
  end
515
537
 
538
+ # Documented in Unzip.
539
+ def root()
540
+ @unzip
541
+ end
542
+
543
+ # The target directory to extract to.
544
+ def target()
545
+ @unzip.target
546
+ end
547
+
516
548
  end
517
549
 
518
550
  end
@@ -544,3 +576,20 @@ module Buildr
544
576
  end
545
577
 
546
578
  end
579
+
580
+
581
+ module Zip #:nodoc:
582
+ class ZipEntrySet #:nodoc:
583
+
584
+ # Make sure entries are returned in sorted order so the ZIP
585
+ # index is human readable instead of random hashtable order.
586
+ def entries()
587
+ @entrySet.values.sort
588
+ end
589
+
590
+ def each(&block)
591
+ entries.each(&block)
592
+ end
593
+
594
+ end
595
+ end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: buildr
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.1.3
7
- date: 2007-06-12 00:00:00 -07:00
6
+ version: 1.2.0
7
+ date: 2007-07-06 00:00:00 -07:00
8
8
  summary: A build system that doesn't suck
9
9
  require_paths:
10
10
  - lib
@@ -33,8 +33,11 @@ files:
33
33
  - lib/tasks/concat.rb
34
34
  - lib/tasks/zip.rb
35
35
  - lib/core
36
+ - lib/core/generate.rb
36
37
  - lib/core/transports.rb
37
38
  - lib/core/build.rb
39
+ - lib/core/checks.rb
40
+ - lib/core/help.rb
38
41
  - lib/core/project.rb
39
42
  - lib/core/rake_ext.rb
40
43
  - lib/core/common.rb
@@ -59,11 +62,13 @@ files:
59
62
  - lib/java/java.rb
60
63
  - lib/java/ant.rb
61
64
  - lib/java/artifact.rb
65
+ - lib/java/idea.ipr.template
62
66
  - lib/java/packaging.rb
63
67
  - lib/java/compile.rb
64
68
  - CHANGELOG
65
69
  - README
66
70
  - LICENSE
71
+ - Rakefile
67
72
  test_files: []
68
73
 
69
74
  rdoc_options:
@@ -77,8 +82,8 @@ extra_rdoc_files:
77
82
  - README
78
83
  - CHANGELOG
79
84
  - LICENSE
80
- executables: []
81
-
85
+ executables:
86
+ - buildr
82
87
  extensions: []
83
88
 
84
89
  requirements: []
@@ -89,7 +94,7 @@ dependencies:
89
94
  version_requirement:
90
95
  version_requirements: !ruby/object:Gem::Version::Requirement
91
96
  requirements:
92
- - - ">="
97
+ - - "="
93
98
  - !ruby/object:Gem::Version
94
99
  version: 0.7.3
95
100
  version:
@@ -109,7 +114,7 @@ dependencies:
109
114
  requirements:
110
115
  - - "="
111
116
  - !ruby/object:Gem::Version
112
- version: 2.1.1
117
+ version: 2.1.2
113
118
  version:
114
119
  - !ruby/object:Gem::Dependency
115
120
  name: net-ssh
@@ -118,7 +123,7 @@ dependencies:
118
123
  requirements:
119
124
  - - "="
120
125
  - !ruby/object:Gem::Version
121
- version: 1.1.1
126
+ version: 1.1.2
122
127
  version:
123
128
  - !ruby/object:Gem::Dependency
124
129
  name: net-sftp
@@ -145,7 +150,7 @@ dependencies:
145
150
  requirements:
146
151
  - - "="
147
152
  - !ruby/object:Gem::Version
148
- version: 1.2.7
153
+ version: 1.2.9
149
154
  version:
150
155
  - !ruby/object:Gem::Dependency
151
156
  name: rjb
@@ -154,7 +159,7 @@ dependencies:
154
159
  requirements:
155
160
  - - "="
156
161
  - !ruby/object:Gem::Version
157
- version: 1.0.4
162
+ version: 1.0.6
158
163
  version:
159
164
  - !ruby/object:Gem::Dependency
160
165
  name: Antwrap
@@ -163,5 +168,14 @@ dependencies:
163
168
  requirements:
164
169
  - - "="
165
170
  - !ruby/object:Gem::Version
166
- version: 0.5.2
171
+ version: 0.6.0
172
+ version:
173
+ - !ruby/object:Gem::Dependency
174
+ name: rspec
175
+ version_requirement:
176
+ version_requirements: !ruby/object:Gem::Version::Requirement
177
+ requirements:
178
+ - - "="
179
+ - !ruby/object:Gem::Version
180
+ version: 1.0.5
167
181
  version: