Permalink
Browse files

Move <root>/vendor/cache to a Bundler class method

  • Loading branch information...
1 parent 6bc81d0 commit 2d87c368af8db0fa6cd42d38cba3c05846ca9414 Carl Lerche committed May 5, 2010
Showing with 8 additions and 8 deletions.
  1. +5 −1 lib/bundler.rb
  2. +3 −7 lib/bundler/source.rb
View
@@ -117,7 +117,11 @@ def cache
end
def root
- default_gemfile.dirname
+ default_gemfile.dirname.expand_path
+ end
+
+ def app_cache
+ root.join("vendor/cache")
end
def settings
View
@@ -16,7 +16,7 @@ def initialize(options = {})
# @caches = (options["caches"] || [])
# Hardcode the paths for now
@installed = {}
- @caches = [ app_cache ] + Gem.path.map { |p| File.expand_path("#{p}/cache") }
+ @caches = [ Bundler.app_cache ] + Gem.path.map { |p| File.expand_path("#{p}/cache") }
@spec_fetch_map = {}
end
@@ -76,9 +76,9 @@ def cache(spec)
Bundler.ui.info " * #{File.basename(cached_path)}"
- return if File.dirname(cached_path) == app_cache
+ return if File.dirname(cached_path) == Bundler.app_cache.to_s
- FileUtils.cp(cached_path, app_cache)
+ FileUtils.cp(cached_path, Bundler.app_cache)
end
def add_remote(source)
@@ -87,10 +87,6 @@ def add_remote(source)
private
- def app_cache
- "#{Bundler.root}/vendor/cache"
- end
-
def cached_gem(spec)
possibilities = @caches.map { |p| "#{p}/#{spec.full_name}.gem" }
possibilities.find { |p| File.exist?(p) }

0 comments on commit 2d87c36

Please sign in to comment.