Class: BundleDepot::FileSystemStore

Inherits:
Store
  • Object
show all
Defined in:
lib/bundle_depot/cache.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Store

#with_packing

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

#pathObject (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

Returns:

  • (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