Sha256: 6eb201eff35fb02f78e925b47b77471da89bd36400baf292d2f32ed1f17d933f
Contents?: true
Size: 760 Bytes
Versions: 3
Compression:
Stored size: 760 Bytes
Contents
require 'fog' module Hillary class Slug class Bucket attr_reader :name def initialize(name = ENV['SLUG_BUCKET'], access_key = ENV['AWS_S3_KEY_ID'], secret_key = ENV['AWS_S3_KEY_SECRET']) @name = name @storage = Fog::Storage.new( provider: 'AWS', aws_access_key_id: access_key, aws_secret_access_key: secret_key ) @directory = @storage.directories.get(name) end def write(name, file) @directory.files.create( key: name, body: File.open(file), public: false ) end def copy(source, target) source_file = @directory.files.get(source) source_file.copy(@name, target) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hillary-0.0.3 | lib/hillary/slug/bucket.rb |
hillary-0.0.2 | lib/hillary/slug/bucket.rb |
hillary-0.0.1 | lib/hillary/slug/bucket.rb |