Sha256: 826fa0d593a29adfeb1b1b39abd119179e7b45ae93966163c085fb7de46b6dfc

Contents?: true

Size: 747 Bytes

Versions: 17

Compression:

Stored size: 747 Bytes

Contents

module EbDeployer
  module AWSDriver
    class S3Driver
      def create_bucket(bucket_name)
        s3.create_bucket(:bucket => bucket_name)
      end

      def bucket_exists?(bucket_name)
        s3.bucket(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)
        o.upload_file(file)
      end

      private
      def s3
        Aws::S3::Resource.new(client: Aws::S3::Client.new)
      end

      def obj(bucket_name, obj_name)
        s3.bucket(bucket_name).object(obj_name)
      end

      def buckets
        s3.buckets
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 3 rubygems

Version Path
man_eb_deployer-0.8.0 lib/eb_deployer/aws_driver/s3_driver.rb
eb_deployer_updated-0.8.1 lib/eb_deployer/aws_driver/s3_driver.rb
eb_deployer_updated-0.8.0 lib/eb_deployer/aws_driver/s3_driver.rb
eb_deployer-0.7.0 lib/eb_deployer/aws_driver/s3_driver.rb
eb_deployer-0.6.6 lib/eb_deployer/aws_driver/s3_driver.rb
eb_deployer-0.6.5 lib/eb_deployer/aws_driver/s3_driver.rb
eb_deployer-0.6.4 lib/eb_deployer/aws_driver/s3_driver.rb
eb_deployer-0.6.3 lib/eb_deployer/aws_driver/s3_driver.rb
eb_deployer-0.6.2 lib/eb_deployer/aws_driver/s3_driver.rb
eb_deployer-0.6.1 lib/eb_deployer/aws_driver/s3_driver.rb
eb_deployer-0.6.0 lib/eb_deployer/aws_driver/s3_driver.rb
eb_deployer-0.6.0.beta6 lib/eb_deployer/aws_driver/s3_driver.rb
eb_deployer-0.6.0.beta5 lib/eb_deployer/aws_driver/s3_driver.rb
eb_deployer-0.6.0.beta4 lib/eb_deployer/aws_driver/s3_driver.rb
eb_deployer-0.6.0.beta3 lib/eb_deployer/aws_driver/s3_driver.rb
eb_deployer-0.6.0.beta2 lib/eb_deployer/aws_driver/s3_driver.rb
eb_deployer-0.6.0.beta1 lib/eb_deployer/aws_driver/s3_driver.rb