Method: Bundler::Source::Rubygems#cache

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

#cache(spec, custom_path = nil) ⇒ Object

[View source]

229
230
231
232
233
234
235
236
237
238
# File 'lib/bundler/source/rubygems.rb', line 229

def cache(spec, custom_path = nil)
  cached_path = Bundler.settings[:cache_all_platforms] ? fetch_gem_if_possible(spec) : cached_gem(spec)
  raise GemNotFound, "Missing gem file '#{spec.file_name}'." unless cached_path
  return if File.dirname(cached_path) == Bundler.app_cache.to_s
  Bundler.ui.info "  * #{File.basename(cached_path)}"
  FileUtils.cp(cached_path, Bundler.app_cache(custom_path))
rescue Errno::EACCES => e
  Bundler.ui.debug(e)
  raise InstallError, e.message
end