Class: LiquidBackup::Handler::S3

Inherits:
Object
  • Object
show all
Defined in:
lib/liquid_backup/handler/s3.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ S3

Returns a new instance of S3.



6
7
8
# File 'lib/liquid_backup/handler/s3.rb', line 6

def initialize(options={})
  AWS::S3::Base.establish_connection!(:access_key_id => options[:access_key_id], :secret_access_key => options[:secret_access_key])
end

Instance Method Details

#cleanupObject



21
22
23
# File 'lib/liquid_backup/handler/s3.rb', line 21

def cleanup
  # Nothing here yet
end

#store(location, files = []) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/liquid_backup/handler/s3.rb', line 10

def store(location, files = [])
  return false unless files.any?
  
  AWS::S3::Bucket.create(location) 
  
  files.each do |file|
    AWS::S3::S3Object.store("#{File.mtime(file).strftime("%Y%m%d%H%M%S")}_#{File.split(file)[-1]}", File.open(file), location)
  end
  self
end