1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Track Bundler master(2.3.0.dev) branch at 55634a8af18a52df86c4275d70fa1179118bcc20

This commit is contained in:
Hiroshi SHIBATA 2021-01-04 10:11:34 +09:00
parent 5537adf719
commit 69ed64949b
Notes: git 2021-01-04 13:15:10 +09:00
78 changed files with 426 additions and 350 deletions

View file

@ -122,9 +122,7 @@ module Bundler
else command = "bundle-#{cli}" else command = "bundle-#{cli}"
end end
man_path = File.expand_path("../../../man", __FILE__) man_path = File.expand_path("man", __dir__)
# man files are located under ruby's mandir with the default gems of bundler
man_path = RbConfig::CONFIG["mandir"] unless File.directory?(man_path)
man_pages = Hash[Dir.glob(File.join(man_path, "**", "*")).grep(/.*\.\d*\Z/).collect do |f| man_pages = Hash[Dir.glob(File.join(man_path, "**", "*")).grep(/.*\.\d*\Z/).collect do |f|
[File.basename(f, ".*"), f] [File.basename(f, ".*"), f]
end] end]
@ -134,8 +132,7 @@ module Bundler
if Bundler.which("man") && man_path !~ %r{^file:/.+!/META-INF/jruby.home/.+} if Bundler.which("man") && man_path !~ %r{^file:/.+!/META-INF/jruby.home/.+}
Kernel.exec "man #{man_page}" Kernel.exec "man #{man_page}"
else else
fallback_man_path = File.expand_path("../man", __FILE__) puts File.read("#{man_path}/#{File.basename(man_page)}.ronn")
puts File.read("#{fallback_man_path}/#{File.basename(man_page)}.ronn")
end end
elsif command_path = Bundler.which("bundler-#{cli}") elsif command_path = Bundler.which("bundler-#{cli}")
Kernel.exec(command_path, "--help") Kernel.exec(command_path, "--help")

View file

@ -95,7 +95,7 @@ module Bundler
when "minitest" when "minitest"
templates.merge!( templates.merge!(
"test/minitest/test_helper.rb.tt" => "test/test_helper.rb", "test/minitest/test_helper.rb.tt" => "test/test_helper.rb",
"test/minitest/newgem_test.rb.tt" => "test/#{namespaced_path}_test.rb" "test/minitest/test_newgem.rb.tt" => "test/test_#{namespaced_path}.rb"
) )
config[:test_task] = :test config[:test_task] = :test
when "test-unit" when "test-unit"

View file

@ -7,6 +7,11 @@ module Bundler
class Definition class Definition
include GemHelpers include GemHelpers
class << self
# Do not create or modify a lockfile (Makes #lock a noop)
attr_accessor :no_lock
end
attr_reader( attr_reader(
:dependencies, :dependencies,
:locked_deps, :locked_deps,
@ -336,6 +341,8 @@ module Bundler
end end
def lock(file, preserve_unknown_sections = false) def lock(file, preserve_unknown_sections = false)
return if Definition.no_lock
contents = to_lock contents = to_lock
# Convert to \r\n if the existing lock has them # Convert to \r\n if the existing lock has them

View file

@ -69,8 +69,8 @@ module Bundler
:HTTPUnsupportedMediaType, :HTTPVersionNotSupported].freeze :HTTPUnsupportedMediaType, :HTTPVersionNotSupported].freeze
FAIL_ERRORS = begin FAIL_ERRORS = begin
fail_errors = [AuthenticationRequiredError, BadAuthenticationError, FallbackError] fail_errors = [AuthenticationRequiredError, BadAuthenticationError, FallbackError]
fail_errors << Gem::Requirement::BadRequirementError if defined?(Gem::Requirement::BadRequirementError) fail_errors << Gem::Requirement::BadRequirementError
fail_errors.concat(NET_ERRORS.map {|e| SharedHelpers.const_get_safely(e, Net) }.compact) fail_errors.concat(NET_ERRORS.map {|e| Net.const_get(e) })
end.freeze end.freeze
class << self class << self

View file

