module EDB::Storage::S3

Public Class Methods

upload(source) click to toggle source
# 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