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,9 +52,10 @@ 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.
@ -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.
@ -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