Sha256: 8800d5f5bac1ac544f7776e0220637ea9613c5a161727133d405ee7d990d1906

Contents?: true

Size: 1 KB

Versions: 9

Compression:

Stored size: 1 KB

Contents

require 'fog'

module RightPublish
  module S3Storage

    STORAGE_KEY = :s3_storage
    STORAGE_OPTIONS = {
      :access_id   => :attr_optional,
      :access_key  => :attr_optional,
      :region      => :attr_optional,
      :remote_path => :attr_needed,
    }

    def compute_md5(file)
      file.etag
    end

    def self.get_directories()
      Profile.log("Connecting to S3.", :debug)
      conn = Fog::Storage.new(
        :provider              => "AWS",
        :aws_access_key_id     => Profile.config[:remote_storage][:access_id],
        :aws_secret_access_key => Profile.config[:remote_storage][:access_key],
        :region                => Profile.config[:remote_storage][:region]
      )

      Profile.log("Attaching to bucket: [#{Profile.config[:remote_storage][:remote_path]}].", :debug)
      aws_bucket = conn.directories.get(Profile.config[:remote_storage][:remote_path])
      aws_bucket.extend(S3Storage)
      aws_bucket
    end
  end

  RightPublish::StorageManager.register_storage(S3Storage)
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
right_publish-0.6.0 lib/right_publish/stores/s3.rb
right_publish-0.5.2 lib/right_publish/stores/s3.rb
right_publish-0.5.1 lib/right_publish/stores/s3.rb
right_publish-0.5.0 lib/right_publish/stores/s3.rb
right_publish-0.4.2 lib/right_publish/stores/s3.rb
right_publish-0.4.0 lib/right_publish/stores/s3.rb
right_publish-0.3.0 lib/right_publish/stores/s3.rb
right_publish-0.2.1 lib/right_publish/stores/s3.rb
right_publish-0.2.0 lib/right_publish/stores/s3.rb