lib/bundler.rb in bundler-2.1.4 vs lib/bundler.rb in bundler-2.2.0.rc.1
- old
+ new
@@ -32,13 +32,13 @@
#
# As a standard library inside project, Bundler could be used for introspection
# of loaded and required modules.
#
module Bundler
- environment_preserver = EnvironmentPreserver.new(ENV, EnvironmentPreserver::BUNDLER_KEYS)
+ environment_preserver = EnvironmentPreserver.from_env
ORIGINAL_ENV = environment_preserver.restore
- ENV.replace(environment_preserver.backup)
+ environment_preserver.replace_with_backup
SUDO_MUTEX = Mutex.new
autoload :Definition, File.expand_path("bundler/definition", __dir__)
autoload :Dependency, File.expand_path("bundler/dependency", __dir__)
autoload :DepProxy, File.expand_path("bundler/dep_proxy", __dir__)
@@ -283,11 +283,17 @@
end
end
def app_config_path
if app_config = ENV["BUNDLE_APP_CONFIG"]
- Pathname.new(app_config).expand_path(root)
+ app_config_pathname = Pathname.new(app_config)
+
+ if app_config_pathname.absolute?
+ app_config_pathname
+ else
+ app_config_pathname.expand_path(root)
+ end
else
root.join(".bundle")
end
end
@@ -449,10 +455,14 @@
# that directory at all, so rather than parse .gemrc ourselves, we allow
# the directory to be set as well, via `bundle config set bindir foo`.
Bundler.settings[:system_bindir] || Bundler.rubygems.gem_bindir
end
+ def preferred_gemfile_name
+ Bundler.settings[:init_gems_rb] ? "gems.rb" : "Gemfile"
+ end
+
def use_system_gems?
configured_bundle_path.use_system_gems?
end
def requires_sudo?
@@ -510,10 +520,11 @@
SUDO_MUTEX.synchronize do
prompt = "\n\n" + <<-PROMPT.gsub(/^ {6}/, "").strip + " "
Your user account isn't allowed to install to the system RubyGems.
You can cancel this installation and run:
- bundle install --path vendor/bundle
+ bundle config set --local path 'vendor/bundle'
+ bundle install
to install the gems into ./vendor/bundle/, or you can enter your password
and install the bundled gems to RubyGems using sudo.
Password: