Downgrade Bundler 1.17.x from 2.0.0.

We have the platform issue on heroku:
    * https://gist.github.com/schneems/26452540f6e2bbbcf2ea144f45f6b305
    * https://github.com/heroku/heroku-buildpack-ruby/issues/833

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
hsbt 2018-12-11 03:07:37 +00:00
parent 448e86d796
commit 91533d9ab1
78 changed files with 460 additions and 478 deletions

View File

@ -119,7 +119,7 @@ module Bundler
end end
def environment 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 load
end end
@ -283,7 +283,7 @@ EOF
# @deprecated Use `original_env` instead # @deprecated Use `original_env` instead
# @return [Hash] Environment with all bundler-related variables removed # @return [Hash] Environment with all bundler-related variables removed
def clean_env 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 weird edge cases, use `.original_env` instead")
env = original_env env = original_env
if env.key?("BUNDLER_ORIG_MANPATH") if env.key?("BUNDLER_ORIG_MANPATH")

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
require "bundler/shared_helpers" 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" "The Bundler task for Capistrano. Please use http://github.com/capistrano/bundler"
# Capistrano task for Bundler. # Capistrano task for Bundler.

View File

@ -229,7 +229,7 @@ module Bundler
"Include gems that are part of the specified named group." "Include gems that are part of the specified named group."
map "i" => "install" map "i" => "install"
def install def install
SharedHelpers.major_deprecation(3, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force") SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force")
require "bundler/cli/install" require "bundler/cli/install"
Bundler.settings.temporary(:no_install => false) do Bundler.settings.temporary(:no_install => false) do
Install.new(options.dup).run Install.new(options.dup).run
@ -275,7 +275,7 @@ module Bundler
method_option "all", :type => :boolean, :banner => method_option "all", :type => :boolean, :banner =>
"Update everything." "Update everything."
def update(*gems) def update(*gems)
SharedHelpers.major_deprecation(3, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force") SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force")
require "bundler/cli/update" require "bundler/cli/update"
Update.new(options, gems).run Update.new(options, gems).run
end end
@ -303,7 +303,7 @@ module Bundler
old_argv = ARGV.join(" ") old_argv = ARGV.join(" ")
new_argv = [new_command, *new_arguments.compact].join(" ") new_argv = [new_command, *new_arguments.compact].join(" ")
Bundler::SharedHelpers.major_deprecation(3, "use `bundle #{new_argv}` instead of `bundle #{old_argv}`") Bundler::SharedHelpers.major_deprecation(2, "use `bundle #{new_argv}` instead of `bundle #{old_argv}`")
end end
require "bundler/cli/show" require "bundler/cli/show"
Show.new(options, gem_name).run Show.new(options, gem_name).run
@ -537,7 +537,7 @@ module Bundler
method_option :version, :type => :boolean, :default => false, :aliases => "-v", :desc => "Set to show each gem version." method_option :version, :type => :boolean, :default => false, :aliases => "-v", :desc => "Set to show each gem version."
method_option :without, :type => :array, :default => [], :aliases => "-W", :banner => "GROUP[ GROUP...]", :desc => "Exclude gems that are part of the specified named group." method_option :without, :type => :array, :default => [], :aliases => "-W", :banner => "GROUP[ GROUP...]", :desc => "Exclude gems that are part of the specified named group."
def viz def viz
SharedHelpers.major_deprecation 3, "The `viz` command has been moved to the `bundle-viz` gem, see https://github.com/bundler/bundler-viz" SharedHelpers.major_deprecation 2, "The `viz` command has been moved to the `bundle-viz` gem, see https://github.com/bundler/bundler-viz"
require "bundler/cli/viz" require "bundler/cli/viz"
Viz.new(options.dup).run Viz.new(options.dup).run
end end
@ -608,7 +608,7 @@ module Bundler
method_option "group", :type => :string, :banner => method_option "group", :type => :string, :banner =>
"Install gem into a bundler group" "Install gem into a bundler group"
def inject(name, version) def inject(name, version)
SharedHelpers.major_deprecation 3, "The `inject` command has been replaced by the `add` command" SharedHelpers.major_deprecation 2, "The `inject` command has been replaced by the `add` command"
require "bundler/cli/inject" require "bundler/cli/inject"
Inject.new(options.dup, name, version).run Inject.new(options.dup, name, version).run
end end

View File

@ -9,7 +9,7 @@ module Bundler
end end
def run def run
Bundler::SharedHelpers.major_deprecation 3, "bundle console will be replaced " \ Bundler::SharedHelpers.major_deprecation 2, "bundle console will be replaced " \
"by `bin/console` generated by `bundle gem <name>`" "by `bin/console` generated by `bundle gem <name>`"
group ? Bundler.require(:default, *(group.split.map!(&:to_sym))) : Bundler.require group ? Bundler.require(:default, *(group.split.map!(&:to_sym))) : Bundler.require

View File

@ -53,7 +53,7 @@ module Bundler
Bundler::Fetcher.disable_endpoint = options["full-index"] Bundler::Fetcher.disable_endpoint = options["full-index"]
if options["binstubs"] if options["binstubs"]
Bundler::SharedHelpers.major_deprecation 3, Bundler::SharedHelpers.major_deprecation 2,
"The --binstubs option will be removed in favor of `bundle binstubs`" "The --binstubs option will be removed in favor of `bundle binstubs`"
end end

View File

@ -22,7 +22,7 @@ module Bundler
if Bundler.feature_flag.update_requires_all_flag? if Bundler.feature_flag.update_requires_all_flag?
raise InvalidOption, "To update everything, pass the `--all` flag." raise InvalidOption, "To update everything, pass the `--all` flag."
end end
SharedHelpers.major_deprecation 3, "Pass --all to `bundle update` to update everything" SharedHelpers.major_deprecation 2, "Pass --all to `bundle update` to update everything"
elsif !full_update && options[:all] elsif !full_update && options[:all]
raise InvalidOption, "Cannot specify --all along with specific options." raise InvalidOption, "Cannot specify --all along with specific options."
end end

View File

@ -331,7 +331,7 @@ module Bundler
# i.e., Windows with `git config core.autocrlf=true` # i.e., Windows with `git config core.autocrlf=true`
contents.gsub!(/\n/, "\r\n") if @lockfile_contents.match("\r\n") contents.gsub!(/\n/, "\r\n") if @lockfile_contents.match("\r\n")
if @locked_bundler_version && Bundler.feature_flag.lockfile_upgrade_warning? if @locked_bundler_version
locked_major = @locked_bundler_version.segments.first locked_major = @locked_bundler_version.segments.first
current_major = Gem::Version.create(Bundler::VERSION).segments.first current_major = Gem::Version.create(Bundler::VERSION).segments.first

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
require "bundler/shared_helpers" require "bundler/shared_helpers"
Bundler::SharedHelpers.major_deprecation 3, "Bundler no longer integrates with " \ Bundler::SharedHelpers.major_deprecation 2, "Bundler no longer integrates with " \
"Capistrano, but Capistrano provides its own integration with " \ "Capistrano, but Capistrano provides its own integration with " \
"Bundler via the capistrano-bundler gem. Use it instead." "Bundler via the capistrano-bundler gem. Use it instead."

View File

@ -194,7 +194,7 @@ module Bundler
" end\n\n" " end\n\n"
raise DeprecatedError, msg if Bundler.feature_flag.disable_multisource? raise DeprecatedError, msg if Bundler.feature_flag.disable_multisource?
SharedHelpers.major_deprecation(3, msg.strip) SharedHelpers.major_deprecation(2, msg.strip)
end end
source_options = normalize_hash(options).merge( source_options = normalize_hash(options).merge(
@ -306,7 +306,7 @@ module Bundler
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
# TODO: 2.0 upgrade this setting to the default # TODO: 2.0 upgrade this setting to the default
if Bundler.settings["github.https"] if Bundler.settings["github.https"]
Bundler::SharedHelpers.major_deprecation 3, "The `github.https` setting will be removed" Bundler::SharedHelpers.major_deprecation 2, "The `github.https` setting will be removed"
"https://github.com/#{repo_name}.git" "https://github.com/#{repo_name}.git"
else else
"git://github.com/#{repo_name}.git" "git://github.com/#{repo_name}.git"
@ -456,7 +456,7 @@ repo_name ||= user_name
def normalize_source(source) def normalize_source(source)
case source case source
when :gemcutter, :rubygems, :rubyforge when :gemcutter, :rubygems, :rubyforge
Bundler::SharedHelpers.major_deprecation 3, "The source :#{source} is deprecated because HTTP " \ Bundler::SharedHelpers.major_deprecation 2, "The source :#{source} is deprecated because HTTP " \
"requests are insecure.\nPlease change your source to 'https://" \ "requests are insecure.\nPlease change your source to 'https://" \
"rubygems.org' if possible, or 'http://rubygems.org' if not." "rubygems.org' if possible, or 'http://rubygems.org' if not."
"http://rubygems.org" "http://rubygems.org"
@ -474,13 +474,13 @@ repo_name ||= user_name
msg = "This Gemfile contains multiple primary sources. " \ msg = "This Gemfile contains multiple primary sources. " \
"Each source after the first must include a block to indicate which gems " \ "Each source after the first must include a block to indicate which gems " \
"should come from that source" "should come from that source"
unless Bundler.feature_flag.bundler_3_mode? unless Bundler.feature_flag.bundler_2_mode?
msg += ". To downgrade this error to a warning, run " \ msg += ". To downgrade this error to a warning, run " \
"`bundle config --delete disable_multisource`" "`bundle config --delete disable_multisource`"
end end
raise GemfileEvalError, msg raise GemfileEvalError, msg
else else
Bundler::SharedHelpers.major_deprecation 3, "Your Gemfile contains multiple primary sources. " \ Bundler::SharedHelpers.major_deprecation 2, "Your Gemfile contains multiple primary sources. " \
"Using `source` more than once without a block is a security risk, and " \ "Using `source` more than once without a block is a security risk, and " \
"may result in installing unexpected gems. To resolve this warning, use " \ "may result in installing unexpected gems. To resolve this warning, use " \
"a block to indicate which gems should come from the secondary source. " \ "a block to indicate which gems should come from the secondary source. " \
@ -498,8 +498,8 @@ repo_name ||= user_name
"do |repo_name|\n#{replacement.to_s.gsub(/^/, " ")}\n end" "do |repo_name|\n#{replacement.to_s.gsub(/^/, " ")}\n end"
end end
Bundler::SharedHelpers.major_deprecation 3, <<-EOS Bundler::SharedHelpers.major_deprecation 2, <<-EOS
The :#{name} git source is deprecated, and will be removed in Bundler 3.0.#{additional_message} Add this code to the top of your Gemfile to ensure it continues to work: The :#{name} git source is deprecated, and will be removed in Bundler 2.0.#{additional_message} Add this code to the top of your Gemfile to ensure it continues to work:
git_source(:#{name}) #{replacement} git_source(:#{name}) #{replacement}

View File

@ -27,41 +27,38 @@ module Bundler
(1..10).each {|v| define_method("bundler_#{v}_mode?") { major_version >= v } } (1..10).each {|v| define_method("bundler_#{v}_mode?") { major_version >= v } }
settings_flag(:allow_bundler_dependency_conflicts) { bundler_3_mode? } settings_flag(:allow_bundler_dependency_conflicts) { bundler_2_mode? }
settings_flag(:allow_offline_install) { bundler_3_mode? } settings_flag(:allow_offline_install) { bundler_2_mode? }
settings_flag(:auto_clean_without_path) { bundler_3_mode? } settings_flag(:auto_clean_without_path) { bundler_2_mode? }
settings_flag(:auto_config_jobs) { bundler_3_mode? } settings_flag(:auto_config_jobs) { bundler_2_mode? }
settings_flag(:cache_all) { bundler_3_mode? } settings_flag(:cache_all) { bundler_2_mode? }
settings_flag(:cache_command_is_package) { bundler_3_mode? } settings_flag(:cache_command_is_package) { bundler_2_mode? }
settings_flag(:console_command) { !bundler_3_mode? } settings_flag(:console_command) { !bundler_2_mode? }
settings_flag(:default_install_uses_path) { bundler_3_mode? } settings_flag(:default_install_uses_path) { bundler_2_mode? }
settings_flag(:deployment_means_frozen) { bundler_3_mode? } settings_flag(:deployment_means_frozen) { bundler_2_mode? }
settings_flag(:disable_multisource) { bundler_3_mode? } settings_flag(:disable_multisource) { bundler_2_mode? }
settings_flag(:error_on_stderr) { bundler_2_mode? } settings_flag(:error_on_stderr) { bundler_2_mode? }
settings_flag(:forget_cli_options) { bundler_3_mode? } settings_flag(:forget_cli_options) { bundler_2_mode? }
settings_flag(:global_path_appends_ruby_scope) { bundler_3_mode? } settings_flag(:global_path_appends_ruby_scope) { bundler_2_mode? }
settings_flag(:global_gem_cache) { bundler_3_mode? } settings_flag(:global_gem_cache) { bundler_2_mode? }
settings_flag(:init_gems_rb) { bundler_3_mode? } settings_flag(:init_gems_rb) { bundler_2_mode? }
settings_flag(:list_command) { bundler_3_mode? } settings_flag(:list_command) { bundler_2_mode? }
settings_flag(:lockfile_uses_separate_rubygems_sources) { bundler_3_mode? } settings_flag(:lockfile_uses_separate_rubygems_sources) { bundler_2_mode? }
settings_flag(:lockfile_upgrade_warning) { bundler_3_mode? } settings_flag(:only_update_to_newer_versions) { bundler_2_mode? }
settings_flag(:only_update_to_newer_versions) { bundler_3_mode? } settings_flag(:path_relative_to_cwd) { bundler_2_mode? }
settings_flag(:path_relative_to_cwd) { bundler_3_mode? }
settings_flag(:plugins) { @bundler_version >= Gem::Version.new("1.14") } settings_flag(:plugins) { @bundler_version >= Gem::Version.new("1.14") }
settings_flag(:prefer_gems_rb) { bundler_3_mode? } settings_flag(:prefer_gems_rb) { bundler_2_mode? }
settings_flag(:print_only_version_number) { bundler_3_mode? } settings_flag(:print_only_version_number) { bundler_2_mode? }
settings_flag(:setup_makes_kernel_gem_public) { !bundler_3_mode? } settings_flag(:setup_makes_kernel_gem_public) { !bundler_2_mode? }
settings_flag(:skip_default_git_sources) { bundler_3_mode? } settings_flag(:skip_default_git_sources) { bundler_2_mode? }
settings_flag(:specific_platform) { bundler_3_mode? } settings_flag(:specific_platform) { bundler_2_mode? }
settings_flag(:suppress_install_using_messages) { bundler_3_mode? } settings_flag(:suppress_install_using_messages) { bundler_2_mode? }
settings_flag(:unlock_source_unlocks_spec) { !bundler_3_mode? } settings_flag(:unlock_source_unlocks_spec) { !bundler_2_mode? }
settings_flag(:update_requires_all_flag) { bundler_3_mode? } settings_flag(:update_requires_all_flag) { bundler_2_mode? }
settings_flag(:use_gem_version_promoter_for_major_updates) { bundler_3_mode? } settings_flag(:use_gem_version_promoter_for_major_updates) { bundler_2_mode? }
settings_flag(:viz_command) { !bundler_3_mode? } settings_flag(:viz_command) { !bundler_2_mode? }
settings_option(:default_cli_command) { bundler_3_mode? ? :cli_help : :install } settings_option(:default_cli_command) { bundler_2_mode? ? :cli_help : :install }
settings_method(:github_https?, "github.https") { bundler_2_mode? }
def initialize(bundler_version) def initialize(bundler_version)
@bundler_version = Gem::Version.create(bundler_version) @bundler_version = Gem::Version.create(bundler_version)

View File

@ -465,7 +465,7 @@ module Bundler
raise Gem::Exception, "no default executable for #{spec.full_name}" unless exec_name ||= spec.default_executable raise Gem::Exception, "no default executable for #{spec.full_name}" unless exec_name ||= spec.default_executable
unless spec.name == gem_name unless spec.name == gem_name
Bundler::SharedHelpers.major_deprecation 3, Bundler::SharedHelpers.major_deprecation 2,
"Bundler is using a binstub that was created for a different gem (#{spec.name}).\n" \ "Bundler is using a binstub that was created for a different gem (#{spec.name}).\n" \
"You should run `bundle binstub #{gem_name}` " \ "You should run `bundle binstub #{gem_name}` " \
"to work around a system/bundle conflict." "to work around a system/bundle conflict."

View File

@ -40,7 +40,6 @@ module Bundler
ignore_messages ignore_messages
init_gems_rb init_gems_rb
list_command list_command
lockfile_upgrade_warning
lockfile_uses_separate_rubygems_sources lockfile_uses_separate_rubygems_sources
major_deprecations major_deprecations
no_install no_install
@ -113,7 +112,7 @@ module Bundler
"bundle config #{key} #{Array(value).join(":")}" "bundle config #{key} #{Array(value).join(":")}"
end end
Bundler::SharedHelpers.major_deprecation 3,\ Bundler::SharedHelpers.major_deprecation 2,\
"flags passed to commands " \ "flags passed to commands " \
"will no longer be automatically remembered. Instead please set flags " \ "will no longer be automatically remembered. Instead please set flags " \
"you want remembered between commands using `bundle config " \ "you want remembered between commands using `bundle config " \

View File

@ -1,7 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
return unless defined?(Gem)
require "bundler/shared_helpers" require "bundler/shared_helpers"
if Bundler::SharedHelpers.in_bundle? if Bundler::SharedHelpers.in_bundle?

View File

@ -157,8 +157,8 @@ module Bundler
next if gemfiles.empty? next if gemfiles.empty?
break false if gemfiles.size == 1 break false if gemfiles.size == 1
end end
if multiple_gemfiles && Bundler.bundler_major_version == 2 if multiple_gemfiles && Bundler.bundler_major_version == 1
Bundler::SharedHelpers.major_deprecation 3, \ Bundler::SharedHelpers.major_deprecation 2, \
"gems.rb and gems.locked will be preferred to Gemfile and Gemfile.lock." "gems.rb and gems.locked will be preferred to Gemfile and Gemfile.lock."
end end

View File

@ -1,4 +1,6 @@
source "https://rubygems.org" source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
# Specify your gem's dependencies in <%= config[:name] %>.gemspec # Specify your gem's dependencies in <%= config[:name] %>.gemspec
gemspec gemspec

View File

@ -7,7 +7,7 @@ module Bundler
# We're doing this because we might write tests that deal # We're doing this because we might write tests that deal
# with other versions of bundler and we are unsure how to # with other versions of bundler and we are unsure how to
# handle this better. # handle this better.
VERSION = "2.0.0" unless defined?(::Bundler::VERSION) VERSION = "1.17.1" unless defined?(::Bundler::VERSION)
def self.overwrite_loaded_gem_version def self.overwrite_loaded_gem_version
begin begin

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
require "bundler/shared_helpers" require "bundler/shared_helpers"
Bundler::SharedHelpers.major_deprecation 3, Bundler::SharedHelpers.major_deprecation 2,
"The Bundler task for Vlad" "The Bundler task for Vlad"
# Vlad task for Bundler. # Vlad task for Bundler.

View File

@ -3,7 +3,7 @@
require "bundler/shared_helpers" require "bundler/shared_helpers"
Bundler::SharedHelpers.major_deprecation(3, "the bundle_ruby executable has been removed in favor of `bundle platform --ruby`") Bundler::SharedHelpers.major_deprecation(2, "the bundle_ruby executable has been removed in favor of `bundle platform --ruby`")
Signal.trap("INT") { exit 1 } Signal.trap("INT") { exit 1 }

View File

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-CONFIG" "1" "November 2018" "" "" .TH "BUNDLE\-CONFIG" "1" "December 2018" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-config\fR \- Set bundler configuration options \fBbundle\-config\fR \- Set bundler configuration options
@ -238,7 +238,7 @@ The following is a list of all configuration keys and their purpose\. You can le
\fBpath\.system\fR (\fBBUNDLE_PATH__SYSTEM\fR): Whether Bundler will install gems into the default system path (\fBGem\.dir\fR)\. \fBpath\.system\fR (\fBBUNDLE_PATH__SYSTEM\fR): Whether Bundler will install gems into the default system path (\fBGem\.dir\fR)\.
. .
.IP "\(bu" 4 .IP "\(bu" 4
\fBpath_relative_to_cwd\fR (\fBBUNDLE_PATH_RELATIVE_TO_CWD\fR) Makes \fB\-\-path\fR relative to the CWD instead of the \fBGemfile\fR\. \fBpath_relative_to_cwd\fR (\fBPATH_RELATIVE_TO_CWD\fR) Makes \fB\-\-path\fR relative to the CWD instead of the \fBGemfile\fR\.
. .
.IP "\(bu" 4 .IP "\(bu" 4
\fBplugins\fR (\fBBUNDLE_PLUGINS\fR): Enable Bundler\'s experimental plugin system\. \fBplugins\fR (\fBBUNDLE_PLUGINS\fR): Enable Bundler\'s experimental plugin system\.

View File

@ -282,8 +282,8 @@ BUNDLE-CONFIG(1) BUNDLE-CONFIG(1)
o 1mpath.system 22m(1mBUNDLE_PATH__SYSTEM22m): Whether Bundler will install o 1mpath.system 22m(1mBUNDLE_PATH__SYSTEM22m): Whether Bundler will install
gems into the default system path (1mGem.dir22m). gems into the default system path (1mGem.dir22m).
o 1mpath_relative_to_cwd 22m(1mBUNDLE_PATH_RELATIVE_TO_CWD22m) Makes 1m--path0m o 1mpath_relative_to_cwd 22m(1mPATH_RELATIVE_TO_CWD22m) Makes 1m--path 22mrelative
relative to the CWD instead of the 1mGemfile22m. to the CWD instead of the 1mGemfile22m.
o 1mplugins 22m(1mBUNDLE_PLUGINS22m): Enable Bundler's experimental plugin sys- o 1mplugins 22m(1mBUNDLE_PLUGINS22m): Enable Bundler's experimental plugin sys-
tem. tem.
@ -526,4 +526,4 @@ BUNDLE-CONFIG(1) BUNDLE-CONFIG(1)
November 2018 BUNDLE-CONFIG(1) December 2018 BUNDLE-CONFIG(1)

View File

@ -1,13 +1,13 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-INSTALL" "1" "November 2018" "" "" .TH "BUNDLE\-INSTALL" "1" "December 2018" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-install\fR \- Install the dependencies specified in your Gemfile \fBbundle\-install\fR \- Install the dependencies specified in your Gemfile
. .
.SH "SYNOPSIS" .SH "SYNOPSIS"
\fBbundle install\fR [\-\-binstubs[=DIRECTORY]] [\-\-clean] [\-\-deployment] [\-\-frozen] [\-\-full\-index] [\-\-gemfile=GEMFILE] [\-\-jobs=NUMBER] [\-\-local] [\-\-no\-cache] [\-\-no\-prune] [\-\-path PATH] [\-\-quiet] [\-\-redownload] [\-\-retry=NUMBER] [\-\-shebang] [\-\-standalone[=GROUP[ GROUP\.\.\.]]] [\-\-system] [\-\-trust\-policy=POLICY] [\-\-with=GROUP[ GROUP\.\.\.]] [\-\-without=GROUP[ GROUP\.\.\.]] \fBbundle install\fR [\-\-binstubs[=DIRECTORY]] [\-\-clean] [\-\-deployment] [\-\-force] [\-\-frozen] [\-\-full\-index] [\-\-gemfile=GEMFILE] [\-\-jobs=NUMBER] [\-\-local] [\-\-no\-cache] [\-\-no\-prune] [\-\-path PATH] [\-\-quiet] [\-\-retry=NUMBER] [\-\-shebang] [\-\-standalone[=GROUP[ GROUP\.\.\.]]] [\-\-system] [\-\-trust\-policy=POLICY] [\-\-with=GROUP[ GROUP\.\.\.]] [\-\-without=GROUP[ GROUP\.\.\.]]
. .
.SH "DESCRIPTION" .SH "DESCRIPTION"
Install the gems specified in your Gemfile(5)\. If this is the first time you run bundle install (and a \fBGemfile\.lock\fR does not exist), Bundler will fetch all remote sources, resolve dependencies and install all needed gems\. Install the gems specified in your Gemfile(5)\. If this is the first time you run bundle install (and a \fBGemfile\.lock\fR does not exist), Bundler will fetch all remote sources, resolve dependencies and install all needed gems\.
@ -23,10 +23,7 @@ To apply any of \fB\-\-binstubs\fR, \fB\-\-deployment\fR, \fB\-\-path\fR, or \fB
. .
.TP .TP
\fB\-\-binstubs[=<directory>]\fR \fB\-\-binstubs[=<directory>]\fR
Binstubs are scripts that wrap around executables\. Bundler creates a small Ruby file (a binstub) that loads Bundler, runs the command, and puts it in \fBbin/\fR\. This lets you link the binstub inside of an application to the exact gem version the application needs\. Creates a directory (defaults to \fB~/bin\fR) and place any executables from the gem there\. These executables run in Bundler\'s context\. If used, you might add this directory to your environment\'s \fBPATH\fR variable\. For instance, if the \fBrails\fR gem comes with a \fBrails\fR executable, this flag will create a \fBbin/rails\fR executable that ensures that all referred dependencies will be resolved using the bundled gems\.
.
.IP
Creates a directory (defaults to \fB~/bin\fR) and places any executables from the gem there\. These executables run in Bundler\'s context\. If used, you might add this directory to your environment\'s \fBPATH\fR variable\. For instance, if the \fBrails\fR gem comes with a \fBrails\fR executable, this flag will create a \fBbin/rails\fR executable that ensures that all referred dependencies will be resolved using the bundled gems\.
. .
.TP .TP
\fB\-\-clean\fR \fB\-\-clean\fR
@ -37,8 +34,8 @@ On finishing the installation Bundler is going to remove any gems not present in
In \fIdeployment mode\fR, Bundler will \'roll\-out\' the bundle for production or CI use\. Please check carefully if you want to have this option enabled in your development environment\. In \fIdeployment mode\fR, Bundler will \'roll\-out\' the bundle for production or CI use\. Please check carefully if you want to have this option enabled in your development environment\.
. .
.TP .TP
\fB\-\-redownload\fR \fB\-\-force\fR
Force download every gem, even if the required versions are already available locally\. Force download every gem, even if the required versions are already available locally\. \fB\-\-redownload\fR is an alias of this option\.
. .
.TP .TP
\fB\-\-frozen\fR \fB\-\-frozen\fR

View File

@ -7,8 +7,8 @@ BUNDLE-INSTALL(1) BUNDLE-INSTALL(1)
1mSYNOPSIS0m 1mSYNOPSIS0m
1mbundle install 22m[--binstubs[=DIRECTORY]] [--clean] [--deployment] 1mbundle install 22m[--binstubs[=DIRECTORY]] [--clean] [--deployment]
[--frozen] [--full-index] [--gemfile=GEMFILE] [--jobs=NUMBER] [--local] [--force] [--frozen] [--full-index] [--gemfile=GEMFILE] [--jobs=NUMBER]
[--no-cache] [--no-prune] [--path PATH] [--quiet] [--redownload] [--local] [--no-cache] [--no-prune] [--path PATH] [--quiet]
[--retry=NUMBER] [--shebang] [--standalone[=GROUP[ GROUP...]]] [--sys- [--retry=NUMBER] [--shebang] [--standalone[=GROUP[ GROUP...]]] [--sys-
tem] [--trust-policy=POLICY] [--with=GROUP[ GROUP...]] [--with- tem] [--trust-policy=POLICY] [--with=GROUP[ GROUP...]] [--with-
out=GROUP[ GROUP...]] out=GROUP[ GROUP...]]
@ -34,13 +34,7 @@ BUNDLE-INSTALL(1) BUNDLE-INSTALL(1)
time 1mbundle install 22mis run, use 1mbundle config 22m(see bundle-config(1)). time 1mbundle install 22mis run, use 1mbundle config 22m(see bundle-config(1)).
1m--binstubs[=<directory>]0m 1m--binstubs[=<directory>]0m
Binstubs are scripts that wrap around executables. Bundler cre- Creates a directory (defaults to 1m~/bin22m) and place any executa-
ates a small Ruby file (a binstub) that loads Bundler, runs the
command, and puts it in 1mbin/22m. This lets you link the binstub
inside of an application to the exact gem version the applica-
tion needs.
Creates a directory (defaults to 1m~/bin22m) and places any executa-
bles from the gem there. These executables run in Bundler's con- bles from the gem there. These executables run in Bundler's con-
text. If used, you might add this directory to your environ- text. If used, you might add this directory to your environ-
ment's 1mPATH 22mvariable. For instance, if the 1mrails 22mgem comes with ment's 1mPATH 22mvariable. For instance, if the 1mrails 22mgem comes with
@ -58,57 +52,58 @@ BUNDLE-INSTALL(1) BUNDLE-INSTALL(1)
duction or CI use. Please check carefully if you want to have duction or CI use. Please check carefully if you want to have
this option enabled in your development environment. this option enabled in your development environment.
1m--redownload0m 1m--force0m
Force download every gem, even if the required versions are Force download every gem, even if the required versions are
already available locally. already available locally. 1m--redownload 22mis an alias of this
option.
1m--frozen0m 1m--frozen0m
Do not allow the Gemfile.lock to be updated after this install. Do not allow the Gemfile.lock to be updated after this install.
Exits non-zero if there are going to be changes to the Gem- Exits non-zero if there are going to be changes to the Gem-
file.lock. file.lock.
1m--full-index0m 1m--full-index0m
Bundler will not call Rubygems' API endpoint (default) but down- Bundler will not call Rubygems' API endpoint (default) but down-
load and cache a (currently big) index file of all gems. Perfor- load and cache a (currently big) index file of all gems. Perfor-
mance can be improved for large bundles that seldom change by mance can be improved for large bundles that seldom change by
enabling this option. enabling this option.
1m--gemfile=<gemfile>0m 1m--gemfile=<gemfile>0m
The location of the Gemfile(5) which Bundler should use. This The location of the Gemfile(5) which Bundler should use. This
defaults to a Gemfile(5) in the current working directory. In defaults to a Gemfile(5) in the current working directory. In
general, Bundler will assume that the location of the Gemfile(5) general, Bundler will assume that the location of the Gemfile(5)
is also the project's root and will try to find 1mGemfile.lock 22mand is also the project's root and will try to find 1mGemfile.lock 22mand
1mvendor/cache 22mrelative to this location. 1mvendor/cache 22mrelative to this location.
1m--jobs=[<number>]22m, 1m-j[<number>]0m 1m--jobs=[<number>]22m, 1m-j[<number>]0m
The maximum number of parallel download and install jobs. The The maximum number of parallel download and install jobs. The
default is 1m122m. default is 1m122m.
1m--local0m 1m--local0m
Do not attempt to connect to 1mrubygems.org22m. Instead, Bundler will Do not attempt to connect to 1mrubygems.org22m. Instead, Bundler will
use the gems already present in Rubygems' cache or in 1mven-0m use the gems already present in Rubygems' cache or in 1mven-0m
1mdor/cache22m. Note that if a appropriate platform-specific gem 1mdor/cache22m. Note that if a appropriate platform-specific gem
exists on 1mrubygems.org 22mit will not be found. exists on 1mrubygems.org 22mit will not be found.
1m--no-cache0m 1m--no-cache0m
Do not update the cache in 1mvendor/cache 22mwith the newly bundled Do not update the cache in 1mvendor/cache 22mwith the newly bundled
gems. This does not remove any gems in the cache but keeps the gems. This does not remove any gems in the cache but keeps the
newly bundled gems from being cached during the install. newly bundled gems from being cached during the install.
1m--no-prune0m 1m--no-prune0m
Don't remove stale gems from the cache when the installation Don't remove stale gems from the cache when the installation
finishes. finishes.
1m--path=<path>0m 1m--path=<path>0m
The location to install the specified gems to. This defaults to The location to install the specified gems to. This defaults to
Rubygems' setting. Bundler shares this location with Rubygems, Rubygems' setting. Bundler shares this location with Rubygems,
1mgem install ... 22mwill have gem installed there, too. Therefore, 1mgem install ... 22mwill have gem installed there, too. Therefore,
gems installed without a 1m--path ... 22msetting will show up by gems installed without a 1m--path ... 22msetting will show up by
calling 1mgem list22m. Accordingly, gems installed to other locations calling 1mgem list22m. Accordingly, gems installed to other locations
will not get listed. will not get listed.
1m--quiet0m 1m--quiet0m
Do not print progress information to the standard output. Do not print progress information to the standard output.
Instead, Bundler will exit using a status code (1m$?22m). Instead, Bundler will exit using a status code (1m$?22m).
1m--retry=[<number>]0m 1m--retry=[<number>]0m
@ -116,34 +111,34 @@ BUNDLE-INSTALL(1) BUNDLE-INSTALL(1)
1m--shebang=<ruby-executable>0m 1m--shebang=<ruby-executable>0m
Uses the specified ruby executable (usually 1mruby22m) to execute the Uses the specified ruby executable (usually 1mruby22m) to execute the
scripts created with 1m--binstubs22m. In addition, if you use 1m--bin-0m scripts created with 1m--binstubs22m. In addition, if you use 1m--bin-0m
1mstubs 22mtogether with 1m--shebang jruby 22mthese executables will be 1mstubs 22mtogether with 1m--shebang jruby 22mthese executables will be
changed to execute 1mjruby 22minstead. changed to execute 1mjruby 22minstead.
1m--standalone[=<list>]0m 1m--standalone[=<list>]0m
Makes a bundle that can work without depending on Rubygems or Makes a bundle that can work without depending on Rubygems or
Bundler at runtime. A space separated list of groups to install Bundler at runtime. A space separated list of groups to install
has to be specified. Bundler creates a directory named 1mbundle0m has to be specified. Bundler creates a directory named 1mbundle0m
and installs the bundle there. It also generates a 1mbun-0m and installs the bundle there. It also generates a 1mbun-0m
1mdle/bundler/setup.rb 22mfile to replace Bundler's own setup in the 1mdle/bundler/setup.rb 22mfile to replace Bundler's own setup in the
manner required. Using this option implicitly sets 1mpath22m, which manner required. Using this option implicitly sets 1mpath22m, which
is a [remembered option][REMEMBERED OPTIONS]. is a [remembered option][REMEMBERED OPTIONS].
1m--system0m 1m--system0m
Installs the gems specified in the bundle to the system's Installs the gems specified in the bundle to the system's
Rubygems location. This overrides any previous configuration of Rubygems location. This overrides any previous configuration of
1m--path22m. 1m--path22m.
1m--trust-policy=[<policy>]0m 1m--trust-policy=[<policy>]0m
Apply the Rubygems security policy 4mpolicy24m, where policy is one Apply the Rubygems security policy 4mpolicy24m, where policy is one
of 1mHighSecurity22m, 1mMediumSecurity22m, 1mLowSecurity22m, 1mAlmostNoSecurity22m, of 1mHighSecurity22m, 1mMediumSecurity22m, 1mLowSecurity22m, 1mAlmostNoSecurity22m,
or 1mNoSecurity22m. For more details, please see the Rubygems signing or 1mNoSecurity22m. For more details, please see the Rubygems signing
documentation linked below in 4mSEE24m 4mALSO24m. documentation linked below in 4mSEE24m 4mALSO24m.
1m--with=<list>0m 1m--with=<list>0m
A space-separated list of groups referencing gems to install. If A space-separated list of groups referencing gems to install. If
an optional group is given it is installed. If a group is given an optional group is given it is installed. If a group is given
that is in the remembered list of groups given to --without, it that is in the remembered list of groups given to --without, it
is removed from that list. is removed from that list.
1m--without=<list>0m 1m--without=<list>0m
@ -153,41 +148,41 @@ BUNDLE-INSTALL(1) BUNDLE-INSTALL(1)
1mDEPLOYMENT MODE0m 1mDEPLOYMENT MODE0m
Bundler's defaults are optimized for development. To switch to defaults Bundler's defaults are optimized for development. To switch to defaults
optimized for deployment and for CI, use the 1m--deployment 22mflag. Do not optimized for deployment and for CI, use the 1m--deployment 22mflag. Do not
activate deployment mode on development machines, as it will cause an activate deployment mode on development machines, as it will cause an
error when the Gemfile(5) is modified. error when the Gemfile(5) is modified.
1. A 1mGemfile.lock 22mis required. 1. A 1mGemfile.lock 22mis required.
To ensure that the same versions of the gems you developed with and To ensure that the same versions of the gems you developed with and
tested with are also used in deployments, a 1mGemfile.lock 22mis tested with are also used in deployments, a 1mGemfile.lock 22mis
required. required.
This is mainly to ensure that you remember to check your 1mGem-0m This is mainly to ensure that you remember to check your 1mGem-0m
1mfile.lock 22minto version control. 1mfile.lock 22minto version control.
2. The 1mGemfile.lock 22mmust be up to date 2. The 1mGemfile.lock 22mmust be up to date
In development, you can modify your Gemfile(5) and re-run 1mbundle0m In development, you can modify your Gemfile(5) and re-run 1mbundle0m
1minstall 22mto 4mconservatively24m 4mupdate24m your 1mGemfile.lock 22msnapshot. 1minstall 22mto 4mconservatively24m 4mupdate24m your 1mGemfile.lock 22msnapshot.
In deployment, your 1mGemfile.lock 22mshould be up-to-date with changes In deployment, your 1mGemfile.lock 22mshould be up-to-date with changes
made in your Gemfile(5). made in your Gemfile(5).
3. Gems are installed to 1mvendor/bundle 22mnot your default system loca- 3. Gems are installed to 1mvendor/bundle 22mnot your default system loca-
tion tion
In development, it's convenient to share the gems used in your In development, it's convenient to share the gems used in your
application with other applications and other scripts that run on application with other applications and other scripts that run on
the system. the system.
In deployment, isolation is a more important default. In addition, In deployment, isolation is a more important default. In addition,
the user deploying the application may not have permission to the user deploying the application may not have permission to
install gems to the system, or the web server may not have permis- install gems to the system, or the web server may not have permis-
sion to read them. sion to read them.
As a result, 1mbundle install --deployment 22minstalls gems to the 1mven-0m As a result, 1mbundle install --deployment 22minstalls gems to the 1mven-0m
1mdor/bundle 22mdirectory in the application. This may be overridden 1mdor/bundle 22mdirectory in the application. This may be overridden
using the 1m--path 22moption. using the 1m--path 22moption.
@ -195,12 +190,12 @@ BUNDLE-INSTALL(1) BUNDLE-INSTALL(1)
1mSUDO USAGE0m 1mSUDO USAGE0m
By default, Bundler installs gems to the same location as 1mgem install22m. By default, Bundler installs gems to the same location as 1mgem install22m.
In some cases, that location may not be writable by your Unix user. In In some cases, that location may not be writable by your Unix user. In
that case, Bundler will stage everything in a temporary directory, then that case, Bundler will stage everything in a temporary directory, then
ask you for your 1msudo 22mpassword in order to copy the gems into their ask you for your 1msudo 22mpassword in order to copy the gems into their
system location. system location.
From your perspective, this is identical to installing the gems From your perspective, this is identical to installing the gems
directly into the system. directly into the system.
You should never use 1msudo bundle install22m. This is because several other You should never use 1msudo bundle install22m. This is because several other
@ -214,36 +209,36 @@ BUNDLE-INSTALL(1) BUNDLE-INSTALL(1)
Of these three, the first two could theoretically be performed by Of these three, the first two could theoretically be performed by
1mchown22ming the resulting files to 1m$SUDO_USER22m. The third, however, can 1mchown22ming the resulting files to 1m$SUDO_USER22m. The third, however, can
only be performed by invoking the 1mgit 22mcommand as the current user. only be performed by invoking the 1mgit 22mcommand as the current user.
Therefore, git gems are downloaded and installed into 1m~/.bundle 22mrather Therefore, git gems are downloaded and installed into 1m~/.bundle 22mrather
than $GEM_HOME or $BUNDLE_PATH. than $GEM_HOME or $BUNDLE_PATH.
As a result, you should run 1mbundle install 22mas the current user, and As a result, you should run 1mbundle install 22mas the current user, and
Bundler will ask for your password if it is needed to put the gems into Bundler will ask for your password if it is needed to put the gems into
their final location. their final location.
1mINSTALLING GROUPS0m 1mINSTALLING GROUPS0m
By default, 1mbundle install 22mwill install all gems in all groups in your By default, 1mbundle install 22mwill install all gems in all groups in your
Gemfile(5), except those declared for a different platform. Gemfile(5), except those declared for a different platform.
However, you can explicitly tell Bundler to skip installing certain However, you can explicitly tell Bundler to skip installing certain
groups with the 1m--without 22moption. This option takes a space-separated groups with the 1m--without 22moption. This option takes a space-separated
list of groups. list of groups.
While the 1m--without 22moption will skip 4minstalling24m the gems in the speci- While the 1m--without 22moption will skip 4minstalling24m the gems in the speci-
fied groups, it will still 4mdownload24m those gems and use them to resolve fied groups, it will still 4mdownload24m those gems and use them to resolve
the dependencies of every gem in your Gemfile(5). the dependencies of every gem in your Gemfile(5).
This is so that installing a different set of groups on another machine This is so that installing a different set of groups on another machine
(such as a production server) will not change the gems and versions (such as a production server) will not change the gems and versions
that you have already developed and tested against. that you have already developed and tested against.
1mBundler offers a rock-solid guarantee that the third-party code you are0m 1mBundler offers a rock-solid guarantee that the third-party code you are0m
1mrunning in development and testing is also the third-party code you are0m 1mrunning in development and testing is also the third-party code you are0m
1mrunning in production. You can choose to exclude some of that code in0m 1mrunning in production. You can choose to exclude some of that code in0m
1mdifferent environments, but you will never be caught flat-footed by0m 1mdifferent environments, but you will never be caught flat-footed by0m
1mdifferent versions of third-party code being used in different environ-0m 1mdifferent versions of third-party code being used in different environ-0m
1mments.0m 1mments.0m
@ -261,63 +256,63 @@ BUNDLE-INSTALL(1) BUNDLE-INSTALL(1)
In this case, 1msinatra 22mdepends on any version of Rack (1m>= 1.022m), while In this case, 1msinatra 22mdepends on any version of Rack (1m>= 1.022m), while
1mrack-perftools-profiler 22mdepends on 1.x (1m~> 1.022m). 1mrack-perftools-profiler 22mdepends on 1.x (1m~> 1.022m).
When you run 1mbundle install --without production 22min development, we When you run 1mbundle install --without production 22min development, we
look at the dependencies of 1mrack-perftools-profiler 22mas well. That way, look at the dependencies of 1mrack-perftools-profiler 22mas well. That way,
you do not spend all your time developing against Rack 2.0, using new you do not spend all your time developing against Rack 2.0, using new
APIs unavailable in Rack 1.x, only to have Bundler switch to Rack 1.2 APIs unavailable in Rack 1.x, only to have Bundler switch to Rack 1.2
when the 1mproduction 22mgroup 4mis24m used. when the 1mproduction 22mgroup 4mis24m used.
This should not cause any problems in practice, because we do not This should not cause any problems in practice, because we do not
attempt to 1minstall 22mthe gems in the excluded groups, and only evaluate attempt to 1minstall 22mthe gems in the excluded groups, and only evaluate
as part of the dependency resolution process. as part of the dependency resolution process.
This also means that you cannot include different versions of the same This also means that you cannot include different versions of the same
gem in different groups, because doing so would result in different gem in different groups, because doing so would result in different
sets of dependencies used in development and production. Because of the sets of dependencies used in development and production. Because of the
vagaries of the dependency resolution process, this usually affects vagaries of the dependency resolution process, this usually affects
more than the gems you list in your Gemfile(5), and can (surprisingly) more than the gems you list in your Gemfile(5), and can (surprisingly)
radically change the gems you are using. radically change the gems you are using.
1mTHE GEMFILE.LOCK0m 1mTHE GEMFILE.LOCK0m
When you run 1mbundle install22m, Bundler will persist the full names and When you run 1mbundle install22m, Bundler will persist the full names and
versions of all gems that you used (including dependencies of the gems versions of all gems that you used (including dependencies of the gems
specified in the Gemfile(5)) into a file called 1mGemfile.lock22m. specified in the Gemfile(5)) into a file called 1mGemfile.lock22m.
Bundler uses this file in all subsequent calls to 1mbundle install22m, which Bundler uses this file in all subsequent calls to 1mbundle install22m, which
guarantees that you always use the same exact code, even as your appli- guarantees that you always use the same exact code, even as your appli-
cation moves across machines. cation moves across machines.
Because of the way dependency resolution works, even a seemingly small Because of the way dependency resolution works, even a seemingly small
change (for instance, an update to a point-release of a dependency of a change (for instance, an update to a point-release of a dependency of a
gem in your Gemfile(5)) can result in radically different gems being gem in your Gemfile(5)) can result in radically different gems being
needed to satisfy all dependencies. needed to satisfy all dependencies.
As a result, you 1mSHOULD 22mcheck your 1mGemfile.lock 22minto version control, As a result, you 1mSHOULD 22mcheck your 1mGemfile.lock 22minto version control,
in both applications and gems. If you do not, every machine that checks in both applications and gems. If you do not, every machine that checks
out your repository (including your production server) will resolve all out your repository (including your production server) will resolve all
dependencies again, which will result in different versions of dependencies again, which will result in different versions of
third-party code being used if 1many 22mof the gems in the Gemfile(5) or any third-party code being used if 1many 22mof the gems in the Gemfile(5) or any
of their dependencies have been updated. of their dependencies have been updated.
When Bundler first shipped, the 1mGemfile.lock 22mwas included in the 1m.git-0m When Bundler first shipped, the 1mGemfile.lock 22mwas included in the 1m.git-0m
1mignore 22mfile included with generated gems. Over time, however, it became 1mignore 22mfile included with generated gems. Over time, however, it became
clear that this practice forces the pain of broken dependencies onto clear that this practice forces the pain of broken dependencies onto
new contributors, while leaving existing contributors potentially new contributors, while leaving existing contributors potentially
unaware of the problem. Since 1mbundle install 22mis usually the first step unaware of the problem. Since 1mbundle install 22mis usually the first step
towards a contribution, the pain of broken dependencies would discour- towards a contribution, the pain of broken dependencies would discour-
age new contributors from contributing. As a result, we have revised age new contributors from contributing. As a result, we have revised
our guidance for gem authors to now recommend checking in the lock for our guidance for gem authors to now recommend checking in the lock for
gems. gems.
1mCONSERVATIVE UPDATING0m 1mCONSERVATIVE UPDATING0m
When you make a change to the Gemfile(5) and then run 1mbundle install22m, When you make a change to the Gemfile(5) and then run 1mbundle install22m,
Bundler will update only the gems that you modified. Bundler will update only the gems that you modified.
In other words, if a gem that you 1mdid not modify 22mworked before you In other words, if a gem that you 1mdid not modify 22mworked before you
called 1mbundle install22m, it will continue to use the exact same versions called 1mbundle install22m, it will continue to use the exact same versions
of all dependencies as it used before the update. of all dependencies as it used before the update.
Let's take a look at an example. Here's your original Gemfile(5): Let's take a look at an example. Here's your original Gemfile(5):
@ -331,13 +326,13 @@ BUNDLE-INSTALL(1) BUNDLE-INSTALL(1)
In this case, both 1mactionpack 22mand 1mactivemerchant 22mdepend on 1mactivesup-0m In this case, both 1mactionpack 22mand 1mactivemerchant 22mdepend on 1mactivesup-0m
1mport22m. The 1mactionpack 22mgem depends on 1mactivesupport 2.3.8 22mand 1mrack ~>0m 1mport22m. The 1mactionpack 22mgem depends on 1mactivesupport 2.3.8 22mand 1mrack ~>0m
1m1.1.022m, while the 1mactivemerchant 22mgem depends on 1mactivesupport >= 2.3.222m, 1m1.1.022m, while the 1mactivemerchant 22mgem depends on 1mactivesupport >= 2.3.222m,
1mbraintree >= 2.0.022m, and 1mbuilder >= 2.0.022m. 1mbraintree >= 2.0.022m, and 1mbuilder >= 2.0.022m.
When the dependencies are first resolved, Bundler will select When the dependencies are first resolved, Bundler will select
1mactivesupport 2.3.822m, which satisfies the requirements of both gems in 1mactivesupport 2.3.822m, which satisfies the requirements of both gems in
your Gemfile(5). your Gemfile(5).
Next, you modify your Gemfile(5) to: Next, you modify your Gemfile(5) to:
@ -351,44 +346,44 @@ BUNDLE-INSTALL(1) BUNDLE-INSTALL(1)
The 1mactionpack 3.0.0.rc 22mgem has a number of new dependencies, and The 1mactionpack 3.0.0.rc 22mgem has a number of new dependencies, and
updates the 1mactivesupport 22mdependency to 1m= 3.0.0.rc 22mand the 1mrack 22mdepen- updates the 1mactivesupport 22mdependency to 1m= 3.0.0.rc 22mand the 1mrack 22mdepen-
dency to 1m~> 1.2.122m. dency to 1m~> 1.2.122m.
When you run 1mbundle install22m, Bundler notices that you changed the When you run 1mbundle install22m, Bundler notices that you changed the
1mactionpack 22mgem, but not the 1mactivemerchant 22mgem. It evaluates the gems 1mactionpack 22mgem, but not the 1mactivemerchant 22mgem. It evaluates the gems
currently being used to satisfy its requirements: currently being used to satisfy its requirements:
1mactivesupport 2.3.80m 1mactivesupport 2.3.80m
also used to satisfy a dependency in 1mactivemerchant22m, which is also used to satisfy a dependency in 1mactivemerchant22m, which is
not being updated not being updated
1mrack ~> 1.1.00m 1mrack ~> 1.1.00m
not currently being used to satisfy another dependency not currently being used to satisfy another dependency
Because you did not explicitly ask to update 1mactivemerchant22m, you would Because you did not explicitly ask to update 1mactivemerchant22m, you would
not expect it to suddenly stop working after updating 1mactionpack22m. How- not expect it to suddenly stop working after updating 1mactionpack22m. How-
ever, satisfying the new 1mactivesupport 3.0.0.rc 22mdependency of action- ever, satisfying the new 1mactivesupport 3.0.0.rc 22mdependency of action-
pack requires updating one of its dependencies. pack requires updating one of its dependencies.
Even though 1mactivemerchant 22mdeclares a very loose dependency that theo- Even though 1mactivemerchant 22mdeclares a very loose dependency that theo-
retically matches 1mactivesupport 3.0.0.rc22m, Bundler treats gems in your retically matches 1mactivesupport 3.0.0.rc22m, Bundler treats gems in your
Gemfile(5) that have not changed as an atomic unit together with their Gemfile(5) that have not changed as an atomic unit together with their
dependencies. In this case, the 1mactivemerchant 22mdependency is treated as dependencies. In this case, the 1mactivemerchant 22mdependency is treated as
1mactivemerchant 1.7.1 + activesupport 2.3.822m, so 1mbundle install 22mwill 1mactivemerchant 1.7.1 + activesupport 2.3.822m, so 1mbundle install 22mwill
report that it cannot update 1mactionpack22m. report that it cannot update 1mactionpack22m.
To explicitly update 1mactionpack22m, including its dependencies which other To explicitly update 1mactionpack22m, including its dependencies which other
gems in the Gemfile(5) still depend on, run 1mbundle update actionpack0m gems in the Gemfile(5) still depend on, run 1mbundle update actionpack0m
(see 1mbundle update(1)22m). (see 1mbundle update(1)22m).
1mSummary22m: In general, after making a change to the Gemfile(5) , you 1mSummary22m: In general, after making a change to the Gemfile(5) , you
should first try to run 1mbundle install22m, which will guarantee that no should first try to run 1mbundle install22m, which will guarantee that no
other gem in the Gemfile(5) is impacted by the change. If that does not other gem in the Gemfile(5) is impacted by the change. If that does not
work, run bundle update(1) 4mbundle-update.1.html24m. work, run bundle update(1) 4mbundle-update.1.html24m.
1mSEE ALSO0m 1mSEE ALSO0m
o Gem install docs o Gem install docs
4mhttp://guides.rubygems.org/rubygems-basics/#installing-gems0m 4mhttp://guides.rubygems.org/rubygems-basics/#installing-gems0m
o Rubygems signing docs 4mhttp://guides.rubygems.org/security/0m o Rubygems signing docs 4mhttp://guides.rubygems.org/security/0m
@ -398,4 +393,4 @@ BUNDLE-INSTALL(1) BUNDLE-INSTALL(1)
November 2018 BUNDLE-INSTALL(1) December 2018 BUNDLE-INSTALL(1)

View File

@ -1,13 +1,13 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-UPDATE" "1" "November 2018" "" "" .TH "BUNDLE\-UPDATE" "1" "December 2018" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-update\fR \- Update your gems to the latest available versions \fBbundle\-update\fR \- Update your gems to the latest available versions
. .
.SH "SYNOPSIS" .SH "SYNOPSIS"
\fBbundle update\fR \fI*gems\fR [\-\-all] [\-\-group=NAME] [\-\-source=NAME] [\-\-local] [\-\-ruby] [\-\-bundler[=VERSION]] [\-\-full\-index] [\-\-jobs=JOBS] [\-\-quiet] [\-\-patch|\-\-minor|\-\-major] [\-\-redownload] [\-\-strict] [\-\-conservative] \fBbundle update\fR \fI*gems\fR [\-\-all] [\-\-group=NAME] [\-\-source=NAME] [\-\-local] [\-\-ruby] [\-\-bundler[=VERSION]] [\-\-full\-index] [\-\-jobs=JOBS] [\-\-quiet] [\-\-force] [\-\-patch|\-\-minor|\-\-major] [\-\-strict] [\-\-conservative]
. .
.SH "DESCRIPTION" .SH "DESCRIPTION"
Update the gems specified (all gems, if \fB\-\-all\fR flag is used), ignoring the previously installed gems specified in the \fBGemfile\.lock\fR\. In general, you should use bundle install(1) \fIbundle\-install\.1\.html\fR to install the same exact gems and versions across machines\. Update the gems specified (all gems, if \fB\-\-all\fR flag is used), ignoring the previously installed gems specified in the \fBGemfile\.lock\fR\. In general, you should use bundle install(1) \fIbundle\-install\.1\.html\fR to install the same exact gems and versions across machines\.
@ -58,8 +58,8 @@ Retry failed network or git requests for \fInumber\fR times\.
Only output warnings and errors\. Only output warnings and errors\.
. .
.TP .TP
\fB\-\-redownload\fR \fB\-\-force\fR
Force downloading every gem\. Force downloading every gem\. \fB\-\-redownload\fR is an alias of this option\.
. .
.TP .TP
\fB\-\-patch\fR \fB\-\-patch\fR

View File

@ -8,7 +8,7 @@ BUNDLE-UPDATE(1) BUNDLE-UPDATE(1)
1mSYNOPSIS0m 1mSYNOPSIS0m
1mbundle update 4m22m*gems24m [--all] [--group=NAME] [--source=NAME] [--local] 1mbundle update 4m22m*gems24m [--all] [--group=NAME] [--source=NAME] [--local]
[--ruby] [--bundler[=VERSION]] [--full-index] [--jobs=JOBS] [--quiet] [--ruby] [--bundler[=VERSION]] [--full-index] [--jobs=JOBS] [--quiet]
[--patch|--minor|--major] [--redownload] [--strict] [--conservative] [--force] [--patch|--minor|--major] [--strict] [--conservative]
1mDESCRIPTION0m 1mDESCRIPTION0m
Update the gems specified (all gems, if 1m--all 22mflag is used), ignoring Update the gems specified (all gems, if 1m--all 22mflag is used), ignoring
@ -57,8 +57,9 @@ BUNDLE-UPDATE(1) BUNDLE-UPDATE(1)
1m--quiet0m 1m--quiet0m
Only output warnings and errors. Only output warnings and errors.
1m--redownload0m 1m--force0m
Force downloading every gem. Force downloading every gem. 1m--redownload 22mis an alias of this
option.
1m--patch0m 1m--patch0m
Prefer updating only to next patch version. Prefer updating only to next patch version.
@ -78,8 +79,8 @@ BUNDLE-UPDATE(1) BUNDLE-UPDATE(1)
shared dependencies to be updated. shared dependencies to be updated.
1mUPDATING ALL GEMS0m 1mUPDATING ALL GEMS0m
If you run 1mbundle update --all22m, bundler will ignore any previously If you run 1mbundle update --all22m, bundler will ignore any previously
installed gems and resolve all dependencies again based on the latest installed gems and resolve all dependencies again based on the latest
versions of all gems available in the sources. versions of all gems available in the sources.
Consider the following Gemfile(5): Consider the following Gemfile(5):
@ -93,8 +94,8 @@ BUNDLE-UPDATE(1) BUNDLE-UPDATE(1)
When you run bundle install(1) 4mbundle-install.1.html24m the first time, When you run bundle install(1) 4mbundle-install.1.html24m the first time,
bundler will resolve all of the dependencies, all the way down, and bundler will resolve all of the dependencies, all the way down, and
install what you need: install what you need:
@ -133,43 +134,43 @@ BUNDLE-UPDATE(1) BUNDLE-UPDATE(1)
As you can see, even though you have two gems in the Gemfile(5), your As you can see, even though you have two gems in the Gemfile(5), your
application needs 26 different gems in order to run. Bundler remembers application needs 26 different gems in order to run. Bundler remembers
the exact versions it installed in 1mGemfile.lock22m. The next time you run the exact versions it installed in 1mGemfile.lock22m. The next time you run
bundle install(1) 4mbundle-install.1.html24m, bundler skips the dependency bundle install(1) 4mbundle-install.1.html24m, bundler skips the dependency
resolution and installs the same gems as it installed last time. resolution and installs the same gems as it installed last time.
After checking in the 1mGemfile.lock 22minto version control and cloning it After checking in the 1mGemfile.lock 22minto version control and cloning it
on another machine, running bundle install(1) 4mbundle-install.1.html0m on another machine, running bundle install(1) 4mbundle-install.1.html0m
will 4mstill24m install the gems that you installed last time. You don't will 4mstill24m install the gems that you installed last time. You don't
need to worry that a new release of 1merubis 22mor 1mmail 22mchanges the gems you need to worry that a new release of 1merubis 22mor 1mmail 22mchanges the gems you
use. use.
However, from time to time, you might want to update the gems you are However, from time to time, you might want to update the gems you are
using to the newest versions that still match the gems in your Gem- using to the newest versions that still match the gems in your Gem-
file(5). file(5).
To do this, run 1mbundle update --all22m, which will ignore the 1mGem-0m To do this, run 1mbundle update --all22m, which will ignore the 1mGem-0m
1mfile.lock22m, and resolve all the dependencies again. Keep in mind that 1mfile.lock22m, and resolve all the dependencies again. Keep in mind that
this process can result in a significantly different set of the 25 this process can result in a significantly different set of the 25
gems, based on the requirements of new gems that the gem authors gems, based on the requirements of new gems that the gem authors
released since the last time you ran 1mbundle update --all22m. released since the last time you ran 1mbundle update --all22m.
1mUPDATING A LIST OF GEMS0m 1mUPDATING A LIST OF GEMS0m
Sometimes, you want to update a single gem in the Gemfile(5), and leave Sometimes, you want to update a single gem in the Gemfile(5), and leave
the rest of the gems that you specified locked to the versions in the the rest of the gems that you specified locked to the versions in the
1mGemfile.lock22m. 1mGemfile.lock22m.
For instance, in the scenario above, imagine that 1mnokogiri 22mreleases For instance, in the scenario above, imagine that 1mnokogiri 22mreleases
version 1m1.4.422m, and you want to update it 4mwithout24m updating Rails and all version 1m1.4.422m, and you want to update it 4mwithout24m updating Rails and all
of its dependencies. To do this, run 1mbundle update nokogiri22m. of its dependencies. To do this, run 1mbundle update nokogiri22m.
Bundler will update 1mnokogiri 22mand any of its dependencies, but leave Bundler will update 1mnokogiri 22mand any of its dependencies, but leave
alone Rails and its dependencies. alone Rails and its dependencies.
1mOVERLAPPING DEPENDENCIES0m 1mOVERLAPPING DEPENDENCIES0m
Sometimes, multiple gems declared in your Gemfile(5) are satisfied by Sometimes, multiple gems declared in your Gemfile(5) are satisfied by
the same second-level dependency. For instance, consider the case of the same second-level dependency. For instance, consider the case of
1mthin 22mand 1mrack-perftools-profiler22m. 1mthin 22mand 1mrack-perftools-profiler22m.
@ -181,7 +182,7 @@ BUNDLE-UPDATE(1) BUNDLE-UPDATE(1)
The 1mthin 22mgem depends on 1mrack >= 1.022m, while 1mrack-perftools-profiler0m The 1mthin 22mgem depends on 1mrack >= 1.022m, while 1mrack-perftools-profiler0m
depends on 1mrack ~> 1.022m. If you run bundle install, you get: depends on 1mrack ~> 1.022m. If you run bundle install, you get:
@ -199,14 +200,14 @@ BUNDLE-UPDATE(1) BUNDLE-UPDATE(1)
In this case, the two gems have their own set of dependencies, but they In this case, the two gems have their own set of dependencies, but they
share 1mrack 22min common. If you run 1mbundle update thin22m, bundler will share 1mrack 22min common. If you run 1mbundle update thin22m, bundler will
update 1mdaemons22m, 1meventmachine 22mand 1mrack22m, which are dependencies of 1mthin22m, update 1mdaemons22m, 1meventmachine 22mand 1mrack22m, which are dependencies of 1mthin22m,
but not 1mopen4 22mor 1mperftools.rb22m, which are dependencies of but not 1mopen4 22mor 1mperftools.rb22m, which are dependencies of
1mrack-perftools_profiler22m. Note that 1mbundle update thin 22mwill update 1mrack0m 1mrack-perftools_profiler22m. Note that 1mbundle update thin 22mwill update 1mrack0m
even though it's 4malso24m a dependency of 1mrack-perftools_profiler22m. even though it's 4malso24m a dependency of 1mrack-perftools_profiler22m.
In short, by default, when you update a gem using 1mbundle update22m, In short, by default, when you update a gem using 1mbundle update22m,
bundler will update all dependencies of that gem, including those that bundler will update all dependencies of that gem, including those that
are also dependencies of another gem. are also dependencies of another gem.
To prevent updating shared dependencies, prior to version 1.14 the only To prevent updating shared dependencies, prior to version 1.14 the only
@ -214,8 +215,8 @@ BUNDLE-UPDATE(1) BUNDLE-UPDATE(1)
4mdle-install.1.html24m: 4mdle-install.1.html24m:
In this scenario, updating the 1mthin 22mversion manually in the Gemfile(5), In this scenario, updating the 1mthin 22mversion manually in the Gemfile(5),
and then running bundle install(1) 4mbundle-install.1.html24m will only and then running bundle install(1) 4mbundle-install.1.html24m will only
update 1mdaemons 22mand 1meventmachine22m, but not 1mrack22m. For more information, update 1mdaemons 22mand 1meventmachine22m, but not 1mrack22m. For more information,
see the 1mCONSERVATIVE UPDATING 22msection of bundle install(1) 4mbun-0m see the 1mCONSERVATIVE UPDATING 22msection of bundle install(1) 4mbun-0m
4mdle-install.1.html24m. 4mdle-install.1.html24m.
@ -223,8 +224,8 @@ BUNDLE-UPDATE(1) BUNDLE-UPDATE(1)
vent shared dependencies from being updated. vent shared dependencies from being updated.
1mPATCH LEVEL OPTIONS0m 1mPATCH LEVEL OPTIONS0m
Version 1.14 introduced 4 patch-level options that will influence how Version 1.14 introduced 4 patch-level options that will influence how
gem versions are resolved. One of the following options can be used: gem versions are resolved. One of the following options can be used:
1m--patch22m, 1m--minor 22mor 1m--major22m. 1m--strict 22mcan be added to further influence 1m--patch22m, 1m--minor 22mor 1m--major22m. 1m--strict 22mcan be added to further influence
resolution. resolution.
@ -241,41 +242,41 @@ BUNDLE-UPDATE(1) BUNDLE-UPDATE(1)
Do not allow any gem to be updated past latest 1m--patch 22m| 1m--minor0m Do not allow any gem to be updated past latest 1m--patch 22m| 1m--minor0m
| 1m--major22m. | 1m--major22m.
When Bundler is resolving what versions to use to satisfy declared When Bundler is resolving what versions to use to satisfy declared
requirements in the Gemfile or in parent gems, it looks up all avail- requirements in the Gemfile or in parent gems, it looks up all avail-
able versions, filters out any versions that don't satisfy the require- able versions, filters out any versions that don't satisfy the require-
ment, and then, by default, sorts them from newest to oldest, consider- ment, and then, by default, sorts them from newest to oldest, consider-
ing them in that order. ing them in that order.
Providing one of the patch level options (e.g. 1m--patch22m) changes the Providing one of the patch level options (e.g. 1m--patch22m) changes the
sort order of the satisfying versions, causing Bundler to consider the sort order of the satisfying versions, causing Bundler to consider the
latest 1m--patch 22mor 1m--minor 22mversion available before other versions. Note latest 1m--patch 22mor 1m--minor 22mversion available before other versions. Note
that versions outside the stated patch level could still be resolved to that versions outside the stated patch level could still be resolved to
if necessary to find a suitable dependency graph. if necessary to find a suitable dependency graph.
For example, if gem 'foo' is locked at 1.0.2, with no gem requirement For example, if gem 'foo' is locked at 1.0.2, with no gem requirement
defined in the Gemfile, and versions 1.0.3, 1.0.4, 1.1.0, 1.1.1, 2.0.0 defined in the Gemfile, and versions 1.0.3, 1.0.4, 1.1.0, 1.1.1, 2.0.0
all exist, the default order of preference by default (1m--major22m) will be all exist, the default order of preference by default (1m--major22m) will be
"2.0.0, 1.1.1, 1.1.0, 1.0.4, 1.0.3, 1.0.2". "2.0.0, 1.1.1, 1.1.0, 1.0.4, 1.0.3, 1.0.2".
If the 1m--patch 22moption is used, the order of preference will change to If the 1m--patch 22moption is used, the order of preference will change to
"1.0.4, 1.0.3, 1.0.2, 1.1.1, 1.1.0, 2.0.0". "1.0.4, 1.0.3, 1.0.2, 1.1.1, 1.1.0, 2.0.0".
If the 1m--minor 22moption is used, the order of preference will change to If the 1m--minor 22moption is used, the order of preference will change to
"1.1.1, 1.1.0, 1.0.4, 1.0.3, 1.0.2, 2.0.0". "1.1.1, 1.1.0, 1.0.4, 1.0.3, 1.0.2, 2.0.0".
Combining the 1m--strict 22moption with any of the patch level options will Combining the 1m--strict 22moption with any of the patch level options will
remove any versions beyond the scope of the patch level option, to remove any versions beyond the scope of the patch level option, to
ensure that no gem is updated that far. ensure that no gem is updated that far.
To continue the previous example, if both 1m--patch 22mand 1m--strict 22moptions To continue the previous example, if both 1m--patch 22mand 1m--strict 22moptions
are used, the available versions for resolution would be "1.0.4, 1.0.3, are used, the available versions for resolution would be "1.0.4, 1.0.3,
1.0.2". If 1m--minor 22mand 1m--strict 22mare used, it would be "1.1.1, 1.1.0, 1.0.2". If 1m--minor 22mand 1m--strict 22mare used, it would be "1.1.1, 1.1.0,
1.0.4, 1.0.3, 1.0.2". 1.0.4, 1.0.3, 1.0.2".
Gem requirements as defined in the Gemfile will still be the first Gem requirements as defined in the Gemfile will still be the first
determining factor for what versions are available. If the gem require- determining factor for what versions are available. If the gem require-
ment for 1mfoo 22min the Gemfile is '~> 1.0', that will accomplish the same ment for 1mfoo 22min the Gemfile is '~> 1.0', that will accomplish the same
thing as providing the 1m--minor 22mand 1m--strict 22moptions. thing as providing the 1m--minor 22mand 1m--strict 22moptions.
1mPATCH LEVEL EXAMPLES0m 1mPATCH LEVEL EXAMPLES0m
@ -324,26 +325,26 @@ BUNDLE-UPDATE(1) BUNDLE-UPDATE(1)
In case 1, bar is upgraded to 2.1.1, a minor version increase, because In case 1, bar is upgraded to 2.1.1, a minor version increase, because
the dependency from foo 1.4.5 required it. the dependency from foo 1.4.5 required it.
In case 2, only foo is requested to be unlocked, but bar is also In case 2, only foo is requested to be unlocked, but bar is also
allowed to move because it's not a declared dependency in the Gemfile. allowed to move because it's not a declared dependency in the Gemfile.
In case 3, bar goes up a whole major release, because a minor increase In case 3, bar goes up a whole major release, because a minor increase
is preferred now for foo, and when it goes to 1.5.1, it requires 3.0.0 is preferred now for foo, and when it goes to 1.5.1, it requires 3.0.0
of bar. of bar.
In case 4, foo is preferred up to a minor version, but 1.5.1 won't work In case 4, foo is preferred up to a minor version, but 1.5.1 won't work
because the --strict flag removes bar 3.0.0 from consideration since because the --strict flag removes bar 3.0.0 from consideration since
it's a major increment. it's a major increment.
In case 5, both foo and bar have any minor or major increments removed In case 5, both foo and bar have any minor or major increments removed
from consideration because of the --strict flag, so the most they can from consideration because of the --strict flag, so the most they can
move is up to 1.4.4 and 2.0.4. move is up to 1.4.4 and 2.0.4.
1mRECOMMENDED WORKFLOW0m 1mRECOMMENDED WORKFLOW0m
In general, when working with an application managed with bundler, you In general, when working with an application managed with bundler, you
should use the following workflow: should use the following workflow:
o After you create your Gemfile(5) for the first time, run o After you create your Gemfile(5) for the first time, run
@ -354,7 +355,7 @@ BUNDLE-UPDATE(1) BUNDLE-UPDATE(1)
$ git add Gemfile.lock $ git add Gemfile.lock
o When checking out this repository on another development machine, o When checking out this repository on another development machine,
run run
$ bundle install $ bundle install
@ -363,7 +364,7 @@ BUNDLE-UPDATE(1) BUNDLE-UPDATE(1)
$ bundle install --deployment $ bundle install --deployment
o After changing the Gemfile(5) to reflect a new or update depen- o After changing the Gemfile(5) to reflect a new or update depen-
dency, run dency, run
$ bundle install $ bundle install
@ -377,7 +378,7 @@ BUNDLE-UPDATE(1) BUNDLE-UPDATE(1)
$ bundle update rails thin $ bundle update rails thin
o If you want to update all the gems to the latest possible versions o If you want to update all the gems to the latest possible versions
that still match the gems listed in the Gemfile(5), run that still match the gems listed in the Gemfile(5), run
$ bundle update --all $ bundle update --all
@ -387,4 +388,4 @@ BUNDLE-UPDATE(1) BUNDLE-UPDATE(1)
November 2018 BUNDLE-UPDATE(1) December 2018 BUNDLE-UPDATE(1)

View File

@ -28,7 +28,7 @@ RSpec.describe "bundle executable" do
end end
context "with no arguments" do context "with no arguments" do
it "prints a concise help message", :bundler => "3" do it "prints a concise help message", :bundler => "2" do
bundle! "" bundle! ""
expect(last_command.stderr).to be_empty expect(last_command.stderr).to be_empty
expect(last_command.stdout).to include("Bundler version #{Bundler::VERSION}"). expect(last_command.stdout).to include("Bundler version #{Bundler::VERSION}").
@ -161,12 +161,12 @@ To install the latest version, run `gem install bundler --pre`
end end
RSpec.describe "bundler executable" do RSpec.describe "bundler executable" do
it "shows the bundler version just as the `bundle` executable does", :bundler => "< 3" do it "shows the bundler version just as the `bundle` executable does", :bundler => "< 2" do
bundler "--version" bundler "--version"
expect(out).to eq("Bundler version #{Bundler::VERSION}") expect(out).to eq("Bundler version #{Bundler::VERSION}")
end end
it "shows the bundler version just as the `bundle` executable does", :bundler => "3" do it "shows the bundler version just as the `bundle` executable does", :bundler => "2" do
bundler "--version" bundler "--version"
expect(out).to eq(Bundler::VERSION) expect(out).to eq(Bundler::VERSION)
end end

View File

@ -13,6 +13,7 @@ RSpec.describe Bundler::Definition do
subject { Bundler::Definition.new(nil, [], Bundler::SourceList.new, []) } subject { Bundler::Definition.new(nil, [], Bundler::SourceList.new, []) }
it "raises an PermissionError with explanation" do it "raises an PermissionError with explanation" do
allow(File).to receive(:open).and_call_original
expect(File).to receive(:open).with("Gemfile.lock", "wb"). expect(File).to receive(:open).with("Gemfile.lock", "wb").
and_raise(Errno::EACCES) and_raise(Errno::EACCES)
expect { subject.lock("Gemfile.lock") }. expect { subject.lock("Gemfile.lock") }.
@ -23,6 +24,7 @@ RSpec.describe Bundler::Definition do
subject { Bundler::Definition.new(nil, [], Bundler::SourceList.new, []) } subject { Bundler::Definition.new(nil, [], Bundler::SourceList.new, []) }
it "raises a TemporaryResourceError with explanation" do it "raises a TemporaryResourceError with explanation" do
allow(File).to receive(:open).and_call_original
expect(File).to receive(:open).with("Gemfile.lock", "wb"). expect(File).to receive(:open).with("Gemfile.lock", "wb").
and_raise(Errno::EAGAIN) and_raise(Errno::EAGAIN)
expect { subject.lock("Gemfile.lock") }. expect { subject.lock("Gemfile.lock") }.
@ -32,7 +34,7 @@ RSpec.describe Bundler::Definition do
end end
describe "detects changes" do describe "detects changes" do
it "for a path gem with changes", :bundler => "< 3" do it "for a path gem with changes", :bundler => "< 2" do
build_lib "foo", "1.0", :path => lib_path("foo") build_lib "foo", "1.0", :path => lib_path("foo")
install_gemfile <<-G install_gemfile <<-G
@ -70,7 +72,7 @@ RSpec.describe Bundler::Definition do
G G
end end
it "for a path gem with changes", :bundler => "3" do it "for a path gem with changes", :bundler => "2" do
build_lib "foo", "1.0", :path => lib_path("foo") build_lib "foo", "1.0", :path => lib_path("foo")
install_gemfile <<-G install_gemfile <<-G
@ -108,7 +110,7 @@ RSpec.describe Bundler::Definition do
G G
end end
it "for a path gem with deps and no changes", :bundler => "< 3" do it "for a path gem with deps and no changes", :bundler => "< 2" do
build_lib "foo", "1.0", :path => lib_path("foo") do |s| build_lib "foo", "1.0", :path => lib_path("foo") do |s|
s.add_dependency "rack", "1.0" s.add_dependency "rack", "1.0"
s.add_development_dependency "net-ssh", "1.0" s.add_development_dependency "net-ssh", "1.0"
@ -145,7 +147,7 @@ RSpec.describe Bundler::Definition do
G G
end end
it "for a path gem with deps and no changes", :bundler => "3" do it "for a path gem with deps and no changes", :bundler => "2" do
build_lib "foo", "1.0", :path => lib_path("foo") do |s| build_lib "foo", "1.0", :path => lib_path("foo") do |s|
s.add_dependency "rack", "1.0" s.add_dependency "rack", "1.0"
s.add_development_dependency "net-ssh", "1.0" s.add_development_dependency "net-ssh", "1.0"

View File

@ -25,23 +25,7 @@ RSpec.describe Bundler::Dsl do
expect { subject.git_source(:example) }.to raise_error(Bundler::InvalidOption) expect { subject.git_source(:example) }.to raise_error(Bundler::InvalidOption)
end end
context "github_https feature flag" do context "default hosts (git, gist)", :bundler => "< 2" do
it "is true when github.https is true" do
bundle "config github.https true"
expect(Bundler.feature_flag.github_https?).to eq "true"
end
end
context "default hosts (git, gist)", :bundler => "< 3" do
context "when github.https config is true" do
before { bundle "config github.https true" }
it "converts :github to :git using https" do
subject.gem("sparks", :github => "indirect/sparks")
github_uri = "https://github.com/indirect/sparks.git"
expect(subject.dependencies.first.source.uri).to eq(github_uri)
end
end
it "converts :github to :git" do it "converts :github to :git" do
subject.gem("sparks", :github => "indirect/sparks") subject.gem("sparks", :github => "indirect/sparks")
github_uri = "git://github.com/indirect/sparks.git" github_uri = "git://github.com/indirect/sparks.git"
@ -79,7 +63,7 @@ RSpec.describe Bundler::Dsl do
end end
end end
context "default git sources", :bundler => "3" do context "default git sources", :bundler => "2" do
it "has none" do it "has none" do
expect(subject.instance_variable_get(:@git_sources)).to eq({}) expect(subject.instance_variable_get(:@git_sources)).to eq({})
end end
@ -245,7 +229,7 @@ RSpec.describe Bundler::Dsl do
# gem 'spree_api' # gem 'spree_api'
# gem 'spree_backend' # gem 'spree_backend'
# end # end
describe "#github", :bundler => "< 3" do describe "#github", :bundler => "< 2" do
it "from github" do it "from github" do
spree_gems = %w[spree_core spree_api spree_backend] spree_gems = %w[spree_core spree_api spree_backend]
subject.github "spree" do subject.github "spree" do
@ -258,7 +242,7 @@ RSpec.describe Bundler::Dsl do
end end
end end
describe "#github", :bundler => "3" do describe "#github", :bundler => "2" do
it "from github" do it "from github" do
expect do expect do
spree_gems = %w[spree_core spree_api spree_backend] spree_gems = %w[spree_core spree_api spree_backend]

View File

@ -115,7 +115,7 @@ RSpec.describe Bundler::SourceList do
end end
end end
describe "#add_rubygems_remote", :bundler => "< 3" do describe "#add_rubygems_remote", :bundler => "< 2" do
let!(:returned_source) { source_list.add_rubygems_remote("https://rubygems.org/") } let!(:returned_source) { source_list.add_rubygems_remote("https://rubygems.org/") }
it "returns the aggregate rubygems source" do it "returns the aggregate rubygems source" do
@ -372,7 +372,7 @@ RSpec.describe Bundler::SourceList do
source_list.add_git_source("uri" => "git://first-git.org/path.git") source_list.add_git_source("uri" => "git://first-git.org/path.git")
end end
it "combines the rubygems sources into a single instance, removing duplicate remotes from the end", :bundler => "< 3" do it "combines the rubygems sources into a single instance, removing duplicate remotes from the end", :bundler => "< 2" do
expect(source_list.lock_sources).to eq [ expect(source_list.lock_sources).to eq [
Bundler::Source::Git.new("uri" => "git://first-git.org/path.git"), Bundler::Source::Git.new("uri" => "git://first-git.org/path.git"),
Bundler::Source::Git.new("uri" => "git://second-git.org/path.git"), Bundler::Source::Git.new("uri" => "git://second-git.org/path.git"),
@ -391,7 +391,7 @@ RSpec.describe Bundler::SourceList do
] ]
end end
it "returns all sources, without combining rubygems sources", :bundler => "3" do it "returns all sources, without combining rubygems sources", :bundler => "2" do
expect(source_list.lock_sources).to eq [ expect(source_list.lock_sources).to eq [
Bundler::Source::Rubygems.new, Bundler::Source::Rubygems.new,
Bundler::Source::Rubygems.new("remotes" => ["https://duplicate-rubygems.org"]), Bundler::Source::Rubygems.new("remotes" => ["https://duplicate-rubygems.org"]),

View File

@ -86,7 +86,7 @@
expect(bundled_app("vendor/cache/bar-1.0")).not_to exist expect(bundled_app("vendor/cache/bar-1.0")).not_to exist
end end
it "raises a warning without --all", :bundler => "< 3" do it "raises a warning without --all", :bundler => "< 2" do
build_lib "foo" build_lib "foo"
install_gemfile <<-G install_gemfile <<-G

View File

@ -134,33 +134,6 @@ RSpec.describe "bundle binstubs <gem>" do
if ENV["BUNDLER_SPEC_SUB_VERSION"] if ENV["BUNDLER_SPEC_SUB_VERSION"]
let(:system_bundler_version) { Bundler::VERSION } let(:system_bundler_version) { Bundler::VERSION }
end end
before do
gemfile <<-G
source "file:///Users/colby/Projects/bundler/tmp/gems/remote2"
gem "rack"
gem "prints_loaded_gems"
G
lockfile <<-G
GEM
remote: file:///Users/colby/Projects/bundler/tmp/gems/remote2/
specs:
prints_loaded_gems (1.0)
rack (1.2)
PLATFORMS
ruby
DEPENDENCIES
prints_loaded_gems
rack
BUNDLED WITH
#{system_bundler_version}
G
end
it "runs bundler" do it "runs bundler" do
sys_exec! "#{bundled_app("bin/bundle")} install" sys_exec! "#{bundled_app("bin/bundle")} install"
expect(out).to eq %(system bundler #{system_bundler_version}\n["install"]) expect(out).to eq %(system bundler #{system_bundler_version}\n["install"])
@ -340,7 +313,7 @@ RSpec.describe "bundle binstubs <gem>" do
expect(bundled_app("exec/rackup")).to exist expect(bundled_app("exec/rackup")).to exist
end end
it "setting is saved for bundle install", :bundler => "< 3" do it "setting is saved for bundle install", :bundler => "< 2" do
install_gemfile <<-G install_gemfile <<-G
source "file://#{gem_repo1}" source "file://#{gem_repo1}"
gem "rack" gem "rack"

View File

@ -92,7 +92,7 @@ RSpec.describe "bundle check" do
expect(out).to include("Bundler can't satisfy your Gemfile's dependencies.") expect(out).to include("Bundler can't satisfy your Gemfile's dependencies.")
end end
it "remembers --without option from install", :bundler => "< 3" do it "remembers --without option from install", :bundler => "< 2" do
gemfile <<-G gemfile <<-G
source "file://#{gem_repo1}" source "file://#{gem_repo1}"
group :foo do group :foo do
@ -238,7 +238,7 @@ RSpec.describe "bundle check" do
expect(last_command).to be_failure expect(last_command).to be_failure
end end
context "--path", :bundler => "< 3" do context "--path", :bundler => "< 2" do
before do before do
gemfile <<-G gemfile <<-G
source "file://#{gem_repo1}" source "file://#{gem_repo1}"
@ -254,7 +254,7 @@ RSpec.describe "bundle check" do
expect(out).to include("The Gemfile's dependencies are satisfied") expect(out).to include("The Gemfile's dependencies are satisfied")
end end
it "should write to .bundle/config", :bundler => "< 3" do it "should write to .bundle/config", :bundler => "< 2" do
bundle "check --path vendor/bundle" bundle "check --path vendor/bundle"
bundle! "check" bundle! "check"
end end

View File

@ -142,7 +142,7 @@ RSpec.describe "bundle clean" do
bundle :clean bundle :clean
digest = Digest(:SHA1).hexdigest(git_path.to_s) digest = Digest(:SHA1).hexdigest(git_path.to_s)
cache_path = Bundler.bundler_major_version < 3 ? vendored_gems("cache/bundler/git/foo-1.0-#{digest}") : home(".bundle/cache/git/foo-1.0-#{digest}") cache_path = Bundler::VERSION.start_with?("1.") ? vendored_gems("cache/bundler/git/foo-1.0-#{digest}") : home(".bundle/cache/git/foo-1.0-#{digest}")
expect(cache_path).to exist expect(cache_path).to exist
end end
@ -343,7 +343,7 @@ RSpec.describe "bundle clean" do
expect(out).to include("rack (1.0.0)").and include("thin (1.0)") expect(out).to include("rack (1.0.0)").and include("thin (1.0)")
end end
it "--clean should override the bundle setting on install", :bundler => "< 3" do it "--clean should override the bundle setting on install", :bundler => "< 2" do
gemfile <<-G gemfile <<-G
source "file://#{gem_repo1}" source "file://#{gem_repo1}"
@ -363,7 +363,7 @@ RSpec.describe "bundle clean" do
should_not_have_gems "thin-1.0" should_not_have_gems "thin-1.0"
end end
it "--clean should override the bundle setting on update", :bundler => "< 3" do it "--clean should override the bundle setting on update", :bundler => "< 2" do
build_repo2 build_repo2
gemfile <<-G gemfile <<-G
@ -383,7 +383,7 @@ RSpec.describe "bundle clean" do
should_not_have_gems "foo-1.0" should_not_have_gems "foo-1.0"
end end
it "automatically cleans when path has not been set", :bundler => "3" do it "automatically cleans when path has not been set", :bundler => "2" do
build_repo2 build_repo2
install_gemfile! <<-G install_gemfile! <<-G

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
RSpec.describe "bundle console", :bundler => "< 3" do RSpec.describe "bundle console", :bundler => "< 2" do
before :each do before :each do
install_gemfile <<-G install_gemfile <<-G
source "file://#{gem_repo1}" source "file://#{gem_repo1}"

View File

@ -570,7 +570,22 @@ RSpec.describe "bundle exec" do
it_behaves_like "it runs" it_behaves_like "it runs"
end end
context "the executable is empty" do context "the executable is empty", :bundler => "< 2" do
let(:executable) { "" }
let(:exit_code) { 0 }
let(:expected) { "#{path} is empty" }
let(:expected_err) { "" }
if LessThanProc.with(RUBY_VERSION).call("1.9")
# Kernel#exec in ruby < 1.9 will raise Errno::ENOEXEC if the command content is empty,
# even if the command is set as an executable.
pending "Kernel#exec is different"
else
it_behaves_like "it runs"
end
end
context "the executable is empty", :bundler => "2" do
let(:executable) { "" } let(:executable) { "" }
let(:exit_code) { 0 } let(:exit_code) { 0 }
@ -579,7 +594,18 @@ RSpec.describe "bundle exec" do
it_behaves_like "it runs" it_behaves_like "it runs"
end end
context "the executable raises" do context "the executable raises", :bundler => "< 2" do
let(:executable) { super() << "\nraise 'ERROR'" }
let(:exit_code) { 1 }
let(:expected) { super() << "\nbundler: failed to load command: #{path} (#{path})" }
let(:expected_err) do
"RuntimeError: ERROR\n #{path}:10" +
(Bundler.current_ruby.ruby_18? ? "" : ":in `<top (required)>'")
end
it_behaves_like "it runs"
end
context "the executable raises", :bundler => "2" do
let(:executable) { super() << "\nraise 'ERROR'" } let(:executable) { super() << "\nraise 'ERROR'" }
let(:exit_code) { 1 } let(:exit_code) { 1 }
let(:expected_err) do let(:expected_err) do
@ -589,7 +615,16 @@ RSpec.describe "bundle exec" do
it_behaves_like "it runs" it_behaves_like "it runs"
end end
context "the executable raises an error without a backtrace" do context "the executable raises an error without a backtrace", :bundler => "< 2" do
let(:executable) { super() << "\nclass Err < Exception\ndef backtrace; end;\nend\nraise Err" }
let(:exit_code) { 1 }
let(:expected) { super() << "\nbundler: failed to load command: #{path} (#{path})" }
let(:expected_err) { "Err: Err" }
it_behaves_like "it runs"
end
context "the executable raises an error without a backtrace", :bundler => "2" do
let(:executable) { super() << "\nclass Err < Exception\ndef backtrace; end;\nend\nraise Err" } let(:executable) { super() << "\nclass Err < Exception\ndef backtrace; end;\nend\nraise Err" }
let(:exit_code) { 1 } let(:exit_code) { 1 }
let(:expected_err) { "bundler: failed to load command: #{path} (#{path})\nErr: Err" } let(:expected_err) { "bundler: failed to load command: #{path} (#{path})\nErr: Err" }
@ -603,7 +638,7 @@ RSpec.describe "bundle exec" do
it_behaves_like "it runs" it_behaves_like "it runs"
end end
context "when Bundler.setup fails", :bundler => "< 3" do context "when Bundler.setup fails", :bundler => "< 2" do
before do before do
gemfile <<-G gemfile <<-G
gem 'rack', '2' gem 'rack', '2'
@ -620,7 +655,7 @@ RSpec.describe "bundle exec" do
it_behaves_like "it runs" it_behaves_like "it runs"
end end
context "when Bundler.setup fails", :bundler => "3" do context "when Bundler.setup fails", :bundler => "2" do
before do before do
gemfile <<-G gemfile <<-G
gem 'rack', '2' gem 'rack', '2'

View File

@ -1,19 +1,19 @@
# frozen_string_literal: true # frozen_string_literal: true
RSpec.describe "bundle init" do RSpec.describe "bundle init" do
it "generates a Gemfile", :bundler => "< 3" do it "generates a Gemfile", :bundler => "< 2" do
bundle! :init bundle! :init
expect(out).to include("Writing new Gemfile") expect(out).to include("Writing new Gemfile")
expect(bundled_app("Gemfile")).to be_file expect(bundled_app("Gemfile")).to be_file
end end
it "generates a gems.rb", :bundler => "3" do it "generates a gems.rb", :bundler => "2" do
bundle! :init bundle! :init
expect(out).to include("Writing new gems.rb") expect(out).to include("Writing new gems.rb")
expect(bundled_app("gems.rb")).to be_file expect(bundled_app("gems.rb")).to be_file
end end
context "when a Gemfile already exists", :bundler => "< 3" do context "when a Gemfile already exists", :bundler => "< 2" do
before do before do
create_file "Gemfile", <<-G create_file "Gemfile", <<-G
gem "rails" gem "rails"
@ -30,7 +30,7 @@ RSpec.describe "bundle init" do
end end
end end
context "when gems.rb already exists", :bundler => ">= 3" do context "when gems.rb already exists", :bundler => ">= 2" do
before do before do
create_file("gems.rb", <<-G) create_file("gems.rb", <<-G)
gem "rails" gem "rails"
@ -47,7 +47,7 @@ RSpec.describe "bundle init" do
end end
end end
context "when a Gemfile exists in a parent directory", :bundler => "< 3" do context "when a Gemfile exists in a parent directory", :bundler => "< 2" do
let(:subdir) { "child_dir" } let(:subdir) { "child_dir" }
it "lets users generate a Gemfile in a child directory" do it "lets users generate a Gemfile in a child directory" do
@ -82,7 +82,7 @@ RSpec.describe "bundle init" do
end end
end end
context "when a gems.rb file exists in a parent directory", :bundler => ">= 3" do context "when a gems.rb file exists in a parent directory", :bundler => ">= 2" do
let(:subdir) { "child_dir" } let(:subdir) { "child_dir" }
it "lets users generate a Gemfile in a child directory" do it "lets users generate a Gemfile in a child directory" do
@ -99,7 +99,7 @@ RSpec.describe "bundle init" do
end end
end end
context "given --gemspec option", :bundler => "< 3" do context "given --gemspec option", :bundler => "< 2" do
let(:spec_file) { tmp.join("test.gemspec") } let(:spec_file) { tmp.join("test.gemspec") }
it "should generate from an existing gemspec" do it "should generate from an existing gemspec" do
@ -115,7 +115,7 @@ RSpec.describe "bundle init" do
bundle :init, :gemspec => spec_file bundle :init, :gemspec => spec_file
gemfile = if Bundler::VERSION[0, 2].to_i < 3 gemfile = if Bundler::VERSION[0, 2] == "1."
bundled_app("Gemfile").read bundled_app("Gemfile").read
else else
bundled_app("gems.rb").read bundled_app("gems.rb").read
@ -146,7 +146,7 @@ RSpec.describe "bundle init" do
context "when init_gems_rb setting is enabled" do context "when init_gems_rb setting is enabled" do
before { bundle "config init_gems_rb true" } before { bundle "config init_gems_rb true" }
context "given --gemspec option", :bundler => "< 3" do context "given --gemspec option", :bundler => "< 2" do
let(:spec_file) { tmp.join("test.gemspec") } let(:spec_file) { tmp.join("test.gemspec") }
before do before do

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
RSpec.describe "bundle inject", :bundler => "< 3" do RSpec.describe "bundle inject", :bundler => "< 2" do
before :each do before :each do
gemfile <<-G gemfile <<-G
source "file://#{gem_repo1}" source "file://#{gem_repo1}"
@ -79,7 +79,7 @@ Usage: "bundle inject GEM VERSION"
context "when frozen" do context "when frozen" do
before do before do
bundle "install" bundle "install"
if Bundler.feature_flag.bundler_3_mode? if Bundler.feature_flag.bundler_2_mode?
bundle! "config --local deployment true" bundle! "config --local deployment true"
else else
bundle! "config --local frozen true" bundle! "config --local frozen true"

View File

@ -29,7 +29,7 @@ RSpec.describe "bundle install with gem sources" do
expect(bundled_app("Gemfile.lock")).to exist expect(bundled_app("Gemfile.lock")).to exist
end end
it "does not create ./.bundle by default", :bundler => "< 3" do it "does not create ./.bundle by default", :bundler => "< 2" do
gemfile <<-G gemfile <<-G
source "file://#{gem_repo1}" source "file://#{gem_repo1}"
gem "rack" gem "rack"
@ -275,14 +275,14 @@ RSpec.describe "bundle install with gem sources" do
expect(the_bundle).to include_gems "rack 1.0" expect(the_bundle).to include_gems "rack 1.0"
end end
it "allows running bundle install --system without deleting foo", :bundler => "< 3" do it "allows running bundle install --system without deleting foo", :bundler => "< 2" do
bundle "install", forgotten_command_line_options(:path => "vendor") bundle "install", forgotten_command_line_options(:path => "vendor")
bundle "install", forgotten_command_line_options(:system => true) bundle "install", forgotten_command_line_options(:system => true)
FileUtils.rm_rf(bundled_app("vendor")) FileUtils.rm_rf(bundled_app("vendor"))
expect(the_bundle).to include_gems "rack 1.0" expect(the_bundle).to include_gems "rack 1.0"
end end
it "allows running bundle install --system after deleting foo", :bundler => "< 3" do it "allows running bundle install --system after deleting foo", :bundler => "< 2" do
bundle "install", forgotten_command_line_options(:path => "vendor") bundle "install", forgotten_command_line_options(:path => "vendor")
FileUtils.rm_rf(bundled_app("vendor")) FileUtils.rm_rf(bundled_app("vendor"))
bundle "install", forgotten_command_line_options(:system => true) bundle "install", forgotten_command_line_options(:system => true)
@ -290,7 +290,7 @@ RSpec.describe "bundle install with gem sources" do
end end
end end
it "finds gems in multiple sources", :bundler => "< 3" do it "finds gems in multiple sources", :bundler => "< 2" do
build_repo2 build_repo2
update_repo2 update_repo2

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
RSpec.describe "bundle list", :bundler => "3" do RSpec.describe "bundle list", :bundler => "2" do
before do before do
install_gemfile <<-G install_gemfile <<-G
source "file://#{gem_repo1}" source "file://#{gem_repo1}"

View File

@ -407,7 +407,7 @@ RSpec.describe "bundle outdated" do
expect(out).to include("Installing foo 1.0") expect(out).to include("Installing foo 1.0")
end end
context "after bundle install --deployment", :bundler => "< 3" do context "after bundle install --deployment", :bundler => "< 2" do
before do before do
install_gemfile <<-G, forgotten_command_line_options(:deployment => true) install_gemfile <<-G, forgotten_command_line_options(:deployment => true)
source "file://#{gem_repo2}" source "file://#{gem_repo2}"

View File

@ -141,7 +141,7 @@ RSpec.describe "bundle package" do
end end
end end
context "with --path", :bundler => "< 3" do context "with --path", :bundler => "< 2" do
it "sets root directory for gems" do it "sets root directory for gems" do
gemfile <<-D gemfile <<-D
source "file://#{gem_repo1}" source "file://#{gem_repo1}"

View File

@ -49,7 +49,7 @@ RSpec.describe "bundle pristine", :ruby_repo do
bundle! "pristine", :system_bundler => true bundle! "pristine", :system_bundler => true
bundle! "-v", :system_bundler => true bundle! "-v", :system_bundler => true
expected = if Bundler::VERSION < "3.0" expected = if Bundler::VERSION < "2.0"
"Bundler version" "Bundler version"
else else
Bundler::VERSION Bundler::VERSION

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
RSpec.describe "bundle show", :bundler => "< 3", :ruby => ">= 2.0" do RSpec.describe "bundle show", :bundler => "< 2", :ruby => ">= 2.0" do
context "with a standard Gemfile" do context "with a standard Gemfile" do
before :each do before :each do
install_gemfile <<-G install_gemfile <<-G
@ -36,7 +36,7 @@ RSpec.describe "bundle show", :bundler => "< 3", :ruby => ">= 2.0" do
it "prints path if gem exists in bundle" do it "prints path if gem exists in bundle" do
bundle "show rails" bundle "show rails"
expect(out).to eq( expect(out).to eq(
"[DEPRECATED FOR 3.0] use `bundle info rails` instead of `bundle show rails`\n" + "[DEPRECATED FOR 2.0] use `bundle info rails` instead of `bundle show rails`\n" +
default_bundle_path("gems", "rails-2.3.2").to_s default_bundle_path("gems", "rails-2.3.2").to_s
) )
end end
@ -44,7 +44,7 @@ RSpec.describe "bundle show", :bundler => "< 3", :ruby => ">= 2.0" do
it "prints the path to the running bundler" do it "prints the path to the running bundler" do
bundle "show bundler" bundle "show bundler"
expect(out).to eq( expect(out).to eq(
"[DEPRECATED FOR 3.0] use `bundle info bundler` instead of `bundle show bundler`\n" + "[DEPRECATED FOR 2.0] use `bundle info bundler` instead of `bundle show bundler`\n" +
root.to_s root.to_s
) )
end end
@ -52,7 +52,7 @@ RSpec.describe "bundle show", :bundler => "< 3", :ruby => ">= 2.0" do
it "prints path if gem exists in bundle (with --paths option)" do it "prints path if gem exists in bundle (with --paths option)" do
bundle "show rails --paths" bundle "show rails --paths"
expect(out).to eq( expect(out).to eq(
"[DEPRECATED FOR 3.0] use `bundle info rails --path` instead of `bundle show rails --paths`\n" + "[DEPRECATED FOR 2.0] use `bundle info rails --path` instead of `bundle show rails --paths`\n" +
default_bundle_path("gems", "rails-2.3.2").to_s default_bundle_path("gems", "rails-2.3.2").to_s
) )
end end
@ -64,7 +64,7 @@ RSpec.describe "bundle show", :bundler => "< 3", :ruby => ">= 2.0" do
expect(out).to include(default_bundle_path("gems", "rails-2.3.2").to_s) expect(out).to include(default_bundle_path("gems", "rails-2.3.2").to_s)
out_lines = out.split("\n") out_lines = out.split("\n")
expect(out_lines[0]).to eq("[DEPRECATED FOR 3.0] use `bundle list` instead of `bundle show --paths`") expect(out_lines[0]).to eq("[DEPRECATED FOR 2.0] use `bundle list` instead of `bundle show --paths`")
# Gem names are the last component of their path. # Gem names are the last component of their path.
gem_list = out_lines[1..-1].map {|p| p.split("/").last } gem_list = out_lines[1..-1].map {|p| p.split("/").last }

View File

@ -11,7 +11,7 @@ RSpec.describe "bundle update" do
G G
end end
describe "with no arguments", :bundler => "< 3" do describe "with no arguments", :bundler => "< 2" do
it "updates the entire bundle" do it "updates the entire bundle" do
update_repo2 do update_repo2 do
build_gem "activesupport", "3.0" build_gem "activesupport", "3.0"
@ -34,7 +34,7 @@ RSpec.describe "bundle update" do
end end
end end
describe "with --all", :bundler => "3" do describe "with --all", :bundler => "2" do
it "updates the entire bundle" do it "updates the entire bundle" do
update_repo2 do update_repo2 do
build_gem "activesupport", "3.0" build_gem "activesupport", "3.0"
@ -279,7 +279,7 @@ RSpec.describe "bundle update" do
end end
describe "in a frozen bundle" do describe "in a frozen bundle" do
it "should fail loudly", :bundler => "< 3" do it "should fail loudly", :bundler => "< 2" do
bundle! "install --deployment" bundle! "install --deployment"
bundle "update", :all => bundle_update_requires_all? bundle "update", :all => bundle_update_requires_all?
@ -288,14 +288,14 @@ RSpec.describe "bundle update" do
expect(out).to match(/freeze \nby running `bundle install --no-deployment`./m) expect(out).to match(/freeze \nby running `bundle install --no-deployment`./m)
end end
it "should suggest different command when frozen is set globally", :bundler => "< 3" do it "should suggest different command when frozen is set globally", :bundler => "< 2" do
bundle! "config --global frozen 1" bundle! "config --global frozen 1"
bundle "update", :all => bundle_update_requires_all? bundle "update", :all => bundle_update_requires_all?
expect(out).to match(/You are trying to install in deployment mode after changing.your Gemfile/m). expect(out).to match(/You are trying to install in deployment mode after changing.your Gemfile/m).
and match(/freeze \nby running `bundle config --delete frozen`./m) and match(/freeze \nby running `bundle config --delete frozen`./m)
end end
it "should suggest different command when frozen is set globally", :bundler => "3" do it "should suggest different command when frozen is set globally", :bundler => "2" do
bundle! "config --global deployment true" bundle! "config --global deployment true"
bundle "update", :all => bundle_update_requires_all? bundle "update", :all => bundle_update_requires_all?
expect(out).to match(/You are trying to install in deployment mode after changing.your Gemfile/m). expect(out).to match(/You are trying to install in deployment mode after changing.your Gemfile/m).
@ -304,7 +304,7 @@ RSpec.describe "bundle update" do
end end
describe "with --source option" do describe "with --source option" do
it "should not update gems not included in the source that happen to have the same name", :bundler => "< 3" do it "should not update gems not included in the source that happen to have the same name", :bundler => "< 2" do
install_gemfile! <<-G install_gemfile! <<-G
source "file://#{gem_repo2}" source "file://#{gem_repo2}"
gem "activesupport" gem "activesupport"
@ -315,7 +315,7 @@ RSpec.describe "bundle update" do
expect(the_bundle).to include_gem "activesupport 3.0" expect(the_bundle).to include_gem "activesupport 3.0"
end end
it "should not update gems not included in the source that happen to have the same name", :bundler => "3" do it "should not update gems not included in the source that happen to have the same name", :bundler => "2" do
install_gemfile! <<-G install_gemfile! <<-G
source "file://#{gem_repo2}" source "file://#{gem_repo2}"
gem "activesupport" gem "activesupport"
@ -358,7 +358,7 @@ RSpec.describe "bundle update" do
G G
end end
it "should not update the child dependencies of a gem that has the same name as the source", :bundler => "< 3" do it "should not update the child dependencies of a gem that has the same name as the source", :bundler => "< 2" do
update_repo2 do update_repo2 do
build_gem "fred", "2.0" build_gem "fred", "2.0"
build_gem "harry", "2.0" do |s| build_gem "harry", "2.0" do |s|
@ -371,7 +371,7 @@ RSpec.describe "bundle update" do
expect(the_bundle).to include_gems "fred 1.0" expect(the_bundle).to include_gems "fred 1.0"
end end
it "should not update the child dependencies of a gem that has the same name as the source", :bundler => "3" do it "should not update the child dependencies of a gem that has the same name as the source", :bundler => "2" do
update_repo2 do update_repo2 do
build_gem "fred", "2.0" build_gem "fred", "2.0"
build_gem "harry", "2.0" do |s| build_gem "harry", "2.0" do |s|
@ -403,7 +403,7 @@ RSpec.describe "bundle update" do
G G
end end
it "should not update the child dependencies of a gem that has the same name as the source", :bundler => "< 3" do it "should not update the child dependencies of a gem that has the same name as the source", :bundler => "< 2" do
update_repo2 do update_repo2 do
build_gem "george", "2.0" build_gem "george", "2.0"
build_gem "harry", "2.0" do |s| build_gem "harry", "2.0" do |s|
@ -417,7 +417,7 @@ RSpec.describe "bundle update" do
expect(the_bundle).to include_gems "george 1.0" expect(the_bundle).to include_gems "george 1.0"
end end
it "should not update the child dependencies of a gem that has the same name as the source", :bundler => "3" do it "should not update the child dependencies of a gem that has the same name as the source", :bundler => "2" do
update_repo2 do update_repo2 do
build_gem "george", "2.0" build_gem "george", "2.0"
build_gem "harry", "2.0" do |s| build_gem "harry", "2.0" do |s|
@ -561,14 +561,14 @@ RSpec.describe "bundle update when a gem depends on a newer version of bundler"
G G
end end
it "should explain that bundler conflicted", :bundler => "< 3" do it "should explain that bundler conflicted", :bundler => "< 2" do
bundle "update", :all => bundle_update_requires_all? bundle "update", :all => bundle_update_requires_all?
expect(last_command.stdboth).not_to match(/in snapshot/i) expect(last_command.stdboth).not_to match(/in snapshot/i)
expect(last_command.bundler_err).to match(/current Bundler version/i). expect(last_command.bundler_err).to match(/current Bundler version/i).
and match(/perhaps you need to update bundler/i) and match(/perhaps you need to update bundler/i)
end end
it "should warn that the newer version of Bundler would conflict", :bundler => "3" do it "should warn that the newer version of Bundler would conflict", :bundler => "2" do
bundle! "update", :all => true bundle! "update", :all => true
expect(last_command.bundler_err).to include("rails (3.0.1) has dependency bundler"). expect(last_command.bundler_err).to include("rails (3.0.1) has dependency bundler").
and include("so the dependency is being ignored") and include("so the dependency is being ignored")
@ -577,7 +577,7 @@ RSpec.describe "bundle update when a gem depends on a newer version of bundler"
end end
RSpec.describe "bundle update" do RSpec.describe "bundle update" do
it "shows the previous version of the gem when updated from rubygems source", :bundler => "< 3" do it "shows the previous version of the gem when updated from rubygems source", :bundler => "< 2" do
build_repo2 build_repo2
install_gemfile <<-G install_gemfile <<-G

View File

@ -2,36 +2,36 @@
RSpec.describe "bundle version" do RSpec.describe "bundle version" do
context "with -v" do context "with -v" do
it "outputs the version", :bundler => "< 3" do it "outputs the version", :bundler => "< 2" do
bundle! "-v" bundle! "-v"
expect(out).to eq("Bundler version #{Bundler::VERSION}") expect(out).to eq("Bundler version #{Bundler::VERSION}")
end end
it "outputs the version", :bundler => "3" do it "outputs the version", :bundler => "2" do
bundle! "-v" bundle! "-v"
expect(out).to eq(Bundler::VERSION) expect(out).to eq(Bundler::VERSION)
end end
end end
context "with --version" do context "with --version" do
it "outputs the version", :bundler => "< 3" do it "outputs the version", :bundler => "< 2" do
bundle! "--version" bundle! "--version"
expect(out).to eq("Bundler version #{Bundler::VERSION}") expect(out).to eq("Bundler version #{Bundler::VERSION}")
end end
it "outputs the version", :bundler => "3" do it "outputs the version", :bundler => "2" do
bundle! "--version" bundle! "--version"
expect(out).to eq(Bundler::VERSION) expect(out).to eq(Bundler::VERSION)
end end
end end
context "with version" do context "with version" do
it "outputs the version with build metadata", :bundler => "< 3" do it "outputs the version with build metadata", :bundler => "< 2" do
bundle! "version" bundle! "version"
expect(out).to match(/\ABundler version #{Regexp.escape(Bundler::VERSION)} \(\d{4}-\d{2}-\d{2} commit [a-fA-F0-9]{7,}\)\z/) expect(out).to match(/\ABundler version #{Regexp.escape(Bundler::VERSION)} \(\d{4}-\d{2}-\d{2} commit [a-fA-F0-9]{7,}\)\z/)
end end
it "outputs the version with build metadata", :bundler => "3" do it "outputs the version with build metadata", :bundler => "2" do
bundle! "version" bundle! "version"
expect(out).to match(/\A#{Regexp.escape(Bundler::VERSION)} \(\d{4}-\d{2}-\d{2} commit [a-fA-F0-9]{7,}\)\z/) expect(out).to match(/\A#{Regexp.escape(Bundler::VERSION)} \(\d{4}-\d{2}-\d{2} commit [a-fA-F0-9]{7,}\)\z/)
end end

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
RSpec.describe "bundle viz", :ruby => "1.9.3", :bundler => "< 3", :if => Bundler.which("dot") do RSpec.describe "bundle viz", :ruby => "1.9.3", :bundler => "< 2", :if => Bundler.which("dot") do
let(:ruby_graphviz) do let(:ruby_graphviz) do
graphviz_glob = base_system_gems.join("cache/ruby-graphviz*") graphviz_glob = base_system_gems.join("cache/ruby-graphviz*")
Pathname.glob(graphviz_glob).first Pathname.glob(graphviz_glob).first

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
RSpec.describe "bundle install", :bundler => "< 3" do RSpec.describe "bundle install", :bundler => "< 2" do
describe "when system_bindir is set" do describe "when system_bindir is set" do
# On OS X, Gem.bindir defaults to /usr/bin, so system_bindir is useful if # On OS X, Gem.bindir defaults to /usr/bin, so system_bindir is useful if
# you want to avoid sudo installs for system gems with OS X's default ruby # you want to avoid sudo installs for system gems with OS X's default ruby
@ -20,7 +20,7 @@ RSpec.describe "bundle install", :bundler => "< 3" do
end end
end end
describe "when multiple gems contain the same exe", :bundler => "< 3" do describe "when multiple gems contain the same exe", :bundler => "< 2" do
before do before do
build_repo2 do build_repo2 do
build_gem "fake", "14" do |s| build_gem "fake", "14" do |s|

View File

@ -8,7 +8,7 @@ RSpec.describe "install with --deployment or --frozen" do
G G
end end
context "with CLI flags", :bundler => "< 3" do context "with CLI flags", :bundler => "< 2" do
it "fails without a lockfile and says that --deployment requires a lock" do it "fails without a lockfile and says that --deployment requires a lock" do
bundle "install --deployment" bundle "install --deployment"
expect(out).to include("The --deployment flag requires a Gemfile.lock") expect(out).to include("The --deployment flag requires a Gemfile.lock")
@ -109,11 +109,11 @@ RSpec.describe "install with --deployment or --frozen" do
bundle "install" bundle "install"
end end
it "works with the --deployment flag if you didn't change anything", :bundler => "< 3" do it "works with the --deployment flag if you didn't change anything", :bundler => "< 2" do
bundle! "install --deployment" bundle! "install --deployment"
end end
it "works with the --frozen flag if you didn't change anything", :bundler => "< 3" do it "works with the --frozen flag if you didn't change anything", :bundler => "< 2" do
bundle! "install --frozen" bundle! "install --frozen"
end end
@ -165,7 +165,7 @@ RSpec.describe "install with --deployment or --frozen" do
expect(out).to include("The path `#{lib_path("path_gem-1.0")}` does not exist.") expect(out).to include("The path `#{lib_path("path_gem-1.0")}` does not exist.")
end end
it "can have --frozen set via an environment variable", :bundler => "< 3" do it "can have --frozen set via an environment variable", :bundler => "< 2" do
gemfile <<-G gemfile <<-G
source "file://#{gem_repo1}" source "file://#{gem_repo1}"
gem "rack" gem "rack"
@ -297,7 +297,7 @@ RSpec.describe "install with --deployment or --frozen" do
context "when replacing a host with the same host with credentials" do context "when replacing a host with the same host with credentials" do
let(:success_message) do let(:success_message) do
if Bundler.bundler_major_version < 3 if Bundler::VERSION.split(".", 2).first == "1"
"Could not reach host localgemserver.test" "Could not reach host localgemserver.test"
else else
"Bundle complete!" "Bundle complete!"

View File

@ -433,7 +433,7 @@ RSpec.describe "bundle install from an existing gemspec" do
end end
end end
context "on ruby", :bundler => "< 3" do context "on ruby", :bundler => "< 2" do
before do before do
simulate_platform("ruby") simulate_platform("ruby")
bundle :install bundle :install
@ -534,7 +534,7 @@ RSpec.describe "bundle install from an existing gemspec" do
end end
end end
context "on ruby", :bundler => "3" do context "on ruby", :bundler => "2" do
before do before do
simulate_platform("ruby") simulate_platform("ruby")
bundle :install bundle :install

View File

@ -26,7 +26,7 @@ RSpec.describe "bundle install with git sources" do
expect(out).to eq("WIN") expect(out).to eq("WIN")
end end
it "caches the git repo", :bundler => "< 3" do it "caches the git repo", :bundler => "< 2" do
expect(Dir["#{default_bundle_path}/cache/bundler/git/foo-1.0-*"]).to have_attributes :size => 1 expect(Dir["#{default_bundle_path}/cache/bundler/git/foo-1.0-*"]).to have_attributes :size => 1
end end

View File

@ -192,19 +192,19 @@ RSpec.describe "bundle install with groups" do
expect(the_bundle).not_to include_gems "thin 1.0" expect(the_bundle).not_to include_gems "thin 1.0"
end end
it "does remove groups from without when passed at --with", :bundler => "< 3" do it "does remove groups from without when passed at --with", :bundler => "< 2" do
bundle :install, forgotten_command_line_options(:without => "emo") bundle :install, forgotten_command_line_options(:without => "emo")
bundle :install, forgotten_command_line_options(:with => "emo") bundle :install, forgotten_command_line_options(:with => "emo")
expect(the_bundle).to include_gems "activesupport 2.3.5" expect(the_bundle).to include_gems "activesupport 2.3.5"
end end
it "does remove groups from with when passed at --without", :bundler => "< 3" do it "does remove groups from with when passed at --without", :bundler => "< 2" do
bundle :install, forgotten_command_line_options(:with => "debugging") bundle :install, forgotten_command_line_options(:with => "debugging")
bundle :install, forgotten_command_line_options(:without => "debugging") bundle :install, forgotten_command_line_options(:without => "debugging")
expect(the_bundle).not_to include_gem "thin 1.0" expect(the_bundle).not_to include_gem "thin 1.0"
end end
it "errors out when passing a group to with and without via CLI flags", :bundler => "< 3" do it "errors out when passing a group to with and without via CLI flags", :bundler => "< 2" do
bundle :install, forgotten_command_line_options(:with => "emo debugging", :without => "emo") bundle :install, forgotten_command_line_options(:with => "emo debugging", :without => "emo")
expect(last_command).to be_failure expect(last_command).to be_failure
expect(out).to include("The offending groups are: emo") expect(out).to include("The offending groups are: emo")

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
RSpec.describe "bundle install with explicit source paths" do RSpec.describe "bundle install with explicit source paths" do
it "fetches gems with a global path source", :bundler => "< 3" do it "fetches gems with a global path source", :bundler => "< 2" do
build_lib "foo" build_lib "foo"
install_gemfile <<-G install_gemfile <<-G

View File

@ -230,7 +230,7 @@ RSpec.describe "bundle install across platforms" do
expect(the_bundle).to include_gems "nokogiri 1.4.2 JAVA", "weakling 0.0.3" expect(the_bundle).to include_gems "nokogiri 1.4.2 JAVA", "weakling 0.0.3"
end end
it "works with gems that have extra platform-specific runtime dependencies", :bundler => "< 3" do it "works with gems that have extra platform-specific runtime dependencies", :bundler => "< 2" do
simulate_platform x64_mac simulate_platform x64_mac
update_repo2 do update_repo2 do

View File

@ -28,7 +28,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
bundle "config major_deprecations true" bundle "config major_deprecations true"
end end
it "warns about ambiguous gems, but installs anyway, prioritizing sources last to first", :bundler => "< 3" do it "warns about ambiguous gems, but installs anyway, prioritizing sources last to first", :bundler => "< 2" do
bundle :install bundle :install
expect(out).to have_major_deprecation a_string_including("Your Gemfile contains multiple primary sources.") expect(out).to have_major_deprecation a_string_including("Your Gemfile contains multiple primary sources.")
@ -58,7 +58,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
bundle "config major_deprecations true" bundle "config major_deprecations true"
end end
it "warns about ambiguous gems, but installs anyway", :bundler => "< 3" do it "warns about ambiguous gems, but installs anyway", :bundler => "< 2" do
bundle :install bundle :install
expect(out).to have_major_deprecation a_string_including("Your Gemfile contains multiple primary sources.") expect(out).to have_major_deprecation a_string_including("Your Gemfile contains multiple primary sources.")
@ -248,7 +248,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
G G
end end
it "installs from the other source and warns about ambiguous gems", :bundler => "< 3" do it "installs from the other source and warns about ambiguous gems", :bundler => "< 2" do
bundle "config major_deprecations true" bundle "config major_deprecations true"
bundle :install bundle :install
expect(out).to have_major_deprecation a_string_including("Your Gemfile contains multiple primary sources.") expect(out).to have_major_deprecation a_string_including("Your Gemfile contains multiple primary sources.")
@ -276,7 +276,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
G G
end end
it "installs the dependency from the pinned source without warning", :bundler => "< 3" do it "installs the dependency from the pinned source without warning", :bundler => "< 2" do
bundle :install bundle :install
expect(out).not_to include("Warning: the gem 'rack' was found in multiple sources.") expect(out).not_to include("Warning: the gem 'rack' was found in multiple sources.")

View File

@ -269,7 +269,7 @@ The checksum of /versions does not match the checksum provided by the server! So
expect(last_command.stdboth).not_to include "Double checking" expect(last_command.stdboth).not_to include "Double checking"
end end
it "fetches again when more dependencies are found in subsequent sources", :bundler => "< 3" do it "fetches again when more dependencies are found in subsequent sources", :bundler => "< 2" do
build_repo2 do build_repo2 do
build_gem "back_deps" do |s| build_gem "back_deps" do |s|
s.add_dependency "foo" s.add_dependency "foo"
@ -328,7 +328,7 @@ The checksum of /versions does not match the checksum provided by the server! So
expect(the_bundle).to include_gems "rack 1.2" expect(the_bundle).to include_gems "rack 1.2"
end end
it "considers all possible versions of dependencies from all api gem sources", :bundler => "< 3" do it "considers all possible versions of dependencies from all api gem sources", :bundler => "< 2" do
# In this scenario, the gem "somegem" only exists in repo4. It depends on specific version of activesupport that # In this scenario, the gem "somegem" only exists in repo4. It depends on specific version of activesupport that
# exists only in repo1. There happens also be a version of activesupport in repo4, but not the one that version 1.0.0 # exists only in repo1. There happens also be a version of activesupport in repo4, but not the one that version 1.0.0
# of somegem wants. This test makes sure that bundler actually finds version 1.2.3 of active support in the other # of somegem wants. This test makes sure that bundler actually finds version 1.2.3 of active support in the other
@ -352,7 +352,7 @@ The checksum of /versions does not match the checksum provided by the server! So
expect(the_bundle).to include_gems "activesupport 1.2.3" expect(the_bundle).to include_gems "activesupport 1.2.3"
end end
it "considers all possible versions of dependencies from all api gem sources when using blocks", :bundler => "< 3" do it "considers all possible versions of dependencies from all api gem sources when using blocks", :bundler => "< 2" do
# In this scenario, the gem "somegem" only exists in repo4. It depends on specific version of activesupport that # In this scenario, the gem "somegem" only exists in repo4. It depends on specific version of activesupport that
# exists only in repo1. There happens also be a version of activesupport in repo4, but not the one that version 1.0.0 # exists only in repo1. There happens also be a version of activesupport in repo4, but not the one that version 1.0.0
# of somegem wants. This test makes sure that bundler actually finds version 1.2.3 of active support in the other # of somegem wants. This test makes sure that bundler actually finds version 1.2.3 of active support in the other
@ -458,7 +458,7 @@ The checksum of /versions does not match the checksum provided by the server! So
expect(the_bundle).to include_gems "foo 1.0" expect(the_bundle).to include_gems "foo 1.0"
end end
it "fetches again when more dependencies are found in subsequent sources using --deployment", :bundler => "< 3" do it "fetches again when more dependencies are found in subsequent sources using --deployment", :bundler => "< 2" do
build_repo2 do build_repo2 do
build_gem "back_deps" do |s| build_gem "back_deps" do |s|
s.add_dependency "foo" s.add_dependency "foo"
@ -522,7 +522,7 @@ The checksum of /versions does not match the checksum provided by the server! So
expect(the_bundle).to include_gems "rails 2.3.2" expect(the_bundle).to include_gems "rails 2.3.2"
end end
it "installs the binstubs", :bundler => "< 3" do it "installs the binstubs", :bundler => "< 2" do
gemfile <<-G gemfile <<-G
source "#{source_uri}" source "#{source_uri}"
gem "rack" gem "rack"
@ -534,7 +534,7 @@ The checksum of /versions does not match the checksum provided by the server! So
expect(out).to eq("1.0.0") expect(out).to eq("1.0.0")
end end
it "installs the bins when using --path and uses autoclean", :bundler => "< 3" do it "installs the bins when using --path and uses autoclean", :bundler => "< 2" do
gemfile <<-G gemfile <<-G
source "#{source_uri}" source "#{source_uri}"
gem "rack" gem "rack"
@ -545,7 +545,7 @@ The checksum of /versions does not match the checksum provided by the server! So
expect(vendored_gems("bin/rackup")).to exist expect(vendored_gems("bin/rackup")).to exist
end end
it "installs the bins when using --path and uses bundle clean", :bundler => "< 3" do it "installs the bins when using --path and uses bundle clean", :bundler => "< 2" do
gemfile <<-G gemfile <<-G
source "#{source_uri}" source "#{source_uri}"
gem "rack" gem "rack"
@ -620,7 +620,7 @@ The checksum of /versions does not match the checksum provided by the server! So
expect(out).not_to include("#{user}:#{password}") expect(out).not_to include("#{user}:#{password}")
end end
it "strips http basic auth creds when warning about ambiguous sources", :bundler => "< 3" do it "strips http basic auth creds when warning about ambiguous sources", :bundler => "< 2" do
gemfile <<-G gemfile <<-G
source "#{basic_auth_source_uri}" source "#{basic_auth_source_uri}"
source "file://#{gem_repo1}" source "file://#{gem_repo1}"

View File

@ -243,7 +243,7 @@ RSpec.describe "gemcutter's dependency API" do
end end
end end
it "fetches again when more dependencies are found in subsequent sources", :bundler => "< 3" do it "fetches again when more dependencies are found in subsequent sources", :bundler => "< 2" do
build_repo2 do build_repo2 do
build_gem "back_deps" do |s| build_gem "back_deps" do |s|
s.add_dependency "foo" s.add_dependency "foo"
@ -302,7 +302,7 @@ RSpec.describe "gemcutter's dependency API" do
expect(the_bundle).to include_gems "rack 1.2" expect(the_bundle).to include_gems "rack 1.2"
end end
it "considers all possible versions of dependencies from all api gem sources", :bundler => "< 3" do it "considers all possible versions of dependencies from all api gem sources", :bundler => "< 2" do
# In this scenario, the gem "somegem" only exists in repo4. It depends on specific version of activesupport that # In this scenario, the gem "somegem" only exists in repo4. It depends on specific version of activesupport that
# exists only in repo1. There happens also be a version of activesupport in repo4, but not the one that version 1.0.0 # exists only in repo1. There happens also be a version of activesupport in repo4, but not the one that version 1.0.0
# of somegem wants. This test makes sure that bundler actually finds version 1.2.3 of active support in the other # of somegem wants. This test makes sure that bundler actually finds version 1.2.3 of active support in the other
@ -372,7 +372,7 @@ RSpec.describe "gemcutter's dependency API" do
expect(out).to include("Fetching source index from http://localgemserver.test/extra") expect(out).to include("Fetching source index from http://localgemserver.test/extra")
end end
it "does not fetch every spec if the index of gems is large when doing back deps", :bundler => "< 3" do it "does not fetch every spec if the index of gems is large when doing back deps", :bundler => "< 2" do
build_repo2 do build_repo2 do
build_gem "back_deps" do |s| build_gem "back_deps" do |s|
s.add_dependency "foo" s.add_dependency "foo"
@ -432,7 +432,7 @@ RSpec.describe "gemcutter's dependency API" do
expect(the_bundle).to include_gems "foo 1.0" expect(the_bundle).to include_gems "foo 1.0"
end end
it "fetches again when more dependencies are found in subsequent sources using --deployment", :bundler => "< 3" do it "fetches again when more dependencies are found in subsequent sources using --deployment", :bundler => "< 2" do
build_repo2 do build_repo2 do
build_gem "back_deps" do |s| build_gem "back_deps" do |s|
s.add_dependency "foo" s.add_dependency "foo"
@ -496,7 +496,7 @@ RSpec.describe "gemcutter's dependency API" do
expect(the_bundle).to include_gems "rails 2.3.2" expect(the_bundle).to include_gems "rails 2.3.2"
end end
it "installs the binstubs", :bundler => "< 3" do it "installs the binstubs", :bundler => "< 2" do
gemfile <<-G gemfile <<-G
source "#{source_uri}" source "#{source_uri}"
gem "rack" gem "rack"
@ -508,7 +508,7 @@ RSpec.describe "gemcutter's dependency API" do
expect(out).to eq("1.0.0") expect(out).to eq("1.0.0")
end end
it "installs the bins when using --path and uses autoclean", :bundler => "< 3" do it "installs the bins when using --path and uses autoclean", :bundler => "< 2" do
gemfile <<-G gemfile <<-G
source "#{source_uri}" source "#{source_uri}"
gem "rack" gem "rack"
@ -519,7 +519,7 @@ RSpec.describe "gemcutter's dependency API" do
expect(vendored_gems("bin/rackup")).to exist expect(vendored_gems("bin/rackup")).to exist
end end
it "installs the bins when using --path and uses bundle clean", :bundler => "< 3" do it "installs the bins when using --path and uses bundle clean", :bundler => "< 2" do
gemfile <<-G gemfile <<-G
source "#{source_uri}" source "#{source_uri}"
gem "rack" gem "rack"
@ -594,7 +594,7 @@ RSpec.describe "gemcutter's dependency API" do
expect(out).not_to include("#{user}:#{password}") expect(out).not_to include("#{user}:#{password}")
end end
it "strips http basic auth creds when warning about ambiguous sources", :bundler => "< 3" do it "strips http basic auth creds when warning about ambiguous sources", :bundler => "< 2" do
gemfile <<-G gemfile <<-G
source "#{basic_auth_source_uri}" source "#{basic_auth_source_uri}"
source "file://#{gem_repo1}" source "file://#{gem_repo1}"

View File

@ -244,7 +244,7 @@ RSpec.describe "bundle flex_install" do
end end
describe "when adding a new source" do describe "when adding a new source" do
it "updates the lockfile", :bundler => "< 3" do it "updates the lockfile", :bundler => "< 2" do
build_repo2 build_repo2
install_gemfile! <<-G install_gemfile! <<-G
source "file://localhost#{gem_repo1}" source "file://localhost#{gem_repo1}"
@ -274,7 +274,7 @@ RSpec.describe "bundle flex_install" do
L L
end end
it "updates the lockfile", :bundler => "3" do it "updates the lockfile", :bundler => "2" do
build_repo2 build_repo2
install_gemfile! <<-G install_gemfile! <<-G
source "file://localhost#{gem_repo1}" source "file://localhost#{gem_repo1}"

View File

@ -197,7 +197,7 @@ RSpec.shared_examples "bundle install --standalone" do
expect(last_command.stderr).to eq("ZOMG LOAD ERROR") expect(last_command.stderr).to eq("ZOMG LOAD ERROR")
end end
it "allows --path to change the location of the standalone bundle", :bundler => "< 3" do it "allows --path to change the location of the standalone bundle", :bundler => "< 2" do
bundle! "install", forgotten_command_line_options(:path => "path/to/bundle").merge(:standalone => true) bundle! "install", forgotten_command_line_options(:path => "path/to/bundle").merge(:standalone => true)
Dir.chdir(bundled_app) do Dir.chdir(bundled_app) do
@ -213,7 +213,7 @@ RSpec.shared_examples "bundle install --standalone" do
expect(last_command.stdout).to eq("2.3.2") expect(last_command.stdout).to eq("2.3.2")
end end
it "allows --path to change the location of the standalone bundle", :bundler => "3" do it "allows --path to change the location of the standalone bundle", :bundler => "2" do
bundle! "install", forgotten_command_line_options(:path => "path/to/bundle").merge(:standalone => true) bundle! "install", forgotten_command_line_options(:path => "path/to/bundle").merge(:standalone => true)
path = File.expand_path("path/to/bundle") path = File.expand_path("path/to/bundle")
@ -273,7 +273,7 @@ RSpec.shared_examples "bundle install --standalone" do
end end
end end
describe "with --binstubs", :bundler => "< 3" do describe "with --binstubs", :bundler => "< 2" do
before do before do
gemfile <<-G gemfile <<-G
source "file://#{gem_repo1}" source "file://#{gem_repo1}"

View File

@ -2,7 +2,7 @@
RSpec.describe "bundle install" do RSpec.describe "bundle install" do
context "git sources" do context "git sources" do
it "displays the revision hash of the gem repository", :bundler => "< 3" do it "displays the revision hash of the gem repository", :bundler => "< 2" do
build_git "foo", "1.0", :path => lib_path("foo") build_git "foo", "1.0", :path => lib_path("foo")
install_gemfile <<-G install_gemfile <<-G
@ -14,7 +14,7 @@ RSpec.describe "bundle install" do
expect(the_bundle).to include_gems "foo 1.0", :source => "git@#{lib_path("foo")}" expect(the_bundle).to include_gems "foo 1.0", :source => "git@#{lib_path("foo")}"
end end
it "displays the ref of the gem repository when using branch~num as a ref", :bundler => "< 3" do it "displays the ref of the gem repository when using branch~num as a ref", :bundler => "< 2" do
build_git "foo", "1.0", :path => lib_path("foo") build_git "foo", "1.0", :path => lib_path("foo")
rev = revision_for(lib_path("foo"))[0..6] rev = revision_for(lib_path("foo"))[0..6]
update_git "foo", "2.0", :path => lib_path("foo"), :gemspec => true update_git "foo", "2.0", :path => lib_path("foo"), :gemspec => true

View File

@ -13,7 +13,7 @@ RSpec.describe "bundle install" do
G G
end end
it "does not use available system gems with bundle --path vendor/bundle", :bundler => "< 3" do it "does not use available system gems with bundle --path vendor/bundle", :bundler => "< 2" do
bundle! :install, forgotten_command_line_options(:path => "vendor/bundle") bundle! :install, forgotten_command_line_options(:path => "vendor/bundle")
expect(the_bundle).to include_gems "rack 1.0.0" expect(the_bundle).to include_gems "rack 1.0.0"
end end
@ -35,13 +35,13 @@ RSpec.describe "bundle install" do
expect(out).to include("gems are installed into `./vendor/bundle`") expect(out).to include("gems are installed into `./vendor/bundle`")
end end
it "disallows --path vendor/bundle --system", :bundler => "< 3" do it "disallows --path vendor/bundle --system", :bundler => "< 2" do
bundle "install --path vendor/bundle --system" bundle "install --path vendor/bundle --system"
expect(out).to include("Please choose only one option.") expect(out).to include("Please choose only one option.")
expect(exitstatus).to eq(15) if exitstatus expect(exitstatus).to eq(15) if exitstatus
end end
it "remembers to disable system gems after the first time with bundle --path vendor/bundle", :bundler => "< 3" do it "remembers to disable system gems after the first time with bundle --path vendor/bundle", :bundler => "< 2" do
bundle "install --path vendor/bundle" bundle "install --path vendor/bundle"
FileUtils.rm_rf bundled_app("vendor") FileUtils.rm_rf bundled_app("vendor")
bundle "install" bundle "install"
@ -53,7 +53,7 @@ RSpec.describe "bundle install" do
context "with path_relative_to_cwd set to true" do context "with path_relative_to_cwd set to true" do
before { bundle! "config path_relative_to_cwd true" } before { bundle! "config path_relative_to_cwd true" }
it "installs the bundle relatively to current working directory", :bundler => "< 3" do it "installs the bundle relatively to current working directory", :bundler => "< 2" do
Dir.chdir(bundled_app.parent) do Dir.chdir(bundled_app.parent) do
bundle! "install --gemfile='#{bundled_app}/Gemfile' --path vendor/bundle" bundle! "install --gemfile='#{bundled_app}/Gemfile' --path vendor/bundle"
expect(out).to include("installed into `./vendor/bundle`") expect(out).to include("installed into `./vendor/bundle`")
@ -113,7 +113,7 @@ RSpec.describe "bundle install" do
expect(the_bundle).to include_gems "rack 1.0.0" expect(the_bundle).to include_gems "rack 1.0.0"
end end
context "with global_path_appends_ruby_scope set", :bundler => "3" do context "with global_path_appends_ruby_scope set", :bundler => "2" do
it "installs gems to ." do it "installs gems to ." do
set_bundle_path(type, ".") set_bundle_path(type, ".")
bundle! "config --global disable_shared_gems true" bundle! "config --global disable_shared_gems true"
@ -147,7 +147,7 @@ RSpec.describe "bundle install" do
end end
end end
context "with global_path_appends_ruby_scope unset", :bundler => "< 3" do context "with global_path_appends_ruby_scope unset", :bundler => "< 2" do
it "installs gems to ." do it "installs gems to ." do
set_bundle_path(type, ".") set_bundle_path(type, ".")
bundle! "config --global disable_shared_gems true" bundle! "config --global disable_shared_gems true"

View File

@ -19,7 +19,7 @@ RSpec.describe "post bundle message" do
let(:bundle_complete_message) { "Bundle complete!" } let(:bundle_complete_message) { "Bundle complete!" }
let(:bundle_updated_message) { "Bundle updated!" } let(:bundle_updated_message) { "Bundle updated!" }
let(:installed_gems_stats) { "4 Gemfile dependencies, 5 gems now installed." } let(:installed_gems_stats) { "4 Gemfile dependencies, 5 gems now installed." }
let(:bundle_show_message) { Bundler::VERSION.split(".").first.to_i < 3 ? bundle_show_system_message : bundle_show_path_message } let(:bundle_show_message) { Bundler::VERSION.split(".").first.to_i < 2 ? bundle_show_system_message : bundle_show_path_message }
describe "for fresh bundle install" do describe "for fresh bundle install" do
it "without any options" do it "without any options" do
@ -101,7 +101,7 @@ RSpec.describe "post bundle message" do
end end
describe "with misspelled or non-existent gem name" do describe "with misspelled or non-existent gem name" do
it "should report a helpful error message", :bundler => "< 3" do it "should report a helpful error message", :bundler => "< 2" do
install_gemfile <<-G install_gemfile <<-G
source "file://localhost#{gem_repo1}" source "file://localhost#{gem_repo1}"
gem "rack" gem "rack"
@ -110,7 +110,7 @@ RSpec.describe "post bundle message" do
expect(out).to include("Could not find gem 'not-a-gem' in any of the gem sources listed in your Gemfile.") expect(out).to include("Could not find gem 'not-a-gem' in any of the gem sources listed in your Gemfile.")
end end
it "should report a helpful error message", :bundler => "3" do it "should report a helpful error message", :bundler => "2" do
install_gemfile <<-G install_gemfile <<-G
source "file://localhost#{gem_repo1}" source "file://localhost#{gem_repo1}"
gem "rack" gem "rack"

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
RSpec.describe "bundle install", :bundler => "< 3", :ruby => ">= 2.0" do RSpec.describe "bundle install", :bundler => "< 2", :ruby => ">= 2.0" do
before :each do before :each do
gemfile <<-G gemfile <<-G
source "file://#{gem_repo1}" source "file://#{gem_repo1}"
@ -65,12 +65,12 @@ RSpec.describe "bundle install", :bundler => "< 3", :ruby => ">= 2.0" do
it "shows a deprecation when single flag passed" do it "shows a deprecation when single flag passed" do
bundle! "install --force" bundle! "install --force"
expect(out).to include "[DEPRECATED FOR 3.0] The `--force` option has been renamed to `--redownload`" expect(out).to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`"
end end
it "shows a deprecation when multiple flags passed" do it "shows a deprecation when multiple flags passed" do
bundle! "install --no-color --force" bundle! "install --no-color --force"
expect(out).to include "[DEPRECATED FOR 3.0] The `--force` option has been renamed to `--redownload`" expect(out).to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`"
end end
end end

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
RSpec.describe "the lockfile format", :bundler => "< 3" do RSpec.describe "the lockfile format", :bundler => "< 2" do
include Bundler::GemHelpers include Bundler::GemHelpers
before { ENV["BUNDLER_SPEC_IGNORE_COMPATIBILITY_GUARD"] = "TRUE" } before { ENV["BUNDLER_SPEC_IGNORE_COMPATIBILITY_GUARD"] = "TRUE" }

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
RSpec.describe "the lockfile format", :bundler => "3" do RSpec.describe "the lockfile format", :bundler => "2" do
include Bundler::GemHelpers include Bundler::GemHelpers
before { ENV["BUNDLER_SPEC_IGNORE_COMPATIBILITY_GUARD"] = "TRUE" } before { ENV["BUNDLER_SPEC_IGNORE_COMPATIBILITY_GUARD"] = "TRUE" }
@ -428,7 +428,7 @@ RSpec.describe "the lockfile format", :bundler => "3" do
expect(the_bundle).to include_gems "net-sftp 1.1.1", "net-ssh 1.0.0" expect(the_bundle).to include_gems "net-sftp 1.1.1", "net-ssh 1.0.0"
end end
it "generates a simple lockfile for a single pinned source, gem with a version requirement", :bundler => "< 3" do it "generates a simple lockfile for a single pinned source, gem with a version requirement", :bundler => "< 2" do
git = build_git "foo" git = build_git "foo"
install_gemfile <<-G install_gemfile <<-G

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
RSpec.describe "bundle_ruby", :bundler => "< 3" do RSpec.describe "bundle_ruby", :bundler => "< 2" do
context "without patchlevel" do context "without patchlevel" do
it "returns the ruby version" do it "returns the ruby version" do
gemfile <<-G gemfile <<-G

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
RSpec.describe "major deprecations", :bundler => "< 3" do RSpec.describe "major deprecations", :bundler => "< 2" do
let(:warnings) { last_command.bundler_err } # change to err in 2.0 let(:warnings) { last_command.bundler_err } # change to err in 2.0
let(:warnings_without_version_messages) { warnings.gsub(/#{Spec::Matchers::MAJOR_DEPRECATION}Bundler will only support ruby(gems)? >= .*/, "") } let(:warnings_without_version_messages) { warnings.gsub(/#{Spec::Matchers::MAJOR_DEPRECATION}Bundler will only support ruby(gems)? >= .*/, "") }
@ -200,25 +200,25 @@ RSpec.describe "major deprecations", :bundler => "< 3" do
context "with github gems" do context "with github gems" do
it "warns about the https change" do it "warns about the https change" do
msg = <<-EOS msg = <<-EOS
The :github git source is deprecated, and will be removed in Bundler 3.0. Change any "reponame" :github sources to "username/reponame". Add this code to the top of your Gemfile to ensure it continues to work: The :github git source is deprecated, and will be removed in Bundler 2.0. Change any "reponame" :github sources to "username/reponame". Add this code to the top of your Gemfile to ensure it continues to work:
git_source(:github) {|repo_name| "https://github.com/\#{repo_name}.git" } git_source(:github) {|repo_name| "https://github.com/\#{repo_name}.git" }
EOS EOS
expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, msg) expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, msg)
subject.gem("sparks", :github => "indirect/sparks") subject.gem("sparks", :github => "indirect/sparks")
end end
it "upgrades to https on request" do it "upgrades to https on request" do
Bundler.settings.temporary "github.https" => true Bundler.settings.temporary "github.https" => true
msg = <<-EOS msg = <<-EOS
The :github git source is deprecated, and will be removed in Bundler 3.0. Change any "reponame" :github sources to "username/reponame". Add this code to the top of your Gemfile to ensure it continues to work: The :github git source is deprecated, and will be removed in Bundler 2.0. Change any "reponame" :github sources to "username/reponame". Add this code to the top of your Gemfile to ensure it continues to work:
git_source(:github) {|repo_name| "https://github.com/\#{repo_name}.git" } git_source(:github) {|repo_name| "https://github.com/\#{repo_name}.git" }
EOS EOS
expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, msg) expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, msg)
expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, "The `github.https` setting will be removed") expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, "The `github.https` setting will be removed")
subject.gem("sparks", :github => "indirect/sparks") subject.gem("sparks", :github => "indirect/sparks")
github_uri = "https://github.com/indirect/sparks.git" github_uri = "https://github.com/indirect/sparks.git"
expect(subject.dependencies.first.source.uri).to eq(github_uri) expect(subject.dependencies.first.source.uri).to eq(github_uri)
@ -229,7 +229,7 @@ The :github git source is deprecated, and will be removed in Bundler 3.0. Change
it "warns about removal" do it "warns about removal" do
allow(Bundler.ui).to receive(:deprecate) allow(Bundler.ui).to receive(:deprecate)
msg = <<-EOS msg = <<-EOS
The :bitbucket git source is deprecated, and will be removed in Bundler 3.0. Add this code to the top of your Gemfile to ensure it continues to work: The :bitbucket git source is deprecated, and will be removed in Bundler 2.0. Add this code to the top of your Gemfile to ensure it continues to work:
git_source(:bitbucket) do |repo_name| git_source(:bitbucket) do |repo_name|
user_name, repo_name = repo_name.split("/") user_name, repo_name = repo_name.split("/")
@ -238,7 +238,7 @@ The :bitbucket git source is deprecated, and will be removed in Bundler 3.0. Add
end end
EOS EOS
expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, msg) expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, msg)
subject.gem("not-really-a-gem", :bitbucket => "mcorp/flatlab-rails") subject.gem("not-really-a-gem", :bitbucket => "mcorp/flatlab-rails")
end end
end end
@ -247,10 +247,10 @@ The :bitbucket git source is deprecated, and will be removed in Bundler 3.0. Add
it "warns about removal" do it "warns about removal" do
allow(Bundler.ui).to receive(:deprecate) allow(Bundler.ui).to receive(:deprecate)
msg = "The :gist git source is deprecated, and will be removed " \ msg = "The :gist git source is deprecated, and will be removed " \
"in Bundler 3.0. Add this code to the top of your Gemfile to ensure it " \ "in Bundler 2.0. Add this code to the top of your Gemfile to ensure it " \
"continues to work:\n\n git_source(:gist) {|repo_name| " \ "continues to work:\n\n git_source(:gist) {|repo_name| " \
"\"https://gist.github.com/\#{repo_name}.git\" }\n\n" "\"https://gist.github.com/\#{repo_name}.git\" }\n\n"
expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, msg) expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, msg)
subject.gem("not-really-a-gem", :gist => "1234") subject.gem("not-really-a-gem", :gist => "1234")
end end
end end

