Class: Gembrew::ArchiveStore
- Inherits:
-
Object
- Object
- Gembrew::ArchiveStore
- Defined in:
- lib/gembrew/archive_store.rb
Instance Attribute Summary collapse
-
#cache_path ⇒ Object
readonly
Returns the value of attribute cache_path.
Instance Method Summary collapse
- #fetch(name, version, download_path, index: nil, total: nil) ⇒ Object
-
#initialize(cache_path:, reporter: Reporter.new, command_runner: nil) ⇒ ArchiveStore
constructor
A new instance of ArchiveStore.
Constructor Details
#initialize(cache_path:, reporter: Reporter.new, command_runner: nil) ⇒ ArchiveStore
Returns a new instance of ArchiveStore.
12 13 14 15 16 17 |
# File 'lib/gembrew/archive_store.rb', line 12 def initialize(cache_path:, reporter: Reporter.new, command_runner: nil) @cache_path = Pathname(cache_path) @reporter = reporter @command_runner = command_runner || method(:run_command) @cache_path.mkpath end |
Instance Attribute Details
#cache_path ⇒ Object (readonly)
Returns the value of attribute cache_path.
10 11 12 |
# File 'lib/gembrew/archive_store.rb', line 10 def cache_path @cache_path end |
Instance Method Details
#fetch(name, version, download_path, index: nil, total: nil) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/gembrew/archive_store.rb', line 19 def fetch(name, version, download_path, index: nil, total: nil) if (path = locally_cached(name, version)) report :rubygems_cache, name, version, index: index, total: total return path end if version && (path = gembrew_cached(name, version)) report :gembrew_cache, name, version, index: index, total: total return path end download name, version, Pathname(download_path), index: index, total: total end |