@ -117,13 +117,13 @@ module Bundler
def git_push(remote = nil) def git_push(remote = nil)
remote ||= default_remote remote ||= default_remote
perform_git_push remote perform_git_push remote
perform_git_push "#{remote} #{version_tag}" perform_git_push "#{remote} refs/tags/#{version_tag}"
Bundler.ui.confirm "Pushed git commits and release tag." Bundler.ui.confirm "Pushed git commits and release tag."
end end
def default_remote def default_remote
current_branch = sh(%w[git rev-parse --abbrev-ref HEAD]).strip # We can replace this with `git branch --show-current` once we drop support for git < 2.22.0
return "origin" if current_branch.empty? current_branch = sh(%w[git rev-parse --abbrev-ref HEAD]).gsub(%r{\Aheads/}, "").strip
remote_for_branch = sh(%W[git config --get branch.#{current_branch}.remote]).strip remote_for_branch = sh(%W[git config --get branch.#{current_branch}.remote]).strip
return "origin" if remote_for_branch.empty? return "origin" if remote_for_branch.empty?

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\-ADD" "1" "November 2020" "" "" .TH "BUNDLE\-ADD" "1" "December 2020" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-add\fR \- Add gem to the Gemfile and run bundle install \fBbundle\-add\fR \- Add gem to the Gemfile and run bundle install

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\-BINSTUBS" "1" "November 2020" "" "" .TH "BUNDLE\-BINSTUBS" "1" "December 2020" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-binstubs\fR \- Install the binstubs of the listed gems \fBbundle\-binstubs\fR \- Install the binstubs of the listed gems

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\-CACHE" "1" "November 2020" "" "" .TH "BUNDLE\-CACHE" "1" "December 2020" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-cache\fR \- Package your needed \fB\.gem\fR files into your application \fBbundle\-cache\fR \- Package your needed \fB\.gem\fR files into your application

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\-CHECK" "1" "November 2020" "" "" .TH "BUNDLE\-CHECK" "1" "December 2020" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-check\fR \- Verifies if dependencies are satisfied by installed gems \fBbundle\-check\fR \- Verifies if dependencies are satisfied by installed gems

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\-CLEAN" "1" "November 2020" "" "" .TH "BUNDLE\-CLEAN" "1" "December 2020" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-clean\fR \- Cleans up unused gems in your bundler directory \fBbundle\-clean\fR \- Cleans up unused gems in your bundler directory

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 2020" "" "" .TH "BUNDLE\-CONFIG" "1" "December 2020" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-config\fR \- Set bundler configuration options \fBbundle\-config\fR \- Set bundler configuration options
@ -211,10 +211,10 @@ The following is a list of all configuration keys and their purpose\. You can le
\fBignore_messages\fR (\fBBUNDLE_IGNORE_MESSAGES\fR): When set, no post install messages will be printed\. To silence a single gem, use dot notation like \fBignore_messages\.httparty true\fR\. \fBignore_messages\fR (\fBBUNDLE_IGNORE_MESSAGES\fR): When set, no post install messages will be printed\. To silence a single gem, use dot notation like \fBignore_messages\.httparty true\fR\.
. .
.IP "\(bu" 4 .IP "\(bu" 4
\fBinit_gems_rb\fR (\fBBUNDLE_INIT_GEMS_RB\fR) Generate a \fBgems\.rb\fR instead of a \fBGemfile\fR when running \fBbundle init\fR\. \fBinit_gems_rb\fR (\fBBUNDLE_INIT_GEMS_RB\fR): Generate a \fBgems\.rb\fR instead of a \fBGemfile\fR when running \fBbundle init\fR\.
. .
.IP "\(bu" 4 .IP "\(bu" 4
\fBjobs\fR (\fBBUNDLE_JOBS\fR): The number of gems Bundler can install in parallel\. Defaults to 1\. \fBjobs\fR (\fBBUNDLE_JOBS\fR): The number of gems Bundler can install in parallel\. Defaults to 1 on Windows, and to the the number of processors on other platforms\.
. .
.IP "\(bu" 4 .IP "\(bu" 4
\fBno_install\fR (\fBBUNDLE_NO_INSTALL\fR): Whether \fBbundle package\fR should skip installing gems\. \fBno_install\fR (\fBBUNDLE_NO_INSTALL\fR): Whether \fBbundle package\fR should skip installing gems\.
@ -241,7 +241,7 @@ The following is a list of all configuration keys and their purpose\. You can le
\fBprefer_patch\fR (BUNDLE_PREFER_PATCH): Prefer updating only to next patch version during updates\. Makes \fBbundle update\fR calls equivalent to \fBbundler update \-\-patch\fR\. \fBprefer_patch\fR (BUNDLE_PREFER_PATCH): Prefer updating only to next patch version during updates\. Makes \fBbundle update\fR calls equivalent to \fBbundler update \-\-patch\fR\.
. .
.IP "\(bu" 4 .IP "\(bu" 4
\fBprint_only_version_number\fR (\fBBUNDLE_PRINT_ONLY_VERSION_NUMBER\fR) Print only version number from \fBbundler \-\-version\fR\. \fBprint_only_version_number\fR (\fBBUNDLE_PRINT_ONLY_VERSION_NUMBER\fR): Print only version number from \fBbundler \-\-version\fR\.
. .
.IP "\(bu" 4 .IP "\(bu" 4
\fBredirect\fR (\fBBUNDLE_REDIRECT\fR): The number of redirects allowed for network requests\. Defaults to \fB5\fR\. \fBredirect\fR (\fBBUNDLE_REDIRECT\fR): The number of redirects allowed for network requests\. Defaults to \fB5\fR\.
@ -283,7 +283,7 @@ The following is a list of all configuration keys and their purpose\. You can le
\fBunlock_source_unlocks_spec\fR (\fBBUNDLE_UNLOCK_SOURCE_UNLOCKS_SPEC\fR): Whether running \fBbundle update \-\-source NAME\fR unlocks a gem with the given name\. Defaults to \fBtrue\fR\. \fBunlock_source_unlocks_spec\fR (\fBBUNDLE_UNLOCK_SOURCE_UNLOCKS_SPEC\fR): Whether running \fBbundle update \-\-source NAME\fR unlocks a gem with the given name\. Defaults to \fBtrue\fR\.
. .
.IP "\(bu" 4 .IP "\(bu" 4
\fBupdate_requires_all_flag\fR (\fBBUNDLE_UPDATE_REQUIRES_ALL_FLAG\fR) Require passing \fB\-\-all\fR to \fBbundle update\fR when everything should be updated, and disallow passing no options to \fBbundle update\fR\. \fBupdate_requires_all_flag\fR (\fBBUNDLE_UPDATE_REQUIRES_ALL_FLAG\fR): Require passing \fB\-\-all\fR to \fBbundle update\fR when everything should be updated, and disallow passing no options to \fBbundle update\fR\.
. .
.IP "\(bu" 4 .IP "\(bu" 4
\fBuser_agent\fR (\fBBUNDLE_USER_AGENT\fR): The custom user agent fragment Bundler includes in API requests\. \fBuser_agent\fR (\fBBUNDLE_USER_AGENT\fR): The custom user agent fragment Bundler includes in API requests\.
@ -458,7 +458,7 @@ export BUNDLE_GITHUB__COM=username:password
.IP "" 0 .IP "" 0
. .
.P .P
This is especially useful for private repositories on hosts such as Github, where you can use personal OAuth tokens: This is especially useful for private repositories on hosts such as GitHub, where you can use personal OAuth tokens:
. .
.IP "" 4 .IP "" 4
. .

View file

@ -206,13 +206,14 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
* `global_gem_cache` (`BUNDLE_GLOBAL_GEM_CACHE`): * `global_gem_cache` (`BUNDLE_GLOBAL_GEM_CACHE`):
Whether Bundler should cache all gems globally, rather than locally to the Whether Bundler should cache all gems globally, rather than locally to the
installing Ruby installation. installing Ruby installation.
* `ignore_messages` (`BUNDLE_IGNORE_MESSAGES`): When set, no post install * `ignore_messages` (`BUNDLE_IGNORE_MESSAGES`):
messages will be printed. To silence a single gem, use dot notation like When set, no post install messages will be printed. To silence a single gem,
`ignore_messages.httparty true`. use dot notation like `ignore_messages.httparty true`.
* `init_gems_rb` (`BUNDLE_INIT_GEMS_RB`) * `init_gems_rb` (`BUNDLE_INIT_GEMS_RB`):
Generate a `gems.rb` instead of a `Gemfile` when running `bundle init`. Generate a `gems.rb` instead of a `Gemfile` when running `bundle init`.
* `jobs` (`BUNDLE_JOBS`): * `jobs` (`BUNDLE_JOBS`):
The number of gems Bundler can install in parallel. Defaults to 1. The number of gems Bundler can install in parallel. Defaults to 1 on Windows,
and to the the number of processors on other platforms.
* `no_install` (`BUNDLE_NO_INSTALL`): * `no_install` (`BUNDLE_NO_INSTALL`):
Whether `bundle package` should skip installing gems. Whether `bundle package` should skip installing gems.
* `no_prune` (`BUNDLE_NO_PRUNE`): * `no_prune` (`BUNDLE_NO_PRUNE`):
@ -233,7 +234,7 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
Enable Bundler's experimental plugin system. Enable Bundler's experimental plugin system.
* `prefer_patch` (BUNDLE_PREFER_PATCH): * `prefer_patch` (BUNDLE_PREFER_PATCH):
Prefer updating only to next patch version during updates. Makes `bundle update` calls equivalent to `bundler update --patch`. Prefer updating only to next patch version during updates. Makes `bundle update` calls equivalent to `bundler update --patch`.
* `print_only_version_number` (`BUNDLE_PRINT_ONLY_VERSION_NUMBER`) * `print_only_version_number` (`BUNDLE_PRINT_ONLY_VERSION_NUMBER`):
Print only version number from `bundler --version`. Print only version number from `bundler --version`.
* `redirect` (`BUNDLE_REDIRECT`): * `redirect` (`BUNDLE_REDIRECT`):
The number of redirects allowed for network requests. Defaults to `5`. The number of redirects allowed for network requests. Defaults to `5`.
@ -269,7 +270,7 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
* `unlock_source_unlocks_spec` (`BUNDLE_UNLOCK_SOURCE_UNLOCKS_SPEC`): * `unlock_source_unlocks_spec` (`BUNDLE_UNLOCK_SOURCE_UNLOCKS_SPEC`):
Whether running `bundle update --source NAME` unlocks a gem with the given Whether running `bundle update --source NAME` unlocks a gem with the given
name. Defaults to `true`. name. Defaults to `true`.
* `update_requires_all_flag` (`BUNDLE_UPDATE_REQUIRES_ALL_FLAG`) * `update_requires_all_flag` (`BUNDLE_UPDATE_REQUIRES_ALL_FLAG`):
Require passing `--all` to `bundle update` when everything should be updated, Require passing `--all` to `bundle update` when everything should be updated,
and disallow passing no options to `bundle update`. and disallow passing no options to `bundle update`.
* `user_agent` (`BUNDLE_USER_AGENT`): * `user_agent` (`BUNDLE_USER_AGENT`):
@ -369,7 +370,7 @@ Or you can set the credentials as an environment variable like so:
export BUNDLE_GITHUB__COM=username:password export BUNDLE_GITHUB__COM=username:password
This is especially useful for private repositories on hosts such as Github, This is especially useful for private repositories on hosts such as GitHub,
where you can use personal OAuth tokens: where you can use personal OAuth tokens:
export BUNDLE_GITHUB__COM=abcd0123generatedtoken:x-oauth-basic export BUNDLE_GITHUB__COM=abcd0123generatedtoken:x-oauth-basic

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\-DOCTOR" "1" "November 2020" "" "" .TH "BUNDLE\-DOCTOR" "1" "December 2020" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-doctor\fR \- Checks the bundle for common problems \fBbundle\-doctor\fR \- Checks the bundle for common problems

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\-EXEC" "1" "November 2020" "" "" .TH "BUNDLE\-EXEC" "1" "December 2020" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-exec\fR \- Execute a command in the context of the bundle \fBbundle\-exec\fR \- Execute a command in the context of the bundle

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\-GEM" "1" "November 2020" "" "" .TH "BUNDLE\-GEM" "1" "December 2020" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-gem\fR \- Generate a project skeleton for creating a rubygem \fBbundle\-gem\fR \- Generate a project skeleton for creating a rubygem

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\-INFO" "1" "November 2020" "" "" .TH "BUNDLE\-INFO" "1" "December 2020" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-info\fR \- Show information for the given gem in your bundle \fBbundle\-info\fR \- Show information for the given gem in your bundle

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\-INIT" "1" "November 2020" "" "" .TH "BUNDLE\-INIT" "1" "December 2020" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-init\fR \- Generates a Gemfile into the current working directory \fBbundle\-init\fR \- Generates a Gemfile into the current working directory

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\-INJECT" "1" "November 2020" "" "" .TH "BUNDLE\-INJECT" "1" "December 2020" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-inject\fR \- Add named gem(s) with version requirements to Gemfile \fBbundle\-inject\fR \- Add named gem(s) with version requirements to Gemfile

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\-INSTALL" "1" "November 2020" "" "" .TH "BUNDLE\-INSTALL" "1" "December 2020" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-install\fR \- Install the dependencies specified in your Gemfile \fBbundle\-install\fR \- Install the dependencies specified in your Gemfile

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\-LIST" "1" "November 2020" "" "" .TH "BUNDLE\-LIST" "1" "December 2020" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-list\fR \- List all the gems in the bundle \fBbundle\-list\fR \- List all the gems in the bundle

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\-LOCK" "1" "November 2020" "" "" .TH "BUNDLE\-LOCK" "1" "December 2020" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-lock\fR \- Creates / Updates a lockfile without installing \fBbundle\-lock\fR \- Creates / Updates a lockfile without installing

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\-OPEN" "1" "November 2020" "" "" .TH "BUNDLE\-OPEN" "1" "December 2020" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-open\fR \- Opens the source directory for a gem in your bundle \fBbundle\-open\fR \- Opens the source directory for a gem in your bundle

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\-OUTDATED" "1" "November 2020" "" "" .TH "BUNDLE\-OUTDATED" "1" "December 2020" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-outdated\fR \- List installed gems with newer versions available \fBbundle\-outdated\fR \- List installed gems with newer versions available

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\-PLATFORM" "1" "November 2020" "" "" .TH "BUNDLE\-PLATFORM" "1" "December 2020" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-platform\fR \- Displays platform compatibility information \fBbundle\-platform\fR \- Displays platform compatibility information

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\-PRISTINE" "1" "November 2020" "" "" .TH "BUNDLE\-PRISTINE" "1" "December 2020" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-pristine\fR \- Restores installed gems to their pristine condition \fBbundle\-pristine\fR \- Restores installed gems to their pristine condition

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\-REMOVE" "1" "November 2020" "" "" .TH "BUNDLE\-REMOVE" "1" "December 2020" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-remove\fR \- Removes gems from the Gemfile \fBbundle\-remove\fR \- Removes gems from the Gemfile

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\-SHOW" "1" "November 2020" "" "" .TH "BUNDLE\-SHOW" "1" "December 2020" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-show\fR \- Shows all the gems in your bundle, or the path to a gem \fBbundle\-show\fR \- Shows all the gems in your bundle, or the path to a gem

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\-UPDATE" "1" "November 2020" "" "" .TH "BUNDLE\-UPDATE" "1" "December 2020" "" ""
. .
.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

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\-VIZ" "1" "November 2020" "" "" .TH "BUNDLE\-VIZ" "1" "December 2020" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-viz\fR \- Generates a visual dependency graph for your Gemfile \fBbundle\-viz\fR \- Generates a visual dependency graph for your Gemfile

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" "1" "November 2020" "" "" .TH "BUNDLE" "1" "December 2020" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\fR \- Ruby Dependency Management \fBbundle\fR \- Ruby Dependency Management

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 "GEMFILE" "5" "November 2020" "" "" .TH "GEMFILE" "5" "December 2020" "" ""
. .
.SH "NAME" .SH "NAME"
\fBGemfile\fR \- A format for describing gem dependencies for Ruby programs \fBGemfile\fR \- A format for describing gem dependencies for Ruby programs
@ -507,7 +507,7 @@ gem "rails", :git => "git://github\.com/rails/rails\.git"
Since the \fBgithub\fR method is a specialization of \fBgit_source\fR, it accepts a \fB:branch\fR named argument\. Since the \fBgithub\fR method is a specialization of \fBgit_source\fR, it accepts a \fB:branch\fR named argument\.
. .
.SS "GIST" .SS "GIST"
If the git repository you want to use is hosted as a Github Gist and is public, you can use the :gist shorthand to specify the gist identifier (without the trailing "\.git")\. If the git repository you want to use is hosted as a GitHub Gist and is public, you can use the :gist shorthand to specify the gist identifier (without the trailing "\.git")\.
. .
.IP "" 4 .IP "" 4
. .

View file

@ -374,7 +374,7 @@ Since the `github` method is a specialization of `git_source`, it accepts a `:br
### GIST ### GIST
If the git repository you want to use is hosted as a Github Gist and is public, you can use If the git repository you want to use is hosted as a GitHub Gist and is public, you can use
the :gist shorthand to specify the gist identifier (without the trailing ".git"). the :gist shorthand to specify the gist identifier (without the trailing ".git").
gem "the_hatch", :gist => "4815162342" gem "the_hatch", :gist => "4815162342"

25
lib/bundler/man/index.txt Normal file
View file

@ -0,0 +1,25 @@
Gemfile(5) gemfile.5
bundle(1) bundle.1
bundle-add(1) bundle-add.1
bundle-binstubs(1) bundle-binstubs.1
bundle-cache(1) bundle-cache.1
bundle-check(1) bundle-check.1
bundle-clean(1) bundle-clean.1
bundle-config(1) bundle-config.1
bundle-doctor(1) bundle-doctor.1
bundle-exec(1) bundle-exec.1
bundle-gem(1) bundle-gem.1
bundle-info(1) bundle-info.1
bundle-init(1) bundle-init.1
bundle-inject(1) bundle-inject.1
bundle-install(1) bundle-install.1
bundle-list(1) bundle-list.1
bundle-lock(1) bundle-lock.1
bundle-open(1) bundle-open.1
bundle-outdated(1) bundle-outdated.1
bundle-platform(1) bundle-platform.1
bundle-pristine(1) bundle-pristine.1
bundle-remove(1) bundle-remove.1
bundle-show(1) bundle-show.1
bundle-update(1) bundle-update.1
bundle-viz(1) bundle-viz.1

View file

@ -12,7 +12,7 @@ module Bundler
yield yield
f.flock(File::LOCK_UN) f.flock(File::LOCK_UN)
end end
rescue Errno::EACCES, Errno::ENOLCK, *[SharedHelpers.const_get_safely(:ENOTSUP, Errno)].compact rescue Errno::EACCES, Errno::ENOLCK, Errno::ENOTSUP
# In the case the user does not have access to # In the case the user does not have access to
# create the lock file or is using NFS where # create the lock file or is using NFS where
# locks are not available we skip locking. # locks are not available we skip locking.

View file

@ -109,7 +109,7 @@ module Bundler
raise VirtualProtocolError.new raise VirtualProtocolError.new
rescue Errno::ENOSPC rescue Errno::ENOSPC
raise NoSpaceOnDeviceError.new(path, action) raise NoSpaceOnDeviceError.new(path, action)
rescue *[const_get_safely(:ENOTSUP, Errno)].compact rescue Errno::ENOTSUP
raise OperationNotSupportedError.new(path, action) raise OperationNotSupportedError.new(path, action)
rescue Errno::EEXIST, Errno::ENOENT rescue Errno::EEXIST, Errno::ENOENT
raise raise
@ -117,13 +117,6 @@ module Bundler
raise GenericSystemCallError.new(e, "There was an error accessing `#{path}`.") raise GenericSystemCallError.new(e, "There was an error accessing `#{path}`.")
end end
def const_get_safely(constant_name, namespace)
const_in_namespace = namespace.constants.include?(constant_name.to_s) ||
namespace.constants.include?(constant_name.to_sym)
return nil unless const_in_namespace
namespace.const_get(constant_name)
end
def major_deprecation(major_version, message, print_caller_location: false) def major_deprecation(major_version, message, print_caller_location: false)
if print_caller_location if print_caller_location
caller_location = caller_locations(2, 2).first caller_location = caller_locations(2, 2).first

View file

@ -67,13 +67,13 @@ module Bundler
def branch def branch
@branch ||= allowed_with_path do @branch ||= allowed_with_path do
git("rev-parse --abbrev-ref HEAD", :dir => path).strip git("rev-parse", "--abbrev-ref", "HEAD", :dir => path).strip
end end
end end
def contains?(commit) def contains?(commit)
allowed_with_path do allowed_with_path do
result, status = git_null("branch --contains #{commit}", :dir => path) result, status = git_null("branch", "--contains", commit, :dir => path)
status.success? && result =~ /^\* (.*)$/ status.success? && result =~ /^\* (.*)$/
end end
end end
@ -88,20 +88,22 @@ module Bundler
def checkout def checkout
return if path.exist? && has_revision_cached? return if path.exist? && has_revision_cached?
extra_ref = "#{Shellwords.shellescape(ref)}:#{Shellwords.shellescape(ref)}" if ref && ref.start_with?("refs/") extra_ref = "#{ref}:#{ref}" if ref && ref.start_with?("refs/")
Bundler.ui.info "Fetching #{URICredentialsFilter.credential_filtered_uri(uri)}" Bundler.ui.info "Fetching #{URICredentialsFilter.credential_filtered_uri(uri)}"
configured_uri = configured_uri_for(uri).to_s
unless path.exist? unless path.exist?
SharedHelpers.filesystem_access(path.dirname) do |p| SharedHelpers.filesystem_access(path.dirname) do |p|
FileUtils.mkdir_p(p) FileUtils.mkdir_p(p)
end end
git_retry %(clone #{uri_escaped_with_configured_credentials} "#{path}" --bare --no-hardlinks --quiet) git_retry "clone", configured_uri, path.to_s, "--bare", "--no-hardlinks", "--quiet"
return unless extra_ref return unless extra_ref
end end
with_path do with_path do
git_retry %(fetch --force --quiet --tags #{uri_escaped_with_configured_credentials} "refs/heads/*:refs/heads/*" #{extra_ref}), :dir => path git_retry(*["fetch", "--force", "--quiet", "--tags", configured_uri, "refs/heads/*:refs/heads/*", extra_ref].compact, :dir => path)
end end
end end
@ -115,7 +117,7 @@ module Bundler
SharedHelpers.filesystem_access(destination) do |p| SharedHelpers.filesystem_access(destination) do |p|
FileUtils.rm_rf(p) FileUtils.rm_rf(p)
end end
git_retry %(clone --no-checkout --quiet "#{path}" "#{destination}") git_retry "clone", "--no-checkout", "--quiet", path.to_s, destination.to_s
File.chmod(((File.stat(destination).mode | 0o777) & ~File.umask), destination) File.chmod(((File.stat(destination).mode | 0o777) & ~File.umask), destination)
rescue Errno::EEXIST => e rescue Errno::EEXIST => e
file_path = e.message[%r{.*?((?:[a-zA-Z]:)?/.*)}, 1] file_path = e.message[%r{.*?((?:[a-zA-Z]:)?/.*)}, 1]
@ -125,46 +127,45 @@ module Bundler
end end
end end
# method 2 # method 2
git_retry %(fetch --force --quiet --tags "#{path}"), :dir => destination git_retry "fetch", "--force", "--quiet", "--tags", path.to_s, :dir => destination
begin begin
git "reset --hard #{@revision}", :dir => destination git "reset", "--hard", @revision, :dir => destination
rescue GitCommandError => e rescue GitCommandError => e
raise MissingGitRevisionError.new(e.command, path, destination, @revision, URICredentialsFilter.credential_filtered_uri(uri)) raise MissingGitRevisionError.new(e.command, path, destination, @revision, URICredentialsFilter.credential_filtered_uri(uri))
end end
if submodules if submodules
git_retry "submodule update --init --recursive", :dir => destination git_retry "submodule", "update", "--init", "--recursive", :dir => destination
elsif Gem::Version.create(version) >= Gem::Version.create("2.9.0") elsif Gem::Version.create(version) >= Gem::Version.create("2.9.0")
inner_command = "git -C $toplevel submodule deinit --force $sm_path" inner_command = "git -C $toplevel submodule deinit --force $sm_path"
inner_command = inner_command.gsub("$") { '\$' } unless Bundler::WINDOWS git_retry "submodule", "foreach", "--quiet", inner_command, :dir => destination
git_retry "submodule foreach --quiet \"#{inner_command}\"", :dir => destination
end end
end end
private private
def git_null(command, dir: SharedHelpers.pwd) def git_null(*command, dir: SharedHelpers.pwd)
check_allowed(command) check_allowed(command)
out, status = SharedHelpers.with_clean_git_env do out, status = SharedHelpers.with_clean_git_env do
capture_and_ignore_stderr("git #{command}", :chdir => dir.to_s) capture_and_ignore_stderr("git", "-C", dir.to_s, *command)
end end
[URICredentialsFilter.credential_filtered_string(out, uri), status] [URICredentialsFilter.credential_filtered_string(out, uri), status]
end end
def git_retry(command, dir: SharedHelpers.pwd) def git_retry(*command, dir: SharedHelpers.pwd)
Bundler::Retry.new("`git #{URICredentialsFilter.credential_filtered_string(command, uri)}`", GitNotAllowedError).attempts do Bundler::Retry.new("`git -C #{dir} #{URICredentialsFilter.credential_filtered_string(command.shelljoin, uri)}`", GitNotAllowedError).attempts do
git(command, :dir => dir) git(*command, :dir => dir)
end end
end end
def git(command, dir: SharedHelpers.pwd) def git(*command, dir: SharedHelpers.pwd)
command_with_no_credentials = check_allowed(command) command_with_no_credentials = check_allowed(command)
out, status = SharedHelpers.with_clean_git_env do out, status = SharedHelpers.with_clean_git_env do
capture_and_filter_stderr(uri, "git #{command}", :chdir => dir.to_s) capture_and_filter_stderr("git", "-C", dir.to_s, *command)
end end
raise GitCommandError.new(command_with_no_credentials, path, dir) unless status.success? raise GitCommandError.new(command_with_no_credentials, path, dir) unless status.success?
@ -174,7 +175,7 @@ module Bundler
def has_revision_cached? def has_revision_cached?
return unless @revision return unless @revision
with_path { git("cat-file -e #{@revision}", :dir => path) } with_path { git("cat-file", "-e", @revision, :dir => path) }
true true
rescue GitError rescue GitError
false false
@ -186,26 +187,12 @@ module Bundler
def find_local_revision def find_local_revision
allowed_with_path do allowed_with_path do
git("rev-parse --verify #{Shellwords.shellescape(ref)}", :dir => path).strip git("rev-parse", "--verify", ref, :dir => path).strip
end end
rescue GitCommandError => e rescue GitCommandError => e
raise MissingGitRevisionError.new(e.command, path, path, ref, URICredentialsFilter.credential_filtered_uri(uri)) raise MissingGitRevisionError.new(e.command, path, path, ref, URICredentialsFilter.credential_filtered_uri(uri))
end end
# Escape the URI for git commands
def uri_escaped_with_configured_credentials
remote = configured_uri_for(uri)
if Bundler::WINDOWS
# Windows quoting requires double quotes only, with double quotes
# inside the string escaped by being doubled.
'"' + remote.gsub('"') { '""' } + '"'
else
# Bash requires single quoted strings, with the single quotes escaped
# by ending the string, escaping the quote, and restarting the string.
"'" + remote.gsub("'") { "'\\''" } + "'"
end
end
# Adds credentials to the URI as Fetcher#configured_uri_for does # Adds credentials to the URI as Fetcher#configured_uri_for does
def configured_uri_for(uri) def configured_uri_for(uri)
if /https?:/ =~ uri if /https?:/ =~ uri
@ -233,21 +220,21 @@ module Bundler
end end
def check_allowed(command) def check_allowed(command)
command_with_no_credentials = URICredentialsFilter.credential_filtered_string(command, uri) command_with_no_credentials = URICredentialsFilter.credential_filtered_string(command.shelljoin, uri)
raise GitNotAllowedError.new(command_with_no_credentials) unless allow? raise GitNotAllowedError.new(command_with_no_credentials) unless allow?
command_with_no_credentials command_with_no_credentials
end end
def capture_and_filter_stderr(uri, cmd, chdir: SharedHelpers.pwd) def capture_and_filter_stderr(*cmd)
require "open3" require "open3"
return_value, captured_err, status = Open3.capture3(cmd, :chdir => chdir) return_value, captured_err, status = Open3.capture3(*cmd)
Bundler.ui.warn URICredentialsFilter.credential_filtered_string(captured_err, uri) if uri && !captured_err.empty? Bundler.ui.warn URICredentialsFilter.credential_filtered_string(captured_err, uri) unless captured_err.empty?
[return_value, status] [return_value, status]
end end
def capture_and_ignore_stderr(cmd, chdir: SharedHelpers.pwd) def capture_and_ignore_stderr(*cmd)
require "open3" require "open3"
return_value, _, status = Open3.capture3(cmd, :chdir => chdir) return_value, _, status = Open3.capture3(*cmd)
[return_value, status] [return_value, status]
end end
end end

View file

@ -487,8 +487,15 @@ module Bundler
uri = spec.remote.uri uri = spec.remote.uri
Bundler.ui.confirm("Fetching #{version_message(spec)}") Bundler.ui.confirm("Fetching #{version_message(spec)}")
rubygems_local_path = Bundler.rubygems.download_gem(spec, uri, download_path) rubygems_local_path = Bundler.rubygems.download_gem(spec, uri, download_path)
# older rubygems return varying file:// variants depending on version
rubygems_local_path = rubygems_local_path.gsub(/\Afile:/, "") unless Bundler.rubygems.provides?(">= 3.2.0.rc.2")
rubygems_local_path = rubygems_local_path.gsub(%r{\A//}, "") if Bundler.rubygems.provides?("< 3.1.0")
if rubygems_local_path != local_path if rubygems_local_path != local_path
FileUtils.mv(rubygems_local_path, local_path) SharedHelpers.filesystem_access(local_path) do
FileUtils.mv(rubygems_local_path, local_path)
end
end end
cache_globally(spec, local_path) cache_globally(spec, local_path)
end end

View file

@ -3,7 +3,16 @@
require "bundler/gem_tasks" require "bundler/gem_tasks"
<% default_task_names = [config[:test_task]].compact -%> <% default_task_names = [config[:test_task]].compact -%>
<% case config[:test] -%> <% case config[:test] -%>
<% when "minitest", "test-unit" -%> <% when "minitest" -%>
require "rake/testtask"
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"
t.test_files = FileList["test/**/test_*.rb"]
end
<% when "test-unit" -%>
require "rake/testtask" require "rake/testtask"
Rake::TestTask.new(:test) do |t| Rake::TestTask.new(:test) do |t|

View file

@ -25,7 +25,9 @@ Gem::Specification.new do |spec|
# Specify which files should be added to the gem when it is released. # Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git. # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
spec.files = Dir.chdir(File.expand_path(__dir__)) do spec.files = Dir.chdir(File.expand_path(__dir__)) do
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) } `git ls-files -z`.split("\x0").reject do |f|
f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
end
end end
spec.bindir = "exe" spec.bindir = "exe"
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) } spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }

View file

@ -2,7 +2,7 @@
require "test_helper" require "test_helper"
class <%= config[:constant_name] %>Test < Minitest::Test class Test<%= config[:constant_name] %> < Minitest::Test
def test_that_it_has_a_version_number def test_that_it_has_a_version_number
refute_nil ::<%= config[:constant_name] %>::VERSION refute_nil ::<%= config[:constant_name] %>::VERSION
end end

View file

@ -1,7 +1,7 @@
# frozen_string_literal: false # frozen_string_literal: false
module Bundler module Bundler
VERSION = "2.2.3".freeze VERSION = "2.3.0.dev".freeze
def self.bundler_major_version def self.bundler_major_version
@bundler_major_version ||= VERSION.split(".").first.to_i @bundler_major_version ||= VERSION.split(".").first.to_i

View file

@ -31,6 +31,16 @@ RSpec.describe Bundler::Definition do
to raise_error(Bundler::TemporaryResourceError, /temporarily unavailable/) to raise_error(Bundler::TemporaryResourceError, /temporarily unavailable/)
end end
end end
context "when Bundler::Definition.no_lock is set to true" do
subject { Bundler::Definition.new(nil, [], Bundler::SourceList.new, []) }
before { Bundler::Definition.no_lock = true }
after { Bundler::Definition.no_lock = false }
it "does not create a lock file" do
subject.lock("Gemfile.lock")
expect(File.file?("Gemfile.lock")).to eq false
end
end
end end
describe "detects changes" do describe "detects changes" do

View file

@ -1,6 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
require "bundler/settings" require "bundler/settings"
require "openssl"
RSpec.describe Bundler::Env do RSpec.describe Bundler::Env do
let(:git_proxy_stub) { Bundler::Source::Git::GitProxy.new(nil, nil, nil) } let(:git_proxy_stub) { Bundler::Source::Git::GitProxy.new(nil, nil, nil) }

View file

@ -256,6 +256,16 @@ RSpec.describe Bundler::GemHelper do
Rake.application["release"].invoke Rake.application["release"].invoke
end end
it "also works when releasing from an ambiguous reference" do
# Create a branch with the same name as the tag
sys_exec("git checkout -b v#{app_version}", :dir => app_path)
sys_exec("git push -u origin v#{app_version}", :dir => app_path)
expect(subject).to receive(:rubygem_push).with(app_gem_path.to_s)
Rake.application["release"].invoke
end
end end
context "on releasing with a custom tag prefix" do context "on releasing with a custom tag prefix" do

View file

@ -1,7 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative "../support/streams"
RSpec.describe Bundler::Plugin do RSpec.describe Bundler::Plugin do
Plugin = Bundler::Plugin Plugin = Bundler::Plugin
@ -296,11 +294,9 @@ RSpec.describe Bundler::Plugin do
end end
it "executes the hook" do it "executes the hook" do
out = capture(:stdout) do expect do
Plugin.hook(Bundler::Plugin::Events::EVENT_1) Plugin.hook(Bundler::Plugin::Events::EVENT_1)
end.strip end.to output("hook for event 1\n").to_stdout
expect(out).to eq("hook for event 1")
end end
context "single plugin declaring more than one hook" do context "single plugin declaring more than one hook" do
@ -311,12 +307,10 @@ RSpec.describe Bundler::Plugin do
RUBY RUBY
it "evals plugins.rb once" do it "evals plugins.rb once" do
out = capture(:stdout) do expect do
Plugin.hook(Bundler::Plugin::Events::EVENT_1) Plugin.hook(Bundler::Plugin::Events::EVENT_1)
Plugin.hook(Bundler::Plugin::Events::EVENT_2) Plugin.hook(Bundler::Plugin::Events::EVENT_2)
end.strip end.to output("loaded\n").to_stdout
expect(out).to eq("loaded")
end end
end end
@ -326,11 +320,9 @@ RSpec.describe Bundler::Plugin do
RUBY RUBY
it "is passed to the hook" do it "is passed to the hook" do
out = capture(:stdout) do expect do
Plugin.hook(Bundler::Plugin::Events::EVENT_1) { puts "win" } Plugin.hook(Bundler::Plugin::Events::EVENT_1) { puts "win" }
end.strip end.to output("win\n").to_stdout
expect(out).to eq("win")
end end
end end
end end

View file

@ -494,28 +494,4 @@ RSpec.describe Bundler::SharedHelpers do
end end
end end
end end
describe "#const_get_safely" do
module TargetNamespace
VALID_CONSTANT = 1
end
context "when the namespace does have the requested constant" do
it "returns the value of the requested constant" do
expect(subject.const_get_safely(:VALID_CONSTANT, TargetNamespace)).to eq(1)
end
end
context "when the requested constant is passed as a string" do
it "returns the value of the requested constant" do
expect(subject.const_get_safely("VALID_CONSTANT", TargetNamespace)).to eq(1)
end
end
context "when the namespace does not have the requested constant" do
it "returns nil" do
expect(subject.const_get_safely("INVALID_CONSTANT", TargetNamespace)).to be_nil
end
end
end
end end

View file

@ -11,21 +11,21 @@ RSpec.describe Bundler::Source::Git::GitProxy do
context "with configured credentials" do context "with configured credentials" do
it "adds username and password to URI" do it "adds username and password to URI" do
Bundler.settings.temporary(uri => "u:p") do Bundler.settings.temporary(uri => "u:p") do
expect(subject).to receive(:git_retry).with(match("https://u:p@github.com/rubygems/rubygems.git")) expect(subject).to receive(:git_retry).with("clone", "https://u:p@github.com/rubygems/rubygems.git", any_args)
subject.checkout subject.checkout
end end
end end
it "adds username and password to URI for host" do it "adds username and password to URI for host" do
Bundler.settings.temporary("github.com" => "u:p") do Bundler.settings.temporary("github.com" => "u:p") do
expect(subject).to receive(:git_retry).with(match("https://u:p@github.com/rubygems/rubygems.git")) expect(subject).to receive(:git_retry).with("clone", "https://u:p@github.com/rubygems/rubygems.git", any_args)
subject.checkout subject.checkout
end end
end end
it "does not add username and password to mismatched URI" do it "does not add username and password to mismatched URI" do
Bundler.settings.temporary("https://u:p@github.com/rubygems/rubygems-mismatch.git" => "u:p") do Bundler.settings.temporary("https://u:p@github.com/rubygems/rubygems-mismatch.git" => "u:p") do
expect(subject).to receive(:git_retry).with(match(uri)) expect(subject).to receive(:git_retry).with("clone", uri, any_args)
subject.checkout subject.checkout
end end
end end
@ -34,7 +34,7 @@ RSpec.describe Bundler::Source::Git::GitProxy do
Bundler.settings.temporary("github.com" => "u:p") do Bundler.settings.temporary("github.com" => "u:p") do
original = "https://orig:info@github.com/rubygems/rubygems.git" original = "https://orig:info@github.com/rubygems/rubygems.git"
subject = described_class.new(Pathname("path"), original, "HEAD") subject = described_class.new(Pathname("path"), original, "HEAD")
expect(subject).to receive(:git_retry).with(match(original)) expect(subject).to receive(:git_retry).with("clone", original, any_args)
subject.checkout subject.checkout
end end
end end
@ -129,12 +129,12 @@ RSpec.describe Bundler::Source::Git::GitProxy do
context "when given a SHA as a revision" do context "when given a SHA as a revision" do
let(:revision) { "abcd" * 10 } let(:revision) { "abcd" * 10 }
let(:command) { "reset --hard #{revision}" } let(:command) { ["reset", "--hard", revision] }
it "fails gracefully when resetting to the revision fails" do it "fails gracefully when resetting to the revision fails" do
expect(subject).to receive(:git_retry).with(start_with("clone ")) { destination.mkpath } expect(subject).to receive(:git_retry).with("clone", any_args) { destination.mkpath }
expect(subject).to receive(:git_retry).with(start_with("fetch "), :dir => destination) expect(subject).to receive(:git_retry).with("fetch", any_args, :dir => destination)
expect(subject).to receive(:git).with(command, :dir => destination).and_raise(Bundler::Source::Git::GitCommandError.new(command, cache, destination)) expect(subject).to receive(:git).with(*command, :dir => destination).and_raise(Bundler::Source::Git::GitCommandError.new(command, cache, destination))
expect(subject).not_to receive(:git) expect(subject).not_to receive(:git)
expect { subject.copy_to(destination, submodules) }. expect { subject.copy_to(destination, submodules) }.

View file

@ -1,7 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative "../../support/streams"
RSpec.describe Bundler::UI::Shell do RSpec.describe Bundler::UI::Shell do
subject { described_class.new } subject { described_class.new }
@ -43,10 +41,19 @@ RSpec.describe Bundler::UI::Shell do
context "when stderr is closed" do context "when stderr is closed" do
it "doesn't report anything" do it "doesn't report anything" do
output = capture(:stderr, :closed => true) do output = begin
subject.error("Something went wrong") result = StringIO.new
end result.close
expect(output).to_not eq("Something went wrong\n")
$stderr = result
subject.error("Something went wrong")
result.string
ensure
$stderr = STDERR
end
expect(output).to_not eq("Something went wrong")
end end
end end
end end

View file

@ -221,7 +221,7 @@ RSpec.describe "bundle cache" do
end end
end end
bundle "config --local without wo" bundle "config set --local without wo"
install_gemfile <<-G install_gemfile <<-G
source "file:#{gem_repo1}" source "file:#{gem_repo1}"
gem "rack" gem "rack"
@ -237,7 +237,7 @@ RSpec.describe "bundle cache" do
expect(the_bundle).to include_gem "rack 1.0" expect(the_bundle).to include_gem "rack 1.0"
expect(the_bundle).not_to include_gems "weakling", "uninstallable" expect(the_bundle).not_to include_gems "weakling", "uninstallable"
bundle "config --local without wo" bundle "config set --local without wo"
bundle :install bundle :install
expect(the_bundle).to include_gem "rack 1.0" expect(the_bundle).to include_gem "rack 1.0"
expect(the_bundle).not_to include_gems "weakling", "uninstallable" expect(the_bundle).not_to include_gems "weakling", "uninstallable"
@ -254,7 +254,7 @@ RSpec.describe "bundle cache" do
end end
subject do subject do
bundle "config --local frozen true" bundle "config set --local frozen true"
bundle :cache, :raise_on_error => false bundle :cache, :raise_on_error => false
end end
@ -304,8 +304,8 @@ RSpec.describe "bundle install with gem sources" do
simulate_new_machine simulate_new_machine
FileUtils.rm_rf gem_repo2 FileUtils.rm_rf gem_repo2
bundle "config --local deployment true" bundle "config set --local deployment true"
bundle "config --local path vendor/bundle" bundle "config set --local path vendor/bundle"
bundle :install bundle :install
expect(the_bundle).to include_gems "rack 1.0.0" expect(the_bundle).to include_gems "rack 1.0.0"
end end

View file

@ -124,7 +124,7 @@ RSpec.describe "bundle check" do
gem "rack", :group => :foo gem "rack", :group => :foo
G G
bundle "config --local without foo" bundle "config set --local without foo"
bundle :install bundle :install
gemfile <<-G gemfile <<-G
@ -217,7 +217,7 @@ RSpec.describe "bundle check" do
gem "foo" gem "foo"
G G
bundle "config --local deployment true" bundle "config set --local deployment true"
bundle "install" bundle "install"
FileUtils.rm(bundled_app_lock) FileUtils.rm(bundled_app_lock)

View file

@ -45,7 +45,7 @@ RSpec.describe ".bundle/config" do
it "can be moved with an environment variable" do it "can be moved with an environment variable" do
ENV["BUNDLE_APP_CONFIG"] = tmp("foo/bar").to_s ENV["BUNDLE_APP_CONFIG"] = tmp("foo/bar").to_s
bundle "config --local path vendor/bundle" bundle "config set --local path vendor/bundle"
bundle "install" bundle "install"
expect(bundled_app(".bundle")).not_to exist expect(bundled_app(".bundle")).not_to exist
@ -57,7 +57,7 @@ RSpec.describe ".bundle/config" do
FileUtils.mkdir_p bundled_app("omg") FileUtils.mkdir_p bundled_app("omg")
ENV["BUNDLE_APP_CONFIG"] = "../foo" ENV["BUNDLE_APP_CONFIG"] = "../foo"
bundle "config --local path vendor/bundle" bundle "config set --local path vendor/bundle"
bundle "install", :dir => bundled_app("omg") bundle "install", :dir => bundled_app("omg")
expect(bundled_app(".bundle")).not_to exist expect(bundled_app(".bundle")).not_to exist

View file

@ -295,7 +295,7 @@ RSpec.describe "bundle exec" do
end end
it "handles gems installed with --without" do it "handles gems installed with --without" do
bundle "config --local without middleware" bundle "config set --local without middleware"
install_gemfile <<-G install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}" source "#{file_uri_for(gem_repo1)}"
gem "rack" # rack 0.9.1 and 1.0 exist gem "rack" # rack 0.9.1 and 1.0 exist
@ -448,35 +448,35 @@ RSpec.describe "bundle exec" do
with_fake_man do with_fake_man do
bundle "#{exec} --help cat" bundle "#{exec} --help cat"
end end
expect(out).to include(%(["#{root}/man/bundle-exec.1"])) expect(out).to include(%(["#{man_dir}/bundle-exec.1"]))
end end
it "shows bundle-exec's man page when --help is before exec" do it "shows bundle-exec's man page when --help is before exec" do
with_fake_man do with_fake_man do
bundle "--help #{exec}" bundle "--help #{exec}"
end end
expect(out).to include(%(["#{root}/man/bundle-exec.1"])) expect(out).to include(%(["#{man_dir}/bundle-exec.1"]))
end end
it "shows bundle-exec's man page when -h is before exec" do it "shows bundle-exec's man page when -h is before exec" do
with_fake_man do with_fake_man do
bundle "-h #{exec}" bundle "-h #{exec}"
end end
expect(out).to include(%(["#{root}/man/bundle-exec.1"])) expect(out).to include(%(["#{man_dir}/bundle-exec.1"]))
end end
it "shows bundle-exec's man page when --help is after exec" do it "shows bundle-exec's man page when --help is after exec" do
with_fake_man do with_fake_man do
bundle "#{exec} --help" bundle "#{exec} --help"
end end
expect(out).to include(%(["#{root}/man/bundle-exec.1"])) expect(out).to include(%(["#{man_dir}/bundle-exec.1"]))
end end
it "shows bundle-exec's man page when -h is after exec" do it "shows bundle-exec's man page when -h is after exec" do
with_fake_man do with_fake_man do
bundle "#{exec} -h" bundle "#{exec} -h"
end end
expect(out).to include(%(["#{root}/man/bundle-exec.1"])) expect(out).to include(%(["#{man_dir}/bundle-exec.1"]))
end end
end end
end end

