Class: RSpecTracer::RemoteCache::Cache
- Inherits:
-
Object
- Object
- RSpecTracer::RemoteCache::Cache
- Defined in:
- lib/rspec_tracer/remote_cache/cache.rb
Defined Under Namespace
Classes: CacheError
Instance Method Summary collapse
- #download ⇒ Object
-
#initialize ⇒ Cache
constructor
A new instance of Cache.
- #upload ⇒ Object
Constructor Details
#initialize ⇒ Cache
Returns a new instance of Cache.
12 13 14 15 |
# File 'lib/rspec_tracer/remote_cache/cache.rb', line 12 def initialize @aws = RSpecTracer::RemoteCache::Aws.new @repo = RSpecTracer::RemoteCache::Repo.new(@aws) end |
Instance Method Details
#download ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/rspec_tracer/remote_cache/cache.rb', line 17 def download return unless cache_ref? @aws.download_file(@cache_sha, 'last_run.json') @aws.download_dir(@cache_sha, last_run_id) rescue StandardError => e puts "Error: #{e.}" puts e.backtrace.first(5).join("\n") end |
#upload ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/rspec_tracer/remote_cache/cache.rb', line 27 def upload @aws.upload_file(@repo.branch_ref, 'last_run.json') @aws.upload_dir(@repo.branch_ref, last_run_id) file_name = File.join(RSpecTracer.cache_path, 'branch_refs.json') write_branch_refs(file_name) @aws.upload_branch_refs(@repo.branch_name, file_name) rescue StandardError => e puts "Error: #{e.}" puts e.backtrace.first(5).join("\n") end |