module Omnibus::SoftwareS3URLs

Public Instance Methods

config() click to toggle source
# File lib/omnibus/s3_cacher.rb, line 30
def config
  Omnibus.config
end
url_for(software) click to toggle source
# File lib/omnibus/s3_cacher.rb, line 34
def url_for(software)
  "http://#{config.s3_bucket}.s3.amazonaws.com/#{key_for_package(software)}"
end

Private Instance Methods

key_for_package(package) click to toggle source
# File lib/omnibus/s3_cacher.rb, line 40
def key_for_package(package)
  package.name     or raise InsufficientSpecification, "Software must have a name to cache it in S3 (#{package.inspect})"
  package.version  or raise InsufficientSpecification, "Software must set a version to cache it in S3 (#{package.inspect})"
  package.checksum or raise InsufficientSpecification, "Software must specify a checksum (md5) to cache it in S3 (#{package.inspect})"
  "#{package.name}-#{package.version}-#{package.checksum}"
end