View file

@ -5,14 +5,14 @@ RSpec.describe "bundle help" do
with_fake_man do with_fake_man do
bundle "help gemfile" bundle "help gemfile"
end end
expect(out).to eq(%(["#{root}/man/gemfile.5"])) expect(out).to eq(%(["#{man_dir}/gemfile.5"]))
end end
it "prefixes bundle commands with bundle- when finding the man files" do it "prefixes bundle commands with bundle- when finding the man files" do
with_fake_man do with_fake_man do
bundle "help install" bundle "help install"
end end
expect(out).to eq(%(["#{root}/man/bundle-install.1"])) expect(out).to eq(%(["#{man_dir}/bundle-install.1"]))
end end
it "simply outputs the human readable file when there is no man on the path" do it "simply outputs the human readable file when there is no man on the path" do
@ -45,28 +45,28 @@ RSpec.describe "bundle help" do
with_fake_man do with_fake_man do
bundle "install --help" bundle "install --help"
end end
expect(out).to eq(%(["#{root}/man/bundle-install.1"])) expect(out).to eq(%(["#{man_dir}/bundle-install.1"]))
end end
it "is called when the --help flag is used before the command" do it "is called when the --help flag is used before the command" do
with_fake_man do with_fake_man do
bundle "--help install" bundle "--help install"
end end
expect(out).to eq(%(["#{root}/man/bundle-install.1"])) expect(out).to eq(%(["#{man_dir}/bundle-install.1"]))
end end
it "is called when the -h flag is used before the command" do it "is called when the -h flag is used before the command" do
with_fake_man do with_fake_man do
bundle "-h install" bundle "-h install"
end end
expect(out).to eq(%(["#{root}/man/bundle-install.1"])) expect(out).to eq(%(["#{man_dir}/bundle-install.1"]))
end end
it "is called when the -h flag is used after the command" do it "is called when the -h flag is used after the command" do
with_fake_man do with_fake_man do
bundle "install -h" bundle "install -h"
end end
expect(out).to eq(%(["#{root}/man/bundle-install.1"])) expect(out).to eq(%(["#{man_dir}/bundle-install.1"]))
end end
it "has helpful output when using --help flag for a non-existent command" do it "has helpful output when using --help flag for a non-existent command" do
@ -80,11 +80,11 @@ RSpec.describe "bundle help" do
with_fake_man do with_fake_man do
bundle "--help" bundle "--help"
end end
expect(out).to eq(%(["#{root}/man/bundle.1"])) expect(out).to eq(%(["#{man_dir}/bundle.1"]))
with_fake_man do with_fake_man do
bundle "-h" bundle "-h"
end end
expect(out).to eq(%(["#{root}/man/bundle.1"])) expect(out).to eq(%(["#{man_dir}/bundle.1"]))
end end
end end

