Class: WinRM::FS::Core::ShellZipFactory
- Inherits:
-
Object
- Object
- WinRM::FS::Core::ShellZipFactory
- Defined in:
- lib/winrm-fs/core/temp_zip_file.rb
Overview
Creates a zip file by shelling out to the zip command
Instance Attribute Summary collapse
-
#basedir ⇒ Object
readonly
Returns the value of attribute basedir.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#paths ⇒ Object
readonly
Returns the value of attribute paths.
-
#zip_definition ⇒ Object
readonly
Returns the value of attribute zip_definition.
-
#zip_file ⇒ Object
readonly
Returns the value of attribute zip_file.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(zip_definition) ⇒ ShellZipFactory
constructor
A new instance of ShellZipFactory.
Constructor Details
#initialize(zip_definition) ⇒ ShellZipFactory
Returns a new instance of ShellZipFactory.
80 81 82 83 84 85 86 |
# File 'lib/winrm-fs/core/temp_zip_file.rb', line 80 def initialize(zip_definition) @zip_definition = zip_definition @zip_file = zip_definition.zip_file @basedir = zip_definition.basedir @paths = zip_definition.paths @options = .push('--names-stdin').join(' ') end |
Instance Attribute Details
#basedir ⇒ Object (readonly)
Returns the value of attribute basedir.
78 79 80 |
# File 'lib/winrm-fs/core/temp_zip_file.rb', line 78 def basedir @basedir end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
78 79 80 |
# File 'lib/winrm-fs/core/temp_zip_file.rb', line 78 def @options end |
#paths ⇒ Object (readonly)
Returns the value of attribute paths.
78 79 80 |
# File 'lib/winrm-fs/core/temp_zip_file.rb', line 78 def paths @paths end |
#zip_definition ⇒ Object (readonly)
Returns the value of attribute zip_definition.
78 79 80 |
# File 'lib/winrm-fs/core/temp_zip_file.rb', line 78 def zip_definition @zip_definition end |
#zip_file ⇒ Object (readonly)
Returns the value of attribute zip_file.
78 79 80 |
# File 'lib/winrm-fs/core/temp_zip_file.rb', line 78 def zip_file @zip_file end |
Instance Method Details
#build ⇒ Object
88 89 90 91 92 93 94 95 96 |
# File 'lib/winrm-fs/core/temp_zip_file.rb', line 88 def build Dir.chdir(basedir) do # zip doesn't like the file that already exists output = `zip #{zip_definition.path}.tmp #{} < #{write_file_list.path}` fail "zip command failed: #{output}" unless $CHILD_STATUS.success? FileUtils.mv("#{zip_definition.path}.tmp", "#{zip_definition.path}") end end |