Skip to content

Commit

Permalink
Merge Bundler 2.1.0.pre.1 as developed version from upstream.
Browse files Browse the repository at this point in the history
  rubygems/bundler@a537095

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
hsbt committed Apr 14, 2019
1 parent d636809 commit 68ddd4d
Show file tree
Hide file tree
Showing 290 changed files with 5,780 additions and 6,121 deletions.
75 changes: 65 additions & 10 deletions lib/bundler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
require "bundler/vendored_fileutils"
require "pathname"
require "rbconfig"
require "thread"

require "bundler/errors"
require "bundler/environment_preserver"
Expand Down Expand Up @@ -119,7 +118,7 @@ def load
end

def environment
SharedHelpers.major_deprecation 3, "Bundler.environment has been removed in favor of Bundler.load"
SharedHelpers.major_deprecation 2, "Bundler.environment has been removed in favor of Bundler.load"
load
end

Expand Down Expand Up @@ -280,10 +279,19 @@ def original_env
ORIGINAL_ENV.clone
end

# @deprecated Use `original_env` instead
# @return [Hash] Environment with all bundler-related variables removed
# @deprecated Use `unbundled_env` instead
def clean_env
Bundler::SharedHelpers.major_deprecation(3, "`Bundler.clean_env` has weird edge cases, use `.original_env` instead")
Bundler::SharedHelpers.major_deprecation(
2,
"`Bundler.clean_env` has been deprecated in favor of `Bundler.unbundled_env`. " \
"If you instead want the environment before bundler was originally loaded, use `Bundler.original_env`"
)

unbundled_env
end

# @return [Hash] Environment with all bundler-related variables removed
def unbundled_env
env = original_env

if env.key?("BUNDLER_ORIG_MANPATH")
Expand All @@ -305,20 +313,67 @@ def clean_env
env
end

# Run block with environment present before Bundler was activated
def with_original_env
with_env(original_env) { yield }
end

# @deprecated Use `with_unbundled_env` instead
def with_clean_env
with_env(clean_env) { yield }
Bundler::SharedHelpers.major_deprecation(
2,
"`Bundler.with_clean_env` has been deprecated in favor of `Bundler.with_unbundled_env`. " \
"If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env`"
)

with_env(unbundled_env) { yield }
end

# Run block with all bundler-related variables removed
def with_unbundled_env
with_env(unbundled_env) { yield }
end

# Run subcommand with the environment present before Bundler was activated
def original_system(*args)
with_original_env { Kernel.system(*args) }
end

# @deprecated Use `unbundled_system` instead
def clean_system(*args)
with_clean_env { Kernel.system(*args) }
Bundler::SharedHelpers.major_deprecation(
2,
"`Bundler.clean_system` has been deprecated in favor of `Bundler.unbundled_system`. " \
"If you instead want to run the command in the environment before bundler was originally loaded, use `Bundler.original_system`"
)

with_env(unbundled_env) { Kernel.system(*args) }
end

# Run subcommand in an environment with all bundler related variables removed
def unbundled_system(*args)
with_unbundled_env { Kernel.system(*args) }
end

# Run a `Kernel.exec` to a subcommand with the environment present before Bundler was activated
def original_exec(*args)
with_original_env { Kernel.exec(*args) }
end

# @deprecated Use `unbundled_exec` instead
def clean_exec(*args)
with_clean_env { Kernel.exec(*args) }
Bundler::SharedHelpers.major_deprecation(
2,
"`Bundler.clean_exec` has been deprecated in favor of `Bundler.unbundled_exec`. " \
"If you instead want to exec to a command in the environment before bundler was originally loaded, use `Bundler.original_exec`"
)

with_env(unbundled_env) { Kernel.exec(*args) }
end

# Run a `Kernel.exec` to a subcommand in an environment with all bundler related variables removed
def unbundled_exec(*args)
with_env(unbundled_env) { Kernel.exec(*args) }
end

def local_platform
Expand All @@ -343,7 +398,7 @@ def system_bindir
# system binaries. If you put '-n foo' in your .gemrc, RubyGems will
# install binstubs there instead. Unfortunately, RubyGems doesn't expose
# that directory at all, so rather than parse .gemrc ourselves, we allow
# the directory to be set as well, via `bundle config bindir foo`.
# the directory to be set as well, via `bundle config set bindir foo`.
Bundler.settings[:system_bindir] || Bundler.rubygems.gem_bindir
end

Expand Down Expand Up @@ -523,7 +578,7 @@ def eval_gemspec(path, contents)
rescue ScriptError, StandardError => e
msg = "There was an error while loading `#{path.basename}`: #{e.message}"

if e.is_a?(LoadError) && RUBY_VERSION >= "1.9"
if e.is_a?(LoadError)
msg += "\nDoes it try to require a relative path? That's been removed in Ruby 1.9"
end

Expand Down
15 changes: 6 additions & 9 deletions lib/bundler/bundler.gemspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# coding: utf-8
# frozen_string_literal: true

begin
Expand All @@ -19,16 +18,16 @@ Gem::Specification.new do |s|
"Yehuda Katz"
]
s.email = ["[email protected]"]
s.homepage = "http://bundler.io"
s.homepage = "https://bundler.io"
s.summary = "The best way to manage your application's dependencies"
s.description = "Bundler manages an application's dependencies through its entire life, across many machines, systematically and repeatably"

if s.respond_to?(:metadata=)
s.metadata = {
"bug_tracker_uri" => "http://github.com/bundler/bundler/issues",
"bug_tracker_uri" => "https://github.com/bundler/bundler/issues",
"changelog_uri" => "https://github.com/bundler/bundler/blob/master/CHANGELOG.md",
"homepage_uri" => "https://bundler.io/",
"source_code_uri" => "http://github.com/bundler/bundler/",
"source_code_uri" => "https://github.com/bundler/bundler/",
}
end

Expand All @@ -41,14 +40,12 @@ Gem::Specification.new do |s|
end

s.add_development_dependency "automatiek", "~> 0.1.0"
s.add_development_dependency "mustache", "0.99.6"
s.add_development_dependency "rake", "~> 10.0"
s.add_development_dependency "rdiscount", "~> 2.2"
s.add_development_dependency "rake", "~> 12.0"
s.add_development_dependency "ronn", "~> 0.7.3"
s.add_development_dependency "rspec", "~> 3.6"
s.add_development_dependency "rubocop", "= 0.65.0"

# base_dir = File.dirname(__FILE__).gsub(%r{([^A-Za-z0-9_\-.,:\/@\n])}, "\\\\\\1")
# s.files = IO.popen("git -C #{base_dir} ls-files -z", &:read).split("\x0").select {|f| f.match(%r{^(lib|exe)/}) }
# s.files = Dir.glob("{lib,exe}/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) }

# we don't check in man pages, but we need to ship them because
# we use them to generate the long-form help for each command.
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/capistrano.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

require "bundler/shared_helpers"
Bundler::SharedHelpers.major_deprecation 3,
Bundler::SharedHelpers.major_deprecation 2,
"The Bundler task for Capistrano. Please use http://github.com/capistrano/bundler"

# Capistrano task for Bundler.
Expand Down
Loading

0 comments on commit 68ddd4d

Please sign in to comment.