View file

@ -291,7 +291,7 @@ RSpec.describe "bundle install with gem sources" do
end end
it "works" do it "works" do
bundle "config --local path vendor" bundle "config set --local path vendor"
bundle "install" bundle "install"
expect(the_bundle).to include_gems "rack 1.0" expect(the_bundle).to include_gems "rack 1.0"
end end
@ -580,8 +580,10 @@ RSpec.describe "bundle install with gem sources" do
end end
describe "when bundle path does not have write access", :permissions do describe "when bundle path does not have write access", :permissions do
let(:bundle_path) { bundled_app("vendor") }
before do before do
FileUtils.mkdir_p(bundled_app("vendor")) FileUtils.mkdir_p(bundle_path)
gemfile <<-G gemfile <<-G
source "#{file_uri_for(gem_repo1)}" source "#{file_uri_for(gem_repo1)}"
gem 'rack' gem 'rack'
@ -589,11 +591,32 @@ RSpec.describe "bundle install with gem sources" do
end end
it "should display a proper message to explain the problem" do it "should display a proper message to explain the problem" do
FileUtils.chmod(0o500, bundled_app("vendor")) FileUtils.chmod(0o500, bundle_path)
bundle "config --local path vendor" bundle "config set --local path vendor"
bundle :install, :raise_on_error => false bundle :install, :raise_on_error => false
expect(err).to include(bundled_app("vendor").to_s) expect(err).to include(bundle_path.to_s)
expect(err).to include("grant write permissions")
end
end
describe "when bundle cache path does not have write access", :permissions do
let(:cache_path) { bundled_app("vendor/#{Bundler.ruby_scope}/cache") }
before do
FileUtils.mkdir_p(cache_path)
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem 'rack'
G
end
it "should display a proper message to explain the problem" do
FileUtils.chmod(0o500, cache_path)
bundle "config set --local path vendor"
bundle :install, :raise_on_error => false
expect(err).to include(cache_path.to_s)
expect(err).to include("grant write permissions") expect(err).to include("grant write permissions")
end end
end end
@ -604,7 +627,7 @@ RSpec.describe "bundle install with gem sources" do
source "#{file_uri_for(gem_repo1)}" source "#{file_uri_for(gem_repo1)}"
gem "rack" gem "rack"
G G
bundle "config --local path bundle" bundle "config set --local path bundle"
bundle "install", :standalone => true bundle "install", :standalone => true
end end

View file

@ -536,7 +536,7 @@ RSpec.describe "bundle gem" do
end end
it "builds spec skeleton" do it "builds spec skeleton" do
expect(bundled_app("#{gem_name}/test/#{require_path}_test.rb")).to exist expect(bundled_app("#{gem_name}/test/test_#{require_path}.rb")).to exist
expect(bundled_app("#{gem_name}/test/test_helper.rb")).to exist expect(bundled_app("#{gem_name}/test/test_helper.rb")).to exist
end end
end end
@ -556,7 +556,7 @@ RSpec.describe "bundle gem" do
end end
it "builds spec skeleton" do it "builds spec skeleton" do
expect(bundled_app("#{gem_name}/test/#{require_path}_test.rb")).to exist expect(bundled_app("#{gem_name}/test/test_#{require_path}.rb")).to exist
expect(bundled_app("#{gem_name}/test/test_helper.rb")).to exist expect(bundled_app("#{gem_name}/test/test_helper.rb")).to exist
end end
@ -565,11 +565,11 @@ RSpec.describe "bundle gem" do
end end
it "requires 'test_helper'" do it "requires 'test_helper'" do
expect(bundled_app("#{gem_name}/test/#{require_path}_test.rb").read).to include(%(require "test_helper")) expect(bundled_app("#{gem_name}/test/test_#{require_path}.rb").read).to include(%(require "test_helper"))
end end
it "creates a default test which fails" do it "creates a default test which fails" do
expect(bundled_app("#{gem_name}/test/#{require_path}_test.rb").read).to include("assert false") expect(bundled_app("#{gem_name}/test/test_#{require_path}.rb").read).to include("assert false")
end end
end end
@ -589,7 +589,7 @@ RSpec.describe "bundle gem" do
Rake::TestTask.new(:test) do |t| Rake::TestTask.new(:test) do |t|
t.libs << "test" t.libs << "test"
t.libs << "lib" t.libs << "lib"
t.test_files = FileList["test/**/*_test.rb"] t.test_files = FileList["test/**/test_*.rb"]
end end
task default: :test task default: :test

View file

