Module: Buildr::ZipTask::IncludeFiles
- Included in:
- Buildr::ZipTask, Path
- Defined in:
- lib/tasks/zip.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#exclude(*files) ⇒ Object
Exclude the specified file or directories.
-
#include(*files) ⇒ Object
(also: #add)
Include the specified files or directories.
- #merge(*files) ⇒ Object
Instance Method Details
#exclude(*files) ⇒ Object
Exclude the specified file or directories.
42 43 44 45 |
# File 'lib/tasks/zip.rb', line 42 def exclude(*files) (@files ||= FileList[]).exclude *files self end |
#include(*files) ⇒ Object Also known as: add
Include the specified files or directories.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/tasks/zip.rb', line 16 def include(*files) if Hash === files.last = files.pop else = {} end files = files.flatten if [:path] path([:path]).include *files +[ .reject { |k,v| k == :path } ] elsif [:as] raise "You can only use the :as option in combination with the :path option" unless .keys.size == 1 raise "You can only use one file with the :as option" unless files.size == 1 include_as(files.first.to_s, [:as]) elsif [:merge] raise "You can only use the :merge option in combination with the :path option" unless .keys.size == 1 files.each { |file| merge file } elsif .keys.empty? (@files ||= FileList[]).include files.map(&:to_s) else raise "Unrecognized option #{.keys.join(", ")}" end self end |
#merge(*files) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/tasks/zip.rb', line 48 def merge(*files) if Hash === files.last = files.pop else = {} end if [:path] path([:path]).merge *files +[ .reject { |k,v| k == :path } ] elsif .keys.empty? files.collect do |file| @expand_sources << proc { file.to_s } = ZipExpander.new(file) @add_files << proc { |zip| .(zip, @path) } end.first else raise "Unrecognized option #{.keys.join(", ")}" end end |