Sha256: 6dd702207bb2b657cea8a41ce20de65c59512ae3db37219feb27408f63b254bc

Contents?: true

Size: 632 Bytes

Versions: 31

Compression:

Stored size: 632 Bytes

Contents

module EbDeployer
  class S3Driver
    def create_bucket(bucket_name)
      buckets.create(bucket_name)
    end

    def bucket_exists?(bucket_name)
      buckets[bucket_name].exists?
    end

    def object_length(bucket_name, obj_name)
      obj(bucket_name, obj_name).content_length rescue nil
    end

    def upload_file(bucket_name, obj_name, file)
      o = obj(bucket_name, obj_name)
      File.open(file) { |f| o.write(f) }
    end

    private
    def s3
      AWS::S3.new
    end

    def obj(bucket_name, obj_name)
      buckets[bucket_name].objects[obj_name]
    end

    def buckets
      s3.buckets
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
eb_deployer-0.0.11 lib/eb_deployer/s3_driver.rb
eb_deployer-0.0.10 lib/eb_deployer/s3_driver.rb
eb_deployer-0.0.9 lib/eb_deployer/s3_driver.rb
eb_deployer-0.0.8 lib/eb_deployer/s3_driver.rb
eb_deployer-0.0.7 lib/eb_deployer/s3_driver.rb
eb_deployer-0.0.6 lib/eb_deployer/s3_driver.rb
eb_deployer-0.0.5 lib/eb_deployer/s3_driver.rb
eb_deployer-0.0.4 lib/eb_deployer/s3_driver.rb
eb_deployer-0.0.3 lib/eb_deployer/s3_driver.rb
eb_deployer-0.0.2 lib/eb_deployer/s3_driver.rb
eb_deployer-0.0.1 lib/eb_deployer/s3_driver.rb