Class: XcodeArchiveCache::ArtifactCache::LocalStorage
- Inherits:
-
AbstractStorage
- Object
- AbstractStorage
- XcodeArchiveCache::ArtifactCache::LocalStorage
- Defined in:
- lib/artifact_cache/local_storage.rb
Instance Method Summary collapse
-
#cached_artifact_path(node) ⇒ String
Cached artifact path, nil if no artifact found in cache dir.
-
#initialize(cache_dir_path) ⇒ LocalStorage
constructor
A new instance of LocalStorage.
- #store(node, path) ⇒ Object
Constructor Details
#initialize(cache_dir_path) ⇒ LocalStorage
Returns a new instance of LocalStorage.
7 8 9 10 |
# File 'lib/artifact_cache/local_storage.rb', line 7 def initialize(cache_dir_path) @cache_dir_path = cache_dir_path @archiver = Archiver.new end |
Instance Method Details
#cached_artifact_path(node) ⇒ String
Returns cached artifact path, nil if no artifact found in cache dir.
16 17 18 19 |
# File 'lib/artifact_cache/local_storage.rb', line 16 def cached_artifact_path(node) path = path_inside_cache_dir(node) File.exist?(path) ? path : nil end |
#store(node, path) ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/artifact_cache/local_storage.rb', line 24 def store(node, path) archive_path = path_inside_cache_dir(node) archive_directory = File.("..", archive_path) unless File.exist?(archive_directory) FileUtils.mkdir_p(archive_directory) end archiver.archive(path, archive_path) save_state(node, archive_path) end |