Class: XCCache::S3Storage

Inherits:
Storage
  • Object
show all
Defined in:
lib/xccache/storage/s3.rb

Instance Method Summary collapse

Methods included from Config::Mixin

#config

Constructor Details

#initialize(options = {}) ⇒ S3Storage



5
6
7
8
9
10
11
12
# File 'lib/xccache/storage/s3.rb', line 5

def initialize(options = {})
  super
  @uri = options[:uri]
  @creds_path = Pathname(options[:creds_path] || "~/.xccache/s3.creds.json").expand_path
  creds = JSONRepresentable.new(@creds_path)
  @access_key_id = creds["access_key_id"]
  @secret_access_key = creds["secret_access_key"]
end

Instance Method Details

#pullObject



14
15
16
# File 'lib/xccache/storage/s3.rb', line 14

def pull
  s3_sync(src: @uri, dst: config.spm_cache_dir)
end

#pushObject



18
19
20
# File 'lib/xccache/storage/s3.rb', line 18

def push
  s3_sync(src: config.spm_cache_dir, dst: @uri)
end