Class: BundleDepot::FileSystemStore
- Defined in:
- lib/bundle_depot/cache.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #cached?(file) ⇒ Boolean
- #fetch(file, dest_dir) ⇒ Object
-
#initialize(path) ⇒ FileSystemStore
constructor
A new instance of FileSystemStore.
- #store(file) ⇒ Object
Methods inherited from Store
Constructor Details
#initialize(path) ⇒ FileSystemStore
Returns a new instance of FileSystemStore.
75 76 77 78 |
# File 'lib/bundle_depot/cache.rb', line 75 def initialize(path) @path = path FileUtils.mkdir_p(path) end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
69 70 71 |
# File 'lib/bundle_depot/cache.rb', line 69 def path @path end |
Instance Method Details
#cached?(file) ⇒ Boolean
71 72 73 |
# File 'lib/bundle_depot/cache.rb', line 71 def cached?(file) File.exists? File.join(path, file) end |
#fetch(file, dest_dir) ⇒ Object
84 85 86 |
# File 'lib/bundle_depot/cache.rb', line 84 def fetch(file, dest_dir) FileUtils.cp_r File.join(path, file), dest_dir end |
#store(file) ⇒ Object
80 81 82 |
# File 'lib/bundle_depot/cache.rb', line 80 def store(file) FileUtils.cp_r file, File.join(path, File.basename(file)) end |