Module: BCL
- Defined in:
- lib/bcl/version.rb,
lib/bcl/base_xml.rb,
lib/bcl/tar_ball.rb,
lib/bcl/component.rb,
lib/bcl/component_methods.rb,
lib/bcl/component_from_spreadsheet.rb
Overview
******************************************************************************* OpenStudio®, Copyright © Alliance for Sustainable Energy, LLC. See also openstudio.net/license *******************************************************************************
Defined Under Namespace
Classes: AttrStruct, BaseXml, Component, ComponentFromSpreadsheet, ComponentMethods, ComponentStruct, CostStruct, FileStruct, HeaderStruct, ObjectStruct, ProvStruct, TagsStruct, WorksheetStruct
Constant Summary collapse
- VERSION =
'0.8.0'.freeze
Class Method Summary collapse
- .extract_tarball(filename, destination) ⇒ Object
- .extract_zip(filename, destination, delete_zip = false) ⇒ Object
Class Method Details
.extract_tarball(filename, destination) ⇒ Object
9 10 11 12 13 |
# File 'lib/bcl/tar_ball.rb', line 9 def extract_tarball(filename, destination) Zlib::GzipReader.open(filename) do |gz| Archive::Tar::Minitar.unpack(gz, destination) end end |
.extract_zip(filename, destination, delete_zip = false) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/bcl/tar_ball.rb', line 15 def extract_zip(filename, destination, delete_zip = false) Zip::File.open(filename) do |zip_file| zip_file.each do |f| f_path = File.join(destination, f.name) FileUtils.mkdir_p(File.dirname(f_path)) zip_file.extract(f, f_path) unless File.exist? f_path end end if delete_zip file_list = [] file_list << filename FileUtils.rm(file_list) end end |