View File

@ -4,7 +4,7 @@ RSpec.describe "bundle platform" do
context "without flags" do context "without flags" do
let(:bundle_platform_platforms_string) do let(:bundle_platform_platforms_string) do
platforms = [rb] platforms = [rb]
platforms.unshift(specific_local_platform) if Bundler.feature_flag.bundler_3_mode? platforms.unshift(specific_local_platform) if Bundler.feature_flag.bundler_2_mode?
platforms.map {|pl| "* #{pl}" }.join("\n") platforms.map {|pl| "* #{pl}" }.join("\n")
end end
@ -633,7 +633,7 @@ G
end end
end end
it "fails if ruby version doesn't match", :bundler => "< 3" do it "fails if ruby version doesn't match", :bundler => "< 2" do
gemfile <<-G gemfile <<-G
source "file://#{gem_repo1}" source "file://#{gem_repo1}"
gem "rails" gem "rails"
@ -645,7 +645,7 @@ G
should_be_ruby_version_incorrect should_be_ruby_version_incorrect
end end
it "fails if engine doesn't match", :bundler => "< 3" do it "fails if engine doesn't match", :bundler => "< 2" do
gemfile <<-G gemfile <<-G
source "file://#{gem_repo1}" source "file://#{gem_repo1}"
gem "rails" gem "rails"
@ -657,7 +657,7 @@ G
should_be_engine_incorrect should_be_engine_incorrect
end end
it "fails if engine version doesn't match", :bundler => "< 3" do it "fails if engine version doesn't match", :bundler => "< 2" do
simulate_ruby_engine "jruby" do simulate_ruby_engine "jruby" do
gemfile <<-G gemfile <<-G
source "file://#{gem_repo1}" source "file://#{gem_repo1}"
@ -671,7 +671,7 @@ G
end end
end end
it "fails when patchlevel doesn't match", :bundler => "< 3" do it "fails when patchlevel doesn't match", :bundler => "< 2" do
gemfile <<-G gemfile <<-G
source "file://#{gem_repo1}" source "file://#{gem_repo1}"
gem "rack" gem "rack"
@ -928,7 +928,7 @@ G
end end
end end
context "bundle console", :bundler => "< 3" do context "bundle console", :bundler => "< 2" do
before do before do
install_gemfile <<-G install_gemfile <<-G
source "file://#{gem_repo1}" source "file://#{gem_repo1}"

