Sha256: df77d4d8c88c0466b7b7764b7b7ce0773f994523e7703241d7d57e6f3fec5027
Contents?: true
Size: 1.22 KB
Versions: 2
Compression:
Stored size: 1.22 KB
Contents
require 'aws' require 'vos/drivers/s3_vfs_storage' module Vos module Drivers class S3 attr_accessor :box attr_reader :connection, :bucket def initialize options = {} options = options.clone @bucket_name = options.delete(:bucket) || raise("S3 bucket not provided!") @acl = options.delete(:acl) || :public_read @options = options end # # Establishing SSH channel # def open &block if block if connection block.call self else begin open block.call self ensure close end end else unless connection @connection = ::AWS::S3.new self.options.clone @bucket = @connection.buckets[bucket_name] end end end def close; end # # Vfs # include S3VfsStorage # # Miscellaneous # def inspect; "https://#{bucket_name}.s3.amazonaws.com" end alias_method :to_s, :inspect def _clear bucket.objects.each{|o| o.delete} end protected attr_reader :options, :bucket_name, :acl end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vos-0.4.2 | lib/vos/drivers/s3.rb |
vos-0.4.1 | lib/vos/drivers/s3.rb |