Class: Unzip
Instance Attribute Summary collapse
-
#destination ⇒ Object
Returns the value of attribute destination.
-
#file ⇒ Object
Returns the value of attribute file.
Attributes included from Logging
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize ⇒ Unzip
constructor
A new instance of Unzip.
Methods included from Albacore::Task
clean_dirname, create_rake_task, include_config, included
Methods included from UpdateAttributes
Methods included from YAMLConfig
#configure, #load_config_by_task_name
Methods included from Logging
#create_logger, #log_device=, #log_level, #log_level=
Methods included from Failure
Constructor Details
#initialize ⇒ Unzip
Returns a new instance of Unzip.
11 12 13 14 |
# File 'lib/albacore/unzip.rb', line 11 def initialize super() update_attributes Albacore.configuration.unzip.to_hash end |
Instance Attribute Details
#destination ⇒ Object
Returns the value of attribute destination.
9 10 11 |
# File 'lib/albacore/unzip.rb', line 9 def destination @destination end |
#file ⇒ Object
Returns the value of attribute file.
9 10 11 |
# File 'lib/albacore/unzip.rb', line 9 def file @file end |
Instance Method Details
#execute ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/albacore/unzip.rb', line 16 def execute() 'Zip File cannot be empty' if @file.nil? return if @file.nil? Zip::ZipFile.open(@file) do |zip_f| zip_f.each do |f| out_path = File.join(@destination, f.name) FileUtils.mkdir_p(File.dirname(out_path)) zip_f.extract(f, out_path) unless File.exist?(out_path) end end end |