@ -29,21 +29,21 @@ RSpec.describe "post bundle message" do
expect(out).to include(bundle_complete_message) expect(out).to include(bundle_complete_message)
expect(out).to include(installed_gems_stats) expect(out).to include(installed_gems_stats)
bundle "config --local without emo" bundle "config set --local without emo"
bundle :install bundle :install
expect(out).to include(bundle_show_message) expect(out).to include(bundle_show_message)
expect(out).to include("Gems in the group emo were not installed") expect(out).to include("Gems in the group emo were not installed")
expect(out).to include(bundle_complete_message) expect(out).to include(bundle_complete_message)
expect(out).to include(installed_gems_stats) expect(out).to include(installed_gems_stats)
bundle "config --local without emo test" bundle "config set --local without emo test"
bundle :install bundle :install
expect(out).to include(bundle_show_message) expect(out).to include(bundle_show_message)
expect(out).to include("Gems in the groups emo and test were not installed") expect(out).to include("Gems in the groups emo and test were not installed")
expect(out).to include(bundle_complete_message) expect(out).to include(bundle_complete_message)
expect(out).to include("4 Gemfile dependencies, 3 gems now installed.") expect(out).to include("4 Gemfile dependencies, 3 gems now installed.")
bundle "config --local without emo obama test" bundle "config set --local without emo obama test"
bundle :install bundle :install
expect(out).to include(bundle_show_message) expect(out).to include(bundle_show_message)
expect(out).to include("Gems in the groups emo, obama and test were not installed") expect(out).to include("Gems in the groups emo, obama and test were not installed")
@ -55,28 +55,28 @@ RSpec.describe "post bundle message" do
let(:bundle_path) { "./vendor" } let(:bundle_path) { "./vendor" }
it "shows proper messages according to the configured groups" do it "shows proper messages according to the configured groups" do
bundle "config --local path vendor" bundle "config set --local path vendor"
bundle :install bundle :install
expect(out).to include(bundle_show_path_message) expect(out).to include(bundle_show_path_message)
expect(out).to_not include("Gems in the group") expect(out).to_not include("Gems in the group")
expect(out).to include(bundle_complete_message) expect(out).to include(bundle_complete_message)
bundle "config --local path vendor" bundle "config set --local path vendor"
bundle "config --local without emo" bundle "config set --local without emo"
bundle :install bundle :install
expect(out).to include(bundle_show_path_message) expect(out).to include(bundle_show_path_message)
expect(out).to include("Gems in the group emo were not installed") expect(out).to include("Gems in the group emo were not installed")
expect(out).to include(bundle_complete_message) expect(out).to include(bundle_complete_message)
bundle "config --local path vendor" bundle "config set --local path vendor"
bundle "config --local without emo test" bundle "config set --local without emo test"
bundle :install bundle :install
expect(out).to include(bundle_show_path_message) expect(out).to include(bundle_show_path_message)
expect(out).to include("Gems in the groups emo and test were not installed") expect(out).to include("Gems in the groups emo and test were not installed")
expect(out).to include(bundle_complete_message) expect(out).to include(bundle_complete_message)
bundle "config --local path vendor" bundle "config set --local path vendor"
bundle "config --local without emo obama test" bundle "config set --local without emo obama test"
bundle :install bundle :install
expect(out).to include(bundle_show_path_message) expect(out).to include(bundle_show_path_message)
expect(out).to include("Gems in the groups emo, obama and test were not installed") expect(out).to include("Gems in the groups emo, obama and test were not installed")
@ -88,7 +88,7 @@ RSpec.describe "post bundle message" do
let(:bundle_path) { bundled_app("cache") } let(:bundle_path) { bundled_app("cache") }
it "shows proper messages according to the configured groups" do it "shows proper messages according to the configured groups" do
bundle "config --local path #{bundle_path}" bundle "config set --local path #{bundle_path}"
bundle :install bundle :install
expect(out).to include("Bundled gems are installed into `./cache`") expect(out).to include("Bundled gems are installed into `./cache`")
expect(out).to_not include("Gems in the group") expect(out).to_not include("Gems in the group")
@ -100,7 +100,7 @@ RSpec.describe "post bundle message" do
let(:bundle_path) { tmp("not_bundled_app") } let(:bundle_path) { tmp("not_bundled_app") }
it "shows proper messages according to the configured groups" do it "shows proper messages according to the configured groups" do
bundle "config --local path #{bundle_path}" bundle "config set --local path #{bundle_path}"
bundle :install bundle :install
expect(out).to include("Bundled gems are installed into `#{tmp("not_bundled_app")}`") expect(out).to include("Bundled gems are installed into `#{tmp("not_bundled_app")}`")
expect(out).to_not include("Gems in the group") expect(out).to_not include("Gems in the group")
@ -193,19 +193,19 @@ The source does not contain any versions of 'not-a-gem'
expect(out).not_to include("Gems in the groups") expect(out).not_to include("Gems in the groups")
expect(out).to include(bundle_updated_message) expect(out).to include(bundle_updated_message)
bundle "config --local without emo" bundle "config set --local without emo"
bundle :install bundle :install
bundle :update, :all => true bundle :update, :all => true
expect(out).to include("Gems in the group emo were not updated") expect(out).to include("Gems in the group emo were not updated")
expect(out).to include(bundle_updated_message) expect(out).to include(bundle_updated_message)
bundle "config --local without emo test" bundle "config set --local without emo test"
bundle :install bundle :install
bundle :update, :all => true bundle :update, :all => true
expect(out).to include("Gems in the groups emo and test were not updated") expect(out).to include("Gems in the groups emo and test were not updated")
expect(out).to include(bundle_updated_message) expect(out).to include(bundle_updated_message)
bundle "config --local without emo obama test" bundle "config set --local without emo obama test"
bundle :install bundle :install
bundle :update, :all => true bundle :update, :all => true
expect(out).to include("Gems in the groups emo, obama and test were not updated") expect(out).to include("Gems in the groups emo, obama and test were not updated")

View file

@ -44,8 +44,8 @@ RSpec.describe "install in deployment or frozen mode" do
it "still works if you are not in the app directory and specify --gemfile" do it "still works if you are not in the app directory and specify --gemfile" do
bundle "install" bundle "install"
simulate_new_machine simulate_new_machine
bundle "config --local deployment true" bundle "config set --local deployment true"
bundle "config --local path vendor/bundle" bundle "config set --local path vendor/bundle"
bundle "install --gemfile #{tmp}/bundled_app/Gemfile", :dir => tmp bundle "install --gemfile #{tmp}/bundled_app/Gemfile", :dir => tmp
expect(the_bundle).to include_gems "rack 1.0" expect(the_bundle).to include_gems "rack 1.0"
end end
@ -58,8 +58,8 @@ RSpec.describe "install in deployment or frozen mode" do
end end
G G
bundle :install bundle :install
bundle "config --local deployment true" bundle "config set --local deployment true"
bundle "config --local without test" bundle "config set --local without test"
bundle :install bundle :install
end end
@ -67,7 +67,7 @@ RSpec.describe "install in deployment or frozen mode" do
skip "doesn't find bundle" if Gem.win_platform? skip "doesn't find bundle" if Gem.win_platform?
bundle :install bundle :install
bundle "config --local deployment true" bundle "config set --local deployment true"
bundle :install bundle :install
bundle "exec bundle check", :env => { "PATH" => path } bundle "exec bundle check", :env => { "PATH" => path }
end end
@ -81,7 +81,7 @@ RSpec.describe "install in deployment or frozen mode" do
G G
bundle :install bundle :install
bundle "config --local deployment true" bundle "config set --local deployment true"
bundle :install bundle :install
end end
@ -92,7 +92,7 @@ RSpec.describe "install in deployment or frozen mode" do
gem "rack-obama", ">= 1.0" gem "rack-obama", ">= 1.0"
G G
bundle "config --local deployment true" bundle "config set --local deployment true"
bundle :install, :artifice => "endpoint_strict_basic_authentication" bundle :install, :artifice => "endpoint_strict_basic_authentication"
end end
@ -103,7 +103,7 @@ RSpec.describe "install in deployment or frozen mode" do
end end
G G
bundle "config --local deployment true" bundle "config set --local deployment true"
bundle :install bundle :install
expect(the_bundle).to include_gems "rack 1.0" expect(the_bundle).to include_gems "rack 1.0"
@ -111,7 +111,7 @@ RSpec.describe "install in deployment or frozen mode" 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
before do before do
bundle "config --local path vendor/bundle" bundle "config set --local path vendor/bundle"
bundle "install" bundle "install"
gemfile <<-G gemfile <<-G
source "http://user_name:password@localgemserver.test/" source "http://user_name:password@localgemserver.test/"
@ -215,7 +215,7 @@ RSpec.describe "install in deployment or frozen mode" do
gem "rack-obama" gem "rack-obama"
G G
bundle "config --local deployment true" bundle "config set --local deployment true"
bundle :install, :raise_on_error => false bundle :install, :raise_on_error => false
expect(err).to include("deployment mode") expect(err).to include("deployment mode")
expect(err).to include("You have added to the Gemfile") expect(err).to include("You have added to the Gemfile")
@ -234,9 +234,9 @@ RSpec.describe "install in deployment or frozen mode" do
expect(the_bundle).to include_gems "path_gem 1.0" expect(the_bundle).to include_gems "path_gem 1.0"
FileUtils.rm_r lib_path("path_gem-1.0") FileUtils.rm_r lib_path("path_gem-1.0")
bundle "config --local path .bundle" bundle "config set --local path .bundle"
bundle "config --local without development" bundle "config set --local without development"
bundle "config --local deployment true" bundle "config set --local deployment true"
bundle :install, :env => { "DEBUG" => "1" } bundle :install, :env => { "DEBUG" => "1" }
run "puts :WIN" run "puts :WIN"
expect(out).to eq("WIN") expect(out).to eq("WIN")
@ -252,8 +252,8 @@ RSpec.describe "install in deployment or frozen mode" do
expect(the_bundle).to include_gems "path_gem 1.0" expect(the_bundle).to include_gems "path_gem 1.0"
FileUtils.rm_r lib_path("path_gem-1.0") FileUtils.rm_r lib_path("path_gem-1.0")
bundle "config --local path .bundle" bundle "config set --local path .bundle"
bundle "config --local deployment true" bundle "config set --local deployment true"
bundle :install, :raise_on_error => false bundle :install, :raise_on_error => false
expect(err).to include("The path `#{lib_path("path_gem-1.0")}` does not exist.") expect(err).to include("The path `#{lib_path("path_gem-1.0")}` does not exist.")
end end
@ -324,7 +324,7 @@ RSpec.describe "install in deployment or frozen mode" do
gem "activesupport" gem "activesupport"
G G
bundle "config --local deployment true" bundle "config set --local deployment true"
bundle :install, :raise_on_error => false bundle :install, :raise_on_error => false
expect(err).to include("deployment mode") expect(err).to include("deployment mode")
expect(err).to include("You have added to the Gemfile:\n* activesupport\n\n") expect(err).to include("You have added to the Gemfile:\n* activesupport\n\n")
@ -338,7 +338,7 @@ RSpec.describe "install in deployment or frozen mode" do
gem "rack", :git => "git://hubz.com" gem "rack", :git => "git://hubz.com"
G G
bundle "config --local deployment true" bundle "config set --local deployment true"
bundle :install, :raise_on_error => false bundle :install, :raise_on_error => false
expect(err).to include("deployment mode") expect(err).to include("deployment mode")
expect(err).to include("You have added to the Gemfile:\n* source: git://hubz.com (at master)") expect(err).to include("You have added to the Gemfile:\n* source: git://hubz.com (at master)")
@ -358,7 +358,7 @@ RSpec.describe "install in deployment or frozen mode" do
gem "rack" gem "rack"
G G
bundle "config --local deployment true" bundle "config set --local deployment true"
bundle :install, :raise_on_error => false bundle :install, :raise_on_error => false
expect(err).to include("deployment mode") expect(err).to include("deployment mode")
expect(err).to include("You have deleted from the Gemfile:\n* source: #{lib_path("rack-1.0")} (at master@#{revision_for(lib_path("rack-1.0"))[0..6]}") expect(err).to include("You have deleted from the Gemfile:\n* source: #{lib_path("rack-1.0")} (at master@#{revision_for(lib_path("rack-1.0"))[0..6]}")
@ -382,7 +382,7 @@ RSpec.describe "install in deployment or frozen mode" do
gem "foo", :git => "#{lib_path("rack")}" gem "foo", :git => "#{lib_path("rack")}"
G G
bundle "config --local deployment true" bundle "config set --local deployment true"
bundle :install, :raise_on_error => false bundle :install, :raise_on_error => false
expect(err).to include("deployment mode") expect(err).to include("deployment mode")
expect(err).to include("You have changed in the Gemfile:\n* rack from `no specified source` to `#{lib_path("rack")} (at master@#{revision_for(lib_path("rack"))[0..6]})`") expect(err).to include("You have changed in the Gemfile:\n* rack from `no specified source` to `#{lib_path("rack")} (at master@#{revision_for(lib_path("rack"))[0..6]})`")

View file

@ -47,7 +47,7 @@ RSpec.describe "bundle install with gemfile that uses eval_gemfile" do
# parsed lockfile and the evaluated gemfile. # parsed lockfile and the evaluated gemfile.
it "bundles with deployment mode configured" do it "bundles with deployment mode configured" do
bundle :install bundle :install
bundle "config --local deployment true" bundle "config set --local deployment true"
bundle :install bundle :install
end end
end end

View file

@ -291,7 +291,7 @@ RSpec.describe "bundle install from an existing gemspec" do
s.add_dependency "activesupport", ">= 1.0.1" s.add_dependency "activesupport", ">= 1.0.1"
end end
bundle "config --local deployment true" bundle "config set --local deployment true"
bundle :install, :raise_on_error => false bundle :install, :raise_on_error => false
expect(err).to include("changed") expect(err).to include("changed")
@ -558,7 +558,7 @@ RSpec.describe "bundle install from an existing gemspec" do
it "installs the ruby platform gemspec and skips dev deps with `without development` configured" do it "installs the ruby platform gemspec and skips dev deps with `without development` configured" do
simulate_platform "ruby" simulate_platform "ruby"
bundle "config --local without development" bundle "config set --local without development"
install_gemfile <<-G install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}" source "#{file_uri_for(gem_repo1)}"
gemspec :path => '#{tmp.join("foo")}', :name => 'foo' gemspec :path => '#{tmp.join("foo")}', :name => 'foo'

View file

@ -128,7 +128,7 @@ RSpec.describe "bundle install with git sources" do
end end
it "still works after moving the application directory" do it "still works after moving the application directory" do
bundle "config --local path vendor/bundle" bundle "config set --local path vendor/bundle"
bundle "install" bundle "install"
FileUtils.mv bundled_app, tmp("bundled_app.bck") FileUtils.mv bundled_app, tmp("bundled_app.bck")
@ -137,7 +137,7 @@ RSpec.describe "bundle install with git sources" do
end end
it "can still install after moving the application directory" do it "can still install after moving the application directory" do
bundle "config --local path vendor/bundle" bundle "config set --local path vendor/bundle"
bundle "install" bundle "install"
FileUtils.mv bundled_app, tmp("bundled_app.bck") FileUtils.mv bundled_app, tmp("bundled_app.bck")
@ -1064,7 +1064,7 @@ RSpec.describe "bundle install with git sources" do
simulate_new_machine simulate_new_machine
bundle "config --local deployment true" bundle "config set --local deployment true"
bundle :install bundle :install
end end
end end

