class CarthageCache::HTTPRepository

Attributes

base_url[R]

Public Class Methods

new(bucket_name, client_options = {}) click to toggle source
# File lib/carthage_cache/repository.rb, line 38
def initialize(bucket_name, client_options = {})
  region = client_options[:region]
  bucket_name = bucket_name
  @base_url = "https://s3-#{region}.amazonaws.com/#{bucket_name}"
end

Public Instance Methods

archive_exist?(archive_filename) click to toggle source
# File lib/carthage_cache/repository.rb, line 44
def archive_exist?(archive_filename)
  system "wget", "--method=HEAD", "#{base_url}/#{archive_filename}", "-q"
end
download(archive_filename, destination_path) click to toggle source
# File lib/carthage_cache/repository.rb, line 48
def download(archive_filename, destination_path)
  system "wget", "--output-document=#{destination_path}", "#{base_url}/#{archive_filename}", "-q"
end
upload(archive_filename, archive_path) click to toggle source
# File lib/carthage_cache/repository.rb, line 52
def upload(archive_filename, archive_path)
  raise "carthage_cache is working in read-only mode. Please configure AWS credentials first"
end