Method: Bundler::Source::Path#cache

Defined in:
lib/bundler/source/path.rb

#cache(spec, custom_path = nil) ⇒ Object



84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/bundler/source/path.rb', line 84

def cache(spec, custom_path = nil)
  app_cache_path = app_cache_path(custom_path)
  return unless Bundler.settings[:cache_all]
  return if expand(@original_path).to_s.index(root_path.to_s + "/") == 0

  unless @original_path.exist?
    raise GemNotFound, "Can't cache gem #{version_message(spec)} because #{self} is missing!"
  end

  FileUtils.rm_rf(app_cache_path)
  FileUtils.cp_r("#{@original_path}/.", app_cache_path)
  FileUtils.touch(app_cache_path.join(".bundlecache"))
end