View file

@ -86,7 +86,7 @@ RSpec.describe "bundle install with groups" do
end end
it "installs gems in the default group" do it "installs gems in the default group" do
bundle "config --local without emo" bundle "config set --local without emo"
bundle :install bundle :install
expect(the_bundle).to include_gems "rack 1.0.0", :groups => [:default] expect(the_bundle).to include_gems "rack 1.0.0", :groups => [:default]
end end
@ -117,7 +117,7 @@ RSpec.describe "bundle install with groups" do
end end
it "does not install gems from the excluded group" do it "does not install gems from the excluded group" do
bundle "config --local without emo" bundle "config set --local without emo"
bundle :install bundle :install
expect(the_bundle).not_to include_gems "activesupport 2.3.5", :groups => [:default] expect(the_bundle).not_to include_gems "activesupport 2.3.5", :groups => [:default]
end end
@ -130,13 +130,13 @@ RSpec.describe "bundle install with groups" do
end end
it "does not say it installed gems from the excluded group" do it "does not say it installed gems from the excluded group" do
bundle "config --local without emo" bundle "config set --local without emo"
bundle :install bundle :install
expect(out).not_to include("activesupport") expect(out).not_to include("activesupport")
end end
it "allows Bundler.setup for specific groups" do it "allows Bundler.setup for specific groups" do
bundle "config --local without emo" bundle "config set --local without emo"
bundle :install bundle :install
run("require 'rack'; puts RACK", :default) run("require 'rack'; puts RACK", :default)
expect(out).to eq("1.0.0") expect(out).to eq("1.0.0")
@ -151,7 +151,7 @@ RSpec.describe "bundle install with groups" do
end end
G G
bundle "config --local without emo" bundle "config set --local without emo"
bundle :install bundle :install
expect(the_bundle).to include_gems "activesupport 2.3.2", :groups => [:default] expect(the_bundle).to include_gems "activesupport 2.3.2", :groups => [:default]
end end
@ -188,7 +188,7 @@ RSpec.describe "bundle install with groups" do
end end
it "installs gems from the optional group when requested" do it "installs gems from the optional group when requested" do
bundle "config --local with debugging" bundle "config set --local with debugging"
bundle :install bundle :install
expect(the_bundle).to include_gems "thin 1.0" expect(the_bundle).to include_gems "thin 1.0"
end end
@ -214,13 +214,13 @@ RSpec.describe "bundle install with groups" do
end end
it "removes groups from without when passed at --with", :bundler => "< 3" do it "removes groups from without when passed at --with", :bundler => "< 3" do
bundle "config --local without emo" bundle "config set --local without emo"
bundle "install --with emo" bundle "install --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 "removes groups from with when passed at --without", :bundler => "< 3" do it "removes groups from with when passed at --without", :bundler => "< 3" do
bundle "config --local with debugging" bundle "config set --local with debugging"
bundle "install --without debugging", :raise_on_error => false bundle "install --without debugging", :raise_on_error => false
expect(the_bundle).not_to include_gem "thin 1.0" expect(the_bundle).not_to include_gem "thin 1.0"
end end
@ -251,13 +251,13 @@ RSpec.describe "bundle install with groups" do
end end
it "has no effect when listing a not optional group in with" do it "has no effect when listing a not optional group in with" do
bundle "config --local with emo" bundle "config set --local with emo"
bundle :install bundle :install
expect(the_bundle).to include_gems "activesupport 2.3.5" expect(the_bundle).to include_gems "activesupport 2.3.5"
end end
it "has no effect when listing an optional group in without" do it "has no effect when listing an optional group in without" do
bundle "config --local without debugging" bundle "config set --local without debugging"
bundle :install bundle :install
expect(the_bundle).not_to include_gems "thin 1.0" expect(the_bundle).not_to include_gems "thin 1.0"
end end
@ -275,13 +275,13 @@ RSpec.describe "bundle install with groups" do
end end
it "installs gems in the default group" do it "installs gems in the default group" do
bundle "config --local without emo lolercoaster" bundle "config set --local without emo lolercoaster"
bundle :install bundle :install
expect(the_bundle).to include_gems "rack 1.0.0" expect(the_bundle).to include_gems "rack 1.0.0"
end end
it "installs the gem if any of its groups are installed" do it "installs the gem if any of its groups are installed" do
bundle "config --local without emo" bundle "config set --local without emo"
bundle :install bundle :install
expect(the_bundle).to include_gems "rack 1.0.0", "activesupport 2.3.5" expect(the_bundle).to include_gems "rack 1.0.0", "activesupport 2.3.5"
end end
@ -303,19 +303,19 @@ RSpec.describe "bundle install with groups" do
end end
it "installs the gem unless all groups are excluded" do it "installs the gem unless all groups are excluded" do
bundle "config --local without emo" bundle "config set --local without emo"
bundle :install bundle :install
expect(the_bundle).to include_gems "activesupport 2.3.5" expect(the_bundle).to include_gems "activesupport 2.3.5"
bundle "config --local without lolercoaster" bundle "config set --local without lolercoaster"
bundle :install bundle :install
expect(the_bundle).to include_gems "activesupport 2.3.5" expect(the_bundle).to include_gems "activesupport 2.3.5"
bundle "config --local without emo lolercoaster" bundle "config set --local without emo lolercoaster"
bundle :install bundle :install
expect(the_bundle).not_to include_gems "activesupport 2.3.5" expect(the_bundle).not_to include_gems "activesupport 2.3.5"
bundle "config --local without 'emo lolercoaster'" bundle "config set --local without 'emo lolercoaster'"
bundle :install bundle :install
expect(the_bundle).not_to include_gems "activesupport 2.3.5" expect(the_bundle).not_to include_gems "activesupport 2.3.5"
end end
@ -336,13 +336,13 @@ RSpec.describe "bundle install with groups" do
end end
it "installs gems in the default group" do it "installs gems in the default group" do
bundle "config --local without emo lolercoaster" bundle "config set --local without emo lolercoaster"
bundle :install bundle :install
expect(the_bundle).to include_gems "rack 1.0.0" expect(the_bundle).to include_gems "rack 1.0.0"
end end
it "installs the gem if any of its groups are installed" do it "installs the gem if any of its groups are installed" do
bundle "config --local without emo" bundle "config set --local without emo"
bundle :install bundle :install
expect(the_bundle).to include_gems "rack 1.0.0", "activesupport 2.3.5" expect(the_bundle).to include_gems "rack 1.0.0", "activesupport 2.3.5"
end end
@ -380,7 +380,7 @@ RSpec.describe "bundle install with groups" do
system_gems "rack-0.9.1" system_gems "rack-0.9.1"
bundle "config --local without rack" bundle "config set --local without rack"
install_gemfile <<-G install_gemfile <<-G
source "#{file_uri_for(gem_repo2)}" source "#{file_uri_for(gem_repo2)}"
gem "rack" gem "rack"
@ -404,7 +404,7 @@ RSpec.describe "bundle install with groups" do
it "does not hit the remote a second time" do it "does not hit the remote a second time" do
FileUtils.rm_rf gem_repo2 FileUtils.rm_rf gem_repo2
bundle "config --local without rack" bundle "config set --local without rack"
bundle :install, :verbose => true bundle :install, :verbose => true
expect(last_command.stdboth).not_to match(/fetching/i) expect(last_command.stdboth).not_to match(/fetching/i)
end end

View file

@ -131,7 +131,7 @@ RSpec.describe "bundle install with explicit source paths" do
gem 'foo', :path => File.expand_path("../foo-1.0", __FILE__) gem 'foo', :path => File.expand_path("../foo-1.0", __FILE__)
G G
bundle "config --local frozen true" bundle "config set --local frozen true"
bundle :install bundle :install
end end

View file

@ -291,7 +291,7 @@ RSpec.describe "bundle install across platforms" do
gem "rack", "1.0.0" gem "rack", "1.0.0"
G G
bundle "config --local path vendor/bundle" bundle "config set --local path vendor/bundle"
bundle :install bundle :install
FileUtils.mv(vendored_gems, bundled_app("vendor/bundle", Gem.ruby_engine, "1.8")) FileUtils.mv(vendored_gems, bundled_app("vendor/bundle", Gem.ruby_engine, "1.8"))

View file

@ -107,7 +107,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
expect(bundled_app("vendor/cache/rack-obama-1.0.gem")).to exist expect(bundled_app("vendor/cache/rack-obama-1.0.gem")).to exist
bundle "config --local deployment true" bundle "config set --local deployment true"
bundle :install bundle :install
expect(the_bundle).to include_gems("rack-obama 1.0.0", "rack 1.0.0") expect(the_bundle).to include_gems("rack-obama 1.0.0", "rack 1.0.0")
@ -486,7 +486,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
gem 'bar', '~> 0.1', :source => '#{file_uri_for(gem_repo4)}' gem 'bar', '~> 0.1', :source => '#{file_uri_for(gem_repo4)}'
G G
bundle "config --local path ../gems/system" bundle "config set --local path ../gems/system"
bundle :install bundle :install
# And then we add some new versions... # And then we add some new versions...

View file

@ -80,8 +80,8 @@ RSpec.describe "compact index api" do
G G
bundle :install, :artifice => "compact_index" bundle :install, :artifice => "compact_index"
bundle "config --local deployment true" bundle "config set --local deployment true"
bundle "config --local path vendor/bundle" bundle "config set --local path vendor/bundle"
bundle :install, :artifice => "compact_index" bundle :install, :artifice => "compact_index"
expect(out).to include("Fetching gem metadata from #{source_uri}") expect(out).to include("Fetching gem metadata from #{source_uri}")
expect(the_bundle).to include_gems "rack 1.0.0" expect(the_bundle).to include_gems "rack 1.0.0"
@ -118,7 +118,7 @@ RSpec.describe "compact index api" do
bundle :install, :artifice => "compact_index" bundle :install, :artifice => "compact_index"
bundle "config --local deployment true" bundle "config set --local deployment true"
bundle :install, :artifice => "compact_index" bundle :install, :artifice => "compact_index"
expect(the_bundle).to include_gems("rails 2.3.2") expect(the_bundle).to include_gems("rails 2.3.2")
@ -132,7 +132,7 @@ RSpec.describe "compact index api" do
G G
bundle "install", :artifice => "compact_index" bundle "install", :artifice => "compact_index"
bundle "config --local deployment true" bundle "config set --local deployment true"
bundle :install, :artifice => "compact_index" bundle :install, :artifice => "compact_index"
expect(the_bundle).to include_gems("foo 1.0") expect(the_bundle).to include_gems("foo 1.0")
@ -503,7 +503,7 @@ The checksum of /versions does not match the checksum provided by the server! So
G G
bundle :install, :artifice => "compact_index_extra" bundle :install, :artifice => "compact_index_extra"
bundle "config --local deployment true" bundle "config set --local deployment true"
bundle :install, :artifice => "compact_index_extra" bundle :install, :artifice => "compact_index_extra"
expect(the_bundle).to include_gems "back_deps 1.0" expect(the_bundle).to include_gems "back_deps 1.0"
end end

View file

@ -60,8 +60,8 @@ RSpec.describe "gemcutter's dependency API" do
G G
bundle :install, :artifice => "endpoint" bundle :install, :artifice => "endpoint"
bundle "config --local deployment true" bundle "config set --local deployment true"
bundle "config --local path vendor/bundle" bundle "config set --local path vendor/bundle"
bundle :install, :artifice => "endpoint" bundle :install, :artifice => "endpoint"
expect(out).to include("Fetching gem metadata from #{source_uri}") expect(out).to include("Fetching gem metadata from #{source_uri}")
expect(the_bundle).to include_gems "rack 1.0.0" expect(the_bundle).to include_gems "rack 1.0.0"
@ -98,7 +98,7 @@ RSpec.describe "gemcutter's dependency API" do
bundle :install, :artifice => "endpoint" bundle :install, :artifice => "endpoint"
bundle "config --local deployment true" bundle "config set --local deployment true"
bundle :install, :artifice => "endpoint" bundle :install, :artifice => "endpoint"
expect(the_bundle).to include_gems("rails 2.3.2") expect(the_bundle).to include_gems("rails 2.3.2")
@ -112,7 +112,7 @@ RSpec.describe "gemcutter's dependency API" do
G G
bundle "install", :artifice => "endpoint" bundle "install", :artifice => "endpoint"
bundle "config --local deployment true" bundle "config set --local deployment true"
bundle :install, :artifice => "endpoint" bundle :install, :artifice => "endpoint"
expect(the_bundle).to include_gems("foo 1.0") expect(the_bundle).to include_gems("foo 1.0")
@ -475,7 +475,7 @@ RSpec.describe "gemcutter's dependency API" do
bundle :install, :artifice => "endpoint_extra" bundle :install, :artifice => "endpoint_extra"
bundle "config --local deployment true" bundle "config set --local deployment true"
bundle "install", :artifice => "endpoint_extra" bundle "install", :artifice => "endpoint_extra"
expect(the_bundle).to include_gems "back_deps 1.0" expect(the_bundle).to include_gems "back_deps 1.0"
end end

View file

