Module: EDB::Storage::S3

Defined in:
lib/edb/storage/s3.rb

Class Method Summary collapse

Class Method Details

.upload(source) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/edb/storage/s3.rb', line 31

def upload(source)
  ::EDB::Logger.log(:info, "Uploading #{source} to S3...")

  aws = ::EDB.opts[:STORAGE][:S3]
  AWS.config(aws)

  target = File.join(aws[:bucket][:subfolder], source)
  source = File.join('./', source)

  bucket = AWS::S3.new.buckets[aws[:bucket][:name]]
  bucket.objects.create(target, Pathname.new(source))
end