Class: Fulmar::Infrastructure::Model::Transfer::Tar
- Defined in:
- lib/fulmar/infrastructure/model/transfer/tar.rb
Overview
Implements the rsync transfer
Constant Summary collapse
- DEFAULT_CONFIG =
{ tar: { format: 'gz', # 'bz2' file_base: nil, # exclude: "*.bak", # filename: "site.tar.gz" } }
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(config) ⇒ Tar
constructor
A new instance of Tar.
-
#tar_command ⇒ Object
Build the rsync command from the given options.
- #transfer ⇒ Object
Methods inherited from Base
config_hash, #prepare, #publish, #test_config
Constructor Details
#initialize(config) ⇒ Tar
Returns a new instance of Tar.
19 20 21 22 23 24 25 |
# File 'lib/fulmar/infrastructure/model/transfer/tar.rb', line 19 def initialize(config) @config = DEFAULT_CONFIG.deep_merge(config) @config[:tar][:file_base] = File.basename(@config[:local_path]) if @config[:tar][:file_base].nil? super(@config) end |
Instance Method Details
#tar_command ⇒ Object
Build the rsync command from the given options
34 35 36 |
# File 'lib/fulmar/infrastructure/model/transfer/tar.rb', line 34 def tar_command "tar #{tar_command_options} '#{filename}' '#{config[:local_path]}'" end |
#transfer ⇒ Object
27 28 29 30 31 |
# File 'lib/fulmar/infrastructure/model/transfer/tar.rb', line 27 def transfer prepare unless @prepared @local_shell.run tar_command filename end |