Class: Naifa::Plugins::S3::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/naifa/plugins/s3/cli.rb

Class Attribute Summary collapse

Instance Method Summary collapse

Class Attribute Details

.settings_keyObject (readonly)

Returns the value of attribute settings_key.



9
10
11
# File 'lib/naifa/plugins/s3/cli.rb', line 9

def settings_key
  @settings_key
end

Instance Method Details

#sync(from = nil, to = nil) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/naifa/plugins/s3/cli.rb', line 13

def sync(from=nil, to=nil)
  config = Naifa::Config.settings[settings_key] || {}

  options = {sync: {}}
  options[:sync][:origin] = from unless from.nil?
  options[:sync][:destination] = to unless to.nil?

  S3.sync(config.fetch(:settings,{}).deep_merge(options))
end