View File

@ -67,7 +67,7 @@ RSpec.describe "real source plugins" do
expect(the_bundle).to include_gems("a-path-gem 1.0") expect(the_bundle).to include_gems("a-path-gem 1.0")
end end
it "writes to lock file", :bundler => "< 3" do it "writes to lock file", :bundler => "< 2" do
bundle "install" bundle "install"
lockfile_should_be <<-G lockfile_should_be <<-G
@ -92,7 +92,7 @@ RSpec.describe "real source plugins" do
G G
end end
it "writes to lock file", :bundler => "3" do it "writes to lock file", :bundler => "2" do
bundle "install" bundle "install"
lockfile_should_be <<-G lockfile_should_be <<-G
@ -359,7 +359,7 @@ RSpec.describe "real source plugins" do
expect(the_bundle).to include_gems("ma-gitp-gem 1.0") expect(the_bundle).to include_gems("ma-gitp-gem 1.0")
end end
it "writes to lock file", :bundler => "< 3" do it "writes to lock file", :bundler => "< 2" do
revision = revision_for(lib_path("ma-gitp-gem-1.0")) revision = revision_for(lib_path("ma-gitp-gem-1.0"))
bundle "install" bundle "install"
@ -386,7 +386,7 @@ RSpec.describe "real source plugins" do
G G
end end
it "writes to lock file", :bundler => "3" do it "writes to lock file", :bundler => "2" do
revision = revision_for(lib_path("ma-gitp-gem-1.0")) revision = revision_for(lib_path("ma-gitp-gem-1.0"))
bundle "install" bundle "install"

