Sha256: 7d6cb29167609f0eadbaeafaf760c082ea7ae02c38ec18517c03fa9f3c1073a1

Contents?: true

Size: 707 Bytes

Versions: 10

Compression:

Stored size: 707 Bytes

Contents

module EbDeployer
  module AWSDriver
    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
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
eb_deployer-0.4.4.beta3 lib/eb_deployer/aws_driver/s3_driver.rb
eb_deployer-0.4.4.beta2 lib/eb_deployer/aws_driver/s3_driver.rb
eb_deployer-0.4.4.beta1 lib/eb_deployer/aws_driver/s3_driver.rb
eb_deployer-0.4.3 lib/eb_deployer/aws_driver/s3_driver.rb
eb_deployer-0.4.2 lib/eb_deployer/aws_driver/s3_driver.rb
eb_deployer-0.4.1 lib/eb_deployer/aws_driver/s3_driver.rb
eb_deployer-0.4.0 lib/eb_deployer/aws_driver/s3_driver.rb
eb_deployer-0.3.9 lib/eb_deployer/aws_driver/s3_driver.rb
eb_deployer-0.3.8 lib/eb_deployer/aws_driver/s3_driver.rb
eb_deployer-0.3.7 lib/eb_deployer/aws_driver/s3_driver.rb