summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Werbin <spam@me.gregwerbin.com>2017-09-11 11:18:50 -0400
committerGreg Werbin <spam@me.gregwerbin.com>2017-09-11 11:18:50 -0400
commit71f13f90eaa447dd565ee6ea5d18864060d80033 (patch)
tree705a1a2d40ca015a08e126155b48ab75d2d9e14e
parentd378a816866ce28f7fa010a4dd9095f4b2439bee (diff)
downloadbundler-71f13f90eaa447dd565ee6ea5d18864060d80033.tar.gz
Remove unnecessary method
-rw-r--r--lib/bundler.rb21
1 files changed, 9 insertions, 12 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb
index 31602dfa65..8a7296d8e7 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -193,15 +193,10 @@ module Bundler
raise e.exception("#{warning}\nBundler also failed to create a temporary home directory at `#{path}':\n#{e}")
end
- def user_bundle_path_default
- Pathname.new(user_home).join(".bundle")
- end
-
def user_bundle_path(dir="home")
- # if "home", user_bundle_path_default
env_var, fallback = case dir
when "home"
- ["BUNDLE_USER_HOME", user_bundle_path_default]
+ ["BUNDLE_USER_HOME", Pathname.new(user_home).join(".bundle")]
when "cache"
["BUNDLE_USER_CACHE", user_bundle_path.join("cache")]
when "config"
@@ -209,9 +204,15 @@ module Bundler
when "plugin"
["BUNDLE_USER_PLUGIN", user_bundle_path.join("plugin")]
else
- nil
+ raise BundlerError, "Unknown user path requested: #{dir}"
end
- ENV.fetch(env_var, fallback)
+ # `fallback` will already be a Pathname, but Pathname.new() is
+ # idempotent so it's OK
+ Pathname.new(ENV.fetch(env_var, fallback))
+ end
+
+ def user_cache
+ user_bundle_path("cache")
end
def home
@@ -226,10 +227,6 @@ module Bundler
bundle_path.join("specifications")
end
- def user_cache
- user_bundle_path("cache")
- end
-
def root
@root ||= begin
SharedHelpers.root