@ -55,7 +55,7 @@ RSpec.shared_examples "bundle install --standalone" do
source "#{file_uri_for(gem_repo1)}" source "#{file_uri_for(gem_repo1)}"
gem "rails" gem "rails"
G G
bundle "config --local path #{bundled_app("bundle")}" bundle "config set --local path #{bundled_app("bundle")}"
bundle :install, :standalone => true, :dir => cwd bundle :install, :standalone => true, :dir => cwd
end end
@ -71,7 +71,7 @@ RSpec.shared_examples "bundle install --standalone" do
describe "with gems with native extension", :ruby_repo do describe "with gems with native extension", :ruby_repo do
before do before do
bundle "config --local path #{bundled_app("bundle")}" bundle "config set --local path #{bundled_app("bundle")}"
install_gemfile <<-G, :standalone => true, :dir => cwd install_gemfile <<-G, :standalone => true, :dir => cwd
source "#{file_uri_for(gem_repo1)}" source "#{file_uri_for(gem_repo1)}"
gem "very_simple_binary" gem "very_simple_binary"
@ -105,7 +105,7 @@ RSpec.shared_examples "bundle install --standalone" do
end end
G G
end end
bundle "config --local path #{bundled_app("bundle")}" bundle "config set --local path #{bundled_app("bundle")}"
install_gemfile <<-G, :standalone => true, :dir => cwd, :raise_on_error => false install_gemfile <<-G, :standalone => true, :dir => cwd, :raise_on_error => false
gem "bar", :git => "#{lib_path("bar-1.0")}" gem "bar", :git => "#{lib_path("bar-1.0")}"
G G
@ -126,7 +126,7 @@ RSpec.shared_examples "bundle install --standalone" do
gem "rails" gem "rails"
gem "devise", :git => "#{lib_path("devise-1.0")}" gem "devise", :git => "#{lib_path("devise-1.0")}"
G G
bundle "config --local path #{bundled_app("bundle")}" bundle "config set --local path #{bundled_app("bundle")}"
bundle :install, :standalone => true, :dir => cwd bundle :install, :standalone => true, :dir => cwd
end end
@ -154,7 +154,7 @@ RSpec.shared_examples "bundle install --standalone" do
gem "rack-test" gem "rack-test"
end end
G G
bundle "config --local path #{bundled_app("bundle")}" bundle "config set --local path #{bundled_app("bundle")}"
bundle :install, :standalone => true, :dir => cwd bundle :install, :standalone => true, :dir => cwd
end end
@ -168,7 +168,7 @@ RSpec.shared_examples "bundle install --standalone" do
include_examples "common functionality" include_examples "common functionality"
it "allows creating a standalone file with limited groups" do it "allows creating a standalone file with limited groups" do
bundle "config --local path #{bundled_app("bundle")}" bundle "config set --local path #{bundled_app("bundle")}"
bundle :install, :standalone => "default", :dir => cwd bundle :install, :standalone => "default", :dir => cwd
load_error_ruby <<-RUBY, "spec" load_error_ruby <<-RUBY, "spec"
@ -185,8 +185,8 @@ RSpec.shared_examples "bundle install --standalone" do
end end
it "allows `without` configuration to limit the groups used in a standalone" do it "allows `without` configuration to limit the groups used in a standalone" do
bundle "config --local path #{bundled_app("bundle")}" bundle "config set --local path #{bundled_app("bundle")}"
bundle "config --local without test" bundle "config set --local without test"
bundle :install, :standalone => true, :dir => cwd bundle :install, :standalone => true, :dir => cwd
load_error_ruby <<-RUBY, "spec" load_error_ruby <<-RUBY, "spec"
@ -203,7 +203,7 @@ RSpec.shared_examples "bundle install --standalone" do
end end
it "allows `path` configuration to change the location of the standalone bundle" do it "allows `path` configuration to change the location of the standalone bundle" do
bundle "config --local path path/to/bundle" bundle "config set --local path path/to/bundle"
bundle "install", :standalone => true, :dir => cwd bundle "install", :standalone => true, :dir => cwd
ruby <<-RUBY ruby <<-RUBY
@ -218,9 +218,9 @@ RSpec.shared_examples "bundle install --standalone" do
end end
it "allows `without` to limit the groups used in a standalone" do it "allows `without` to limit the groups used in a standalone" do
bundle "config --local without test" bundle "config set --local without test"
bundle :install, :dir => cwd bundle :install, :dir => cwd
bundle "config --local path #{bundled_app("bundle")}" bundle "config set --local path #{bundled_app("bundle")}"
bundle :install, :standalone => true, :dir => cwd bundle :install, :standalone => true, :dir => cwd
load_error_ruby <<-RUBY, "spec" load_error_ruby <<-RUBY, "spec"
@ -246,7 +246,7 @@ RSpec.shared_examples "bundle install --standalone" do
source "#{source_uri}" source "#{source_uri}"
gem "rails" gem "rails"
G G
bundle "config --local path #{bundled_app("bundle")}" bundle "config set --local path #{bundled_app("bundle")}"
bundle :install, :standalone => true, :artifice => "endpoint", :dir => cwd bundle :install, :standalone => true, :artifice => "endpoint", :dir => cwd
end end
@ -267,7 +267,7 @@ RSpec.shared_examples "bundle install --standalone" do
source "#{file_uri_for(gem_repo1)}" source "#{file_uri_for(gem_repo1)}"
gem "rails" gem "rails"
G G
bundle "config --local path #{bundled_app("bundle")}" bundle "config set --local path #{bundled_app("bundle")}"
bundle :install, :standalone => true, :binstubs => true, :dir => cwd bundle :install, :standalone => true, :binstubs => true, :dir => cwd
end end

View file

@ -57,8 +57,8 @@ RSpec.describe "bundle install" do
foo! foo!
L L
bundle "config --local path vendor/bundle" bundle "config set --local path vendor/bundle"
bundle "config --local without development" bundle "config set --local without development"
bundle :install bundle :install
expect(out).to include("Bundle complete!") expect(out).to include("Bundle complete!")

View file

@ -14,14 +14,14 @@ RSpec.describe "bundle install" do
end end
it "does not use available system gems with `vendor/bundle" do it "does not use available system gems with `vendor/bundle" do
bundle "config --local path vendor/bundle" bundle "config set --local path vendor/bundle"
bundle :install bundle :install
expect(the_bundle).to include_gems "rack 1.0.0" expect(the_bundle).to include_gems "rack 1.0.0"
end end
it "uses system gems with `path.system` configured with more priority than `path`" do it "uses system gems with `path.system` configured with more priority than `path`" do
bundle "config --local path.system true" bundle "config set --local path.system true"
bundle "config --global path vendor/bundle" bundle "config set --global path vendor/bundle"
bundle :install bundle :install
run "require 'rack'", :raise_on_error => false run "require 'rack'", :raise_on_error => false
expect(out).to include("FAIL") expect(out).to include("FAIL")
@ -31,7 +31,7 @@ RSpec.describe "bundle install" do
dir = bundled_app("bun++dle") dir = bundled_app("bun++dle")
dir.mkpath dir.mkpath
bundle "config --local path #{dir.join("vendor/bundle")}" bundle "config set --local path #{dir.join("vendor/bundle")}"
bundle :install, :dir => dir bundle :install, :dir => dir
expect(out).to include("installed into `./vendor/bundle`") expect(out).to include("installed into `./vendor/bundle`")
@ -39,7 +39,7 @@ RSpec.describe "bundle install" do
end end
it "prints a message to let the user know where gems where installed" do it "prints a message to let the user know where gems where installed" do
bundle "config --local path vendor/bundle" bundle "config set --local path vendor/bundle"
bundle :install bundle :install
expect(out).to include("gems are installed into `./vendor/bundle`") expect(out).to include("gems are installed into `./vendor/bundle`")
end end
@ -109,7 +109,7 @@ RSpec.describe "bundle install" do
context "when set via #{type}" do context "when set via #{type}" do
it "installs gems to a path if one is specified" do it "installs gems to a path if one is specified" do
set_bundle_path(type, bundled_app("vendor2").to_s) set_bundle_path(type, bundled_app("vendor2").to_s)
bundle "config --local path vendor/bundle" bundle "config set --local path vendor/bundle"
bundle :install bundle :install
expect(vendored_gems("gems/rack-1.0.0")).to be_directory expect(vendored_gems("gems/rack-1.0.0")).to be_directory
@ -159,7 +159,7 @@ RSpec.describe "bundle install" do
end end
it "sets BUNDLE_PATH as the first argument to bundle install" do it "sets BUNDLE_PATH as the first argument to bundle install" do
bundle "config --local path ./vendor/bundle" bundle "config set --local path ./vendor/bundle"
bundle :install bundle :install
expect(vendored_gems("gems/rack-1.0.0")).to be_directory expect(vendored_gems("gems/rack-1.0.0")).to be_directory
@ -169,7 +169,7 @@ RSpec.describe "bundle install" do
it "disables system gems when passing a path to install" do it "disables system gems when passing a path to install" do
# This is so that vendored gems can be distributed to others # This is so that vendored gems can be distributed to others
build_gem "rack", "1.1.0", :to_system => true build_gem "rack", "1.1.0", :to_system => true
bundle "config --local path ./vendor/bundle" bundle "config set --local path ./vendor/bundle"
bundle :install bundle :install
expect(vendored_gems("gems/rack-1.0.0")).to be_directory expect(vendored_gems("gems/rack-1.0.0")).to be_directory
@ -186,7 +186,7 @@ RSpec.describe "bundle install" do
gem "very_simple_binary" gem "very_simple_binary"
G G
bundle "config --local path ./vendor/bundle" bundle "config set --local path ./vendor/bundle"
bundle :install bundle :install
expect(vendored_gems("gems/very_simple_binary-1.0")).to be_directory expect(vendored_gems("gems/very_simple_binary-1.0")).to be_directory
@ -198,7 +198,7 @@ RSpec.describe "bundle install" do
run "require 'very_simple_binary_c'", :raise_on_error => false run "require 'very_simple_binary_c'", :raise_on_error => false
expect(err).to include("Bundler::GemNotFound") expect(err).to include("Bundler::GemNotFound")
bundle "config --local path ./vendor/bundle" bundle "config set --local path ./vendor/bundle"
bundle :install bundle :install
expect(vendored_gems("gems/very_simple_binary-1.0")).to be_directory expect(vendored_gems("gems/very_simple_binary-1.0")).to be_directory
@ -218,7 +218,7 @@ RSpec.describe "bundle install" do
gem "rack" gem "rack"
G G
bundle "config --local path bundle" bundle "config set --local path bundle"
bundle :install, :raise_on_error => false bundle :install, :raise_on_error => false
expect(err).to include("file already exists") expect(err).to include("file already exists")
end end

View file

@ -1202,7 +1202,7 @@ RSpec.describe "the lockfile format" do
gem "omg", :git => "#{lib_path("omg")}", :branch => 'master' gem "omg", :git => "#{lib_path("omg")}", :branch => 'master'
G G
bundle "config --local path vendor" bundle "config set --local path vendor"
bundle :install bundle :install
expect(the_bundle).to include_gems "omg 1.0" expect(the_bundle).to include_gems "omg 1.0"

View file

@ -228,7 +228,7 @@ RSpec.describe "bundler plugin install" do
gem 'rack', "1.0.0" gem 'rack', "1.0.0"
G G
bundle "config --local deployment true" bundle "config set --local deployment true"
install_gemfile <<-G install_gemfile <<-G
source '#{file_uri_for(gem_repo2)}' source '#{file_uri_for(gem_repo2)}'
plugin 'foo' plugin 'foo'

View file

@ -132,7 +132,7 @@ RSpec.describe "real source plugins" do
end end
it "copies repository to vendor cache and uses it even when installed with `path` configured" do it "copies repository to vendor cache and uses it even when installed with `path` configured" do
bundle "config --local path vendor/bundle" bundle "config set --local path vendor/bundle"
bundle :install bundle :install
bundle "config set cache_all true" bundle "config set cache_all true"
bundle :cache bundle :cache
@ -144,7 +144,7 @@ RSpec.describe "real source plugins" do
end end
it "bundler package copies repository to vendor cache" do it "bundler package copies repository to vendor cache" do
bundle "config --local path vendor/bundle" bundle "config set --local path vendor/bundle"
bundle :install bundle :install
bundle "config set cache_all true" bundle "config set cache_all true"
bundle :cache bundle :cache

View file

@ -249,7 +249,7 @@ RSpec.describe "The library itself" do
end end
it "does not use require internally, but require_relative" do it "does not use require internally, but require_relative" do
exempt = %r{templates/|man/|vendor/} exempt = %r{templates/|\.5|\.1|vendor/}
all_bad_requires = [] all_bad_requires = []
lib_tracked_files.each do |filename| lib_tracked_files.each do |filename|
next if filename =~ exempt next if filename =~ exempt

View file

