Module: RightPublish::S3Storage

Defined in:
lib/right_publish/stores/s3.rb

Constant Summary collapse

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.get_directoriesObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/right_publish/stores/s3.rb', line 18

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

Instance Method Details

#compute_md5(file) ⇒ Object



14
15
16
# File 'lib/right_publish/stores/s3.rb', line 14

def compute_md5(file)
  file.etag
end