View File

@ -181,7 +181,6 @@ RSpec.describe "The library itself" do
gem.coc gem.coc
gem.mit gem.mit
inline inline
lockfile_upgrade_warning
lockfile_uses_separate_rubygems_sources lockfile_uses_separate_rubygems_sources
use_gem_version_promoter_for_major_updates use_gem_version_promoter_for_major_updates
viz_command viz_command

View File

@ -57,7 +57,7 @@ RSpec.describe "real world edgecases", :realworld => true, :sometimes => true do
expect(lockfile).to include("activemodel (3.0.5)") expect(lockfile).to include("activemodel (3.0.5)")
end end
it "resolves dependencies correctly", :ruby => "<= 1.9.3" do it "resolves dependencies correctly", :ruby => "1.9.3" do
gemfile <<-G gemfile <<-G
source "https://rubygems.org" source "https://rubygems.org"
@ -70,7 +70,7 @@ RSpec.describe "real world edgecases", :realworld => true, :sometimes => true do
expect(lockfile).to include("capybara (2.2.1)") expect(lockfile).to include("capybara (2.2.1)")
end end
it "installs the latest version of gxapi_rails", :ruby => "<= 1.9.3" do it "installs the latest version of gxapi_rails", :ruby => "1.9.3" do
gemfile <<-G gemfile <<-G
source "https://rubygems.org" source "https://rubygems.org"
@ -188,7 +188,7 @@ RSpec.describe "real world edgecases", :realworld => true, :sometimes => true do
activemodel (= 4.2.7.1) activemodel (= 4.2.7.1)
activerecord (= 4.2.7.1) activerecord (= 4.2.7.1)
activesupport (= 4.2.7.1) activesupport (= 4.2.7.1)
bundler (>= 1.3.0, < 3.0) bundler (>= 1.3.0, < 2.0)
railties (= 4.2.7.1) railties (= 4.2.7.1)
sprockets-rails sprockets-rails
rails-deprecated_sanitizer (1.0.3) rails-deprecated_sanitizer (1.0.3)

