class Awss3sync::Awss3sync
Public Instance Methods
aws?()
click to toggle source
# File lib/awss3sync.rb, line 9 def aws? raise 'Requires AWS CLI Installation' if %x{which aws}.empty? end
list()
click to toggle source
# File lib/awss3sync.rb, line 28 def list aws? say list_contents end
list_contents()
click to toggle source
# File lib/awss3sync.rb, line 13 def list_contents %x{aws s3 ls #{options[:from]}/}.split("\n").map{|str| string_to_array(str).last} end
string_to_array(str)
click to toggle source
# File lib/awss3sync.rb, line 17 def string_to_array(str) str.split("\s") end
sync()
click to toggle source
# File lib/awss3sync.rb, line 45 def sync aws? list_contents.reject{|directory| directory == 'backups/'}.each do |dir| say "Syncing: #{dir} From: #{options[:from]} To: #{options[:to]}" %x{aws s3 sync #{options[:protocol]}#{options[:from]}/#{dir} #{options[:protocol]}#{options[:to]}/#{dir}} end end