module Bundler::Plugin::API::Source

def cache(spec, custom_path = nil)

by bundler.
at sub paths of `cache_path` (from API). This can be though as caching
This cache is different from the internal caching that can be done

specs and install only from this cache when `cached!` is called.
This is stored with the app and source plugins should try to provide

alternative to remote)
be reinstalled from the cache without querying the remote (i.e. an
source can resolve to path provided by `app_cache_app`so that they can
This method is called while caching to save copy of the gems that the
def cache(spec, custom_path = nil)
  new_cache_path = app_cache_path(custom_path)
  FileUtils.rm_rf(new_cache_path)
  FileUtils.cp_r(install_path, new_cache_path)
  FileUtils.touch(app_cache_path.join(".bundlecache"))
end