View File

@ -99,7 +99,7 @@ RSpec.describe "Running bin/* commands" do
expect(bundled_app("bin/rackup")).not_to exist expect(bundled_app("bin/rackup")).not_to exist
end end
it "allows you to stop installing binstubs", :bundler => "< 3" do it "allows you to stop installing binstubs", :bundler => "< 2" do
bundle! "install --binstubs bin/" bundle! "install --binstubs bin/"
bundled_app("bin/rackup").rmtree bundled_app("bin/rackup").rmtree
bundle! "install --binstubs \"\"" bundle! "install --binstubs \"\""
@ -110,7 +110,7 @@ RSpec.describe "Running bin/* commands" do
expect(out).to include("You have not configured a value for `bin`") expect(out).to include("You have not configured a value for `bin`")
end end
it "remembers that the option was specified", :bundler => "< 3" do it "remembers that the option was specified", :bundler => "< 2" do
gemfile <<-G gemfile <<-G
source "file://#{gem_repo1}" source "file://#{gem_repo1}"
gem "activesupport" gem "activesupport"

View File

@ -1395,7 +1395,7 @@ end
end end
describe "after setup" do describe "after setup" do
it "allows calling #gem on random objects", :bundler => "< 3" do it "allows calling #gem on random objects", :bundler => "< 2" do
install_gemfile <<-G install_gemfile <<-G
source "file:#{gem_repo1}" source "file:#{gem_repo1}"
gem "rack" gem "rack"
@ -1410,7 +1410,7 @@ end
expect(out).to eq("rack-1.0.0") expect(out).to eq("rack-1.0.0")
end end
it "keeps Kernel#gem private", :bundler => "3" do it "keeps Kernel#gem private", :bundler => "2" do
install_gemfile! <<-G install_gemfile! <<-G
source "file:#{gem_repo1}" source "file:#{gem_repo1}"
gem "rack" gem "rack"

