summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2019-11-11 17:57:45 +0900
committerSHIBATA Hiroshi <hsbt@ruby-lang.org>2019-11-11 18:56:25 +0900
commit7585bc31877d4f9725f8de51b4a2faf47acb6f34 (patch)
treeadf61a7c20f7e54b595ebde05284b5e2862f552c
parentfd69f82675bf93a848e5aa58d117bf8bbf604188 (diff)
Merge Bundler 2.1.0.pre.3
Features: - Add caller information to some deprecation messages to make them easier to fix [#7361](https://github.com/bundler/bundler/pull/7361) - Reconcile `bundle cache` vs `bundle package` everywhere. Now in docs, CLI help and everywhere else `bundle cache` is the preferred version and `bundle package` remains as an alias [#7389](https://github.com/bundler/bundler/pull/7389) - Display some basic `bundler` documentation together with ruby's RDoc based documentation [#7394](https://github.com/bundler/bundler/pull/7394) Bugfixes: - Fix typos deprecation message and upgrading docs [#7374](https://github.com/bundler/bundler/pull/7374) - Deprecation warnings about `taint` usage on ruby 2.7 [#7385](https://github.com/bundler/bundler/pull/7385) - Fix `--help` flag not correctly delegating to `man` when used with command aliases [#7388](https://github.com/bundler/bundler/pull/7388) - `bundle add` should cache newly added gems if an application cache exists [#7393](https://github.com/bundler/bundler/pull/7393) - Stop using an insecure folder as a "fallback home" when user home is not defined [#7416](https://github.com/bundler/bundler/pull/7416) - Fix `bundler/inline` warning about `Bundler.root` redefinition [#7417](https://github.com/bundler/bundler/pull/7417)
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/2668
-rw-r--r--lib/bundler.rb111
-rw-r--r--lib/bundler/cli.rb80
-rw-r--r--lib/bundler/cli/add.rb1
-rw-r--r--lib/bundler/cli/cache.rb48
-rw-r--r--lib/bundler/cli/exec.rb7
-rw-r--r--lib/bundler/dsl.rb2
-rw-r--r--lib/bundler/friendly_errors.rb2
-rw-r--r--lib/bundler/gem_helper.rb1
-rw-r--r--lib/bundler/gem_helpers.rb2
-rw-r--r--lib/bundler/inline.rb10
-rw-r--r--lib/bundler/lockfile_parser.rb1
-rw-r--r--lib/bundler/rubygems_ext.rb2
-rw-r--r--lib/bundler/rubygems_integration.rb1
-rw-r--r--lib/bundler/setup.rb11
-rw-r--r--lib/bundler/shared_helpers.rb37
-rw-r--r--lib/bundler/source/git.rb2
-rw-r--r--lib/bundler/source/git/git_proxy.rb2
-rw-r--r--lib/bundler/vendor/fileutils/lib/fileutils.rb241
-rw-r--r--lib/bundler/vendor/fileutils/lib/fileutils/version.rb2
-rw-r--r--lib/bundler/version.rb2
-rw-r--r--man/bundle-add.12
-rw-r--r--man/bundle-add.1.txt2
-rw-r--r--man/bundle-binstubs.12
-rw-r--r--man/bundle-binstubs.1.txt2
-rw-r--r--man/bundle-cache.155
-rw-r--r--man/bundle-cache.1.txt78
-rw-r--r--man/bundle-cache.ronn72
-rw-r--r--man/bundle-check.12
-rw-r--r--man/bundle-check.1.txt12
-rw-r--r--man/bundle-clean.12
-rw-r--r--man/bundle-clean.1.txt2
-rw-r--r--man/bundle-config.12
-rw-r--r--man/bundle-config.1.txt256
-rw-r--r--man/bundle-doctor.12
-rw-r--r--man/bundle-doctor.1.txt2
-rw-r--r--man/bundle-exec.12
-rw-r--r--man/bundle-exec.1.txt2
-rw-r--r--man/bundle-gem.12
-rw-r--r--man/bundle-gem.1.txt6
-rw-r--r--man/bundle-info.12
-rw-r--r--man/bundle-info.1.txt2
-rw-r--r--man/bundle-init.12
-rw-r--r--man/bundle-init.1.txt2
-rw-r--r--man/bundle-inject.12
-rw-r--r--man/bundle-inject.1.txt2
-rw-r--r--man/bundle-install.12
-rw-r--r--man/bundle-install.1.txt130
-rw-r--r--man/bundle-list.12
-rw-r--r--man/bundle-list.1.txt2
-rw-r--r--man/bundle-lock.12
-rw-r--r--man/bundle-lock.1.txt32
-rw-r--r--man/bundle-open.12
-rw-r--r--man/bundle-open.1.txt2
-rw-r--r--man/bundle-outdated.12
-rw-r--r--man/bundle-outdated.1.txt2
-rw-r--r--man/bundle-platform.12
-rw-r--r--man/bundle-platform.1.txt2
-rw-r--r--man/bundle-pristine.12
-rw-r--r--man/bundle-pristine.1.txt2
-rw-r--r--man/bundle-remove.12
-rw-r--r--man/bundle-remove.1.txt2
-rw-r--r--man/bundle-show.12
-rw-r--r--man/bundle-show.1.txt2
-rw-r--r--man/bundle-update.12
-rw-r--r--man/bundle-update.1.txt42
-rw-r--r--man/bundle-viz.12
-rw-r--r--man/bundle-viz.1.txt2
-rw-r--r--man/bundle.12
-rw-r--r--man/bundle.1.txt12
-rw-r--r--man/gemfile.52
-rw-r--r--man/gemfile.5.txt188
-rw-r--r--spec/bundler/bundler/bundler_spec.rb38
-rw-r--r--spec/bundler/bundler/cli_spec.rb50
-rw-r--r--spec/bundler/bundler/friendly_errors_spec.rb2
-rw-r--r--spec/bundler/bundler/plugin_spec.rb2
-rw-r--r--spec/bundler/bundler/ruby_version_spec.rb20
-rw-r--r--spec/bundler/bundler/settings_spec.rb2
-rw-r--r--spec/bundler/bundler/shared_helpers_spec.rb2
-rw-r--r--spec/bundler/bundler/source_spec.rb31
-rw-r--r--spec/bundler/bundler/ui/shell_spec.rb2
-rw-r--r--spec/bundler/cache/cache_path_spec.rb6
-rw-r--r--spec/bundler/cache/git_spec.rb342
-rw-r--r--spec/bundler/cache/path_spec.rb214
-rw-r--r--spec/bundler/commands/add_spec.rb9
-rw-r--r--spec/bundler/commands/cache_spec.rb (renamed from spec/bundler/commands/package_spec.rb)34
-rw-r--r--spec/bundler/commands/exec_spec.rb6
-rw-r--r--spec/bundler/commands/newgem_spec.rb474
-rw-r--r--spec/bundler/install/deploy_spec.rb2
-rw-r--r--spec/bundler/install/gemfile/git_spec.rb8
-rw-r--r--spec/bundler/install/gemfile/groups_spec.rb2
-rw-r--r--spec/bundler/install/gemfile/path_spec.rb6
-rw-r--r--spec/bundler/install/gemfile/sources_spec.rb2
-rw-r--r--spec/bundler/lock/lockfile_spec.rb2
-rw-r--r--spec/bundler/other/major_deprecation_spec.rb19
-rw-r--r--spec/bundler/other/platform_spec.rb12
-rw-r--r--spec/bundler/plugins/source/example_spec.rb2
-rw-r--r--spec/bundler/realworld/dependency_api_spec.rb4
-rw-r--r--spec/bundler/realworld/double_check_spec.rb6
-rw-r--r--spec/bundler/realworld/edgecases_spec.rb20
-rw-r--r--spec/bundler/realworld/gemfile_source_header_spec.rb4
-rw-r--r--spec/bundler/realworld/mirror_probe_spec.rb4
-rw-r--r--spec/bundler/runtime/gem_tasks_spec.rb4
-rw-r--r--spec/bundler/runtime/inline_spec.rb8
-rw-r--r--spec/bundler/runtime/load_spec.rb2
-rw-r--r--spec/bundler/runtime/platform_spec.rb2
-rw-r--r--spec/bundler/runtime/require_spec.rb2
-rw-r--r--spec/bundler/runtime/setup_spec.rb62
-rw-r--r--spec/bundler/runtime/with_unbundled_env_spec.rb36
-rw-r--r--spec/bundler/spec_helper.rb46
-rw-r--r--spec/bundler/support/artifice/compact_index.rb2
-rw-r--r--spec/bundler/support/artifice/compact_index_api_missing.rb2
-rw-r--r--spec/bundler/support/artifice/compact_index_basic_authentication.rb2
-rw-r--r--spec/bundler/support/artifice/compact_index_checksum_mismatch.rb2
-rw-r--r--spec/bundler/support/artifice/compact_index_concurrent_download.rb2
-rw-r--r--spec/bundler/support/artifice/compact_index_creds_diff_host.rb2
-rw-r--r--spec/bundler/support/artifice/compact_index_extra.rb2
-rw-r--r--spec/bundler/support/artifice/compact_index_extra_api.rb2
-rw-r--r--spec/bundler/support/artifice/compact_index_extra_api_missing.rb2
-rw-r--r--spec/bundler/support/artifice/compact_index_extra_missing.rb2
-rw-r--r--spec/bundler/support/artifice/compact_index_forbidden.rb2
-rw-r--r--spec/bundler/support/artifice/compact_index_host_redirect.rb2
-rw-r--r--spec/bundler/support/artifice/compact_index_no_gem.rb2
-rw-r--r--spec/bundler/support/artifice/compact_index_partial_update.rb2
-rw-r--r--spec/bundler/support/artifice/compact_index_range_not_satisfiable.rb2
-rw-r--r--spec/bundler/support/artifice/compact_index_rate_limited.rb2
-rw-r--r--spec/bundler/support/artifice/compact_index_redirects.rb2
-rw-r--r--spec/bundler/support/artifice/compact_index_strict_basic_authentication.rb2
-rw-r--r--spec/bundler/support/artifice/compact_index_wrong_dependencies.rb2
-rw-r--r--spec/bundler/support/artifice/compact_index_wrong_gem_checksum.rb2
-rw-r--r--spec/bundler/support/artifice/endopint_marshal_fail_basic_authentication.rb2
-rw-r--r--spec/bundler/support/artifice/endpoint.rb6
-rw-r--r--spec/bundler/support/artifice/endpoint_500.rb2
-rw-r--r--spec/bundler/support/artifice/endpoint_api_forbidden.rb2
-rw-r--r--spec/bundler/support/artifice/endpoint_api_missing.rb2
-rw-r--r--spec/bundler/support/artifice/endpoint_basic_authentication.rb2
-rw-r--r--spec/bundler/support/artifice/endpoint_creds_diff_host.rb2
-rw-r--r--spec/bundler/support/artifice/endpoint_extra.rb2
-rw-r--r--spec/bundler/support/artifice/endpoint_extra_api.rb2
-rw-r--r--spec/bundler/support/artifice/endpoint_extra_missing.rb2
-rw-r--r--spec/bundler/support/artifice/endpoint_fallback.rb2
-rw-r--r--spec/bundler/support/artifice/endpoint_host_redirect.rb2
-rw-r--r--spec/bundler/support/artifice/endpoint_marshal_fail.rb2
-rw-r--r--spec/bundler/support/artifice/endpoint_mirror_source.rb2
-rw-r--r--spec/bundler/support/artifice/endpoint_redirect.rb2
-rw-r--r--spec/bundler/support/artifice/endpoint_strict_basic_authentication.rb2
-rw-r--r--spec/bundler/support/artifice/endpoint_timeout.rb2
-rw-r--r--spec/bundler/support/artifice/vcr.rb3
-rw-r--r--spec/bundler/support/artifice/windows.rb2
-rw-r--r--spec/bundler/support/command_execution.rb5
-rw-r--r--spec/bundler/support/filters.rb45
-rw-r--r--spec/bundler/support/helpers.rb32
-rw-r--r--spec/bundler/support/matchers.rb5
-rw-r--r--spec/bundler/support/path.rb4
-rw-r--r--spec/bundler/support/requirement_checker.rb19
-rw-r--r--spec/bundler/support/rubygems.rb7
-rw-r--r--spec/bundler/support/rubygems_ext.rb41
-rw-r--r--spec/bundler/support/rubygems_version_manager.rb127
-rw-r--r--spec/bundler/support/the_bundle.rb4
158 files changed, 1894 insertions, 1495 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb
index a21dc7726d..3b494a6cdf 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -14,6 +14,25 @@ require_relative "bundler/constants"
require_relative "bundler/current_ruby"
require_relative "bundler/build_metadata"
+# Bundler provides a consistent environment for Ruby projects by
+# tracking and installing the exact gems and versions that are needed.
+#
+# Since Ruby 2.6, Bundler is a part of Ruby's standard library.
+#
+# Bunder is used by creating _gemfiles_ listing all the project dependencies
+# and (optionally) their versions and then using
+#
+# require 'bundler/setup'
+#
+# or Bundler.setup to setup environment where only specified gems and their
+# specified versions could be used.
+#
+# See {Bundler website}[https://bundler.io/docs.html] for extensive documentation
+# on gemfiles creation and Bundler usage.
+#
+# As a standard library inside project, Bundler could be used for introspection
+# of loaded and required modules.
+#
module Bundler
environment_preserver = EnvironmentPreserver.new(ENV, EnvironmentPreserver::BUNDLER_KEYS)
ORIGINAL_ENV = environment_preserver.restore
@@ -64,11 +83,11 @@ module Bundler
end
def ui
- (defined?(@ui) && @ui) || (self.ui = UI::Silent.new)
+ (defined?(@ui) && @ui) || (self.ui = UI::Shell.new)
end
def ui=(ui)
- Bundler.rubygems.ui = ui ? UI::RGProxy.new(ui) : nil
+ Bundler.rubygems.ui = UI::RGProxy.new(ui)
@ui = ui
end
@@ -91,6 +110,33 @@ module Bundler
end
end
+ # Turns on the Bundler runtime. After +Bundler.setup+ call, all +load+ or
+ # +require+ of the gems would be allowed only if they are part of
+ # the Gemfile or Ruby's standard library. If the versions specified
+ # in Gemfile, only those versions would be loaded.
+ #
+ # Assuming Gemfile
+ #
+ # gem 'first_gem', '= 1.0'
+ # group :test do
+ # gem 'second_gem', '= 1.0'
+ # end
+ #
+ # The code using Bundler.setup works as follows:
+ #
+ # require 'third_gem' # allowed, required from global gems
+ # require 'first_gem' # allowed, loads the last installed version
+ # Bundler.setup
+ # require 'fourth_gem' # fails with LoadError
+ # require 'second_gem' # loads exactly version 1.0
+ #
+ # +Bundler.setup+ can be called only once, all subsequent calls are no-op.
+ #
+ # If _groups_ list is provided, only gems from specified groups would
+ # be allowed (gems specified outside groups belong to special +:default+ group).
+ #
+ # To require all gems from Gemfile (or only some groups), see Bundler.require.
+ #
def setup(*groups)
# Return if all groups are already loaded
return @setup if defined?(@setup) && @setup
@@ -107,6 +153,24 @@ module Bundler
end
end
+ # Setups Bundler environment (see Bundler.setup) if it is not already set,
+ # and loads all gems from groups specified. Unlike ::setup, can be called
+ # multiple times with different groups (if they were allowed by setup).
+ #
+ # Assuming Gemfile
+ #
+ # gem 'first_gem', '= 1.0'
+ # group :test do
+ # gem 'second_gem', '= 1.0'
+ # end
+ #
+ # The code will work as follows:
+ #
+ # Bundler.setup # allow all groups
+ # Bundler.require(:default) # requires only first_gem
+ # # ...later
+ # Bundler.require(:test) # requires second_gem
+ #
def require(*groups)
setup(*groups).require(*groups)
end
@@ -116,7 +180,7 @@ module Bundler
end
def environment
- SharedHelpers.major_deprecation 2, "Bundler.environment has been removed in favor of Bundler.load"
+ SharedHelpers.major_deprecation 2, "Bundler.environment has been removed in favor of Bundler.load", :print_caller_location => true
load
end
@@ -167,8 +231,7 @@ module Bundler
end
if warning
- Kernel.send(:require, "etc")
- user_home = tmp_home_path(Etc.getlogin, warning)
+ user_home = tmp_home_path(warning)
Bundler.ui.warn "#{warning}\nBundler will use `#{user_home}' as your home directory temporarily.\n"
user_home
else
@@ -177,21 +240,6 @@ module Bundler
end
end
- def tmp_home_path(login, warning)
- login ||= "unknown"
- Kernel.send(:require, "tmpdir")
- path = Pathname.new(Dir.tmpdir).join("bundler", "home")
- SharedHelpers.filesystem_access(path) do |tmp_home_path|
- unless tmp_home_path.exist?
- tmp_home_path.mkpath
- tmp_home_path.chmod(0o777)
- end
- tmp_home_path.join(login).tap(&:mkpath)
- end
- rescue RuntimeError => e
- raise e.exception("#{warning}\nBundler also failed to create a temporary home directory at `#{path}':\n#{e}")
- end
-
def user_bundle_path(dir = "home")
env_var, fallback = case dir
when "home"
@@ -282,7 +330,8 @@ EOF
Bundler::SharedHelpers.major_deprecation(
2,
"`Bundler.clean_env` has been deprecated in favor of `Bundler.unbundled_env`. " \
- "If you instead want the environment before bundler was originally loaded, use `Bundler.original_env`"
+ "If you instead want the environment before bundler was originally loaded, use `Bundler.original_env`",
+ :print_caller_location => true
)
unbundled_env
@@ -321,7 +370,8 @@ EOF
Bundler::SharedHelpers.major_deprecation(
2,
"`Bundler.with_clean_env` has been deprecated in favor of `Bundler.with_unbundled_env`. " \
- "If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env`"
+ "If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env`",
+ :print_caller_location => true
)
with_env(unbundled_env) { yield }
@@ -342,7 +392,8 @@ EOF
Bundler::SharedHelpers.major_deprecation(
2,
"`Bundler.clean_system` has been deprecated in favor of `Bundler.unbundled_system`. " \
- "If you instead want to run the command in the environment before bundler was originally loaded, use `Bundler.original_system`"
+ "If you instead want to run the command in the environment before bundler was originally loaded, use `Bundler.original_system`",
+ :print_caller_location => true
)
with_env(unbundled_env) { Kernel.system(*args) }
@@ -363,7 +414,8 @@ EOF
Bundler::SharedHelpers.major_deprecation(
2,
"`Bundler.clean_exec` has been deprecated in favor of `Bundler.unbundled_exec`. " \
- "If you instead want to exec to a command in the environment before bundler was originally loaded, use `Bundler.original_exec`"
+ "If you instead want to exec to a command in the environment before bundler was originally loaded, use `Bundler.original_exec`",
+ :print_caller_location => true
)
with_env(unbundled_env) { Kernel.exec(*args) }
@@ -608,6 +660,17 @@ EOF
Bundler.rubygems.clear_paths
end
+ def tmp_home_path(warning)
+ Kernel.send(:require, "tmpdir")
+ SharedHelpers.filesystem_access(Dir.tmpdir) do
+ path = Bundler.tmp
+ at_exit { Bundler.rm_rf(path) }
+ path
+ end
+ rescue RuntimeError => e
+ raise e.exception("#{warning}\nBundler also failed to create a temporary home directory':\n#{e}")
+ end
+
# @param env [Hash]
def with_env(env)
backup = ENV.to_hash
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index 45db2a3200..d7f749a672 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -9,15 +9,19 @@ module Bundler
package_name "Bundler"
AUTO_INSTALL_CMDS = %w[show binstubs outdated exec open console licenses clean].freeze
- PARSEABLE_COMMANDS = %w[
- check config help exec platform show version
- ].freeze
+ PARSEABLE_COMMANDS = %w[check config help exec platform show version].freeze
+
+ COMMAND_ALIASES = {
+ "check" => "c",
+ "install" => "i",
+ "list" => "ls",
+ "exec" => ["e", "ex", "exe"],
+ "cache" => ["package", "pack"],
+ "version" => ["-v", "--version"],
+ }.freeze
def self.start(*)
super
- rescue Exception => e # rubocop:disable Lint/RescueException
- Bundler.ui = UI::Shell.new
- raise e
ensure
Bundler::SharedHelpers.print_major_deprecations!
end
@@ -29,6 +33,24 @@ module Bundler
end
end
+ def self.all_aliases
+ @all_aliases ||= begin
+ command_aliases = {}
+
+ COMMAND_ALIASES.each do |name, aliases|
+ Array(aliases).each do |one_alias|
+ command_aliases[one_alias] = name
+ end
+ end
+
+ command_aliases
+ end
+ end
+
+ def self.aliases_for(command_name)
+ COMMAND_ALIASES.select {|k, _| k == command_name }.invert
+ end
+
def initialize(*args)
super
@@ -68,9 +90,7 @@ module Bundler
version
Bundler.ui.info "\n"
- primary_commands = ["install", "update",
- Bundler.feature_flag.bundler_3_mode? ? "cache" : "package",
- "exec", "config", "help"]
+ primary_commands = ["install", "update", "cache", "exec", "config", "help"]
list = self.class.printable_commands(true)
by_name = list.group_by {|name, _message| name.match(/^bundle (\w+)/)[1] }
@@ -154,7 +174,6 @@ module Bundler
"Use the specified gemfile instead of Gemfile"
method_option "path", :type => :string, :banner =>
"Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME).#{" Bundler will remember this value for future installs on this machine" unless Bundler.feature_flag.forget_cli_options?}"
- map "c" => "check"
def check
remembered_flag_deprecation("path")
@@ -162,6 +181,8 @@ module Bundler
Check.new(options).run
end
+ map aliases_for("check")
+
desc "remove [GEM [GEM ...]]", "Removes gems from the Gemfile"
long_desc <<-D
Removes the given gems from the Gemfile while ensuring that the resulting Gemfile is still valid. If the gem is not found, Bundler prints a error message and if gem could not be removed due to any reason Bundler will display a warning.
@@ -223,7 +244,6 @@ module Bundler
"Exclude gems that are part of the specified named group."
method_option "with", :type => :array, :banner =>
"Include gems that are part of the specified named group."
- map "i" => "install"
def install
SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force")
@@ -237,6 +257,8 @@ module Bundler
end
end
+ map aliases_for("install")
+
desc "update [OPTIONS]", "Update the current environment"
long_desc <<-D
Update will install the newest versions of the gems listed in the Gemfile. Use
@@ -328,7 +350,7 @@ module Bundler
List.new(options).run
end
- map %w[ls] => "list"
+ map aliases_for("list")
desc "info GEM [OPTIONS]", "Show information for the given gem"
method_option "path", :type => :boolean, :banner => "Print full path to gem"
@@ -412,7 +434,7 @@ module Bundler
Outdated.new(options, gems).run
end
- desc "#{Bundler.feature_flag.bundler_3_mode? ? :cache : :package} [OPTIONS]", "Locks and then caches all of the gems into vendor/cache"
+ desc "cache [OPTIONS]", "Locks and then caches all of the gems into vendor/cache"
unless Bundler.feature_flag.cache_all?
method_option "all", :type => :boolean,
:banner => "Include all sources (including path and git)."
@@ -421,24 +443,25 @@ module Bundler
method_option "cache-path", :type => :string, :banner =>
"Specify a different cache path than the default (vendor/cache)."
method_option "gemfile", :type => :string, :banner => "Use the specified gemfile instead of Gemfile"
- method_option "no-install", :type => :boolean, :banner => "Don't install the gems, only the package."
+ method_option "no-install", :type => :boolean, :banner => "Don't install the gems, only update the cache."
method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache."
method_option "path", :type => :string, :banner =>
"Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME).#{" Bundler will remember this value for future installs on this machine" unless Bundler.feature_flag.forget_cli_options?}"
method_option "quiet", :type => :boolean, :banner => "Only output warnings and errors."
method_option "frozen", :type => :boolean, :banner =>
- "Do not allow the Gemfile.lock to be updated after this package operation's install"
+ "Do not allow the Gemfile.lock to be updated after this bundle cache operation's install"
long_desc <<-D
- The package command will copy the .gem files for every gem in the bundle into the
+ The cache command will copy the .gem files for every gem in the bundle into the
directory ./vendor/cache. If you then check that directory into your source
control repository, others who check out your source will be able to install the
bundle without having to download any additional gems.
D
- def package
- require_relative "cli/package"
- Package.new(options).run
+ def cache
+ require_relative "cli/cache"
+ Cache.new(options).run
end
- map %w[cache pack] => :package
+
+ map aliases_for("cache")
desc "exec [OPTIONS]", "Run the command in context of the bundle"
method_option :keep_file_descriptors, :type => :boolean, :default => false
@@ -448,12 +471,13 @@ module Bundler
bundle exec you can require and call the bundled gems as if they were installed
into the system wide RubyGems repository.
D
- map "e" => "exec"
def exec(*args)
require_relative "cli/exec"
Exec.new(options, args).run
end
+ map aliases_for("exec")
+
desc "config NAME [VALUE]", "Retrieve or set a configuration value"
long_desc <<-D
Retrieves or sets a configuration value. If only one parameter is provided, retrieve the value. If two parameters are provided, replace the
@@ -496,7 +520,8 @@ module Bundler
Bundler.ui.info "Bundler version #{Bundler::VERSION}#{build_info}"
end
end
- map %w[-v --version] => :version
+
+ map aliases_for("version")
desc "licenses", "Prints the license of all gems in the bundle"
def licenses
@@ -680,12 +705,17 @@ module Bundler
# Reformat the arguments passed to bundle that include a --help flag
# into the corresponding `bundle help #{command}` call
def self.reformatted_help_args(args)
- bundler_commands = all_commands.keys
+ bundler_commands = (COMMAND_ALIASES.keys + COMMAND_ALIASES.values).flatten
+
help_flags = %w[--help -h]
- exec_commands = %w[e ex exe exec]
+ exec_commands = ["exec"] + COMMAND_ALIASES["exec"]
+
help_used = args.index {|a| help_flags.include? a }
exec_used = args.index {|a| exec_commands.include? a }
+
command = args.find {|a| bundler_commands.include? a }
+ command = all_aliases[command] if all_aliases[command]
+
if exec_used && help_used
if exec_used + help_used == 1
%w[help exec]
@@ -790,7 +820,7 @@ module Bundler
Bundler::SharedHelpers.major_deprecation 2,\
"The `#{flag_name}` flag is deprecated because it relies on being " \
- "remembered across bundler invokations, which bundler will no longer " \
+ "remembered across bundler invocations, which bundler will no longer " \
"do in future versions. Instead please use `bundle config set #{name} " \
"'#{value}'`, and stop using this flag"
end
diff --git a/lib/bundler/cli/add.rb b/lib/bundler/cli/add.rb
index 7c6235f17c..07b951f1ef 100644
--- a/lib/bundler/cli/add.rb
+++ b/lib/bundler/cli/add.rb
@@ -21,6 +21,7 @@ module Bundler
def perform_bundle_install
Installer.install(Bundler.root, Bundler.definition)
+ Bundler.load.cache if Bundler.app_cache.exist?
end
def inject_dependencies
diff --git a/lib/bundler/cli/cache.rb b/lib/bundler/cli/cache.rb
new file mode 100644
index 0000000000..5e8420990f
--- /dev/null
+++ b/lib/bundler/cli/cache.rb
@@ -0,0 +1,48 @@
+# frozen_string_literal: true
+
+module Bundler
+ class CLI::Cache
+ attr_reader :options
+
+ def initialize(options)
+ @options = options
+ end
+
+ def run
+ Bundler.ui.level = "error" if options[:quiet]
+ Bundler.settings.set_command_option_if_given :path, options[:path]
+ Bundler.settings.set_command_option_if_given :cache_path, options["cache-path"]
+
+ setup_cache_all
+ install
+
+ # TODO: move cache contents here now that all bundles are locked
+ custom_path = Bundler.settings[:path] if options[:path]
+
+ Bundler.settings.temporary(:cache_all_platforms => options["all-platforms"]) do
+ Bundler.load.cache(custom_path)
+ end
+ end
+
+ private
+
+ def install
+ require_relative "install"
+ options = self.options.dup
+ options["local"] = false if Bundler.settings[:cache_all_platforms]
+ Bundler::CLI::Install.new(options).run
+ end
+
+ def setup_cache_all
+ all = options.fetch(:all, Bundler.feature_flag.cache_all? || nil)
+
+ Bundler.settings.set_command_option_if_given :cache_all, all
+
+ if Bundler.definition.has_local_dependencies? && !Bundler.feature_flag.cache_all?
+ Bundler.ui.warn "Your Gemfile contains path and git dependencies. If you want " \
+ "to cache them as well, please pass the --all flag. This will be the default " \
+ "on Bundler 3.0."
+ end
+ end
+ end
+end
diff --git a/lib/bundler/cli/exec.rb b/lib/bundler/cli/exec.rb
index 0b0e991ea5..0a1edbdbbd 100644
--- a/lib/bundler/cli/exec.rb
+++ b/lib/bundler/cli/exec.rb
@@ -43,15 +43,11 @@ module Bundler
end
def kernel_exec(*args)
- ui = Bundler.ui
- Bundler.ui = nil
Kernel.exec(*args)
rescue Errno::EACCES, Errno::ENOEXEC
- Bundler.ui = ui
Bundler.ui.error "bundler: not executable: #{cmd}"
exit 126
rescue Errno::ENOENT
- Bundler.ui = ui
Bundler.ui.error "bundler: command not found: #{cmd}"
Bundler.ui.warn "Install missing gem executables with `bundle install`"
exit 127
@@ -62,15 +58,12 @@ module Bundler
ARGV.replace(args)
$0 = file
Process.setproctitle(process_title(file, args)) if Process.respond_to?(:setproctitle)
- ui = Bundler.ui
- Bundler.ui = nil
require_relative "../setup"
TRAPPED_SIGNALS.each {|s| trap(s, "DEFAULT") }
Kernel.load(file)
rescue SystemExit, SignalException
raise
rescue Exception => e # rubocop:disable Lint/RescueException
- Bundler.ui = ui
Bundler.ui.error "bundler: failed to load command: #{cmd} (#{file})"
backtrace = e.backtrace ? e.backtrace.take_while {|bt| !bt.start_with?(__FILE__) } : []
abort "#{e.class}: #{e.message}\n #{backtrace.join("\n ")}"
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb
index cc23f9b389..99a369281a 100644
--- a/lib/bundler/dsl.rb
+++ b/lib/bundler/dsl.rb
@@ -44,7 +44,7 @@ module Bundler
@gemfile = expanded_gemfile_path
@gemfiles << expanded_gemfile_path
contents ||= Bundler.read_file(@gemfile.to_s)
- instance_eval(contents.dup.untaint, gemfile.to_s, 1)
+ instance_eval(contents.dup.tap{|x| x.untaint if RUBY_VERSION < "2.7" }, gemfile.to_s, 1)
rescue Exception => e # rubocop:disable Lint/RescueException
message = "There was an error " \
"#{e.is_a?(GemfileEvalError) ? "evaluating" : "parsing"} " \
diff --git a/lib/bundler/friendly_errors.rb b/lib/bundler/friendly_errors.rb
index e9f06d90be..273573e820 100644
--- a/lib/bundler/friendly_errors.rb
+++ b/lib/bundler/friendly_errors.rb
@@ -16,7 +16,7 @@ module Bundler
Bundler.ui.error error.message
when GemRequireError
Bundler.ui.error error.message
- Bundler.ui.trace error.orig_exception, nil, true
+ Bundler.ui.trace error.orig_exception
when BundlerError
Bundler.ui.error error.message, :wrap => true
Bundler.ui.trace error
diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb
index d00c1894a8..81872b9429 100644
--- a/lib/bundler/gem_helper.rb
+++ b/lib/bundler/gem_helper.rb
@@ -26,7 +26,6 @@ module Bundler
attr_reader :spec_path, :base, :gemspec
def initialize(base = nil, name = nil)
- Bundler.ui = UI::Shell.new
@base = (base ||= SharedHelpers.pwd)
gemspecs = name ? [File.join(base, "#{name}.gemspec")] : Dir[File.join(base, "{,*}.gemspec")]
raise "Unable to determine name from existing gemspec. Use :name => 'gemname' in #install_tasks to manually set it." unless gemspecs.size == 1
diff --git a/lib/bundler/gem_helpers.rb b/lib/bundler/gem_helpers.rb
index 90dfb70867..be047f4397 100644
--- a/lib/bundler/gem_helpers.rb
+++ b/lib/bundler/gem_helpers.rb
@@ -2,7 +2,7 @@
module Bundler
module GemHelpers
- GENERIC_CACHE = { Gem::Platform::RUBY => Gem::Platform::RUBY } # rubocop:disable MutableConstant
+ GENERIC_CACHE = { Gem::Platform::RUBY => Gem::Platform::RUBY } # rubocop:disable Style/MutableConstant
GENERICS = [
[Gem::Platform.new("java"), Gem::Platform.new("java")],
[Gem::Platform.new("mswin32"), Gem::Platform.new("mswin32")],
diff --git a/lib/bundler/inline.rb b/lib/bundler/inline.rb
index dbf737c7ee..152d7d3f60 100644
--- a/lib/bundler/inline.rb
+++ b/lib/bundler/inline.rb
@@ -38,6 +38,8 @@ def gemfile(install = false, options = {}, &gemfile)
raise ArgumentError, "Unknown options: #{opts.keys.join(", ")}" unless opts.empty?
old_root = Bundler.method(:root)
+ bundler_module = class << Bundler; self; end
+ bundler_module.send(:remove_method, :root)
def Bundler.root
Bundler::SharedHelpers.pwd.expand_path
end
@@ -56,7 +58,7 @@ def gemfile(install = false, options = {}, &gemfile)
definition.missing_specs?
end
- Bundler.ui = ui if install
+ Bundler.ui = install ? ui : Bundler::UI::Silent.new
if install || missing_specs.call
Bundler.settings.temporary(:inline => true, :disable_platform_warnings => true) do
installer = Bundler::Installer.install(Bundler.root, definition, :system => true)
@@ -70,6 +72,8 @@ def gemfile(install = false, options = {}, &gemfile)
runtime.setup.require
end
ensure
- bundler_module = class << Bundler; self; end
- bundler_module.send(:define_method, :root, old_root) if old_root
+ if bundler_module
+ bundler_module.send(:remove_method, :root)
+ bundler_module.send(:define_method, :root, old_root)
+ end
end
diff --git a/lib/bundler/lockfile_parser.rb b/lib/bundler/lockfile_parser.rb
index 5658ec1205..caabd524d4 100644
--- a/lib/bundler/lockfile_parser.rb
+++ b/lib/bundler/lockfile_parser.rb
@@ -1,5 +1,6 @@
# frozen_string_literal: true
+#--
# Some versions of the Bundler 1.1 RC series introduced corrupted
# lockfiles. There were two major problems:
#
diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb
index 96b93836c7..eda826422f 100644
--- a/lib/bundler/rubygems_ext.rb
+++ b/lib/bundler/rubygems_ext.rb
@@ -29,7 +29,7 @@ module Gem
# gems at that time, this method could be called inside another require,
# thus raising with that constant being undefined. Better to check a method
if source.respond_to?(:path) || (source.respond_to?(:bundler_plugin_api_source?) && source.bundler_plugin_api_source?)
- Pathname.new(loaded_from).dirname.expand_path(source.root).to_s.untaint
+ Pathname.new(loaded_from).dirname.expand_path(source.root).to_s.tap{|x| x.untaint if RUBY_VERSION < "2.7" }
else
rg_full_gem_path
end
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index 7549c592f1..c4950d14e8 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -635,7 +635,6 @@ module Bundler
ENV["BUNDLE_GEMFILE"] ||= File.expand_path(gemfile)
require_relative "gemdeps"
runtime = Bundler.setup
- Bundler.ui = nil
activated_spec_names = runtime.requested_specs.map(&:to_spec).sort_by(&:name)
[Gemdeps.new(runtime), activated_spec_names]
end
diff --git a/lib/bundler/setup.rb b/lib/bundler/setup.rb
index d156f494a8..70a0968f4b 100644
--- a/lib/bundler/setup.rb
+++ b/lib/bundler/setup.rb
@@ -6,9 +6,8 @@ if Bundler::SharedHelpers.in_bundle?
require_relative "../bundler"
if STDOUT.tty? || ENV["BUNDLER_FORCE_TTY"]
- Bundler.ui = Bundler::UI::Shell.new
begin
- Bundler.setup
+ Bundler.ui.silence { Bundler.setup }
rescue Bundler::BundlerError => e
Bundler.ui.warn "\e[31m#{e.message}\e[0m"
Bundler.ui.warn e.backtrace.join("\n") if ENV["DEBUG"]
@@ -18,12 +17,6 @@ if Bundler::SharedHelpers.in_bundle?
exit e.status_code
end
else
- Bundler.setup
+ Bundler.ui.silence { Bundler.setup }
end
-
- # Add bundler to the load path after disabling system gems
- bundler_lib = File.expand_path("../..", __FILE__)
- $LOAD_PATH.unshift(bundler_lib) unless $LOAD_PATH.include?(bundler_lib)
-
- Bundler.ui = nil
end
diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb
index e6e2b79344..6e83bc5ff4 100644
--- a/lib/bundler/shared_helpers.rb
+++ b/lib/bundler/shared_helpers.rb
@@ -13,13 +13,13 @@ module Bundler
def root
gemfile = find_gemfile
raise GemfileNotFound, "Could not locate Gemfile" unless gemfile
- Pathname.new(gemfile).untaint.expand_path.parent
+ Pathname.new(gemfile).tap{|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path.parent
end
def default_gemfile
gemfile = find_gemfile
raise GemfileNotFound, "Could not locate Gemfile" unless gemfile
- Pathname.new(gemfile).untaint.expand_path
+ Pathname.new(gemfile).tap{|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path
end
def default_lockfile
@@ -28,7 +28,7 @@ module Bundler
case gemfile.basename.to_s
when "gems.rb" then Pathname.new(gemfile.sub(/.rb$/, ".locked"))
else Pathname.new("#{gemfile}.lock")
- end.untaint
+ end.tap{|x| x.untaint if RUBY_VERSION < "2.7" }
end
def default_bundle_dir
@@ -100,7 +100,7 @@ module Bundler
#
# @see {Bundler::PermissionError}
def filesystem_access(path, action = :write, &block)
- yield(path.dup.untaint)
+ yield(path.dup.tap{|x| x.untaint if RUBY_VERSION < "2.7" })
rescue Errno::EACCES
raise PermissionError.new(path, action)
rescue Errno::EAGAIN
@@ -124,7 +124,12 @@ module Bundler
namespace.const_get(constant_name)
end
- def major_deprecation(major_version, message)
+ def major_deprecation(major_version, message, print_caller_location: false)
+ if print_caller_location
+ caller_location = caller_locations(2, 2).first
+ message = "#{message} (called at #{caller_location.path}:#{caller_location.lineno})"
+ end
+
bundler_major_version = Bundler.bundler_major_version
if bundler_major_version > major_version
require_relative "errors"
@@ -132,10 +137,7 @@ module Bundler
end
return unless bundler_major_version >= major_version && prints_major_deprecations?
- @major_deprecation_ui ||= Bundler::UI::Shell.new("no-color" => true)
- with_major_deprecation_ui do |ui|
- ui.warn("[DEPRECATED] #{message}")
- end
+ Bundler.ui.warn("[DEPRECATED] #{message}")
end
def print_major_deprecations!
@@ -212,21 +214,6 @@ module Bundler
private
- def with_major_deprecation_ui(&block)
- ui = Bundler.ui
-
- if ui.is_a?(@major_deprecation_ui.class)
- yield ui
- else
- begin
- Bundler.ui = @major_deprecation_ui
- yield Bundler.ui
- ensure
- Bundler.ui = ui
- end
- end
- end
-
def validate_bundle_path
path_separator = Bundler.rubygems.path_separator
return unless Bundler.bundle_path.to_s.split(path_separator).size > 1
@@ -263,7 +250,7 @@ module Bundler
def search_up(*names)
previous = nil
- current = File.expand_path(SharedHelpers.pwd).untaint
+ current = File.expand_path(SharedHelpers.pwd).tap{|x| x.untaint if RUBY_VERSION < "2.7" }
until !File.directory?(current) || current == previous
if ENV["BUNDLE_SPEC_RUN"]
diff --git a/lib/bundler/source/git.rb b/lib/bundler/source/git.rb
index 73123622d4..736f5bb546 100644
--- a/lib/bundler/source/git.rb
+++ b/lib/bundler/source/git.rb
@@ -316,7 +316,7 @@ module Bundler
def load_gemspec(file)
stub = Gem::StubSpecification.gemspec_stub(file, install_path.parent, install_path.parent)
- stub.full_gem_path = Pathname.new(file).dirname.expand_path(root).to_s.untaint
+ stub.full_gem_path = Pathname.new(file).dirname.expand_path(root).to_s.tap{|x| x.untaint if RUBY_VERSION < "2.7" }
StubSpecification.from_stub(stub)
end
diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb
index 1f6dc5d8f9..2a4d7138a4 100644
--- a/lib/bundler/source/git/git_proxy.rb
+++ b/lib/bundler/source/git/git_proxy.rb
@@ -2,7 +2,7 @@
require "open3"
require "shellwords"
-require "tempfile"
+
module Bundler
class Source
class Git
diff --git a/lib/bundler/vendor/fileutils/lib/fileutils.rb b/lib/bundler/vendor/fileutils/lib/fileutils.rb
index 6fbe741498..c1988dceab 100644
--- a/lib/bundler/vendor/fileutils/lib/fileutils.rb
+++ b/lib/bundler/vendor/fileutils/lib/fileutils.rb
@@ -24,46 +24,56 @@ require_relative "fileutils/version"
#
# require 'bundler/vendor/fileutils/lib/fileutils'
#
-# Bundler::FileUtils.cd(dir, options)
-# Bundler::FileUtils.cd(dir, options) {|dir| block }
+# Bundler::FileUtils.cd(dir, **options)
+# Bundler::FileUtils.cd(dir, **options) {|dir| block }
# Bundler::FileUtils.pwd()
-# Bundler::FileUtils.mkdir(dir, options)
-# Bundler::FileUtils.mkdir(list, options)
-# Bundler::FileUtils.mkdir_p(dir, options)
-# Bundler::FileUtils.mkdir_p(list, options)
-# Bundler::FileUtils.rmdir(dir, options)
-# Bundler::FileUtils.rmdir(list, options)
-# Bundler::FileUtils.ln(target, link, options)
-# Bundler::FileUtils.ln(targets, dir, options)
-# Bundler::FileUtils.ln_s(target, link, options)
-# Bundler::FileUtils.ln_s(targets, dir, options)
-# Bundler::FileUtils.ln_sf(target, link, options)
-# Bundler::FileUtils.cp(src, dest, options)
-# Bundler::FileUtils.cp(list, dir, options)
-# Bundler::FileUtils.cp_r(src, dest, options)
-# Bundler::FileUtils.cp_r(list, dir, options)
-# Bundler::FileUtils.mv(src, dest, options)
-# Bundler::FileUtils.mv(list, dir, options)
-# Bundler::FileUtils.rm(list, options)
-# Bundler::FileUtils.rm_r(list, options)
-# Bundler::FileUtils.rm_rf(list, options)
-# Bundler::FileUtils.install(src, dest, options)
-# Bundler::FileUtils.chmod(mode, list, options)
-# Bundler::FileUtils.chmod_R(mode, list, options)
-# Bundler::FileUtils.chown(user, group, list, options)
-# Bundler::FileUtils.chown_R(user, group, list, options)
-# Bundler::FileUtils.touch(list, options)
+# Bundler::FileUtils.mkdir(dir, **options)
+# Bundler::FileUtils.mkdir(list, **options)
+# Bundler::FileUtils.mkdir_p(dir, **options)
+# Bundler::FileUtils.mkdir_p(list, **options)
+# Bundler::FileUtils.rmdir(dir, **options)
+# Bundler::FileUtils.rmdir(list, **options)
+# Bundler::FileUtils.ln(target, link, **options)
+# Bundler::FileUtils.ln(targets, dir, **options)
+# Bundler::FileUtils.ln_s(target, link, **options)
+# Bundler::FileUtils.ln_s(targets, dir, **options)
+# Bundler::FileUtils.ln_sf(target, link, **options)
+# Bundler::FileUtils.cp(src, dest, **options)
+# Bundler::FileUtils.cp(list, dir, **options)
+# Bundler::FileUtils.cp_r(src, dest, **options)
+# Bundler::FileUtils.cp_r(list, dir, **options)
+# Bundler::FileUtils.mv(src, dest, **options)
+# Bundler::FileUtils.mv(list, dir, **options)
+# Bundler::FileUtils.rm(list, **options)
+# Bundler::FileUtils.rm_r(list, **options)
+# Bundler::FileUtils.rm_rf(list, **options)
+# Bundler::FileUtils.install(src, dest, **options)
+# Bundler::FileUtils.chmod(mode, list, **options)
+# Bundler::FileUtils.chmod_R(mode, list, **options)
+# Bundler::FileUtils.chown(user, group, list, **options)
+# Bundler::FileUtils.chown_R(user, group, list, **options)
+# Bundler::FileUtils.touch(list, **options)
#
-# The <tt>options</tt> parameter is a hash of options, taken from the list
-# <tt>:force</tt>, <tt>:noop</tt>, <tt>:preserve</tt>, and <tt>:verbose</tt>.
-# <tt>:noop</tt> means that no changes are made. The other three are obvious.
-# Each method documents the options that it honours.
+# Possible <tt>options</tt> are:
+#
+# <tt>:force</tt> :: forced operation (rewrite files if exist, remove
+# directories if not empty, etc.);
+# <tt>:verbose</tt> :: print command to be run, in bash syntax, before
+# performing it;
+# <tt>:preserve</tt> :: preserve object's group, user and modification
+# time on copying;
+# <tt>:noop</tt> :: no changes are made (usable in combination with
+# <tt>:verbose</tt> which will print the command to run)
+#
+# Each method documents the options that it honours. See also ::commands,
+# ::options and ::options_of methods to introspect which command have which
+# options.
#
# All methods that have the concept of a "source" file or directory can take
# either one file or a list of files in that argument. See the method
# documentation for examples.
#
-# There are some `low level' methods, which do not accept any option:
+# There are some `low level' methods, which do not accept keyword arguments:
#
# Bundler::FileUtils.copy_entry(src, dest, preserve = false, dereference_root = false, remove_destination = false)
# Bundler::FileUtils.copy_file(src, dest, preserve = false, dereference = true)
@@ -119,7 +129,7 @@ module Bundler::FileUtils
#
# Bundler::FileUtils.cd('/') # change directory
#
- # Bundler::FileUtils.cd('/', :verbose => true) # change directory and report it
+ # Bundler::FileUtils.cd('/', verbose: true) # change directory and report it
#
# Bundler::FileUtils.cd('/') do # change directory
# # ... # do something
@@ -164,9 +174,9 @@ module Bundler::FileUtils
# Creates one or more directories.
#
# Bundler::FileUtils.mkdir 'test'
- # Bundler::FileUtils.mkdir %w( tmp data )
- # Bundler::FileUtils.mkdir 'notexist', :noop => true # Does not really create.
- # Bundler::FileUtils.mkdir 'tmp', :mode => 0700
+ # Bundler::FileUtils.mkdir %w(tmp data)
+ # Bundler::FileUtils.mkdir 'notexist', noop: true # Does not really create.
+ # Bundler::FileUtils.mkdir 'tmp', mode: 0700
#
def mkdir(list, mode: nil, noop: nil, verbose: nil)
list = fu_list(list)
@@ -185,7 +195,7 @@ module Bundler::FileUtils
#
# Bundler::FileUtils.mkdir_p '/usr/local/lib/ruby'
#
- # causes to make following directories, if it does not exist.
+ # causes to make following directories, if they do not exist.
#
# * /usr
# * /usr/local
@@ -249,7 +259,7 @@ module Bundler::FileUtils
# Bundler::FileUtils.rmdir 'somedir'
# Bundler::FileUtils.rmdir %w(somedir anydir otherdir)
# # Does not really remove directory; outputs message.
- # Bundler::FileUtils.rmdir 'somedir', :verbose => true, :noop => true
+ # Bundler::FileUtils.rmdir 'somedir', verbose: true, noop: true
#
def rmdir(list, parents: nil, noop: nil, verbose: nil)
list = fu_list(list)
@@ -278,7 +288,7 @@ module Bundler::FileUtils
#
# In the first form, creates a hard link +link+ which points to +target+.
# If +link+ already exists, raises Errno::EEXIST.
- # But if the :force option is set, overwrites +link+.
+ # But if the +force+ option is set, overwrites +link+.
#
# Bundler::FileUtils.ln 'gcc', 'cc', verbose: true
# Bundler::FileUtils.ln '/usr/bin/emacs21', '/usr/bin/emacs'
@@ -305,22 +315,22 @@ module Bundler::FileUtils
module_function :link
#
- # :call-seq:
- # Bundler::FileUtils.cp_lr(src, dest, noop: nil, verbose: nil, dereference_root: true, remove_destination: false)
- #
# Hard link +src+ to +dest+. If +src+ is a directory, this method links
# all its contents recursively. If +dest+ is a directory, links
# +src+ to +dest/src+.
#
# +src+ can be a list of files.
#
- # # Installing the library "mylib" under the site_ruby directory.
- # Bundler::FileUtils.rm_r site_ruby + '/mylib', :force => true
+ # If +dereference_root+ is true, this method dereference tree root.
+ #
+ # If +remove_destination+ is true, this method removes each destination file before copy.
+ #
+ # Bundler::FileUtils.rm_r site_ruby + '/mylib', force: true
# Bundler::FileUtils.cp_lr 'lib/', site_ruby + '/mylib'
#
# # Examples of linking several files to target directory.
# Bundler::FileUtils.cp_lr %w(mail.rb field.rb debug/), site_ruby + '/tmail'
- # Bundler::FileUtils.cp_lr Dir.glob('*.rb'), '/home/aamine/lib/ruby', :noop => true, :verbose => true
+ # Bundler::FileUtils.cp_lr Dir.glob('*.rb'), '/home/aamine/lib/ruby', noop: true, verbose: true
#
# # If you want to link all contents of a directory instead of the
# # directory itself, c.f. src/x -> dest/x, src/y -> dest/y,
@@ -345,7 +355,7 @@ module Bundler::FileUtils
#
# In the first form, creates a symbolic link +link+ which points to +target+.
# If +link+ already exists, raises Errno::EEXIST.
- # But if the :force option is set, overwrites +link+.
+ # But if the <tt>force</tt> option is set, overwrites +link+.
#
# Bundler::FileUtils.ln_s '/usr/bin/ruby', '/usr/local/bin/ruby'
# Bundler::FileUtils.ln_s 'verylongsourcefilename.c', 'c', force: true
@@ -411,7 +421,7 @@ module Bundler::FileUtils
#
# Bundler::FileUtils.cp 'eval.c', 'eval.c.org'
# Bundler::FileUtils.cp %w(cgi.rb complex.rb date.rb), '/usr/lib/ruby/1.6'
- # Bundler::FileUtils.cp %w(cgi.rb complex.rb date.rb), '/usr/lib/ruby/1.6', :verbose => true
+ # Bundler::FileUtils.cp %w(cgi.rb complex.rb date.rb), '/usr/lib/ruby/1.6', verbose: true
# Bundler::FileUtils.cp 'symlink', 'dest' # copy content, "dest" is not a symlink
#
def cp(src, dest, preserve: nil, noop: nil, verbose: nil)
@@ -433,13 +443,17 @@ module Bundler::FileUtils
#
# +src+ can be a list of files.
#
+ # If +dereference_root+ is true, this method dereference tree root.
+ #
+ # If +remove_destination+ is true, this method removes each destination file before copy.
+ #
# # Installing Ruby library "mylib" under the site_ruby
- # Bundler::FileUtils.rm_r site_ruby + '/mylib', :force
+ # Bundler::FileUtils.rm_r site_ruby + '/mylib', force: true
# Bundler::FileUtils.cp_r 'lib/', site_ruby + '/mylib'
#
# # Examples of copying several files to target directory.
# Bundler::FileUtils.cp_r %w(mail.rb field.rb debug/), site_ruby + '/tmail'
- # Bundler::FileUtils.cp_r Dir.glob('*.rb'), '/home/foo/lib/ruby', :noop => true, :verbose => true
+ # Bundler::FileUtils.cp_r Dir.glob('*.rb'), '/home/foo/lib/ruby', noop: true, verbose: true
#
# # If you want to copy all contents of a directory instead of the
# # directory itself, c.f. src/x -> dest/x, src/y -> dest/y,
@@ -474,7 +488,11 @@ module Bundler::FileUtils
# If +remove_destination+ is true, this method removes each destination file before copy.
#
def copy_entry(src, dest, preserve = false, dereference_root = false, remove_destination = false)
- Entry_.new(src, nil, dereference_root).wrap_traverse(proc do |ent|
+ if dereference_root
+ src = File.realpath(src)
+ end
+
+ Entry_.new(src, nil, false).wrap_traverse(proc do |ent|
destent = Entry_.new(dest, ent.rel, false)
File.unlink destent.path if remove_destination && (File.file?(destent.path) || File.symlink?(destent.path))
ent.copy destent.path
@@ -511,10 +529,10 @@ module Bundler::FileUtils
# disk partition, the file is copied then the original file is removed.
#
# Bundler::FileUtils.mv 'badname.rb', 'goodname.rb'
- # Bundler::FileUtils.mv 'stuff.rb', '/notexist/lib/ruby', :force => true # no error
+ # Bundler::FileUtils.mv 'stuff.rb', '/notexist/lib/ruby', force: true # no error
#
# Bundler::FileUtils.mv %w(junk.txt dust.txt), '/home/foo/.trash/'
- # Bundler::FileUtils.mv Dir.glob('test*.rb'), 'test', :noop => true, :verbose => true
+ # Bundler::FileUtils.mv Dir.glob('test*.rb'), 'test', noop: true, verbose: true
#
def mv(src, dest, force: nil, noop: nil, verbose: nil, secure: nil)
fu_output_message "mv#{force ? ' -f' : ''} #{[src,dest].flatten.join ' '}" if verbose
@@ -554,7 +572,7 @@ module Bundler::FileUtils
#
# Bundler::FileUtils.rm %w( junk.txt dust.txt )
# Bundler::FileUtils.rm Dir.glob('*.so')
- # Bundler::FileUtils.rm 'NotExistFile', :force => true # never raises exception
+ # Bundler::FileUtils.rm 'NotExistFile', force: true # never raises exception
#
def rm(list, force: nil, noop: nil, verbose: nil)
list = fu_list(list)
@@ -573,7 +591,7 @@ module Bundler::FileUtils
#
# Equivalent to
#
- # Bundler::FileUtils.rm(list, :force => true)
+ # Bundler::FileUtils.rm(list, force: true)
#
def rm_f(list, noop: nil, verbose: nil)
rm list, force: true, noop: noop, verbose: verbose
@@ -589,18 +607,18 @@ module Bundler::FileUtils
# StandardError when :force option is set.
#
# Bundler::FileUtils.rm_r Dir.glob('/tmp/*')
- # Bundler::FileUtils.rm_r 'some_dir', :force => true
+ # Bundler::FileUtils.rm_r 'some_dir', force: true
#
# WARNING: This method causes local vulnerability
# if one of parent directories or removing directory tree are world
# writable (including /tmp, whose permission is 1777), and the current
# process has strong privilege such as Unix super user (root), and the
# system has symbolic link. For secure removing, read the documentation
- # of #remove_entry_secure carefully, and set :secure option to true.
- # Default is :secure=>false.
+ # of remove_entry_secure carefully, and set :secure option to true.
+ # Default is <tt>secure: false</tt>.
#
- # NOTE: This method calls #remove_entry_secure if :secure option is set.
- # See also #remove_entry_secure.
+ # NOTE: This method calls remove_entry_secure if :secure option is set.
+ # See also remove_entry_secure.
#
def rm_r(list, force: nil, noop: nil, verbose: nil, secure: nil)
list = fu_list(list)
@@ -619,10 +637,10 @@ module Bundler::FileUtils
#
# Equivalent to
#
- # Bundler::FileUtils.rm_r(list, :force => true)
+ # Bundler::FileUtils.rm_r(list, force: true)
#
# WARNING: This method causes local vulnerability.
- # Read the documentation of #rm_r first.
+ # Read the documentation of rm_r first.
#
def rm_rf(list, noop: nil, verbose: nil, secure: nil)
rm_r list, force: true, noop: noop, verbose: verbose, secure: secure
@@ -636,7 +654,7 @@ module Bundler::FileUtils
# This method removes a file system entry +path+. +path+ shall be a
# regular file, a directory, or something. If +path+ is a directory,
# remove it recursively. This method is required to avoid TOCTTOU
- # (time-of-check-to-time-of-use) local security vulnerability of #rm_r.
+ # (time-of-check-to-time-of-use) local security vulnerability of rm_r.
# #rm_r causes security hole when:
#
# * Parent directory is world writable (including /tmp).
@@ -755,7 +773,7 @@ module Bundler::FileUtils
# +path+ might be a regular file, a directory, or something.
# If +path+ is a directory, remove it recursively.
#
- # See also #remove_entry_secure.
+ # See also remove_entry_secure.
#
def remove_entry(path, force = false)
Entry_.new(path).postorder_traverse do |ent|
@@ -839,8 +857,8 @@ module Bundler::FileUtils
# mode to +mode+. If +dest+ is a directory, destination is +dest+/+src+.
# This method removes destination before copy.
#
- # Bundler::FileUtils.install 'ruby', '/usr/local/bin/ruby', :mode => 0755, :verbose => true
- # Bundler::FileUtils.install 'lib.rb', '/usr/local/lib/ruby/site_ruby', :verbose => true
+ # Bundler::FileUtils.install 'ruby', '/usr/local/bin/ruby', mode: 0755, verbose: true
+ # Bundler::FileUtils.install 'lib.rb', '/usr/local/lib/ruby/site_ruby', verbose: true
#
def install(src, dest, mode: nil, owner: nil, group: nil, preserve: nil,
noop: nil, verbose: nil)
@@ -970,12 +988,12 @@ module Bundler::FileUtils
# Absolute mode is
# Bundler::FileUtils.chmod 0755, 'somecommand'
# Bundler::FileUtils.chmod 0644, %w(my.rb your.rb his.rb her.rb)
- # Bundler::FileUtils.chmod 0755, '/usr/bin/ruby', :verbose => true
+ # Bundler::FileUtils.chmod 0755, '/usr/bin/ruby', verbose: true
#
# Symbolic mode is
# Bundler::FileUtils.chmod "u=wrx,go=rx", 'somecommand'
# Bundler::FileUtils.chmod "u=wr,go=rr", %w(my.rb your.rb his.rb her.rb)
- # Bundler::FileUtils.chmod "u=wrx,go=rx", '/usr/bin/ruby', :verbose => true
+ # Bundler::FileUtils.chmod "u=wrx,go=rx", '/usr/bin/ruby', verbose: true
#
# "a" :: is user, group, other mask.
# "u" :: is user's mask.
@@ -1035,7 +1053,7 @@ module Bundler::FileUtils
# the attribute.
#
# Bundler::FileUtils.chown 'root', 'staff', '/usr/local/bin/ruby'
- # Bundler::FileUtils.chown nil, 'bin', Dir.glob('/usr/bin/*'), :verbose => true
+ # Bundler::FileUtils.chown nil, 'bin', Dir.glob('/usr/bin/*'), verbose: true
#
def chown(user, group, list, noop: nil, verbose: nil)
list = fu_list(list)
@@ -1059,7 +1077,7 @@ module Bundler::FileUtils
# method does not change the attribute.
#
# Bundler::FileUtils.chown_R 'www', 'www', '/var/www/htdocs'
- # Bundler::FileUtils.chown_R 'cvs', 'cvs', '/var/cvs', :verbose => true
+ # Bundler::FileUtils.chown_R 'cvs', 'cvs', '/var/cvs', verbose: true
#
def chown_R(user, group, list, noop: nil, verbose: nil, force: nil)
list = fu_list(list)
@@ -1276,13 +1294,13 @@ module Bundler::FileUtils
opts[:encoding] = ::Encoding::UTF_8 if fu_windows?
files = if Dir.respond_to?(:children)
- Dir.children(path, opts)
+ Dir.children(path, **opts)
else
- Dir.entries(path(), opts)
+ Dir.entries(path(), **opts)
.reject {|n| n == '.' or n == '..' }
end
- files.map {|n| Entry_.new(prefix(), join(rel(), n.untaint)) }
+ files.map {|n| Entry_.new(prefix(), join(rel(), n.tap{|x| x.untaint if RUBY_VERSION < "2.7" })) }
end
def stat
@@ -1369,18 +1387,21 @@ module Bundler::FileUtils
end
when symlink?
File.symlink File.readlink(path()), dest
- when chardev?
- raise "cannot handle device file" unless File.respond_to?(:mknod)
- mknod dest, ?c, 0666, lstat().rdev
- when blockdev?
- raise "cannot handle device file" unless File.respond_to?(:mknod)
- mknod dest, ?b, 0666, lstat().rdev
+ when chardev?, blockdev?
+ raise "cannot handle device file"
when socket?
- raise "cannot handle socket" unless File.respond_to?(:mknod)
- mknod dest, nil, lstat().mode, 0
+ begin
+ require 'socket'
+ rescue LoadError
+ raise "cannot handle socket"
+ else
+ raise "cannot handle socket" unless defined?(UNIXServer)
+ end
+ UNIXServer.new(dest).close
+ File.chmod lstat().mode, dest
when pipe?
raise "cannot handle FIFO" unless File.respond_to?(:mkfifo)
- mkfifo dest, 0666
+ File.mkfifo dest, lstat().mode
when door?
raise "cannot handle door: #{path()}"
else
@@ -1499,14 +1520,14 @@ module Bundler::FileUtils
private
- $fileutils_rb_have_lchmod = nil
+ @@fileutils_rb_have_lchmod = nil
def have_lchmod?
# This is not MT-safe, but it does not matter.
- if $fileutils_rb_have_lchmod == nil
- $fileutils_rb_have_lchmod = check_have_lchmod?
+ if @@fileutils_rb_have_lchmod == nil
+ @@fileutils_rb_have_lchmod = check_have_lchmod?
end
- $fileutils_rb_have_lchmod
+ @@fileutils_rb_have_lchmod
end
def check_have_lchmod?
@@ -1517,14 +1538,14 @@ module Bundler::FileUtils
return false
end
- $fileutils_rb_have_lchown = nil
+ @@fileutils_rb_have_lchown = nil
def have_lchown?
# This is not MT-safe, but it does not matter.
- if $fileutils_rb_have_lchown == nil
- $fileutils_rb_have_lchown = check_have_lchown?
+ if @@fileutils_rb_have_lchown == nil
+ @@fileutils_rb_have_lchown = check_have_lchown?
end
- $fileutils_rb_have_lchown
+ @@fileutils_rb_have_lchown
end
def check_have_lchown?
@@ -1546,10 +1567,13 @@ module Bundler::FileUtils
else
DIRECTORY_TERM = "(?=/|\\z)"
end
- SYSCASE = File::FNM_SYSCASE.nonzero? ? "-i" : ""
def descendant_directory?(descendant, ascendant)
- /\A(?#{SYSCASE}:#{Regexp.quote(ascendant)})#{DIRECTORY_TERM}/ =~ File.dirname(descendant)
+ if File::FNM_SYSCASE.nonzero?
+ File.expand_path(File.dirname(descendant)).casecmp(File.expand_path(ascendant)) == 0
+ else
+ File.expand_path(File.dirname(descendant)) == File.expand_path(ascendant)
+ end
end
end # class Entry_
@@ -1588,13 +1612,13 @@ module Bundler::FileUtils
end
private_module_function :fu_same?
- @fileutils_output = $stderr
- @fileutils_label = ''
-
def fu_output_message(msg) #:nodoc:
- @fileutils_output ||= $stderr
- @fileutils_label ||= ''
- @fileutils_output.puts @fileutils_label + msg
+ output = @fileutils_output if defined?(@fileutils_output)
+ output ||= $stderr
+ if defined?(@fileutils_label)
+ msg = @fileutils_label + msg
+ end
+ output.puts msg
end
private_module_function :fu_output_message
@@ -1605,8 +1629,11 @@ module Bundler::FileUtils
tbl
}
+ public
+
#
- # Returns an Array of method names which have any options.
+ # Returns an Array of names of high-level methods that accept any keyword
+ # arguments.
#
# p Bundler::FileUtils.commands #=> ["chmod", "cp", "cp_r", "install", ...]
#
@@ -1645,7 +1672,7 @@ module Bundler::FileUtils
end
#
- # Returns an Array of method names which have the option +opt+.
+ # Returns an Array of methods names which have the option +opt+.
#
# p Bundler::FileUtils.collect_method(:preserve) #=> ["cp", "cp_r", "copy", "install"]
#
@@ -1653,14 +1680,16 @@ module Bundler::FileUtils
OPT_TABLE.keys.select {|m| OPT_TABLE[m].include?(opt) }
end
- LOW_METHODS = singleton_methods(false) - collect_method(:noop).map(&:intern)
- module LowMethods
+ private
+
+ LOW_METHODS = singleton_methods(false) - collect_method(:noop).map(&:intern) # :nodoc:
+ module LowMethods # :nodoc: internal use only
private
def _do_nothing(*)end
::Bundler::FileUtils::LOW_METHODS.map {|name| alias_method name, :_do_nothing}
end
- METHODS = singleton_methods() - [:private_module_function,
+ METHODS = singleton_methods() - [:private_module_function, # :nodoc:
:commands, :options, :have_option?, :options_of, :collect_method]
#
@@ -1670,8 +1699,6 @@ module Bundler::FileUtils
#
module Verbose
include Bundler::FileUtils
- @fileutils_output = $stderr
- @fileutils_label = ''
names = ::Bundler::FileUtils.collect_method(:verbose)
names.each do |name|
module_eval(<<-EOS, __FILE__, __LINE__ + 1)
@@ -1695,8 +1722,6 @@ module Bundler::FileUtils
module NoWrite
include Bundler::FileUtils
include LowMethods
- @fileutils_output = $stderr
- @fileutils_label = ''
names = ::Bundler::FileUtils.collect_method(:noop)
names.each do |name|
module_eval(<<-EOS, __FILE__, __LINE__ + 1)
@@ -1721,8 +1746,6 @@ module Bundler::FileUtils
module DryRun
include Bundler::FileUtils
include LowMethods
- @fileutils_output = $stderr
- @fileutils_label = ''
names = ::Bundler::FileUtils.collect_method(:noop)
names.each do |name|
module_eval(<<-EOS, __FILE__, __LINE__ + 1)
diff --git a/lib/bundler/vendor/fileutils/lib/fileutils/version.rb b/lib/bundler/vendor/fileutils/lib/fileutils/version.rb
index 6d8504ccd5..b8f616e4fb 100644
--- a/lib/bundler/vendor/fileutils/lib/fileutils/version.rb
+++ b/lib/bundler/vendor/fileutils/lib/fileutils/version.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
module Bundler::FileUtils
- VERSION = "1.2.0"
+ VERSION = "1.3.0"
end
diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb
index a2b824c471..4cf11c5fb5 100644
--- a/lib/bundler/version.rb
+++ b/lib/bundler/version.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: false
module Bundler
- VERSION = "2.1.0.pre.2".freeze
+ VERSION = "2.1.0.pre.3".freeze
def self.bundler_major_version
@bundler_major_version ||= VERSION.split(".").first.to_i
diff --git a/man/bundle-add.1 b/man/bundle-add.1
index 11361233a7..ba81726c5f 100644
--- a/man/bundle-add.1
+++ b/man/bundle-add.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-ADD" "1" "September 2019" "" ""
+.TH "BUNDLE\-ADD" "1" "November 2019" "" ""
.
.SH "NAME"
\fBbundle\-add\fR \- Add gem to the Gemfile and run bundle install
diff --git a/man/bundle-add.1.txt b/man/bundle-add.1.txt
index 8379dbcf42..16a1405c9b 100644
--- a/man/bundle-add.1.txt
+++ b/man/bundle-add.1.txt
@@ -55,4 +55,4 @@ OPTIONS
- September 2019 BUNDLE-ADD(1)
+ November 2019 BUNDLE-ADD(1)
diff --git a/man/bundle-binstubs.1 b/man/bundle-binstubs.1
index bcfe60019b..559350c7d0 100644
--- a/man/bundle-binstubs.1
+++ b/man/bundle-binstubs.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-BINSTUBS" "1" "September 2019" "" ""
+.TH "BUNDLE\-BINSTUBS" "1" "November 2019" "" ""
.
.SH "NAME"
\fBbundle\-binstubs\fR \- Install the binstubs of the listed gems
diff --git a/man/bundle-binstubs.1.txt b/man/bundle-binstubs.1.txt
index 7a45eccfc2..1e35f6111b 100644
--- a/man/bundle-binstubs.1.txt
+++ b/man/bundle-binstubs.1.txt
@@ -45,4 +45,4 @@ BUNDLE INSTALL --BINSTUBS
- September 2019 BUNDLE-BINSTUBS(1)
+ November 2019 BUNDLE-BINSTUBS(1)
diff --git a/man/bundle-cache.1 b/man/bundle-cache.1
new file mode 100644
index 0000000000..1adb0b152c
--- /dev/null
+++ b/man/bundle-cache.1
@@ -0,0 +1,55 @@
+.\" generated with Ronn/v0.7.3
+.\" http://github.com/rtomayko/ronn/tree/0.7.3
+.
+.TH "BUNDLE\-CACHE" "1" "November 2019" "" ""
+.
+.SH "NAME"
+\fBbundle\-cache\fR \- Package your needed \fB\.gem\fR files into your application
+.
+.SH "SYNOPSIS"
+\fBbundle cache\fR
+.
+.SH "DESCRIPTION"
+Copy all of the \fB\.gem\fR files needed to run the application into the \fBvendor/cache\fR directory\. In the future, when running [bundle install(1)][bundle\-install], use the gems in the cache in preference to the ones on \fBrubygems\.org\fR\.
+.
+.SH "GIT AND PATH GEMS"
+The \fBbundle cache\fR command can also package \fB:git\fR and \fB:path\fR dependencies besides \.gem files\. This needs to be explicitly enabled via the \fB\-\-all\fR option\. Once used, the \fB\-\-all\fR option will be remembered\.
+.
+.SH "SUPPORT FOR MULTIPLE PLATFORMS"
+When using gems that have different packages for different platforms, Bundler supports caching of gems for other platforms where the Gemfile has been resolved (i\.e\. present in the lockfile) in \fBvendor/cache\fR\. This needs to be enabled via the \fB\-\-all\-platforms\fR option\. This setting will be remembered in your local bundler configuration\.
+.
+.SH "REMOTE FETCHING"
+By default, if you run \fBbundle install(1)\fR](bundle\-install\.1\.html) after running bundle cache(1) \fIbundle\-cache\.1\.html\fR, bundler will still connect to \fBrubygems\.org\fR to check whether a platform\-specific gem exists for any of the gems in \fBvendor/cache\fR\.
+.
+.P
+For instance, consider this Gemfile(5):
+.
+.IP "" 4
+.
+.nf
+
+source "https://rubygems\.org"
+
+gem "nokogiri"
+.
+.fi
+.
+.IP "" 0
+.
+.P
+If you run \fBbundle cache\fR under C Ruby, bundler will retrieve the version of \fBnokogiri\fR for the \fB"ruby"\fR platform\. If you deploy to JRuby and run \fBbundle install\fR, bundler is forced to check to see whether a \fB"java"\fR platformed \fBnokogiri\fR exists\.
+.
+.P
+Even though the \fBnokogiri\fR gem for the Ruby platform is \fItechnically\fR acceptable on JRuby, it has a C extension that does not run on JRuby\. As a result, bundler will, by default, still connect to \fBrubygems\.org\fR to check whether it has a version of one of your gems more specific to your platform\.
+.
+.P
+This problem is also not limited to the \fB"java"\fR platform\. A similar (common) problem can happen when developing on Windows and deploying to Linux, or even when developing on OSX and deploying to Linux\.
+.
+.P
+If you know for sure that the gems packaged in \fBvendor/cache\fR are appropriate for the platform you are on, you can run \fBbundle install \-\-local\fR to skip checking for more appropriate gems, and use the ones in \fBvendor/cache\fR\.
+.
+.P
+One way to be sure that you have the right platformed versions of all your gems is to run \fBbundle cache\fR on an identical machine and check in the gems\. For instance, you can run \fBbundle cache\fR on an identical staging box during your staging process, and check in the \fBvendor/cache\fR before deploying to production\.
+.
+.P
+By default, bundle cache(1) \fIbundle\-cache\.1\.html\fR fetches and also installs the gems to the default location\. To package the dependencies to \fBvendor/cache\fR without installing them to the local install location, you can run \fBbundle cache \-\-no\-install\fR\.
diff --git a/man/bundle-cache.1.txt b/man/bundle-cache.1.txt
new file mode 100644
index 0000000000..b5cec05f8a
--- /dev/null
+++ b/man/bundle-cache.1.txt
@@ -0,0 +1,78 @@
+BUNDLE-CACHE(1) BUNDLE-CACHE(1)
+
+
+
+NAME
+ bundle-cache - Package your needed .gem files into your application
+
+SYNOPSIS
+ bundle cache
+
+DESCRIPTION
+ Copy all of the .gem files needed to run the application into the ven-
+ dor/cache directory. In the future, when running [bundle
+ install(1)][bundle-install], use the gems in the cache in preference to
+ the ones on rubygems.org.
+
+GIT AND PATH GEMS
+ The bundle cache command can also package :git and :path dependencies
+ besides .gem files. This needs to be explicitly enabled via the --all
+ option. Once used, the --all option will be remembered.
+
+SUPPORT FOR MULTIPLE PLATFORMS
+ When using gems that have different packages for different platforms,
+ Bundler supports caching of gems for other platforms where the Gemfile
+ has been resolved (i.e. present in the lockfile) in vendor/cache. This
+ needs to be enabled via the --all-platforms option. This setting will
+ be remembered in your local bundler configuration.
+
+REMOTE FETCHING
+ By default, if you run bundle install(1)](bundle-install.1.html) after
+ running bundle cache(1) bundle-cache.1.html, bundler will still connect
+ to rubygems.org to check whether a platform-specific gem exists for any
+ of the gems in vendor/cache.
+
+ For instance, consider this Gemfile(5):
+
+
+
+ source "https://rubygems.org"
+
+ gem "nokogiri"
+
+
+
+ If you run bundle cache under C Ruby, bundler will retrieve the version
+ of nokogiri for the "ruby" platform. If you deploy to JRuby and run
+ bundle install, bundler is forced to check to see whether a "java"
+ platformed nokogiri exists.
+
+ Even though the nokogiri gem for the Ruby platform is technically
+ acceptable on JRuby, it has a C extension that does not run on JRuby.
+ As a result, bundler will, by default, still connect to rubygems.org to
+ check whether it has a version of one of your gems more specific to
+ your platform.
+
+ This problem is also not limited to the "java" platform. A similar
+ (common) problem can happen when developing on Windows and deploying to
+ Linux, or even when developing on OSX and deploying to Linux.
+
+ If you know for sure that the gems packaged in vendor/cache are appro-
+ priate for the platform you are on, you can run bundle install --local
+ to skip checking for more appropriate gems, and use the ones in ven-
+ dor/cache.
+
+ One way to be sure that you have the right platformed versions of all
+ your gems is to run bundle cache on an identical machine and check in
+ the gems. For instance, you can run bundle cache on an identical stag-
+ ing box during your staging process, and check in the vendor/cache
+ before deploying to production.
+
+ By default, bundle cache(1) bundle-cache.1.html fetches and also
+ installs the gems to the default location. To package the dependencies
+ to vendor/cache without installing them to the local install location,
+ you can run bundle cache --no-install.
+
+
+
+ November 2019 BUNDLE-CACHE(1)
diff --git a/man/bundle-cache.ronn b/man/bundle-cache.ronn
new file mode 100644
index 0000000000..383adb2ba3
--- /dev/null
+++ b/man/bundle-cache.ronn
@@ -0,0 +1,72 @@
+bundle-cache(1) -- Package your needed `.gem` files into your application
+===========================================================================
+
+## SYNOPSIS
+
+`bundle cache`
+
+## DESCRIPTION
+
+Copy all of the `.gem` files needed to run the application into the
+`vendor/cache` directory. In the future, when running [bundle install(1)][bundle-install],
+use the gems in the cache in preference to the ones on `rubygems.org`.
+
+## GIT AND PATH GEMS
+
+The `bundle cache` command can also package `:git` and `:path` dependencies
+besides .gem files. This needs to be explicitly enabled via the `--all` option.
+Once used, the `--all` option will be remembered.
+
+## SUPPORT FOR MULTIPLE PLATFORMS
+
+When using gems that have different packages for different platforms, Bundler
+supports caching of gems for other platforms where the Gemfile has been resolved
+(i.e. present in the lockfile) in `vendor/cache`. This needs to be enabled via
+the `--all-platforms` option. This setting will be remembered in your local
+bundler configuration.
+
+## REMOTE FETCHING
+
+By default, if you run `bundle install(1)`](bundle-install.1.html) after running
+[bundle cache(1)](bundle-cache.1.html), bundler will still connect to `rubygems.org`
+to check whether a platform-specific gem exists for any of the gems
+in `vendor/cache`.
+
+For instance, consider this Gemfile(5):
+
+ source "https://rubygems.org"
+
+ gem "nokogiri"
+
+If you run `bundle cache` under C Ruby, bundler will retrieve
+the version of `nokogiri` for the `"ruby"` platform. If you deploy
+to JRuby and run `bundle install`, bundler is forced to check to
+see whether a `"java"` platformed `nokogiri` exists.
+
+Even though the `nokogiri` gem for the Ruby platform is
+_technically_ acceptable on JRuby, it has a C extension
+that does not run on JRuby. As a result, bundler will, by default,
+still connect to `rubygems.org` to check whether it has a version
+of one of your gems more specific to your platform.
+
+This problem is also not limited to the `"java"` platform.
+A similar (common) problem can happen when developing on Windows
+and deploying to Linux, or even when developing on OSX and
+deploying to Linux.
+
+If you know for sure that the gems packaged in `vendor/cache`
+are appropriate for the platform you are on, you can run
+`bundle install --local` to skip checking for more appropriate
+gems, and use the ones in `vendor/cache`.
+
+One way to be sure that you have the right platformed versions
+of all your gems is to run `bundle cache` on an identical
+machine and check in the gems. For instance, you can run
+`bundle cache` on an identical staging box during your
+staging process, and check in the `vendor/cache` before
+deploying to production.
+
+By default, [bundle cache(1)](bundle-cache.1.html) fetches and also
+installs the gems to the default location. To package the
+dependencies to `vendor/cache` without installing them to the
+local install location, you can run `bundle cache --no-install`.
diff --git a/man/bundle-check.1 b/man/bundle-check.1
index 90df9cad6a..56516255c7 100644
--- a/man/bundle-check.1
+++ b/man/bundle-check.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-CHECK" "1" "September 2019" "" ""
+.TH "BUNDLE\-CHECK" "1" "November 2019" "" ""
.
.SH "NAME"
\fBbundle\-check\fR \- Verifies if dependencies are satisfied by installed gems
diff --git a/man/bundle-check.1.txt b/man/bundle-check.1.txt
index 7e24698216..a1edc4d4a4 100644
--- a/man/bundle-check.1.txt
+++ b/man/bundle-check.1.txt
@@ -9,8 +9,8 @@ SYNOPSIS
bundle check [--dry-run] [--gemfile=FILE] [--path=PATH]
DESCRIPTION
- check searches the local machine for each of the gems requested in the
- Gemfile. If all gems are found, Bundler prints a success message and
+ check searches the local machine for each of the gems requested in the
+ Gemfile. If all gems are found, Bundler prints a success message and
exits with a status of 0.
If not, the first missing gem is listed and Bundler exits status 1.
@@ -20,14 +20,14 @@ OPTIONS
Locks the [Gemfile(5)][Gemfile(5)] before running the command.
--gemfile
- Use the specified gemfile instead of the [Gemfile(5)][Gem-
+ Use the specified gemfile instead of the [Gemfile(5)][Gem-
file(5)].
- --path Specify a different path than the system default ($BUNDLE_PATH
- or $GEM_HOME). Bundler will remember this value for future
+ --path Specify a different path than the system default ($BUNDLE_PATH
+ or $GEM_HOME). Bundler will remember this value for future
installs on this machine.
- September 2019 BUNDLE-CHECK(1)
+ November 2019 BUNDLE-CHECK(1)
diff --git a/man/bundle-clean.1 b/man/bundle-clean.1
index 76dcee2233..9d62619bb2 100644
--- a/man/bundle-clean.1
+++ b/man/bundle-clean.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-CLEAN" "1" "September 2019" "" ""
+.TH "BUNDLE\-CLEAN" "1" "November 2019" "" ""
.
.SH "NAME"
\fBbundle\-clean\fR \- Cleans up unused gems in your bundler directory
diff --git a/man/bundle-clean.1.txt b/man/bundle-clean.1.txt
index f3d9c77703..6e24aaf2c4 100644
--- a/man/bundle-clean.1.txt
+++ b/man/bundle-clean.1.txt
@@ -23,4 +23,4 @@ OPTIONS
- September 2019 BUNDLE-CLEAN(1)
+ November 2019 BUNDLE-CLEAN(1)
diff --git a/man/bundle-config.1 b/man/bundle-config.1
index ce670f7117..e982ec0501 100644
--- a/man/bundle-config.1
+++ b/man/bundle-config.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-CONFIG" "1" "September 2019" "" ""
+.TH "BUNDLE\-CONFIG" "1" "November 2019" "" ""
.
.SH "NAME"
\fBbundle\-config\fR \- Set bundler configuration options
diff --git a/man/bundle-config.1.txt b/man/bundle-config.1.txt
index 7c601a86bf..cff5990296 100644
--- a/man/bundle-config.1.txt
+++ b/man/bundle-config.1.txt
@@ -65,29 +65,29 @@ REMEMBERING OPTIONS
foo or --without production, are remembered between commands and saved
to your local application's configuration (normally, ./.bundle/config).
- However, this will be changed in bundler 3, so it's better not to rely
- on this behavior. If these options must be remembered, it's better to
+ However, this will be changed in bundler 3, so it's better not to rely
+ on this behavior. If these options must be remembered, it's better to
set them using bundle config (e.g., bundle config set path foo).
The options that can be configured are:
- bin Creates a directory (defaults to ~/bin) and place any executa-
+ bin Creates a directory (defaults to ~/bin) and place any executa-
bles from the gem there. These executables run in Bundler's con-
- text. If used, you might add this directory to your environ-
- ment's PATH variable. For instance, if the rails gem comes with
+ text. If used, you might add this directory to your environ-
+ ment's PATH variable. For instance, if the rails gem comes with
a rails executable, this flag will create a bin/rails executable
- that ensures that all referred dependencies will be resolved
+ that ensures that all referred dependencies will be resolved
using the bundled gems.
deployment
- In deployment mode, Bundler will 'roll-out' the bundle for pro-
- duction use. Please check carefully if you want to have this
+ In deployment mode, Bundler will 'roll-out' the bundle for pro-
+ duction use. Please check carefully if you want to have this
option enabled in development or test environments.
- path The location to install the specified gems to. This defaults to
- Rubygems' setting. Bundler shares this location with Rubygems,
- gem install ... will have gem installed there, too. Therefore,
- gems installed without a --path ... setting will show up by
+ path The location to install the specified gems to. This defaults to
+ Rubygems' setting. Bundler shares this location with Rubygems,
+ gem install ... will have gem installed there, too. Therefore,
+ gems installed without a --path ... setting will show up by
calling gem list. Accordingly, gems installed to other locations
will not get listed.
@@ -95,15 +95,15 @@ REMEMBERING OPTIONS
A space-separated list of groups referencing gems to skip during
installation.
- with A space-separated list of groups referencing gems to include
+ with A space-separated list of groups referencing gems to include
during installation.
BUILD OPTIONS
- You can use bundle config to give Bundler the flags to pass to the gem
+ You can use bundle config to give Bundler the flags to pass to the gem
installer every time bundler tries to install a particular gem.
- A very common example, the mysql gem, requires Snow Leopard users to
- pass configuration flags to gem install to specify where to find the
+ A very common example, the mysql gem, requires Snow Leopard users to
+ pass configuration flags to gem install to specify where to find the
mysql_config executable.
@@ -112,7 +112,7 @@ BUILD OPTIONS
- Since the specific location of that executable can change from machine
+ Since the specific location of that executable can change from machine
to machine, you can specify these flags on a per-machine basis.
@@ -121,43 +121,43 @@ BUILD OPTIONS
- After running this command, every time bundler needs to install the
+ After running this command, every time bundler needs to install the
mysql gem, it will pass along the flags you specified.
CONFIGURATION KEYS
- Configuration keys in bundler have two forms: the canonical form and
+ Configuration keys in bundler have two forms: the canonical form and
the environment variable form.
- For instance, passing the --without flag to bundle install(1) bun-
- dle-install.1.html prevents Bundler from installing certain groups
- specified in the Gemfile(5). Bundler persists this value in app/.bun-
- dle/config so that calls to Bundler.setup do not try to find gems from
- the Gemfile that you didn't install. Additionally, subsequent calls to
- bundle install(1) bundle-install.1.html remember this setting and skip
+ For instance, passing the --without flag to bundle install(1) bun-
+ dle-install.1.html prevents Bundler from installing certain groups
+ specified in the Gemfile(5). Bundler persists this value in app/.bun-
+ dle/config so that calls to Bundler.setup do not try to find gems from
+ the Gemfile that you didn't install. Additionally, subsequent calls to
+ bundle install(1) bundle-install.1.html remember this setting and skip
those groups.
- The canonical form of this configuration is "without". To convert the
- canonical form to the environment variable form, capitalize it, and
- prepend BUNDLE_. The environment variable form of "without" is BUN-
+ The canonical form of this configuration is "without". To convert the
+ canonical form to the environment variable form, capitalize it, and
+ prepend BUNDLE_. The environment variable form of "without" is BUN-
DLE_WITHOUT.
- Any periods in the configuration keys must be replaced with two under-
+ Any periods in the configuration keys must be replaced with two under-
scores when setting it via environment variables. The configuration key
local.rack becomes the environment variable BUNDLE_LOCAL__RACK.
LIST OF AVAILABLE KEYS
- The following is a list of all configuration keys and their purpose.
- You can learn more about their operation in bundle install(1) bun-
+ The following is a list of all configuration keys and their purpose.
+ You can learn more about their operation in bundle install(1) bun-
dle-install.1.html.
o allow_bundler_dependency_conflicts (BUNDLE_ALLOW_BUNDLER_DEPEN-
DENCY_CONFLICTS): Allow resolving to specifications that have
- dependencies on bundler that are incompatible with the running
+ dependencies on bundler that are incompatible with the running
Bundler version.
o allow_deployment_source_credential_changes (BUNDLE_ALLOW_DEPLOY-
- MENT_SOURCE_CREDENTIAL_CHANGES): When in deployment mode, allow
- changing the credentials to a gem's source. Ex:
+ MENT_SOURCE_CREDENTIAL_CHANGES): When in deployment mode, allow
+ changing the credentials to a gem's source. Ex:
https://some.host.com/gems/path/ -> https://user_name:pass-
word@some.host.com/gems/path
@@ -165,85 +165,85 @@ LIST OF AVAILABLE KEYS
to use cached data when installing without network access.
o auto_clean_without_path (BUNDLE_AUTO_CLEAN_WITHOUT_PATH): Automati-
- cally run bundle clean after installing when an explicit path has
+ cally run bundle clean after installing when an explicit path has
not been set and Bundler is not installing into the system gems.
- o auto_install (BUNDLE_AUTO_INSTALL): Automatically run bundle
+ o auto_install (BUNDLE_AUTO_INSTALL): Automatically run bundle
install when gems are missing.
- o bin (BUNDLE_BIN): Install executables from gems in the bundle to
+ o bin (BUNDLE_BIN): Install executables from gems in the bundle to
the specified directory. Defaults to false.
- o cache_all (BUNDLE_CACHE_ALL): Cache all gems, including path and
+ o cache_all (BUNDLE_CACHE_ALL): Cache all gems, including path and
git gems.
- o cache_all_platforms (BUNDLE_CACHE_ALL_PLATFORMS): Cache gems for
+ o cache_all_platforms (BUNDLE_CACHE_ALL_PLATFORMS): Cache gems for
all platforms.
- o cache_path (BUNDLE_CACHE_PATH): The directory that bundler will
- place cached gems in when running bundle package, and that bundler
+ o cache_path (BUNDLE_CACHE_PATH): The directory that bundler will
+ place cached gems in when running bundle package, and that bundler
will look in when installing gems. Defaults to vendor/cache.
o clean (BUNDLE_CLEAN): Whether Bundler should run bundle clean auto-
matically after bundle install.
- o console (BUNDLE_CONSOLE): The console that bundle console starts.
+ o console (BUNDLE_CONSOLE): The console that bundle console starts.
Defaults to irb.
o default_install_uses_path (BUNDLE_DEFAULT_INSTALL_USES_PATH):
- Whether a bundle install without an explicit --path argument
+ Whether a bundle install without an explicit --path argument
defaults to installing gems in .bundle.
- o deployment (BUNDLE_DEPLOYMENT): Disallow changes to the Gemfile.
- When the Gemfile is changed and the lockfile has not been updated,
+ o deployment (BUNDLE_DEPLOYMENT): Disallow changes to the Gemfile.
+ When the Gemfile is changed and the lockfile has not been updated,
running Bundler commands will be blocked.
o disable_checksum_validation (BUNDLE_DISABLE_CHECKSUM_VALIDATION):
- Allow installing gems even if they do not match the checksum pro-
+ Allow installing gems even if they do not match the checksum pro-
vided by RubyGems.
o disable_exec_load (BUNDLE_DISABLE_EXEC_LOAD): Stop Bundler from
using load to launch an executable in-process in bundle exec.
o disable_local_branch_check (BUNDLE_DISABLE_LOCAL_BRANCH_CHECK):
- Allow Bundler to use a local git override without a branch speci-
+ Allow Bundler to use a local git override without a branch speci-
fied in the Gemfile.
- o disable_multisource (BUNDLE_DISABLE_MULTISOURCE): When set, Gem-
- files containing multiple sources will produce errors instead of
+ o disable_multisource (BUNDLE_DISABLE_MULTISOURCE): When set, Gem-
+ files containing multiple sources will produce errors instead of
warnings. Use bundle config unset disable_multisource to unset.
- o disable_platform_warnings (BUNDLE_DISABLE_PLATFORM_WARNINGS): Dis-
- able warnings during bundle install when a dependency is unused on
+ o disable_platform_warnings (BUNDLE_DISABLE_PLATFORM_WARNINGS): Dis-
+ able warnings during bundle install when a dependency is unused on
the current platform.
o disable_shared_gems (BUNDLE_DISABLE_SHARED_GEMS): Stop Bundler from
accessing gems installed to RubyGems' normal location.
- o disable_version_check (BUNDLE_DISABLE_VERSION_CHECK): Stop Bundler
- from checking if a newer Bundler version is available on
+ o disable_version_check (BUNDLE_DISABLE_VERSION_CHECK): Stop Bundler
+ from checking if a newer Bundler version is available on
rubygems.org.
- o force_ruby_platform (BUNDLE_FORCE_RUBY_PLATFORM): Ignore the cur-
- rent machine's platform and install only ruby platform gems. As a
+ o force_ruby_platform (BUNDLE_FORCE_RUBY_PLATFORM): Ignore the cur-
+ rent machine's platform and install only ruby platform gems. As a
result, gems with native extensions will be compiled from source.
- o frozen (BUNDLE_FROZEN): Disallow changes to the Gemfile. When the
- Gemfile is changed and the lockfile has not been updated, running
- Bundler commands will be blocked. Defaults to true when --deploy-
+ o frozen (BUNDLE_FROZEN): Disallow changes to the Gemfile. When the
+ Gemfile is changed and the lockfile has not been updated, running
+ Bundler commands will be blocked. Defaults to true when --deploy-
ment is used.
- o gem.push_key (BUNDLE_GEM__PUSH_KEY): Sets the --key parameter for
- gem push when using the rake release command with a private gem-
+ o gem.push_key (BUNDLE_GEM__PUSH_KEY): Sets the --key parameter for
+ gem push when using the rake release command with a private gem-
stash server.
- o gemfile (BUNDLE_GEMFILE): The name of the file that bundler should
- use as the Gemfile. This location of this file also sets the root
+ o gemfile (BUNDLE_GEMFILE): The name of the file that bundler should
+ use as the Gemfile. This location of this file also sets the root
of the project, which is used to resolve relative paths in the Gem-
- file, among other things. By default, bundler will search up from
+ file, among other things. By default, bundler will search up from
the current working directory until it finds a Gemfile.
- o global_gem_cache (BUNDLE_GLOBAL_GEM_CACHE): Whether Bundler should
+ o global_gem_cache (BUNDLE_GLOBAL_GEM_CACHE): Whether Bundler should
cache all gems globally, rather than locally to the installing Ruby
installation.
@@ -251,80 +251,80 @@ LIST OF AVAILABLE KEYS
messages will be printed. To silence a single gem, use dot notation
like ignore_messages.httparty true.
- o init_gems_rb (BUNDLE_INIT_GEMS_RB) Generate a gems.rb instead of a
+ o init_gems_rb (BUNDLE_INIT_GEMS_RB) Generate a gems.rb instead of a
Gemfile when running bundle init.
- o jobs (BUNDLE_JOBS): The number of gems Bundler can install in par-
+ o jobs (BUNDLE_JOBS): The number of gems Bundler can install in par-
allel. Defaults to 1.
- o no_install (BUNDLE_NO_INSTALL): Whether bundle package should skip
+ o no_install (BUNDLE_NO_INSTALL): Whether bundle package should skip
installing gems.
- o no_prune (BUNDLE_NO_PRUNE): Whether Bundler should leave outdated
+ o no_prune (BUNDLE_NO_PRUNE): Whether Bundler should leave outdated
gems unpruned when caching.
o only_update_to_newer_versions (BUNDLE_ONLY_UPDATE_TO_NEWER_VER-
SIONS): During bundle update, only resolve to newer versions of the
gems in the lockfile.
- o path (BUNDLE_PATH): The location on disk where all gems in your
+ o path (BUNDLE_PATH): The location on disk where all gems in your
bundle will be located regardless of $GEM_HOME or $GEM_PATH values.
- Bundle gems not found in this location will be installed by bundle
- install. Defaults to Gem.dir. When --deployment is used, defaults
+ Bundle gems not found in this location will be installed by bundle
+ install. Defaults to Gem.dir. When --deployment is used, defaults
to vendor/bundle.
- o path.system (BUNDLE_PATH__SYSTEM): Whether Bundler will install
+ o path.system (BUNDLE_PATH__SYSTEM): Whether Bundler will install
gems into the default system path (Gem.dir).
- o path_relative_to_cwd (BUNDLE_PATH_RELATIVE_TO_CWD) Makes --path
+ o path_relative_to_cwd (BUNDLE_PATH_RELATIVE_TO_CWD) Makes --path
relative to the CWD instead of the Gemfile.
o plugins (BUNDLE_PLUGINS): Enable Bundler's experimental plugin sys-
tem.
- o prefer_patch (BUNDLE_PREFER_PATCH): Prefer updating only to next
- patch version during updates. Makes bundle update calls equivalent
+ o prefer_patch (BUNDLE_PREFER_PATCH): Prefer updating only to next
+ patch version during updates. Makes bundle update calls equivalent
to bundler update --patch.
- o print_only_version_number (BUNDLE_PRINT_ONLY_VERSION_NUMBER) Print
+ o print_only_version_number (BUNDLE_PRINT_ONLY_VERSION_NUMBER) Print
only version number from bundler --version.
- o redirect (BUNDLE_REDIRECT): The number of redirects allowed for
+ o redirect (BUNDLE_REDIRECT): The number of redirects allowed for
network requests. Defaults to 5.
- o retry (BUNDLE_RETRY): The number of times to retry failed network
+ o retry (BUNDLE_RETRY): The number of times to retry failed network
requests. Defaults to 3.
o setup_makes_kernel_gem_public (BUNDLE_SETUP_MAKES_KERNEL_GEM_PUB-
- LIC): Have Bundler.setup make the Kernel#gem method public, even
+ LIC): Have Bundler.setup make the Kernel#gem method public, even
though RubyGems declares it as private.
- o shebang (BUNDLE_SHEBANG): The program name that should be invoked
- for generated binstubs. Defaults to the ruby install name used to
+ o shebang (BUNDLE_SHEBANG): The program name that should be invoked
+ for generated binstubs. Defaults to the ruby install name used to
generate the binstub.
o silence_deprecations (BUNDLE_SILENCE_DEPRECATIONS): Whether Bundler
- should silence deprecation warnings for behavior that will be
+ should silence deprecation warnings for behavior that will be
changed in the next major version.
- o silence_root_warning (BUNDLE_SILENCE_ROOT_WARNING): Silence the
+ o silence_root_warning (BUNDLE_SILENCE_ROOT_WARNING): Silence the
warning Bundler prints when installing gems as root.
o skip_default_git_sources (BUNDLE_SKIP_DEFAULT_GIT_SOURCES): Whether
Bundler should skip adding default git source shortcuts to the Gem-
file DSL.
- o specific_platform (BUNDLE_SPECIFIC_PLATFORM): Allow bundler to
+ o specific_platform (BUNDLE_SPECIFIC_PLATFORM): Allow bundler to
resolve for the specific running platform and store it in the lock-
file, instead of only using a generic platform. A specific platform
- is the exact platform triple reported by Gem::Platform.local, such
- as x86_64-darwin-16 or universal-java-1.8. On the other hand,
- generic platforms are those such as ruby, mswin, or java. In this
- example, x86_64-darwin-16 would map to ruby and universal-java-1.8
+ is the exact platform triple reported by Gem::Platform.local, such
+ as x86_64-darwin-16 or universal-java-1.8. On the other hand,
+ generic platforms are those such as ruby, mswin, or java. In this
+ example, x86_64-darwin-16 would map to ruby and universal-java-1.8
to java.
- o ssl_ca_cert (BUNDLE_SSL_CA_CERT): Path to a designated CA certifi-
- cate file or folder containing multiple certificates for trusted
+ o ssl_ca_cert (BUNDLE_SSL_CA_CERT): Path to a designated CA certifi-
+ cate file or folder containing multiple certificates for trusted
CAs in PEM format.
o ssl_client_cert (BUNDLE_SSL_CLIENT_CERT): Path to a designated file
@@ -334,44 +334,44 @@ LIST OF AVAILABLE KEYS
Bundler uses when making HTTPS requests. Defaults to verify peer.
o suppress_install_using_messages (BUNDLE_SUPPRESS_INSTALL_USING_MES-
- SAGES): Avoid printing Using ... messages during installation when
+ SAGES): Avoid printing Using ... messages during installation when
the version of a gem has not changed.
- o system_bindir (BUNDLE_SYSTEM_BINDIR): The location where RubyGems
+ o system_bindir (BUNDLE_SYSTEM_BINDIR): The location where RubyGems
installs binstubs. Defaults to Gem.bindir.
o timeout (BUNDLE_TIMEOUT): The seconds allowed before timing out for
network requests. Defaults to 10.
o unlock_source_unlocks_spec (BUNDLE_UNLOCK_SOURCE_UNLOCKS_SPEC):
- Whether running bundle update --source NAME unlocks a gem with the
+ Whether running bundle update --source NAME unlocks a gem with the
given name. Defaults to true.
- o update_requires_all_flag (BUNDLE_UPDATE_REQUIRES_ALL_FLAG) Require
- passing --all to bundle update when everything should be updated,
+ o update_requires_all_flag (BUNDLE_UPDATE_REQUIRES_ALL_FLAG) Require
+ passing --all to bundle update when everything should be updated,
and disallow passing no options to bundle update.
- o user_agent (BUNDLE_USER_AGENT): The custom user agent fragment
+ o user_agent (BUNDLE_USER_AGENT): The custom user agent fragment
Bundler includes in API requests.
o with (BUNDLE_WITH): A :-separated list of groups whose gems bundler
should install.
- o without (BUNDLE_WITHOUT): A :-separated list of groups whose gems
+ o without (BUNDLE_WITHOUT): A :-separated list of groups whose gems
bundler should not install.
- In general, you should set these settings per-application by using the
- applicable flag to the bundle install(1) bundle-install.1.html or bun-
+ In general, you should set these settings per-application by using the
+ applicable flag to the bundle install(1) bundle-install.1.html or bun-
dle package(1) bundle-package.1.html command.
- You can set them globally either via environment variables or bundle
- config, whichever is preferable for your setup. If you use both, envi-
+ You can set them globally either via environment variables or bundle
+ config, whichever is preferable for your setup. If you use both, envi-
ronment variables will take preference over global settings.
LOCAL GIT REPOS
- Bundler also allows you to work against a git repository locally
+ Bundler also allows you to work against a git repository locally
instead of using the remote version. This can be achieved by setting up
a local override:
@@ -390,30 +390,30 @@ LOCAL GIT REPOS
- Now instead of checking out the remote git repository, the local over-
- ride will be used. Similar to a path source, every time the local git
- repository change, changes will be automatically picked up by Bundler.
- This means a commit in the local git repo will update the revision in
+ Now instead of checking out the remote git repository, the local over-
+ ride will be used. Similar to a path source, every time the local git
+ repository change, changes will be automatically picked up by Bundler.
+ This means a commit in the local git repo will update the revision in
the Gemfile.lock to the local git repo revision. This requires the same
- attention as git submodules. Before pushing to the remote, you need to
+ attention as git submodules. Before pushing to the remote, you need to
ensure the local override was pushed, otherwise you may point to a com-
- mit that only exists in your local machine. You'll also need to CGI
+ mit that only exists in your local machine. You'll also need to CGI
escape your usernames and passwords as well.
- Bundler does many checks to ensure a developer won't work with invalid
- references. Particularly, we force a developer to specify a branch in
- the Gemfile in order to use this feature. If the branch specified in
- the Gemfile and the current branch in the local git repository do not
- match, Bundler will abort. This ensures that a developer is always
- working against the correct branches, and prevents accidental locking
+ Bundler does many checks to ensure a developer won't work with invalid
+ references. Particularly, we force a developer to specify a branch in
+ the Gemfile in order to use this feature. If the branch specified in
+ the Gemfile and the current branch in the local git repository do not
+ match, Bundler will abort. This ensures that a developer is always
+ working against the correct branches, and prevents accidental locking
to a different branch.
- Finally, Bundler also ensures that the current revision in the Gem-
- file.lock exists in the local git repository. By doing this, Bundler
+ Finally, Bundler also ensures that the current revision in the Gem-
+ file.lock exists in the local git repository. By doing this, Bundler
forces you to fetch the latest changes in the remotes.
MIRRORS OF GEM SOURCES
- Bundler supports overriding gem sources with mirrors. This allows you
+ Bundler supports overriding gem sources with mirrors. This allows you
to configure rubygems.org as the gem source in your Gemfile while still
using your mirror to fetch gems.
@@ -423,7 +423,7 @@ MIRRORS OF GEM SOURCES
- For example, to use a mirror of rubygems.org hosted at rubygems-mir-
+ For example, to use a mirror of rubygems.org hosted at rubygems-mir-
ror.org:
@@ -432,8 +432,8 @@ MIRRORS OF GEM SOURCES
- Each mirror also provides a fallback timeout setting. If the mirror
- does not respond within the fallback timeout, Bundler will try to use
+ Each mirror also provides a fallback timeout setting. If the mirror
+ does not respond within the fallback timeout, Bundler will try to use
the original server instead of the mirror.
@@ -450,11 +450,11 @@ MIRRORS OF GEM SOURCES
- The default fallback timeout is 0.1 seconds, but the setting can cur-
+ The default fallback timeout is 0.1 seconds, but the setting can cur-
rently only accept whole seconds (for example, 1, 15, or 30).
CREDENTIALS FOR GEM SOURCES
- Bundler allows you to configure credentials for any gem source, which
+ Bundler allows you to configure credentials for any gem source, which
allows you to avoid putting secrets into your Gemfile.
@@ -463,7 +463,7 @@ CREDENTIALS FOR GEM SOURCES
- For example, to save the credentials of user claudette for the gem
+ For example, to save the credentials of user claudette for the gem
source at gems.longerous.com, you would run:
@@ -497,7 +497,7 @@ CREDENTIALS FOR GEM SOURCES
- This is especially useful for private repositories on hosts such as
+ This is especially useful for private repositories on hosts such as
Github, where you can use personal OAuth tokens:
@@ -507,9 +507,9 @@ CREDENTIALS FOR GEM SOURCES
CONFIGURE BUNDLER DIRECTORIES
- Bundler's home, config, cache and plugin directories are able to be
- configured through environment variables. The default location for
- Bundler's home directory is ~/.bundle, which all directories inherit
+ Bundler's home, config, cache and plugin directories are able to be
+ configured through environment variables. The default location for
+ Bundler's home directory is ~/.bundle, which all directories inherit
from by default. The following outlines the available environment vari-
ables and their default values
@@ -525,4 +525,4 @@ CONFIGURE BUNDLER DIRECTORIES
- September 2019 BUNDLE-CONFIG(1)
+ November 2019 BUNDLE-CONFIG(1)
diff --git a/man/bundle-doctor.1 b/man/bundle-doctor.1
index b92b7107c7..ec7231d4a9 100644
--- a/man/bundle-doctor.1
+++ b/man/bundle-doctor.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-DOCTOR" "1" "September 2019" "" ""
+.TH "BUNDLE\-DOCTOR" "1" "November 2019" "" ""
.
.SH "NAME"
\fBbundle\-doctor\fR \- Checks the bundle for common problems
diff --git a/man/bundle-doctor.1.txt b/man/bundle-doctor.1.txt
index 2c7956ce54..58fd9ed4a0 100644
--- a/man/bundle-doctor.1.txt
+++ b/man/bundle-doctor.1.txt
@@ -41,4 +41,4 @@ OPTIONS
- September 2019 BUNDLE-DOCTOR(1)
+ November 2019 BUNDLE-DOCTOR(1)
diff --git a/man/bundle-exec.1 b/man/bundle-exec.1
index 8d6b2fb085..187251740a 100644
--- a/man/bundle-exec.1
+++ b/man/bundle-exec.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-EXEC" "1" "September 2019" "" ""
+.TH "BUNDLE\-EXEC" "1" "November 2019" "" ""
.
.SH "NAME"
\fBbundle\-exec\fR \- Execute a command in the context of the bundle
diff --git a/man/bundle-exec.1.txt b/man/bundle-exec.1.txt
index c15b321265..2b0a17c4fc 100644
--- a/man/bundle-exec.1.txt
+++ b/man/bundle-exec.1.txt
@@ -175,4 +175,4 @@ RUBYGEMS PLUGINS
- September 2019 BUNDLE-EXEC(1)
+ November 2019 BUNDLE-EXEC(1)
diff --git a/man/bundle-gem.1 b/man/bundle-gem.1
index ccbbfbb442..e814e3f1aa 100644
--- a/man/bundle-gem.1
+++ b/man/bundle-gem.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-GEM" "1" "September 2019" "" ""
+.TH "BUNDLE\-GEM" "1" "November 2019" "" ""
.
.SH "NAME"
\fBbundle\-gem\fR \- Generate a project skeleton for creating a rubygem
diff --git a/man/bundle-gem.1.txt b/man/bundle-gem.1.txt
index c6000ed50b..266cc43131 100644
--- a/man/bundle-gem.1.txt
+++ b/man/bundle-gem.1.txt
@@ -77,8 +77,8 @@ OPTIONS
-e, --edit[=EDITOR]
Open the resulting GEM_NAME.gemspec in EDITOR, or the default
- editor if not specified. The default is $BUNDLER_EDITOR,
- $VISUAL, or $EDITOR.
+ editor if not specified. The default is $BUNDLER_EDITOR, $VIS-
+ UAL, or $EDITOR.
SEE ALSO
o bundle config(1) bundle-config.1.html
@@ -88,4 +88,4 @@ SEE ALSO
- September 2019 BUNDLE-GEM(1)
+ November 2019 BUNDLE-GEM(1)
diff --git a/man/bundle-info.1 b/man/bundle-info.1
index a2598df0cb..75b0cfa358 100644
--- a/man/bundle-info.1
+++ b/man/bundle-info.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-INFO" "1" "September 2019" "" ""
+.TH "BUNDLE\-INFO" "1" "November 2019" "" ""
.
.SH "NAME"
\fBbundle\-info\fR \- Show information for the given gem in your bundle
diff --git a/man/bundle-info.1.txt b/man/bundle-info.1.txt
index 870c713cfb..4e908c6e4c 100644
--- a/man/bundle-info.1.txt
+++ b/man/bundle-info.1.txt
@@ -18,4 +18,4 @@ OPTIONS
- September 2019 BUNDLE-INFO(1)
+ November 2019 BUNDLE-INFO(1)
diff --git a/man/bundle-init.1 b/man/bundle-init.1
index d0860311e9..9e2a23004f 100644
--- a/man/bundle-init.1
+++ b/man/bundle-init.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-INIT" "1" "September 2019" "" ""
+.TH "BUNDLE\-INIT" "1" "November 2019" "" ""
.
.SH "NAME"
\fBbundle\-init\fR \- Generates a Gemfile into the current working directory
diff --git a/man/bundle-init.1.txt b/man/bundle-init.1.txt
index 59c4ab4eab..cdebbebf14 100644
--- a/man/bundle-init.1.txt
+++ b/man/bundle-init.1.txt
@@ -31,4 +31,4 @@ SEE ALSO
- September 2019 BUNDLE-INIT(1)
+ November 2019 BUNDLE-INIT(1)
diff --git a/man/bundle-inject.1 b/man/bundle-inject.1
index 00ff8f9f7b..6ce2973b5f 100644
--- a/man/bundle-inject.1
+++ b/man/bundle-inject.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-INJECT" "1" "September 2019" "" ""
+.TH "BUNDLE\-INJECT" "1" "November 2019" "" ""
.
.SH "NAME"
\fBbundle\-inject\fR \- Add named gem(s) with version requirements to Gemfile
diff --git a/man/bundle-inject.1.txt b/man/bundle-inject.1.txt
index 252b62d12c..df0a032b97 100644
--- a/man/bundle-inject.1.txt
+++ b/man/bundle-inject.1.txt
@@ -29,4 +29,4 @@ DESCRIPTION
- September 2019 BUNDLE-INJECT(1)
+ November 2019 BUNDLE-INJECT(1)
diff --git a/man/bundle-install.1 b/man/bundle-install.1
index 0f02fb262a..4656a0cbe3 100644
--- a/man/bundle-install.1
+++ b/man/bundle-install.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-INSTALL" "1" "September 2019" "" ""
+.TH "BUNDLE\-INSTALL" "1" "November 2019" "" ""
.
.SH "NAME"
\fBbundle\-install\fR \- Install the dependencies specified in your Gemfile
diff --git a/man/bundle-install.1.txt b/man/bundle-install.1.txt
index 2606b4ffd6..cef9494cc3 100644
--- a/man/bundle-install.1.txt
+++ b/man/bundle-install.1.txt
@@ -193,14 +193,14 @@ DEPLOYMENT MODE
SUDO USAGE
- By default, Bundler installs gems to the same location as gem install.
+ By default, Bundler installs gems to the same location as gem install.
- In some cases, that location may not be writable by your Unix user. In
+ In some cases, that location may not be writable by your Unix user. In
that case, Bundler will stage everything in a temporary directory, then
- ask you for your sudo password in order to copy the gems into their
+ ask you for your sudo password in order to copy the gems into their
system location.
- From your perspective, this is identical to installing the gems
+ From your perspective, this is identical to installing the gems
directly into the system.
You should never use sudo bundle install. This is because several other
@@ -214,36 +214,36 @@ SUDO USAGE
- Of these three, the first two could theoretically be performed by
- chowning the resulting files to $SUDO_USER. The third, however, can
- only be performed by invoking the git command as the current user.
- Therefore, git gems are downloaded and installed into ~/.bundle rather
+ Of these three, the first two could theoretically be performed by
+ chowning the resulting files to $SUDO_USER. The third, however, can
+ only be performed by invoking the git command as the current user.
+ Therefore, git gems are downloaded and installed into ~/.bundle rather
than $GEM_HOME or $BUNDLE_PATH.
- As a result, you should run bundle install as the current user, and
+ As a result, you should run bundle install as the current user, and
Bundler will ask for your password if it is needed to put the gems into
their final location.
INSTALLING GROUPS
- By default, bundle install will install all gems in all groups in your
+ By default, bundle install will install all gems in all groups in your
Gemfile(5), except those declared for a different platform.
- However, you can explicitly tell Bundler to skip installing certain
- groups with the --without option. This option takes a space-separated
+ However, you can explicitly tell Bundler to skip installing certain
+ groups with the --without option. This option takes a space-separated
list of groups.
- While the --without option will skip installing the gems in the speci-
- fied groups, it will still download those gems and use them to resolve
+ While the --without option will skip installing the gems in the speci-
+ fied groups, it will still download those gems and use them to resolve
the dependencies of every gem in your Gemfile(5).
This is so that installing a different set of groups on another machine
- (such as a production server) will not change the gems and versions
+ (such as a production server) will not change the gems and versions
that you have already developed and tested against.
Bundler offers a rock-solid guarantee that the third-party code you are
running in development and testing is also the third-party code you are
- running in production. You can choose to exclude some of that code in
- different environments, but you will never be caught flat-footed by
+ running in production. You can choose to exclude some of that code in
+ different environments, but you will never be caught flat-footed by
different versions of third-party code being used in different environ-
ments.
@@ -261,63 +261,63 @@ INSTALLING GROUPS
- In this case, sinatra depends on any version of Rack (>= 1.0), while
+ In this case, sinatra depends on any version of Rack (>= 1.0), while
rack-perftools-profiler depends on 1.x (~> 1.0).
- When you run bundle install --without production in development, we
- look at the dependencies of rack-perftools-profiler as well. That way,
- you do not spend all your time developing against Rack 2.0, using new
- APIs unavailable in Rack 1.x, only to have Bundler switch to Rack 1.2
+ When you run bundle install --without production in development, we
+ look at the dependencies of rack-perftools-profiler as well. That way,
+ you do not spend all your time developing against Rack 2.0, using new
+ APIs unavailable in Rack 1.x, only to have Bundler switch to Rack 1.2
when the production group is used.
- This should not cause any problems in practice, because we do not
- attempt to install the gems in the excluded groups, and only evaluate
+ This should not cause any problems in practice, because we do not
+ attempt to install the gems in the excluded groups, and only evaluate
as part of the dependency resolution process.
- This also means that you cannot include different versions of the same
- gem in different groups, because doing so would result in different
+ This also means that you cannot include different versions of the same
+ gem in different groups, because doing so would result in different
sets of dependencies used in development and production. Because of the
- vagaries of the dependency resolution process, this usually affects
- more than the gems you list in your Gemfile(5), and can (surprisingly)
+ vagaries of the dependency resolution process, this usually affects
+ more than the gems you list in your Gemfile(5), and can (surprisingly)
radically change the gems you are using.
THE GEMFILE.LOCK
- When you run bundle install, Bundler will persist the full names and
- versions of all gems that you used (including dependencies of the gems
+ When you run bundle install, Bundler will persist the full names and
+ versions of all gems that you used (including dependencies of the gems
specified in the Gemfile(5)) into a file called Gemfile.lock.
Bundler uses this file in all subsequent calls to bundle install, which
guarantees that you always use the same exact code, even as your appli-
cation moves across machines.
- Because of the way dependency resolution works, even a seemingly small
+ Because of the way dependency resolution works, even a seemingly small
change (for instance, an update to a point-release of a dependency of a
- gem in your Gemfile(5)) can result in radically different gems being
+ gem in your Gemfile(5)) can result in radically different gems being
needed to satisfy all dependencies.
- As a result, you SHOULD check your Gemfile.lock into version control,
+ As a result, you SHOULD check your Gemfile.lock into version control,
in both applications and gems. If you do not, every machine that checks
out your repository (including your production server) will resolve all
- dependencies again, which will result in different versions of
+ dependencies again, which will result in different versions of
third-party code being used if any of the gems in the Gemfile(5) or any
of their dependencies have been updated.
- When Bundler first shipped, the Gemfile.lock was included in the .git-
+ When Bundler first shipped, the Gemfile.lock was included in the .git-
ignore file included with generated gems. Over time, however, it became
- clear that this practice forces the pain of broken dependencies onto
+ clear that this practice forces the pain of broken dependencies onto
new contributors, while leaving existing contributors potentially
- unaware of the problem. Since bundle install is usually the first step
- towards a contribution, the pain of broken dependencies would discour-
- age new contributors from contributing. As a result, we have revised
- our guidance for gem authors to now recommend checking in the lock for
+ unaware of the problem. Since bundle install is usually the first step
+ towards a contribution, the pain of broken dependencies would discour-
+ age new contributors from contributing. As a result, we have revised
+ our guidance for gem authors to now recommend checking in the lock for
gems.
CONSERVATIVE UPDATING
- When you make a change to the Gemfile(5) and then run bundle install,
+ When you make a change to the Gemfile(5) and then run bundle install,
Bundler will update only the gems that you modified.
- In other words, if a gem that you did not modify worked before you
- called bundle install, it will continue to use the exact same versions
+ In other words, if a gem that you did not modify worked before you
+ called bundle install, it will continue to use the exact same versions
of all dependencies as it used before the update.
Let's take a look at an example. Here's your original Gemfile(5):
@@ -331,13 +331,13 @@ CONSERVATIVE UPDATING
- In this case, both actionpack and activemerchant depend on activesup-
- port. The actionpack gem depends on activesupport 2.3.8 and rack ~>
- 1.1.0, while the activemerchant gem depends on activesupport >= 2.3.2,
+ In this case, both actionpack and activemerchant depend on activesup-
+ port. The actionpack gem depends on activesupport 2.3.8 and rack ~>
+ 1.1.0, while the activemerchant gem depends on activesupport >= 2.3.2,
braintree >= 2.0.0, and builder >= 2.0.0.
- When the dependencies are first resolved, Bundler will select
- activesupport 2.3.8, which satisfies the requirements of both gems in
+ When the dependencies are first resolved, Bundler will select
+ activesupport 2.3.8, which satisfies the requirements of both gems in
your Gemfile(5).
Next, you modify your Gemfile(5) to:
@@ -351,44 +351,44 @@ CONSERVATIVE UPDATING
- The actionpack 3.0.0.rc gem has a number of new dependencies, and
- updates the activesupport dependency to = 3.0.0.rc and the rack depen-
+ The actionpack 3.0.0.rc gem has a number of new dependencies, and
+ updates the activesupport dependency to = 3.0.0.rc and the rack depen-
dency to ~> 1.2.1.
- When you run bundle install, Bundler notices that you changed the
- actionpack gem, but not the activemerchant gem. It evaluates the gems
+ When you run bundle install, Bundler notices that you changed the
+ actionpack gem, but not the activemerchant gem. It evaluates the gems
currently being used to satisfy its requirements:
activesupport 2.3.8
- also used to satisfy a dependency in activemerchant, which is
+ also used to satisfy a dependency in activemerchant, which is
not being updated
rack ~> 1.1.0
not currently being used to satisfy another dependency
- Because you did not explicitly ask to update activemerchant, you would
- not expect it to suddenly stop working after updating actionpack. How-
- ever, satisfying the new activesupport 3.0.0.rc dependency of action-
+ Because you did not explicitly ask to update activemerchant, you would
+ not expect it to suddenly stop working after updating actionpack. How-
+ ever, satisfying the new activesupport 3.0.0.rc dependency of action-
pack requires updating one of its dependencies.
- Even though activemerchant declares a very loose dependency that theo-
- retically matches activesupport 3.0.0.rc, Bundler treats gems in your
- Gemfile(5) that have not changed as an atomic unit together with their
+ Even though activemerchant declares a very loose dependency that theo-
+ retically matches activesupport 3.0.0.rc, Bundler treats gems in your
+ Gemfile(5) that have not changed as an atomic unit together with their
dependencies. In this case, the activemerchant dependency is treated as
- activemerchant 1.7.1 + activesupport 2.3.8, so bundle install will
+ activemerchant 1.7.1 + activesupport 2.3.8, so bundle install will
report that it cannot update actionpack.
To explicitly update actionpack, including its dependencies which other
- gems in the Gemfile(5) still depend on, run bundle update actionpack
+ gems in the Gemfile(5) still depend on, run bundle update actionpack
(see bundle update(1)).
- Summary: In general, after making a change to the Gemfile(5) , you
- should first try to run bundle install, which will guarantee that no
+ Summary: In general, after making a change to the Gemfile(5) , you
+ should first try to run bundle install, which will guarantee that no
other gem in the Gemfile(5) is impacted by the change. If that does not
work, run bundle update(1) bundle-update.1.html.
SEE ALSO
- o Gem install docs
+ o Gem install docs
http://guides.rubygems.org/rubygems-basics/#installing-gems
o Rubygems signing docs http://guides.rubygems.org/security/
@@ -398,4 +398,4 @@ SEE ALSO
- September 2019 BUNDLE-INSTALL(1)
+ November 2019 BUNDLE-INSTALL(1)
diff --git a/man/bundle-list.1 b/man/bundle-list.1
index 1f2a0d9e3e..0d932dbf28 100644
--- a/man/bundle-list.1
+++ b/man/bundle-list.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-LIST" "1" "September 2019" "" ""
+.TH "BUNDLE\-LIST" "1" "November 2019" "" ""
.
.SH "NAME"
\fBbundle\-list\fR \- List all the gems in the bundle
diff --git a/man/bundle-list.1.txt b/man/bundle-list.1.txt
index 6a042e94b1..d2433c5648 100644
--- a/man/bundle-list.1.txt
+++ b/man/bundle-list.1.txt
@@ -40,4 +40,4 @@ OPTIONS
- September 2019 BUNDLE-LIST(1)
+ November 2019 BUNDLE-LIST(1)
diff --git a/man/bundle-lock.1 b/man/bundle-lock.1
index 254d912ed5..6b86531f60 100644
--- a/man/bundle-lock.1
+++ b/man/bundle-lock.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-LOCK" "1" "September 2019" "" ""
+.TH "BUNDLE\-LOCK" "1" "November 2019" "" ""
.
.SH "NAME"
\fBbundle\-lock\fR \- Creates / Updates a lockfile without installing
diff --git a/man/bundle-lock.1.txt b/man/bundle-lock.1.txt
index 81e735419c..b8f18c13e0 100644
--- a/man/bundle-lock.1.txt
+++ b/man/bundle-lock.1.txt
@@ -16,16 +16,16 @@ DESCRIPTION
OPTIONS
--update=<*gems>
Ignores the existing lockfile. Resolve then updates lockfile.
- Taking a list of gems or updating all gems if no list is given.
+ Taking a list of gems or updating all gems if no list is given.
--local
Do not attempt to connect to rubygems.org. Instead, Bundler will
- use the gems already present in Rubygems' cache or in ven-
- dor/cache. Note that if a appropriate platform-specific gem
+ use the gems already present in Rubygems' cache or in ven-
+ dor/cache. Note that if a appropriate platform-specific gem
exists on rubygems.org it will not be found.
--print
- Prints the lockfile to STDOUT instead of writing to the file
+ Prints the lockfile to STDOUT instead of writing to the file
system.
--lockfile=<path>
@@ -35,7 +35,7 @@ OPTIONS
Fall back to using the single-file index of all gems.
--add-platform
- Add a new platform to the lockfile, re-resolving for the addi-
+ Add a new platform to the lockfile, re-resolving for the addi-
tion of that platform.
--remove-platform
@@ -51,7 +51,7 @@ OPTIONS
If updating, prefer updating to next major version (default).
--strict
- If updating, do not allow any gem to be updated past latest
+ If updating, do not allow any gem to be updated past latest
--patch | --minor | --major.
--conservative
@@ -59,28 +59,28 @@ OPTIONS
do not allow shared dependencies to be updated.
UPDATING ALL GEMS
- If you run bundle lock with --update option without list of gems,
- bundler will ignore any previously installed gems and resolve all
- dependencies again based on the latest versions of all gems available
+ If you run bundle lock with --update option without list of gems,
+ bundler will ignore any previously installed gems and resolve all
+ dependencies again based on the latest versions of all gems available
in the sources.
UPDATING A LIST OF GEMS
Sometimes, you want to update a single gem in the Gemfile(5), and leave
- the rest of the gems that you specified locked to the versions in the
+ the rest of the gems that you specified locked to the versions in the
Gemfile.lock.
- For instance, you only want to update nokogiri, run bundle lock
+ For instance, you only want to update nokogiri, run bundle lock
--update nokogiri.
Bundler will update nokogiri and any of its dependencies, but leave the
- rest of the gems that you specified locked to the versions in the Gem-
+ rest of the gems that you specified locked to the versions in the Gem-
file.lock.
SUPPORTING OTHER PLATFORMS
- If you want your bundle to support platforms other than the one you're
+ If you want your bundle to support platforms other than the one you're
running locally, you can run bundle lock --add-platform PLATFORM to add
- PLATFORM to the lockfile, force bundler to re-resolve and consider the
- new platform when picking gems, all without needing to have a machine
+ PLATFORM to the lockfile, force bundler to re-resolve and consider the
+ new platform when picking gems, all without needing to have a machine
that matches PLATFORM handy to install those platform-specific gems on.
For a full explanation of gem platforms, see gem help platform.
@@ -90,4 +90,4 @@ PATCH LEVEL OPTIONS
- September 2019 BUNDLE-LOCK(1)
+ November 2019 BUNDLE-LOCK(1)
diff --git a/man/bundle-open.1 b/man/bundle-open.1
index 4ed742c942..4eb5aebdf3 100644
--- a/man/bundle-open.1
+++ b/man/bundle-open.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-OPEN" "1" "September 2019" "" ""
+.TH "BUNDLE\-OPEN" "1" "November 2019" "" ""
.
.SH "NAME"
\fBbundle\-open\fR \- Opens the source directory for a gem in your bundle
diff --git a/man/bundle-open.1.txt b/man/bundle-open.1.txt
index 8d367a6e01..a4ca7eaf61 100644
--- a/man/bundle-open.1.txt
+++ b/man/bundle-open.1.txt
@@ -26,4 +26,4 @@ DESCRIPTION
- September 2019 BUNDLE-OPEN(1)
+ November 2019 BUNDLE-OPEN(1)
diff --git a/man/bundle-outdated.1 b/man/bundle-outdated.1
index 987b3e8bcf..d126a14f05 100644
--- a/man/bundle-outdated.1
+++ b/man/bundle-outdated.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-OUTDATED" "1" "September 2019" "" ""
+.TH "BUNDLE\-OUTDATED" "1" "November 2019" "" ""
.
.SH "NAME"
\fBbundle\-outdated\fR \- List installed gems with newer versions available
diff --git a/man/bundle-outdated.1.txt b/man/bundle-outdated.1.txt
index 66a6a5d685..49534557d9 100644
--- a/man/bundle-outdated.1.txt
+++ b/man/bundle-outdated.1.txt
@@ -128,4 +128,4 @@ FILTERING OUTPUT
- September 2019 BUNDLE-OUTDATED(1)
+ November 2019 BUNDLE-OUTDATED(1)
diff --git a/man/bundle-platform.1 b/man/bundle-platform.1
index a03e4a6ede..8d0dd9bfda 100644
--- a/man/bundle-platform.1
+++ b/man/bundle-platform.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-PLATFORM" "1" "September 2019" "" ""
+.TH "BUNDLE\-PLATFORM" "1" "November 2019" "" ""
.
.SH "NAME"
\fBbundle\-platform\fR \- Displays platform compatibility information
diff --git a/man/bundle-platform.1.txt b/man/bundle-platform.1.txt
index 7274b1da8c..e609225e84 100644
--- a/man/bundle-platform.1.txt
+++ b/man/bundle-platform.1.txt
@@ -54,4 +54,4 @@ OPTIONS
- September 2019 BUNDLE-PLATFORM(1)
+ November 2019 BUNDLE-PLATFORM(1)
diff --git a/man/bundle-pristine.1 b/man/bundle-pristine.1
index 10f5fcd66c..3ba82f0eb1 100644
--- a/man/bundle-pristine.1
+++ b/man/bundle-pristine.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-PRISTINE" "1" "September 2019" "" ""
+.TH "BUNDLE\-PRISTINE" "1" "November 2019" "" ""
.
.SH "NAME"
\fBbundle\-pristine\fR \- Restores installed gems to their pristine condition
diff --git a/man/bundle-pristine.1.txt b/man/bundle-pristine.1.txt
index b943f25e35..780441595a 100644
--- a/man/bundle-pristine.1.txt
+++ b/man/bundle-pristine.1.txt
@@ -41,4 +41,4 @@ DESCRIPTION
- September 2019 BUNDLE-PRISTINE(1)
+ November 2019 BUNDLE-PRISTINE(1)
diff --git a/man/bundle-remove.1 b/man/bundle-remove.1
index 41c28277b4..35874563a0 100644
--- a/man/bundle-remove.1
+++ b/man/bundle-remove.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-REMOVE" "1" "September 2019" "" ""
+.TH "BUNDLE\-REMOVE" "1" "November 2019" "" ""
.
.SH "NAME"
\fBbundle\-remove\fR \- Removes gems from the Gemfile
diff --git a/man/bundle-remove.1.txt b/man/bundle-remove.1.txt
index 4fe03be2d2..968aeed416 100644
--- a/man/bundle-remove.1.txt
+++ b/man/bundle-remove.1.txt
@@ -31,4 +31,4 @@ OPTIONS
- September 2019 BUNDLE-REMOVE(1)
+ November 2019 BUNDLE-REMOVE(1)
diff --git a/man/bundle-show.1 b/man/bundle-show.1
index 05ac7dbee1..51329ecb2c 100644
--- a/man/bundle-show.1
+++ b/man/bundle-show.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-SHOW" "1" "September 2019" "" ""
+.TH "BUNDLE\-SHOW" "1" "November 2019" "" ""
.
.SH "NAME"
\fBbundle\-show\fR \- Shows all the gems in your bundle, or the path to a gem
diff --git a/man/bundle-show.1.txt b/man/bundle-show.1.txt
index 7a17d01afe..cbab9e0bd7 100644
--- a/man/bundle-show.1.txt
+++ b/man/bundle-show.1.txt
@@ -24,4 +24,4 @@ OPTIONS
- September 2019 BUNDLE-SHOW(1)
+ November 2019 BUNDLE-SHOW(1)
diff --git a/man/bundle-update.1 b/man/bundle-update.1
index 2df9301c5b..726f4f7cb7 100644
--- a/man/bundle-update.1
+++ b/man/bundle-update.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-UPDATE" "1" "September 2019" "" ""
+.TH "BUNDLE\-UPDATE" "1" "November 2019" "" ""
.
.SH "NAME"
\fBbundle\-update\fR \- Update your gems to the latest available versions
diff --git a/man/bundle-update.1.txt b/man/bundle-update.1.txt
index a39070200b..bc84254475 100644
--- a/man/bundle-update.1.txt
+++ b/man/bundle-update.1.txt
@@ -16,29 +16,29 @@ DESCRIPTION
eral, you should use bundle install(1) bundle-install.1.html to install
the same exact gems and versions across machines.
- You would use bundle update to explicitly update the version of a gem.
+ You would use bundle update to explicitly update the version of a gem.
OPTIONS
--all Update all gems specified in Gemfile.
--group=<name>, -g=[<name>]
- Only update the gems in the specified group. For instance, you
- can update all gems in the development group with bundle update
- --group development. You can also call bundle update rails
- --group test to update the rails gem and all gems in the test
+ Only update the gems in the specified group. For instance, you
+ can update all gems in the development group with bundle update
+ --group development. You can also call bundle update rails
+ --group test to update the rails gem and all gems in the test
group, for example.
--source=<name>
- The name of a :git or :path source used in the Gemfile(5). For
- instance, with a :git source of
- http://github.com/rails/rails.git, you would call bundle update
+ The name of a :git or :path source used in the Gemfile(5). For
+ instance, with a :git source of
+ http://github.com/rails/rails.git, you would call bundle update
--source rails
--local
- Do not attempt to fetch gems remotely and use the gem cache
+ Do not attempt to fetch gems remotely and use the gem cache
instead.
- --ruby Update the locked version of Ruby to the current version of
+ --ruby Update the locked version of Ruby to the current version of
Ruby.
--bundler
@@ -328,22 +328,22 @@ PATCH LEVEL EXAMPLES
the dependency from foo 1.4.5 required it.
In case 2, only foo is requested to be unlocked, but bar is also
- allowed to move because it's not a declared dependency in the Gemfile.
+ allowed to move because it's not a declared dependency in the Gemfile.
- In case 3, bar goes up a whole major release, because a minor increase
- is preferred now for foo, and when it goes to 1.5.1, it requires 3.0.0
+ In case 3, bar goes up a whole major release, because a minor increase
+ is preferred now for foo, and when it goes to 1.5.1, it requires 3.0.0
of bar.
In case 4, foo is preferred up to a minor version, but 1.5.1 won't work
- because the --strict flag removes bar 3.0.0 from consideration since
+ because the --strict flag removes bar 3.0.0 from consideration since
it's a major increment.
- In case 5, both foo and bar have any minor or major increments removed
- from consideration because of the --strict flag, so the most they can
+ In case 5, both foo and bar have any minor or major increments removed
+ from consideration because of the --strict flag, so the most they can
move is up to 1.4.4 and 2.0.4.
RECOMMENDED WORKFLOW
- In general, when working with an application managed with bundler, you
+ In general, when working with an application managed with bundler, you
should use the following workflow:
o After you create your Gemfile(5) for the first time, run
@@ -354,7 +354,7 @@ RECOMMENDED WORKFLOW
$ git add Gemfile.lock
- o When checking out this repository on another development machine,
+ o When checking out this repository on another development machine,
run
$ bundle install
@@ -363,7 +363,7 @@ RECOMMENDED WORKFLOW
$ bundle install --deployment
- o After changing the Gemfile(5) to reflect a new or update depen-
+ o After changing the Gemfile(5) to reflect a new or update depen-
dency, run
$ bundle install
@@ -377,7 +377,7 @@ RECOMMENDED WORKFLOW
$ bundle update rails thin
- o If you want to update all the gems to the latest possible versions
+ o If you want to update all the gems to the latest possible versions
that still match the gems listed in the Gemfile(5), run
$ bundle update --all
@@ -387,4 +387,4 @@ RECOMMENDED WORKFLOW
- September 2019 BUNDLE-UPDATE(1)
+ November 2019 BUNDLE-UPDATE(1)
diff --git a/man/bundle-viz.1 b/man/bundle-viz.1
index 670a2a2823..0ad8a1fa58 100644
--- a/man/bundle-viz.1
+++ b/man/bundle-viz.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-VIZ" "1" "September 2019" "" ""
+.TH "BUNDLE\-VIZ" "1" "November 2019" "" ""
.
.SH "NAME"
\fBbundle\-viz\fR \- Generates a visual dependency graph for your Gemfile
diff --git a/man/bundle-viz.1.txt b/man/bundle-viz.1.txt
index 8ad3e33169..c9e3ce2c2b 100644
--- a/man/bundle-viz.1.txt
+++ b/man/bundle-viz.1.txt
@@ -36,4 +36,4 @@ OPTIONS
- September 2019 BUNDLE-VIZ(1)
+ November 2019 BUNDLE-VIZ(1)
diff --git a/man/bundle.1 b/man/bundle.1
index cb90afe25d..c391270cf2 100644
--- a/man/bundle.1
+++ b/man/bundle.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE" "1" "September 2019" "" ""
+.TH "BUNDLE" "1" "November 2019" "" ""
.
.SH "NAME"
\fBbundle\fR \- Ruby Dependency Management
diff --git a/man/bundle.1.txt b/man/bundle.1.txt
index 1ff762dd91..e952002870 100644
--- a/man/bundle.1.txt
+++ b/man/bundle.1.txt
@@ -36,7 +36,7 @@ PRIMARY COMMANDS
Update dependencies to their latest versions
bundle package(1) bundle-package.1.html
- Package the .gem files required by your application into the
+ Package the .gem files required by your application into the
vendor/cache directory
bundle exec(1) bundle-exec.1.html
@@ -56,7 +56,7 @@ UTILITIES
Generate binstubs for executables in a gem
bundle check(1) bundle-check.1.html
- Determine whether the requirements for your application are
+ Determine whether the requirements for your application are
installed and available to Bundler
bundle show(1) bundle-show.1.html
@@ -96,9 +96,9 @@ UTILITIES
Removes gems from the Gemfile
PLUGINS
- When running a command that isn't listed in PRIMARY COMMANDS or UTILI-
- TIES, Bundler will try to find an executable on your path named
- bundler-<command> and execute it, passing down any extra arguments to
+ When running a command that isn't listed in PRIMARY COMMANDS or UTILI-
+ TIES, Bundler will try to find an executable on your path named
+ bundler-<command> and execute it, passing down any extra arguments to
it.
OBSOLETE
@@ -113,4 +113,4 @@ OBSOLETE
- September 2019 BUNDLE(1)
+ November 2019 BUNDLE(1)
diff --git a/man/gemfile.5 b/man/gemfile.5
index d614468255..8d1ac996a0 100644
--- a/man/gemfile.5
+++ b/man/gemfile.5
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "GEMFILE" "5" "September 2019" "" ""
+.TH "GEMFILE" "5" "November 2019" "" ""
.
.SH "NAME"
\fBGemfile\fR \- A format for describing gem dependencies for Ruby programs
diff --git a/man/gemfile.5.txt b/man/gemfile.5.txt
index ba3aca531d..e7dd2c0d97 100644
--- a/man/gemfile.5.txt
+++ b/man/gemfile.5.txt
@@ -99,13 +99,13 @@ RUBY
exist. Some of the more well-known implementations include Rubinius
https://rubinius.com/, and JRuby http://jruby.org/. Rubinius is an
alternative implementation of Ruby written in Ruby. JRuby is an
- implementation of Ruby on the JVM, short for Java Virtual Machine.
+ implementation of Ruby on the JVM, short for Java Virtual Machine.
ENGINE VERSION
- Each application may specify a Ruby engine version. If an engine ver-
- sion is specified, an engine must also be specified. If the engine is
+ Each application may specify a Ruby engine version. If an engine ver-
+ sion is specified, an engine must also be specified. If the engine is
"ruby" the engine version specified must match the Ruby version.
@@ -147,9 +147,9 @@ GEMS
REQUIRE AS
- Each gem MAY specify files that should be used when autorequiring via
- Bundler.require. You may pass an array with multiple files or true if
- file you want required has same name as gem or false to prevent any
+ Each gem MAY specify files that should be used when autorequiring via
+ Bundler.require. You may pass an array with multiple files or true if
+ file you want required has same name as gem or false to prevent any
file from being autorequired.
@@ -160,7 +160,7 @@ GEMS
- The argument defaults to the name of the gem. For example, these are
+ The argument defaults to the name of the gem. For example, these are
identical:
@@ -172,8 +172,8 @@ GEMS
GROUPS
- Each gem MAY specify membership in one or more groups. Any gem that
- does not specify membership in any group is placed in the default
+ Each gem MAY specify membership in one or more groups. Any gem that
+ does not specify membership in any group is placed in the default
group.
@@ -183,7 +183,7 @@ GEMS
- The Bundler runtime allows its two main methods, Bundler.setup and
+ The Bundler runtime allows its two main methods, Bundler.setup and
Bundler.require, to limit their impact to particular groups.
@@ -203,10 +203,10 @@ GEMS
- The Bundler CLI allows you to specify a list of groups whose gems bun-
+ The Bundler CLI allows you to specify a list of groups whose gems bun-
dle install should not install with the without configuration.
- To specify multiple groups to ignore, specify a list of groups sepa-
+ To specify multiple groups to ignore, specify a list of groups sepa-
rated by spaces.
@@ -216,20 +216,20 @@ GEMS
- Also, calling Bundler.setup with no parameters, or calling require
- "bundler/setup" will setup all groups except for the ones you excluded
+ Also, calling Bundler.setup with no parameters, or calling require
+ "bundler/setup" will setup all groups except for the ones you excluded
via --without (since they are not available).
- Note that on bundle install, bundler downloads and evaluates all gems,
- in order to create a single canonical list of all of the required gems
- and their dependencies. This means that you cannot list different ver-
- sions of the same gems in different groups. For more details, see
+ Note that on bundle install, bundler downloads and evaluates all gems,
+ in order to create a single canonical list of all of the required gems
+ and their dependencies. This means that you cannot list different ver-
+ sions of the same gems in different groups. For more details, see
Understanding Bundler https://bundler.io/rationale.html.
PLATFORMS
- If a gem should only be used in a particular platform or set of plat-
- forms, you can specify them. Platforms are essentially identical to
- groups, except that you do not need to use the --without install-time
+ If a gem should only be used in a particular platform or set of plat-
+ forms, you can specify them. Platforms are essentially identical to
+ groups, except that you do not need to use the --without install-time
flag to exclude groups of gems for other platforms.
There are a number of Gemfile platforms:
@@ -252,7 +252,7 @@ GEMS
mswin Windows
- You can restrict further by platform and version for all platforms
+ You can restrict further by platform and version for all platforms
except for rbx, jruby, truffleruby and mswin.
To specify a version in addition to a platform, append the version num-
@@ -286,12 +286,12 @@ GEMS
- All operations involving groups (bundle install bundle-install.1.html,
- Bundler.setup, Bundler.require) behave exactly the same as if any
+ All operations involving groups (bundle install bundle-install.1.html,
+ Bundler.setup, Bundler.require) behave exactly the same as if any
groups not matching the current platform were explicitly excluded.
SOURCE
- You can select an alternate Rubygems repository for a gem using the
+ You can select an alternate Rubygems repository for a gem using the
':source' option.
@@ -300,22 +300,22 @@ GEMS
- This forces the gem to be loaded from this source and ignores any
- global sources declared at the top level of the file. If the gem does
+ This forces the gem to be loaded from this source and ignores any
+ global sources declared at the top level of the file. If the gem does
not exist in this source, it will not be installed.
Bundler will search for child dependencies of this gem by first looking
in the source selected for the parent, but if they are not found there,
- it will fall back on global sources using the ordering described in
+ it will fall back on global sources using the ordering described in
SOURCE PRIORITY.
- Selecting a specific source repository this way also suppresses the
+ Selecting a specific source repository this way also suppresses the
ambiguous gem warning described above in GLOBAL SOURCES (#source).
- Using the :source option for an individual gem will also make that
- source available as a possible global source for any other gems which
- do not specify explicit sources. Thus, when adding gems with explicit
- sources, it is recommended that you also ensure all other gems in the
+ Using the :source option for an individual gem will also make that
+ source available as a possible global source for any other gems which
+ do not specify explicit sources. Thus, when adding gems with explicit
+ sources, it is recommended that you also ensure all other gems in the
Gemfile are using explicit sources.
GIT
@@ -333,27 +333,27 @@ GEMS
If using SSH, the user that you use to run bundle install MUST have the
appropriate keys available in their $HOME/.ssh.
- NOTE: http:// and git:// URLs should be avoided if at all possible.
- These protocols are unauthenticated, so a man-in-the-middle attacker
- can deliver malicious code and compromise your system. HTTPS and SSH
+ NOTE: http:// and git:// URLs should be avoided if at all possible.
+ These protocols are unauthenticated, so a man-in-the-middle attacker
+ can deliver malicious code and compromise your system. HTTPS and SSH
are strongly preferred.
- The group, platforms, and require options are available and behave
+ The group, platforms, and require options are available and behave
exactly the same as they would for a normal gem.
- A git repository SHOULD have at least one file, at the root of the
- directory containing the gem, with the extension .gemspec. This file
- MUST contain a valid gem specification, as expected by the gem build
+ A git repository SHOULD have at least one file, at the root of the
+ directory containing the gem, with the extension .gemspec. This file
+ MUST contain a valid gem specification, as expected by the gem build
command.
- If a git repository does not have a .gemspec, bundler will attempt to
+ If a git repository does not have a .gemspec, bundler will attempt to
create one, but it will not contain any dependencies, executables, or C
- extension compilation instructions. As a result, it may fail to prop-
+ extension compilation instructions. As a result, it may fail to prop-
erly integrate into your application.
- If a git repository does have a .gemspec for the gem you attached it
- to, a version specifier, if provided, means that the git repository is
- only valid if the .gemspec specifies a version matching the version
+ If a git repository does have a .gemspec for the gem you attached it
+ to, a version specifier, if provided, means that the git repository is
+ only valid if the .gemspec specifies a version matching the version
specifier. If not, bundler will print a warning.
@@ -364,34 +364,34 @@ GEMS
- If a git repository does not have a .gemspec for the gem you attached
+ If a git repository does not have a .gemspec for the gem you attached
it to, a version specifier MUST be provided. Bundler will use this ver-
sion in the simple .gemspec it creates.
Git repositories support a number of additional options.
branch, tag, and ref
- You MUST only specify at most one of these options. The default
+ You MUST only specify at most one of these options. The default
is :branch => "master". For example:
- gem "rails", :git => "https://github.com/rails/rails.git",
+ gem "rails", :git => "https://github.com/rails/rails.git",
:branch => "5-0-stable"
- gem "rails", :git => "https://github.com/rails/rails.git", :tag
+ gem "rails", :git => "https://github.com/rails/rails.git", :tag
=> "v5.0.0"
- gem "rails", :git => "https://github.com/rails/rails.git", :ref
+ gem "rails", :git => "https://github.com/rails/rails.git", :ref
=> "4aded"
submodules
- For reference, a git submodule
+ For reference, a git submodule
https://git-scm.com/book/en/v2/Git-Tools-Submodules lets you
- have another git repository within a subfolder of your reposi-
+ have another git repository within a subfolder of your reposi-
tory. Specify :submodules => true to cause bundler to expand any
submodules included in the git repository
- If a git repository contains multiple .gemspecs, each .gemspec repre-
- sents a gem located at the same place in the file system as the .gem-
+ If a git repository contains multiple .gemspecs, each .gemspec repre-
+ sents a gem located at the same place in the file system as the .gem-
spec.
@@ -406,16 +406,16 @@ GEMS
- To install a gem located in a git repository, bundler changes to the
- directory containing the gemspec, runs gem build name.gemspec and then
+ To install a gem located in a git repository, bundler changes to the
+ directory containing the gemspec, runs gem build name.gemspec and then
installs the resulting gem. The gem build command, which comes standard
- with Rubygems, evaluates the .gemspec in the context of the directory
+ with Rubygems, evaluates the .gemspec in the context of the directory
in which it is located.
GIT SOURCE
- A custom git source can be defined via the git_source method. Provide
- the source's name as an argument, and a block which receives a single
- argument and interpolates it into a string to return the full repo
+ A custom git source can be defined via the git_source method. Provide
+ the source's name as an argument, and a block which receives a single
+ argument and interpolates it into a string to return the full repo
address:
@@ -438,10 +438,10 @@ GEMS
rently expands to an insecure git:// URL. This allows a man-in-the-mid-
dle attacker to compromise your system.
- If the git repository you want to use is hosted on GitHub and is pub-
- lic, you can use the :github shorthand to specify the github username
- and repository name (without the trailing ".git"), separated by a
- slash. If both the username and repository name are the same, you can
+ If the git repository you want to use is hosted on GitHub and is pub-
+ lic, you can use the :github shorthand to specify the github username
+ and repository name (without the trailing ".git"), separated by a
+ slash. If both the username and repository name are the same, you can
omit one.
@@ -464,7 +464,7 @@ GEMS
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
+ public, you can use the :gist shorthand to specify the gist identifier
(without the trailing ".git").
@@ -481,14 +481,14 @@ GEMS
- Since the gist method is a specialization of git_source, it accepts a
+ Since the gist method is a specialization of git_source, it accepts a
:branch named argument.
BITBUCKET
- If the git repository you want to use is hosted on Bitbucket and is
- public, you can use the :bitbucket shorthand to specify the bitbucket
- username and repository name (without the trailing ".git"), separated
- by a slash. If both the username and repository name are the same, you
+ If the git repository you want to use is hosted on Bitbucket and is
+ public, you can use the :bitbucket shorthand to specify the bitbucket
+ username and repository name (without the trailing ".git"), separated
+ by a slash. If both the username and repository name are the same, you
can omit one.
@@ -506,19 +506,19 @@ GEMS
- Since the bitbucket method is a specialization of git_source, it
+ Since the bitbucket method is a specialization of git_source, it
accepts a :branch named argument.
PATH
- You can specify that a gem is located in a particular location on the
+ You can specify that a gem is located in a particular location on the
file system. Relative paths are resolved relative to the directory con-
taining the Gemfile.
- Similar to the semantics of the :git option, the :path option requires
- that the directory in question either contains a .gemspec for the gem,
+ Similar to the semantics of the :git option, the :path option requires
+ that the directory in question either contains a .gemspec for the gem,
or that you specify an explicit version that bundler should use.
- Unlike :git, bundler does not compile C extensions for gems specified
+ Unlike :git, bundler does not compile C extensions for gems specified
as paths.
@@ -528,8 +528,8 @@ GEMS
If you would like to use multiple local gems directly from the filesys-
- tem, you can set a global path option to the path containing the gem's
- files. This will automatically load gemspec files from subdirectories.
+ tem, you can set a global path option to the path containing the gem's
+ files. This will automatically load gemspec files from subdirectories.
@@ -597,48 +597,48 @@ INSTALL_IF
GEMSPEC
- The .gemspec http://guides.rubygems.org/specification-reference/ file
+ The .gemspec http://guides.rubygems.org/specification-reference/ file
is where you provide metadata about your gem to Rubygems. Some required
- Gemspec attributes include the name, description, and homepage of your
- gem. This is also where you specify the dependencies your gem needs to
+ Gemspec attributes include the name, description, and homepage of your
+ gem. This is also where you specify the dependencies your gem needs to
run.
If you wish to use Bundler to help install dependencies for a gem while
- it is being developed, use the gemspec method to pull in the dependen-
+ it is being developed, use the gemspec method to pull in the dependen-
cies listed in the .gemspec file.
The gemspec method adds any runtime dependencies as gem requirements in
- the default group. It also adds development dependencies as gem
- requirements in the development group. Finally, it adds a gem require-
+ the default group. It also adds development dependencies as gem
+ requirements in the development group. Finally, it adds a gem require-
ment on your project (:path => '.'). In conjunction with Bundler.setup,
this allows you to require project files in your test code as you would
- if the project were installed as a gem; you need not manipulate the
+ if the project were installed as a gem; you need not manipulate the
load path manually or require project files via relative paths.
The gemspec method supports optional :path, :glob, :name, and :develop-
ment_group options, which control where bundler looks for the .gemspec,
- the glob it uses to look for the gemspec (defaults to: "{,,/*}.gem-
- spec"), what named .gemspec it uses (if more than one is present), and
+ the glob it uses to look for the gemspec (defaults to: "{,,/*}.gem-
+ spec"), what named .gemspec it uses (if more than one is present), and
which group development dependencies are included in.
- When a gemspec dependency encounters version conflicts during resolu-
- tion, the local version under development will always be selected --
- even if there are remote versions that better match other requirements
+ When a gemspec dependency encounters version conflicts during resolu-
+ tion, the local version under development will always be selected --
+ even if there are remote versions that better match other requirements
for the gemspec gem.
SOURCE PRIORITY
- When attempting to locate a gem to satisfy a gem requirement, bundler
+ When attempting to locate a gem to satisfy a gem requirement, bundler
uses the following priority order:
1. The source explicitly attached to the gem (using :source, :path, or
:git)
2. For implicit gems (dependencies of explicit gems), any source, git,
- or path repository declared on the parent. This results in bundler
- prioritizing the ActiveSupport gem from the Rails git repository
+ or path repository declared on the parent. This results in bundler
+ prioritizing the ActiveSupport gem from the Rails git repository
over ones from rubygems.org
- 3. The sources specified via global source lines, searching each
+ 3. The sources specified via global source lines, searching each
source in your Gemfile from last added to first added.
@@ -646,4 +646,4 @@ SOURCE PRIORITY
- September 2019 GEMFILE(5)
+ November 2019 GEMFILE(5)
diff --git a/spec/bundler/bundler/bundler_spec.rb b/spec/bundler/bundler/bundler_spec.rb
index 74cf7ae05d..247838600b 100644
--- a/spec/bundler/bundler/bundler_spec.rb
+++ b/spec/bundler/bundler/bundler_spec.rb
@@ -232,16 +232,13 @@ EOF
path = "/home/oggy"
allow(Bundler.rubygems).to receive(:user_home).and_return(path)
allow(File).to receive(:directory?).with(path).and_return false
- allow(Etc).to receive(:getlogin).and_return("USER")
- allow(Dir).to receive(:tmpdir).and_return("/TMP")
- allow(FileTest).to receive(:exist?).with("/TMP/bundler/home").and_return(true)
- expect(FileUtils).to receive(:mkpath).with("/TMP/bundler/home/USER")
+ allow(Bundler).to receive(:tmp).and_return(Pathname.new("/tmp/trulyrandom"))
message = <<EOF
`/home/oggy` is not a directory.
-Bundler will use `/TMP/bundler/home/USER' as your home directory temporarily.
+Bundler will use `/tmp/trulyrandom' as your home directory temporarily.
EOF
expect(Bundler.ui).to receive(:warn).with(message)
- expect(Bundler.user_home).to eq(Pathname("/TMP/bundler/home/USER"))
+ expect(Bundler.user_home).to eq(Pathname("/tmp/trulyrandom"))
end
end
@@ -254,16 +251,13 @@ EOF
allow(File).to receive(:directory?).with(path).and_return true
allow(File).to receive(:writable?).with(path).and_return false
allow(File).to receive(:directory?).with(dotbundle).and_return false
- allow(Etc).to receive(:getlogin).and_return("USER")
- allow(Dir).to receive(:tmpdir).and_return("/TMP")
- allow(FileTest).to receive(:exist?).with("/TMP/bundler/home").and_return(true)
- expect(FileUtils).to receive(:mkpath).with("/TMP/bundler/home/USER")
+ allow(Bundler).to receive(:tmp).and_return(Pathname.new("/tmp/trulyrandom"))
message = <<EOF
`/home/oggy` is not writable.
-Bundler will use `/TMP/bundler/home/USER' as your home directory temporarily.
+Bundler will use `/tmp/trulyrandom' as your home directory temporarily.
EOF
expect(Bundler.ui).to receive(:warn).with(message)
- expect(Bundler.user_home).to eq(Pathname("/TMP/bundler/home/USER"))
+ expect(Bundler.user_home).to eq(Pathname("/tmp/trulyrandom"))
end
context ".bundle exists and have correct permissions" do
@@ -282,31 +276,17 @@ EOF
context "home directory is not set" do
it "should issue warning and return a temporary user home" do
allow(Bundler.rubygems).to receive(:user_home).and_return(nil)
- allow(Etc).to receive(:getlogin).and_return("USER")
- allow(Dir).to receive(:tmpdir).and_return("/TMP")
- allow(FileTest).to receive(:exist?).with("/TMP/bundler/home").and_return(true)
- expect(FileUtils).to receive(:mkpath).with("/TMP/bundler/home/USER")
+ allow(Bundler).to receive(:tmp).and_return(Pathname.new("/tmp/trulyrandom"))
message = <<EOF
Your home directory is not set.
-Bundler will use `/TMP/bundler/home/USER' as your home directory temporarily.
+Bundler will use `/tmp/trulyrandom' as your home directory temporarily.
EOF
expect(Bundler.ui).to receive(:warn).with(message)
- expect(Bundler.user_home).to eq(Pathname("/TMP/bundler/home/USER"))
+ expect(Bundler.user_home).to eq(Pathname("/tmp/trulyrandom"))
end
end
end
- describe "#tmp_home_path" do
- it "should create temporary user home" do
- allow(Dir).to receive(:tmpdir).and_return("/TMP")
- allow(FileTest).to receive(:exist?).with("/TMP/bundler/home").and_return(false)
- expect(FileUtils).to receive(:mkpath).once.ordered.with("/TMP/bundler/home")
- expect(FileUtils).to receive(:mkpath).once.ordered.with("/TMP/bundler/home/USER")
- expect(File).to receive(:chmod).with(0o777, "/TMP/bundler/home")
- expect(Bundler.tmp_home_path("USER", "")).to eq(Pathname("/TMP/bundler/home/USER"))
- end
- end
-
describe "#requires_sudo?" do
let!(:tmpdir) { Dir.mktmpdir }
let(:bundle_path) { Pathname("#{tmpdir}/bundle") }
diff --git a/spec/bundler/bundler/cli_spec.rb b/spec/bundler/bundler/cli_spec.rb
index 02e5155733..ddcd699d6c 100644
--- a/spec/bundler/bundler/cli_spec.rb
+++ b/spec/bundler/bundler/cli_spec.rb
@@ -27,6 +27,56 @@ RSpec.describe "bundle executable" do
expect(out).to eq("Hello, world")
end
+ describe "aliases" do
+ it "aliases e to exec" do
+ bundle "e --help"
+
+ expect(out).to include("BUNDLE-EXEC")
+ end
+
+ it "aliases ex to exec" do
+ bundle "ex --help"
+
+ expect(out).to include("BUNDLE-EXEC")
+ end
+
+ it "aliases exe to exec" do
+ bundle "exe --help"
+
+ expect(out).to include("BUNDLE-EXEC")
+ end
+
+ it "aliases c to check" do
+ bundle "c --help"
+
+ expect(out).to include("BUNDLE-CHECK")
+ end
+
+ it "aliases i to install" do
+ bundle "i --help"
+
+ expect(out).to include("BUNDLE-INSTALL")
+ end
+
+ it "aliases ls to list" do
+ bundle "ls --help"
+
+ expect(out).to include("BUNDLE-LIST")
+ end
+
+ it "aliases package to cache" do
+ bundle "package --help"
+
+ expect(out).to include("BUNDLE-CACHE")
+ end
+
+ it "aliases pack to cache" do
+ bundle "pack --help"
+
+ expect(out).to include("BUNDLE-CACHE")
+ end
+ end
+
context "with no arguments" do
it "prints a concise help message", :bundler => "3" do
bundle! ""
diff --git a/spec/bundler/bundler/friendly_errors_spec.rb b/spec/bundler/bundler/friendly_errors_spec.rb
index 858831c448..47e7a5d3cd 100644
--- a/spec/bundler/bundler/friendly_errors_spec.rb
+++ b/spec/bundler/bundler/friendly_errors_spec.rb
@@ -94,7 +94,7 @@ RSpec.describe Bundler, "friendly errors" do
end
it "writes to Bundler.ui.trace" do
- expect(Bundler.ui).to receive(:trace).with(orig_error, nil, true)
+ expect(Bundler.ui).to receive(:trace).with(orig_error)
Bundler::FriendlyErrors.log_error(error)
end
end
diff --git a/spec/bundler/bundler/plugin_spec.rb b/spec/bundler/bundler/plugin_spec.rb
index eaa0b80905..e0e2e9afdf 100644
--- a/spec/bundler/bundler/plugin_spec.rb
+++ b/spec/bundler/bundler/plugin_spec.rb
@@ -1,5 +1,7 @@
# frozen_string_literal: true
+require_relative "../support/streams"
+
RSpec.describe Bundler::Plugin do
Plugin = Bundler::Plugin
diff --git a/spec/bundler/bundler/ruby_version_spec.rb b/spec/bundler/bundler/ruby_version_spec.rb
index 868d81088d..8c6c071d7f 100644
--- a/spec/bundler/bundler/ruby_version_spec.rb
+++ b/spec/bundler/bundler/ruby_version_spec.rb
@@ -400,12 +400,20 @@ RSpec.describe "Bundler::RubyVersion and its subclasses" do
let(:bundler_system_ruby_version) { subject }
around do |example|
- begin
- old_ruby_version = Bundler::RubyVersion.instance_variable_get("@ruby_version")
- Bundler::RubyVersion.instance_variable_set("@ruby_version", nil)
- example.run
- ensure
- Bundler::RubyVersion.instance_variable_set("@ruby_version", old_ruby_version)
+ if Bundler::RubyVersion.instance_variable_defined?("@ruby_version")
+ begin
+ old_ruby_version = Bundler::RubyVersion.instance_variable_get("@ruby_version")
+ Bundler::RubyVersion.remove_instance_variable("@ruby_version")
+ example.run
+ ensure
+ Bundler::RubyVersion.instance_variable_set("@ruby_version", old_ruby_version)
+ end
+ else
+ begin
+ example.run
+ ensure
+ Bundler::RubyVersion.remove_instance_variable("@ruby_version")
+ end
end
end
diff --git a/spec/bundler/bundler/settings_spec.rb b/spec/bundler/bundler/settings_spec.rb
index 7e1dadded7..2a285fdcf3 100644
--- a/spec/bundler/bundler/settings_spec.rb
+++ b/spec/bundler/bundler/settings_spec.rb
@@ -67,7 +67,7 @@ that would suck --ehhh=oh geez it looks like i might have broken bundler somehow
context "when $TMPDIR is not writable" do
it "does not raise" do
expect(Bundler.rubygems).to receive(:user_home).twice.and_return(nil)
- expect(FileUtils).to receive(:mkpath).twice.with(File.join(Dir.tmpdir, "bundler", "home")).and_raise(Errno::EROFS, "Read-only file system @ dir_s_mkdir - /tmp/bundler")
+ expect(Bundler).to receive(:tmp).twice.and_raise(Errno::EROFS, "Read-only file system @ dir_s_mkdir - /tmp/bundler")
expect(subject.send(:global_config_file)).to be_nil
end
diff --git a/spec/bundler/bundler/shared_helpers_spec.rb b/spec/bundler/bundler/shared_helpers_spec.rb
index 0340cb7bae..4530a9a5cd 100644
--- a/spec/bundler/bundler/shared_helpers_spec.rb
+++ b/spec/bundler/bundler/shared_helpers_spec.rb
@@ -236,7 +236,7 @@ RSpec.describe Bundler::SharedHelpers do
shared_examples_for "ENV['RUBYOPT'] gets set correctly" do
it "ensures -rbundler/setup is at the beginning of ENV['RUBYOPT']" do
subject.set_bundle_environment
- expect(ENV["RUBYOPT"].split(" ")).to start_with("-r#{lib}/bundler/setup")
+ expect(ENV["RUBYOPT"].split(" ")).to start_with("-r#{lib_dir}/bundler/setup")
end
end
diff --git a/spec/bundler/bundler/source_spec.rb b/spec/bundler/bundler/source_spec.rb
index 5b11503d23..0c35c27fdf 100644
--- a/spec/bundler/bundler/source_spec.rb
+++ b/spec/bundler/bundler/source_spec.rb
@@ -59,7 +59,6 @@ RSpec.describe Bundler::Source do
context "with color", :no_color_tty do
before do
allow($stdout).to receive(:tty?).and_return(true)
- Bundler.ui = Bundler::UI::Shell.new
end
it "should return a string with the spec name and version and locked spec version" do
@@ -68,7 +67,11 @@ RSpec.describe Bundler::Source do
end
context "without color" do
- before { Bundler.ui = Bundler::UI::Shell.new("no-color" => true) }
+ around do |example|
+ with_ui(Bundler::UI::Shell.new("no-color" => true)) do
+ example.run
+ end
+ end
it "should return a string with the spec name and version and locked spec version" do
expect(subject.version_message(spec)).to eq("nokogiri >= 1.6 (was < 1.5)")
@@ -83,7 +86,6 @@ RSpec.describe Bundler::Source do
context "with color", :no_color_tty do
before do
allow($stdout).to receive(:tty?).and_return(true)
- Bundler.ui = Bundler::UI::Shell.new
end
it "should return a string with the locked spec version in yellow" do
@@ -92,7 +94,11 @@ RSpec.describe Bundler::Source do
end
context "without color" do
- before { Bundler.ui = Bundler::UI::Shell.new("no-color" => true) }
+ around do |example|
+ with_ui(Bundler::UI::Shell.new("no-color" => true)) do
+ example.run
+ end
+ end
it "should return a string with the locked spec version in yellow" do
expect(subject.version_message(spec)).to eq("nokogiri 1.6.1 (was 1.7.0)")
@@ -107,7 +113,6 @@ RSpec.describe Bundler::Source do
context "with color", :no_color_tty do
before do
allow($stdout).to receive(:tty?).and_return(true)
- Bundler.ui = Bundler::UI::Shell.new
end
it "should return a string with the locked spec version in green" do
@@ -116,7 +121,11 @@ RSpec.describe Bundler::Source do
end
context "without color" do
- before { Bundler.ui = Bundler::UI::Shell.new("no-color" => true) }
+ around do |example|
+ with_ui(Bundler::UI::Shell.new("no-color" => true)) do
+ example.run
+ end
+ end
it "should return a string with the locked spec version in yellow" do
expect(subject.version_message(spec)).to eq("nokogiri 1.7.1 (was 1.7.0)")
@@ -178,4 +187,14 @@ RSpec.describe Bundler::Source do
end
end
end
+
+private
+
+ def with_ui(ui)
+ old_ui = Bundler.ui
+ Bundler.ui = ui
+ yield
+ ensure
+ Bundler.ui = old_ui
+ end
end
diff --git a/spec/bundler/bundler/ui/shell_spec.rb b/spec/bundler/bundler/ui/shell_spec.rb
index 632477096e..536014c6aa 100644
--- a/spec/bundler/bundler/ui/shell_spec.rb
+++ b/spec/bundler/bundler/ui/shell_spec.rb
@@ -1,5 +1,7 @@
# frozen_string_literal: true
+require_relative "../../support/streams"
+
RSpec.describe Bundler::UI::Shell do
subject { described_class.new }
diff --git a/spec/bundler/cache/cache_path_spec.rb b/spec/bundler/cache/cache_path_spec.rb
index 1a61494130..12385427b1 100644
--- a/spec/bundler/cache/cache_path_spec.rb
+++ b/spec/bundler/cache/cache_path_spec.rb
@@ -10,7 +10,7 @@ RSpec.describe "bundle package" do
context "with --cache-path" do
it "caches gems at given path" do
- bundle :package, "cache-path" => "vendor/cache-foo"
+ bundle :cache, "cache-path" => "vendor/cache-foo"
expect(bundled_app("vendor/cache-foo/rack-1.0.0.gem")).to exist
end
end
@@ -18,14 +18,14 @@ RSpec.describe "bundle package" do
context "with config cache_path" do
it "caches gems at given path" do
bundle "config set cache_path vendor/cache-foo"
- bundle :package
+ bundle :cache
expect(bundled_app("vendor/cache-foo/rack-1.0.0.gem")).to exist
end
end
context "with absolute --cache-path" do
it "caches gems at given path" do
- bundle :package, "cache-path" => "/tmp/cache-foo"
+ bundle :cache, "cache-path" => "/tmp/cache-foo"
expect(bundled_app("/tmp/cache-foo/rack-1.0.0.gem")).to exist
end
end
diff --git a/spec/bundler/cache/git_spec.rb b/spec/bundler/cache/git_spec.rb
index 1cb278e912..75525d405b 100644
--- a/spec/bundler/cache/git_spec.rb
+++ b/spec/bundler/cache/git_spec.rb
@@ -12,230 +12,228 @@ RSpec.describe "git base name" do
end
end
-%w[cache package].each do |cmd|
- RSpec.describe "bundle #{cmd} with git" do
- it "copies repository to vendor cache and uses it" do
- git = build_git "foo"
- ref = git.ref_for("master", 11)
-
- install_gemfile <<-G
- gem "foo", :git => '#{lib_path("foo-1.0")}'
- G
-
- bundle "config set cache_all true"
- bundle cmd
- expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).to exist
- expect(bundled_app("vendor/cache/foo-1.0-#{ref}/.git")).not_to exist
- expect(bundled_app("vendor/cache/foo-1.0-#{ref}/.bundlecache")).to be_file
-
- FileUtils.rm_rf lib_path("foo-1.0")
- expect(the_bundle).to include_gems "foo 1.0"
- end
-
- it "copies repository to vendor cache and uses it even when installed with bundle --path" do
- git = build_git "foo"
- ref = git.ref_for("master", 11)
+RSpec.describe "bundle cache with git" do
+ it "copies repository to vendor cache and uses it" do
+ git = build_git "foo"
+ ref = git.ref_for("master", 11)
+
+ install_gemfile <<-G
+ gem "foo", :git => '#{lib_path("foo-1.0")}'
+ G
+
+ bundle "config set cache_all true"
+ bundle :cache
+ expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).to exist
+ expect(bundled_app("vendor/cache/foo-1.0-#{ref}/.git")).not_to exist
+ expect(bundled_app("vendor/cache/foo-1.0-#{ref}/.bundlecache")).to be_file
+
+ FileUtils.rm_rf lib_path("foo-1.0")
+ expect(the_bundle).to include_gems "foo 1.0"
+ end
- install_gemfile <<-G
- gem "foo", :git => '#{lib_path("foo-1.0")}'
- G
+ it "copies repository to vendor cache and uses it even when installed with bundle --path" do
+ git = build_git "foo"
+ ref = git.ref_for("master", 11)
- bundle "install --path vendor/bundle"
- bundle "config set cache_all true"
- bundle cmd
+ install_gemfile <<-G
+ gem "foo", :git => '#{lib_path("foo-1.0")}'
+ G
- expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).to exist
- expect(bundled_app("vendor/cache/foo-1.0-#{ref}/.git")).not_to exist
+ bundle "install --path vendor/bundle"
+ bundle "config set cache_all true"
+ bundle :cache
- FileUtils.rm_rf lib_path("foo-1.0")
- expect(the_bundle).to include_gems "foo 1.0"
- end
+ expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).to exist
+ expect(bundled_app("vendor/cache/foo-1.0-#{ref}/.git")).not_to exist
- it "runs twice without exploding" do
- build_git "foo"
+ FileUtils.rm_rf lib_path("foo-1.0")
+ expect(the_bundle).to include_gems "foo 1.0"
+ end
- install_gemfile! <<-G
- gem "foo", :git => '#{lib_path("foo-1.0")}'
- G
+ it "runs twice without exploding" do
+ build_git "foo"
- bundle "config set cache_all true"
- bundle! cmd
- bundle! cmd
+ install_gemfile! <<-G
+ gem "foo", :git => '#{lib_path("foo-1.0")}'
+ G
- expect(out).to include "Updating files in vendor/cache"
- FileUtils.rm_rf lib_path("foo-1.0")
- expect(the_bundle).to include_gems "foo 1.0"
- end
+ bundle "config set cache_all true"
+ bundle! :cache
+ bundle! :cache
- it "tracks updates" do
- git = build_git "foo"
- old_ref = git.ref_for("master", 11)
+ expect(out).to include "Updating files in vendor/cache"
+ FileUtils.rm_rf lib_path("foo-1.0")
+ expect(the_bundle).to include_gems "foo 1.0"
+ end
- install_gemfile <<-G
- gem "foo", :git => '#{lib_path("foo-1.0")}'
- G
+ it "tracks updates" do
+ git = build_git "foo"
+ old_ref = git.ref_for("master", 11)
- bundle "config set cache_all true"
- bundle cmd
+ install_gemfile <<-G
+ gem "foo", :git => '#{lib_path("foo-1.0")}'
+ G
- update_git "foo" do |s|
- s.write "lib/foo.rb", "puts :CACHE"
- end
+ bundle "config set cache_all true"
+ bundle :cache
- ref = git.ref_for("master", 11)
- expect(ref).not_to eq(old_ref)
+ update_git "foo" do |s|
+ s.write "lib/foo.rb", "puts :CACHE"
+ end
- bundle! "update", :all => true
- bundle "config set cache_all true"
- bundle! cmd
+ ref = git.ref_for("master", 11)
+ expect(ref).not_to eq(old_ref)
- expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).to exist
- expect(bundled_app("vendor/cache/foo-1.0-#{old_ref}")).not_to exist
+ bundle! "update", :all => true
+ bundle "config set cache_all true"
+ bundle! :cache
- FileUtils.rm_rf lib_path("foo-1.0")
- run! "require 'foo'"
- expect(out).to eq("CACHE")
- end
+ expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).to exist
+ expect(bundled_app("vendor/cache/foo-1.0-#{old_ref}")).not_to exist
- it "tracks updates when specifying the gem" do
- git = build_git "foo"
- old_ref = git.ref_for("master", 11)
+ FileUtils.rm_rf lib_path("foo-1.0")
+ run! "require 'foo'"
+ expect(out).to eq("CACHE")
+ end
- install_gemfile <<-G
- gem "foo", :git => '#{lib_path("foo-1.0")}'
- G
+ it "tracks updates when specifying the gem" do
+ git = build_git "foo"
+ old_ref = git.ref_for("master", 11)
- bundle "config set cache_all true"
- bundle! cmd
+ install_gemfile <<-G
+ gem "foo", :git => '#{lib_path("foo-1.0")}'
+ G
- update_git "foo" do |s|
- s.write "lib/foo.rb", "puts :CACHE"
- end
+ bundle "config set cache_all true"
+ bundle! :cache
- ref = git.ref_for("master", 11)
- expect(ref).not_to eq(old_ref)
+ update_git "foo" do |s|
+ s.write "lib/foo.rb", "puts :CACHE"
+ end
- bundle "update foo"
+ ref = git.ref_for("master", 11)
+ expect(ref).not_to eq(old_ref)
- expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).to exist
- expect(bundled_app("vendor/cache/foo-1.0-#{old_ref}")).not_to exist
+ bundle "update foo"
- FileUtils.rm_rf lib_path("foo-1.0")
- run "require 'foo'"
- expect(out).to eq("CACHE")
- end
+ expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).to exist
+ expect(bundled_app("vendor/cache/foo-1.0-#{old_ref}")).not_to exist
- it "uses the local repository to generate the cache" do
- git = build_git "foo"
- ref = git.ref_for("master", 11)
+ FileUtils.rm_rf lib_path("foo-1.0")
+ run "require 'foo'"
+ expect(out).to eq("CACHE")
+ end
- gemfile <<-G
- gem "foo", :git => '#{lib_path("foo-invalid")}', :branch => :master
- G
+ it "uses the local repository to generate the cache" do
+ git = build_git "foo"
+ ref = git.ref_for("master", 11)
- bundle %(config set local.foo #{lib_path("foo-1.0")})
- bundle "install"
- bundle "config set cache_all true"
- bundle cmd
+ gemfile <<-G
+ gem "foo", :git => '#{lib_path("foo-invalid")}', :branch => :master
+ G
- expect(bundled_app("vendor/cache/foo-invalid-#{ref}")).to exist
+ bundle %(config set local.foo #{lib_path("foo-1.0")})
+ bundle "install"
+ bundle "config set cache_all true"
+ bundle :cache
- # Updating the local still uses the local.
- update_git "foo" do |s|
- s.write "lib/foo.rb", "puts :LOCAL"
- end
+ expect(bundled_app("vendor/cache/foo-invalid-#{ref}")).to exist
- run "require 'foo'"
- expect(out).to eq("LOCAL")
+ # Updating the local still uses the local.
+ update_git "foo" do |s|
+ s.write "lib/foo.rb", "puts :LOCAL"
end
- it "copies repository to vendor cache, including submodules" do
- build_git "submodule", "1.0"
+ run "require 'foo'"
+ expect(out).to eq("LOCAL")
+ end
- git = build_git "has_submodule", "1.0" do |s|
- s.add_dependency "submodule"
- end
+ it "copies repository to vendor cache, including submodules" do
+ build_git "submodule", "1.0"
- Dir.chdir(lib_path("has_submodule-1.0")) do
- sys_exec "git submodule add #{lib_path("submodule-1.0")} submodule-1.0"
- `git commit -m "submodulator"`
- end
+ git = build_git "has_submodule", "1.0" do |s|
+ s.add_dependency "submodule"
+ end
- install_gemfile <<-G
- git "#{lib_path("has_submodule-1.0")}", :submodules => true do
- gem "has_submodule"
- end
- G
+ Dir.chdir(lib_path("has_submodule-1.0")) do
+ sys_exec "git submodule add #{lib_path("submodule-1.0")} submodule-1.0"
+ `git commit -m "submodulator"`
+ end
+
+ install_gemfile <<-G
+ git "#{lib_path("has_submodule-1.0")}", :submodules => true do
+ gem "has_submodule"
+ end
+ G
- ref = git.ref_for("master", 11)
- bundle "config set cache_all true"
- bundle cmd
+ ref = git.ref_for("master", 11)
+ bundle "config set cache_all true"
+ bundle :cache
- expect(bundled_app("vendor/cache/has_submodule-1.0-#{ref}")).to exist
- expect(bundled_app("vendor/cache/has_submodule-1.0-#{ref}/submodule-1.0")).to exist
- expect(the_bundle).to include_gems "has_submodule 1.0"
- end
+ expect(bundled_app("vendor/cache/has_submodule-1.0-#{ref}")).to exist
+ expect(bundled_app("vendor/cache/has_submodule-1.0-#{ref}/submodule-1.0")).to exist
+ expect(the_bundle).to include_gems "has_submodule 1.0"
+ end
- it "displays warning message when detecting git repo in Gemfile", :bundler => "< 3" do
- build_git "foo"
+ it "displays warning message when detecting git repo in Gemfile", :bundler => "< 3" do
+ build_git "foo"
- install_gemfile <<-G
- gem "foo", :git => '#{lib_path("foo-1.0")}'
- G
+ install_gemfile <<-G
+ gem "foo", :git => '#{lib_path("foo-1.0")}'
+ G
- bundle cmd
+ bundle :cache
- expect(err).to include("Your Gemfile contains path and git dependencies.")
- end
+ expect(err).to include("Your Gemfile contains path and git dependencies.")
+ end
- it "does not display warning message if cache_all is set in bundle config" do
- build_git "foo"
+ it "does not display warning message if cache_all is set in bundle config" do
+ build_git "foo"
- install_gemfile <<-G
- gem "foo", :git => '#{lib_path("foo-1.0")}'
- G
+ install_gemfile <<-G
+ gem "foo", :git => '#{lib_path("foo-1.0")}'
+ G
- bundle "config set cache_all true"
- bundle cmd
- bundle cmd
+ bundle "config set cache_all true"
+ bundle :cache
+ bundle :cache
- expect(err).not_to include("Your Gemfile contains path and git dependencies.")
- end
+ expect(err).not_to include("Your Gemfile contains path and git dependencies.")
+ end
- it "caches pre-evaluated gemspecs" do
- git = build_git "foo"
+ it "caches pre-evaluated gemspecs" do
+ git = build_git "foo"
- # Insert a gemspec method that shells out
- spec_lines = lib_path("foo-1.0/foo.gemspec").read.split("\n")
- spec_lines.insert(-2, "s.description = `echo bob`")
- update_git("foo") {|s| s.write "foo.gemspec", spec_lines.join("\n") }
+ # Insert a gemspec method that shells out
+ spec_lines = lib_path("foo-1.0/foo.gemspec").read.split("\n")
+ spec_lines.insert(-2, "s.description = `echo bob`")
+ update_git("foo") {|s| s.write "foo.gemspec", spec_lines.join("\n") }
- install_gemfile <<-G
- gem "foo", :git => '#{lib_path("foo-1.0")}'
- G
- bundle "config set cache_all true"
- bundle cmd
+ install_gemfile <<-G
+ gem "foo", :git => '#{lib_path("foo-1.0")}'
+ G
+ bundle "config set cache_all true"
+ bundle :cache
- ref = git.ref_for("master", 11)
- gemspec = bundled_app("vendor/cache/foo-1.0-#{ref}/foo.gemspec").read
- expect(gemspec).to_not match("`echo bob`")
- end
+ ref = git.ref_for("master", 11)
+ gemspec = bundled_app("vendor/cache/foo-1.0-#{ref}/foo.gemspec").read
+ expect(gemspec).to_not match("`echo bob`")
+ end
- it "can install after #{cmd} with git not installed" do
- build_git "foo"
+ it "can install after bundle cache with git not installed" do
+ build_git "foo"
- gemfile <<-G
- gem "foo", :git => '#{lib_path("foo-1.0")}'
- G
- bundle! "config set cache_all true"
- bundle! cmd, "all-platforms" => true, :install => false, :path => "./vendor/cache"
+ gemfile <<-G
+ gem "foo", :git => '#{lib_path("foo-1.0")}'
+ G
+ bundle! "config set cache_all true"
+ bundle! :cache, "all-platforms" => true, :install => false, :path => "./vendor/cache"
- simulate_new_machine
- with_path_as "" do
- bundle! "config set deployment true"
- bundle! :install, :local => true
- expect(the_bundle).to include_gem "foo 1.0"
- end
+ simulate_new_machine
+ with_path_as "" do
+ bundle! "config set deployment true"
+ bundle! :install, :local => true
+ expect(the_bundle).to include_gem "foo 1.0"
end
end
end
diff --git a/spec/bundler/cache/path_spec.rb b/spec/bundler/cache/path_spec.rb
index 3bbd7b1805..79e8b4a82b 100644
--- a/spec/bundler/cache/path_spec.rb
+++ b/spec/bundler/cache/path_spec.rb
@@ -1,146 +1,144 @@
# frozen_string_literal: true
-%w[cache package].each do |cmd|
- RSpec.describe "bundle #{cmd} with path" do
- it "is no-op when the path is within the bundle" do
- build_lib "foo", :path => bundled_app("lib/foo")
-
- install_gemfile <<-G
- gem "foo", :path => '#{bundled_app("lib/foo")}'
- G
-
- bundle "config set cache_all true"
- bundle cmd
- expect(bundled_app("vendor/cache/foo-1.0")).not_to exist
- expect(the_bundle).to include_gems "foo 1.0"
- end
+RSpec.describe "bundle cache with path" do
+ it "is no-op when the path is within the bundle" do
+ build_lib "foo", :path => bundled_app("lib/foo")
+
+ install_gemfile <<-G
+ gem "foo", :path => '#{bundled_app("lib/foo")}'
+ G
+
+ bundle "config set cache_all true"
+ bundle :cache
+ expect(bundled_app("vendor/cache/foo-1.0")).not_to exist
+ expect(the_bundle).to include_gems "foo 1.0"
+ end
- it "copies when the path is outside the bundle " do
- build_lib "foo"
+ it "copies when the path is outside the bundle " do
+ build_lib "foo"
- install_gemfile <<-G
- gem "foo", :path => '#{lib_path("foo-1.0")}'
- G
+ install_gemfile <<-G
+ gem "foo", :path => '#{lib_path("foo-1.0")}'
+ G
- bundle "config set cache_all true"
- bundle cmd
- expect(bundled_app("vendor/cache/foo-1.0")).to exist
- expect(bundled_app("vendor/cache/foo-1.0/.bundlecache")).to be_file
+ bundle "config set cache_all true"
+ bundle :cache
+ expect(bundled_app("vendor/cache/foo-1.0")).to exist
+ expect(bundled_app("vendor/cache/foo-1.0/.bundlecache")).to be_file
- FileUtils.rm_rf lib_path("foo-1.0")
- expect(the_bundle).to include_gems "foo 1.0"
- end
+ FileUtils.rm_rf lib_path("foo-1.0")
+ expect(the_bundle).to include_gems "foo 1.0"
+ end
- it "copies when the path is outside the bundle and the paths intersect" do
- libname = File.basename(Dir.pwd) + "_gem"
- libpath = File.join(File.dirname(Dir.pwd), libname)
+ it "copies when the path is outside the bundle and the paths intersect" do
+ libname = File.basename(Dir.pwd) + "_gem"
+ libpath = File.join(File.dirname(Dir.pwd), libname)
- build_lib libname, :path => libpath
+ build_lib libname, :path => libpath
- install_gemfile <<-G
- gem "#{libname}", :path => '#{libpath}'
- G
+ install_gemfile <<-G
+ gem "#{libname}", :path => '#{libpath}'
+ G
- bundle "config set cache_all true"
- bundle cmd
- expect(bundled_app("vendor/cache/#{libname}")).to exist
- expect(bundled_app("vendor/cache/#{libname}/.bundlecache")).to be_file
+ bundle "config set cache_all true"
+ bundle :cache
+ expect(bundled_app("vendor/cache/#{libname}")).to exist
+ expect(bundled_app("vendor/cache/#{libname}/.bundlecache")).to be_file
- FileUtils.rm_rf libpath
- expect(the_bundle).to include_gems "#{libname} 1.0"
- end
+ FileUtils.rm_rf libpath
+ expect(the_bundle).to include_gems "#{libname} 1.0"
+ end
- it "updates the path on each cache" do
- build_lib "foo"
+ it "updates the path on each cache" do
+ build_lib "foo"
- install_gemfile <<-G
- gem "foo", :path => '#{lib_path("foo-1.0")}'
- G
+ install_gemfile <<-G
+ gem "foo", :path => '#{lib_path("foo-1.0")}'
+ G
- bundle "config set cache_all true"
- bundle cmd
+ bundle "config set cache_all true"
+ bundle :cache
- build_lib "foo" do |s|
- s.write "lib/foo.rb", "puts :CACHE"
- end
+ build_lib "foo" do |s|
+ s.write "lib/foo.rb", "puts :CACHE"
+ end
- bundle cmd
+ bundle :cache
- expect(bundled_app("vendor/cache/foo-1.0")).to exist
- FileUtils.rm_rf lib_path("foo-1.0")
+ expect(bundled_app("vendor/cache/foo-1.0")).to exist
+ FileUtils.rm_rf lib_path("foo-1.0")
- run "require 'foo'"
- expect(out).to eq("CACHE")
- end
+ run "require 'foo'"
+ expect(out).to eq("CACHE")
+ end
- it "removes stale entries cache" do
- build_lib "foo"
+ it "removes stale entries cache" do
+ build_lib "foo"
- install_gemfile <<-G
- gem "foo", :path => '#{lib_path("foo-1.0")}'
- G
+ install_gemfile <<-G
+ gem "foo", :path => '#{lib_path("foo-1.0")}'
+ G
- bundle "config set cache_all true"
- bundle cmd
+ bundle "config set cache_all true"
+ bundle :cache
- install_gemfile <<-G
- gem "bar", :path => '#{lib_path("bar-1.0")}'
- G
+ install_gemfile <<-G
+ gem "bar", :path => '#{lib_path("bar-1.0")}'
+ G
- bundle cmd
- expect(bundled_app("vendor/cache/bar-1.0")).not_to exist
- end
+ bundle :cache
+ expect(bundled_app("vendor/cache/bar-1.0")).not_to exist
+ end
- it "raises a warning without --all", :bundler => "< 3" do
- build_lib "foo"
+ it "raises a warning without --all", :bundler => "< 3" do
+ build_lib "foo"
- install_gemfile <<-G
- gem "foo", :path => '#{lib_path("foo-1.0")}'
- G
+ install_gemfile <<-G
+ gem "foo", :path => '#{lib_path("foo-1.0")}'
+ G
- bundle cmd
- expect(err).to match(/please pass the \-\-all flag/)
- expect(bundled_app("vendor/cache/foo-1.0")).not_to exist
- end
+ bundle :cache
+ expect(err).to match(/please pass the \-\-all flag/)
+ expect(bundled_app("vendor/cache/foo-1.0")).not_to exist
+ end
- it "stores the given flag" do
- build_lib "foo"
+ it "stores the given flag" do
+ build_lib "foo"
- install_gemfile <<-G
- gem "foo", :path => '#{lib_path("foo-1.0")}'
- G
+ install_gemfile <<-G
+ gem "foo", :path => '#{lib_path("foo-1.0")}'
+ G
- bundle "config set cache_all true"
- bundle cmd
- build_lib "bar"
+ bundle "config set cache_all true"
+ bundle :cache
+ build_lib "bar"
- install_gemfile <<-G
- gem "foo", :path => '#{lib_path("foo-1.0")}'
- gem "bar", :path => '#{lib_path("bar-1.0")}'
- G
+ install_gemfile <<-G
+ gem "foo", :path => '#{lib_path("foo-1.0")}'
+ gem "bar", :path => '#{lib_path("bar-1.0")}'
+ G
- bundle cmd
- expect(bundled_app("vendor/cache/bar-1.0")).to exist
- end
+ bundle :cache
+ expect(bundled_app("vendor/cache/bar-1.0")).to exist
+ end
- it "can rewind chosen configuration" do
- build_lib "foo"
+ it "can rewind chosen configuration" do
+ build_lib "foo"
- install_gemfile <<-G
- gem "foo", :path => '#{lib_path("foo-1.0")}'
- G
+ install_gemfile <<-G
+ gem "foo", :path => '#{lib_path("foo-1.0")}'
+ G
- bundle "config set cache_all true"
- bundle cmd
- build_lib "baz"
+ bundle "config set cache_all true"
+ bundle :cache
+ build_lib "baz"
- gemfile <<-G
- gem "foo", :path => '#{lib_path("foo-1.0")}'
- gem "baz", :path => '#{lib_path("baz-1.0")}'
- G
+ gemfile <<-G
+ gem "foo", :path => '#{lib_path("foo-1.0")}'
+ gem "baz", :path => '#{lib_path("baz-1.0")}'
+ G
- bundle "#{cmd} --no-all"
- expect(bundled_app("vendor/cache/baz-1.0")).not_to exist
- end
+ bundle "cache --no-all"
+ expect(bundled_app("vendor/cache/baz-1.0")).not_to exist
end
end
diff --git a/spec/bundler/commands/add_spec.rb b/spec/bundler/commands/add_spec.rb
index fdfca5d8f2..35fd43d3d2 100644
--- a/spec/bundler/commands/add_spec.rb
+++ b/spec/bundler/commands/add_spec.rb
@@ -239,4 +239,13 @@ RSpec.describe "bundle add" do
expect(err).not_to include("You may also need to change the version requirement specified in the Gemfile if it's too restrictive")
end
end
+
+ describe "when a gem is added and cache exists" do
+ it "caches all new dependencies added for the specified gem" do
+ bundle! :cache
+
+ bundle "add 'rack' --version=1.0.0"
+ expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
+ end
+ end
end
diff --git a/spec/bundler/commands/package_spec.rb b/spec/bundler/commands/cache_spec.rb
index da22c002eb..07ec186c2f 100644
--- a/spec/bundler/commands/package_spec.rb
+++ b/spec/bundler/commands/cache_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe "bundle package" do
+RSpec.describe "bundle cache" do
context "with --gemfile" do
it "finds the gemfile" do
gemfile bundled_app("NotGemfile"), <<-G
@@ -8,7 +8,7 @@ RSpec.describe "bundle package" do
gem 'rack'
G
- bundle "package --gemfile=NotGemfile"
+ bundle "cache --gemfile=NotGemfile"
ENV["BUNDLE_GEMFILE"] = "NotGemfile"
expect(the_bundle).to include_gems "rack 1.0.0"
@@ -25,7 +25,7 @@ RSpec.describe "bundle package" do
D
bundle "config set cache_all true"
- bundle :package
+ bundle :cache
expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
expect(bundled_app("vendor/cache/bundler-0.9.gem")).to_not exist
@@ -56,7 +56,7 @@ RSpec.describe "bundle package" do
D
bundle "config set cache_all true"
- bundle! :package
+ bundle! :cache
expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
expect(bundled_app("vendor/cache/nokogiri-1.4.2.gem")).to exist
@@ -88,7 +88,7 @@ RSpec.describe "bundle package" do
D
bundle "config set cache_all true"
- bundle! :package
+ bundle! :cache
expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
expect(bundled_app("vendor/cache/nokogiri-1.4.2.gem")).to exist
@@ -133,7 +133,7 @@ RSpec.describe "bundle package" do
D
bundle "config set cache_all true"
- bundle! :package
+ bundle! :cache
expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
expect(bundled_app("vendor/cache/nokogiri-1.4.2.gem")).to exist
@@ -152,7 +152,7 @@ RSpec.describe "bundle package" do
gem 'rack'
D
- bundle! :package, forgotten_command_line_options(:path => bundled_app("test"))
+ bundle! :cache, forgotten_command_line_options(:path => bundled_app("test"))
expect(the_bundle).to include_gems "rack 1.0.0"
expect(bundled_app("test/vendor/cache/")).to exist
@@ -166,7 +166,7 @@ RSpec.describe "bundle package" do
gem 'rack'
D
- bundle! "package --no-install"
+ bundle! "cache --no-install"
expect(the_bundle).not_to include_gems "rack 1.0.0"
expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
@@ -178,7 +178,7 @@ RSpec.describe "bundle package" do
gem 'rack'
D
- bundle! "package --no-install"
+ bundle! "cache --no-install"
bundle! "install"
expect(the_bundle).to include_gems "rack 1.0.0"
@@ -190,7 +190,7 @@ RSpec.describe "bundle package" do
gem "rack", "1.0.0"
D
- bundle! "package --no-install"
+ bundle! "cache --no-install"
bundle! "update --all"
expect(the_bundle).to include_gems "rack 1.0.0"
@@ -204,7 +204,7 @@ RSpec.describe "bundle package" do
gem 'rack', :platforms => :ruby_19
D
- bundle "package --all-platforms"
+ bundle "cache --all-platforms"
expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
end
@@ -226,7 +226,7 @@ RSpec.describe "bundle package" do
end
G
- bundle! :package, "all-platforms" => true
+ bundle! :cache, "all-platforms" => true
expect(bundled_app("vendor/cache/weakling-0.0.3.gem")).to exist
expect(bundled_app("vendor/cache/uninstallable-2.0.gem")).to exist
expect(the_bundle).to include_gem "rack 1.0"
@@ -247,7 +247,7 @@ RSpec.describe "bundle package" do
bundle "install"
end
- subject { bundle :package, forgotten_command_line_options(:frozen => true) }
+ subject { bundle :cache, forgotten_command_line_options(:frozen => true) }
it "tries to install with frozen" do
bundle! "config set deployment true"
@@ -276,7 +276,7 @@ RSpec.describe "bundle install with gem sources" do
gem "rack"
G
- bundle :pack
+ bundle :cache
simulate_new_machine
FileUtils.rm_rf gem_repo2
@@ -291,7 +291,7 @@ RSpec.describe "bundle install with gem sources" do
gem "rack"
G
- bundle! :pack
+ bundle! :cache
simulate_new_machine
FileUtils.rm_rf gem_repo2
@@ -304,7 +304,7 @@ RSpec.describe "bundle install with gem sources" do
source "#{file_uri_for(gem_repo1)}"
gem "rack"
G
- bundle :pack
+ bundle :cache
build_gem "rack", "1.0.0", :path => bundled_app("vendor/cache") do |s|
s.write "lib/rack.rb", "raise 'omg'"
@@ -321,7 +321,7 @@ RSpec.describe "bundle install with gem sources" do
source "#{file_uri_for(gem_repo1)}"
gem "platform_specific"
G
- bundle :pack
+ bundle :cache
end
simulate_new_machine
diff --git a/spec/bundler/commands/exec_spec.rb b/spec/bundler/commands/exec_spec.rb
index cf76d3fb93..7ae504d360 100644
--- a/spec/bundler/commands/exec_spec.rb
+++ b/spec/bundler/commands/exec_spec.rb
@@ -89,7 +89,7 @@ RSpec.describe "bundle exec" do
else
require 'tempfile'
io = Tempfile.new("io-test-fd")
- args = %W[#{Gem.ruby} -I#{lib} #{bindir.join("bundle")} exec --keep-file-descriptors #{Gem.ruby} #{command.path} \#{io.to_i}]
+ args = %W[#{Gem.ruby} -I#{lib_dir} #{bindir.join("bundle")} exec --keep-file-descriptors #{Gem.ruby} #{command.path} \#{io.to_i}]
args << { io.to_i => io }
exec(*args)
end
@@ -279,7 +279,7 @@ RSpec.describe "bundle exec" do
G
rubyopt = ENV["RUBYOPT"]
- rubyopt = "-r#{lib}/bundler/setup #{rubyopt}"
+ rubyopt = "-r#{lib_dir}/bundler/setup #{rubyopt}"
bundle "exec 'echo $RUBYOPT'"
expect(out).to have_rubyopts(rubyopt)
@@ -294,7 +294,7 @@ RSpec.describe "bundle exec" do
G
rubylib = ENV["RUBYLIB"]
- rubylib = rubylib.to_s.split(File::PATH_SEPARATOR).unshift lib.to_s
+ rubylib = rubylib.to_s.split(File::PATH_SEPARATOR).unshift lib_dir.to_s
rubylib = rubylib.uniq.join(File::PATH_SEPARATOR)
bundle "exec 'echo $RUBYLIB'"
diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb
index 32c1868cd2..708b41f623 100644
--- a/spec/bundler/commands/newgem_spec.rb
+++ b/spec/bundler/commands/newgem_spec.rb
@@ -1,22 +1,20 @@
# frozen_string_literal: true
RSpec.describe "bundle gem" do
- def execute_bundle_gem(gem_name, flag = "")
- bundle! "gem #{gem_name} #{flag}"
- # reset gemspec cache for each test because of commit 3d4163a
- Bundler.clear_gemspec_cache
- end
-
- def gem_skeleton_assertions(gem_name)
+ def gem_skeleton_assertions
expect(bundled_app("#{gem_name}/#{gem_name}.gemspec")).to exist
expect(bundled_app("#{gem_name}/README.md")).to exist
expect(bundled_app("#{gem_name}/Gemfile")).to exist
expect(bundled_app("#{gem_name}/Rakefile")).to exist
- expect(bundled_app("#{gem_name}/lib/test/gem.rb")).to exist
- expect(bundled_app("#{gem_name}/lib/test/gem/version.rb")).to exist
+ expect(bundled_app("#{gem_name}/lib/#{require_path}.rb")).to exist
+ expect(bundled_app("#{gem_name}/lib/#{require_path}/version.rb")).to exist
end
- let(:generated_gemspec) { Bundler::GemHelper.new(bundled_app(gem_name).to_s).gemspec }
+ let(:generated_gemspec) { Bundler.load_gemspec_uncached(bundled_app(gem_name).join("#{gem_name}.gemspec")) }
+
+ let(:gem_name) { "mygem" }
+
+ let(:require_path) { "mygem" }
before do
global_config "BUNDLE_GEM__MIT" => "false", "BUNDLE_GEM__TEST" => "false", "BUNDLE_GEM__COC" => "false"
@@ -28,7 +26,7 @@ RSpec.describe "bundle gem" do
user = bundleuser
EOF
@git_config_location = ENV["GIT_CONFIG"]
- path = "#{File.expand_path(tmp, File.dirname(__FILE__))}/test_git_config.txt"
+ path = "#{tmp}/test_git_config.txt"
File.open(path, "w") {|f| f.write(git_config_content) }
ENV["GIT_CONFIG"] = path
end
@@ -61,15 +59,14 @@ RSpec.describe "bundle gem" do
end
describe "git repo initialization" do
- let(:gem_name) { "test-gem" }
-
shared_examples_for "a gem with an initial git repo" do
before do
- execute_bundle_gem(gem_name, flags)
+ bundle! "gem #{gem_name} #{flags}"
end
+
it "generates a gem skeleton with a .git folder" do
- gem_skeleton_assertions(gem_name)
- expect(bundled_app("test-gem/.git")).to exist
+ gem_skeleton_assertions
+ expect(bundled_app("#{gem_name}/.git")).to exist
end
end
@@ -87,111 +84,104 @@ RSpec.describe "bundle gem" do
context "when passing --no-git" do
before do
- execute_bundle_gem(gem_name, "--no-git")
+ bundle! "gem #{gem_name} --no-git"
end
it "generates a gem skeleton without a .git folder" do
- gem_skeleton_assertions(gem_name)
- expect(bundled_app("test-gem/.git")).not_to exist
+ gem_skeleton_assertions
+ expect(bundled_app("#{gem_name}/.git")).not_to exist
end
end
end
shared_examples_for "--mit flag" do
before do
- execute_bundle_gem(gem_name, "--mit")
+ bundle! "gem #{gem_name} --mit"
end
it "generates a gem skeleton with MIT license" do
- gem_skeleton_assertions(gem_name)
- expect(bundled_app("test-gem/LICENSE.txt")).to exist
- skel = Bundler::GemHelper.new(bundled_app(gem_name).to_s)
- expect(skel.gemspec.license).to eq("MIT")
+ gem_skeleton_assertions
+ expect(bundled_app("#{gem_name}/LICENSE.txt")).to exist
+ expect(generated_gemspec.license).to eq("MIT")
end
end
shared_examples_for "--no-mit flag" do
before do
- execute_bundle_gem(gem_name, "--no-mit")
+ bundle! "gem #{gem_name} --no-mit"
end
it "generates a gem skeleton without MIT license" do
- gem_skeleton_assertions(gem_name)
- expect(bundled_app("test-gem/LICENSE.txt")).to_not exist
+ gem_skeleton_assertions
+ expect(bundled_app("#{gem_name}/LICENSE.txt")).to_not exist
end
end
shared_examples_for "--coc flag" do
before do
- execute_bundle_gem(gem_name, "--coc")
+ bundle! "gem #{gem_name} --coc"
end
it "generates a gem skeleton with MIT license" do
- gem_skeleton_assertions(gem_name)
- expect(bundled_app("test-gem/CODE_OF_CONDUCT.md")).to exist
+ gem_skeleton_assertions
+ expect(bundled_app("#{gem_name}/CODE_OF_CONDUCT.md")).to exist
end
describe "README additions" do
it "generates the README with a section for the Code of Conduct" do
- expect(bundled_app("test-gem/README.md").read).to include("## Code of Conduct")
- expect(bundled_app("test-gem/README.md").read).to include("https://github.com/bundleuser/#{gem_name}/blob/master/CODE_OF_CONDUCT.md")
+ expect(bundled_app("#{gem_name}/README.md").read).to include("## Code of Conduct")
+ expect(bundled_app("#{gem_name}/README.md").read).to include("https://github.com/bundleuser/#{gem_name}/blob/master/CODE_OF_CONDUCT.md")
end
end
end
shared_examples_for "--no-coc flag" do
before do
- execute_bundle_gem(gem_name, "--no-coc")
+ bundle! "gem #{gem_name} --no-coc"
end
it "generates a gem skeleton without Code of Conduct" do
- gem_skeleton_assertions(gem_name)
- expect(bundled_app("test-gem/CODE_OF_CONDUCT.md")).to_not exist
+ gem_skeleton_assertions
+ expect(bundled_app("#{gem_name}/CODE_OF_CONDUCT.md")).to_not exist
end
describe "README additions" do
it "generates the README without a section for the Code of Conduct" do
- expect(bundled_app("test-gem/README.md").read).not_to include("## Code of Conduct")
- expect(bundled_app("test-gem/README.md").read).not_to include("https://github.com/bundleuser/#{gem_name}/blob/master/CODE_OF_CONDUCT.md")
+ expect(bundled_app("#{gem_name}/README.md").read).not_to include("## Code of Conduct")
+ expect(bundled_app("#{gem_name}/README.md").read).not_to include("https://github.com/bundleuser/#{gem_name}/blob/master/CODE_OF_CONDUCT.md")
end
end
end
context "README.md" do
- let(:gem_name) { "test_gem" }
-
context "git config github.user present" do
before do
- execute_bundle_gem(gem_name)
+ bundle! "gem #{gem_name}"
end
it "contribute URL set to git username" do
- expect(bundled_app("test_gem/README.md").read).not_to include("[USERNAME]")
- expect(bundled_app("test_gem/README.md").read).to include("github.com/bundleuser")
+ expect(bundled_app("#{gem_name}/README.md").read).not_to include("[USERNAME]")
+ expect(bundled_app("#{gem_name}/README.md").read).to include("github.com/bundleuser")
end
end
context "git config github.user is absent" do
before do
sys_exec("git config --unset github.user")
- in_app_root
bundle "gem #{gem_name}"
end
it "contribute URL set to [USERNAME]" do
- expect(bundled_app("test_gem/README.md").read).to include("[USERNAME]")
- expect(bundled_app("test_gem/README.md").read).not_to include("github.com/bundleuser")
+ expect(bundled_app("#{gem_name}/README.md").read).to include("[USERNAME]")
+ expect(bundled_app("#{gem_name}/README.md").read).not_to include("github.com/bundleuser")
end
end
end
it "creates a new git repository" do
- in_app_root
- bundle "gem test_gem"
- expect(bundled_app("test_gem/.git")).to exist
+ bundle "gem #{gem_name}"
+ expect(bundled_app("#{gem_name}/.git")).to exist
end
context "when git is not available" do
- let(:gem_name) { "test_gem" }
-
# This spec cannot have `git` available in the test env
before do
- load_paths = [lib, spec]
+ load_paths = [lib_dir, spec_dir]
load_path_str = "-I#{load_paths.join(File::PATH_SEPARATOR)}"
sys_exec "#{Gem.ruby} #{load_path_str} #{bindir.join("bundle")} gem #{gem_name}", "PATH" => ""
@@ -211,7 +201,6 @@ RSpec.describe "bundle gem" do
end
it "generates a valid gemspec" do
- in_app_root
bundle! "gem newgem --bin"
prepare_gemspec(bundled_app("newgem", "newgem.gemspec"))
@@ -226,10 +215,6 @@ RSpec.describe "bundle gem" do
end
context "gem naming with relative paths" do
- before do
- in_app_root
- end
-
it "resolves ." do
create_temporary_dir("tmp")
@@ -260,43 +245,41 @@ RSpec.describe "bundle gem" do
end
end
- context "gem naming with underscore" do
- let(:gem_name) { "test_gem" }
-
- before do
- execute_bundle_gem(gem_name)
- end
-
+ shared_examples_for "generating a gem" do
it "generates a gem skeleton" do
- expect(bundled_app("test_gem/test_gem.gemspec")).to exist
- expect(bundled_app("test_gem/Gemfile")).to exist
- expect(bundled_app("test_gem/Rakefile")).to exist
- expect(bundled_app("test_gem/lib/test_gem.rb")).to exist
- expect(bundled_app("test_gem/lib/test_gem/version.rb")).to exist
- expect(bundled_app("test_gem/.gitignore")).to exist
+ bundle! "gem #{gem_name}"
+
+ expect(bundled_app("#{gem_name}/#{gem_name}.gemspec")).to exist
+ expect(bundled_app("#{gem_name}/Gemfile")).to exist
+ expect(bundled_app("#{gem_name}/Rakefile")).to exist
+ expect(bundled_app("#{gem_name}/lib/#{require_path}.rb")).to exist
+ expect(bundled_app("#{gem_name}/lib/#{require_path}/version.rb")).to exist
+ expect(bundled_app("#{gem_name}/.gitignore")).to exist
- expect(bundled_app("test_gem/bin/setup")).to exist
- expect(bundled_app("test_gem/bin/console")).to exist
- expect(bundled_app("test_gem/bin/setup")).to be_executable
- expect(bundled_app("test_gem/bin/console")).to be_executable
+ expect(bundled_app("#{gem_name}/bin/setup")).to exist
+ expect(bundled_app("#{gem_name}/bin/console")).to exist
+ expect(bundled_app("#{gem_name}/bin/setup")).to be_executable
+ expect(bundled_app("#{gem_name}/bin/console")).to be_executable
end
it "starts with version 0.1.0" do
- expect(bundled_app("test_gem/lib/test_gem/version.rb").read).to match(/VERSION = "0.1.0"/)
- end
+ bundle! "gem #{gem_name}"
- it "does not nest constants" do
- expect(bundled_app("test_gem/lib/test_gem/version.rb").read).to match(/module TestGem/)
- expect(bundled_app("test_gem/lib/test_gem.rb").read).to match(/module TestGem/)
+ expect(bundled_app("#{gem_name}/lib/#{require_path}/version.rb").read).to match(/VERSION = "0.1.0"/)
end
- it_should_behave_like "git config is present"
+ context "git config user.{name,email} is set" do
+ before do
+ bundle! "gem #{gem_name}"
+ end
+
+ it_should_behave_like "git config is present"
+ end
context "git config user.{name,email} is not set" do
before do
`git config --unset user.name`
`git config --unset user.email`
- in_app_root
bundle "gem #{gem_name}"
end
@@ -304,25 +287,35 @@ RSpec.describe "bundle gem" do
end
it "sets gemspec metadata['allowed_push_host']" do
+ bundle! "gem #{gem_name}"
+
expect(generated_gemspec.metadata["allowed_push_host"]).
to match(/mygemserver\.com/)
end
it "sets a minimum ruby version" do
+ bundle! "gem #{gem_name}"
+
bundler_gemspec = Bundler::GemHelper.new(gemspec_dir).gemspec
expect(bundler_gemspec.required_ruby_version).to eq(generated_gemspec.required_ruby_version)
end
it "requires the version file" do
- expect(bundled_app("test_gem/lib/test_gem.rb").read).to match(%r{require "test_gem/version"})
+ bundle! "gem #{gem_name}"
+
+ expect(bundled_app("#{gem_name}/lib/#{require_path}.rb").read).to match(%r{require "#{require_path}/version"})
end
it "creates a base error class" do
- expect(bundled_app("test_gem/lib/test_gem.rb").read).to match(/class Error < StandardError; end$/)
+ bundle! "gem #{gem_name}"
+
+ expect(bundled_app("#{gem_name}/lib/#{require_path}.rb").read).to match(/class Error < StandardError; end$/)
end
it "runs rake without problems" do
+ bundle! "gem #{gem_name}"
+
system_gems ["rake-12.3.2"]
rakefile = strip_whitespace <<-RAKEFILE
@@ -330,7 +323,7 @@ RSpec.describe "bundle gem" do
puts 'SUCCESS'
end
RAKEFILE
- File.open(bundled_app("test_gem/Rakefile"), "w") do |file|
+ File.open(bundled_app("#{gem_name}/Rakefile"), "w") do |file|
file.puts rakefile
end
@@ -342,117 +335,110 @@ RSpec.describe "bundle gem" do
context "--exe parameter set" do
before do
- in_app_root
bundle "gem #{gem_name} --exe"
end
it "builds exe skeleton" do
- expect(bundled_app("test_gem/exe/test_gem")).to exist
+ expect(bundled_app("#{gem_name}/exe/#{gem_name}")).to exist
end
- it "requires 'test-gem'" do
- expect(bundled_app("test_gem/exe/test_gem").read).to match(/require "test_gem"/)
+ it "requires the main file" do
+ expect(bundled_app("#{gem_name}/exe/#{gem_name}").read).to match(/require "#{require_path}"/)
end
end
context "--bin parameter set" do
before do
- in_app_root
bundle "gem #{gem_name} --bin"
end
it "builds exe skeleton" do
- expect(bundled_app("test_gem/exe/test_gem")).to exist
+ expect(bundled_app("#{gem_name}/exe/#{gem_name}")).to exist
end
- it "requires 'test-gem'" do
- expect(bundled_app("test_gem/exe/test_gem").read).to match(/require "test_gem"/)
+ it "requires the main file" do
+ expect(bundled_app("#{gem_name}/exe/#{gem_name}").read).to match(/require "#{require_path}"/)
end
end
context "no --test parameter" do
before do
- in_app_root
bundle "gem #{gem_name}"
end
it "doesn't create any spec/test file" do
- expect(bundled_app("test_gem/.rspec")).to_not exist
- expect(bundled_app("test_gem/spec/test_gem_spec.rb")).to_not exist
- expect(bundled_app("test_gem/spec/spec_helper.rb")).to_not exist
- expect(bundled_app("test_gem/test/test_test_gem.rb")).to_not exist
- expect(bundled_app("test_gem/test/minitest_helper.rb")).to_not exist
+ expect(bundled_app("#{gem_name}/.rspec")).to_not exist
+ expect(bundled_app("#{gem_name}/spec/#{require_path}_spec.rb")).to_not exist
+ expect(bundled_app("#{gem_name}/spec/spec_helper.rb")).to_not exist
+ expect(bundled_app("#{gem_name}/test/#{require_path}.rb")).to_not exist
+ expect(bundled_app("#{gem_name}/test/minitest_helper.rb")).to_not exist
end
end
context "--test parameter set to rspec" do
before do
- in_app_root
bundle "gem #{gem_name} --test=rspec"
end
it "builds spec skeleton" do
- expect(bundled_app("test_gem/.rspec")).to exist
- expect(bundled_app("test_gem/spec/test_gem_spec.rb")).to exist
- expect(bundled_app("test_gem/spec/spec_helper.rb")).to exist
+ expect(bundled_app("#{gem_name}/.rspec")).to exist
+ expect(bundled_app("#{gem_name}/spec/#{require_path}_spec.rb")).to exist
+ expect(bundled_app("#{gem_name}/spec/spec_helper.rb")).to exist
end
it "depends on a specific version of rspec in generated Gemfile" do
- Dir.chdir(bundled_app("test_gem")) do
+ Dir.chdir(bundled_app(gem_name)) do
builder = Bundler::Dsl.new
- builder.eval_gemfile(bundled_app("test_gem/Gemfile"))
+ builder.eval_gemfile(bundled_app("#{gem_name}/Gemfile"))
builder.dependencies
rspec_dep = builder.dependencies.find {|d| d.name == "rspec" }
expect(rspec_dep).to be_specific
end
end
- it "requires 'test-gem'" do
- expect(bundled_app("test_gem/spec/spec_helper.rb").read).to include(%(require "test_gem"))
+ it "requires the main file" do
+ expect(bundled_app("#{gem_name}/spec/spec_helper.rb").read).to include(%(require "#{require_path}"))
end
it "creates a default test which fails" do
- expect(bundled_app("test_gem/spec/test_gem_spec.rb").read).to include("expect(false).to eq(true)")
+ expect(bundled_app("#{gem_name}/spec/#{require_path}_spec.rb").read).to include("expect(false).to eq(true)")
end
end
context "gem.test setting set to rspec" do
before do
- in_app_root
bundle "config set gem.test rspec"
bundle "gem #{gem_name}"
end
it "builds spec skeleton" do
- expect(bundled_app("test_gem/.rspec")).to exist
- expect(bundled_app("test_gem/spec/test_gem_spec.rb")).to exist
- expect(bundled_app("test_gem/spec/spec_helper.rb")).to exist
+ expect(bundled_app("#{gem_name}/.rspec")).to exist
+ expect(bundled_app("#{gem_name}/spec/#{require_path}_spec.rb")).to exist
+ expect(bundled_app("#{gem_name}/spec/spec_helper.rb")).to exist
end
end
context "gem.test setting set to rspec and --test is set to minitest" do
before do
- in_app_root
bundle "config set gem.test rspec"
bundle "gem #{gem_name} --test=minitest"
end
it "builds spec skeleton" do
- expect(bundled_app("test_gem/test/test_gem_test.rb")).to exist
- expect(bundled_app("test_gem/test/test_helper.rb")).to exist
+ expect(bundled_app("#{gem_name}/test/#{require_path}_test.rb")).to exist
+ expect(bundled_app("#{gem_name}/test/test_helper.rb")).to exist
end
end
context "--test parameter set to minitest" do
before do
- in_app_root
bundle "gem #{gem_name} --test=minitest"
end
it "depends on a specific version of minitest" do
- Dir.chdir(bundled_app("test_gem")) do
+ Dir.chdir(bundled_app(gem_name)) do
builder = Bundler::Dsl.new
- builder.eval_gemfile(bundled_app("test_gem/Gemfile"))
+ builder.eval_gemfile(bundled_app("#{gem_name}/Gemfile"))
builder.dependencies
minitest_dep = builder.dependencies.find {|d| d.name == "minitest" }
expect(minitest_dep).to be_specific
@@ -460,26 +446,25 @@ RSpec.describe "bundle gem" do
end
it "builds spec skeleton" do
- expect(bundled_app("test_gem/test/test_gem_test.rb")).to exist
- expect(bundled_app("test_gem/test/test_helper.rb")).to exist
+ expect(bundled_app("#{gem_name}/test/#{require_path}_test.rb")).to exist
+ expect(bundled_app("#{gem_name}/test/test_helper.rb")).to exist
end
- it "requires 'test-gem'" do
- expect(bundled_app("test_gem/test/test_helper.rb").read).to include(%(require "test_gem"))
+ it "requires the main file" do
+ expect(bundled_app("#{gem_name}/test/test_helper.rb").read).to include(%(require "#{require_path}"))
end
it "requires 'minitest_helper'" do
- expect(bundled_app("test_gem/test/test_gem_test.rb").read).to include(%(require "test_helper"))
+ expect(bundled_app("#{gem_name}/test/#{require_path}_test.rb").read).to include(%(require "test_helper"))
end
it "creates a default test which fails" do
- expect(bundled_app("test_gem/test/test_gem_test.rb").read).to include("assert false")
+ expect(bundled_app("#{gem_name}/test/#{require_path}_test.rb").read).to include("assert false")
end
end
context "gem.test setting set to minitest" do
before do
- in_app_root
bundle "config set gem.test minitest"
bundle "gem #{gem_name}"
end
@@ -498,29 +483,27 @@ RSpec.describe "bundle gem" do
task :default => :test
RAKEFILE
- expect(bundled_app("test_gem/Rakefile").read).to eq(rakefile)
+ expect(bundled_app("#{gem_name}/Rakefile").read).to eq(rakefile)
end
end
context "--test with no arguments" do
before do
- in_app_root
bundle "gem #{gem_name} --test"
end
it "defaults to rspec" do
- expect(bundled_app("test_gem/spec/spec_helper.rb")).to exist
- expect(bundled_app("test_gem/test/minitest_helper.rb")).to_not exist
+ expect(bundled_app("#{gem_name}/spec/spec_helper.rb")).to exist
+ expect(bundled_app("#{gem_name}/test/minitest_helper.rb")).to_not exist
end
it "creates a .travis.yml file to test the library against the current Ruby version on Travis CI" do
- expect(bundled_app("test_gem/.travis.yml").read).to match(/- #{RUBY_VERSION}/)
+ expect(bundled_app("#{gem_name}/.travis.yml").read).to match(/- #{RUBY_VERSION}/)
end
end
context "--edit option" do
it "opens the generated gemspec in the user's text editor" do
- in_app_root
output = bundle "gem #{gem_name} --edit=echo"
gemspec_path = File.join(Dir.pwd, gem_name, "#{gem_name}.gemspec")
expect(output).to include("echo \"#{gemspec_path}\"")
@@ -531,6 +514,8 @@ RSpec.describe "bundle gem" do
context "testing --mit and --coc options against bundle config settings" do
let(:gem_name) { "test-gem" }
+ let(:require_path) { "test/gem" }
+
context "with mit option in bundle config settings set to true" do
before do
global_config "BUNDLE_GEM__MIT" => "true", "BUNDLE_GEM__TEST" => "false", "BUNDLE_GEM__COC" => "false"
@@ -558,196 +543,35 @@ RSpec.describe "bundle gem" do
end
end
- context "gem naming with dashed" do
- let(:gem_name) { "test-gem" }
-
- before do
- execute_bundle_gem(gem_name)
- end
-
- it "generates a gem skeleton" do
- expect(bundled_app("test-gem/test-gem.gemspec")).to exist
- expect(bundled_app("test-gem/Gemfile")).to exist
- expect(bundled_app("test-gem/Rakefile")).to exist
- expect(bundled_app("test-gem/lib/test/gem.rb")).to exist
- expect(bundled_app("test-gem/lib/test/gem/version.rb")).to exist
- end
-
- it "starts with version 0.1.0" do
- expect(bundled_app("test-gem/lib/test/gem/version.rb").read).to match(/VERSION = "0.1.0"/)
- end
-
- it "nests constants so they work" do
- expect(bundled_app("test-gem/lib/test/gem/version.rb").read).to match(/module Test\n module Gem/)
- expect(bundled_app("test-gem/lib/test/gem.rb").read).to match(/module Test\n module Gem/)
- end
-
- it_should_behave_like "git config is present"
-
- context "git config user.{name,email} is not set" do
- before do
- `git config --unset user.name`
- `git config --unset user.email`
- in_app_root
- bundle "gem #{gem_name}"
- end
-
- it_should_behave_like "git config is absent"
- end
-
- it "requires the version file" do
- expect(bundled_app("test-gem/lib/test/gem.rb").read).to match(%r{require "test/gem/version"})
- end
-
- it "runs rake without problems" do
- system_gems ["rake-12.3.2"]
-
- rakefile = strip_whitespace <<-RAKEFILE
- task :default do
- puts 'SUCCESS'
- end
- RAKEFILE
- File.open(bundled_app("test-gem/Rakefile"), "w") do |file|
- file.puts rakefile
- end
-
- Dir.chdir(bundled_app(gem_name)) do
- sys_exec(rake)
- expect(out).to include("SUCCESS")
- end
- end
-
- context "--bin parameter set" do
- before do
- in_app_root
- bundle "gem #{gem_name} --bin"
- end
-
- it "builds bin skeleton" do
- expect(bundled_app("test-gem/exe/test-gem")).to exist
- end
-
- it "requires 'test/gem'" do
- expect(bundled_app("test-gem/exe/test-gem").read).to match(%r{require "test/gem"})
- end
- end
-
- context "no --test parameter" do
- before do
- in_app_root
- bundle "gem #{gem_name}"
- end
-
- it "doesn't create any spec/test file" do
- expect(bundled_app("test-gem/.rspec")).to_not exist
- expect(bundled_app("test-gem/spec/test/gem_spec.rb")).to_not exist
- expect(bundled_app("test-gem/spec/spec_helper.rb")).to_not exist
- expect(bundled_app("test-gem/test/test_test/gem.rb")).to_not exist
- expect(bundled_app("test-gem/test/minitest_helper.rb")).to_not exist
- end
- end
-
- context "--test parameter set to rspec" do
- before do
- in_app_root
- bundle "gem #{gem_name} --test=rspec"
- end
-
- it "builds spec skeleton" do
- expect(bundled_app("test-gem/.rspec")).to exist
- expect(bundled_app("test-gem/spec/test/gem_spec.rb")).to exist
- expect(bundled_app("test-gem/spec/spec_helper.rb")).to exist
- end
-
- it "requires 'test/gem'" do
- expect(bundled_app("test-gem/spec/spec_helper.rb").read).to include(%(require "test/gem"))
- end
-
- it "creates a default test which fails" do
- expect(bundled_app("test-gem/spec/test/gem_spec.rb").read).to include("expect(false).to eq(true)")
- end
-
- it "creates a default rake task to run the specs" do
- rakefile = strip_whitespace <<-RAKEFILE
- require "bundler/gem_tasks"
- require "rspec/core/rake_task"
+ context "gem naming with underscore" do
+ let(:gem_name) { "test_gem" }
- RSpec::Core::RakeTask.new(:spec)
+ let(:require_path) { "test_gem" }
- task :default => :spec
- RAKEFILE
+ let(:flags) { nil }
- expect(bundled_app("test-gem/Rakefile").read).to eq(rakefile)
- end
+ before do
+ bundle! ["gem", gem_name, flags].compact.join(" ")
end
- context "--test parameter set to minitest" do
- before do
- in_app_root
- bundle "gem #{gem_name} --test=minitest"
- end
-
- it "builds spec skeleton" do
- expect(bundled_app("test-gem/test/test/gem_test.rb")).to exist
- expect(bundled_app("test-gem/test/test_helper.rb")).to exist
- end
-
- it "requires 'test/gem'" do
- expect(bundled_app("test-gem/test/test_helper.rb").read).to match(%r{require "test/gem"})
- end
-
- it "requires 'test_helper'" do
- expect(bundled_app("test-gem/test/test/gem_test.rb").read).to match(/require "test_helper"/)
- end
-
- it "creates a default test which fails" do
- expect(bundled_app("test-gem/test/test/gem_test.rb").read).to match(/assert false/)
- end
-
- it "creates a default rake task to run the test suite" do
- rakefile = strip_whitespace <<-RAKEFILE
- require "bundler/gem_tasks"
- require "rake/testtask"
-
- Rake::TestTask.new(:test) do |t|
- t.libs << "test"
- t.libs << "lib"
- t.test_files = FileList["test/**/*_test.rb"]
- end
-
- task :default => :test
- RAKEFILE
-
- expect(bundled_app("test-gem/Rakefile").read).to eq(rakefile)
- end
+ it "does not nest constants" do
+ expect(bundled_app("#{gem_name}/lib/#{require_path}/version.rb").read).to match(/module TestGem/)
+ expect(bundled_app("#{gem_name}/lib/#{require_path}.rb").read).to match(/module TestGem/)
end
- context "--test with no arguments" do
- before do
- in_app_root
- bundle "gem #{gem_name} --test"
- end
-
- it "defaults to rspec" do
- expect(bundled_app("test-gem/spec/spec_helper.rb")).to exist
- expect(bundled_app("test-gem/test/minitest_helper.rb")).to_not exist
- end
- end
+ include_examples "generating a gem"
context "--ext parameter set" do
- before do
- in_app_root
- bundle "gem test_gem --ext"
- end
+ let(:flags) { "--ext" }
it "builds ext skeleton" do
- expect(bundled_app("test_gem/ext/test_gem/extconf.rb")).to exist
- expect(bundled_app("test_gem/ext/test_gem/test_gem.h")).to exist
- expect(bundled_app("test_gem/ext/test_gem/test_gem.c")).to exist
+ expect(bundled_app("#{gem_name}/ext/#{gem_name}/extconf.rb")).to exist
+ expect(bundled_app("#{gem_name}/ext/#{gem_name}/#{gem_name}.h")).to exist
+ expect(bundled_app("#{gem_name}/ext/#{gem_name}/#{gem_name}.c")).to exist
end
it "includes rake-compiler" do
- expect(bundled_app("test_gem/Gemfile").read).to include('gem "rake-compiler"')
+ expect(bundled_app("#{gem_name}/Gemfile").read).to include('gem "rake-compiler"')
end
it "depends on compile task for build" do
@@ -757,21 +581,38 @@ RSpec.describe "bundle gem" do
task :build => :compile
- Rake::ExtensionTask.new("test_gem") do |ext|
- ext.lib_dir = "lib/test_gem"
+ Rake::ExtensionTask.new("#{gem_name}") do |ext|
+ ext.lib_dir = "lib/#{gem_name}"
end
task :default => [:clobber, :compile, :spec]
RAKEFILE
- expect(bundled_app("test_gem/Rakefile").read).to eq(rakefile)
+ expect(bundled_app("#{gem_name}/Rakefile").read).to eq(rakefile)
end
end
end
+ context "gem naming with dashed" do
+ let(:gem_name) { "test-gem" }
+
+ let(:require_path) { "test/gem" }
+
+ before do
+ bundle! "gem #{gem_name}"
+ end
+
+ it "nests constants so they work" do
+ expect(bundled_app("#{gem_name}/lib/#{require_path}/version.rb").read).to match(/module Test\n module Gem/)
+ expect(bundled_app("#{gem_name}/lib/#{require_path}.rb").read).to match(/module Test\n module Gem/)
+ end
+
+ include_examples "generating a gem"
+ end
+
describe "uncommon gem names" do
it "can deal with two dashes" do
- execute_bundle_gem("a--a")
+ bundle! "gem a--a"
expect(bundled_app("a--a/a--a.gemspec")).to exist
end
@@ -804,9 +645,6 @@ Usage: "bundle gem NAME [OPTIONS]"
before do
bundle "gem #{subject}"
end
- after do
- Bundler.clear_gemspec_cache
- end
context "with an existing const name" do
subject { "gem" }
@@ -830,10 +668,6 @@ Usage: "bundle gem NAME [OPTIONS]"
end
context "on first run" do
- before do
- in_app_root
- end
-
it "asks about test framework" do
global_config "BUNDLE_GEM__MIT" => "false", "BUNDLE_GEM__COC" => "false"
@@ -880,9 +714,7 @@ Usage: "bundle gem NAME [OPTIONS]"
context "on conflicts with a previously created file" do
it "should fail gracefully" do
- in_app_root do
- FileUtils.touch("conflict-foobar")
- end
+ FileUtils.touch("conflict-foobar")
bundle "gem conflict-foobar"
expect(err).to include("Errno::ENOTDIR")
expect(exitstatus).to eql(32) if exitstatus
@@ -891,9 +723,7 @@ Usage: "bundle gem NAME [OPTIONS]"
context "on conflicts with a previously created directory" do
it "should succeed" do
- in_app_root do
- FileUtils.mkdir_p("conflict-foobar/Gemfile")
- end
+ FileUtils.mkdir_p("conflict-foobar/Gemfile")
bundle! "gem conflict-foobar"
expect(out).to include("file_clash conflict-foobar/Gemfile").
and include "Initializing git repo in #{bundled_app("conflict-foobar")}"
diff --git a/spec/bundler/install/deploy_spec.rb b/spec/bundler/install/deploy_spec.rb
index 79a344eaa1..d607f8bb46 100644
--- a/spec/bundler/install/deploy_spec.rb
+++ b/spec/bundler/install/deploy_spec.rb
@@ -390,7 +390,7 @@ You have deleted from the Gemfile:
expect(the_bundle).to include_gems "foo 1.0"
bundle "config set cache_all true"
- bundle! :package
+ bundle! :cache
expect(bundled_app("vendor/cache/foo")).to be_directory
bundle! "install --local"
diff --git a/spec/bundler/install/gemfile/git_spec.rb b/spec/bundler/install/gemfile/git_spec.rb
index 7eb05a995c..08789820d8 100644
--- a/spec/bundler/install/gemfile/git_spec.rb
+++ b/spec/bundler/install/gemfile/git_spec.rb
@@ -1056,7 +1056,7 @@ RSpec.describe "bundle install with git sources" do
File.open(lib_path("install_hooks.rb"), "w") do |h|
h.write <<-H
- require 'rubygems'
+ require '#{spec_dir}/support/rubygems'
Gem.pre_install_hooks << lambda do |inst|
STDERR.puts "Ran pre-install hook: \#{inst.spec.full_name}"
end
@@ -1076,7 +1076,7 @@ RSpec.describe "bundle install with git sources" do
File.open(lib_path("install_hooks.rb"), "w") do |h|
h.write <<-H
- require 'rubygems'
+ require '#{spec_dir}/support/rubygems'
Gem.post_install_hooks << lambda do |inst|
STDERR.puts "Ran post-install hook: \#{inst.spec.full_name}"
end
@@ -1096,7 +1096,7 @@ RSpec.describe "bundle install with git sources" do
File.open(lib_path("install_hooks.rb"), "w") do |h|
h.write <<-H
- require 'rubygems'
+ require '#{spec_dir}/support/rubygems'
Gem.pre_install_hooks << lambda do |inst|
false
end
@@ -1391,7 +1391,7 @@ In Gemfile:
end
G
bundle "config set cache_all true"
- bundle :package
+ bundle :cache
simulate_new_machine
bundle! "install", :env => { "PATH" => "" }
diff --git a/spec/bundler/install/gemfile/groups_spec.rb b/spec/bundler/install/gemfile/groups_spec.rb
index 93798ef62e..63be1a4e43 100644
--- a/spec/bundler/install/gemfile/groups_spec.rb
+++ b/spec/bundler/install/gemfile/groups_spec.rb
@@ -333,7 +333,7 @@ RSpec.describe "bundle install with groups" do
G
ruby <<-R
- require "#{lib}/bundler"
+ require "#{lib_dir}/bundler"
Bundler.setup :default
Bundler.require :default
puts RACK
diff --git a/spec/bundler/install/gemfile/path_spec.rb b/spec/bundler/install/gemfile/path_spec.rb
index 3f2e5bdfc3..5261e18bbe 100644
--- a/spec/bundler/install/gemfile/path_spec.rb
+++ b/spec/bundler/install/gemfile/path_spec.rb
@@ -672,7 +672,7 @@ RSpec.describe "bundle install with explicit source paths" do
File.open(lib_path("install_hooks.rb"), "w") do |h|
h.write <<-H
- require 'rubygems'
+ require '#{spec_dir}/support/rubygems'
Gem.pre_install_hooks << lambda do |inst|
STDERR.puts "Ran pre-install hook: \#{inst.spec.full_name}"
end
@@ -692,7 +692,7 @@ RSpec.describe "bundle install with explicit source paths" do
File.open(lib_path("install_hooks.rb"), "w") do |h|
h.write <<-H
- require 'rubygems'
+ require '#{spec_dir}/support/rubygems'
Gem.post_install_hooks << lambda do |inst|
STDERR.puts "Ran post-install hook: \#{inst.spec.full_name}"
end
@@ -712,7 +712,7 @@ RSpec.describe "bundle install with explicit source paths" do
File.open(lib_path("install_hooks.rb"), "w") do |h|
h.write <<-H
- require 'rubygems'
+ require '#{spec_dir}/support/rubygems'
Gem.pre_install_hooks << lambda do |inst|
false
end
diff --git a/spec/bundler/install/gemfile/sources_spec.rb b/spec/bundler/install/gemfile/sources_spec.rb
index b2861e1c00..61943ef2e5 100644
--- a/spec/bundler/install/gemfile/sources_spec.rb
+++ b/spec/bundler/install/gemfile/sources_spec.rb
@@ -102,7 +102,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
end
it "can cache and deploy" do
- bundle! :package
+ bundle! :cache
expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
expect(bundled_app("vendor/cache/rack-obama-1.0.gem")).to exist
diff --git a/spec/bundler/lock/lockfile_spec.rb b/spec/bundler/lock/lockfile_spec.rb
index df30bc0400..e291fb7917 100644
--- a/spec/bundler/lock/lockfile_spec.rb
+++ b/spec/bundler/lock/lockfile_spec.rb
@@ -621,7 +621,7 @@ RSpec.describe "the lockfile format" do
G
bundle "config set cache_all true"
- bundle! :package
+ bundle! :cache
bundle! :install, :local => true
lockfile_should_be <<-G
diff --git a/spec/bundler/other/major_deprecation_spec.rb b/spec/bundler/other/major_deprecation_spec.rb
index 74f28b94f9..57b68fdb97 100644
--- a/spec/bundler/other/major_deprecation_spec.rb
+++ b/spec/bundler/other/major_deprecation_spec.rb
@@ -20,7 +20,8 @@ RSpec.describe "major deprecations" do
it "is deprecated in favor of .unbundled_env", :bundler => "2" do
expect(deprecations).to include \
"`Bundler.clean_env` has been deprecated in favor of `Bundler.unbundled_env`. " \
- "If you instead want the environment before bundler was originally loaded, use `Bundler.original_env`"
+ "If you instead want the environment before bundler was originally loaded, use `Bundler.original_env` " \
+ "(called at -e:1)"
end
pending "is removed and shows a helpful error message about it", :bundler => "3"
@@ -35,7 +36,8 @@ RSpec.describe "major deprecations" do
it "is deprecated in favor of .unbundled_env", :bundler => "2" do
expect(deprecations).to include(
"`Bundler.with_clean_env` has been deprecated in favor of `Bundler.with_unbundled_env`. " \
- "If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env`"
+ "If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env` " \
+ "(called at -e:1)"
)
end
@@ -51,7 +53,8 @@ RSpec.describe "major deprecations" do
it "is deprecated in favor of .unbundled_system", :bundler => "2" do
expect(deprecations).to include(
"`Bundler.clean_system` has been deprecated in favor of `Bundler.unbundled_system`. " \
- "If you instead want to run the command in the environment before bundler was originally loaded, use `Bundler.original_system`"
+ "If you instead want to run the command in the environment before bundler was originally loaded, use `Bundler.original_system` " \
+ "(called at -e:1)"
)
end
@@ -67,7 +70,8 @@ RSpec.describe "major deprecations" do
it "is deprecated in favor of .unbundled_exec", :bundler => "2" do
expect(deprecations).to include(
"`Bundler.clean_exec` has been deprecated in favor of `Bundler.unbundled_exec`. " \
- "If you instead want to exec to a command in the environment before bundler was originally loaded, use `Bundler.original_exec`"
+ "If you instead want to exec to a command in the environment before bundler was originally loaded, use `Bundler.original_exec` " \
+ "(called at -e:1)"
)
end
@@ -81,7 +85,7 @@ RSpec.describe "major deprecations" do
end
it "is deprecated in favor of .load", :bundler => "2" do
- expect(deprecations).to include "Bundler.environment has been removed in favor of Bundler.load"
+ expect(deprecations).to include "Bundler.environment has been removed in favor of Bundler.load (called at -e:1)"
end
pending "is removed and shows a helpful error message about it", :bundler => "3"
@@ -108,7 +112,7 @@ RSpec.describe "major deprecations" do
it "should print a deprecation warning", :bundler => "2" do
expect(deprecations).to include(
"The `--path` flag is deprecated because it relies on being " \
- "remembered across bundler invokations, which bundler will no " \
+ "remembered across bundler invocations, which bundler will no " \
"longer do in future versions. Instead please use `bundle config set " \
"path 'vendor/bundle'`, and stop using this flag"
)
@@ -310,7 +314,7 @@ RSpec.describe "major deprecations" do
it "should print a deprecation warning", :bundler => "2" do
expect(deprecations).to include(
"The `#{flag_name}` flag is deprecated because it relies on " \
- "being remembered across bundler invokations, which bundler " \
+ "being remembered across bundler invocations, which bundler " \
"will no longer do in future versions. Instead please use " \
"`bundle config set #{name} '#{value}'`, and stop using this flag"
)
@@ -356,7 +360,6 @@ RSpec.describe "major deprecations" do
require 'bundler'
require 'bundler/vendored_thor'
- Bundler.ui = Bundler::UI::Shell.new
Bundler.setup
Bundler.setup
RUBY
diff --git a/spec/bundler/other/platform_spec.rb b/spec/bundler/other/platform_spec.rb
index b61a3f1b03..4feec14d76 100644
--- a/spec/bundler/other/platform_spec.rb
+++ b/spec/bundler/other/platform_spec.rb
@@ -781,7 +781,7 @@ G
#{ruby_version_correct}
G
- bundle :pack
+ bundle :cache
expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
end
@@ -794,7 +794,7 @@ G
#{ruby_version_correct_engineless}
G
- bundle :pack
+ bundle :cache
expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
end
end
@@ -806,7 +806,7 @@ G
#{ruby_version_incorrect}
G
- bundle :pack
+ bundle :cache
should_be_ruby_version_incorrect
end
@@ -817,7 +817,7 @@ G
#{engine_incorrect}
G
- bundle :pack
+ bundle :cache
should_be_engine_incorrect
end
@@ -829,7 +829,7 @@ G
#{engine_version_incorrect}
G
- bundle :pack
+ bundle :cache
should_be_engine_version_incorrect
end
end
@@ -842,7 +842,7 @@ G
#{patchlevel_incorrect}
G
- bundle :pack
+ bundle :cache
should_be_patchlevel_incorrect
end
end
diff --git a/spec/bundler/plugins/source/example_spec.rb b/spec/bundler/plugins/source/example_spec.rb
index 1ef7c2134d..64002d8f46 100644
--- a/spec/bundler/plugins/source/example_spec.rb
+++ b/spec/bundler/plugins/source/example_spec.rb
@@ -169,7 +169,7 @@ RSpec.describe "real source plugins" do
it "bundler package copies repository to vendor cache" do
bundle! :install, forgotten_command_line_options(:path => "vendor/bundle")
bundle "config set cache_all true"
- bundle! :package
+ bundle! :cache
expect(bundled_app("vendor/cache/a-path-gem-1.0-#{uri_hash}")).to exist
diff --git a/spec/bundler/realworld/dependency_api_spec.rb b/spec/bundler/realworld/dependency_api_spec.rb
index e7d11419cd..dea8329a4d 100644
--- a/spec/bundler/realworld/dependency_api_spec.rb
+++ b/spec/bundler/realworld/dependency_api_spec.rb
@@ -1,5 +1,7 @@
# frozen_string_literal: true
+require_relative "../support/silent_logger"
+
RSpec.describe "gemcutter's dependency API", :realworld => true do
context "when Gemcutter API takes too long to respond" do
before do
@@ -8,7 +10,7 @@ RSpec.describe "gemcutter's dependency API", :realworld => true do
port = find_unused_port
@server_uri = "http://127.0.0.1:#{port}"
- require File.expand_path("../../support/artifice/endpoint_timeout", __FILE__)
+ require_relative "../support/artifice/endpoint_timeout"
@t = Thread.new do
server = Rack::Server.start(:app => EndpointTimeout,
diff --git a/spec/bundler/realworld/double_check_spec.rb b/spec/bundler/realworld/double_check_spec.rb
index 323e0d5735..90cf298b33 100644
--- a/spec/bundler/realworld/double_check_spec.rb
+++ b/spec/bundler/realworld/double_check_spec.rb
@@ -25,9 +25,9 @@ RSpec.describe "double checking sources", :realworld => true, :sometimes => true
RUBY
cmd = <<-RUBY
- require "#{lib}/bundler"
- require #{File.expand_path("../../support/artifice/vcr.rb", __FILE__).dump}
- require "#{lib}/bundler/inline"
+ require "#{lib_dir}/bundler"
+ require "#{spec_dir}/support/artifice/vcr"
+ require "#{lib_dir}/bundler/inline"
gemfile(true) do
source "https://rubygems.org"
gem "rails", path: "."
diff --git a/spec/bundler/realworld/edgecases_spec.rb b/spec/bundler/realworld/edgecases_spec.rb
index 6468ee7f1e..53d9f9a026 100644
--- a/spec/bundler/realworld/edgecases_spec.rb
+++ b/spec/bundler/realworld/edgecases_spec.rb
@@ -3,19 +3,21 @@
RSpec.describe "real world edgecases", :realworld => true, :sometimes => true do
def rubygems_version(name, requirement)
ruby! <<-RUBY
- require #{File.expand_path("../../support/artifice/vcr.rb", __FILE__).dump}
- require "bundler"
- require "bundler/source/rubygems/remote"
- require "bundler/fetcher"
- source = Bundler::Source::Rubygems::Remote.new(URI("https://rubygems.org"))
- fetcher = Bundler::Fetcher.new(source)
- index = fetcher.specs([#{name.dump}], nil)
- rubygem = index.search(Gem::Dependency.new(#{name.dump}, #{requirement.dump})).last
+ require "#{spec_dir}/support/artifice/vcr"
+ require "#{lib_dir}/bundler"
+ require "#{lib_dir}/bundler/source/rubygems/remote"
+ require "#{lib_dir}/bundler/fetcher"
+ rubygem = Bundler.ui.silence do
+ source = Bundler::Source::Rubygems::Remote.new(URI("https://rubygems.org"))
+ fetcher = Bundler::Fetcher.new(source)
+ index = fetcher.specs([#{name.dump}], nil)
+ index.search(Gem::Dependency.new(#{name.dump}, #{requirement.dump})).last
+ end
if rubygem.nil?
raise "Could not find #{name} (#{requirement}) on rubygems.org!\n" \
"Found specs:\n\#{index.send(:specs).inspect}"
end
- "#{name} (\#{rubygem.version})"
+ puts "#{name} (\#{rubygem.version})"
RUBY
end
diff --git a/spec/bundler/realworld/gemfile_source_header_spec.rb b/spec/bundler/realworld/gemfile_source_header_spec.rb
index 382485b8fc..3f507b056a 100644
--- a/spec/bundler/realworld/gemfile_source_header_spec.rb
+++ b/spec/bundler/realworld/gemfile_source_header_spec.rb
@@ -1,5 +1,7 @@
# frozen_string_literal: true
+require_relative "../support/silent_logger"
+
RSpec.describe "fetching dependencies with a mirrored source", :realworld => true do
let(:mirror) { "https://server.example.org" }
let(:original) { "http://127.0.0.1:#{@port}" }
@@ -35,7 +37,7 @@ private
@port = find_unused_port
@server_uri = "http://127.0.0.1:#{@port}"
- require File.expand_path("../../support/artifice/endpoint_mirror_source", __FILE__)
+ require_relative "../support/artifice/endpoint_mirror_source"
@t = Thread.new do
Rack::Server.start(:app => EndpointMirrorSource,
diff --git a/spec/bundler/realworld/mirror_probe_spec.rb b/spec/bundler/realworld/mirror_probe_spec.rb
index 13d1afe124..735fb2b3dd 100644
--- a/spec/bundler/realworld/mirror_probe_spec.rb
+++ b/spec/bundler/realworld/mirror_probe_spec.rb
@@ -1,5 +1,7 @@
# frozen_string_literal: true
+require_relative "../support/silent_logger"
+
RSpec.describe "fetching dependencies with a not available mirror", :realworld => true do
let(:mirror) { @mirror_uri }
let(:original) { @server_uri }
@@ -121,7 +123,7 @@ Could not fetch specs from #{mirror}/
@server_port = find_unused_port
@server_uri = "http://#{host}:#{@server_port}"
- require File.expand_path("../../support/artifice/endpoint", __FILE__)
+ require_relative "../support/artifice/endpoint"
@server_thread = Thread.new do
Rack::Server.start(:app => Endpoint,
diff --git a/spec/bundler/runtime/gem_tasks_spec.rb b/spec/bundler/runtime/gem_tasks_spec.rb
index af645c8ef1..4760b6a749 100644
--- a/spec/bundler/runtime/gem_tasks_spec.rb
+++ b/spec/bundler/runtime/gem_tasks_spec.rb
@@ -11,7 +11,7 @@ RSpec.describe "require 'bundler/gem_tasks'" do
end
bundled_app("Rakefile").open("w") do |f|
f.write <<-RAKEFILE
- $:.unshift("#{lib}")
+ $:.unshift("#{lib_dir}")
require "bundler/gem_tasks"
RAKEFILE
end
@@ -19,7 +19,7 @@ RSpec.describe "require 'bundler/gem_tasks'" do
it "includes the relevant tasks" do
with_gem_path_as(Spec::Path.base_system_gems.to_s) do
- sys_exec "#{rake} -T", "RUBYOPT" => "-I#{lib}"
+ sys_exec "#{rake} -T", "RUBYOPT" => "-I#{lib_dir}"
end
expect(err).to eq("")
diff --git a/spec/bundler/runtime/inline_spec.rb b/spec/bundler/runtime/inline_spec.rb
index 92243a77b6..e5569fec94 100644
--- a/spec/bundler/runtime/inline_spec.rb
+++ b/spec/bundler/runtime/inline_spec.rb
@@ -2,8 +2,8 @@
RSpec.describe "bundler/inline#gemfile" do
def script(code, options = {})
- requires = ["#{lib}/bundler/inline"]
- requires.unshift File.expand_path("../../support/artifice/" + options.delete(:artifice) + ".rb", __FILE__) if options.key?(:artifice)
+ requires = ["#{lib_dir}/bundler/inline"]
+ requires.unshift "#{spec_dir}/support/artifice/" + options.delete(:artifice) if options.key?(:artifice)
requires = requires.map {|r| "require '#{r}'" }.join("\n")
@out = ruby("#{requires}\n\n" + code, options)
end
@@ -97,7 +97,7 @@ RSpec.describe "bundler/inline#gemfile" do
it "lets me use my own ui object" do
script <<-RUBY, :artifice => "endpoint"
- require '#{lib}/bundler'
+ require '#{lib_dir}/bundler'
class MyBundlerUI < Bundler::UI::Silent
def confirm(msg, newline = nil)
puts "CONFIRMED!"
@@ -141,7 +141,7 @@ RSpec.describe "bundler/inline#gemfile" do
it "does not mutate the option argument" do
script <<-RUBY
- require '#{lib}/bundler'
+ require '#{lib_dir}/bundler'
options = { :ui => Bundler::UI::Shell.new }
gemfile(false, options) do
path "#{lib_path}" do
diff --git a/spec/bundler/runtime/load_spec.rb b/spec/bundler/runtime/load_spec.rb
index acefc1a583..7de67e247c 100644
--- a/spec/bundler/runtime/load_spec.rb
+++ b/spec/bundler/runtime/load_spec.rb
@@ -80,7 +80,7 @@ RSpec.describe "Bundler.load" do
G
ruby! <<-RUBY
- require "#{lib}/bundler"
+ require "#{lib_dir}/bundler"
Bundler.setup :default
Bundler.require :default
puts RACK
diff --git a/spec/bundler/runtime/platform_spec.rb b/spec/bundler/runtime/platform_spec.rb
index c504685ea3..f7e93eacf1 100644
--- a/spec/bundler/runtime/platform_spec.rb
+++ b/spec/bundler/runtime/platform_spec.rb
@@ -23,7 +23,7 @@ RSpec.describe "Bundler.setup with multi platform stuff" do
ruby <<-R
begin
require 'bundler'
- Bundler.setup
+ Bundler.ui.silence { Bundler.setup }
rescue Bundler::GemNotFound => e
puts "WIN"
end
diff --git a/spec/bundler/runtime/require_spec.rb b/spec/bundler/runtime/require_spec.rb
index 42d0c2db77..490b8c7631 100644
--- a/spec/bundler/runtime/require_spec.rb
+++ b/spec/bundler/runtime/require_spec.rb
@@ -193,7 +193,7 @@ RSpec.describe "Bundler.require" do
G
cmd = <<-RUBY
- require '#{lib}/bundler'
+ require '#{lib_dir}/bundler'
Bundler.require
RUBY
ruby(cmd)
diff --git a/spec/bundler/runtime/setup_spec.rb b/spec/bundler/runtime/setup_spec.rb
index b9d710a9d9..72ad06a43a 100644
--- a/spec/bundler/runtime/setup_spec.rb
+++ b/spec/bundler/runtime/setup_spec.rb
@@ -12,7 +12,7 @@ RSpec.describe "Bundler.setup" do
G
ruby <<-RUBY
- require '#{lib}/bundler'
+ require '#{lib_dir}/bundler'
Bundler.setup
require 'rack'
@@ -34,7 +34,7 @@ RSpec.describe "Bundler.setup" do
it "doesn't make all groups available" do
ruby <<-RUBY
- require '#{lib}/bundler'
+ require '#{lib_dir}/bundler'
Bundler.setup(:default)
begin
@@ -49,7 +49,7 @@ RSpec.describe "Bundler.setup" do
it "accepts string for group name" do
ruby <<-RUBY
- require '#{lib}/bundler'
+ require '#{lib_dir}/bundler'
Bundler.setup(:default, 'test')
require 'rack'
@@ -61,7 +61,7 @@ RSpec.describe "Bundler.setup" do
it "leaves all groups available if they were already" do
ruby <<-RUBY
- require '#{lib}/bundler'
+ require '#{lib_dir}/bundler'
Bundler.setup
Bundler.setup(:default)
@@ -74,7 +74,7 @@ RSpec.describe "Bundler.setup" do
it "leaves :default available if setup is called twice" do
ruby <<-RUBY
- require '#{lib}/bundler'
+ require '#{lib_dir}/bundler'
Bundler.setup(:default)
Bundler.setup(:default, :test)
@@ -91,7 +91,7 @@ RSpec.describe "Bundler.setup" do
it "handles multiple non-additive invocations" do
ruby <<-RUBY
- require '#{lib}/bundler'
+ require '#{lib_dir}/bundler'
Bundler.setup(:default, :test)
Bundler.setup(:default)
require 'rack'
@@ -109,7 +109,7 @@ RSpec.describe "Bundler.setup" do
def clean_load_path(lp)
without_bundler_load_path = ruby!("puts $LOAD_PATH").split("\n")
lp -= without_bundler_load_path
- lp.map! {|p| p.sub(/^#{Regexp.union system_gem_path.to_s, default_bundle_path.to_s, lib.to_s}/i, "") }
+ lp.map! {|p| p.sub(/^#{Regexp.union system_gem_path.to_s, default_bundle_path.to_s, lib_dir.to_s}/i, "") }
end
it "puts loaded gems after -I and RUBYLIB", :ruby_repo do
@@ -122,7 +122,7 @@ RSpec.describe "Bundler.setup" do
ENV["RUBYLIB"] = "rubylib_dir"
ruby <<-RUBY
- require '#{lib}/bundler'
+ require '#{lib_dir}/bundler'
Bundler.setup
puts $LOAD_PATH
RUBY
@@ -144,7 +144,7 @@ RSpec.describe "Bundler.setup" do
G
ruby! <<-RUBY
- require '#{lib}/bundler'
+ require '#{lib_dir}/bundler'
Bundler.setup
puts $LOAD_PATH
RUBY
@@ -172,7 +172,7 @@ RSpec.describe "Bundler.setup" do
G
ruby! <<-RUBY
- require '#{lib}/bundler/setup'
+ require '#{lib_dir}/bundler/setup'
puts $LOAD_PATH
RUBY
@@ -193,7 +193,7 @@ RSpec.describe "Bundler.setup" do
G
ruby <<-R
- require '#{lib}/bundler'
+ require '#{lib_dir}/bundler'
begin
Bundler.setup
@@ -213,7 +213,7 @@ RSpec.describe "Bundler.setup" do
G
ruby <<-R
- require '#{lib}/bundler'
+ require '#{lib_dir}/bundler'
Bundler.setup
R
@@ -236,7 +236,7 @@ RSpec.describe "Bundler.setup" do
G
ruby <<-R
- require '#{lib}/bundler'
+ require '#{lib_dir}/bundler'
Bundler.setup
R
@@ -289,7 +289,7 @@ RSpec.describe "Bundler.setup" do
ENV["BUNDLE_GEMFILE"] = "Gemfile"
ruby <<-R
- require '#{lib}/bundler'
+ require '#{lib_dir}/bundler'
begin
Bundler.setup
@@ -444,7 +444,7 @@ RSpec.describe "Bundler.setup" do
break_git!
ruby <<-R
- require '#{lib}/bundler'
+ require '#{lib_dir}/bundler'
begin
Bundler.setup
@@ -465,7 +465,7 @@ RSpec.describe "Bundler.setup" do
break_git!
ruby <<-R
- require "#{lib}/bundler"
+ require "#{lib_dir}/bundler"
begin
Bundler.setup
@@ -774,7 +774,7 @@ end
s.class.send(:define_method, :build_extensions) { nil }
end
- require '#{lib}/bundler'
+ require '#{lib_dir}/bundler'
gem '#{gem_name}'
puts $LOAD_PATH.count {|path| path =~ /#{gem_name}/} >= 2
@@ -1028,7 +1028,7 @@ end
bundle "install"
ruby <<-RUBY
- require '#{lib}/bundler'
+ require '#{lib_dir}/bundler'
def Bundler.require(path)
raise "LOSE"
end
@@ -1043,7 +1043,7 @@ end
describe "when Bundler is bundled" do
it "doesn't blow up" do
install_gemfile <<-G
- gem "bundler", :path => "#{File.expand_path("..", lib)}"
+ gem "bundler", :path => "#{root}"
G
bundle %(exec ruby -e "require 'bundler'; Bundler.setup")
@@ -1083,7 +1083,7 @@ end
context "is not present" do
it "does not change the lock" do
lockfile lock_with(nil)
- ruby "require '#{lib}/bundler/setup'"
+ ruby "require '#{lib_dir}/bundler/setup'"
lockfile_should_be lock_with(nil)
end
end
@@ -1091,7 +1091,7 @@ end
context "is newer" do
it "does not change the lock or warn" do
lockfile lock_with(Bundler::VERSION.succ)
- ruby "require '#{lib}/bundler/setup'"
+ ruby "require '#{lib_dir}/bundler/setup'"
expect(out).to eq("")
expect(err).to eq("")
lockfile_should_be lock_with(Bundler::VERSION.succ)
@@ -1101,7 +1101,7 @@ end
context "is older" do
it "does not change the lock" do
lockfile lock_with("1.10.1")
- ruby "require '#{lib}/bundler/setup'"
+ ruby "require '#{lib_dir}/bundler/setup'"
lockfile_should_be lock_with("1.10.1")
end
end
@@ -1148,14 +1148,14 @@ end
context "is not present" do
it "does not change the lock" do
- expect { ruby! "require '#{lib}/bundler/setup'" }.not_to change { lockfile }
+ expect { ruby! "require '#{lib_dir}/bundler/setup'" }.not_to change { lockfile }
end
end
context "is newer" do
let(:ruby_version) { "5.5.5" }
it "does not change the lock or warn" do
- expect { ruby! "require '#{lib}/bundler/setup'" }.not_to change { lockfile }
+ expect { ruby! "require '#{lib_dir}/bundler/setup'" }.not_to change { lockfile }
expect(out).to eq("")
expect(err).to eq("")
end
@@ -1164,7 +1164,7 @@ end
context "is older" do
let(:ruby_version) { "1.0.0" }
it "does not change the lock" do
- expect { ruby! "require '#{lib}/bundler/setup'" }.not_to change { lockfile }
+ expect { ruby! "require '#{lib_dir}/bundler/setup'" }.not_to change { lockfile }
end
end
end
@@ -1173,7 +1173,7 @@ end
it "does not load Psych" do
gemfile ""
ruby <<-RUBY
- require '#{lib}/bundler/setup'
+ require '#{lib_dir}/bundler/setup'
puts defined?(Psych::VERSION) ? Psych::VERSION : "undefined"
require 'psych'
puts Psych::VERSION
@@ -1186,7 +1186,7 @@ end
it "does not load openssl" do
install_gemfile! ""
ruby! <<-RUBY
- require "#{lib}/bundler/setup"
+ require "#{lib_dir}/bundler/setup"
puts defined?(OpenSSL) || "undefined"
require "openssl"
puts defined?(OpenSSL) || "undefined"
@@ -1240,7 +1240,7 @@ end
it "activates no gems with -rbundler/setup" do
install_gemfile! ""
- ruby! code, :env => { :RUBYOPT => activation_warning_hack_rubyopt + " -r#{lib}/bundler/setup" }
+ ruby! code, :env => { :RUBYOPT => activation_warning_hack_rubyopt + " -r#{lib_dir}/bundler/setup" }
expect(out).to eq("{}")
end
@@ -1315,7 +1315,7 @@ end
G
ruby! <<-RUBY
- require "#{lib}/bundler/setup"
+ require "#{lib_dir}/bundler/setup"
Object.new.gem "rack"
puts Gem.loaded_specs["rack"].full_name
RUBY
@@ -1330,7 +1330,7 @@ end
G
ruby <<-RUBY
- require "#{lib}/bundler/setup"
+ require "#{lib_dir}/bundler/setup"
Object.new.gem "rack"
puts "FAIL"
RUBY
@@ -1346,7 +1346,7 @@ end
G
ruby <<-RUBY
- require "#{lib}/bundler/setup"
+ require "#{lib_dir}/bundler/setup"
Object.new.require "rack"
puts "FAIL"
RUBY
diff --git a/spec/bundler/runtime/with_unbundled_env_spec.rb b/spec/bundler/runtime/with_unbundled_env_spec.rb
index a5140ae463..4aaf9d499c 100644
--- a/spec/bundler/runtime/with_unbundled_env_spec.rb
+++ b/spec/bundler/runtime/with_unbundled_env_spec.rb
@@ -81,8 +81,8 @@ RSpec.describe "Bundler.with_env helpers" do
it "should restore RUBYLIB", :ruby_repo do
code = "print #{modified_env}['RUBYLIB']"
- ENV["RUBYLIB"] = root.join("lib").to_s + File::PATH_SEPARATOR + "/foo"
- ENV["BUNDLER_ORIG_RUBYLIB"] = root.join("lib").to_s + File::PATH_SEPARATOR + "/foo-original"
+ ENV["RUBYLIB"] = lib_dir.to_s + File::PATH_SEPARATOR + "/foo"
+ ENV["BUNDLER_ORIG_RUBYLIB"] = lib_dir.to_s + File::PATH_SEPARATOR + "/foo-original"
bundle_exec_ruby! code.dump
expect(last_command.stdboth).to include("/foo-original")
end
@@ -127,13 +127,17 @@ RSpec.describe "Bundler.with_env helpers" do
describe "Bundler.with_clean_env", :bundler => 2 do
it "should set ENV to unbundled_env in the block" do
expected = Bundler.unbundled_env
- actual = Bundler.with_clean_env { ENV.to_hash }
+
+ actual = Bundler.ui.silence do
+ Bundler.with_clean_env { ENV.to_hash }
+ end
+
expect(actual).to eq(expected)
end
it "should restore the environment after execution" do
- Bundler.with_clean_env do
- ENV["FOO"] = "hello"
+ Bundler.ui.silence do
+ Bundler.with_clean_env { ENV["FOO"] = "hello" }
end
expect(ENV).not_to have_key("FOO")
@@ -166,8 +170,7 @@ RSpec.describe "Bundler.with_env helpers" do
end
it "runs system inside with_original_env" do
- lib = File.expand_path("../../lib", __dir__)
- system({ "BUNDLE_FOO" => "bar" }, "ruby -I#{lib} -rbundler -e '#{code}'")
+ system({ "BUNDLE_FOO" => "bar" }, "ruby -I#{lib_dir} -rbundler -e '#{code}'")
expect($?.exitstatus).to eq(42)
end
end
@@ -175,15 +178,14 @@ RSpec.describe "Bundler.with_env helpers" do
describe "Bundler.clean_system", :bundler => 2 do
let(:code) do
<<~RUBY
- Bundler.clean_system(%([ "\$BUNDLE_FOO" = "bar" ] || exit 42))
+ Bundler.ui.silence { Bundler.clean_system(%([ "\$BUNDLE_FOO" = "bar" ] || exit 42)) }
exit $?.exitstatus
RUBY
end
it "runs system inside with_clean_env" do
- lib = File.expand_path("../../lib", __dir__)
- system({ "BUNDLE_FOO" => "bar" }, "ruby -I#{lib} -rbundler -e '#{code}'")
+ system({ "BUNDLE_FOO" => "bar" }, "ruby -I#{lib_dir} -rbundler -e '#{code}'")
expect($?.exitstatus).to eq(42)
end
end
@@ -198,8 +200,7 @@ RSpec.describe "Bundler.with_env helpers" do
end
it "runs system inside with_unbundled_env" do
- lib = File.expand_path("../../lib", __dir__)
- system({ "BUNDLE_FOO" => "bar" }, "ruby -I#{lib} -rbundler -e '#{code}'")
+ system({ "BUNDLE_FOO" => "bar" }, "ruby -I#{lib_dir} -rbundler -e '#{code}'")
expect($?.exitstatus).to eq(42)
end
end
@@ -220,8 +221,7 @@ RSpec.describe "Bundler.with_env helpers" do
it "runs exec inside with_original_env" do
skip "Fork not implemented" if Gem.win_platform?
- lib = File.expand_path("../../lib", __dir__)
- system({ "BUNDLE_FOO" => "bar" }, "ruby -I#{lib} -rbundler -e '#{code}'")
+ system({ "BUNDLE_FOO" => "bar" }, "ruby -I#{lib_dir} -rbundler -e '#{code}'")
expect($?.exitstatus).to eq(0)
end
end
@@ -230,7 +230,7 @@ RSpec.describe "Bundler.with_env helpers" do
let(:code) do
<<~RUBY
Process.fork do
- exit Bundler.clean_exec(%(test "\$BUNDLE_FOO" = "bar"))
+ exit Bundler.ui.silence { Bundler.clean_exec(%(test "\$BUNDLE_FOO" = "bar")) }
end
_, status = Process.wait2
@@ -242,8 +242,7 @@ RSpec.describe "Bundler.with_env helpers" do
it "runs exec inside with_clean_env" do
skip "Fork not implemented" if Gem.win_platform?
- lib = File.expand_path("../../lib", __dir__)
- system({ "BUNDLE_FOO" => "bar" }, "ruby -I#{lib} -rbundler -e '#{code}'")
+ system({ "BUNDLE_FOO" => "bar" }, "ruby -I#{lib_dir} -rbundler -e '#{code}'")
expect($?.exitstatus).to eq(1)
end
end
@@ -264,8 +263,7 @@ RSpec.describe "Bundler.with_env helpers" do
it "runs exec inside with_clean_env" do
skip "Fork not implemented" if Gem.win_platform?
- lib = File.expand_path("../../lib", __dir__)
- system({ "BUNDLE_FOO" => "bar" }, "ruby -I#{lib} -rbundler -e '#{code}'")
+ system({ "BUNDLE_FOO" => "bar" }, "ruby -I#{lib_dir} -rbundler -e '#{code}'")
expect($?.exitstatus).to eq(1)
end
end
diff --git a/spec/bundler/spec_helper.rb b/spec/bundler/spec_helper.rb
index 58d498e070..ba21d22fbd 100644
--- a/spec/bundler/spec_helper.rb
+++ b/spec/bundler/spec_helper.rb
@@ -1,7 +1,9 @@
# frozen_string_literal: true
-$:.unshift File.expand_path("..", __FILE__)
-$:.unshift File.expand_path("../../lib", __FILE__)
+require_relative "support/path"
+
+$:.unshift Spec::Path.spec_dir.to_s
+$:.unshift Spec::Path.lib_dir.to_s
require "bundler/psyched_yaml"
require "bundler/vendored_fileutils"
@@ -15,10 +17,16 @@ end
require "bundler"
require "rspec"
-Dir["#{File.expand_path("../support", __FILE__)}/*.rb"].each do |file|
- file = file.gsub(%r{\A#{Regexp.escape File.expand_path("..", __FILE__)}/}, "")
- require file unless file.end_with?("hax.rb")
-end
+require_relative "support/builders"
+require_relative "support/filters"
+require_relative "support/helpers"
+require_relative "support/indexes"
+require_relative "support/matchers"
+require_relative "support/parallel"
+require_relative "support/permissions"
+require_relative "support/platforms"
+require_relative "support/sometimes"
+require_relative "support/sudo"
$debug = false
@@ -34,7 +42,6 @@ RSpec.configure do |config|
config.include Spec::Indexes
config.include Spec::Matchers
config.include Spec::Path
- config.include Spec::Rubygems
config.include Spec::Platforms
config.include Spec::Sudo
config.include Spec::Permissions
@@ -52,28 +59,6 @@ RSpec.configure do |config|
config.bisect_runner = :shell
- if ENV["BUNDLER_SUDO_TESTS"] && Spec::Sudo.present?
- config.filter_run :sudo => true
- else
- config.filter_run_excluding :sudo => true
- end
-
- if ENV["BUNDLER_REALWORLD_TESTS"]
- config.filter_run :realworld => true
- else
- config.filter_run_excluding :realworld => true
- end
-
- git_version = Bundler::Source::Git::GitProxy.new(nil, nil, nil).version
-
- config.filter_run_excluding :rubygems => RequirementChecker.against(Gem::VERSION)
- config.filter_run_excluding :git => RequirementChecker.against(git_version)
- config.filter_run_excluding :bundler => RequirementChecker.against(Bundler::VERSION.split(".")[0])
- config.filter_run_excluding :ruby_repo => !ENV["GEM_COMMAND"].nil?
- config.filter_run_excluding :no_color_tty => Gem.win_platform? || !ENV["GITHUB_ACTION"].nil?
-
- config.filter_run_when_matching :focus unless ENV["CI"]
-
original_wd = Dir.pwd
original_env = ENV.to_hash
@@ -95,6 +80,7 @@ RSpec.configure do |config|
end
config.before :suite do
+ require_relative "support/rubygems_ext"
Spec::Rubygems.setup
ENV["RUBYOPT"] = "#{ENV["RUBYOPT"]} -r#{Spec::Path.spec_dir}/support/hax.rb"
ENV["BUNDLE_SPEC_RUN"] = "true"
@@ -122,7 +108,7 @@ RSpec.configure do |config|
in_app_root
@command_executions = []
- example.run
+ Bundler.ui.silence { example.run }
all_output = @command_executions.map(&:to_s_verbose).join("\n\n")
if example.exception && !all_output.empty?
diff --git a/spec/bundler/support/artifice/compact_index.rb b/spec/bundler/support/artifice/compact_index.rb
index 4f01690ae4..89362c4dbc 100644
--- a/spec/bundler/support/artifice/compact_index.rb
+++ b/spec/bundler/support/artifice/compact_index.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../endpoint", __FILE__)
+require_relative "endpoint"
$LOAD_PATH.unshift Dir[base_system_gems.join("gems/compact_index*/lib")].first.to_s
require "compact_index"
diff --git a/spec/bundler/support/artifice/compact_index_api_missing.rb b/spec/bundler/support/artifice/compact_index_api_missing.rb
index 94e6b73000..fdd342bc08 100644
--- a/spec/bundler/support/artifice/compact_index_api_missing.rb
+++ b/spec/bundler/support/artifice/compact_index_api_missing.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../compact_index", __FILE__)
+require_relative "compact_index"
Artifice.deactivate
diff --git a/spec/bundler/support/artifice/compact_index_basic_authentication.rb b/spec/bundler/support/artifice/compact_index_basic_authentication.rb
index 97aa6cbd84..775f1a3977 100644
--- a/spec/bundler/support/artifice/compact_index_basic_authentication.rb
+++ b/spec/bundler/support/artifice/compact_index_basic_authentication.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../compact_index", __FILE__)
+require_relative "compact_index"
Artifice.deactivate
diff --git a/spec/bundler/support/artifice/compact_index_checksum_mismatch.rb b/spec/bundler/support/artifice/compact_index_checksum_mismatch.rb
index 62feb9f164..1abe64236c 100644
--- a/spec/bundler/support/artifice/compact_index_checksum_mismatch.rb
+++ b/spec/bundler/support/artifice/compact_index_checksum_mismatch.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../compact_index", __FILE__)
+require_relative "compact_index"
Artifice.deactivate
diff --git a/spec/bundler/support/artifice/compact_index_concurrent_download.rb b/spec/bundler/support/artifice/compact_index_concurrent_download.rb
index 972ecb88b7..7f989a3f37 100644
--- a/spec/bundler/support/artifice/compact_index_concurrent_download.rb
+++ b/spec/bundler/support/artifice/compact_index_concurrent_download.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../compact_index", __FILE__)
+require_relative "compact_index"
Artifice.deactivate
diff --git a/spec/bundler/support/artifice/compact_index_creds_diff_host.rb b/spec/bundler/support/artifice/compact_index_creds_diff_host.rb
index 0d349bcc1e..6c3442e14b 100644
--- a/spec/bundler/support/artifice/compact_index_creds_diff_host.rb
+++ b/spec/bundler/support/artifice/compact_index_creds_diff_host.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../compact_index", __FILE__)
+require_relative "compact_index"
Artifice.deactivate
diff --git a/spec/bundler/support/artifice/compact_index_extra.rb b/spec/bundler/support/artifice/compact_index_extra.rb
index 84d1859235..3a09afd06f 100644
--- a/spec/bundler/support/artifice/compact_index_extra.rb
+++ b/spec/bundler/support/artifice/compact_index_extra.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../compact_index", __FILE__)
+require_relative "compact_index"
Artifice.deactivate
diff --git a/spec/bundler/support/artifice/compact_index_extra_api.rb b/spec/bundler/support/artifice/compact_index_extra_api.rb
index 903aa900fb..3c716763c0 100644
--- a/spec/bundler/support/artifice/compact_index_extra_api.rb
+++ b/spec/bundler/support/artifice/compact_index_extra_api.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../compact_index", __FILE__)
+require_relative "compact_index"
Artifice.deactivate
diff --git a/spec/bundler/support/artifice/compact_index_extra_api_missing.rb b/spec/bundler/support/artifice/compact_index_extra_api_missing.rb
index e72040f604..6bd24ddbb4 100644
--- a/spec/bundler/support/artifice/compact_index_extra_api_missing.rb
+++ b/spec/bundler/support/artifice/compact_index_extra_api_missing.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../compact_index_extra_api", __FILE__)
+require_relative "compact_index_extra_api"
Artifice.deactivate
diff --git a/spec/bundler/support/artifice/compact_index_extra_missing.rb b/spec/bundler/support/artifice/compact_index_extra_missing.rb
index 67a9d23691..4758b785ac 100644
--- a/spec/bundler/support/artifice/compact_index_extra_missing.rb
+++ b/spec/bundler/support/artifice/compact_index_extra_missing.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../compact_index_extra", __FILE__)
+require_relative "compact_index_extra"
Artifice.deactivate
diff --git a/spec/bundler/support/artifice/compact_index_forbidden.rb b/spec/bundler/support/artifice/compact_index_forbidden.rb
index 0a4dfdb2e8..3eebe0fbd8 100644
--- a/spec/bundler/support/artifice/compact_index_forbidden.rb
+++ b/spec/bundler/support/artifice/compact_index_forbidden.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../compact_index", __FILE__)
+require_relative "compact_index"
Artifice.deactivate
diff --git a/spec/bundler/support/artifice/compact_index_host_redirect.rb b/spec/bundler/support/artifice/compact_index_host_redirect.rb
index ab371117de..304c897d68 100644
--- a/spec/bundler/support/artifice/compact_index_host_redirect.rb
+++ b/spec/bundler/support/artifice/compact_index_host_redirect.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../compact_index", __FILE__)
+require_relative "compact_index"
Artifice.deactivate
diff --git a/spec/bundler/support/artifice/compact_index_no_gem.rb b/spec/bundler/support/artifice/compact_index_no_gem.rb
index 01c5be1b3d..0a4be08a46 100644
--- a/spec/bundler/support/artifice/compact_index_no_gem.rb
+++ b/spec/bundler/support/artifice/compact_index_no_gem.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../compact_index", __FILE__)
+require_relative "compact_index"
Artifice.deactivate
diff --git a/spec/bundler/support/artifice/compact_index_partial_update.rb b/spec/bundler/support/artifice/compact_index_partial_update.rb
index eaedff5105..6e7c05d423 100644
--- a/spec/bundler/support/artifice/compact_index_partial_update.rb
+++ b/spec/bundler/support/artifice/compact_index_partial_update.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../compact_index", __FILE__)
+require_relative "compact_index"
Artifice.deactivate
diff --git a/spec/bundler/support/artifice/compact_index_range_not_satisfiable.rb b/spec/bundler/support/artifice/compact_index_range_not_satisfiable.rb
index 487be4771a..788f9d6f99 100644
--- a/spec/bundler/support/artifice/compact_index_range_not_satisfiable.rb
+++ b/spec/bundler/support/artifice/compact_index_range_not_satisfiable.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../compact_index", __FILE__)
+require_relative "compact_index"
Artifice.deactivate
diff --git a/spec/bundler/support/artifice/compact_index_rate_limited.rb b/spec/bundler/support/artifice/compact_index_rate_limited.rb
index d8f4fc941c..ba17476045 100644
--- a/spec/bundler/support/artifice/compact_index_rate_limited.rb
+++ b/spec/bundler/support/artifice/compact_index_rate_limited.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../compact_index", __FILE__)
+require_relative "compact_index"
Artifice.deactivate
diff --git a/spec/bundler/support/artifice/compact_index_redirects.rb b/spec/bundler/support/artifice/compact_index_redirects.rb
index e83451b5b6..99adc797bf 100644
--- a/spec/bundler/support/artifice/compact_index_redirects.rb
+++ b/spec/bundler/support/artifice/compact_index_redirects.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../compact_index", __FILE__)
+require_relative "compact_index"
Artifice.deactivate
diff --git a/spec/bundler/support/artifice/compact_index_strict_basic_authentication.rb b/spec/bundler/support/artifice/compact_index_strict_basic_authentication.rb
index abbf3258e7..7d427b5382 100644
--- a/spec/bundler/support/artifice/compact_index_strict_basic_authentication.rb
+++ b/spec/bundler/support/artifice/compact_index_strict_basic_authentication.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../compact_index", __FILE__)
+require_relative "compact_index"
Artifice.deactivate
diff --git a/spec/bundler/support/artifice/compact_index_wrong_dependencies.rb b/spec/bundler/support/artifice/compact_index_wrong_dependencies.rb
index 7e1d3686e2..036fac70b3 100644
--- a/spec/bundler/support/artifice/compact_index_wrong_dependencies.rb
+++ b/spec/bundler/support/artifice/compact_index_wrong_dependencies.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../compact_index", __FILE__)
+require_relative "compact_index"
Artifice.deactivate
diff --git a/spec/bundler/support/artifice/compact_index_wrong_gem_checksum.rb b/spec/bundler/support/artifice/compact_index_wrong_gem_checksum.rb
index db4d8e3974..8add32b88f 100644
--- a/spec/bundler/support/artifice/compact_index_wrong_gem_checksum.rb
+++ b/spec/bundler/support/artifice/compact_index_wrong_gem_checksum.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../compact_index", __FILE__)
+require_relative "compact_index"
Artifice.deactivate
diff --git a/spec/bundler/support/artifice/endopint_marshal_fail_basic_authentication.rb b/spec/bundler/support/artifice/endopint_marshal_fail_basic_authentication.rb
index 12a6fa153f..c341c3993f 100644
--- a/spec/bundler/support/artifice/endopint_marshal_fail_basic_authentication.rb
+++ b/spec/bundler/support/artifice/endopint_marshal_fail_basic_authentication.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../endpoint_marshal_fail", __FILE__)
+require_relative "endpoint_marshal_fail"
Artifice.deactivate
diff --git a/spec/bundler/support/artifice/endpoint.rb b/spec/bundler/support/artifice/endpoint.rb
index 966681f8d8..bf26c56503 100644
--- a/spec/bundler/support/artifice/endpoint.rb
+++ b/spec/bundler/support/artifice/endpoint.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-require File.expand_path("../../path.rb", __FILE__)
-require Spec::Path.root.join("lib/bundler/deprecate")
+require_relative "../path"
+require Spec::Path.lib_dir.join("bundler/deprecate")
include Spec::Path
$LOAD_PATH.unshift(*Dir[Spec::Path.base_system_gems.join("gems/{artifice,mustermann,rack,tilt,sinatra}-*/lib")].map(&:to_s))
@@ -44,7 +44,7 @@ class Endpoint < Sinatra::Base
def dependencies_for(gem_names, gem_repo = GEM_REPO)
return [] if gem_names.nil? || gem_names.empty?
- require "#{Spec::Path.lib}/bundler"
+ require "#{Spec::Path.lib_dir}/bundler"
Bundler::Deprecate.skip_during do
all_specs = %w[specs.4.8 prerelease_specs.4.8].map do |filename|
Marshal.load(File.open(gem_repo.join(filename)).read)
diff --git a/spec/bundler/support/artifice/endpoint_500.rb b/spec/bundler/support/artifice/endpoint_500.rb
index ad51d58e67..f98e7e3bc2 100644
--- a/spec/bundler/support/artifice/endpoint_500.rb
+++ b/spec/bundler/support/artifice/endpoint_500.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../../path.rb", __FILE__)
+require_relative "../path"
include Spec::Path
$LOAD_PATH.unshift(*Dir[Spec::Path.base_system_gems.join("gems/{artifice,mustermann,rack,tilt,sinatra}-*/lib")].map(&:to_s))
diff --git a/spec/bundler/support/artifice/endpoint_api_forbidden.rb b/spec/bundler/support/artifice/endpoint_api_forbidden.rb
index bb89747adc..edc2463424 100644
--- a/spec/bundler/support/artifice/endpoint_api_forbidden.rb
+++ b/spec/bundler/support/artifice/endpoint_api_forbidden.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../endpoint", __FILE__)
+require_relative "endpoint"
Artifice.deactivate
diff --git a/spec/bundler/support/artifice/endpoint_api_missing.rb b/spec/bundler/support/artifice/endpoint_api_missing.rb
index 2ada0dc553..8dafde7362 100644
--- a/spec/bundler/support/artifice/endpoint_api_missing.rb
+++ b/spec/bundler/support/artifice/endpoint_api_missing.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../endpoint", __FILE__)
+require_relative "endpoint"
Artifice.deactivate
diff --git a/spec/bundler/support/artifice/endpoint_basic_authentication.rb b/spec/bundler/support/artifice/endpoint_basic_authentication.rb
index 223671bc29..ff3d1493d6 100644
--- a/spec/bundler/support/artifice/endpoint_basic_authentication.rb
+++ b/spec/bundler/support/artifice/endpoint_basic_authentication.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../endpoint", __FILE__)
+require_relative "endpoint"
Artifice.deactivate
diff --git a/spec/bundler/support/artifice/endpoint_creds_diff_host.rb b/spec/bundler/support/artifice/endpoint_creds_diff_host.rb
index 925954b12d..f20ef74ac6 100644
--- a/spec/bundler/support/artifice/endpoint_creds_diff_host.rb
+++ b/spec/bundler/support/artifice/endpoint_creds_diff_host.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../endpoint", __FILE__)
+require_relative "endpoint"
Artifice.deactivate
diff --git a/spec/bundler/support/artifice/endpoint_extra.rb b/spec/bundler/support/artifice/endpoint_extra.rb
index 422f65401b..31f6822161 100644
--- a/spec/bundler/support/artifice/endpoint_extra.rb
+++ b/spec/bundler/support/artifice/endpoint_extra.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../endpoint", __FILE__)
+require_relative "endpoint"
Artifice.deactivate
diff --git a/spec/bundler/support/artifice/endpoint_extra_api.rb b/spec/bundler/support/artifice/endpoint_extra_api.rb
index 62e2c2bb93..213b8e5895 100644
--- a/spec/bundler/support/artifice/endpoint_extra_api.rb
+++ b/spec/bundler/support/artifice/endpoint_extra_api.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../endpoint", __FILE__)
+require_relative "endpoint"
Artifice.deactivate
diff --git a/spec/bundler/support/artifice/endpoint_extra_missing.rb b/spec/bundler/support/artifice/endpoint_extra_missing.rb
index 038a12610a..ee129025ff 100644
--- a/spec/bundler/support/artifice/endpoint_extra_missing.rb
+++ b/spec/bundler/support/artifice/endpoint_extra_missing.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../endpoint_extra", __FILE__)
+require_relative "endpoint_extra"
Artifice.deactivate
diff --git a/spec/bundler/support/artifice/endpoint_fallback.rb b/spec/bundler/support/artifice/endpoint_fallback.rb
index 554c08f0a2..08edf232e3 100644
--- a/spec/bundler/support/artifice/endpoint_fallback.rb
+++ b/spec/bundler/support/artifice/endpoint_fallback.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../endpoint", __FILE__)
+require_relative "endpoint"
Artifice.deactivate
diff --git a/spec/bundler/support/artifice/endpoint_host_redirect.rb b/spec/bundler/support/artifice/endpoint_host_redirect.rb
index cda5664be2..338cbcad00 100644
--- a/spec/bundler/support/artifice/endpoint_host_redirect.rb
+++ b/spec/bundler/support/artifice/endpoint_host_redirect.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../endpoint", __FILE__)
+require_relative "endpoint"
Artifice.deactivate
diff --git a/spec/bundler/support/artifice/endpoint_marshal_fail.rb b/spec/bundler/support/artifice/endpoint_marshal_fail.rb
index 2a5dcdc2fd..22c13e3e17 100644
--- a/spec/bundler/support/artifice/endpoint_marshal_fail.rb
+++ b/spec/bundler/support/artifice/endpoint_marshal_fail.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../endpoint_fallback", __FILE__)
+require_relative "endpoint_fallback"
Artifice.deactivate
diff --git a/spec/bundler/support/artifice/endpoint_mirror_source.rb b/spec/bundler/support/artifice/endpoint_mirror_source.rb
index 64452f198d..318866e420 100644
--- a/spec/bundler/support/artifice/endpoint_mirror_source.rb
+++ b/spec/bundler/support/artifice/endpoint_mirror_source.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../endpoint", __FILE__)
+require_relative "endpoint"
class EndpointMirrorSource < Endpoint
get "/gems/:id" do
diff --git a/spec/bundler/support/artifice/endpoint_redirect.rb b/spec/bundler/support/artifice/endpoint_redirect.rb
index ebf01458ba..ee97fccf64 100644
--- a/spec/bundler/support/artifice/endpoint_redirect.rb
+++ b/spec/bundler/support/artifice/endpoint_redirect.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../endpoint", __FILE__)
+require_relative "endpoint"
Artifice.deactivate
diff --git a/spec/bundler/support/artifice/endpoint_strict_basic_authentication.rb b/spec/bundler/support/artifice/endpoint_strict_basic_authentication.rb
index 905a519f3f..4d4da08770 100644
--- a/spec/bundler/support/artifice/endpoint_strict_basic_authentication.rb
+++ b/spec/bundler/support/artifice/endpoint_strict_basic_authentication.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../endpoint", __FILE__)
+require_relative "endpoint"
Artifice.deactivate
diff --git a/spec/bundler/support/artifice/endpoint_timeout.rb b/spec/bundler/support/artifice/endpoint_timeout.rb
index 3f60471c90..c118da1893 100644
--- a/spec/bundler/support/artifice/endpoint_timeout.rb
+++ b/spec/bundler/support/artifice/endpoint_timeout.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../endpoint_fallback", __FILE__)
+require_relative "endpoint_fallback"
Artifice.deactivate
diff --git a/spec/bundler/support/artifice/vcr.rb b/spec/bundler/support/artifice/vcr.rb
index 1e3809ff62..a46f8e9391 100644
--- a/spec/bundler/support/artifice/vcr.rb
+++ b/spec/bundler/support/artifice/vcr.rb
@@ -1,8 +1,9 @@
# frozen_string_literal: true
require "net/http"
+require_relative "../path"
-CASSETTE_PATH = File.expand_path("../vcr_cassettes", __FILE__)
+CASSETTE_PATH = "#{Spec::Path.spec_dir}/support/artifice/vcr_cassettes"
CASSETTE_NAME = ENV.fetch("BUNDLER_SPEC_VCR_CASSETTE_NAME") { "realworld" }
class BundlerVCRHTTP < Net::HTTP
diff --git a/spec/bundler/support/artifice/windows.rb b/spec/bundler/support/artifice/windows.rb
index 0630798df0..ce7455b86c 100644
--- a/spec/bundler/support/artifice/windows.rb
+++ b/spec/bundler/support/artifice/windows.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require File.expand_path("../../path.rb", __FILE__)
+require_relative "../path"
include Spec::Path
$LOAD_PATH.unshift(*Dir[Spec::Path.base_system_gems.join("gems/{artifice,mustermann,rack,tilt,sinatra}-*/lib")].map(&:to_s))
diff --git a/spec/bundler/support/command_execution.rb b/spec/bundler/support/command_execution.rb
index cec531d6c3..b3c289979f 100644
--- a/spec/bundler/support/command_execution.rb
+++ b/spec/bundler/support/command_execution.rb
@@ -1,12 +1,7 @@
# frozen_string_literal: true
-require "support/helpers"
-require "support/path"
-
module Spec
CommandExecution = Struct.new(:command, :working_directory, :exitstatus, :stdout, :stderr) do
- include RSpec::Matchers::Composable
-
def to_s
c = Shellwords.shellsplit(command.strip).map {|s| s.include?("\n") ? " \\\n <<EOS\n#{s.gsub(/^/, " ").chomp}\nEOS" : Shellwords.shellescape(s) }
c = c.reduce("") do |acc, elem|
diff --git a/spec/bundler/support/filters.rb b/spec/bundler/support/filters.rb
new file mode 100644
index 0000000000..4ce6648cdc
--- /dev/null
+++ b/spec/bundler/support/filters.rb
@@ -0,0 +1,45 @@
+# frozen_string_literal: true
+
+require_relative "sudo"
+
+class RequirementChecker < Proc
+ def self.against(present)
+ provided = Gem::Version.new(present)
+
+ new do |required|
+ !Gem::Requirement.new(required).satisfied_by?(provided)
+ end.tap do |checker|
+ checker.provided = provided
+ end
+ end
+
+ attr_accessor :provided
+
+ def inspect
+ "\"!= #{provided}\""
+ end
+end
+
+RSpec.configure do |config|
+ if ENV["BUNDLER_SUDO_TESTS"] && Spec::Sudo.present?
+ config.filter_run :sudo => true
+ else
+ config.filter_run_excluding :sudo => true
+ end
+
+ if ENV["BUNDLER_REALWORLD_TESTS"]
+ config.filter_run :realworld => true
+ else
+ config.filter_run_excluding :realworld => true
+ end
+
+ git_version = Bundler::Source::Git::GitProxy.new(nil, nil, nil).version
+
+ config.filter_run_excluding :rubygems => RequirementChecker.against(Gem::VERSION)
+ config.filter_run_excluding :git => RequirementChecker.against(git_version)
+ config.filter_run_excluding :bundler => RequirementChecker.against(Bundler::VERSION.split(".")[0])
+ config.filter_run_excluding :ruby_repo => !ENV["GEM_COMMAND"].nil?
+ config.filter_run_excluding :no_color_tty => Gem.win_platform? || !ENV["GITHUB_ACTION"].nil?
+
+ config.filter_run_when_matching :focus unless ENV["CI"]
+end
diff --git a/spec/bundler/support/helpers.rb b/spec/bundler/support/helpers.rb
index 0c05789946..8bf76bba89 100644
--- a/spec/bundler/support/helpers.rb
+++ b/spec/bundler/support/helpers.rb
@@ -2,6 +2,9 @@
require "open3"
+require_relative "command_execution"
+require_relative "the_bundle"
+
module Spec
module Helpers
def reset!
@@ -16,8 +19,6 @@ module Spec
FileUtils.mkdir_p(home)
FileUtils.mkdir_p(tmpdir)
Bundler.reset!
- Bundler.ui = nil
- Bundler.ui # force it to initialize
end
def self.bang(method)
@@ -77,7 +78,7 @@ module Spec
def run(cmd, *args)
opts = args.last.is_a?(Hash) ? args.pop : {}
groups = args.map(&:inspect).join(", ")
- setup = "require '#{lib}/bundler' ; Bundler.setup(#{groups})\n"
+ setup = "require '#{lib_dir}/bundler' ; Bundler.ui.silence { Bundler.setup(#{groups}) }\n"
ruby(setup + cmd, opts)
end
bang :run
@@ -95,10 +96,6 @@ module Spec
run(cmd, *args)
end
- def spec
- spec_dir.to_s
- end
-
def bundle(cmd, options = {})
with_sudo = options.delete(:sudo)
sudo = with_sudo == :preserve_env ? "sudo -E" : "sudo" if with_sudo
@@ -113,6 +110,7 @@ module Spec
env["PATH"].gsub!("#{Path.root}/exe", "") if env["PATH"] && system_bundler
requires = options.delete(:requires) || []
+ requires << "support/rubygems"
requires << "support/hax"
artifice = options.delete(:artifice) do
@@ -123,14 +121,14 @@ module Spec
end
end
if artifice
- requires << File.expand_path("../artifice/#{artifice}", __FILE__)
+ requires << "support/artifice/#{artifice}"
end
requires_str = requires.map {|r| "-r#{r}" }.join(" ")
load_path = []
- load_path << lib unless system_bundler
- load_path << spec
+ load_path << lib_dir unless system_bundler
+ load_path << spec_dir
load_path_str = "-I#{load_path.join(File::PATH_SEPARATOR)}"
args = options.map do |k, v|
@@ -146,7 +144,7 @@ module Spec
end
end.join
- cmd = "#{sudo} #{Gem.ruby} #{load_path_str} #{requires_str} #{bundle_bin} #{cmd}#{args}"
+ cmd = "#{sudo} #{Gem.ruby} --disable-gems #{load_path_str} #{requires_str} #{bundle_bin} #{cmd}#{args}"
sys_exec(cmd, env) {|i, o, thr| yield i, o, thr if block_given? }
end
bang :bundle
@@ -174,10 +172,10 @@ module Spec
end
def ruby(ruby, options = {})
- env = (options.delete(:env) || {}).map {|k, v| "#{k}='#{v}' " }.join
+ env = options.delete(:env) || {}
ruby = ruby.gsub(/["`\$]/) {|m| "\\#{m}" }
- lib_option = options[:no_lib] ? "" : " -I#{lib}"
- sys_exec(%(#{env}#{Gem.ruby}#{lib_option} -e "#{ruby}"))
+ lib_option = options[:no_lib] ? "" : " -I#{lib_dir}"
+ sys_exec(%(#{Gem.ruby}#{lib_option} -e "#{ruby}"), env)
end
bang :ruby
@@ -193,7 +191,7 @@ module Spec
def gembin(cmd)
old = ENV["RUBYOPT"]
- ENV["RUBYOPT"] = "#{ENV["RUBYOPT"]} -I#{lib}"
+ ENV["RUBYOPT"] = "#{ENV["RUBYOPT"]} -I#{lib_dir}"
cmd = bundled_app("bin/#{cmd}") unless cmd.to_s.include?("/")
sys_exec(cmd.to_s)
ensure
@@ -513,10 +511,6 @@ module Spec
Dir.chdir(path) { `git rev-parse HEAD`.strip }
end
- def capture_output
- capture(:stdout)
- end
-
def with_read_only(pattern)
chmod = lambda do |dirmode, filemode|
lambda do |f|
diff --git a/spec/bundler/support/matchers.rb b/spec/bundler/support/matchers.rb
index b0493801e8..69d3be4a3d 100644
--- a/spec/bundler/support/matchers.rb
+++ b/spec/bundler/support/matchers.rb
@@ -1,7 +1,8 @@
# frozen_string_literal: true
require "forwardable"
-require "support/the_bundle"
+require_relative "the_bundle"
+
module Spec
module Matchers
extend RSpec::Matchers
@@ -170,7 +171,7 @@ module Spec
end
R
rescue StandardError => e
- next "checking for #{name} failed:\n#{e}"
+ next "checking for #{name} failed:\n#{e}\n#{e.backtrace.join("\n")}"
end
next if out == "WIN"
next "expected #{name} to not be installed, but it was" if version.nil?
diff --git a/spec/bundler/support/path.rb b/spec/bundler/support/path.rb
index db28454792..b957e24abe 100644
--- a/spec/bundler/support/path.rb
+++ b/spec/bundler/support/path.rb
@@ -22,7 +22,7 @@ module Spec
end
def gem_bin
- @gem_bin ||= ruby_core? ? ENV["GEM_COMMAND"] : "#{Gem.ruby} -S gem --backtrace"
+ @gem_bin ||= ruby_core? ? ENV["GEM_COMMAND"] : "#{Gem.ruby} --disable-gems -r#{spec_dir}/support/rubygems -S gem --backtrace"
end
def spec_dir
@@ -131,7 +131,7 @@ module Spec
tmp("libs", *args)
end
- def lib
+ def lib_dir
root.join("lib")
end
diff --git a/spec/bundler/support/requirement_checker.rb b/spec/bundler/support/requirement_checker.rb
deleted file mode 100644
index e6bd0eb50d..0000000000
--- a/spec/bundler/support/requirement_checker.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class RequirementChecker < Proc
- def self.against(present)
- provided = Gem::Version.new(present)
-
- new do |required|
- !Gem::Requirement.new(required).satisfied_by?(provided)
- end.tap do |checker|
- checker.provided = provided
- end
- end
-
- attr_accessor :provided
-
- def inspect
- "\"!= #{provided}\""
- end
-end
diff --git a/spec/bundler/support/rubygems.rb b/spec/bundler/support/rubygems.rb
new file mode 100644
index 0000000000..e60f9a928e
--- /dev/null
+++ b/spec/bundler/support/rubygems.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+require_relative "rubygems_version_manager"
+
+RubygemsVersionManager.new(ENV["RGV"]).switch
+
+require "rubygems"
diff --git a/spec/bundler/support/rubygems_ext.rb b/spec/bundler/support/rubygems_ext.rb
index faa474a917..1093362d81 100644
--- a/spec/bundler/support/rubygems_ext.rb
+++ b/spec/bundler/support/rubygems_ext.rb
@@ -1,6 +1,5 @@
# frozen_string_literal: true
-require "rubygems/user_interaction"
require_relative "path"
require "fileutils"
@@ -29,7 +28,9 @@ module Spec
"ruby-graphviz" => ">= 0.a",
}.freeze
- def self.dev_setup
+ extend self
+
+ def dev_setup
deps = DEV_DEPS
# JRuby can't build ronn, so we skip that
@@ -38,22 +39,17 @@ module Spec
install_gems(deps)
end
- def self.gem_load(gem_name, bin_container)
- gem_activate(gem_name)
- load Gem.bin_path(gem_name, bin_container)
+ def gem_load(gem_name, bin_container)
+ require_relative "rubygems"
+ gem_load_and_activate(gem_name, bin_container)
end
- def self.gem_activate(gem_name)
- gem_requirement = DEV_DEPS[gem_name]
- gem gem_name, gem_requirement
- end
-
- def self.gem_require(gem_name)
+ def gem_require(gem_name)
gem_activate(gem_name)
require gem_name
end
- def self.setup
+ def setup
Gem.clear_paths
ENV["BUNDLE_PATH"] = nil
@@ -71,20 +67,37 @@ module Spec
manifest_path.open("w") {|f| f << manifest.join }
end
+ FileUtils.mkdir_p(Path.home)
+ FileUtils.mkdir_p(Path.tmpdir)
+
ENV["HOME"] = Path.home.to_s
ENV["TMPDIR"] = Path.tmpdir.to_s
+ require "rubygems/user_interaction"
Gem::DefaultUserInteraction.ui = Gem::SilentUI.new
end
- def self.install_gems(gems)
+ private
+
+ def gem_load_and_activate(gem_name, bin_container)
+ gem_activate(gem_name)
+ load Gem.bin_path(gem_name, bin_container)
+ rescue Gem::LoadError => e
+ abort "We couln't activate #{gem_name} (#{e.requirement}). Run `gem install #{gem_name}:'#{e.requirement}'`"
+ end
+
+ def gem_activate(gem_name)
+ gem_requirement = DEV_DEPS[gem_name]
+ gem gem_name, gem_requirement
+ end
+
+ def install_gems(gems)
reqs, no_reqs = gems.partition {|_, req| !req.nil? && !req.split(" ").empty? }
no_reqs.map!(&:first)
reqs.map! {|name, req| "'#{name}:#{req}'" }
deps = reqs.concat(no_reqs).join(" ")
gem = Path.gem_bin
cmd = "#{gem} install #{deps} --no-document --conservative"
- puts cmd
system(cmd) || raise("Installing gems #{deps} for the tests to use failed!")
end
end
diff --git a/spec/bundler/support/rubygems_version_manager.rb b/spec/bundler/support/rubygems_version_manager.rb
new file mode 100644
index 0000000000..31f7cc4b08
--- /dev/null
+++ b/spec/bundler/support/rubygems_version_manager.rb
@@ -0,0 +1,127 @@
+# frozen_string_literal: true
+
+require "pathname"
+require_relative "helpers"
+require_relative "path"
+
+class RubygemsVersionManager
+ include Spec::Helpers
+ include Spec::Path
+
+ def initialize(env_version)
+ @env_version = env_version
+ end
+
+ def switch
+ return if use_system?
+
+ unrequire_rubygems_if_needed
+
+ switch_local_copy_if_needed
+
+ prepare_environment
+ end
+
+private
+
+ def use_system?
+ @env_version.nil?
+ end
+
+ def unrequire_rubygems_if_needed
+ return unless rubygems_unrequire_needed?
+
+ require "rbconfig"
+
+ ruby = File.join(RbConfig::CONFIG["bindir"], RbConfig::CONFIG["ruby_install_name"])
+ ruby << RbConfig::CONFIG["EXEEXT"]
+
+ cmd = [ruby, $0, *ARGV].compact
+ cmd[1, 0] = "--disable-gems"
+
+ exec(ENV, *cmd)
+ end
+
+ def switch_local_copy_if_needed
+ return unless local_copy_switch_needed?
+
+ Dir.chdir(local_copy_path) do
+ sys_exec!("git remote update")
+ sys_exec!("git checkout #{target_tag_version} --quiet")
+ end
+ end
+
+ def prepare_environment
+ $:.unshift File.expand_path("lib", local_copy_path)
+ end
+
+ def rubygems_unrequire_needed?
+ defined?(Gem) && Gem::VERSION != target_gem_version
+ end
+
+ def local_copy_switch_needed?
+ !env_version_is_path? && target_gem_version != local_copy_version
+ end
+
+ def target_gem_version
+ @target_gem_version ||= resolve_target_gem_version
+ end
+
+ def target_tag_version
+ @target_tag_version ||= resolve_target_tag_version
+ end
+
+ def local_copy_version
+ gemspec_contents = File.read(local_copy_path.join("lib/rubygems.rb"))
+ version_regexp = /VERSION = ["'](.*)["']/
+
+ version_regexp.match(gemspec_contents)[1]
+ end
+
+ def local_copy_path
+ @local_copy_path ||= resolve_local_copy_path
+ end
+
+ def resolve_local_copy_path
+ return expanded_env_version if env_version_is_path?
+
+ rubygems_path = root.join("tmp/rubygems")
+
+ unless rubygems_path.directory?
+ rubygems_path.parent.mkpath
+ sys_exec!("git clone https://github.com/rubygems/rubygems.git #{rubygems_path}")
+ end
+
+ rubygems_path
+ end
+
+ def env_version_is_path?
+ expanded_env_version.directory?
+ end
+
+ def expanded_env_version
+ @expanded_env_version ||= Pathname.new(@env_version).expand_path(root)
+ end
+
+ def resolve_target_tag_version
+ return "v#{@env_version}" if @env_version.match(/^\d/)
+
+ return "master" if @env_version == master_gem_version
+
+ @env_version
+ end
+
+ def resolve_target_gem_version
+ return local_copy_version if env_version_is_path?
+
+ return @env_version[1..-1] if @env_version.match(/^v/)
+
+ return master_gem_version if @env_version == "master"
+
+ @env_version
+ end
+
+ def master_gem_version
+ "3.1.0.pre1"
+ end
+end
diff --git a/spec/bundler/support/the_bundle.rb b/spec/bundler/support/the_bundle.rb
index c994eaae78..f252a4515b 100644
--- a/spec/bundler/support/the_bundle.rb
+++ b/spec/bundler/support/the_bundle.rb
@@ -1,11 +1,9 @@
# frozen_string_literal: true
-require "support/helpers"
-require "support/path"
+require_relative "path"
module Spec
class TheBundle
- include Spec::Helpers
include Spec::Path
attr_accessor :bundle_dir