@ -12,7 +12,7 @@ RSpec.describe "Bundler.setup" do
G G
ruby <<-RUBY ruby <<-RUBY
require '#{lib_dir}/bundler' require 'bundler'
Bundler.setup Bundler.setup
require 'rack' require 'rack'
@ -34,7 +34,7 @@ RSpec.describe "Bundler.setup" do
it "doesn't make all groups available" do it "doesn't make all groups available" do
ruby <<-RUBY ruby <<-RUBY
require '#{lib_dir}/bundler' require 'bundler'
Bundler.setup(:default) Bundler.setup(:default)
begin begin
@ -49,7 +49,7 @@ RSpec.describe "Bundler.setup" do
it "accepts string for group name" do it "accepts string for group name" do
ruby <<-RUBY ruby <<-RUBY
require '#{lib_dir}/bundler' require 'bundler'
Bundler.setup(:default, 'test') Bundler.setup(:default, 'test')
require 'rack' require 'rack'
@ -61,7 +61,7 @@ RSpec.describe "Bundler.setup" do
it "leaves all groups available if they were already" do it "leaves all groups available if they were already" do
ruby <<-RUBY ruby <<-RUBY
require '#{lib_dir}/bundler' require 'bundler'
Bundler.setup Bundler.setup
Bundler.setup(:default) Bundler.setup(:default)
@ -74,7 +74,7 @@ RSpec.describe "Bundler.setup" do
it "leaves :default available if setup is called twice" do it "leaves :default available if setup is called twice" do
ruby <<-RUBY ruby <<-RUBY
require '#{lib_dir}/bundler' require 'bundler'
Bundler.setup(:default) Bundler.setup(:default)
Bundler.setup(:default, :test) Bundler.setup(:default, :test)
@ -91,7 +91,7 @@ RSpec.describe "Bundler.setup" do
it "handles multiple non-additive invocations" do it "handles multiple non-additive invocations" do
ruby <<-RUBY, :raise_on_error => false ruby <<-RUBY, :raise_on_error => false
require '#{lib_dir}/bundler' require 'bundler'
Bundler.setup(:default, :test) Bundler.setup(:default, :test)
Bundler.setup(:default) Bundler.setup(:default)
require 'rack' require 'rack'
@ -122,7 +122,7 @@ RSpec.describe "Bundler.setup" do
ENV["RUBYLIB"] = "rubylib_dir" ENV["RUBYLIB"] = "rubylib_dir"
ruby <<-RUBY ruby <<-RUBY
require '#{lib_dir}/bundler' require 'bundler'
Bundler.setup Bundler.setup
puts $LOAD_PATH puts $LOAD_PATH
RUBY RUBY
@ -143,6 +143,10 @@ RSpec.describe "Bundler.setup" do
gem "rails" gem "rails"
G G
# We require an absolute path because relying on the $LOAD_PATH behaves
# inconsistently depending on whether we're in a ruby-core setup (and
# bundler's lib is in RUBYLIB) or not.
ruby <<-RUBY ruby <<-RUBY
require '#{lib_dir}/bundler' require '#{lib_dir}/bundler'
Bundler.setup Bundler.setup
@ -171,6 +175,10 @@ RSpec.describe "Bundler.setup" do
gem "terranova" gem "terranova"
G G
# We require an absolute path because relying on the $LOAD_PATH behaves
# inconsistently depending on whether we're in a ruby-core setup (and
# bundler's lib is in RUBYLIB) or not.
ruby <<-RUBY ruby <<-RUBY
require '#{lib_dir}/bundler/setup' require '#{lib_dir}/bundler/setup'
puts $LOAD_PATH puts $LOAD_PATH
@ -192,8 +200,10 @@ RSpec.describe "Bundler.setup" do
gem "rack" gem "rack"
G G
entrypoint = mis_activates_prerelease_default_bundler? ? "#{lib_dir}/bundler" : "bundler"
ruby <<-R ruby <<-R
require '#{lib_dir}/bundler' require '#{entrypoint}'
begin begin
Bundler.setup Bundler.setup
@ -213,7 +223,7 @@ RSpec.describe "Bundler.setup" do
G G
ruby <<-R, :raise_on_error => false ruby <<-R, :raise_on_error => false
require '#{lib_dir}/bundler' require 'bundler'
Bundler.setup Bundler.setup
R R
@ -236,7 +246,7 @@ RSpec.describe "Bundler.setup" do
G G
ruby <<-R, :raise_on_error => false ruby <<-R, :raise_on_error => false
require '#{lib_dir}/bundler' require 'bundler'
Bundler.setup Bundler.setup
R R
@ -289,7 +299,7 @@ RSpec.describe "Bundler.setup" do
ENV["BUNDLE_GEMFILE"] = "Gemfile" ENV["BUNDLE_GEMFILE"] = "Gemfile"
ruby <<-R ruby <<-R
require '#{lib_dir}/bundler' require 'bundler'
begin begin
Bundler.setup Bundler.setup
@ -444,7 +454,7 @@ RSpec.describe "Bundler.setup" do
break_git! break_git!
ruby <<-R ruby <<-R
require '#{lib_dir}/bundler' require 'bundler'
begin begin
Bundler.setup Bundler.setup
@ -464,8 +474,10 @@ RSpec.describe "Bundler.setup" do
break_git! break_git!
entrypoint = mis_activates_prerelease_default_bundler? ? "#{lib_dir}/bundler" : "bundler"
ruby <<-R ruby <<-R
require "#{lib_dir}/bundler" require "#{entrypoint}"
begin begin
Bundler.setup Bundler.setup
@ -481,14 +493,14 @@ RSpec.describe "Bundler.setup" do
end end
it "works even when the cache directory has been deleted" do it "works even when the cache directory has been deleted" do
bundle "config --local path vendor/bundle" bundle "config set --local path vendor/bundle"
bundle :install bundle :install
FileUtils.rm_rf vendored_gems("cache") FileUtils.rm_rf vendored_gems("cache")
expect(the_bundle).to include_gems "rack 1.0.0" expect(the_bundle).to include_gems "rack 1.0.0"
end end
it "does not randomly change the path when specifying --path and the bundle directory becomes read only" do it "does not randomly change the path when specifying --path and the bundle directory becomes read only" do
bundle "config --local path vendor/bundle" bundle "config set --local path vendor/bundle"
bundle :install bundle :install
with_read_only("#{bundled_app}/**/*") do with_read_only("#{bundled_app}/**/*") do
@ -592,7 +604,7 @@ RSpec.describe "Bundler.setup" do
describe "when excluding groups" do describe "when excluding groups" do
it "doesn't change the resolve if --without is used" do it "doesn't change the resolve if --without is used" do
bundle "config --local without rails" bundle "config set --local without rails"
install_gemfile <<-G install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}" source "#{file_uri_for(gem_repo1)}"
gem "activesupport" gem "activesupport"
@ -608,7 +620,7 @@ RSpec.describe "Bundler.setup" do
end end
it "remembers --without and does not bail on bare Bundler.setup" do it "remembers --without and does not bail on bare Bundler.setup" do
bundle "config --local without rails" bundle "config set --local without rails"
install_gemfile <<-G install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}" source "#{file_uri_for(gem_repo1)}"
gem "activesupport" gem "activesupport"
@ -624,7 +636,7 @@ RSpec.describe "Bundler.setup" do
end end
it "remembers --without and does not bail on bare Bundler.setup, even in the case of path gems no longer available" do it "remembers --without and does not bail on bare Bundler.setup, even in the case of path gems no longer available" do
bundle "config --local without development" bundle "config set --local without development"
path = bundled_app(File.join("vendor", "foo")) path = bundled_app(File.join("vendor", "foo"))
build_lib "foo", :path => path build_lib "foo", :path => path
@ -644,7 +656,7 @@ RSpec.describe "Bundler.setup" do
end end
it "remembers --without and does not include groups passed to Bundler.setup" do it "remembers --without and does not include groups passed to Bundler.setup" do
bundle "config --local without rails" bundle "config set --local without rails"
install_gemfile <<-G install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}" source "#{file_uri_for(gem_repo1)}"
gem "activesupport" gem "activesupport"
@ -798,7 +810,7 @@ end
# Don't build extensions. # Don't build extensions.
s.class.send(:define_method, :build_extensions) { nil } s.class.send(:define_method, :build_extensions) { nil }
require '#{lib_dir}/bundler' require 'bundler'
gem '#{gem_name}' gem '#{gem_name}'
puts $LOAD_PATH.count {|path| path =~ /#{gem_name}/} >= 2 puts $LOAD_PATH.count {|path| path =~ /#{gem_name}/} >= 2
@ -1056,7 +1068,7 @@ end
bundle "install" bundle "install"
ruby <<-RUBY ruby <<-RUBY
require '#{lib_dir}/bundler' require 'bundler'
bundler_module = class << Bundler; self; end bundler_module = class << Bundler; self; end
bundler_module.send(:remove_method, :require) bundler_module.send(:remove_method, :require)
def Bundler.require(path) def Bundler.require(path)
@ -1104,6 +1116,8 @@ end
end end
before do before do
bundle "config set --local path.system true"
install_gemfile <<-G install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}" source "#{file_uri_for(gem_repo1)}"
gem "rack" gem "rack"
@ -1112,8 +1126,9 @@ end
context "is not present" do context "is not present" do
it "does not change the lock" do it "does not change the lock" do
entrypoint = mis_activates_prerelease_default_bundler? ? "#{lib_dir}/bundler/setup" : "bundler/setup"
lockfile lock_with(nil) lockfile lock_with(nil)
ruby "require '#{lib_dir}/bundler/setup'" ruby "require '#{entrypoint}'"
lockfile_should_be lock_with(nil) lockfile_should_be lock_with(nil)
end end
end end
@ -1121,7 +1136,7 @@ end
context "is newer" do context "is newer" do
it "does not change the lock or warn" do it "does not change the lock or warn" do
lockfile lock_with(Bundler::VERSION.succ) lockfile lock_with(Bundler::VERSION.succ)
ruby "require '#{lib_dir}/bundler/setup'" ruby "require 'bundler/setup'"
expect(out).to be_empty expect(out).to be_empty
expect(err).to be_empty expect(err).to be_empty
lockfile_should_be lock_with(Bundler::VERSION.succ) lockfile_should_be lock_with(Bundler::VERSION.succ)
@ -1130,8 +1145,10 @@ end
context "is older" do context "is older" do
it "does not change the lock" do it "does not change the lock" do
entrypoint = mis_activates_prerelease_default_bundler? ? "#{lib_dir}/bundler/setup" : "bundler/setup"
system_gems "bundler-1.10.1"
lockfile lock_with("1.10.1") lockfile lock_with("1.10.1")
ruby "require '#{lib_dir}/bundler/setup'" ruby "require '#{entrypoint}'"
lockfile_should_be lock_with("1.10.1") lockfile_should_be lock_with("1.10.1")
end end
end end
@ -1178,14 +1195,14 @@ end
context "is not present" do context "is not present" do
it "does not change the lock" do it "does not change the lock" do
expect { ruby "require '#{lib_dir}/bundler/setup'" }.not_to change { lockfile } expect { ruby "require 'bundler/setup'" }.not_to change { lockfile }
end end
end end
context "is newer" do context "is newer" do
let(:ruby_version) { "5.5.5" } let(:ruby_version) { "5.5.5" }
it "does not change the lock or warn" do it "does not change the lock or warn" do
expect { ruby "require '#{lib_dir}/bundler/setup'" }.not_to change { lockfile } expect { ruby "require 'bundler/setup'" }.not_to change { lockfile }
expect(out).to be_empty expect(out).to be_empty
expect(err).to be_empty expect(err).to be_empty
end end
@ -1194,7 +1211,7 @@ end
context "is older" do context "is older" do
let(:ruby_version) { "1.0.0" } let(:ruby_version) { "1.0.0" }
it "does not change the lock" do it "does not change the lock" do
expect { ruby "require '#{lib_dir}/bundler/setup'" }.not_to change { lockfile } expect { ruby "require 'bundler/setup'" }.not_to change { lockfile }
end end
end end
end end
@ -1202,8 +1219,9 @@ end
describe "with gemified standard libraries" do describe "with gemified standard libraries" do
it "does not load Psych" do it "does not load Psych" do
gemfile "" gemfile ""
entrypoint = mis_activates_prerelease_default_bundler? ? "#{lib_dir}/bundler/setup" : "bundler/setup"
ruby <<-RUBY ruby <<-RUBY
require '#{lib_dir}/bundler/setup' require '#{entrypoint}'
puts defined?(Psych::VERSION) ? Psych::VERSION : "undefined" puts defined?(Psych::VERSION) ? Psych::VERSION : "undefined"
require 'psych' require 'psych'
puts Psych::VERSION puts Psych::VERSION
@ -1216,7 +1234,7 @@ end
it "does not load openssl" do it "does not load openssl" do
install_gemfile "" install_gemfile ""
ruby <<-RUBY ruby <<-RUBY
require "#{lib_dir}/bundler/setup" require "bundler/setup"
puts defined?(OpenSSL) || "undefined" puts defined?(OpenSSL) || "undefined"
require "openssl" require "openssl"
puts defined?(OpenSSL) || "undefined" puts defined?(OpenSSL) || "undefined"
@ -1274,7 +1292,7 @@ end
it "activates no gems with -rbundler/setup" do it "activates no gems with -rbundler/setup" do
install_gemfile "" install_gemfile ""
ruby code, :env => { "RUBYOPT" => activation_warning_hack_rubyopt + " -r#{lib_dir}/bundler/setup" } ruby code, :env => { "RUBYOPT" => activation_warning_hack_rubyopt + " -rbundler/setup" }
expect(out).to eq("{}") expect(out).to eq("{}")
end end
@ -1327,7 +1345,7 @@ end
if File.exist?(ext_folder.join("#{require_name}.rb")) if File.exist?(ext_folder.join("#{require_name}.rb"))
{ :exclude_from_load_path => ext_folder.to_s } { :exclude_from_load_path => ext_folder.to_s }
else else
lib_folder = source_root.join("lib") lib_folder = source_lib_dir
if File.exist?(lib_folder.join("#{require_name}.rb")) if File.exist?(lib_folder.join("#{require_name}.rb"))
{ :exclude_from_load_path => lib_folder.to_s } { :exclude_from_load_path => lib_folder.to_s }
else else
@ -1383,7 +1401,7 @@ end
G G
ruby <<-RUBY ruby <<-RUBY
require "#{lib_dir}/bundler/setup" require "bundler/setup"
Object.new.gem "rack" Object.new.gem "rack"
puts Gem.loaded_specs["rack"].full_name puts Gem.loaded_specs["rack"].full_name
RUBY RUBY
@ -1398,7 +1416,7 @@ end
G G
ruby <<-RUBY, :raise_on_error => false ruby <<-RUBY, :raise_on_error => false
require "#{lib_dir}/bundler/setup" require "bundler/setup"
Object.new.gem "rack" Object.new.gem "rack"
puts "FAIL" puts "FAIL"
RUBY RUBY
@ -1414,7 +1432,7 @@ end
G G
ruby <<-RUBY, :raise_on_error => false ruby <<-RUBY, :raise_on_error => false
require "#{lib_dir}/bundler/setup" require "bundler/setup"
Object.new.require "rack" Object.new.require "rack"
puts "FAIL" puts "FAIL"
RUBY RUBY
@ -1429,4 +1447,9 @@ end
expect(last_command.stdboth).to eq("true") expect(last_command.stdboth).to eq("true")
end end
end end
# Tested rubygems does not include https://github.com/rubygems/rubygems/pull/2728 and will not always end up activating the current bundler
def mis_activates_prerelease_default_bundler?
Gem.rubygems_version < Gem::Version.new("3.1.a")
end
end end

View file

@ -13,6 +13,7 @@ require "bundler"
require "rspec/core" require "rspec/core"
require "rspec/expectations" require "rspec/expectations"
require "rspec/mocks" require "rspec/mocks"
require "diff/lcs"
require_relative "support/builders" require_relative "support/builders"
require_relative "support/build_metadata" require_relative "support/build_metadata"

View file

@ -63,6 +63,10 @@ module Spec
@spec_dir ||= source_root.join(ruby_core? ? "spec/bundler" : "spec") @spec_dir ||= source_root.join(ruby_core? ? "spec/bundler" : "spec")
end end
def man_dir
@man_dir ||= lib_dir.join("bundler/man")
end
def tracked_files def tracked_files
@tracked_files ||= git_ls_files(tracked_files_glob) @tracked_files ||= git_ls_files(tracked_files_glob)
end end
@ -236,7 +240,7 @@ module Spec
end end
def man_tracked_files_glob def man_tracked_files_glob
ruby_core? ? "man/bundle* man/gemfile*" : "man" ruby_core? ? "man/bundle* man/gemfile*" : "lib/bundler/man/bundle*.1 lib/bundler/man/gemfile*.5"
end end
def git_root def git_root

View file

@ -71,6 +71,26 @@ module Spec
install_gems(test_gemfile, test_lockfile) install_gems(test_gemfile, test_lockfile)
end end
def check_source_control_changes(success_message:, error_message:)
require "open3"
output, status = Open3.capture2e("git status --porcelain")
if status.success? && output.empty?
puts
puts success_message
puts
else
system("git status --porcelain")
puts
puts error_message
puts
exit(1)
end
end
private private
# Some rubygems versions include loaded specs when loading gemspec stubs # Some rubygems versions include loaded specs when loading gemspec stubs

View file

@ -1,19 +0,0 @@
# frozen_string_literal: true
require "stringio"
def capture(*args)
opts = args.pop if args.last.is_a?(Hash)
opts ||= {}
args.map!(&:to_s)
begin
result = StringIO.new
result.close if opts[:closed]
args.each {|stream| eval "$#{stream} = result" }
yield
ensure
args.each {|stream| eval("$#{stream} = #{stream.upcase}") }
end
result.string
end