View File

@ -63,7 +63,7 @@ RSpec.describe "Bundler.with_env helpers" do
end end
end end
describe "Bundler.clean_env", :bundler => "< 3" do describe "Bundler.clean_env", :bundler => "< 2" do
before do before do
bundle "config path vendor/bundle" bundle "config path vendor/bundle"
gemfile "" gemfile ""
@ -116,7 +116,7 @@ RSpec.describe "Bundler.with_env helpers" do
end end
end end
describe "Bundler.with_clean_env", :bundler => "< 3" do describe "Bundler.with_clean_env", :bundler => "< 2" do
it "should set ENV to clean_env in the block" do it "should set ENV to clean_env in the block" do
expected = Bundler.clean_env expected = Bundler.clean_env
actual = Bundler.with_clean_env { ENV.to_hash } actual = Bundler.with_clean_env { ENV.to_hash }
@ -132,14 +132,14 @@ RSpec.describe "Bundler.with_env helpers" do
end end
end end
describe "Bundler.clean_system", :ruby => ">= 1.9", :bundler => "< 3" do describe "Bundler.clean_system", :ruby => ">= 1.9", :bundler => "< 2" do
it "runs system inside with_clean_env" do it "runs system inside with_clean_env" do
Bundler.clean_system(%(echo 'if [ "$BUNDLE_PATH" = "" ]; then exit 42; else exit 1; fi' | /bin/sh)) Bundler.clean_system(%(echo 'if [ "$BUNDLE_PATH" = "" ]; then exit 42; else exit 1; fi' | /bin/sh))
expect($?.exitstatus).to eq(42) expect($?.exitstatus).to eq(42)
end end
end end
describe "Bundler.clean_exec", :ruby => ">= 1.9", :bundler => "< 3" do describe "Bundler.clean_exec", :ruby => ">= 1.9", :bundler => "< 2" do
it "runs exec inside with_clean_env" do it "runs exec inside with_clean_env" do
pid = Kernel.fork do pid = Kernel.fork do
Bundler.clean_exec(%(echo 'if [ "$BUNDLE_PATH" = "" ]; then exit 42; else exit 1; fi' | /bin/sh)) Bundler.clean_exec(%(echo 'if [ "$BUNDLE_PATH" = "" ]; then exit 42; else exit 1; fi' | /bin/sh))

View File

@ -40,7 +40,7 @@ if ENV.select {|k, _v| k =~ /TRAVIS/ }.any? && Gem::Version.new(Gem::VERSION) >
end end
end end
if File.expand_path(__FILE__) =~ %r{([^\w/\.:\-])} if File.expand_path(__FILE__) =~ %r{([^\w/\.-])}
abort "The bundler specs cannot be run from a path that contains special characters (particularly #{$1.inspect})" abort "The bundler specs cannot be run from a path that contains special characters (particularly #{$1.inspect})"
end end

View File

@ -53,7 +53,7 @@ module Spec
end end
def bundle_update_requires_all? def bundle_update_requires_all?
Bundler::VERSION.start_with?("2.") ? nil : true Bundler::VERSION.start_with?("1.") ? nil : true
end end
def in_app_root(&blk) def in_app_root(&blk)
@ -152,7 +152,7 @@ module Spec
bang :bundle bang :bundle
def forgotten_command_line_options(options) def forgotten_command_line_options(options)
remembered = Bundler.bundler_major_version < 3 remembered = Bundler::VERSION.split(".", 2).first == "1"
options = options.map do |k, v| options = options.map do |k, v|
k = Array(k)[remembered ? 0 : -1] k = Array(k)[remembered ? 0 : -1]
v = '""' if v && v.to_s.empty? v = '""' if v && v.to_s.empty?

View File

@ -29,7 +29,7 @@ module Spec
end end
def default_bundle_path(*path) def default_bundle_path(*path)
if Bundler::VERSION.split(".").first.to_i < 3 if Bundler::VERSION.split(".").first.to_i < 2
system_gem_path(*path) system_gem_path(*path)
else else
bundled_app(*[".bundle", ENV.fetch("BUNDLER_SPEC_RUBY_ENGINE", Gem.ruby_engine), Gem::ConfigMap[:ruby_version], *path].compact) bundled_app(*[".bundle", ENV.fetch("BUNDLER_SPEC_RUBY_ENGINE", Gem.ruby_engine), Gem::ConfigMap[:ruby_version], *path].compact)

View File

@ -106,7 +106,7 @@ module Spec
end end
def local_platforms def local_platforms
if Bundler::VERSION.split(".").first.to_i > 2 if Bundler::VERSION.split(".").first.to_i > 1
[local, specific_local_platform] [local, specific_local_platform]
else else
[local] [local]

View File

@ -299,7 +299,7 @@ RSpec.describe "bundle update" do
G G
end end
it "the --source flag updates version of gems that were originally pulled in by the source", :bundler => "> 3" do it "the --source flag updates version of gems that were originally pulled in by the source", :bundler => "< 2" do
spec_lines = lib_path("bar/foo.gemspec").read.split("\n") spec_lines = lib_path("bar/foo.gemspec").read.split("\n")
spec_lines[5] = "s.version = '2.0'" spec_lines[5] = "s.version = '2.0'"
@ -335,7 +335,7 @@ RSpec.describe "bundle update" do
G G
end end
it "the --source flag updates version of gems that were originally pulled in by the source", :bundler => "3" do it "the --source flag updates version of gems that were originally pulled in by the source", :bundler => "2" do
spec_lines = lib_path("bar/foo.gemspec").read.split("\n") spec_lines = lib_path("bar/foo.gemspec").read.split("\n")
spec_lines[5] = "s.version = '2.0'" spec_lines[5] = "s.version = '2.0'"

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
RSpec.describe "bundle update", :bundler => "< 3", :ruby => ">= 2.0" do RSpec.describe "bundle update", :bundler => "< 2", :ruby => ">= 2.0" do
before :each do before :each do
install_gemfile <<-G install_gemfile <<-G
source "file://#{gem_repo1}" source "file://#{gem_repo1}"
@ -13,24 +13,24 @@ RSpec.describe "bundle update", :bundler => "< 3", :ruby => ">= 2.0" do
describe "with --force" do describe "with --force" do
it "shows a deprecation when single flag passed" do it "shows a deprecation when single flag passed" do
bundle! "update rack --force" bundle! "update rack --force"
expect(out).to include "[DEPRECATED FOR 3.0] The `--force` option has been renamed to `--redownload`" expect(out).to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`"
end end
it "shows a deprecation when multiple flags passed" do it "shows a deprecation when multiple flags passed" do
bundle! "update rack --no-color --force" bundle! "update rack --no-color --force"
expect(out).to include "[DEPRECATED FOR 3.0] The `--force` option has been renamed to `--redownload`" expect(out).to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`"
end end
end end
describe "with --redownload" do describe "with --redownload" do
it "does not show a deprecation when single flag passed" do it "does not show a deprecation when single flag passed" do
bundle! "update rack --redownload" bundle! "update rack --redownload"
expect(out).not_to include "[DEPRECATED FOR 3.0] The `--force` option has been renamed to `--redownload`" expect(out).not_to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`"
end end
it "does not show a deprecation when single multiple flags passed" do it "does not show a deprecation when single multiple flags passed" do
bundle! "update rack --no-color --redownload" bundle! "update rack --no-color --redownload"
expect(out).not_to include "[DEPRECATED FOR 3.0] The `--force` option has been renamed to `--redownload`" expect(out).not_to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`"
end end
end end
end end