summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2020-05-08 14:19:04 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-05-13 07:54:37 +0900
commit0e60b59d5884edb8f9aea023efd9b24f1ff02049 (patch)
treee52935ce510440872ca5ce6b0e092cbc94f18bc9
parent68224651a4d4dc3ce0cea666f5423dd8b6ba6cfc (diff)
downloadruby-0e60b59d5884edb8f9aea023efd9b24f1ff02049.tar.gz
Update the bundler version with master branch
-rw-r--r--lib/bundler.rb19
-rw-r--r--lib/bundler/bundler.gemspec15
-rw-r--r--lib/bundler/cli.rb9
-rw-r--r--lib/bundler/cli/console.rb2
-rw-r--r--lib/bundler/cli/gem.rb32
-rw-r--r--lib/bundler/cli/info.rb7
-rw-r--r--lib/bundler/cli/init.rb2
-rw-r--r--lib/bundler/cli/issue.rb4
-rw-r--r--lib/bundler/cli/list.rb20
-rw-r--r--lib/bundler/cli/outdated.rb149
-rw-r--r--lib/bundler/cli/plugin.rb10
-rw-r--r--lib/bundler/cli/pristine.rb5
-rw-r--r--lib/bundler/compact_index_client/cache.rb18
-rw-r--r--lib/bundler/compact_index_client/gem_parser.rb66
-rw-r--r--lib/bundler/definition.rb57
-rw-r--r--lib/bundler/dependency.rb9
-rw-r--r--lib/bundler/dsl.rb3
-rw-r--r--lib/bundler/environment_preserver.rb28
-rw-r--r--lib/bundler/errors.rb1
-rw-r--r--lib/bundler/feature_flag.rb1
-rw-r--r--lib/bundler/fetcher.rb1
-rw-r--r--lib/bundler/friendly_errors.rb14
-rw-r--r--lib/bundler/gem_helper.rb18
-rw-r--r--lib/bundler/gem_version_promoter.rb2
-rw-r--r--lib/bundler/inline.rb2
-rw-r--r--lib/bundler/installer.rb13
-rw-r--r--lib/bundler/installer/gem_installer.rb4
-rw-r--r--lib/bundler/installer/parallel_installer.rb16
-rw-r--r--lib/bundler/lazy_specification.rb17
-rw-r--r--lib/bundler/plugin.rb26
-rw-r--r--lib/bundler/plugin/index.rb9
-rw-r--r--lib/bundler/psyched_yaml.rb9
-rw-r--r--lib/bundler/remote_specification.rb5
-rw-r--r--lib/bundler/resolver.rb39
-rw-r--r--lib/bundler/resolver/spec_group.rb31
-rw-r--r--lib/bundler/rubygems_ext.rb3
-rw-r--r--lib/bundler/rubygems_integration.rb35
-rw-r--r--lib/bundler/settings.rb2
-rw-r--r--lib/bundler/source/git.rb8
-rw-r--r--lib/bundler/source/git/git_proxy.rb111
-rw-r--r--lib/bundler/source/path.rb6
-rw-r--r--lib/bundler/source/path/installer.rb16
-rw-r--r--lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt104
-rw-r--r--lib/bundler/templates/newgem/Gemfile.tt5
-rw-r--r--lib/bundler/templates/newgem/Rakefile.tt18
-rw-r--r--lib/bundler/templates/newgem/newgem.gemspec.tt4
-rw-r--r--lib/bundler/templates/newgem/test/minitest/newgem_test.rb.tt11
-rw-r--r--lib/bundler/templates/newgem/test/minitest/test_helper.rb.tt4
-rw-r--r--lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt13
-rw-r--r--lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt4
-rw-r--r--lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb264
-rw-r--r--lib/bundler/version.rb2
-rw-r--r--man/bundle-add.12
-rw-r--r--man/bundle-add.1.txt30
-rw-r--r--man/bundle-binstubs.12
-rw-r--r--man/bundle-binstubs.1.txt20
-rw-r--r--man/bundle-cache.12
-rw-r--r--man/bundle-cache.1.txt30
-rw-r--r--man/bundle-check.12
-rw-r--r--man/bundle-check.1.txt16
-rw-r--r--man/bundle-clean.12
-rw-r--r--man/bundle-clean.1.txt12
-rw-r--r--man/bundle-config.19
-rw-r--r--man/bundle-config.1.txt543
-rw-r--r--man/bundle-config.ronn11
-rw-r--r--man/bundle-doctor.12
-rw-r--r--man/bundle-doctor.1.txt18
-rw-r--r--man/bundle-exec.12
-rw-r--r--man/bundle-exec.1.txt165
-rw-r--r--man/bundle-gem.16
-rw-r--r--man/bundle-gem.1.txt78
-rw-r--r--man/bundle-gem.ronn12
-rw-r--r--man/bundle-info.12
-rw-r--r--man/bundle-info.1.txt4
-rw-r--r--man/bundle-init.12
-rw-r--r--man/bundle-init.1.txt18
-rw-r--r--man/bundle-inject.12
-rw-r--r--man/bundle-inject.1.txt8
-rw-r--r--man/bundle-install.12
-rw-r--r--man/bundle-install.1.txt338
-rw-r--r--man/bundle-list.114
-rw-r--r--man/bundle-list.1.txt23
-rw-r--r--man/bundle-list.ronn12
-rw-r--r--man/bundle-lock.12
-rw-r--r--man/bundle-lock.1.txt56
-rw-r--r--man/bundle-open.12
-rw-r--r--man/bundle-open.1.txt6
-rw-r--r--man/bundle-outdated.12
-rw-r--r--man/bundle-outdated.1.txt68
-rw-r--r--man/bundle-platform.12
-rw-r--r--man/bundle-platform.1.txt32
-rw-r--r--man/bundle-pristine.12
-rw-r--r--man/bundle-pristine.1.txt16
-rw-r--r--man/bundle-remove.12
-rw-r--r--man/bundle-remove.1.txt18
-rw-r--r--man/bundle-show.12
-rw-r--r--man/bundle-show.1.txt16
-rw-r--r--man/bundle-update.12
-rw-r--r--man/bundle-update.1.txt297
-rw-r--r--man/bundle-viz.12
-rw-r--r--man/bundle-viz.1.txt22
-rw-r--r--man/bundle.12
-rw-r--r--man/bundle.1.txt62
-rw-r--r--man/gemfile.52
-rw-r--r--man/gemfile.5.txt434
-rw-r--r--spec/bundler/bundler/bundler_spec.rb22
-rw-r--r--spec/bundler/bundler/cli_spec.rb12
-rw-r--r--spec/bundler/bundler/compact_index_client/gem_parser_spec.rb174
-rw-r--r--spec/bundler/bundler/compact_index_client/updater_spec.rb6
-rw-r--r--spec/bundler/bundler/definition_spec.rb10
-rw-r--r--spec/bundler/bundler/dsl_spec.rb44
-rw-r--r--spec/bundler/bundler/env_spec.rb34
-rw-r--r--spec/bundler/bundler/fetcher/compact_index_spec.rb3
-rw-r--r--spec/bundler/bundler/fetcher_spec.rb3
-rw-r--r--spec/bundler/bundler/friendly_errors_spec.rb83
-rw-r--r--spec/bundler/bundler/gem_helper_spec.rb63
-rw-r--r--spec/bundler/bundler/mirror_spec.rb2
-rw-r--r--spec/bundler/bundler/plugin/index_spec.rb11
-rw-r--r--spec/bundler/bundler/plugin_spec.rb9
-rw-r--r--spec/bundler/bundler/settings_spec.rb2
-rw-r--r--spec/bundler/bundler/shared_helpers_spec.rb42
-rw-r--r--spec/bundler/bundler/source/git/git_proxy_spec.rb5
-rw-r--r--spec/bundler/cache/gems_spec.rb14
-rw-r--r--spec/bundler/cache/git_spec.rb6
-rw-r--r--spec/bundler/cache/path_spec.rb7
-rw-r--r--spec/bundler/commands/add_spec.rb44
-rw-r--r--spec/bundler/commands/binstubs_spec.rb50
-rw-r--r--spec/bundler/commands/cache_spec.rb4
-rw-r--r--spec/bundler/commands/check_spec.rb17
-rw-r--r--spec/bundler/commands/clean_spec.rb6
-rw-r--r--spec/bundler/commands/config_spec.rb23
-rw-r--r--spec/bundler/commands/console_spec.rb2
-rw-r--r--spec/bundler/commands/doctor_spec.rb4
-rw-r--r--spec/bundler/commands/exec_spec.rb82
-rw-r--r--spec/bundler/commands/help_spec.rb2
-rw-r--r--spec/bundler/commands/info_spec.rb55
-rw-r--r--spec/bundler/commands/init_spec.rb18
-rw-r--r--spec/bundler/commands/inject_spec.rb26
-rw-r--r--spec/bundler/commands/install_spec.rb29
-rw-r--r--spec/bundler/commands/list_spec.rb23
-rw-r--r--spec/bundler/commands/lock_spec.rb14
-rw-r--r--spec/bundler/commands/newgem_spec.rb272
-rw-r--r--spec/bundler/commands/open_spec.rb4
-rw-r--r--spec/bundler/commands/outdated_spec.rb343
-rw-r--r--spec/bundler/commands/pristine_spec.rb17
-rw-r--r--spec/bundler/commands/remove_spec.rb6
-rw-r--r--spec/bundler/commands/show_spec.rb61
-rw-r--r--spec/bundler/commands/update_spec.rb16
-rw-r--r--spec/bundler/install/allow_offline_install_spec.rb4
-rw-r--r--spec/bundler/install/bundler_spec.rb18
-rw-r--r--spec/bundler/install/deploy_spec.rb19
-rw-r--r--spec/bundler/install/gemfile/eval_gemfile_spec.rb4
-rw-r--r--spec/bundler/install/gemfile/gemspec_spec.rb69
-rw-r--r--spec/bundler/install/gemfile/git_spec.rb130
-rw-r--r--spec/bundler/install/gemfile/install_if_spec.rb (renamed from spec/bundler/install/gemfile/install_if.rb)2
-rw-r--r--spec/bundler/install/gemfile/path_spec.rb66
-rw-r--r--spec/bundler/install/gemfile/platform_spec.rb46
-rw-r--r--spec/bundler/install/gemfile/ruby_spec.rb6
-rw-r--r--spec/bundler/install/gemfile/sources_spec.rb6
-rw-r--r--spec/bundler/install/gemfile/specific_platform_spec.rb6
-rw-r--r--spec/bundler/install/gemfile_spec.rb48
-rw-r--r--spec/bundler/install/gems/compact_index_spec.rb53
-rw-r--r--spec/bundler/install/gems/dependency_api_spec.rb48
-rw-r--r--spec/bundler/install/gems/flex_spec.rb2
-rw-r--r--spec/bundler/install/gems/native_extensions_spec.rb59
-rw-r--r--spec/bundler/install/gems/resolving_spec.rb68
-rw-r--r--spec/bundler/install/gems/standalone_spec.rb144
-rw-r--r--spec/bundler/install/gems/sudo_spec.rb4
-rw-r--r--spec/bundler/install/gems/win32_spec.rb2
-rw-r--r--spec/bundler/install/gemspecs_spec.rb2
-rw-r--r--spec/bundler/install/git_spec.rb22
-rw-r--r--spec/bundler/install/global_cache_spec.rb44
-rw-r--r--spec/bundler/install/path_spec.rb42
-rw-r--r--spec/bundler/lock/lockfile_spec.rb34
-rw-r--r--spec/bundler/other/major_deprecation_spec.rb22
-rw-r--r--spec/bundler/other/platform_spec.rb553
-rw-r--r--spec/bundler/plugins/install_spec.rb14
-rw-r--r--spec/bundler/plugins/source/example_spec.rb11
-rw-r--r--spec/bundler/plugins/source_spec.rb3
-rw-r--r--spec/bundler/plugins/uninstall_spec.rb49
-rw-r--r--spec/bundler/quality_es_spec.rb20
-rw-r--r--spec/bundler/quality_spec.rb133
-rw-r--r--spec/bundler/realworld/edgecases_spec.rb4
-rw-r--r--spec/bundler/realworld/fixtures/warbler/.gitignore1
-rw-r--r--spec/bundler/realworld/fixtures/warbler/Gemfile7
-rw-r--r--spec/bundler/realworld/fixtures/warbler/Gemfile.lock29
-rw-r--r--spec/bundler/realworld/fixtures/warbler/bin/warbler-example.rb3
-rw-r--r--spec/bundler/realworld/fixtures/warbler/demo/demo.gemspec10
-rw-r--r--spec/bundler/resolver/platform_spec.rb96
-rw-r--r--spec/bundler/runtime/executable_spec.rb28
-rw-r--r--spec/bundler/runtime/gem_tasks_spec.rb10
-rw-r--r--spec/bundler/runtime/inline_spec.rb36
-rw-r--r--spec/bundler/runtime/load_spec.rb4
-rw-r--r--spec/bundler/runtime/platform_spec.rb3
-rw-r--r--spec/bundler/runtime/require_spec.rb10
-rw-r--r--spec/bundler/runtime/setup_spec.rb53
-rw-r--r--spec/bundler/runtime/with_unbundled_env_spec.rb110
-rw-r--r--spec/bundler/spec_helper.rb16
-rw-r--r--spec/bundler/support/artifice/compact_index.rb2
-rw-r--r--spec/bundler/support/artifice/compact_index_concurrent_download.rb4
-rw-r--r--spec/bundler/support/artifice/compact_index_creds_diff_host.rb2
-rw-r--r--spec/bundler/support/artifice/compact_index_extra.rb8
-rw-r--r--spec/bundler/support/artifice/compact_index_extra_api.rb10
-rw-r--r--spec/bundler/support/artifice/compact_index_partial_update.rb6
-rw-r--r--spec/bundler/support/artifice/compact_index_range_not_satisfiable.rb2
-rw-r--r--spec/bundler/support/artifice/endpoint.rb8
-rw-r--r--spec/bundler/support/artifice/endpoint_creds_diff_host.rb2
-rw-r--r--spec/bundler/support/artifice/endpoint_extra.rb8
-rw-r--r--spec/bundler/support/artifice/endpoint_extra_api.rb8
-rw-r--r--spec/bundler/support/artifice/endpoint_mirror_source.rb2
-rw-r--r--spec/bundler/support/artifice/vcr.rb2
-rw-r--r--spec/bundler/support/builders.rb157
-rw-r--r--spec/bundler/support/command_execution.rb13
-rw-r--r--spec/bundler/support/filters.rb16
-rw-r--r--spec/bundler/support/hax.rb40
-rw-r--r--spec/bundler/support/helpers.rb184
-rw-r--r--spec/bundler/support/indexes.rb4
-rw-r--r--spec/bundler/support/matchers.rb14
-rw-r--r--spec/bundler/support/parallel.rb5
-rw-r--r--spec/bundler/support/path.rb57
-rw-r--r--spec/bundler/support/platforms.rb4
-rw-r--r--spec/bundler/support/rubygems_ext.rb140
-rw-r--r--spec/bundler/support/rubygems_version_manager.rb35
-rw-r--r--spec/bundler/support/switch_rubygems.rb14
-rw-r--r--spec/bundler/update/gemfile_spec.rb8
-rw-r--r--spec/bundler/update/git_spec.rb39
226 files changed, 4601 insertions, 3747 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb
index df345539c8..610cc484e3 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -34,9 +34,9 @@ require_relative "bundler/build_metadata"
# of loaded and required modules.
#
module Bundler
- environment_preserver = EnvironmentPreserver.new(ENV, EnvironmentPreserver::BUNDLER_KEYS)
+ environment_preserver = EnvironmentPreserver.from_env
ORIGINAL_ENV = environment_preserver.restore
- ENV.replace(environment_preserver.backup)
+ environment_preserver.replace_with_backup
SUDO_MUTEX = Mutex.new
autoload :Definition, File.expand_path("bundler/definition", __dir__)
@@ -285,7 +285,13 @@ module Bundler
def app_config_path
if app_config = ENV["BUNDLE_APP_CONFIG"]
- Pathname.new(app_config).expand_path(root)
+ app_config_pathname = Pathname.new(app_config)
+
+ if app_config_pathname.absolute?
+ app_config_pathname
+ else
+ app_config_pathname.expand_path(root)
+ end
else
root.join(".bundle")
end
@@ -451,6 +457,10 @@ EOF
Bundler.settings[:system_bindir] || Bundler.rubygems.gem_bindir
end
+ def preferred_gemfile_name
+ Bundler.settings[:init_gems_rb] ? "gems.rb" : "Gemfile"
+ end
+
def use_system_gems?
configured_bundle_path.use_system_gems?
end
@@ -512,7 +522,8 @@ EOF
Your user account isn't allowed to install to the system RubyGems.
You can cancel this installation and run:
- bundle install --path vendor/bundle
+ bundle config set --local path 'vendor/bundle'
+ bundle install
to install the gems into ./vendor/bundle/, or you can enter your password
and install the bundled gems to RubyGems using sudo.
diff --git a/lib/bundler/bundler.gemspec b/lib/bundler/bundler.gemspec
index 30a21f155f..27a7f1ea2e 100644
--- a/lib/bundler/bundler.gemspec
+++ b/lib/bundler/bundler.gemspec
@@ -24,21 +24,24 @@ Gem::Specification.new do |s|
if s.respond_to?(:metadata=)
s.metadata = {
- "bug_tracker_uri" => "https://github.com/bundler/bundler/issues",
- "changelog_uri" => "https://github.com/bundler/bundler/blob/master/CHANGELOG.md",
+ "bug_tracker_uri" => "https://github.com/rubygems/bundler/issues",
+ "changelog_uri" => "https://github.com/rubygems/bundler/blob/master/CHANGELOG.md",
"homepage_uri" => "https://bundler.io/",
- "source_code_uri" => "https://github.com/bundler/bundler/",
+ "source_code_uri" => "https://github.com/rubygems/bundler/",
}
end
s.required_ruby_version = ">= 2.3.0"
s.required_rubygems_version = ">= 2.5.2"
- s.files = (Dir.glob("lib/bundler/**/*", File::FNM_DOTMATCH) + Dir.glob("man/bundler*") + Dir.glob("libexec/bundle*")).reject {|f| File.directory?(f) }
+ s.files = Dir.glob("{lib,man,exe}/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) }
- s.files += ["lib/bundler.rb"]
+ # Include the CHANGELOG.md, LICENSE.md, README.md manually
+ s.files += %w[CHANGELOG.md LICENSE.md README.md]
+ # include the gemspec itself because warbler breaks w/o it
+ s.files += %w[bundler.gemspec]
- s.bindir = "libexec"
+ s.bindir = "exe"
s.executables = %w[bundle bundler]
s.require_paths = ["lib"]
end
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index 9ff918a43b..d679482a3a 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -345,8 +345,8 @@ module Bundler
desc "list", "List all gems in the bundle"
method_option "name-only", :type => :boolean, :banner => "print only the gem names"
- method_option "only-group", :type => :string, :banner => "print gems from a particular group"
- method_option "without-group", :type => :string, :banner => "print all gems except from a group"
+ method_option "only-group", :type => :array, :default => [], :banner => "print gems from a given set of groups"
+ method_option "without-group", :type => :array, :default => [], :banner => "print all gems except from a given set of groups"
method_option "paths", :type => :boolean, :banner => "print the path to each gem in the bundle"
def list
require_relative "cli/list"
@@ -570,8 +570,9 @@ module Bundler
method_option :ext, :type => :boolean, :default => false, :desc => "Generate the boilerplate for C extension code"
method_option :git, :type => :boolean, :default => true, :desc => "Initialize a git repo inside your library."
method_option :mit, :type => :boolean, :desc => "Generate an MIT license file. Set a default with `bundle config set gem.mit true`."
+ method_option :rubocop, :type => :boolean, :desc => "Add rubocop to the generated Rakefile and gemspec. Set a default with `bundle config set gem.rubocop true`."
method_option :test, :type => :string, :lazy_default => "rspec", :aliases => "-t", :banner => "rspec",
- :desc => "Generate a test directory for your library, either rspec or minitest. Set a default with `bundle config set gem.test rspec`."
+ :desc => "Generate a test directory for your library, either rspec, minitest or test-unit. Set a default with `bundle config set gem.test rspec`."
def gem(name)
end
@@ -815,7 +816,7 @@ module Bundler
option = current_command.options[name]
flag_name = option.switch_name
- name_index = ARGV.find {|arg| flag_name == arg }
+ name_index = ARGV.find {|arg| flag_name == arg.split("=")[0] }
return unless name_index
value = options[name]
diff --git a/lib/bundler/cli/console.rb b/lib/bundler/cli/console.rb
index c3198331a9..97b8dc0663 100644
--- a/lib/bundler/cli/console.rb
+++ b/lib/bundler/cli/console.rb
@@ -12,7 +12,7 @@ module Bundler
Bundler::SharedHelpers.major_deprecation 2, "bundle console will be replaced " \
"by `bin/console` generated by `bundle gem <name>`"
- group ? Bundler.require(:default, *group.split(' ').map!(&:to_sym)) : Bundler.require
+ group ? Bundler.require(:default, *group.split(" ").map!(&:to_sym)) : Bundler.require
ARGV.clear
console = get_console(Bundler.settings[:console] || "irb")
diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb
index d3e5831759..3fd67d9a88 100644
--- a/lib/bundler/cli/gem.rb
+++ b/lib/bundler/cli/gem.rb
@@ -12,6 +12,7 @@ module Bundler
TEST_FRAMEWORK_VERSIONS = {
"rspec" => "3.0",
"minitest" => "5.0",
+ "test-unit" => "3.0",
}.freeze
attr_reader :options, :gem_name, :thor, :name, :target
@@ -62,7 +63,7 @@ module Bundler
ensure_safe_gem_name(name, constant_array)
templates = {
- "Gemfile.tt" => "Gemfile",
+ "#{Bundler.preferred_gemfile_name}.tt" => Bundler.preferred_gemfile_name,
"lib/newgem.rb.tt" => "lib/#{namespaced_path}.rb",
"lib/newgem/version.rb.tt" => "lib/#{namespaced_path}/version.rb",
"newgem.gemspec.tt" => "#{name}.gemspec",
@@ -92,16 +93,22 @@ module Bundler
"spec/spec_helper.rb.tt" => "spec/spec_helper.rb",
"spec/newgem_spec.rb.tt" => "spec/#{namespaced_path}_spec.rb"
)
+ config[:test_task] = :spec
when "minitest"
templates.merge!(
- "test/test_helper.rb.tt" => "test/test_helper.rb",
- "test/newgem_test.rb.tt" => "test/#{namespaced_path}_test.rb"
+ "test/minitest/test_helper.rb.tt" => "test/test_helper.rb",
+ "test/minitest/newgem_test.rb.tt" => "test/#{namespaced_path}_test.rb"
)
+ config[:test_task] = :test
+ when "test-unit"
+ templates.merge!(
+ "test/test-unit/test_helper.rb.tt" => "test/test_helper.rb",
+ "test/test-unit/newgem_test.rb.tt" => "test/#{namespaced_path}_test.rb"
+ )
+ config[:test_task] = :test
end
end
- config[:test_task] = config[:test] == "minitest" ? "test" : "spec"
-
if ask_and_set(:mit, "Do you want to license your code permissively under the MIT license?",
"This means that any other developer or company will be legally allowed to use your code " \
"for free as long as they admit you created it. You can read more about the MIT license " \
@@ -124,6 +131,15 @@ module Bundler
templates.merge!("CODE_OF_CONDUCT.md.tt" => "CODE_OF_CONDUCT.md")
end
+ if ask_and_set(:rubocop, "Do you want to add rubocop as a dependency for gems you generate?",
+ "RuboCop is a static code analyzer that has out-of-the-box rules for many " \
+ "of the guidelines in the community style guide. " \
+ "For more information, see the RuboCop docs (https://docs.rubocop.org/en/stable/) " \
+ "and the Ruby Style Guides (https://github.com/rubocop-hq/ruby-style-guide).")
+ config[:rubocop] = true
+ Bundler.ui.info "RuboCop enabled in config"
+ end
+
templates.merge!("exe/newgem.tt" => "exe/#{name}") if config[:exe]
if options[:ext]
@@ -199,9 +215,9 @@ module Bundler
if test_framework.nil?
Bundler.ui.confirm "Do you want to generate tests with your gem?"
- result = Bundler.ui.ask "Type 'rspec' or 'minitest' to generate those test files now and " \
- "in the future. rspec/minitest/(none):"
- if result =~ /rspec|minitest/
+ result = Bundler.ui.ask "Type 'rspec', 'minitest' or 'test-unit' to generate those test files now and " \
+ "in the future. rspec/minitest/test-unit/(none):"
+ if result =~ /rspec|minitest|test-unit/
test_framework = result
else
test_framework = false
diff --git a/lib/bundler/cli/info.rb b/lib/bundler/cli/info.rb
index 4733675e8c..c79c8bf814 100644
--- a/lib/bundler/cli/info.rb
+++ b/lib/bundler/cli/info.rb
@@ -50,10 +50,17 @@ module Bundler
end
def print_gem_info(spec)
+ metadata = spec.metadata
gem_info = String.new
gem_info << " * #{spec.name} (#{spec.version}#{spec.git_version})\n"
gem_info << "\tSummary: #{spec.summary}\n" if spec.summary
gem_info << "\tHomepage: #{spec.homepage}\n" if spec.homepage
+ gem_info << "\tDocumentation: #{metadata["documentation_uri"]}\n" if metadata.key?("documentation_uri")
+ gem_info << "\tSource Code: #{metadata["source_code_uri"]}\n" if metadata.key?("source_code_uri")
+ gem_info << "\tWiki: #{metadata["wiki_uri"]}\n" if metadata.key?("wiki_uri")
+ gem_info << "\tChangelog: #{metadata["changelog_uri"]}\n" if metadata.key?("changelog_uri")
+ gem_info << "\tBug Tracker: #{metadata["bug_tracker_uri"]}\n" if metadata.key?("bug_tracker_uri")
+ gem_info << "\tMailing List: #{metadata["mailing_list_uri"]}\n" if metadata.key?("mailing_list_uri")
gem_info << "\tPath: #{spec.full_gem_path}\n"
gem_info << "\tDefault Gem: yes" if spec.respond_to?(:default_gem?) && spec.default_gem?
Bundler.ui.info gem_info
diff --git a/lib/bundler/cli/init.rb b/lib/bundler/cli/init.rb
index 65dd08dfe9..f45871ce9c 100644
--- a/lib/bundler/cli/init.rb
+++ b/lib/bundler/cli/init.rb
@@ -41,7 +41,7 @@ module Bundler
private
def gemfile
- @gemfile ||= Bundler.settings[:init_gems_rb] ? "gems.rb" : "Gemfile"
+ @gemfile ||= Bundler.preferred_gemfile_name
end
end
end
diff --git a/lib/bundler/cli/issue.rb b/lib/bundler/cli/issue.rb
index 054ce76315..1a0ea39f7b 100644
--- a/lib/bundler/cli/issue.rb
+++ b/lib/bundler/cli/issue.rb
@@ -10,7 +10,7 @@ module Bundler
be sure to check out these resources:
1. Check out our troubleshooting guide for quick fixes to common issues:
- https://github.com/bundler/bundler/blob/master/doc/TROUBLESHOOTING.md
+ https://github.com/rubygems/bundler/blob/master/doc/TROUBLESHOOTING.md
2. Instructions for common Bundler uses can be found on the documentation
site: https://bundler.io/
@@ -22,7 +22,7 @@ module Bundler
still aren't working the way you expect them to, please let us know so
that we can diagnose and help fix the problem you're having. Please
view the Filing Issues guide for more information:
- https://github.com/bundler/bundler/blob/master/doc/contributing/ISSUES.md
+ https://github.com/rubygems/bundler/blob/master/doc/contributing/ISSUES.md
EOS
diff --git a/lib/bundler/cli/list.rb b/lib/bundler/cli/list.rb
index d1799196e7..c172e8d182 100644
--- a/lib/bundler/cli/list.rb
+++ b/lib/bundler/cli/list.rb
@@ -4,14 +4,16 @@ module Bundler
class CLI::List
def initialize(options)
@options = options
+ @without_group = options["without-group"].map(&:to_sym)
+ @only_group = options["only-group"].map(&:to_sym)
end
def run
- raise InvalidOption, "The `--only-group` and `--without-group` options cannot be used together" if @options["only-group"] && @options["without-group"]
+ raise InvalidOption, "The `--only-group` and `--without-group` options cannot be used together" if @only_group.any? && @without_group.any?
raise InvalidOption, "The `--name-only` and `--paths` options cannot be used together" if @options["name-only"] && @options[:paths]
- specs = if @options["only-group"] || @options["without-group"]
+ specs = if @only_group.any? || @without_group.any?
filtered_specs_by_groups
else
Bundler.load.specs
@@ -32,9 +34,9 @@ module Bundler
private
def verify_group_exists(groups)
- raise InvalidOption, "`#{@options["without-group"]}` group could not be found." if @options["without-group"] && !groups.include?(@options["without-group"].to_sym)
-
- raise InvalidOption, "`#{@options["only-group"]}` group could not be found." if @options["only-group"] && !groups.include?(@options["only-group"].to_sym)
+ (@without_group + @only_group).each do |group|
+ raise InvalidOption, "`#{group}` group could not be found." unless groups.include?(group)
+ end
end
def filtered_specs_by_groups
@@ -44,10 +46,10 @@ module Bundler
verify_group_exists(groups)
show_groups =
- if @options["without-group"]
- groups.reject {|g| g == @options["without-group"].to_sym }
- elsif @options["only-group"]
- groups.select {|g| g == @options["only-group"].to_sym }
+ if @without_group.any?
+ groups.reject {|g| @without_group.include?(g) }
+ elsif @only_group.any?
+ groups.select {|g| @only_group.include?(g) }
else
groups
end.map(&:to_sym)
diff --git a/lib/bundler/cli/outdated.rb b/lib/bundler/cli/outdated.rb
index 0b710e9782..5f065654b1 100644
--- a/lib/bundler/cli/outdated.rb
+++ b/lib/bundler/cli/outdated.rb
@@ -3,18 +3,16 @@
module Bundler
class CLI::Outdated
attr_reader :options, :gems, :options_include_groups, :filter_options_patch, :sources, :strict
- attr_accessor :outdated_gems_by_groups, :outdated_gems_list
+ attr_accessor :outdated_gems
def initialize(options, gems)
@options = options
@gems = gems
@sources = Array(options[:source])
- @filter_options_patch = options.keys &
- %w[filter-major filter-minor filter-patch]
+ @filter_options_patch = options.keys & %w[filter-major filter-minor filter-patch]
- @outdated_gems_by_groups = {}
- @outdated_gems_list = []
+ @outdated_gems = []
@options_include_groups = [:group, :groups].any? do |v|
options.keys.include?(v.to_s)
@@ -22,8 +20,7 @@ module Bundler
# the patch level options imply strict is also true. It wouldn't make
# sense otherwise.
- @strict = options["filter-strict"] ||
- Bundler::CLI::Common.patch_level_options(options).any?
+ @strict = options["filter-strict"] || Bundler::CLI::Common.patch_level_options(options).any?
end
def run
@@ -76,58 +73,54 @@ module Bundler
end
specs.sort_by(&:name).each do |current_spec|
- next if !gems.empty? && !gems.include?(current_spec.name)
+ next unless gems.empty? || gems.include?(current_spec.name)
- dependency = current_dependencies[current_spec.name]
active_spec = retrieve_active_spec(definition, current_spec)
+ next unless active_spec
- next if active_spec.nil?
- next if filter_options_patch.any? &&
- !update_present_via_semver_portions(current_spec, active_spec, options)
+ next unless filter_options_patch.empty? || update_present_via_semver_portions(current_spec, active_spec, options)
gem_outdated = Gem::Version.new(active_spec.version) > Gem::Version.new(current_spec.version)
next unless gem_outdated || (current_spec.git_version != active_spec.git_version)
- groups = nil
+
+ dependency = current_dependencies[current_spec.name]
+ groups = ""
if dependency && !options[:parseable]
groups = dependency.groups.join(", ")
end
- outdated_gems_list << { :active_spec => active_spec,
- :current_spec => current_spec,
- :dependency => dependency,
- :groups => groups }
-
- outdated_gems_by_groups[groups] ||= []
- outdated_gems_by_groups[groups] << outdated_gems_list[-1]
+ outdated_gems << {
+ :active_spec => active_spec,
+ :current_spec => current_spec,
+ :dependency => dependency,
+ :groups => groups,
+ }
end
- if outdated_gems_list.empty?
- display_nothing_outdated_message
- else
+ if outdated_gems.empty?
unless options[:parseable]
- Bundler.ui.info(header_outdated_message)
+ Bundler.ui.info(nothing_outdated_message)
end
-
+ else
if options_include_groups
- ordered_groups = outdated_gems_by_groups.keys.compact.sort
- ordered_groups.insert(0, nil).each do |groups|
- gems = outdated_gems_by_groups[groups]
- contains_group = if groups
- groups.split(", ").include?(options[:group])
- else
- options[:group] == "group"
- end
+ relevant_outdated_gems = outdated_gems.group_by {|g| g[:groups] }.sort.flat_map do |groups, gems|
+ contains_group = groups.split(", ").include?(options[:group])
+ next unless options[:groups] || contains_group
- next if (!options[:groups] && !contains_group) || gems.nil?
+ gems
+ end.compact
- unless options[:parseable]
- Bundler.ui.info(header_group_message(groups))
+ if options[:parseable]
+ relevant_outdated_gems.each do |gems|
+ print_gems(gems)
end
-
- print_gems(gems)
+ else
+ print_gems_table(relevant_outdated_gems)
end
+ elsif options[:parseable]
+ print_gems(outdated_gems)
else
- print_gems(outdated_gems_list)
+ print_gems_table(outdated_gems)
end
exit 1
@@ -140,22 +133,6 @@ module Bundler
"#{group_text}#{groups.split(",").size > 1 ? "s" : ""} \"#{groups}\""
end
- def header_outdated_message
- if options[:pre]
- "Outdated gems included in the bundle (including pre-releases):"
- else
- "Outdated gems included in the bundle:"
- end
- end
-
- def header_group_message(groups)
- if groups
- "===== #{groups_text("Group", groups)} ====="
- else
- "===== Without group ====="
- end
- end
-
def nothing_outdated_message
if filter_options_patch.any?
display = filter_options_patch.map do |o|
@@ -169,6 +146,8 @@ module Bundler
end
def retrieve_active_spec(definition, current_spec)
+ return unless current_spec.match_platform(Bundler.local_platform)
+
if strict
active_spec = definition.find_resolved_spec(current_spec)
else
@@ -182,12 +161,6 @@ module Bundler
active_spec
end
- def display_nothing_outdated_message
- unless options[:parseable]
- Bundler.ui.info(nothing_outdated_message)
- end
- end
-
def print_gems(gems_list)
gems_list.each do |gem|
print_gem(
@@ -199,6 +172,19 @@ module Bundler
end
end
+ def print_gems_table(gems_list)
+ data = gems_list.map do |gem|
+ gem_column_for(
+ gem[:current_spec],
+ gem[:active_spec],
+ gem[:dependency],
+ gem[:groups],
+ )
+ end
+
+ print_indented([table_header] + data)
+ end
+
def print_gem(current_spec, active_spec, dependency, groups)
spec_version = "#{active_spec.version}#{active_spec.git_version}"
spec_version += " (from #{active_spec.loaded_from})" if Bundler.ui.debug? && active_spec.loaded_from
@@ -213,7 +199,7 @@ module Bundler
output_message = if options[:parseable]
spec_outdated_info.to_s
- elsif options_include_groups || !groups
+ elsif options_include_groups || groups.empty?
" * #{spec_outdated_info}"
else
" * #{spec_outdated_info} in #{groups_text("group", groups)}"
@@ -222,6 +208,16 @@ module Bundler
Bundler.ui.info output_message.rstrip
end
+ def gem_column_for(current_spec, active_spec, dependency, groups)
+ current_version = "#{current_spec.version}#{current_spec.git_version}"
+ spec_version = "#{active_spec.version}#{active_spec.git_version}"
+ dependency = dependency.requirement if dependency
+
+ ret_val = [active_spec.name, current_version, spec_version, dependency.to_s, groups.to_s]
+ ret_val << active_spec.loaded_from.to_s if Bundler.ui.debug?
+ ret_val
+ end
+
def check_for_deployment_mode!
return unless Bundler.frozen_bundle?
suggested_command = if Bundler.settings.locations("frozen")[:global]
@@ -266,5 +262,34 @@ module Bundler
version_section = spec.version.segments[version_portion_index, 1]
version_section.to_a[0].to_i
end
+
+ def print_indented(matrix)
+ header = matrix[0]
+ data = matrix[1..-1]
+
+ column_sizes = Array.new(header.size) do |index|
+ matrix.max_by {|row| row[index].length }[index].length
+ end
+
+ Bundler.ui.info justify(header, column_sizes)
+
+ data.sort_by! {|row| row[0] }
+
+ data.each do |row|
+ Bundler.ui.info justify(row, column_sizes)
+ end
+ end
+
+ def table_header
+ header = ["Gem", "Current", "Latest", "Requested", "Groups"]
+ header << "Path" if Bundler.ui.debug?
+ header
+ end
+
+ def justify(row, sizes)
+ row.each_with_index.map do |element, index|
+ element.ljust(sizes[index])
+ end.join(" ").strip + "\n"
+ end
end
end
diff --git a/lib/bundler/cli/plugin.rb b/lib/bundler/cli/plugin.rb
index 1155c4ec9b..fe3f4412fa 100644
--- a/lib/bundler/cli/plugin.rb
+++ b/lib/bundler/cli/plugin.rb
@@ -23,6 +23,16 @@ module Bundler
Bundler::Plugin.install(plugins, options)
end
+ desc "uninstall PLUGINS", "Uninstall the plugins"
+ long_desc <<-D
+ Uninstall given list of plugins. To uninstall all the plugins, use -all option.
+ D
+ method_option "all", :type => :boolean, :default => nil, :banner =>
+ "Uninstall all the installed plugins. If no plugin is installed, then it does nothing."
+ def uninstall(*plugins)
+ Bundler::Plugin.uninstall(plugins, options)
+ end
+
desc "list", "List the installed plugins and available commands"
def list
Bundler::Plugin.list
diff --git a/lib/bundler/cli/pristine.rb b/lib/bundler/cli/pristine.rb
index 532b3e0b5b..53da90b415 100644
--- a/lib/bundler/cli/pristine.rb
+++ b/lib/bundler/cli/pristine.rb
@@ -29,6 +29,11 @@ module Bundler
FileUtils.rm_rf spec.full_gem_path
when Source::Git
+ if source.local?
+ Bundler.ui.warn("Cannot pristine #{gem_name}. Gem is locally overriden.")
+ next
+ end
+
source.remote!
if extension_cache_path = source.extension_cache_path(spec)
FileUtils.rm_rf extension_cache_path
diff --git a/lib/bundler/compact_index_client/cache.rb b/lib/bundler/compact_index_client/cache.rb
index f6105d3bb3..ef8517e8f6 100644
--- a/lib/bundler/compact_index_client/cache.rb
+++ b/lib/bundler/compact_index_client/cache.rb
@@ -1,5 +1,7 @@
# frozen_string_literal: true
+require_relative "gem_parser"
+
module Bundler
class CompactIndexClient
class Cache
@@ -92,19 +94,9 @@ module Bundler
header ? lines[header + 1..-1] : lines
end
- def parse_gem(string)
- version_and_platform, rest = string.split(" ", 2)
- version, platform = version_and_platform.split("-", 2)
- dependencies, requirements = rest.split("|", 2).map {|s| s.split(",") } if rest
- dependencies = dependencies ? dependencies.map {|d| parse_dependency(d) } : []
- requirements = requirements ? requirements.map {|r| parse_dependency(r) } : []
- [version, platform, dependencies, requirements]
- end
-
- def parse_dependency(string)
- dependency = string.split(":")
- dependency[-1] = dependency[-1].split("&") if dependency.size > 1
- dependency
+ def parse_gem(line)
+ @gem_parser ||= GemParser.new
+ @gem_parser.parse(line)
end
def info_roots
diff --git a/lib/bundler/compact_index_client/gem_parser.rb b/lib/bundler/compact_index_client/gem_parser.rb
new file mode 100644
index 0000000000..117da64ce6
--- /dev/null
+++ b/lib/bundler/compact_index_client/gem_parser.rb
@@ -0,0 +1,66 @@
+# frozen_string_literal: true
+
+module Bundler
+ class CompactIndexClient
+ class GemParser
+ def parse(line)
+ version_and_platform, rest = line.split(" ", 2)
+ version, platform = version_and_platform.split("-", 2)
+ dependencies, requirements = rest.split("|", 2) if rest
+ dependencies = dependencies ? parse_dependencies(dependencies) : []
+ requirements = requirements ? parse_requirements(requirements) : []
+ [version, platform, dependencies, requirements]
+ end
+
+ private
+
+ def parse_dependencies(raw_dependencies)
+ raw_dependencies.split(",").map {|d| parse_dependency(d) }
+ end
+
+ def parse_dependency(raw_dependency)
+ dependency = raw_dependency.split(":")
+ dependency[-1] = dependency[-1].split("&") if dependency.size > 1
+ dependency
+ end
+
+ # Parse the following format:
+ #
+ # line = "checksum:#{checksum}"
+ # line << ",ruby:#{ruby_version}" if ruby_version && ruby_version != ">= 0"
+ # line << ",rubygems:#{rubygems_version}" if rubygems_version && rubygems_version != ">= 0"
+ #
+ # See compact_index/gem_version.rb for details.
+ #
+ # We can't use parse_dependencies for requirements because "," in
+ # ruby_version and rubygems_version isn't escaped as "&". For example,
+ # "checksum:XXX,ruby:>=2.2, < 2.7.dev" can't be parsed as expected.
+ def parse_requirements(raw_requirements)
+ requirements = []
+ checksum = raw_requirements.match(/\A(checksum):([^,]+)/)
+ if checksum
+ requirements << [checksum[1], [checksum[2]]]
+ raw_requirements = checksum.post_match
+ if raw_requirements.start_with?(",")
+ raw_requirements = raw_requirements[1..-1]
+ end
+ end
+ rubygems = raw_requirements.match(/(rubygems):(.+)\z/)
+ if rubygems
+ raw_requirements = rubygems.pre_match
+ if raw_requirements.start_with?(",")
+ raw_requirements = raw_requirements[1..-1]
+ end
+ end
+ ruby = raw_requirements.match(/\A(ruby):(.+)\z/)
+ if ruby
+ requirements << [ruby[1], ruby[2].split(/\s*,\s*/)]
+ end
+ if rubygems
+ requirements << [rubygems[1], rubygems[2].split(/\s*,\s*/)]
+ end
+ requirements
+ end
+ end
+ end
+end
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index d6fbb0b5b7..40f11ff339 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -77,12 +77,17 @@ module Bundler
@locked_bundler_version = nil
@locked_ruby_version = nil
@locked_specs_incomplete_for_platform = false
+ @new_platform = nil
if lockfile && File.exist?(lockfile)
@lockfile_contents = Bundler.read_file(lockfile)
@locked_gems = LockfileParser.new(@lockfile_contents)
@locked_platforms = @locked_gems.platforms
- @platforms = @locked_platforms.dup
+ if Bundler.settings[:force_ruby_platform]
+ @platforms = [Gem::Platform::RUBY]
+ else
+ @platforms = @locked_platforms.dup
+ end
@locked_bundler_version = @locked_gems.bundler_version
@locked_ruby_version = @locked_gems.ruby_version
@@ -113,7 +118,7 @@ module Bundler
end
@unlocking ||= @unlock[:ruby] ||= (!@locked_ruby_version ^ !@ruby_version)
- add_current_platform unless Bundler.frozen_bundle?
+ add_platforms unless Bundler.frozen_bundle?
converge_path_sources_to_gemspec_sources
@path_changes = converge_paths
@@ -228,12 +233,13 @@ module Bundler
end
def current_dependencies
- dependencies.select(&:should_include?)
+ dependencies.select do |d|
+ d.should_include? && !d.gem_platforms(@platforms).empty?
+ end
end
def specs_for(groups)
- deps = dependencies.select {|d| (d.groups & groups).any? }
- deps.delete_if {|d| !d.should_include? }
+ deps = dependencies_for(groups)
specs.for(expand_dependencies(deps))
end
@@ -450,9 +456,9 @@ module Bundler
@locked_deps.each {|name, d| both_sources[name][1] = d.source }
both_sources.each do |name, (dep, lock_source)|
- next unless (dep.nil? && !lock_source.nil?) || (!dep.nil? && !lock_source.nil? && !lock_source.can_lock?(dep))
+ next if lock_source.nil? || (dep && lock_source.can_lock?(dep))
gemfile_source_name = (dep && dep.source) || "no specified source"
- lockfile_source_name = lock_source || "no specified source"
+ lockfile_source_name = lock_source
changed << "* #{name} from `#{gemfile_source_name}` to `#{lockfile_source_name}`"
end
@@ -518,10 +524,6 @@ module Bundler
raise InvalidOption, "Unable to remove the platform `#{platform}` since the only platforms are #{@platforms.join ", "}"
end
- def add_current_platform
- current_platforms.each {|platform| add_platform(platform) }
- end
-
def find_resolved_spec(current_spec)
specs.find_by_name_and_platform(current_spec.name, current_spec.platform)
end
@@ -543,6 +545,12 @@ module Bundler
private
+ def add_platforms
+ (@dependencies.flat_map(&:expanded_platforms) + current_platforms).uniq.each do |platform|
+ add_platform(platform)
+ end
+ end
+
def current_platforms
current_platform = Bundler.local_platform
[].tap do |platforms|
@@ -706,9 +714,6 @@ module Bundler
elsif dep.source
dep.source = sources.get(dep.source)
end
- if dep.source.is_a?(Source::Gemspec)
- dep.platforms.concat(@platforms.map {|p| Dependency::REVERSE_PLATFORM_MAP[p] }.flatten(1)).uniq!
- end
end
changes = false
@@ -858,8 +863,8 @@ module Bundler
@metadata_dependencies ||= begin
ruby_versions = concat_ruby_version_requirements(@ruby_version)
if ruby_versions.empty? || !@ruby_version.exact?
- concat_ruby_version_requirements(RubyVersion.system)
- concat_ruby_version_requirements(locked_ruby_version_object) unless @unlock[:ruby]
+ concat_ruby_version_requirements(RubyVersion.system, ruby_versions)
+ concat_ruby_version_requirements(locked_ruby_version_object, ruby_versions) unless @unlock[:ruby]
end
[
Dependency.new("Ruby\0", ruby_versions),
@@ -890,27 +895,23 @@ module Bundler
dependencies.each do |dep|
dep = Dependency.new(dep, ">= 0") unless dep.respond_to?(:name)
next if !remote && !dep.current_platform?
- platforms = dep.gem_platforms(sorted_platforms)
- if platforms.empty? && !Bundler.settings[:disable_platform_warnings]
- mapped_platforms = dep.expanded_platforms
- Bundler.ui.warn \
- "The dependency #{dep} will be unused by any of the platforms Bundler is installing for. " \
- "Bundler is installing for #{@platforms.join ", "} but the dependency " \
- "is only for #{mapped_platforms.join ", "}. " \
- "To add those platforms to the bundle, " \
- "run `bundle lock --add-platform #{mapped_platforms.join " "}`."
- end
- platforms.each do |p|
+ dep.gem_platforms(sorted_platforms).each do |p|
deps << DepProxy.new(dep, p) if remote || p == generic_local_platform
end
end
deps
end
+ def dependencies_for(groups)
+ current_dependencies.reject do |d|
+ (d.groups & groups).empty?
+ end
+ end
+
def requested_dependencies
groups = requested_groups
groups.map!(&:to_sym)
- dependencies.reject {|d| !d.should_include? || (d.groups & groups).empty? }
+ dependencies_for(groups)
end
def source_requirements
diff --git a/lib/bundler/dependency.rb b/lib/bundler/dependency.rb
index 6c2642163e..26e5f3d1a5 100644
--- a/lib/bundler/dependency.rb
+++ b/lib/bundler/dependency.rb
@@ -74,15 +74,6 @@ module Bundler
:x64_mingw_26 => Gem::Platform::X64_MINGW,
}.freeze
- REVERSE_PLATFORM_MAP = {}.tap do |reverse_platform_map|
- PLATFORM_MAP.each do |key, value|
- reverse_platform_map[value] ||= []
- reverse_platform_map[value] << key
- end
-
- reverse_platform_map.each {|_, platforms| platforms.freeze }
- end.freeze
-
def initialize(name, version, options = {}, &blk)
type = options["type"] || :runtime
super(name, version, type)
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb
index 99a369281a..bb92a28381 100644
--- a/lib/bundler/dsl.rb
+++ b/lib/bundler/dsl.rb
@@ -75,8 +75,7 @@ module Bundler
@gemspecs << spec
- gem_platforms = Bundler::Dependency::REVERSE_PLATFORM_MAP[Bundler::GemHelpers.generic_local_platform]
- gem spec.name, :name => spec.name, :path => path, :glob => glob, :platforms => gem_platforms
+ gem spec.name, :name => spec.name, :path => path, :glob => glob
group(development_group) do
spec.development_dependencies.each do |dep|
diff --git a/lib/bundler/environment_preserver.rb b/lib/bundler/environment_preserver.rb
index c9014badad..a77f7e0816 100644
--- a/lib/bundler/environment_preserver.rb
+++ b/lib/bundler/environment_preserver.rb
@@ -17,14 +17,38 @@ module Bundler
].map(&:freeze).freeze
BUNDLER_PREFIX = "BUNDLER_ORIG_".freeze
- # @param env [ENV]
+ def self.from_env
+ new(env_to_hash(ENV), BUNDLER_KEYS)
+ end
+
+ def self.env_to_hash(env)
+ to_hash = env.to_hash
+ return to_hash unless Gem.win_platform?
+
+ to_hash.each_with_object({}) {|(k,v), a| a[k.upcase] = v }
+ end
+
+ # @param env [Hash]
# @param keys [Array<String>]
def initialize(env, keys)
- @original = env.to_hash
+ @original = env
@keys = keys
@prefix = BUNDLER_PREFIX
end
+ # Replaces `ENV` with the bundler environment variables backed up
+ def replace_with_backup
+ ENV.replace(backup) unless Gem.win_platform?
+
+ # Fallback logic for Windows below to workaround
+ # https://bugs.ruby-lang.org/issues/16798. Can be dropped once all
+ # supported rubies include the fix for that.
+
+ ENV.clear
+
+ backup.each {|k, v| ENV[k] = v }
+ end
+
# @return [Hash]
def backup
env = @original.clone
diff --git a/lib/bundler/errors.rb b/lib/bundler/errors.rb
index e471bce0b6..11763b4e88 100644
--- a/lib/bundler/errors.rb
+++ b/lib/bundler/errors.rb
@@ -56,6 +56,7 @@ module Bundler
class SudoNotPermittedError < BundlerError; status_code(30); end
class ThreadCreationError < BundlerError; status_code(33); end
class APIResponseMismatchError < BundlerError; status_code(34); end
+ class APIResponseInvalidDependenciesError < BundlerError; status_code(35); end
class GemfileEvalError < GemfileError; end
class MarshalError < StandardError; end
diff --git a/lib/bundler/feature_flag.rb b/lib/bundler/feature_flag.rb
index 01739ec4aa..e0f99b987a 100644
--- a/lib/bundler/feature_flag.rb
+++ b/lib/bundler/feature_flag.rb
@@ -30,7 +30,6 @@ module Bundler
settings_flag(:allow_bundler_dependency_conflicts) { bundler_3_mode? }
settings_flag(:allow_offline_install) { bundler_3_mode? }
settings_flag(:auto_clean_without_path) { bundler_3_mode? }
- settings_flag(:auto_config_jobs) { bundler_3_mode? }
settings_flag(:cache_all) { bundler_3_mode? }
settings_flag(:default_install_uses_path) { bundler_3_mode? }
settings_flag(:deployment_means_frozen) { bundler_3_mode? }
diff --git a/lib/bundler/fetcher.rb b/lib/bundler/fetcher.rb
index caf33bcfc9..abdf2a07fd 100644
--- a/lib/bundler/fetcher.rb
+++ b/lib/bundler/fetcher.rb
@@ -229,6 +229,7 @@ module Bundler
"BUILDBOX" => "buildbox",
"GO_SERVER_URL" => "go",
"SNAP_CI" => "snap",
+ "GITLAB_CI" => "gitlab",
"CI_NAME" => ENV["CI_NAME"],
"CI" => "ci",
}
diff --git a/lib/bundler/friendly_errors.rb b/lib/bundler/friendly_errors.rb
index 080697b02c..2b4706aab0 100644
--- a/lib/bundler/friendly_errors.rb
+++ b/lib/bundler/friendly_errors.rb
@@ -23,13 +23,7 @@ module Bundler
Bundler.ui.error error.message
when LoadError
raise error unless error.message =~ /cannot load such file -- openssl|openssl.so|libcrypto.so/
- Bundler.ui.error "\nCould not load OpenSSL."
- Bundler.ui.warn <<-WARN, :wrap => true
- You must recompile Ruby with OpenSSL support or change the sources in your \
- Gemfile from 'https' to 'http'. Instructions for compiling with OpenSSL \
- using RVM are available at https://rvm.io/packages/openssl.
- WARN
- Bundler.ui.trace error
+ Bundler.ui.error "\nCould not load OpenSSL. #{error.class}: #{error}\n#{error.backtrace.join("\n ")}"
when Interrupt
Bundler.ui.error "\nQuitting..."
Bundler.ui.trace error
@@ -82,7 +76,7 @@ module Bundler
I tried...
- - **Have you read our issues document, https://github.com/bundler/bundler/blob/master/doc/contributing/ISSUES.md?**
+ - **Have you read our issues document, https://github.com/rubygems/bundler/blob/master/doc/contributing/ISSUES.md?**
...
@@ -106,7 +100,7 @@ module Bundler
#{issues_url(e)}
If there aren't any reports for this error yet, please create copy and paste the report template above into a new issue. Don't forget to anonymize any private data! The new issue form is located at:
- https://github.com/bundler/bundler/issues/new
+ https://github.com/rubygems/bundler/issues/new
EOS
end
@@ -114,7 +108,7 @@ module Bundler
message = exception.message.lines.first.tr(":", " ").chomp
message = message.split("-").first if exception.is_a?(Errno)
require "cgi"
- "https://github.com/bundler/bundler/search?q=" \
+ "https://github.com/rubygems/bundler/search?q=" \
"#{CGI.escape(message)}&type=Issues"
end
end
diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb
index 204dd24052..eab894638e 100644
--- a/lib/bundler/gem_helper.rb
+++ b/lib/bundler/gem_helper.rb
@@ -25,8 +25,8 @@ module Bundler
attr_reader :spec_path, :base, :gemspec
def initialize(base = nil, name = nil)
- @base = (base ||= SharedHelpers.pwd)
- gemspecs = name ? [File.join(base, "#{name}.gemspec")] : Dir[File.join(base, "{,*}.gemspec")]
+ @base = File.expand_path(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
@spec_path = gemspecs.first
@gemspec = Bundler.load_gemspec(@spec_path)
@@ -73,7 +73,7 @@ module Bundler
def build_gem
file_name = nil
- sh("#{gem_command} build -V #{spec_path.shellescape}".shellsplit) do
+ sh([*gem_command, "build", "-V", spec_path]) do
file_name = File.basename(built_gem_path)
SharedHelpers.filesystem_access(File.join(base, "pkg")) {|p| FileUtils.mkdir_p(p) }
FileUtils.mv(built_gem_path, "pkg")
@@ -84,9 +84,9 @@ module Bundler
def install_gem(built_gem_path = nil, local = false)
built_gem_path ||= build_gem
- cmd = "#{gem_command} install #{built_gem_path}"
- cmd += " --local" if local
- _, status = sh_with_status(cmd.shellsplit)
+ cmd = [*gem_command, "install", built_gem_path.to_s]
+ cmd << "--local" if local
+ _, status = sh_with_status(cmd)
unless status.success?
raise "Couldn't install gem, run `gem install #{built_gem_path}' for more detailed output"
end
@@ -96,11 +96,11 @@ module Bundler
protected
def rubygem_push(path)
- cmd = %W[#{gem_command} push #{path}]
+ cmd = [*gem_command, "push", path]
cmd << "--key" << gem_key if gem_key
cmd << "--host" << allowed_push_host if allowed_push_host
unless allowed_push_host || Bundler.user_home.join(".gem/credentials").file?
- raise "Your rubygems.org credentials aren't set. Run `gem push` to set them."
+ raise "Your rubygems.org credentials aren't set. Run `gem signin` to set them."
end
sh_with_input(cmd)
Bundler.ui.confirm "Pushed #{name} #{version} to #{gem_push_host}"
@@ -210,7 +210,7 @@ module Bundler
end
def gem_command
- ENV["GEM_COMMAND"] ? ENV["GEM_COMMAND"] : "gem"
+ ENV["GEM_COMMAND"]&.shellsplit || ["gem"]
end
end
end
diff --git a/lib/bundler/gem_version_promoter.rb b/lib/bundler/gem_version_promoter.rb
index 311b0cbbf3..76912940ac 100644
--- a/lib/bundler/gem_version_promoter.rb
+++ b/lib/bundler/gem_version_promoter.rb
@@ -7,7 +7,7 @@ module Bundler
# available dependency versions as found in its index, before returning it to
# to the resolution engine to select the best version.
class GemVersionPromoter
- DEBUG = ENV["DEBUG_RESOLVER"]
+ DEBUG = ENV["BUNDLER_DEBUG_RESOLVER"] || ENV["DEBUG_RESOLVER"]
attr_reader :level, :locked_specs, :unlock_gems
diff --git a/lib/bundler/inline.rb b/lib/bundler/inline.rb
index f1f77a7a9c..59211193d4 100644
--- a/lib/bundler/inline.rb
+++ b/lib/bundler/inline.rb
@@ -58,7 +58,7 @@ def gemfile(install = false, options = {}, &gemfile)
Bundler.ui = install ? ui : Bundler::UI::Silent.new
if install || definition.missing_specs?
- Bundler.settings.temporary(:inline => true, :disable_platform_warnings => true) do
+ Bundler.settings.temporary(:inline => true) do
installer = Bundler::Installer.install(Bundler.root, definition, :system => true)
installer.post_install_messages.each do |name, message|
Bundler.ui.info "Post-install message from #{name}:\n#{message}"
diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb
index 700f0a4737..a8b42840ac 100644
--- a/lib/bundler/installer.rb
+++ b/lib/bundler/installer.rb
@@ -204,18 +204,7 @@ module Bundler
return 1 unless can_install_in_parallel?
- auto_config_jobs = Bundler.feature_flag.auto_config_jobs?
- if jobs = Bundler.settings[:jobs]
- if auto_config_jobs
- jobs
- else
- [jobs.pred, 1].max
- end
- elsif auto_config_jobs
- processor_count
- else
- 1
- end
+ Bundler.settings[:jobs] || processor_count
end
def processor_count
diff --git a/lib/bundler/installer/gem_installer.rb b/lib/bundler/installer/gem_installer.rb
index 9689911d6c..b41b3fdf28 100644
--- a/lib/bundler/installer/gem_installer.rb
+++ b/lib/bundler/installer/gem_installer.rb
@@ -19,11 +19,11 @@ module Bundler
Bundler.ui.debug "#{worker}: #{spec.name} (#{spec.version}) from #{spec.loaded_from}"
generate_executable_stubs
return true, post_install_message
- rescue Bundler::InstallHookError, Bundler::SecurityError, APIResponseMismatchError
+ rescue Bundler::InstallHookError, Bundler::SecurityError, Bundler::APIResponseMismatchError
raise
rescue Errno::ENOSPC
return false, out_of_space_message
- rescue StandardError => e
+ rescue Bundler::BundlerError, Gem::InstallError, Bundler::APIResponseInvalidDependenciesError => e
return false, specific_failure_message(e)
end
diff --git a/lib/bundler/installer/parallel_installer.rb b/lib/bundler/installer/parallel_installer.rb
index 391540af0b..3dee9f4664 100644
--- a/lib/bundler/installer/parallel_installer.rb
+++ b/lib/bundler/installer/parallel_installer.rb
@@ -99,7 +99,7 @@ module Bundler
install_serially
end
- handle_error if @specs.any?(&:failed?)
+ handle_error if failed_specs.any?
@specs
ensure
worker_pool && worker_pool.stop
@@ -132,6 +132,10 @@ module Bundler
private
+ def failed_specs
+ @specs.select(&:failed?)
+ end
+
def install_with_worker
enqueue_specs
process_specs until finished_installing?
@@ -156,11 +160,7 @@ module Bundler
gem_installer = Bundler::GemInstaller.new(
spec_install.spec, @installer, @standalone, worker_num, @force
)
- success, message = begin
- gem_installer.install_from_spec
- rescue RuntimeError => e
- raise e, "#{e}\n\n#{require_tree_for_spec(spec_install.spec)}"
- end
+ success, message = gem_installer.install_from_spec
if success
spec_install.state = :installed
spec_install.post_install_message = message unless message.nil?
@@ -190,11 +190,11 @@ module Bundler
end
def handle_error
- errors = @specs.select(&:failed?).map(&:error)
+ errors = failed_specs.map(&:error)
if exception = errors.find {|e| e.is_a?(Bundler::BundlerError) }
raise exception
end
- raise Bundler::InstallError, errors.map(&:to_s).join("\n\n")
+ raise Bundler::InstallError, errors.join("\n\n")
end
def require_tree_for_spec(spec)
diff --git a/lib/bundler/lazy_specification.rb b/lib/bundler/lazy_specification.rb
index 32c8bb9557..a6aeb16648 100644
--- a/lib/bundler/lazy_specification.rb
+++ b/lib/bundler/lazy_specification.rb
@@ -46,6 +46,14 @@ module Bundler
identifier == other.identifier
end
+ def eql?(other)
+ identifier.eql?(other.identifier)
+ end
+
+ def hash
+ identifier.hash
+ end
+
def satisfies?(dependency)
@name == dependency.name && dependency.requirement.satisfied_by?(Gem::Version.new(@version))
end
@@ -72,8 +80,13 @@ module Bundler
@specification = if source.is_a?(Source::Gemspec) && source.gemspec.name == name
source.gemspec.tap {|s| s.source = source }
else
- search = source.specs.search(search_object).last
- if search && Gem::Platform.new(search.platform) != Gem::Platform.new(platform) && !search.runtime_dependencies.-(dependencies.reject {|d| d.type == :development }).empty?
+ platform_object = Gem::Platform.new(platform)
+ candidates = source.specs.search(search_object)
+ same_platform_candidates = candidates.select do |spec|
+ MatchPlatform.platforms_match?(spec.platform, platform_object)
+ end
+ search = same_platform_candidates.last || candidates.last
+ if search && Gem::Platform.new(search.platform) != platform_object && !search.runtime_dependencies.-(dependencies.reject {|d| d.type == :development }).empty?
Bundler.ui.warn "Unable to use the platform-specific (#{search.platform}) version of #{name} (#{version}) " \
"because it has different dependencies from the #{platform} version. " \
"To use the platform-specific version of the gem, run `bundle config set specific_platform true` and install again."
diff --git a/lib/bundler/plugin.rb b/lib/bundler/plugin.rb
index f4dd435df4..2025e09b3d 100644
--- a/lib/bundler/plugin.rb
+++ b/lib/bundler/plugin.rb
@@ -47,6 +47,32 @@ module Bundler
Bundler.ui.error "Failed to install plugin #{name}: #{e.message}\n #{e.backtrace.join("\n ")}"
end
+ # Uninstalls plugins by the given names
+ #
+ # @param [Array<String>] names the names of plugins to be uninstalled
+ def uninstall(names, options)
+ if names.empty? && !options[:all]
+ Bundler.ui.error "No plugins to uninstall. Specify at least 1 plugin to uninstall.\n"\
+ "Use --all option to uninstall all the installed plugins."
+ return
+ end
+
+ names = index.installed_plugins if options[:all]
+ if names.any?
+ names.each do |name|
+ if index.installed?(name)
+ Bundler.rm_rf(index.plugin_path(name))
+ index.unregister_plugin(name)
+ Bundler.ui.info "Uninstalled plugin #{name}"
+ else
+ Bundler.ui.error "Plugin #{name} is not installed \n"
+ end
+ end
+ else
+ Bundler.ui.info "No plugins installed"
+ end
+ end
+
# List installed plugins and commands
#
def list
diff --git a/lib/bundler/plugin/index.rb b/lib/bundler/plugin/index.rb
index 2d70a046bb..8aea92ca0c 100644
--- a/lib/bundler/plugin/index.rb
+++ b/lib/bundler/plugin/index.rb
@@ -71,6 +71,15 @@ module Bundler
raise
end
+ def unregister_plugin(name)
+ @commands.delete_if {|_, v| v == name }
+ @sources.delete_if {|_, v| v == name }
+ @hooks.each {|_, plugin_names| plugin_names.delete(name) }
+ @plugin_paths.delete(name)
+ @load_paths.delete(name)
+ save_index
+ end
+
# Path of default index file
def index_file
Plugin.root.join("index")
diff --git a/lib/bundler/psyched_yaml.rb b/lib/bundler/psyched_yaml.rb
index c086b7651c..aeb2b30310 100644
--- a/lib/bundler/psyched_yaml.rb
+++ b/lib/bundler/psyched_yaml.rb
@@ -26,12 +26,3 @@ module Bundler
YamlLibrarySyntaxError = ::ArgumentError
end
end
-
-require_relative "deprecate"
-begin
- Bundler::Deprecate.skip_during do
- require "rubygems/safe_yaml"
- end
-rescue LoadError
- # it's OK if the file isn't there
-end
diff --git a/lib/bundler/remote_specification.rb b/lib/bundler/remote_specification.rb
index f87a09b9a6..00fe4da93f 100644
--- a/lib/bundler/remote_specification.rb
+++ b/lib/bundler/remote_specification.rb
@@ -50,6 +50,8 @@ module Bundler
# once the remote gem is downloaded, the backend specification will
# be swapped out.
def __swap__(spec)
+ raise APIResponseInvalidDependenciesError unless spec.dependencies.all? {|d| d.is_a?(Gem::Dependency) }
+
SharedHelpers.ensure_same_dependencies(self, dependencies, spec.dependencies)
@_remote_specification = spec
end
@@ -76,7 +78,8 @@ module Bundler
deps = method_missing(:dependencies)
# allow us to handle when the specs dependencies are an array of array of string
- # see https://github.com/bundler/bundler/issues/5797
+ # in order to delay the crash to `#__swap__` where it results in a friendlier error
+ # see https://github.com/rubygems/bundler/issues/5797
deps = deps.map {|d| d.is_a?(Gem::Dependency) ? d : Gem::Dependency.new(*d) }
deps
diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb
index c7caf01c7d..61bb648598 100644
--- a/lib/bundler/resolver.rb
+++ b/lib/bundler/resolver.rb
@@ -75,12 +75,17 @@ module Bundler
return unless debug?
debug_info = yield
debug_info = debug_info.inspect unless debug_info.is_a?(String)
- warn debug_info.split("\n").map {|s| " " * depth + s }
+ warn debug_info.split("\n").map {|s| "BUNDLER: " + " " * depth + s }
end
def debug?
return @debug_mode if defined?(@debug_mode)
- @debug_mode = ENV["DEBUG_RESOLVER"] || ENV["DEBUG_RESOLVER_TREE"] || false
+ @debug_mode =
+ ENV["BUNDLER_DEBUG_RESOLVER"] ||
+ ENV["BUNDLER_DEBUG_RESOLVER_TREE"] ||
+ ENV["DEBUG_RESOLVER"] ||
+ ENV["DEBUG_RESOLVER_TREE"] ||
+ false
end
def before_resolution
@@ -146,7 +151,26 @@ module Bundler
@gem_version_promoter.sort_versions(dependency, spec_groups)
end
end
- search.select {|sg| sg.for?(platform) }.each {|sg| sg.activate_platform!(platform) }
+ selected_sgs = []
+ search.each do |sg|
+ next unless sg.for?(platform)
+ # Add a spec group for "non platform specific spec" as the fallback
+ # spec group.
+ sg_ruby = sg.copy_for(Gem::Platform::RUBY)
+ selected_sgs << sg_ruby if sg_ruby
+ sg_all_platforms = nil
+ all_platforms = @platforms + [platform]
+ sorted_all_platforms = self.class.sort_platforms(all_platforms)
+ sorted_all_platforms.reverse_each do |other_platform|
+ if sg_all_platforms.nil?
+ sg_all_platforms = sg.copy_for(other_platform)
+ else
+ sg_all_platforms.activate_platform!(other_platform)
+ end
+ end
+ selected_sgs << sg_all_platforms
+ end
+ selected_sgs
end
def index_for(dependency)
@@ -183,9 +207,7 @@ module Bundler
end
def requirement_satisfied_by?(requirement, activated, spec)
- return false unless requirement.matches_spec?(spec) || spec.source.is_a?(Source::Gemspec)
- spec.activate_platform!(requirement.__platform) if !@platforms || @platforms.include?(requirement.__platform)
- true
+ requirement.matches_spec?(spec) || spec.source.is_a?(Source::Gemspec)
end
def relevant_sources_for_vertex(vertex)
@@ -223,8 +245,9 @@ module Bundler
end
def self.platform_sort_key(platform)
- return ["", "", ""] if Gem::Platform::RUBY == platform
- platform.to_a.map {|part| part || "" }
+ # Prefer specific platform to not specific platform
+ return ["99-LAST", "", "", ""] if Gem::Platform::RUBY == platform
+ ["00", *platform.to_a.map {|part| part || "" }]
end
private
diff --git a/lib/bundler/resolver/spec_group.rb b/lib/bundler/resolver/spec_group.rb
index e5772eed81..d5d12f7a2d 100644
--- a/lib/bundler/resolver/spec_group.rb
+++ b/lib/bundler/resolver/spec_group.rb
@@ -9,6 +9,7 @@ module Bundler
attr_accessor :ignores_bundler_dependencies
def initialize(all_specs)
+ @all_specs = all_specs
raise ArgumentError, "cannot initialize with an empty value" unless exemplary_spec = all_specs.first
@name = exemplary_spec.name
@version = exemplary_spec.version
@@ -28,7 +29,7 @@ module Bundler
lazy_spec = LazySpecification.new(name, version, s.platform, source)
lazy_spec.dependencies.replace s.dependencies
lazy_spec
- end.compact
+ end.compact.uniq
end
def activate_platform!(platform)
@@ -37,13 +38,25 @@ module Bundler
@activated_platforms << platform
end
+ def copy_for(platform)
+ copied_sg = self.class.new(@all_specs)
+ copied_sg.ignores_bundler_dependencies = @ignores_bundler_dependencies
+ return nil unless copied_sg.for?(platform)
+ copied_sg.activate_platform!(platform)
+ copied_sg
+ end
+
+ def spec_for(platform)
+ @specs[platform]
+ end
+
def for?(platform)
- spec = @specs[platform]
- !spec.nil?
+ !spec_for(platform).nil?
end
def to_s
- @to_s ||= "#{name} (#{version})"
+ activated_platforms_string = sorted_activated_platforms.join(", ")
+ "#{name} (#{version}) (#{activated_platforms_string})"
end
def dependencies_for_activated_platforms
@@ -58,6 +71,7 @@ module Bundler
return unless other.is_a?(SpecGroup)
name == other.name &&
version == other.version &&
+ sorted_activated_platforms == other.sorted_activated_platforms &&
source == other.source
end
@@ -65,11 +79,18 @@ module Bundler
return unless other.is_a?(SpecGroup)
name.eql?(other.name) &&
version.eql?(other.version) &&
+ sorted_activated_platforms.eql?(other.sorted_activated_platforms) &&
source.eql?(other.source)
end
def hash
- to_s.hash ^ source.hash
+ name.hash ^ version.hash ^ sorted_activated_platforms.hash ^ source.hash
+ end
+
+ protected
+
+ def sorted_activated_platforms
+ @activated_platforms.sort_by(&:to_s)
end
private
diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb
index eda826422f..8aa87d8f7d 100644
--- a/lib/bundler/rubygems_ext.rb
+++ b/lib/bundler/rubygems_ext.rb
@@ -51,7 +51,8 @@ module Gem
alias_method :rg_extension_dir, :extension_dir
def extension_dir
@bundler_extension_dir ||= if source.respond_to?(:extension_dir_name)
- File.expand_path(File.join(extensions_dir, source.extension_dir_name))
+ unique_extension_dir = [source.extension_dir_name, File.basename(full_gem_path)].uniq.join("-")
+ File.expand_path(File.join(extensions_dir, unique_extension_dir))
else
rg_extension_dir
end
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index d97621cd92..0ff3df9a08 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -346,7 +346,7 @@ module Bundler
raise e
end
- # backwards compatibility shim, see https://github.com/bundler/bundler/issues/5102
+ # backwards compatibility shim, see https://github.com/rubygems/bundler/issues/5102
kernel_class.send(:public, :gem) if Bundler.feature_flag.setup_makes_kernel_gem_public?
end
end
@@ -443,35 +443,6 @@ module Bundler
Gem.clear_paths
end
- # This backports base_dir which replaces installation path
- # RubyGems 1.8+
- def backport_base_dir
- redefine_method(Gem::Specification, :base_dir) do
- return Gem.dir unless loaded_from
- File.dirname File.dirname loaded_from
- end
- end
-
- def backport_cache_file
- redefine_method(Gem::Specification, :cache_dir) do
- @cache_dir ||= File.join base_dir, "cache"
- end
-
- redefine_method(Gem::Specification, :cache_file) do
- @cache_file ||= File.join cache_dir, "#{full_name}.gem"
- end
- end
-
- def backport_spec_file
- redefine_method(Gem::Specification, :spec_dir) do
- @spec_dir ||= File.join base_dir, "specifications"
- end
-
- redefine_method(Gem::Specification, :spec_file) do
- @spec_file ||= File.join spec_dir, "#{full_name}.gemspec"
- end
- end
-
def undo_replacements
@replaced_methods.each do |(sym, klass), method|
redefine_method(klass, sym, method)
@@ -602,10 +573,10 @@ module Bundler
def backport_ext_builder_monitor
# So we can avoid requiring "rubygems/ext" in its entirety
- Gem.module_eval <<-RB, __FILE__, __LINE__ + 1
+ Gem.module_eval <<-RUBY, __FILE__, __LINE__ + 1
module Ext
end
- RB
+ RUBY
require "rubygems/ext/builder"
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb
index afbb02397c..f1da5dd21f 100644
--- a/lib/bundler/settings.rb
+++ b/lib/bundler/settings.rb
@@ -12,7 +12,6 @@ module Bundler
allow_offline_install
auto_clean_without_path
auto_install
- auto_config_jobs
cache_all
cache_all_platforms
default_install_uses_path
@@ -22,7 +21,6 @@ module Bundler
disable_exec_load
disable_local_branch_check
disable_multisource
- disable_platform_warnings
disable_shared_gems
disable_version_check
force_ruby_platform
diff --git a/lib/bundler/source/git.rb b/lib/bundler/source/git.rb
index 7c1533ad90..0b4d76939b 100644
--- a/lib/bundler/source/git.rb
+++ b/lib/bundler/source/git.rb
@@ -230,6 +230,10 @@ module Bundler
@allow_remote || @allow_cached
end
+ def local?
+ @local
+ end
+
private
def serialize_gemspecs_in(destination)
@@ -256,10 +260,6 @@ module Bundler
cached_revision && super
end
- def local?
- @local
- end
-
def requires_checkout?
allow_git_ops? && !local? && !cached_revision_checked_out?
end
diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb
index 7612eb16c6..9a4b7fe523 100644
--- a/lib/bundler/source/git/git_proxy.rb
+++ b/lib/bundler/source/git/git_proxy.rb
@@ -18,7 +18,7 @@ module Bundler
def initialize(command)
msg = String.new
msg << "Bundler is trying to run a `git #{command}` at runtime. You probably need to run `bundle install`. However, "
- msg << "this error message could probably be more useful. Please submit a ticket at https://github.com/bundler/bundler/issues "
+ msg << "this error message could probably be more useful. Please submit a ticket at https://github.com/rubygems/bundler/issues "
msg << "with steps to reproduce as well as the following\n\nCALLER: #{caller.join("\n")}"
super msg
end
@@ -27,21 +27,21 @@ module Bundler
class GitCommandError < GitError
attr_reader :command
- def initialize(command, path = nil, extra_info = nil)
+ def initialize(command, path, destination_path, extra_info = nil)
@command = command
msg = String.new
- msg << "Git error: command `git #{command}` in directory #{SharedHelpers.pwd} has failed."
+ msg << "Git error: command `git #{command}` in directory #{destination_path} has failed."
msg << "\n#{extra_info}" if extra_info
- msg << "\nIf this error persists you could try removing the cache directory '#{path}'" if path && path.exist?
+ msg << "\nIf this error persists you could try removing the cache directory '#{path}'" if path.exist?
super msg
end
end
class MissingGitRevisionError < GitCommandError
- def initialize(command, path, ref, repo)
+ def initialize(command, path, destination_path, ref, repo)
msg = "Revision #{ref} does not exist in the repository #{repo}. Maybe you misspelled it?"
- super command, path, msg
+ super command, path, destination_path, msg
end
end
@@ -62,26 +62,18 @@ module Bundler
end
def revision
- return @revision if @revision
-
- begin
- @revision ||= find_local_revision
- rescue GitCommandError => e
- raise MissingGitRevisionError.new(e.command, path, ref, URICredentialsFilter.credential_filtered_uri(uri))
- end
-
- @revision
+ @revision ||= find_local_revision
end
def branch
- @branch ||= allowed_in_path do
- git("rev-parse --abbrev-ref HEAD").strip
+ @branch ||= allowed_with_path do
+ git("rev-parse --abbrev-ref HEAD", :dir => path).strip
end
end
def contains?(commit)
- allowed_in_path do
- result, status = git_null("branch --contains #{commit}")
+ allowed_with_path do
+ result, status = git_null("branch --contains #{commit}", :dir => path)
status.success? && result =~ /^\* (.*)$/
end
end
@@ -108,8 +100,8 @@ module Bundler
return unless extra_ref
end
- in_path do
- git_retry %(fetch --force --quiet --tags #{uri_escaped_with_configured_credentials} "refs/heads/*:refs/heads/*" #{extra_ref})
+ with_path do
+ git_retry %(fetch --force --quiet --tags #{uri_escaped_with_configured_credentials} "refs/heads/*:refs/heads/*" #{extra_ref}), :dir => path
end
end
@@ -133,58 +125,54 @@ module Bundler
end
end
# method 2
- SharedHelpers.chdir(destination) do
- git_retry %(fetch --force --quiet --tags "#{path}")
+ git_retry %(fetch --force --quiet --tags "#{path}"), :dir => destination
- begin
- git "reset --hard #{@revision}"
- rescue GitCommandError => e
- raise MissingGitRevisionError.new(e.command, path, @revision, URICredentialsFilter.credential_filtered_uri(uri))
- end
+ begin
+ git "reset --hard #{@revision}", :dir => destination
+ rescue GitCommandError => e
+ raise MissingGitRevisionError.new(e.command, path, destination, @revision, URICredentialsFilter.credential_filtered_uri(uri))
+ end
- if submodules
- git_retry "submodule update --init --recursive"
- elsif Gem::Version.create(version) >= Gem::Version.create("2.9.0")
- git_retry "submodule deinit --all --force"
- end
+ if submodules
+ git_retry "submodule update --init --recursive", :dir => destination
+ elsif Gem::Version.create(version) >= Gem::Version.create("2.9.0")
+ git_retry "submodule deinit --all --force", :dir => destination
end
end
private
- def git_null(command)
- command_with_no_credentials = URICredentialsFilter.credential_filtered_string(command, uri)
- raise GitNotAllowedError.new(command_with_no_credentials) unless allow?
+ def git_null(command, dir: SharedHelpers.pwd)
+ check_allowed(command)
out, status = SharedHelpers.with_clean_git_env do
- capture_and_ignore_stderr("git #{command}")
+ capture_and_ignore_stderr("git #{command}", :chdir => dir.to_s)
end
[URICredentialsFilter.credential_filtered_string(out, uri), status]
end
- def git_retry(command)
+ def git_retry(command, dir: SharedHelpers.pwd)
Bundler::Retry.new("`git #{URICredentialsFilter.credential_filtered_string(command, uri)}`", GitNotAllowedError).attempts do
- git(command)
+ git(command, :dir => dir)
end
end
- def git(command, check_errors = true, error_msg = nil)
- command_with_no_credentials = URICredentialsFilter.credential_filtered_string(command, uri)
- raise GitNotAllowedError.new(command_with_no_credentials) unless allow?
+ def git(command, dir: SharedHelpers.pwd)
+ command_with_no_credentials = check_allowed(command)
out, status = SharedHelpers.with_clean_git_env do
- capture_and_filter_stderr(uri, "git #{command}")
+ capture_and_filter_stderr(uri, "git #{command}", :chdir => dir.to_s)
end
- stdout_with_no_credentials = URICredentialsFilter.credential_filtered_string(out, uri)
- raise GitCommandError.new(command_with_no_credentials, path, error_msg) if check_errors && !status.success?
- stdout_with_no_credentials
+ raise GitCommandError.new(command_with_no_credentials, path, dir) unless status.success?
+
+ URICredentialsFilter.credential_filtered_string(out, uri)
end
def has_revision_cached?
return unless @revision
- in_path { git("cat-file -e #{@revision}") }
+ with_path { git("cat-file -e #{@revision}", :dir => path) }
true
rescue GitError
false
@@ -195,9 +183,11 @@ module Bundler
end
def find_local_revision
- allowed_in_path do
- git("rev-parse --verify #{Shellwords.shellescape(ref)}", true).strip
+ allowed_with_path do
+ git("rev-parse --verify #{Shellwords.shellescape(ref)}", :dir => path).strip
end
+ rescue GitCommandError => e
+ raise MissingGitRevisionError.new(e.command, path, path, ref, URICredentialsFilter.credential_filtered_uri(uri))
end
# Escape the URI for git commands
@@ -230,27 +220,32 @@ module Bundler
@git ? @git.allow_git_ops? : true
end
- def in_path(&blk)
+ def with_path(&blk)
checkout unless path.exist?
- _ = URICredentialsFilter # load it before we chdir
- SharedHelpers.chdir(path, &blk)
+ blk.call
end
- def allowed_in_path
- return in_path { yield } if allow?
+ def allowed_with_path
+ return with_path { yield } if allow?
raise GitError, "The git source #{uri} is not yet checked out. Please run `bundle install` before trying to start your application"
end
- def capture_and_filter_stderr(uri, cmd)
+ def check_allowed(command)
+ command_with_no_credentials = URICredentialsFilter.credential_filtered_string(command, uri)
+ raise GitNotAllowedError.new(command_with_no_credentials) unless allow?
+ command_with_no_credentials
+ end
+
+ def capture_and_filter_stderr(uri, cmd, chdir: SharedHelpers.pwd)
require "open3"
- return_value, captured_err, status = Open3.capture3(cmd)
+ return_value, captured_err, status = Open3.capture3(cmd, :chdir => chdir)
Bundler.ui.warn URICredentialsFilter.credential_filtered_string(captured_err, uri) if uri && !captured_err.empty?
[return_value, status]
end
- def capture_and_ignore_stderr(cmd)
+ def capture_and_ignore_stderr(cmd, chdir: SharedHelpers.pwd)
require "open3"
- return_value, _, status = Open3.capture3(cmd)
+ return_value, _, status = Open3.capture3(cmd, :chdir => chdir)
[return_value, status]
end
end
diff --git a/lib/bundler/source/path.rb b/lib/bundler/source/path.rb
index f98f5155fb..e73e33d922 100644
--- a/lib/bundler/source/path.rb
+++ b/lib/bundler/source/path.rb
@@ -132,7 +132,11 @@ module Bundler
end
def expand(somepath)
- somepath.expand_path(root_path)
+ if Bundler.current_ruby.jruby? # TODO: Unify when https://github.com/rubygems/bundler/issues/7598 fixed upstream and all supported jrubies include the fix
+ somepath.expand_path(root_path).expand_path
+ else
+ somepath.expand_path(root_path)
+ end
rescue ArgumentError => e
Bundler.ui.debug(e)
raise PathError, "There was an error while trying to use the path " \
diff --git a/lib/bundler/source/path/installer.rb b/lib/bundler/source/path/installer.rb
index a0357ffa39..909e248412 100644
--- a/lib/bundler/source/path/installer.rb
+++ b/lib/bundler/source/path/installer.rb
@@ -26,18 +26,16 @@ module Bundler
end
def post_install
- SharedHelpers.chdir(@gem_dir) do
- run_hooks(:pre_install)
+ run_hooks(:pre_install)
- unless @disable_extensions
- build_extensions
- run_hooks(:post_build)
- end
+ unless @disable_extensions
+ build_extensions
+ run_hooks(:post_build)
+ end
- generate_bin unless spec.executables.nil? || spec.executables.empty?
+ generate_bin unless spec.executables.nil? || spec.executables.empty?
- run_hooks(:post_install)
- end
+ run_hooks(:post_install)
ensure
Bundler.rm_rf(@tmp_dir) if Bundler.requires_sudo?
end
diff --git a/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt b/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt
index 7dfd14aab9..175b821a62 100644
--- a/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt
+++ b/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt
@@ -2,73 +2,83 @@
## Our Pledge
-In the interest of fostering an open and welcoming environment, we as
-contributors and maintainers pledge to making participation in our project and
-our community a harassment-free experience for everyone, regardless of age, body
-size, disability, ethnicity, gender identity and expression, level of experience,
-nationality, personal appearance, race, religion, or sexual identity and
-orientation.
+We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
+
+We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
## Our Standards
-Examples of behavior that contributes to creating a positive environment
-include:
+Examples of behavior that contributes to a positive environment for our community include:
-* Using welcoming and inclusive language
-* Being respectful of differing viewpoints and experiences
-* Gracefully accepting constructive criticism
-* Focusing on what is best for the community
-* Showing empathy towards other community members
+* Demonstrating empathy and kindness toward other people
+* Being respectful of differing opinions, viewpoints, and experiences
+* Giving and gracefully accepting constructive feedback
+* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
+* Focusing on what is best not just for us as individuals, but for the overall community
-Examples of unacceptable behavior by participants include:
+Examples of unacceptable behavior include:
-* The use of sexualized language or imagery and unwelcome sexual attention or
-advances
-* Trolling, insulting/derogatory comments, and personal or political attacks
+* The use of sexualized language or imagery, and sexual attention or
+ advances of any kind
+* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
-* Publishing others' private information, such as a physical or electronic
- address, without explicit permission
+* Publishing others' private information, such as a physical or email
+ address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
-## Our Responsibilities
+## Enforcement Responsibilities
-Project maintainers are responsible for clarifying the standards of acceptable
-behavior and are expected to take appropriate and fair corrective action in
-response to any instances of unacceptable behavior.
+Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
-Project maintainers have the right and responsibility to remove, edit, or
-reject comments, commits, code, wiki edits, issues, and other contributions
-that are not aligned to this Code of Conduct, or to ban temporarily or
-permanently any contributor for other behaviors that they deem inappropriate,
-threatening, offensive, or harmful.
+Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
## Scope
-This Code of Conduct applies both within project spaces and in public spaces
-when an individual is representing the project or its community. Examples of
-representing a project or community include using an official project e-mail
-address, posting via an official social media account, or acting as an appointed
-representative at an online or offline event. Representation of a project may be
-further defined and clarified by project maintainers.
+This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
## Enforcement
-Instances of abusive, harassing, or otherwise unacceptable behavior may be
-reported by contacting the project team at <%= config[:email] %>. All
-complaints will be reviewed and investigated and will result in a response that
-is deemed necessary and appropriate to the circumstances. The project team is
-obligated to maintain confidentiality with regard to the reporter of an incident.
-Further details of specific enforcement policies may be posted separately.
+Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at <%= config[:email] %>. All complaints will be reviewed and investigated promptly and fairly.
+
+All community leaders are obligated to respect the privacy and security of the reporter of any incident.
+
+## Enforcement Guidelines
+
+Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
+
+### 1. Correction
+
+**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
+
+**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
+
+### 2. Warning
+
+**Community Impact**: A violation through a single incident or series of actions.
-Project maintainers who do not follow or enforce the Code of Conduct in good
-faith may face temporary or permanent repercussions as determined by other
-members of the project's leadership.
+**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
+
+### 3. Temporary Ban
+
+**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
+
+**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
+
+### 4. Permanent Ban
+
+**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
+
+**Consequence**: A permanent ban from any sort of public interaction within the community.
## Attribution
-This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
-available at [https://contributor-covenant.org/version/1/4][version]
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
+available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
+
+Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
+
+[homepage]: https://www.contributor-covenant.org
-[homepage]: https://contributor-covenant.org
-[version]: https://contributor-covenant.org/version/1/4/
+For answers to common questions about this code of conduct, see the FAQ at
+https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
diff --git a/lib/bundler/templates/newgem/Gemfile.tt b/lib/bundler/templates/newgem/Gemfile.tt
index 83878ec7f8..b689e2e804 100644
--- a/lib/bundler/templates/newgem/Gemfile.tt
+++ b/lib/bundler/templates/newgem/Gemfile.tt
@@ -3,10 +3,13 @@ source "https://rubygems.org"
# Specify your gem's dependencies in <%= config[:name] %>.gemspec
gemspec
-gem "rake", "~> 12.0"
+gem "rake", "~> 13.0"
<%- if config[:ext] -%>
gem "rake-compiler"
<%- end -%>
<%- if config[:test] -%>
gem "<%= config[:test] %>", "~> <%= config[:test_framework_version] %>"
<%- end -%>
+<%- if config[:rubocop] -%>
+gem "rubocop"
+<%- end -%>
diff --git a/lib/bundler/templates/newgem/Rakefile.tt b/lib/bundler/templates/newgem/Rakefile.tt
index 099da6f3ec..af7729c04e 100644
--- a/lib/bundler/templates/newgem/Rakefile.tt
+++ b/lib/bundler/templates/newgem/Rakefile.tt
@@ -1,5 +1,7 @@
require "bundler/gem_tasks"
-<% if config[:test] == "minitest" -%>
+<% default_task_names = [config[:test_task]].compact -%>
+<% case config[:test] -%>
+<% when "minitest", "test-unit" -%>
require "rake/testtask"
Rake::TestTask.new(:test) do |t|
@@ -8,13 +10,21 @@ Rake::TestTask.new(:test) do |t|
t.test_files = FileList["test/**/*_test.rb"]
end
-<% elsif config[:test] == "rspec" -%>
+<% when "rspec" -%>
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)
<% end -%>
+<% if config[:rubocop] -%>
+<% default_task_names << :rubocop -%>
+require "rubocop/rake_task"
+
+RuboCop::RakeTask.new
+
+<% end -%>
<% if config[:ext] -%>
+<% default_task_names.unshift(:clobber, :compile) -%>
require "rake/extensiontask"
task :build => :compile
@@ -23,7 +33,5 @@ Rake::ExtensionTask.new("<%= config[:underscored_name] %>") do |ext|
ext.lib_dir = "lib/<%= config[:namespaced_path] %>"
end
-task :default => [:clobber, :compile, :<%= config[:test_task] %>]
-<% else -%>
-task :default => :<%= config[:test_task] %>
<% end -%>
+task :default => <%= default_task_names.size == 1 ? default_task_names.first.inspect : default_task_names.inspect %>
diff --git a/lib/bundler/templates/newgem/newgem.gemspec.tt b/lib/bundler/templates/newgem/newgem.gemspec.tt
index 9bb3d0ff50..7961ccf24c 100644
--- a/lib/bundler/templates/newgem/newgem.gemspec.tt
+++ b/lib/bundler/templates/newgem/newgem.gemspec.tt
@@ -1,4 +1,4 @@
-require_relative 'lib/<%=config[:namespaced_path]%>/version'
+require_relative "lib/<%=config[:namespaced_path]%>/version"
Gem::Specification.new do |spec|
spec.name = <%= config[:name].inspect %>
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
+ spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
end
spec.bindir = "exe"
diff --git a/lib/bundler/templates/newgem/test/minitest/newgem_test.rb.tt b/lib/bundler/templates/newgem/test/minitest/newgem_test.rb.tt
new file mode 100644
index 0000000000..f2af9f90e0
--- /dev/null
+++ b/lib/bundler/templates/newgem/test/minitest/newgem_test.rb.tt
@@ -0,0 +1,11 @@
+require "test_helper"
+
+class <%= config[:constant_name] %>Test < Minitest::Test
+ def test_that_it_has_a_version_number
+ refute_nil ::<%= config[:constant_name] %>::VERSION
+ end
+
+ def test_it_does_something_useful
+ assert false
+ end
+end
diff --git a/lib/bundler/templates/newgem/test/minitest/test_helper.rb.tt b/lib/bundler/templates/newgem/test/minitest/test_helper.rb.tt
new file mode 100644
index 0000000000..7d7db165ec
--- /dev/null
+++ b/lib/bundler/templates/newgem/test/minitest/test_helper.rb.tt
@@ -0,0 +1,4 @@
+$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
+require "<%= config[:namespaced_path] %>"
+
+require "minitest/autorun"
diff --git a/lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt b/lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt
new file mode 100644
index 0000000000..e653993006
--- /dev/null
+++ b/lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt
@@ -0,0 +1,13 @@
+require "test_helper"
+
+class <%= config[:constant_name] %>Test < Test::Unit::TestCase
+ test "VERSION" do
+ assert do
+ ::<%= config[:constant_name] %>.const_defined?(:VERSION)
+ end
+ end
+
+ test "something useful" do
+ assert_equal("expected", "actual")
+ end
+end
diff --git a/lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt b/lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt
new file mode 100644
index 0000000000..461ee391a5
--- /dev/null
+++ b/lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt
@@ -0,0 +1,4 @@
+$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
+require "<%= config[:namespaced_path] %>"
+
+require "test-unit"
diff --git a/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb b/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb
index f9d1401062..d0ab956faf 100644
--- a/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb
+++ b/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb
@@ -12,15 +12,11 @@ autoload :OpenSSL, 'openssl'
# servers you wish to talk to. For each host:port you communicate with a
# single persistent connection is created.
#
-# Multiple Bundler::Persistent::Net::HTTP::Persistent objects will share the same set of
-# connections.
+# Connections will be shared across threads through a connection pool to
+# increase reuse of connections.
#
-# For each thread you start a new connection will be created. A
-# Bundler::Persistent::Net::HTTP::Persistent connection will not be shared across threads.
-#
-# You can shut down the HTTP connections when done by calling #shutdown. You
-# should name your Bundler::Persistent::Net::HTTP::Persistent object if you intend to call this
-# method.
+# You can shut down any remaining HTTP connections when done by calling
+# #shutdown.
#
# Example:
#
@@ -28,7 +24,7 @@ autoload :OpenSSL, 'openssl'
#
# uri = Bundler::URI 'http://example.com/awesome/web/service'
#
-# http = Bundler::Persistent::Net::HTTP::Persistent.new name: 'my_app_name'
+# http = Bundler::Persistent::Net::HTTP::Persistent.new
#
# # perform a GET
# response = http.request uri
@@ -50,14 +46,14 @@ autoload :OpenSSL, 'openssl'
# to use Bundler::URI#request_uri not Bundler::URI#path. The request_uri contains the query
# params which are sent in the body for other requests.
#
-# == SSL
+# == TLS/SSL
#
-# SSL connections are automatically created depending upon the scheme of the
-# Bundler::URI. SSL connections are automatically verified against the default
+# TLS connections are automatically created depending upon the scheme of the
+# Bundler::URI. TLS connections are automatically verified against the default
# certificate store for your computer. You can override this by changing
# verify_mode or by specifying an alternate cert_store.
#
-# Here are the SSL settings, see the individual methods for documentation:
+# Here are the TLS settings, see the individual methods for documentation:
#
# #certificate :: This client's certificate
# #ca_file :: The certificate-authorities
@@ -67,7 +63,7 @@ autoload :OpenSSL, 'openssl'
# #private_key :: The client's SSL private key
# #reuse_ssl_sessions :: Reuse a previously opened SSL session for a new
# connection
-# #ssl_timeout :: SSL session lifetime
+# #ssl_timeout :: Session lifetime
# #ssl_version :: Which specific SSL version to use
# #verify_callback :: For server certificate verification
# #verify_depth :: Depth of certificate verification
@@ -96,14 +92,15 @@ autoload :OpenSSL, 'openssl'
#
# === Segregation
#
-# By providing an application name to ::new you can separate your connections
-# from the connections of other applications.
+# Each Bundler::Persistent::Net::HTTP::Persistent instance has its own pool of connections. There
+# is no sharing with other instances (as was true in earlier versions).
#
# === Idle Timeout
#
-# If a connection hasn't been used for this number of seconds it will automatically be
-# reset upon the next use to avoid attempting to send to a closed connection.
-# The default value is 5 seconds. nil means no timeout. Set through #idle_timeout.
+# If a connection hasn't been used for this number of seconds it will
+# automatically be reset upon the next use to avoid attempting to send to a
+# closed connection. The default value is 5 seconds. nil means no timeout.
+# Set through #idle_timeout.
#
# Reducing this value may help avoid the "too many connection resets" error
# when sending non-idempotent requests while increasing this value will cause
@@ -118,8 +115,9 @@ autoload :OpenSSL, 'openssl'
#
# The number of requests that should be made before opening a new connection.
# Typically many keep-alive capable servers tune this to 100 or less, so the
-# 101st request will fail with ECONNRESET. If unset (default), this value has no
-# effect, if set, connections will be reset on the request after max_requests.
+# 101st request will fail with ECONNRESET. If unset (default), this value has
+# no effect, if set, connections will be reset on the request after
+# max_requests.
#
# === Open Timeout
#
@@ -131,45 +129,6 @@ autoload :OpenSSL, 'openssl'
# Socket options may be set on newly-created connections. See #socket_options
# for details.
#
-# === Non-Idempotent Requests
-#
-# By default non-idempotent requests will not be retried per RFC 2616. By
-# setting retry_change_requests to true requests will automatically be retried
-# once.
-#
-# Only do this when you know that retrying a POST or other non-idempotent
-# request is safe for your application and will not create duplicate
-# resources.
-#
-# The recommended way to handle non-idempotent requests is the following:
-#
-# require 'bundler/vendor/net-http-persistent/lib/net/http/persistent'
-#
-# uri = Bundler::URI 'http://example.com/awesome/web/service'
-# post_uri = uri + 'create'
-#
-# http = Bundler::Persistent::Net::HTTP::Persistent.new name: 'my_app_name'
-#
-# post = Net::HTTP::Post.new post_uri.path
-# # ... fill in POST request
-#
-# begin
-# response = http.request post_uri, post
-# rescue Bundler::Persistent::Net::HTTP::Persistent::Error
-#
-# # POST failed, make a new request to verify the server did not process
-# # the request
-# exists_uri = uri + '...'
-# response = http.get exists_uri
-#
-# # Retry if it failed
-# retry if response.code == '404'
-# end
-#
-# The method of determining if the resource was created or not is unique to
-# the particular service you are using. Of course, you will want to add
-# protection from infinite looping.
-#
# === Connection Termination
#
# If you are done using the Bundler::Persistent::Net::HTTP::Persistent instance you may shut down
@@ -195,33 +154,20 @@ class Bundler::Persistent::Net::HTTP::Persistent
HAVE_OPENSSL = defined? OpenSSL::SSL # :nodoc:
##
- # The default connection pool size is 1/4 the allowed open files.
+ # The default connection pool size is 1/4 the allowed open files
+ # (<code>ulimit -n</code>) or 256 if your OS does not support file handle
+ # limits (typically windows).
- if Gem.win_platform? then
- DEFAULT_POOL_SIZE = 256
- else
+ if Process.const_defined? :RLIMIT_NOFILE
DEFAULT_POOL_SIZE = Process.getrlimit(Process::RLIMIT_NOFILE).first / 4
+ else
+ DEFAULT_POOL_SIZE = 256
end
##
# The version of Bundler::Persistent::Net::HTTP::Persistent you are using
- VERSION = '3.1.0'
-
- ##
- # Exceptions rescued for automatic retry on ruby 2.0.0. This overlaps with
- # the exception list for ruby 1.x.
-
- RETRIED_EXCEPTIONS = [ # :nodoc:
- (Net::ReadTimeout if Net.const_defined? :ReadTimeout),
- IOError,
- EOFError,
- Errno::ECONNRESET,
- Errno::ECONNABORTED,
- Errno::EPIPE,
- (OpenSSL::SSL::SSLError if HAVE_OPENSSL),
- Timeout::Error,
- ].compact
+ VERSION = '4.0.0'
##
# Error class for errors raised by Bundler::Persistent::Net::HTTP::Persistent. Various
@@ -349,6 +295,13 @@ class Bundler::Persistent::Net::HTTP::Persistent
attr_accessor :max_requests
##
+ # Number of retries to perform if a request fails.
+ #
+ # See also #max_retries=, Net::HTTP#max_retries=.
+
+ attr_reader :max_retries
+
+ ##
# The value sent in the Keep-Alive header. Defaults to 30. Not needed for
# HTTP/1.1 servers.
#
@@ -360,8 +313,7 @@ class Bundler::Persistent::Net::HTTP::Persistent
attr_accessor :keep_alive
##
- # A name for this connection. Allows you to keep your connections apart
- # from everybody else's.
+ # The name for this collection of persistent connections.
attr_reader :name
@@ -491,22 +443,10 @@ class Bundler::Persistent::Net::HTTP::Persistent
attr_reader :verify_mode
##
- # Enable retries of non-idempotent requests that change data (e.g. POST
- # requests) when the server has disconnected.
- #
- # This will in the worst case lead to multiple requests with the same data,
- # but it may be useful for some applications. Take care when enabling
- # this option to ensure it is safe to POST or perform other non-idempotent
- # requests to the server.
-
- attr_accessor :retry_change_requests
-
- ##
# Creates a new Bundler::Persistent::Net::HTTP::Persistent.
#
- # Set +name+ to keep your connections apart from everybody else's. Not
- # required currently, but highly recommended. Your library name should be
- # good enough. This parameter will be required in a future version.
+ # Set a +name+ for fun. Your library name should be good enough, but this
+ # otherwise has no purpose.
#
# +proxy+ may be set to a Bundler::URI::HTTP or :ENV to pick up proxy options from
# the environment. See proxy_from_env for details.
@@ -519,8 +459,9 @@ class Bundler::Persistent::Net::HTTP::Persistent
# proxy.password = 'hunter2'
#
# Set +pool_size+ to limit the maximum number of connections allowed.
- # Defaults to 1/4 the number of allowed file handles. You can have no more
- # than this many threads with active HTTP transactions.
+ # Defaults to 1/4 the number of allowed file handles or 256 if your OS does
+ # not support a limit on allowed file handles. You can have no more than
+ # this many threads with active HTTP transactions.
def initialize name: nil, proxy: nil, pool_size: DEFAULT_POOL_SIZE
@name = name
@@ -537,6 +478,7 @@ class Bundler::Persistent::Net::HTTP::Persistent
@write_timeout = nil
@idle_timeout = 5
@max_requests = nil
+ @max_retries = 1
@socket_options = []
@ssl_generation = 0 # incremented when SSL session variables change
@@ -568,8 +510,6 @@ class Bundler::Persistent::Net::HTTP::Persistent
@reuse_ssl_sessions = OpenSSL::SSL.const_defined? :Session
end
- @retry_change_requests = false
-
self.proxy = proxy if proxy
end
@@ -630,7 +570,9 @@ class Bundler::Persistent::Net::HTTP::Persistent
net_http_args = [uri.hostname, uri.port]
- if @proxy_uri and not proxy_bypass? uri.hostname, uri.port then
+ # I'm unsure if uri.host or uri.hostname should be checked against
+ # the proxy bypass list.
+ if @proxy_uri and not proxy_bypass? uri.host, uri.port then
net_http_args.concat @proxy_args
else
net_http_args.concat [nil, nil, nil, nil]
@@ -650,9 +592,11 @@ class Bundler::Persistent::Net::HTTP::Persistent
reset connection
end
- http.read_timeout = @read_timeout if @read_timeout
- http.write_timeout = @write_timeout if @write_timeout && http.respond_to?(:write_timeout=)
- http.keep_alive_timeout = @idle_timeout if @idle_timeout
+ http.keep_alive_timeout = @idle_timeout if @idle_timeout
+ http.max_retries = @max_retries if http.respond_to?(:max_retries=)
+ http.read_timeout = @read_timeout if @read_timeout
+ http.write_timeout = @write_timeout if
+ @write_timeout && http.respond_to?(:write_timeout=)
return yield connection
rescue Errno::ECONNREFUSED
@@ -670,27 +614,14 @@ class Bundler::Persistent::Net::HTTP::Persistent
end
##
- # Returns an error message containing the number of requests performed on
- # this connection
-
- def error_message connection
- connection.requests -= 1 # fixup
-
- age = Time.now - connection.last_use
-
- "after #{connection.requests} requests on #{connection.http.object_id}, " \
- "last used #{age} seconds ago"
- end
-
- ##
- # Bundler::URI::escape wrapper
+ # CGI::escape wrapper
def escape str
CGI.escape str if str
end
##
- # Bundler::URI::unescape wrapper
+ # CGI::unescape wrapper
def unescape str
CGI.unescape str if str
@@ -733,6 +664,7 @@ class Bundler::Persistent::Net::HTTP::Persistent
def finish connection
connection.finish
+ connection.http.instance_variable_set :@last_communicated, nil
connection.http.instance_variable_set :@ssl_session, nil unless
@reuse_ssl_sessions
end
@@ -741,31 +673,31 @@ class Bundler::Persistent::Net::HTTP::Persistent
# Returns the HTTP protocol version for +uri+
def http_version uri
- @http_versions["#{uri.host}:#{uri.port}"]
+ @http_versions["#{uri.hostname}:#{uri.port}"]
end
##
- # Is +req+ idempotent according to RFC 2616?
+ # Adds "http://" to the String +uri+ if it is missing.
- def idempotent? req
- case req.method
- when 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PUT', 'TRACE' then
- true
- end
+ def normalize_uri uri
+ (uri =~ /^https?:/) ? uri : "http://#{uri}"
end
##
- # Is the request +req+ idempotent or is retry_change_requests allowed.
+ # Set the maximum number of retries for a request.
+ #
+ # Defaults to one retry.
+ #
+ # Set this to 0 to disable retries.
- def can_retry? req
- @retry_change_requests && !idempotent?(req)
- end
+ def max_retries= retries
+ retries = retries.to_int
- ##
- # Adds "http://" to the String +uri+ if it is missing.
+ raise ArgumentError, "max_retries must be positive" if retries < 0
- def normalize_uri uri
- (uri =~ /^https?:/) ? uri : "http://#{uri}"
+ @max_retries = retries
+
+ reconnect
end
##
@@ -806,7 +738,7 @@ class Bundler::Persistent::Net::HTTP::Persistent
if @proxy_uri then
@proxy_args = [
- @proxy_uri.host,
+ @proxy_uri.hostname,
@proxy_uri.port,
unescape(@proxy_uri.user),
unescape(@proxy_uri.password),
@@ -881,14 +813,15 @@ class Bundler::Persistent::Net::HTTP::Persistent
end
##
- # Forces reconnection of HTTP connections.
+ # Forces reconnection of all HTTP connections, including TLS/SSL
+ # connections.
def reconnect
@generation += 1
end
##
- # Forces reconnection of SSL connections.
+ # Forces reconnection of only TLS/SSL connections.
def reconnect_ssl
@ssl_generation += 1
@@ -921,14 +854,8 @@ class Bundler::Persistent::Net::HTTP::Persistent
# the response will not have been read).
#
# +req+ must be a Net::HTTPGenericRequest subclass (see Net::HTTP for a list).
- #
- # If there is an error and the request is idempotent according to RFC 2616
- # it will be retried automatically.
def request uri, req = nil, &block
- retried = false
- bad_response = false
-
uri = Bundler::URI uri
req = request_setup req || uri
response = nil
@@ -942,37 +869,12 @@ class Bundler::Persistent::Net::HTTP::Persistent
response = http.request req, &block
if req.connection_close? or
- (response.http_version <= '1.0' and
+ (response.http_version <= '1.0' and
not response.connection_keep_alive?) or
- response.connection_close? then
+ response.connection_close? then
finish connection
end
- rescue Net::HTTPBadResponse => e
- message = error_message connection
-
- finish connection
-
- raise Error, "too many bad responses #{message}" if
- bad_response or not can_retry? req
-
- bad_response = true
- retry
- rescue *RETRIED_EXCEPTIONS => e
- request_failed e, req, connection if
- retried or not can_retry? req
-
- reset connection
-
- retried = true
- retry
- rescue Errno::EINVAL, Errno::ETIMEDOUT => e # not retried on ruby 2
- request_failed e, req, connection if retried or not can_retry? req
-
- reset connection
-
- retried = true
- retry
- rescue Exception => e
+ rescue Exception # make sure to close the connection when it was interrupted
finish connection
raise
@@ -981,34 +883,19 @@ class Bundler::Persistent::Net::HTTP::Persistent
end
end
- @http_versions["#{uri.host}:#{uri.port}"] ||= response.http_version
+ @http_versions["#{uri.hostname}:#{uri.port}"] ||= response.http_version
response
end
##
- # Raises an Error for +exception+ which resulted from attempting the request
- # +req+ on the +connection+.
- #
- # Finishes the +connection+.
-
- def request_failed exception, req, connection # :nodoc:
- due_to = "(due to #{exception.message} - #{exception.class})"
- message = "too many connection resets #{due_to} #{error_message connection}"
-
- finish connection
-
- raise Error, message, exception.backtrace
- end
-
- ##
# Creates a GET request if +req_or_uri+ is a Bundler::URI and adds headers to the
# request.
#
# Returns the request.
def request_setup req_or_uri # :nodoc:
- req = if Bundler::URI === req_or_uri then
+ req = if req_or_uri.respond_to? 'request_uri' then
Net::HTTP::Get.new req_or_uri.request_uri
else
req_or_uri
@@ -1172,7 +1059,6 @@ application:
reconnect_ssl
end
-
end
require_relative 'persistent/connection'
diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb
index 85704816e4..39789b5913 100644
--- a/lib/bundler/version.rb
+++ b/lib/bundler/version.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: false
module Bundler
- VERSION = "2.1.4".freeze
+ VERSION = "2.2.0.dev".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 8b75859104..33f0142961 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" "January 2020" "" ""
+.TH "BUNDLE\-ADD" "1" "May 2020" "" ""
.
.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 dcd76df4ae..76fa21844a 100644
--- a/man/bundle-add.1.txt
+++ b/man/bundle-add.1.txt
@@ -1,4 +1,4 @@
-BUNDLE-ADD(1) BUNDLE-ADD(1)
+BUNDLE-ADD(1) BUNDLE-ADD(1)
@@ -6,12 +6,12 @@ NAME
bundle-add - Add gem to the Gemfile and run bundle install
SYNOPSIS
- bundle add GEM_NAME [--group=GROUP] [--version=VERSION]
- [--source=SOURCE] [--git=GIT] [--branch=BRANCH] [--skip-install]
+ bundle add GEM_NAME [--group=GROUP] [--version=VERSION]
+ [--source=SOURCE] [--git=GIT] [--branch=BRANCH] [--skip-install]
[--strict] [--optimistic]
DESCRIPTION
- Adds the named gem to the Gemfile and run bundle install. bundle
+ Adds the named gem to the Gemfile and run bundle install. bundle
install can be avoided by using the flag --skip-install.
Example:
@@ -20,8 +20,8 @@ DESCRIPTION
bundle add rails --version "< 3.0, > 1.1"
- bundle add rails --version "~> 5.0.0" --source "https://gems.exam-
- ple.com" --group "development"
+ bundle add rails --version "~> 5.0.0" --source
+ "https://gems.example.com" --group "development"
bundle add rails --skip-install
@@ -29,30 +29,30 @@ DESCRIPTION
OPTIONS
--version, -v
- Specify version requirements(s) for the added gem.
+ Specify version requirements(s) for the added gem.
--group, -g
- Specify the group(s) for the added gem. Multiple groups should
- be separated by commas.
+ Specify the group(s) for the added gem. Multiple groups should
+ be separated by commas.
--source, , -s
- Specify the source for the added gem.
+ Specify the source for the added gem.
--git Specify the git source for the added gem.
--branch
- Specify the git branch for the added gem.
+ Specify the git branch for the added gem.
--skip-install
- Adds the gem to the Gemfile but does not install it.
+ Adds the gem to the Gemfile but does not install it.
--optimistic
- Adds optimistic declaration of version
+ Adds optimistic declaration of version
--strict
- Adds strict declaration of version
+ Adds strict declaration of version
- January 2020 BUNDLE-ADD(1)
+ May 2020 BUNDLE-ADD(1)
diff --git a/man/bundle-binstubs.1 b/man/bundle-binstubs.1
index 4f9e5c0e31..66b3c35903 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" "January 2020" "" ""
+.TH "BUNDLE\-BINSTUBS" "1" "May 2020" "" ""
.
.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 cbd2b12da0..ce5291ad1c 100644
--- a/man/bundle-binstubs.1.txt
+++ b/man/bundle-binstubs.1.txt
@@ -1,4 +1,4 @@
-BUNDLE-BINSTUBS(1) BUNDLE-BINSTUBS(1)
+BUNDLE-BINSTUBS(1) BUNDLE-BINSTUBS(1)
@@ -13,8 +13,8 @@ DESCRIPTION
small Ruby file (a binstub) that loads Bundler, runs the command, and
puts it into bin/. Binstubs are a shortcut-or alternative- to always
using bundle exec. This gives you a file that can be run directly, and
- one that will always run the correct gem version used by the applica-
- tion.
+ one that will always run the correct gem version used by the
+ application.
For example, if you run bundle binstubs rspec-core, Bundler will create
the file bin/rspec. That file will contain enough code to load Bundler,
@@ -26,18 +26,18 @@ DESCRIPTION
OPTIONS
--force
- Overwrite existing binstubs if they exist.
+ Overwrite existing binstubs if they exist.
--path The location to install the specified binstubs to. This defaults
- to bin.
+ to bin.
--standalone
- Makes binstubs that can work without depending on Rubygems or
- Bundler at runtime.
+ Makes binstubs that can work without depending on Rubygems or
+ Bundler at runtime.
--shebang
- Specify a different shebang executable name than the default
- (default 'ruby')
+ Specify a different shebang executable name than the default
+ (default 'ruby')
BUNDLE INSTALL --BINSTUBS
To create binstubs for all the gems in the bundle you can use the
@@ -45,4 +45,4 @@ BUNDLE INSTALL --BINSTUBS
- January 2020 BUNDLE-BINSTUBS(1)
+ May 2020 BUNDLE-BINSTUBS(1)
diff --git a/man/bundle-cache.1 b/man/bundle-cache.1
index cb376777ff..20ce4a4d2e 100644
--- a/man/bundle-cache.1
+++ b/man/bundle-cache.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-CACHE" "1" "January 2020" "" ""
+.TH "BUNDLE\-CACHE" "1" "May 2020" "" ""
.
.SH "NAME"
\fBbundle\-cache\fR \- Package your needed \fB\.gem\fR files into your application
diff --git a/man/bundle-cache.1.txt b/man/bundle-cache.1.txt
index c0b8b5bf07..31940ad999 100644
--- a/man/bundle-cache.1.txt
+++ b/man/bundle-cache.1.txt
@@ -1,4 +1,4 @@
-BUNDLE-CACHE(1) BUNDLE-CACHE(1)
+BUNDLE-CACHE(1) BUNDLE-CACHE(1)
@@ -9,19 +9,19 @@ 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
+ 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
+ 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
+ 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.
@@ -36,9 +36,9 @@ REMOTE FETCHING
- source "https://rubygems.org"
+ source "https://rubygems.org"
- gem "nokogiri"
+ gem "nokogiri"
@@ -50,22 +50,22 @@ REMOTE FETCHING
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
+ 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.
+ 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 stag-
- ing box during your staging process, and check in the vendor/cache
+ 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
@@ -75,4 +75,4 @@ REMOTE FETCHING
- January 2020 BUNDLE-CACHE(1)
+ May 2020 BUNDLE-CACHE(1)
diff --git a/man/bundle-check.1 b/man/bundle-check.1
index aba5b66348..597f2c7cd0 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" "January 2020" "" ""
+.TH "BUNDLE\-CHECK" "1" "May 2020" "" ""
.
.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 cca5fae9e1..40e5c4f1f9 100644
--- a/man/bundle-check.1.txt
+++ b/man/bundle-check.1.txt
@@ -1,4 +1,4 @@
-BUNDLE-CHECK(1) BUNDLE-CHECK(1)
+BUNDLE-CHECK(1) BUNDLE-CHECK(1)
@@ -17,17 +17,17 @@ DESCRIPTION
OPTIONS
--dry-run
- Locks the [Gemfile(5)][Gemfile(5)] before running the command.
+ Locks the [Gemfile(5)][Gemfile(5)] before running the command.
--gemfile
- Use the specified gemfile instead of the [Gemfile(5)][Gem-
- file(5)].
+ Use the specified gemfile instead of the
+ [Gemfile(5)][Gemfile(5)].
- --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.
+ --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.
- January 2020 BUNDLE-CHECK(1)
+ May 2020 BUNDLE-CHECK(1)
diff --git a/man/bundle-clean.1 b/man/bundle-clean.1
index cc5c8e86d7..5244e6d880 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" "January 2020" "" ""
+.TH "BUNDLE\-CLEAN" "1" "May 2020" "" ""
.
.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 300d0c0b51..56732e5b26 100644
--- a/man/bundle-clean.1.txt
+++ b/man/bundle-clean.1.txt
@@ -1,4 +1,4 @@
-BUNDLE-CLEAN(1) BUNDLE-CLEAN(1)
+BUNDLE-CLEAN(1) BUNDLE-CLEAN(1)
@@ -10,17 +10,17 @@ SYNOPSIS
DESCRIPTION
This command will remove all unused gems in your bundler directory.
- This is useful when you have made many changes to your gem dependen-
- cies.
+ This is useful when you have made many changes to your gem
+ dependencies.
OPTIONS
--dry-run
- Print the changes, but do not clean the unused gems.
+ Print the changes, but do not clean the unused gems.
--force
- Force a clean even if --path is not set.
+ Force a clean even if --path is not set.
- January 2020 BUNDLE-CLEAN(1)
+ May 2020 BUNDLE-CLEAN(1)
diff --git a/man/bundle-config.1 b/man/bundle-config.1
index c3464fb2ec..001ec57a41 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" "January 2020" "" ""
+.TH "BUNDLE\-CONFIG" "1" "May 2020" "" ""
.
.SH "NAME"
\fBbundle\-config\fR \- Set bundler configuration options
@@ -16,7 +16,7 @@ This command allows you to interact with Bundler\'s configuration system\.
Bundler loads configuration settings in this order:
.
.IP "1." 4
-Local config (\fBapp/\.bundle/config\fR)
+Local config (\fB<project_root>/\.bundle/config\fR or \fB$BUNDLE_APP_CONFIG/config\fR)
.
.IP "2." 4
Environmental variables (\fBENV\fR)
@@ -42,7 +42,7 @@ Executing \fBbundle config set <name> <value>\fR will set that configuration to
Executing \fBbundle config set \-\-global <name> <value>\fR works the same as above\.
.
.P
-Executing \fBbundle config set \-\-local <name> <value>\fR will set that configuration to the local application\. The configuration will be stored in \fBapp/\.bundle/config\fR\.
+Executing \fBbundle config set \-\-local <name> <value>\fR will set that configuration in the directory for the local application\. The configuration will be stored in \fB<project_root>/\.bundle/config\fR\. If \fBBUNDLE_APP_CONFIG\fR is set, the configuration will be stored in \fB$BUNDLE_APP_CONFIG/config\fR\.
.
.P
Executing \fBbundle config unset <name>\fR will delete the configuration in both local and global sources\.
@@ -187,9 +187,6 @@ The following is a list of all configuration keys and their purpose\. You can le
\fBdisable_multisource\fR (\fBBUNDLE_DISABLE_MULTISOURCE\fR): When set, Gemfiles containing multiple sources will produce errors instead of warnings\. Use \fBbundle config unset disable_multisource\fR to unset\.
.
.IP "\(bu" 4
-\fBdisable_platform_warnings\fR (\fBBUNDLE_DISABLE_PLATFORM_WARNINGS\fR): Disable warnings during bundle install when a dependency is unused on the current platform\.
-.
-.IP "\(bu" 4
\fBdisable_shared_gems\fR (\fBBUNDLE_DISABLE_SHARED_GEMS\fR): Stop Bundler from accessing gems installed to RubyGems\' normal location\.
.
.IP "\(bu" 4
diff --git a/man/bundle-config.1.txt b/man/bundle-config.1.txt
index f5fc0ce12a..219c27bfa8 100644
--- a/man/bundle-config.1.txt
+++ b/man/bundle-config.1.txt
@@ -1,4 +1,4 @@
-BUNDLE-CONFIG(1) BUNDLE-CONFIG(1)
+BUNDLE-CONFIG(1) BUNDLE-CONFIG(1)
@@ -9,12 +9,13 @@ SYNOPSIS
bundle config [list|get|set|unset] [name [value]]
DESCRIPTION
- This command allows you to interact with Bundler's configuration sys-
- tem.
+ This command allows you to interact with Bundler's configuration
+ system.
Bundler loads configuration settings in this order:
- 1. Local config (app/.bundle/config)
+ 1. Local config (<project_root>/.bundle/config or
+ $BUNDLE_APP_CONFIG/config)
2. Environmental variables (ENV)
@@ -24,360 +25,362 @@ DESCRIPTION
- Executing bundle config list with will print a list of all bundler con-
- figuration for the current bundle, and where that configuration was
+ Executing bundle config list with will print a list of all bundler
+ configuration for the current bundle, and where that configuration was
set.
- Executing bundle config get <name> will print the value of that config-
- uration setting, and where it was set.
+ Executing bundle config get <name> will print the value of that
+ configuration setting, and where it was set.
- Executing bundle config set <name> <value> will set that configuration
- to the value specified for all bundles executed as the current user.
- The configuration will be stored in ~/.bundle/config. If name already
+ Executing bundle config set <name> <value> will set that configuration
+ to the value specified for all bundles executed as the current user.
+ The configuration will be stored in ~/.bundle/config. If name already
is set, name will be overridden and user will be warned.
- Executing bundle config set --global <name> <value> works the same as
+ Executing bundle config set --global <name> <value> works the same as
above.
- Executing bundle config set --local <name> <value> will set that con-
- figuration to the local application. The configuration will be stored
- in app/.bundle/config.
+ Executing bundle config set --local <name> <value> will set that
+ configuration in the directory for the local application. The
+ configuration will be stored in <project_root>/.bundle/config. If
+ BUNDLE_APP_CONFIG is set, the configuration will be stored in
+ $BUNDLE_APP_CONFIG/config.
- Executing bundle config unset <name> will delete the configuration in
+ Executing bundle config unset <name> will delete the configuration in
both local and global sources.
- Executing bundle config unset --global <name> will delete the configu-
- ration only from the user configuration.
+ Executing bundle config unset --global <name> will delete the
+ configuration only from the user configuration.
- Executing bundle config unset --local <name> <value> will delete the
+ Executing bundle config unset --local <name> <value> will delete the
configuration only from the local application.
Executing bundle with the BUNDLE_IGNORE_CONFIG environment variable set
will cause it to ignore all configuration.
- Executing bundle config set disable_multisource true upgrades the warn-
- ing about the Gemfile containing multiple primary sources to an error.
- Executing bundle config unset disable_multisource downgrades this error
- to a warning.
+ Executing bundle config set disable_multisource true upgrades the
+ warning about the Gemfile containing multiple primary sources to an
+ error. Executing bundle config unset disable_multisource downgrades
+ this error to a warning.
REMEMBERING OPTIONS
- Flags passed to bundle install or the Bundler runtime, such as --path
- foo or --without production, are remembered between commands and saved
+ Flags passed to bundle install or the Bundler runtime, such as --path
+ 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-
- 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
- a rails executable, this flag will create a bin/rails executable
- that ensures that all referred dependencies will be resolved
- using the bundled gems.
+ bin Creates a directory (defaults to ~/bin) and place any
+ executables from the gem there. These executables run in
+ Bundler's context. If used, you might add this directory to your
+ environment's 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 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
- option enabled in development or test environments.
+ In deployment mode, Bundler will 'roll-out' the bundle for
+ production 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
- calling gem list. Accordingly, gems installed to other locations
- will not get listed.
+ 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.
without
- A space-separated list of groups referencing gems to skip during
- installation.
+ A space-separated list of groups referencing gems to skip during
+ installation.
- with A space-separated list of groups referencing gems to include
- during installation.
+ 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.
- gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
+ gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
- 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.
- bundle config set build.mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config
+ bundle config set build.mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config
- 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
- those groups.
+ For instance, passing the --without flag to bundle install(1)
+ bundle-install.1.html prevents Bundler from installing certain groups
+ specified in the Gemfile(5). Bundler persists this value in
+ app/.bundle/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-
- DLE_WITHOUT.
+ 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
+ BUNDLE_WITHOUT.
- 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.
+ Any periods in the configuration keys must be replaced with two
+ underscores 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-
- dle-install.1.html.
+ You can learn more about their operation in bundle install(1)
+ bundle-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
- Bundler version.
+ o allow_bundler_dependency_conflicts
+ (BUNDLE_ALLOW_BUNDLER_DEPENDENCY_CONFLICTS): Allow resolving to
+ specifications that have 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:
- https://some.host.com/gems/path/ -> https://user_name:pass-
- word@some.host.com/gems/path
+ o allow_deployment_source_credential_changes
+ (BUNDLE_ALLOW_DEPLOYMENT_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:password@some.host.com/gems/path
o allow_offline_install (BUNDLE_ALLOW_OFFLINE_INSTALL): Allow Bundler
- to use cached data when installing without network access.
+ 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
- not been set and Bundler is not installing into the system gems.
+ o auto_clean_without_path (BUNDLE_AUTO_CLEAN_WITHOUT_PATH):
+ Automatically 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
- install when gems are missing.
+ 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
- the specified directory. Defaults to false.
+ 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
- git gems.
+ 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
- all platforms.
+ 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
- will look in when installing gems. Defaults to vendor/cache.
+ 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 clean (BUNDLE_CLEAN): Whether Bundler should run bundle clean
+ automatically after bundle install.
- o console (BUNDLE_CONSOLE): The console that bundle console starts.
- Defaults to irb.
+ 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
- defaults to installing gems in .bundle.
+ o default_install_uses_path (BUNDLE_DEFAULT_INSTALL_USES_PATH):
+ 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,
- running Bundler commands will be blocked.
+ 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-
- vided by RubyGems.
+ o disable_checksum_validation (BUNDLE_DISABLE_CHECKSUM_VALIDATION):
+ Allow installing gems even if they do not match the checksum
+ provided by RubyGems.
o disable_exec_load (BUNDLE_DISABLE_EXEC_LOAD): Stop Bundler from
- using load to launch an executable in-process in bundle exec.
+ 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-
- fied in the Gemfile.
+ o disable_local_branch_check (BUNDLE_DISABLE_LOCAL_BRANCH_CHECK):
+ Allow Bundler to use a local git override without a branch
+ specified in the Gemfile.
- 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
- the current platform.
+ o disable_multisource (BUNDLE_DISABLE_MULTISOURCE): When set,
+ Gemfiles containing multiple sources will produce errors instead of
+ warnings. Use bundle config unset disable_multisource to unset.
o disable_shared_gems (BUNDLE_DISABLE_SHARED_GEMS): Stop Bundler from
- accessing gems installed to RubyGems' normal location.
+ 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
- rubygems.org.
+ 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
- result, gems with native extensions will be compiled from source.
+ o force_ruby_platform (BUNDLE_FORCE_RUBY_PLATFORM): Ignore the
+ current 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-
- ment is used.
+ 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
+ --deployment 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-
- stash server.
+ o gem.push_key (BUNDLE_GEM__PUSH_KEY): Sets the --key parameter for
+ gem push when using the rake release command with a private
+ gemstash 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
- of the project, which is used to resolve relative paths in the Gem-
- file, among other things. By default, bundler will search up from
- the current working directory until it finds a Gemfile.
+ 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
+ Gemfile, 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
- cache all gems globally, rather than locally to the installing Ruby
- installation.
+ o global_gem_cache (BUNDLE_GLOBAL_GEM_CACHE): Whether Bundler should
+ cache all gems globally, rather than locally to the installing Ruby
+ installation.
o ignore_messages (BUNDLE_IGNORE_MESSAGES): When set, no post install
- messages will be printed. To silence a single gem, use dot notation
- like ignore_messages.httparty true.
+ 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
- Gemfile when running bundle init.
+ 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-
- allel. Defaults to 1.
+ o jobs (BUNDLE_JOBS): The number of gems Bundler can install in
+ parallel. Defaults to 1.
- o no_install (BUNDLE_NO_INSTALL): Whether bundle package should skip
- installing gems.
+ o no_install (BUNDLE_NO_INSTALL): Whether bundle package should skip
+ installing gems.
- o no_prune (BUNDLE_NO_PRUNE): Whether Bundler should leave outdated
- gems unpruned when caching.
+ 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 only_update_to_newer_versions
+ (BUNDLE_ONLY_UPDATE_TO_NEWER_VERSIONS): 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
- 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
- to vendor/bundle.
+ 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
+ to vendor/bundle.
- o path.system (BUNDLE_PATH__SYSTEM): Whether Bundler will install
- gems into the default system path (Gem.dir).
+ 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
- relative to the CWD instead of the Gemfile.
+ 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 plugins (BUNDLE_PLUGINS): Enable Bundler's experimental plugin
+ system.
- 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 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
- only version number from bundler --version.
+ 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
- network requests. Defaults to 5.
+ 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
- requests. Defaults to 3.
+ 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
- though RubyGems declares it as private.
+ o setup_makes_kernel_gem_public
+ (BUNDLE_SETUP_MAKES_KERNEL_GEM_PUBLIC): 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
- generate the binstub.
+ 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
- changed in the next major version.
+ 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
- warning Bundler prints when installing gems as root.
+ 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.
+ Bundler should skip adding default git source shortcuts to the
+ Gemfile DSL.
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
- 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
- CAs in PEM format.
+ resolve for the specific running platform and store it in the
+ lockfile, 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 to java.
+
+ o ssl_ca_cert (BUNDLE_SSL_CA_CERT): Path to a designated CA
+ certificate 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
- containing a X.509 client certificate and key in PEM format.
+ containing a X.509 client certificate and key in PEM format.
o ssl_verify_mode (BUNDLE_SSL_VERIFY_MODE): The SSL verification mode
- Bundler uses when making HTTPS requests. Defaults to verify peer.
+ 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
- the version of a gem has not changed.
+ o suppress_install_using_messages
+ (BUNDLE_SUPPRESS_INSTALL_USING_MESSAGES): 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
- installs binstubs. Defaults to Gem.bindir.
+ 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.
+ 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
- given name. Defaults to true.
+ o unlock_source_unlocks_spec (BUNDLE_UNLOCK_SOURCE_UNLOCKS_SPEC):
+ 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,
- and disallow passing no options to bundle update.
+ 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
- Bundler includes in API requests.
+ 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.
+ should install.
- o without (BUNDLE_WITHOUT): A :-separated list of groups whose gems
- bundler should not install.
+ 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-
- dle package(1) bundle-package.1.html command.
+ In general, you should set these settings per-application by using the
+ applicable flag to the bundle install(1) bundle-install.1.html or
+ bundle 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-
- ronment variables will take preference over global settings.
+ You can set them globally either via environment variables or bundle
+ config, whichever is preferable for your setup. If you use both,
+ environment 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:
- bundle config set local.GEM_NAME /path/to/local/git/repository
+ bundle config set local.GEM_NAME /path/to/local/git/repository
@@ -386,59 +389,59 @@ LOCAL GIT REPOS
- bundle config set local.rack ~/Work/git/rack
+ bundle config set local.rack ~/Work/git/rack
- 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
- 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
- escape your usernames and passwords as well.
+ Now instead of checking out the remote git repository, the local
+ override 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 ensure the local override was pushed, otherwise you
+ may point to a commit 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
+ Gemfile.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.
- bundle config set mirror.SOURCE_URL MIRROR_URL
+ bundle config set mirror.SOURCE_URL MIRROR_URL
- For example, to use a mirror of rubygems.org hosted at rubygems-mir-
- ror.org:
+ For example, to use a mirror of rubygems.org hosted at
+ rubygems-mirror.org:
- bundle config set mirror.http://rubygems.org http://rubygems-mirror.org
+ bundle config set mirror.http://rubygems.org http://rubygems-mirror.org
- 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.
- bundle config set mirror.SOURCE_URL.fallback_timeout TIMEOUT
+ bundle config set mirror.SOURCE_URL.fallback_timeout TIMEOUT
@@ -446,29 +449,29 @@ MIRRORS OF GEM SOURCES
- bundle config set mirror.https://rubygems.org.fallback_timeout 3
+ bundle config set mirror.https://rubygems.org.fallback_timeout 3
- The default fallback timeout is 0.1 seconds, but the setting can cur-
- rently only accept whole seconds (for example, 1, 15, or 30).
+ The default fallback timeout is 0.1 seconds, but the setting can
+ currently 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.
- bundle config set SOURCE_HOSTNAME USERNAME:PASSWORD
+ bundle config set SOURCE_HOSTNAME USERNAME:PASSWORD
- 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:
- bundle config set gems.longerous.com claudette:s00pers3krit
+ bundle config set gems.longerous.com claudette:s00pers3krit
@@ -476,7 +479,7 @@ CREDENTIALS FOR GEM SOURCES
- export BUNDLE_GEMS__LONGEROUS__COM="claudette:s00pers3krit"
+ export BUNDLE_GEMS__LONGEROUS__COM="claudette:s00pers3krit"
@@ -485,7 +488,7 @@ CREDENTIALS FOR GEM SOURCES
- bundle config set https://github.com/bundler/bundler.git username:password
+ bundle config set https://github.com/bundler/bundler.git username:password
@@ -493,36 +496,36 @@ CREDENTIALS FOR GEM SOURCES
- export BUNDLE_GITHUB__COM=username:password
+ export BUNDLE_GITHUB__COM=username:password
- 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:
- export BUNDLE_GITHUB__COM=abcd0123generatedtoken:x-oauth-basic
+ export BUNDLE_GITHUB__COM=abcd0123generatedtoken:x-oauth-basic
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
- from by default. The following outlines the available environment vari-
- ables and their default values
+ 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
+ variables and their default values
- BUNDLE_USER_HOME : $HOME/.bundle
- BUNDLE_USER_CACHE : $BUNDLE_USER_HOME/cache
- BUNDLE_USER_CONFIG : $BUNDLE_USER_HOME/config
- BUNDLE_USER_PLUGIN : $BUNDLE_USER_HOME/plugin
+ BUNDLE_USER_HOME : $HOME/.bundle
+ BUNDLE_USER_CACHE : $BUNDLE_USER_HOME/cache
+ BUNDLE_USER_CONFIG : $BUNDLE_USER_HOME/config
+ BUNDLE_USER_PLUGIN : $BUNDLE_USER_HOME/plugin
- January 2020 BUNDLE-CONFIG(1)
+ May 2020 BUNDLE-CONFIG(1)
diff --git a/man/bundle-config.ronn b/man/bundle-config.ronn
index 75b389e7e3..7b7d417bca 100644
--- a/man/bundle-config.ronn
+++ b/man/bundle-config.ronn
@@ -11,7 +11,7 @@ This command allows you to interact with Bundler's configuration system.
Bundler loads configuration settings in this order:
-1. Local config (`app/.bundle/config`)
+1. Local config (`<project_root>/.bundle/config` or `$BUNDLE_APP_CONFIG/config`)
2. Environmental variables (`ENV`)
3. Global config (`~/.bundle/config`)
4. Bundler default config
@@ -30,8 +30,10 @@ overridden and user will be warned.
Executing `bundle config set --global <name> <value>` works the same as above.
-Executing `bundle config set --local <name> <value>` will set that configuration to
-the local application. The configuration will be stored in `app/.bundle/config`.
+Executing `bundle config set --local <name> <value>` will set that configuration
+in the directory for the local application. The configuration will be stored in
+`<project_root>/.bundle/config`. If `BUNDLE_APP_CONFIG` is set, the configuration
+will be stored in `$BUNDLE_APP_CONFIG/config`.
Executing `bundle config unset <name>` will delete the configuration in both
local and global sources.
@@ -179,8 +181,6 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
When set, Gemfiles containing multiple sources will produce errors
instead of warnings.
Use `bundle config unset disable_multisource` to unset.
-* `disable_platform_warnings` (`BUNDLE_DISABLE_PLATFORM_WARNINGS`):
- Disable warnings during bundle install when a dependency is unused on the current platform.
* `disable_shared_gems` (`BUNDLE_DISABLE_SHARED_GEMS`):
Stop Bundler from accessing gems installed to RubyGems' normal location.
* `disable_version_check` (`BUNDLE_DISABLE_VERSION_CHECK`):
@@ -396,4 +396,3 @@ outlines the available environment variables and their default values
BUNDLE_USER_CACHE : $BUNDLE_USER_HOME/cache
BUNDLE_USER_CONFIG : $BUNDLE_USER_HOME/config
BUNDLE_USER_PLUGIN : $BUNDLE_USER_HOME/plugin
-
diff --git a/man/bundle-doctor.1 b/man/bundle-doctor.1
index 344c40066b..0c257aa158 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" "January 2020" "" ""
+.TH "BUNDLE\-DOCTOR" "1" "May 2020" "" ""
.
.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 595ba99633..58a1721602 100644
--- a/man/bundle-doctor.1.txt
+++ b/man/bundle-doctor.1.txt
@@ -1,4 +1,4 @@
-BUNDLE-DOCTOR(1) BUNDLE-DOCTOR(1)
+BUNDLE-DOCTOR(1) BUNDLE-DOCTOR(1)
@@ -10,7 +10,7 @@ SYNOPSIS
DESCRIPTION
Checks your Gemfile and gem environment for common problems. If issues
- are detected, Bundler prints them and exits status 1. Otherwise,
+ are detected, Bundler prints them and exits status 1. Otherwise,
Bundler prints a success message and exits status 0.
Examples of common problems caught by bundle-doctor include:
@@ -29,16 +29,16 @@ DESCRIPTION
OPTIONS
--quiet
- Only output warnings and errors.
+ Only output warnings and errors.
--gemfile=<gemfile>
- The location of the Gemfile(5) which Bundler should use. This
- defaults to a Gemfile(5) in the current working directory. In
- general, Bundler will assume that the location of the Gemfile(5)
- is also the project's root and will try to find Gemfile.lock and
- vendor/cache relative to this location.
+ The location of the Gemfile(5) which Bundler should use. This
+ defaults to a Gemfile(5) in the current working directory. In
+ general, Bundler will assume that the location of the Gemfile(5)
+ is also the project's root and will try to find Gemfile.lock and
+ vendor/cache relative to this location.
- January 2020 BUNDLE-DOCTOR(1)
+ May 2020 BUNDLE-DOCTOR(1)
diff --git a/man/bundle-exec.1 b/man/bundle-exec.1
index 555819a5b4..b7f6dfba82 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" "January 2020" "" ""
+.TH "BUNDLE\-EXEC" "1" "May 2020" "" ""
.
.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 ebdc2fda71..ff2ff62dc9 100644
--- a/man/bundle-exec.1.txt
+++ b/man/bundle-exec.1.txt
@@ -1,4 +1,4 @@
-BUNDLE-EXEC(1) BUNDLE-EXEC(1)
+BUNDLE-EXEC(1) BUNDLE-EXEC(1)
@@ -9,47 +9,48 @@ SYNOPSIS
bundle exec [--keep-file-descriptors] command
DESCRIPTION
- This command executes the command, making all gems specified in the
+ This command executes the command, making all gems specified in the
[Gemfile(5)][Gemfile(5)] available to require in Ruby programs.
- Essentially, if you would normally have run something like rspec
- spec/my_spec.rb, and you want to use the gems specified in the [Gem-
- file(5)][Gemfile(5)] and installed via bundle install(1) bun-
- dle-install.1.html, you should run bundle exec rspec spec/my_spec.rb.
+ Essentially, if you would normally have run something like rspec
+ spec/my_spec.rb, and you want to use the gems specified in the
+ [Gemfile(5)][Gemfile(5)] and installed via bundle install(1)
+ bundle-install.1.html, you should run bundle exec rspec
+ spec/my_spec.rb.
- Note that bundle exec does not require that an executable is available
+ Note that bundle exec does not require that an executable is available
on your shell's $PATH.
OPTIONS
--keep-file-descriptors
- Exec in Ruby 2.0 began discarding non-standard file descriptors.
- When this flag is passed, exec will revert to the 1.9 behaviour
- of passing all file descriptors to the new process.
+ Exec in Ruby 2.0 began discarding non-standard file descriptors.
+ When this flag is passed, exec will revert to the 1.9 behaviour
+ of passing all file descriptors to the new process.
BUNDLE INSTALL --BINSTUBS
- If you use the --binstubs flag in bundle install(1) bun-
- dle-install.1.html, Bundler will automatically create a directory
- (which defaults to app_root/bin) containing all of the executables
+ If you use the --binstubs flag in bundle install(1)
+ bundle-install.1.html, Bundler will automatically create a directory
+ (which defaults to app_root/bin) containing all of the executables
available from gems in the bundle.
- After using --binstubs, bin/rspec spec/my_spec.rb is identical to bun-
- dle exec rspec spec/my_spec.rb.
+ After using --binstubs, bin/rspec spec/my_spec.rb is identical to
+ bundle exec rspec spec/my_spec.rb.
ENVIRONMENT MODIFICATIONS
- bundle exec makes a number of changes to the shell environment, then
+ bundle exec makes a number of changes to the shell environment, then
executes the command you specify in full.
- o make sure that it's still possible to shell out to bundle from
- inside a command invoked by bundle exec (using $BUNDLE_BIN_PATH)
+ o make sure that it's still possible to shell out to bundle from
+ inside a command invoked by bundle exec (using $BUNDLE_BIN_PATH)
- o put the directory containing executables (like rails, rspec,
- rackup) for your bundle on $PATH
+ o put the directory containing executables (like rails, rspec,
+ rackup) for your bundle on $PATH
- o make sure that if bundler is invoked in the subshell, it uses the
- same Gemfile (by setting BUNDLE_GEMFILE)
+ o make sure that if bundler is invoked in the subshell, it uses the
+ same Gemfile (by setting BUNDLE_GEMFILE)
- o add -rbundler/setup to $RUBYOPT, which makes sure that Ruby pro-
- grams invoked in the subshell can see the gems in the bundle
+ o add -rbundler/setup to $RUBYOPT, which makes sure that Ruby
+ programs invoked in the subshell can see the gems in the bundle
@@ -57,122 +58,124 @@ ENVIRONMENT MODIFICATIONS
o disallow loading additional gems not in the bundle
- o modify the gem method to be a no-op if a gem matching the require-
- ments is in the bundle, and to raise a Gem::LoadError if it's not
+ o modify the gem method to be a no-op if a gem matching the
+ requirements is in the bundle, and to raise a Gem::LoadError if
+ it's not
- o Define Gem.refresh to be a no-op, since the source index is always
- frozen when using bundler, and to prevent gems from the system
- leaking into the environment
+ o Define Gem.refresh to be a no-op, since the source index is always
+ frozen when using bundler, and to prevent gems from the system
+ leaking into the environment
- o Override Gem.bin_path to use the gems in the bundle, making system
- executables work
+ o Override Gem.bin_path to use the gems in the bundle, making system
+ executables work
o Add all gems in the bundle into Gem.loaded_specs
- Finally, bundle exec also implicitly modifies Gemfile.lock if the lock-
- file and the Gemfile do not match. Bundler needs the Gemfile to deter-
- mine things such as a gem's groups, autorequire, and platforms, etc.,
- and that information isn't stored in the lockfile. The Gemfile and
- lockfile must be synced in order to bundle exec successfully, so bundle
- exec updates the lockfile beforehand.
+ Finally, bundle exec also implicitly modifies Gemfile.lock if the
+ lockfile and the Gemfile do not match. Bundler needs the Gemfile to
+ determine things such as a gem's groups, autorequire, and platforms,
+ etc., and that information isn't stored in the lockfile. The Gemfile
+ and lockfile must be synced in order to bundle exec successfully, so
+ bundle exec updates the lockfile beforehand.
Loading
- By default, when attempting to bundle exec to a file with a ruby she-
- bang, Bundler will Kernel.load that file instead of using Kernel.exec.
- For the vast majority of cases, this is a performance improvement. In a
- rare few cases, this could cause some subtle side-effects (such as
- dependence on the exact contents of $0 or __FILE__) and the optimiza-
- tion can be disabled by enabling the disable_exec_load setting.
+ By default, when attempting to bundle exec to a file with a ruby
+ shebang, Bundler will Kernel.load that file instead of using
+ Kernel.exec. For the vast majority of cases, this is a performance
+ improvement. In a rare few cases, this could cause some subtle
+ side-effects (such as dependence on the exact contents of $0 or
+ __FILE__) and the optimization can be disabled by enabling the
+ disable_exec_load setting.
Shelling out
- Any Ruby code that opens a subshell (like system, backticks, or %x{})
- will automatically use the current Bundler environment. If you need to
- shell out to a Ruby command that is not part of your current bundle,
- use the with_clean_env method with a block. Any subshells created
- inside the block will be given the environment present before Bundler
- was activated. For example, Homebrew commands run Ruby, but don't work
+ Any Ruby code that opens a subshell (like system, backticks, or %x{})
+ will automatically use the current Bundler environment. If you need to
+ shell out to a Ruby command that is not part of your current bundle,
+ use the with_clean_env method with a block. Any subshells created
+ inside the block will be given the environment present before Bundler
+ was activated. For example, Homebrew commands run Ruby, but don't work
inside a bundle:
- Bundler.with_clean_env do
- `brew install wget`
- end
+ Bundler.with_clean_env do
+ `brew install wget`
+ end
- Using with_clean_env is also necessary if you are shelling out to a
- different bundle. Any Bundler commands run in a subshell will inherit
- the current Gemfile, so commands that need to run in the context of a
+ Using with_clean_env is also necessary if you are shelling out to a
+ different bundle. Any Bundler commands run in a subshell will inherit
+ the current Gemfile, so commands that need to run in the context of a
different bundle also need to use with_clean_env.
- Bundler.with_clean_env do
- Dir.chdir "/other/bundler/project" do
- `bundle exec ./script`
- end
- end
+ Bundler.with_clean_env do
+ Dir.chdir "/other/bundler/project" do
+ `bundle exec ./script`
+ end
+ end
- Bundler provides convenience helpers that wrap system and exec, and
+ Bundler provides convenience helpers that wrap system and exec, and
they can be used like this:
- Bundler.clean_system('brew install wget')
- Bundler.clean_exec('brew install wget')
+ Bundler.clean_system('brew install wget')
+ Bundler.clean_exec('brew install wget')
RUBYGEMS PLUGINS
- At present, the Rubygems plugin system requires all files named
- rubygems_plugin.rb on the load path of any installed gem when any Ruby
+ At present, the Rubygems plugin system requires all files named
+ rubygems_plugin.rb on the load path of any installed gem when any Ruby
code requires rubygems.rb. This includes executables installed into the
system, like rails, rackup, and rspec.
- Since Rubygems plugins can contain arbitrary Ruby code, they commonly
+ Since Rubygems plugins can contain arbitrary Ruby code, they commonly
end up activating themselves or their dependencies.
- For instance, the gemcutter 0.5 gem depended on json_pure. If you had
- that version of gemcutter installed (even if you also had a newer ver-
- sion without this problem), Rubygems would activate gemcutter 0.5 and
- json_pure <latest>.
+ For instance, the gemcutter 0.5 gem depended on json_pure. If you had
+ that version of gemcutter installed (even if you also had a newer
+ version without this problem), Rubygems would activate gemcutter 0.5
+ and json_pure <latest>.
If your Gemfile(5) also contained json_pure (or a gem with a dependency
- on json_pure), the latest version on your system might conflict with
- the version in your Gemfile(5), or the snapshot version in your Gem-
- file.lock.
+ on json_pure), the latest version on your system might conflict with
+ the version in your Gemfile(5), or the snapshot version in your
+ Gemfile.lock.
If this happens, bundler will say:
- You have already activated json_pure 1.4.6 but your Gemfile
- requires json_pure 1.4.3. Consider using bundle exec.
+ You have already activated json_pure 1.4.6 but your Gemfile
+ requires json_pure 1.4.3. Consider using bundle exec.
- In this situation, you almost certainly want to remove the underlying
- gem with the problematic gem plugin. In general, the authors of these
- plugins (in this case, the gemcutter gem) have released newer versions
+ In this situation, you almost certainly want to remove the underlying
+ gem with the problematic gem plugin. In general, the authors of these
+ plugins (in this case, the gemcutter gem) have released newer versions
that are more careful in their plugins.
You can find a list of all the gems containing gem plugins by running
- ruby -rrubygems -e "puts Gem.find_files('rubygems_plugin.rb')"
+ ruby -rrubygems -e "puts Gem.find_files('rubygems_plugin.rb')"
At the very least, you should remove all but the newest version of each
- gem plugin, and also remove all gem plugins that you aren't using (gem
+ gem plugin, and also remove all gem plugins that you aren't using (gem
uninstall gem_name).
- January 2020 BUNDLE-EXEC(1)
+ May 2020 BUNDLE-EXEC(1)
diff --git a/man/bundle-gem.1 b/man/bundle-gem.1
index baed185e70..4ece43bef2 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" "January 2020" "" ""
+.TH "BUNDLE\-GEM" "1" "May 2020" "" ""
.
.SH "NAME"
\fBbundle\-gem\fR \- Generate a project skeleton for creating a rubygem
@@ -64,8 +64,8 @@ Add an MIT license to a \fBLICENSE\.txt\fR file in the root of the generated pro
Do not create a \fBLICENSE\.txt\fR (overrides \fB\-\-mit\fR specified in the global config)\.
.
.TP
-\fB\-t\fR, \fB\-\-test=minitest\fR, \fB\-\-test=rspec\fR
-Specify the test framework that Bundler should use when generating the project\. Acceptable values are \fBminitest\fR and \fBrspec\fR\. The \fBGEM_NAME\.gemspec\fR will be configured and a skeleton test/spec directory will be created based on this option\. If this option is unspecified, an interactive prompt will be displayed and the answer will be saved in Bundler\'s global config for future \fBbundle gem\fR use\. If no option is specified, the default testing framework is RSpec\.
+\fB\-t\fR, \fB\-\-test=minitest\fR, \fB\-\-test=rspec\fR, \fB\-\-test=test\-unit\fR
+Specify the test framework that Bundler should use when generating the project\. Acceptable values are \fBminitest\fR, \fBrspec\fR and \fBtest\-unit\fR\. The \fBGEM_NAME\.gemspec\fR will be configured and a skeleton test/spec directory will be created based on this option\. If this option is unspecified, an interactive prompt will be displayed and the answer will be saved in Bundler\'s global config for future \fBbundle gem\fR use\. If no option is specified, the default testing framework is RSpec\.
.
.TP
\fB\-e\fR, \fB\-\-edit[=EDITOR]\fR
diff --git a/man/bundle-gem.1.txt b/man/bundle-gem.1.txt
index 554bb1a41b..d645bfe7e2 100644
--- a/man/bundle-gem.1.txt
+++ b/man/bundle-gem.1.txt
@@ -1,4 +1,4 @@
-BUNDLE-GEM(1) BUNDLE-GEM(1)
+BUNDLE-GEM(1) BUNDLE-GEM(1)
@@ -16,8 +16,8 @@ DESCRIPTION
Run rake -T in the resulting project for a list of Rake tasks that can
be used to test and publish the gem to rubygems.org.
- The generated project skeleton can be customized with OPTIONS, as
- explained below. Note that these options can also be specified via
+ The generated project skeleton can be customized with OPTIONS, as
+ explained below. Note that these options can also be specified via
Bundler's global configuration file using the following names:
o gem.coc
@@ -30,55 +30,55 @@ DESCRIPTION
OPTIONS
--exe or -b or --bin
- Specify that Bundler should create a binary executable (as
- exe/GEM_NAME) in the generated rubygem project. This binary will
- also be added to the GEM_NAME.gemspec manifest. This behavior is
- disabled by default.
+ Specify that Bundler should create a binary executable (as
+ exe/GEM_NAME) in the generated rubygem project. This binary will
+ also be added to the GEM_NAME.gemspec manifest. This behavior is
+ disabled by default.
--no-exe
- Do not create a binary (overrides --exe specified in the global
- config).
+ Do not create a binary (overrides --exe specified in the global
+ config).
- --coc Add a CODE_OF_CONDUCT.md file to the root of the generated
- project. If this option is unspecified, an interactive prompt
- will be displayed and the answer will be saved in Bundler's
- global config for future bundle gem use.
+ --coc Add a CODE_OF_CONDUCT.md file to the root of the generated
+ project. If this option is unspecified, an interactive prompt
+ will be displayed and the answer will be saved in Bundler's
+ global config for future bundle gem use.
--no-coc
- Do not create a CODE_OF_CONDUCT.md (overrides --coc specified in
- the global config).
+ Do not create a CODE_OF_CONDUCT.md (overrides --coc specified in
+ the global config).
--ext Add boilerplate for C extension code to the generated project.
- This behavior is disabled by default.
+ This behavior is disabled by default.
--no-ext
- Do not add C extension code (overrides --ext specified in the
- global config).
+ Do not add C extension code (overrides --ext specified in the
+ global config).
- --mit Add an MIT license to a LICENSE.txt file in the root of the gen-
- erated project. Your name from the global git config is used for
- the copyright statement. If this option is unspecified, an
- interactive prompt will be displayed and the answer will be
- saved in Bundler's global config for future bundle gem use.
+ --mit Add an MIT license to a LICENSE.txt file in the root of the
+ generated project. Your name from the global git config is used
+ for the copyright statement. If this option is unspecified, an
+ interactive prompt will be displayed and the answer will be
+ saved in Bundler's global config for future bundle gem use.
--no-mit
- Do not create a LICENSE.txt (overrides --mit specified in the
- global config).
-
- -t, --test=minitest, --test=rspec
- Specify the test framework that Bundler should use when generat-
- ing the project. Acceptable values are minitest and rspec. The
- GEM_NAME.gemspec will be configured and a skeleton test/spec
- directory will be created based on this option. If this option
- is unspecified, an interactive prompt will be displayed and the
- answer will be saved in Bundler's global config for future bun-
- dle gem use. If no option is specified, the default testing
- framework is RSpec.
+ Do not create a LICENSE.txt (overrides --mit specified in the
+ global config).
+
+ -t, --test=minitest, --test=rspec, --test=test-unit
+ Specify the test framework that Bundler should use when
+ generating the project. Acceptable values are minitest, rspec
+ and test-unit. The GEM_NAME.gemspec will be configured and a
+ skeleton test/spec directory will be created based on this
+ option. If this option is unspecified, an interactive prompt
+ will be displayed and the answer will be saved in Bundler's
+ global config for future bundle gem use. If no option is
+ specified, the default testing framework is RSpec.
-e, --edit[=EDITOR]
- Open the resulting GEM_NAME.gemspec in EDITOR, or the default
- editor if not specified. The default is $BUNDLER_EDITOR, $VIS-
- UAL, or $EDITOR.
+ Open the resulting GEM_NAME.gemspec in EDITOR, or the default
+ editor if not specified. The default is $BUNDLER_EDITOR,
+ $VISUAL, or $EDITOR.
SEE ALSO
o bundle config(1) bundle-config.1.html
@@ -88,4 +88,4 @@ SEE ALSO
- January 2020 BUNDLE-GEM(1)
+ May 2020 BUNDLE-GEM(1)
diff --git a/man/bundle-gem.ronn b/man/bundle-gem.ronn
index cf3d037df2..1dba9ed607 100644
--- a/man/bundle-gem.ronn
+++ b/man/bundle-gem.ronn
@@ -60,13 +60,13 @@ configuration file using the following names:
Do not create a `LICENSE.txt` (overrides `--mit` specified in the global
config).
-* `-t`, `--test=minitest`, `--test=rspec`:
+* `-t`, `--test=minitest`, `--test=rspec`, `--test=test-unit`:
Specify the test framework that Bundler should use when generating the
- project. Acceptable values are `minitest` and `rspec`. The `GEM_NAME.gemspec`
- will be configured and a skeleton test/spec directory will be created based
- on this option. If this option is unspecified, an interactive prompt will be
- displayed and the answer will be saved in Bundler's global config for future
- `bundle gem` use.
+ project. Acceptable values are `minitest`, `rspec` and `test-unit`. The
+ `GEM_NAME.gemspec` will be configured and a skeleton test/spec directory will
+ be created based on this option. If this option is unspecified, an interactive
+ prompt will be displayed and the answer will be saved in Bundler's global
+ config for future `bundle gem` use.
If no option is specified, the default testing framework is RSpec.
* `-e`, `--edit[=EDITOR]`:
diff --git a/man/bundle-info.1 b/man/bundle-info.1
index d7c73e9bb7..47ca40036c 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" "January 2020" "" ""
+.TH "BUNDLE\-INFO" "1" "May 2020" "" ""
.
.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 67563aa191..5d841b6aae 100644
--- a/man/bundle-info.1.txt
+++ b/man/bundle-info.1.txt
@@ -1,4 +1,4 @@
-BUNDLE-INFO(1) BUNDLE-INFO(1)
+BUNDLE-INFO(1) BUNDLE-INFO(1)
@@ -18,4 +18,4 @@ OPTIONS
- January 2020 BUNDLE-INFO(1)
+ May 2020 BUNDLE-INFO(1)
diff --git a/man/bundle-init.1 b/man/bundle-init.1
index 803d4b9be8..4c172e2e7a 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" "January 2020" "" ""
+.TH "BUNDLE\-INIT" "1" "May 2020" "" ""
.
.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 2565edbece..677654b7a1 100644
--- a/man/bundle-init.1.txt
+++ b/man/bundle-init.1.txt
@@ -1,4 +1,4 @@
-BUNDLE-INIT(1) BUNDLE-INIT(1)
+BUNDLE-INIT(1) BUNDLE-INIT(1)
@@ -9,16 +9,16 @@ SYNOPSIS
bundle init [--gemspec=FILE]
DESCRIPTION
- Init generates a default [Gemfile(5)][Gemfile(5)] in the current work-
- ing directory. When adding a [Gemfile(5)][Gemfile(5)] to a gem with a
- gemspec, the --gemspec option will automatically add each dependency
- listed in the gemspec file to the newly created [Gemfile(5)][Gem-
- file(5)].
+ Init generates a default [Gemfile(5)][Gemfile(5)] in the current
+ working directory. When adding a [Gemfile(5)][Gemfile(5)] to a gem with
+ a gemspec, the --gemspec option will automatically add each dependency
+ listed in the gemspec file to the newly created
+ [Gemfile(5)][Gemfile(5)].
OPTIONS
--gemspec
- Use the specified .gemspec to create the [Gemfile(5)][Gem-
- file(5)]
+ Use the specified .gemspec to create the
+ [Gemfile(5)][Gemfile(5)]
FILES
Included in the default [Gemfile(5)][Gemfile(5)] generated is the line
@@ -31,4 +31,4 @@ SEE ALSO
- January 2020 BUNDLE-INIT(1)
+ May 2020 BUNDLE-INIT(1)
diff --git a/man/bundle-inject.1 b/man/bundle-inject.1
index 3370a91573..b3f98f2b96 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" "January 2020" "" ""
+.TH "BUNDLE\-INJECT" "1" "May 2020" "" ""
.
.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 4707b99e5f..4782408186 100644
--- a/man/bundle-inject.1.txt
+++ b/man/bundle-inject.1.txt
@@ -1,4 +1,4 @@
-BUNDLE-INJECT(1) BUNDLE-INJECT(1)
+BUNDLE-INJECT(1) BUNDLE-INJECT(1)
@@ -19,8 +19,8 @@ DESCRIPTION
- bundle install
- bundle inject 'rack' '> 0'
+ bundle install
+ bundle inject 'rack' '> 0'
@@ -29,4 +29,4 @@ DESCRIPTION
- January 2020 BUNDLE-INJECT(1)
+ May 2020 BUNDLE-INJECT(1)
diff --git a/man/bundle-install.1 b/man/bundle-install.1
index 4a289f5c2e..965df1e72f 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" "January 2020" "" ""
+.TH "BUNDLE\-INSTALL" "1" "May 2020" "" ""
.
.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 b1a9ad1eb3..1c089d7a71 100644
--- a/man/bundle-install.1.txt
+++ b/man/bundle-install.1.txt
@@ -1,4 +1,4 @@
-BUNDLE-INSTALL(1) BUNDLE-INSTALL(1)
+BUNDLE-INSTALL(1) BUNDLE-INSTALL(1)
@@ -6,22 +6,22 @@ NAME
bundle-install - Install the dependencies specified in your Gemfile
SYNOPSIS
- bundle install [--binstubs[=DIRECTORY]] [--clean] [--deployment]
+ bundle install [--binstubs[=DIRECTORY]] [--clean] [--deployment]
[--frozen] [--full-index] [--gemfile=GEMFILE] [--jobs=NUMBER] [--local]
- [--no-cache] [--no-prune] [--path PATH] [--quiet] [--redownload]
- [--retry=NUMBER] [--shebang] [--standalone[=GROUP[ GROUP...]]] [--sys-
- tem] [--trust-policy=POLICY] [--with=GROUP[ GROUP...]] [--with-
- out=GROUP[ GROUP...]]
+ [--no-cache] [--no-prune] [--path PATH] [--quiet] [--redownload]
+ [--retry=NUMBER] [--shebang] [--standalone[=GROUP[ GROUP...]]]
+ [--system] [--trust-policy=POLICY] [--with=GROUP[ GROUP...]]
+ [--without=GROUP[ GROUP...]]
DESCRIPTION
- Install the gems specified in your Gemfile(5). If this is the first
- time you run bundle install (and a Gemfile.lock does not exist),
+ Install the gems specified in your Gemfile(5). If this is the first
+ time you run bundle install (and a Gemfile.lock does not exist),
Bundler will fetch all remote sources, resolve dependencies and install
all needed gems.
If a Gemfile.lock does exist, and you have not updated your Gemfile(5),
- Bundler will fetch all remote sources, but use the dependencies speci-
- fied in the Gemfile.lock instead of resolving dependencies.
+ Bundler will fetch all remote sources, but use the dependencies
+ specified in the Gemfile.lock instead of resolving dependencies.
If a Gemfile.lock does exist, and you have updated your Gemfile(5),
Bundler will use the dependencies in the Gemfile.lock for all gems that
@@ -34,122 +34,122 @@ OPTIONS
time bundle install is run, use bundle config (see bundle-config(1)).
--binstubs[=<directory>]
- Binstubs are scripts that wrap around executables. Bundler cre-
- ates a small Ruby file (a binstub) that loads Bundler, runs the
- command, and puts it in bin/. This lets you link the binstub
- inside of an application to the exact gem version the applica-
- tion needs.
-
- Creates a directory (defaults to ~/bin) and places 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
- a rails executable, this flag will create a bin/rails executable
- that ensures that all referred dependencies will be resolved
- using the bundled gems.
+ Binstubs are scripts that wrap around executables. Bundler
+ creates a small Ruby file (a binstub) that loads Bundler, runs
+ the command, and puts it in bin/. This lets you link the binstub
+ inside of an application to the exact gem version the
+ application needs.
+
+ Creates a directory (defaults to ~/bin) and places any
+ executables from the gem there. These executables run in
+ Bundler's context. If used, you might add this directory to your
+ environment's 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 using the bundled gems.
--clean
- On finishing the installation Bundler is going to remove any
- gems not present in the current Gemfile(5). Don't worry, gems
- currently in use will not be removed.
+ On finishing the installation Bundler is going to remove any
+ gems not present in the current Gemfile(5). Don't worry, gems
+ currently in use will not be removed.
--deployment
- In deployment mode, Bundler will 'roll-out' the bundle for pro-
- duction or CI use. Please check carefully if you want to have
- this option enabled in your development environment.
+ In deployment mode, Bundler will 'roll-out' the bundle for
+ production or CI use. Please check carefully if you want to have
+ this option enabled in your development environment.
--redownload
- Force download every gem, even if the required versions are
- already available locally.
+ Force download every gem, even if the required versions are
+ already available locally.
--frozen
- Do not allow the Gemfile.lock to be updated after this install.
- Exits non-zero if there are going to be changes to the Gem-
- file.lock.
+ Do not allow the Gemfile.lock to be updated after this install.
+ Exits non-zero if there are going to be changes to the
+ Gemfile.lock.
--full-index
- Bundler will not call Rubygems' API endpoint (default) but down-
- load and cache a (currently big) index file of all gems. Perfor-
- mance can be improved for large bundles that seldom change by
- enabling this option.
+ Bundler will not call Rubygems' API endpoint (default) but
+ download and cache a (currently big) index file of all gems.
+ Performance can be improved for large bundles that seldom change
+ by enabling this option.
--gemfile=<gemfile>
- The location of the Gemfile(5) which Bundler should use. This
- defaults to a Gemfile(5) in the current working directory. In
- general, Bundler will assume that the location of the Gemfile(5)
- is also the project's root and will try to find Gemfile.lock and
- vendor/cache relative to this location.
+ The location of the Gemfile(5) which Bundler should use. This
+ defaults to a Gemfile(5) in the current working directory. In
+ general, Bundler will assume that the location of the Gemfile(5)
+ is also the project's root and will try to find Gemfile.lock and
+ vendor/cache relative to this location.
--jobs=[<number>], -j[<number>]
- The maximum number of parallel download and install jobs. The
- default is 1.
+ The maximum number of parallel download and install jobs. The
+ default is 1.
--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
- exists on rubygems.org it will not be found.
+ Do not attempt to connect to rubygems.org. Instead, Bundler will
+ use the gems already present in Rubygems' cache or in
+ vendor/cache. Note that if a appropriate platform-specific gem
+ exists on rubygems.org it will not be found.
--no-cache
- Do not update the cache in vendor/cache with the newly bundled
- gems. This does not remove any gems in the cache but keeps the
- newly bundled gems from being cached during the install.
+ Do not update the cache in vendor/cache with the newly bundled
+ gems. This does not remove any gems in the cache but keeps the
+ newly bundled gems from being cached during the install.
--no-prune
- Don't remove stale gems from the cache when the installation
- finishes.
+ Don't remove stale gems from the cache when the installation
+ finishes.
--path=<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.
+ 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.
--quiet
- Do not print progress information to the standard output.
- Instead, Bundler will exit using a status code ($?).
+ Do not print progress information to the standard output.
+ Instead, Bundler will exit using a status code ($?).
--retry=[<number>]
- Retry failed network or git requests for number times.
+ Retry failed network or git requests for number times.
--shebang=<ruby-executable>
- Uses the specified ruby executable (usually ruby) to execute the
- scripts created with --binstubs. In addition, if you use --bin-
- stubs together with --shebang jruby these executables will be
- changed to execute jruby instead.
+ Uses the specified ruby executable (usually ruby) to execute the
+ scripts created with --binstubs. In addition, if you use
+ --binstubs together with --shebang jruby these executables will
+ be changed to execute jruby instead.
--standalone[=<list>]
- Makes a bundle that can work without depending on Rubygems or
- Bundler at runtime. A space separated list of groups to install
- has to be specified. Bundler creates a directory named bundle
- and installs the bundle there. It also generates a bun-
- dle/bundler/setup.rb file to replace Bundler's own setup in the
- manner required. Using this option implicitly sets path, which
- is a [remembered option][REMEMBERED OPTIONS].
+ Makes a bundle that can work without depending on Rubygems or
+ Bundler at runtime. A space separated list of groups to install
+ has to be specified. Bundler creates a directory named bundle
+ and installs the bundle there. It also generates a
+ bundle/bundler/setup.rb file to replace Bundler's own setup in
+ the manner required. Using this option implicitly sets path,
+ which is a [remembered option][REMEMBERED OPTIONS].
--system
- Installs the gems specified in the bundle to the system's
- Rubygems location. This overrides any previous configuration of
- --path.
+ Installs the gems specified in the bundle to the system's
+ Rubygems location. This overrides any previous configuration of
+ --path.
--trust-policy=[<policy>]
- Apply the Rubygems security policy policy, where policy is one
- of HighSecurity, MediumSecurity, LowSecurity, AlmostNoSecurity,
- or NoSecurity. For more details, please see the Rubygems signing
- documentation linked below in SEE ALSO.
+ Apply the Rubygems security policy policy, where policy is one
+ of HighSecurity, MediumSecurity, LowSecurity, AlmostNoSecurity,
+ or NoSecurity. For more details, please see the Rubygems signing
+ documentation linked below in SEE ALSO.
--with=<list>
- A space-separated list of groups referencing gems to install. If
- an optional group is given it is installed. If a group is given
- that is in the remembered list of groups given to --without, it
- is removed from that list.
+ A space-separated list of groups referencing gems to install. If
+ an optional group is given it is installed. If a group is given
+ that is in the remembered list of groups given to --without, it
+ is removed from that list.
--without=<list>
- A space-separated list of groups referencing gems to skip during
- installation. If a group is given that is in the remembered list
- of groups given to --with, it is removed from that list.
+ A space-separated list of groups referencing gems to skip during
+ installation. If a group is given that is in the remembered list
+ of groups given to --with, it is removed from that list.
DEPLOYMENT MODE
Bundler's defaults are optimized for development. To switch to defaults
@@ -159,36 +159,36 @@ DEPLOYMENT MODE
1. A Gemfile.lock is required.
- To ensure that the same versions of the gems you developed with and
- tested with are also used in deployments, a Gemfile.lock is
- required.
+ To ensure that the same versions of the gems you developed with and
+ tested with are also used in deployments, a Gemfile.lock is
+ required.
- This is mainly to ensure that you remember to check your Gem-
- file.lock into version control.
+ This is mainly to ensure that you remember to check your
+ Gemfile.lock into version control.
2. The Gemfile.lock must be up to date
- In development, you can modify your Gemfile(5) and re-run bundle
- install to conservatively update your Gemfile.lock snapshot.
+ In development, you can modify your Gemfile(5) and re-run bundle
+ install to conservatively update your Gemfile.lock snapshot.
- In deployment, your Gemfile.lock should be up-to-date with changes
- made in your Gemfile(5).
+ In deployment, your Gemfile.lock should be up-to-date with changes
+ made in your Gemfile(5).
- 3. Gems are installed to vendor/bundle not your default system loca-
- tion
+ 3. Gems are installed to vendor/bundle not your default system
+ location
- In development, it's convenient to share the gems used in your
- application with other applications and other scripts that run on
- the system.
+ In development, it's convenient to share the gems used in your
+ application with other applications and other scripts that run on
+ the system.
- In deployment, isolation is a more important default. In addition,
- the user deploying the application may not have permission to
- install gems to the system, or the web server may not have permis-
- sion to read them.
+ In deployment, isolation is a more important default. In addition,
+ the user deploying the application may not have permission to
+ install gems to the system, or the web server may not have
+ permission to read them.
- As a result, bundle install --deployment installs gems to the ven-
- dor/bundle directory in the application. This may be overridden
- using the --path option.
+ As a result, bundle install --deployment installs gems to the
+ vendor/bundle directory in the application. This may be overridden
+ using the --path option.
@@ -197,7 +197,7 @@ SUDO USAGE
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
@@ -216,8 +216,8 @@ 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
+ 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
@@ -232,9 +232,9 @@ INSTALLING GROUPS
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
- the dependencies of every gem in your Gemfile(5).
+ While the --without option will skip installing the gems in the
+ specified 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
@@ -244,24 +244,24 @@ INSTALLING GROUPS
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
- different versions of third-party code being used in different environ-
- ments.
+ different versions of third-party code being used in different
+ environments.
For a simple illustration, consider the following Gemfile(5):
- source 'https://rubygems.org'
+ source 'https://rubygems.org'
- gem 'sinatra'
+ gem 'sinatra'
- group :production do
- gem 'rack-perftools-profiler'
- end
+ group :production do
+ gem 'rack-perftools-profiler'
+ end
- 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
@@ -271,14 +271,14 @@ INSTALLING GROUPS
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
+ 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
+ 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)
+ more than the gems you list in your Gemfile(5), and can (surprisingly)
radically change the gems you are using.
THE GEMFILE.LOCK
@@ -287,12 +287,12 @@ THE GEMFILE.LOCK
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.
+ guarantees that you always use the same exact code, even as your
+ application 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,
@@ -302,15 +302,15 @@ THE GEMFILE.LOCK
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-
- ignore file included with generated gems. Over time, however, it became
- 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
- gems.
+ When Bundler first shipped, the Gemfile.lock was included in the
+ .gitignore file included with generated gems. Over time, however, it
+ became 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
+ discourage 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,
@@ -324,19 +324,19 @@ CONSERVATIVE UPDATING
- source 'https://rubygems.org'
+ source 'https://rubygems.org'
- gem 'actionpack', '2.3.8'
- gem 'activemerchant'
+ gem 'actionpack', '2.3.8'
+ gem 'activemerchant'
- 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.
+ In this case, both actionpack and activemerchant depend on
+ activesupport. 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
+ When the dependencies are first resolved, Bundler will select
activesupport 2.3.8, which satisfies the requirements of both gems in
your Gemfile(5).
@@ -344,52 +344,52 @@ CONSERVATIVE UPDATING
- source 'https://rubygems.org'
+ source 'https://rubygems.org'
- gem 'actionpack', '3.0.0.rc'
- gem 'activemerchant'
+ gem 'actionpack', '3.0.0.rc'
+ gem 'activemerchant'
- 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.
+ 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
+ dependency 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
currently being used to satisfy its requirements:
activesupport 2.3.8
- also used to satisfy a dependency in activemerchant, which is
- not being updated
+ 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
+ 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-
- pack requires updating one of its dependencies.
+ not expect it to suddenly stop working after updating actionpack.
+ However, satisfying the new activesupport 3.0.0.rc dependency of
+ actionpack 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
- dependencies. In this case, the activemerchant dependency is treated as
- activemerchant 1.7.1 + activesupport 2.3.8, so bundle install will
- report that it cannot update actionpack.
+ Even though activemerchant declares a very loose dependency that
+ theoretically 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 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
(see bundle update(1)).
- Summary: In general, after making a change to the Gemfile(5) , you
+ 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
- http://guides.rubygems.org/rubygems-basics/#installing-gems
+ 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
- January 2020 BUNDLE-INSTALL(1)
+ May 2020 BUNDLE-INSTALL(1)
diff --git a/man/bundle-list.1 b/man/bundle-list.1
index 72bc391ac2..0759f11a40 100644
--- a/man/bundle-list.1
+++ b/man/bundle-list.1
@@ -1,13 +1,13 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-LIST" "1" "January 2020" "" ""
+.TH "BUNDLE\-LIST" "1" "May 2020" "" ""
.
.SH "NAME"
\fBbundle\-list\fR \- List all the gems in the bundle
.
.SH "SYNOPSIS"
-\fBbundle list\fR [\-\-name\-only] [\-\-paths] [\-\-without\-group=GROUP] [\-\-only\-group=GROUP]
+\fBbundle list\fR [\-\-name\-only] [\-\-paths] [\-\-without\-group=GROUP[ GROUP\.\.\.]] [\-\-only\-group=GROUP[ GROUP\.\.\.]]
.
.SH "DESCRIPTION"
Prints a list of all the gems in the bundle including their version\.
@@ -28,7 +28,7 @@ bundle list \-\-without\-group test
bundle list \-\-only\-group dev
.
.P
-bundle list \-\-only\-group dev \-\-paths
+bundle list \-\-only\-group dev test \-\-paths
.
.SH "OPTIONS"
.
@@ -41,10 +41,10 @@ Print only the name of each gem\.
Print the path to each gem in the bundle\.
.
.TP
-\fB\-\-without\-group\fR
-Print all gems expect from a group\.
+\fB\-\-without\-group=<list>\fR
+A space\-separated list of groups of gems to skip during printing\.
.
.TP
-\fB\-\-only\-group\fR
-Print gems from a particular group\.
+\fB\-\-only\-group=<list>\fR
+A space\-separated list of groups of gems to print\.
diff --git a/man/bundle-list.1.txt b/man/bundle-list.1.txt
index 645e62e452..7141eb13b9 100644
--- a/man/bundle-list.1.txt
+++ b/man/bundle-list.1.txt
@@ -1,4 +1,4 @@
-BUNDLE-LIST(1) BUNDLE-LIST(1)
+BUNDLE-LIST(1) BUNDLE-LIST(1)
@@ -6,8 +6,8 @@ NAME
bundle-list - List all the gems in the bundle
SYNOPSIS
- bundle list [--name-only] [--paths] [--without-group=GROUP]
- [--only-group=GROUP]
+ bundle list [--name-only] [--paths] [--without-group=GROUP[ GROUP...]]
+ [--only-group=GROUP[ GROUP...]]
DESCRIPTION
Prints a list of all the gems in the bundle including their version.
@@ -22,22 +22,23 @@ DESCRIPTION
bundle list --only-group dev
- bundle list --only-group dev --paths
+ bundle list --only-group dev test --paths
OPTIONS
--name-only
- Print only the name of each gem.
+ Print only the name of each gem.
--paths
- Print the path to each gem in the bundle.
+ Print the path to each gem in the bundle.
- --without-group
- Print all gems expect from a group.
+ --without-group=<list>
+ A space-separated list of groups of gems to skip during
+ printing.
- --only-group
- Print gems from a particular group.
+ --only-group=<list>
+ A space-separated list of groups of gems to print.
- January 2020 BUNDLE-LIST(1)
+ May 2020 BUNDLE-LIST(1)
diff --git a/man/bundle-list.ronn b/man/bundle-list.ronn
index 120cf5e307..dc058ecd5f 100644
--- a/man/bundle-list.ronn
+++ b/man/bundle-list.ronn
@@ -3,7 +3,7 @@ bundle-list(1) -- List all the gems in the bundle
## SYNOPSIS
-`bundle list` [--name-only] [--paths] [--without-group=GROUP] [--only-group=GROUP]
+`bundle list` [--name-only] [--paths] [--without-group=GROUP[ GROUP...]] [--only-group=GROUP[ GROUP...]]
## DESCRIPTION
@@ -19,7 +19,7 @@ bundle list --without-group test
bundle list --only-group dev
-bundle list --only-group dev --paths
+bundle list --only-group dev test --paths
## OPTIONS
@@ -27,7 +27,7 @@ bundle list --only-group dev --paths
Print only the name of each gem.
* `--paths`:
Print the path to each gem in the bundle.
-* `--without-group`:
- Print all gems expect from a group.
-* `--only-group`:
- Print gems from a particular group.
+* `--without-group=<list>`:
+ A space-separated list of groups of gems to skip during printing.
+* `--only-group=<list>`:
+ A space-separated list of groups of gems to print.
diff --git a/man/bundle-lock.1 b/man/bundle-lock.1
index 89f6e35179..2784d31d0b 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" "January 2020" "" ""
+.TH "BUNDLE\-LOCK" "1" "May 2020" "" ""
.
.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 80dcada5b3..88a7e9fe34 100644
--- a/man/bundle-lock.1.txt
+++ b/man/bundle-lock.1.txt
@@ -1,4 +1,4 @@
-BUNDLE-LOCK(1) BUNDLE-LOCK(1)
+BUNDLE-LOCK(1) BUNDLE-LOCK(1)
@@ -6,7 +6,7 @@ NAME
bundle-lock - Creates / Updates a lockfile without installing
SYNOPSIS
- bundle lock [--update] [--local] [--print] [--lockfile=PATH]
+ bundle lock [--update] [--local] [--print] [--lockfile=PATH]
[--full-index] [--add-platform] [--remove-platform] [--patch] [--minor]
[--major] [--strict] [--conservative]
@@ -15,52 +15,52 @@ 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.
+ Ignores the existing lockfile. Resolve then updates lockfile.
+ 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
- exists on rubygems.org it will not be found.
+ Do not attempt to connect to rubygems.org. Instead, Bundler will
+ use the gems already present in Rubygems' cache or in
+ vendor/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
- system.
+ Prints the lockfile to STDOUT instead of writing to the file
+ system.
--lockfile=<path>
- The path where the lockfile should be written to.
+ The path where the lockfile should be written to.
--full-index
- Fall back to using the single-file index of all gems.
+ 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-
- tion of that platform.
+ Add a new platform to the lockfile, re-resolving for the
+ addition of that platform.
--remove-platform
- Remove a platform from the lockfile.
+ Remove a platform from the lockfile.
--patch
- If updating, prefer updating only to next patch version.
+ If updating, prefer updating only to next patch version.
--minor
- If updating, prefer updating only to next minor version.
+ If updating, prefer updating only to next minor version.
--major
- If updating, prefer updating to next major version (default).
+ If updating, prefer updating to next major version (default).
--strict
- If updating, do not allow any gem to be updated past latest
- --patch | --minor | --major.
+ If updating, do not allow any gem to be updated past latest
+ --patch | --minor | --major.
--conservative
- If updating, use bundle install conservative update behavior and
- do not allow shared dependencies to be updated.
+ If updating, use bundle install conservative update behavior and
+ 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
+ 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.
@@ -69,12 +69,12 @@ UPDATING A LIST OF GEMS
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-
- file.lock.
+ rest of the gems that you specified locked to the versions in the
+ Gemfile.lock.
SUPPORTING OTHER PLATFORMS
If you want your bundle to support platforms other than the one you're
@@ -90,4 +90,4 @@ PATCH LEVEL OPTIONS
- January 2020 BUNDLE-LOCK(1)
+ May 2020 BUNDLE-LOCK(1)
diff --git a/man/bundle-open.1 b/man/bundle-open.1
index 5a11eeeb64..99bc7ad878 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" "January 2020" "" ""
+.TH "BUNDLE\-OPEN" "1" "May 2020" "" ""
.
.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 288bbce0e3..fb5d2eefd7 100644
--- a/man/bundle-open.1.txt
+++ b/man/bundle-open.1.txt
@@ -1,4 +1,4 @@
-BUNDLE-OPEN(1) BUNDLE-OPEN(1)
+BUNDLE-OPEN(1) BUNDLE-OPEN(1)
@@ -18,7 +18,7 @@ DESCRIPTION
- bundle open 'rack'
+ bundle open 'rack'
@@ -26,4 +26,4 @@ DESCRIPTION
- January 2020 BUNDLE-OPEN(1)
+ May 2020 BUNDLE-OPEN(1)
diff --git a/man/bundle-outdated.1 b/man/bundle-outdated.1
index 408e568034..0f1202a930 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" "January 2020" "" ""
+.TH "BUNDLE\-OUTDATED" "1" "May 2020" "" ""
.
.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 c938e0a4ab..3ff862ca7d 100644
--- a/man/bundle-outdated.1.txt
+++ b/man/bundle-outdated.1.txt
@@ -1,4 +1,4 @@
-BUNDLE-OUTDATED(1) BUNDLE-OUTDATED(1)
+BUNDLE-OUTDATED(1) BUNDLE-OUTDATED(1)
@@ -6,10 +6,10 @@ NAME
bundle-outdated - List installed gems with newer versions available
SYNOPSIS
- bundle outdated [GEM] [--local] [--pre] [--source] [--strict]
- [--parseable | --porcelain] [--group=GROUP] [--groups]
- [--update-strict] [--patch|--minor|--major] [--filter-major] [--fil-
- ter-minor] [--filter-patch] [--only-explicit]
+ bundle outdated [GEM] [--local] [--pre] [--source] [--strict]
+ [--parseable | --porcelain] [--group=GROUP] [--groups]
+ [--update-strict] [--patch|--minor|--major] [--filter-major]
+ [--filter-minor] [--filter-patch] [--only-explicit]
DESCRIPTION
Outdated lists the names and versions of gems that have a newer version
@@ -20,56 +20,56 @@ DESCRIPTION
OPTIONS
--local
- Do not attempt to fetch gems remotely and use the gem cache
- instead.
+ Do not attempt to fetch gems remotely and use the gem cache
+ instead.
--pre Check for newer pre-release gems.
--source
- Check against a specific source.
+ Check against a specific source.
--strict
- Only list newer versions allowed by your Gemfile requirements.
+ Only list newer versions allowed by your Gemfile requirements.
--parseable, --porcelain
- Use minimal formatting for more parseable output.
+ Use minimal formatting for more parseable output.
--group
- List gems from a specific group.
+ List gems from a specific group.
--groups
- List gems organized by groups.
+ List gems organized by groups.
--update-strict
- Strict conservative resolution, do not allow any gem to be
- updated past latest --patch | --minor| --major.
+ Strict conservative resolution, do not allow any gem to be
+ updated past latest --patch | --minor| --major.
--minor
- Prefer updating only to next minor version.
+ Prefer updating only to next minor version.
--major
- Prefer updating to next major version (default).
+ Prefer updating to next major version (default).
--patch
- Prefer updating only to next patch version.
+ Prefer updating only to next patch version.
--filter-major
- Only list major newer versions.
+ Only list major newer versions.
--filter-minor
- Only list minor newer versions.
+ Only list minor newer versions.
--filter-patch
- Only list patch newer versions.
+ Only list patch newer versions.
--only-explicit
- Only list gems specified in your Gemfile, not their dependen-
- cies.
+ Only list gems specified in your Gemfile, not their
+ dependencies.
PATCH LEVEL OPTIONS
See bundle update(1) bundle-update.1.html for details.
- One difference between the patch level options in bundle update and
+ One difference between the patch level options in bundle update and
here is the --strict option. --strict was already an option on outdated
before the patch level options were added. --strict wasn't altered, and
the --update-strict option on outdated reflects what --strict does on
@@ -83,9 +83,9 @@ FILTERING OUTPUT
- * faker (newest 1.6.6, installed 1.6.5, requested ~> 1.4) in groups "development, test"
- * hashie (newest 3.4.6, installed 1.2.0, requested = 1.2.0) in groups "default"
- * headless (newest 2.3.1, installed 2.2.3) in groups "test"
+ * faker (newest 1.6.6, installed 1.6.5, requested ~> 1.4) in groups "development, test"
+ * hashie (newest 3.4.6, installed 1.2.0, requested = 1.2.0) in groups "default"
+ * headless (newest 2.3.1, installed 2.2.3) in groups "test"
@@ -93,7 +93,7 @@ FILTERING OUTPUT
- * hashie (newest 3.4.6, installed 1.2.0, requested = 1.2.0) in groups "default"
+ * hashie (newest 3.4.6, installed 1.2.0, requested = 1.2.0) in groups "default"
@@ -101,7 +101,7 @@ FILTERING OUTPUT
- * headless (newest 2.3.1, installed 2.2.3) in groups "test"
+ * headless (newest 2.3.1, installed 2.2.3) in groups "test"
@@ -109,7 +109,7 @@ FILTERING OUTPUT
- * faker (newest 1.6.6, installed 1.6.5, requested ~> 1.4) in groups "development, test"
+ * faker (newest 1.6.6, installed 1.6.5, requested ~> 1.4) in groups "development, test"
@@ -118,14 +118,14 @@ FILTERING OUTPUT
- * faker (newest 1.6.6, installed 1.6.5, requested ~> 1.4) in groups "development, test"
- * headless (newest 2.3.1, installed 2.2.3) in groups "test"
+ * faker (newest 1.6.6, installed 1.6.5, requested ~> 1.4) in groups "development, test"
+ * headless (newest 2.3.1, installed 2.2.3) in groups "test"
- Combining all three filter options would be the same result as provid-
- ing none of them.
+ Combining all three filter options would be the same result as
+ providing none of them.
- January 2020 BUNDLE-OUTDATED(1)
+ May 2020 BUNDLE-OUTDATED(1)
diff --git a/man/bundle-platform.1 b/man/bundle-platform.1
index c83aa3c5d4..4d52b7d28a 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" "January 2020" "" ""
+.TH "BUNDLE\-PLATFORM" "1" "May 2020" "" ""
.
.SH "NAME"
\fBbundle\-platform\fR \- Displays platform compatibility information
diff --git a/man/bundle-platform.1.txt b/man/bundle-platform.1.txt
index f9dc8ccc1f..1edeef78d7 100644
--- a/man/bundle-platform.1.txt
+++ b/man/bundle-platform.1.txt
@@ -1,4 +1,4 @@
-BUNDLE-PLATFORM(1) BUNDLE-PLATFORM(1)
+BUNDLE-PLATFORM(1) BUNDLE-PLATFORM(1)
@@ -16,11 +16,11 @@ DESCRIPTION
- source "https://rubygems.org"
+ source "https://rubygems.org"
- ruby "1.9.3"
+ ruby "1.9.3"
- gem "rack"
+ gem "rack"
@@ -29,29 +29,29 @@ DESCRIPTION
- Your platform is: x86_64-linux
+ Your platform is: x86_64-linux
- Your app has gems that work on these platforms:
- * ruby
+ Your app has gems that work on these platforms:
+ * ruby
- Your Gemfile specifies a Ruby version requirement:
- * ruby 1.9.3
+ Your Gemfile specifies a Ruby version requirement:
+ * ruby 1.9.3
- Your current platform satisfies the Ruby version requirement.
+ Your current platform satisfies the Ruby version requirement.
platform will list all the platforms in your Gemfile.lock as well as
the ruby directive if applicable from your Gemfile(5). It will also let
- you know if the ruby directive requirement has been met. If ruby direc-
- tive doesn't match the running Ruby VM, it will tell you what part does
- not.
+ you know if the ruby directive requirement has been met. If ruby
+ directive doesn't match the running Ruby VM, it will tell you what part
+ does not.
OPTIONS
- --ruby It will display the ruby directive information, so you don't
- have to parse it from the Gemfile(5).
+ --ruby It will display the ruby directive information, so you don't
+ have to parse it from the Gemfile(5).
- January 2020 BUNDLE-PLATFORM(1)
+ May 2020 BUNDLE-PLATFORM(1)
diff --git a/man/bundle-pristine.1 b/man/bundle-pristine.1
index 460e3d4e5a..974ca8f965 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" "January 2020" "" ""
+.TH "BUNDLE\-PRISTINE" "1" "May 2020" "" ""
.
.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 8d474fe497..e7e317dbe9 100644
--- a/man/bundle-pristine.1.txt
+++ b/man/bundle-pristine.1.txt
@@ -1,4 +1,4 @@
-BUNDLE-PRISTINE(1) BUNDLE-PRISTINE(1)
+BUNDLE-PRISTINE(1) BUNDLE-PRISTINE(1)
@@ -9,7 +9,7 @@ SYNOPSIS
bundle pristine
DESCRIPTION
- pristine restores the installed gems in the bundle to their pristine
+ pristine restores the installed gems in the bundle to their pristine
condition using the local gem cache from RubyGems. For git gems, a
forced checkout will be performed.
@@ -18,8 +18,8 @@ DESCRIPTION
gem's git repository as if one were installing from scratch.
Note: the Bundler gem cannot be restored to its original state with
- pristine. One also cannot use bundle pristine on gems with a 'path'
- option in the Gemfile, because bundler has no original copy it can
+ pristine. One also cannot use bundle pristine on gems with a 'path'
+ option in the Gemfile, because bundler has no original copy it can
restore from.
When is it practical to use bundle pristine?
@@ -35,10 +35,10 @@ DESCRIPTION
--all cleans all installed gems for that Ruby version.
If a developer forgets which gems in their project they might have been
- debugging, the Rubygems gem pristine [GEMNAME] command may be inconve-
- nient. One can avoid waiting for gem pristine --all, and instead run
- bundle pristine.
+ debugging, the Rubygems gem pristine [GEMNAME] command may be
+ inconvenient. One can avoid waiting for gem pristine --all, and instead
+ run bundle pristine.
- January 2020 BUNDLE-PRISTINE(1)
+ May 2020 BUNDLE-PRISTINE(1)
diff --git a/man/bundle-remove.1 b/man/bundle-remove.1
index cb4ad8d384..424311a637 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" "January 2020" "" ""
+.TH "BUNDLE\-REMOVE" "1" "May 2020" "" ""
.
.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 7203422f39..828cf59d94 100644
--- a/man/bundle-remove.1.txt
+++ b/man/bundle-remove.1.txt
@@ -1,4 +1,4 @@
-BUNDLE-REMOVE(1) BUNDLE-REMOVE(1)
+BUNDLE-REMOVE(1) BUNDLE-REMOVE(1)
@@ -9,17 +9,17 @@ SYNOPSIS
bundle remove [GEM [GEM ...]] [--install]
DESCRIPTION
- Removes the given gems from the Gemfile while ensuring that the result-
- ing Gemfile is still valid. If a gem cannot be removed, a warning is
- printed. If a gem is already absent from the Gemfile, and error is
+ Removes the given gems from the Gemfile while ensuring that the
+ resulting Gemfile is still valid. If a gem cannot be removed, a warning
+ is printed. If a gem is already absent from the Gemfile, and error is
raised.
OPTIONS
--install
- Runs bundle install after the given gems have been removed from
- the Gemfile, which ensures that both the lockfile and the
- installed gems on disk are also updated to remove the given
- gem(s).
+ Runs bundle install after the given gems have been removed from
+ the Gemfile, which ensures that both the lockfile and the
+ installed gems on disk are also updated to remove the given
+ gem(s).
Example:
@@ -31,4 +31,4 @@ OPTIONS
- January 2020 BUNDLE-REMOVE(1)
+ May 2020 BUNDLE-REMOVE(1)
diff --git a/man/bundle-show.1 b/man/bundle-show.1
index 2922a33467..373d29f483 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" "January 2020" "" ""
+.TH "BUNDLE\-SHOW" "1" "May 2020" "" ""
.
.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 58f1620168..874cd3e17a 100644
--- a/man/bundle-show.1.txt
+++ b/man/bundle-show.1.txt
@@ -1,4 +1,4 @@
-BUNDLE-SHOW(1) BUNDLE-SHOW(1)
+BUNDLE-SHOW(1) BUNDLE-SHOW(1)
@@ -9,19 +9,19 @@ SYNOPSIS
bundle show [GEM] [--paths]
DESCRIPTION
- Without the [GEM] option, show will print a list of the names and ver-
- sions of all gems that are required by your [Gemfile(5)][Gemfile(5)],
- sorted by name.
+ Without the [GEM] option, show will print a list of the names and
+ versions of all gems that are required by your
+ [Gemfile(5)][Gemfile(5)], sorted by name.
- Calling show with [GEM] will list the exact location of that gem on
+ Calling show with [GEM] will list the exact location of that gem on
your machine.
OPTIONS
--paths
- List the paths of all gems that are required by your [Gem-
- file(5)][Gemfile(5)], sorted by gem name.
+ List the paths of all gems that are required by your
+ [Gemfile(5)][Gemfile(5)], sorted by gem name.
- January 2020 BUNDLE-SHOW(1)
+ May 2020 BUNDLE-SHOW(1)
diff --git a/man/bundle-update.1 b/man/bundle-update.1
index f315532bb9..f9c89da57f 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" "January 2020" "" ""
+.TH "BUNDLE\-UPDATE" "1" "May 2020" "" ""
.
.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 b8208c75d3..4b44505571 100644
--- a/man/bundle-update.1.txt
+++ b/man/bundle-update.1.txt
@@ -1,4 +1,4 @@
-BUNDLE-UPDATE(1) BUNDLE-UPDATE(1)
+BUNDLE-UPDATE(1) BUNDLE-UPDATE(1)
@@ -12,9 +12,9 @@ SYNOPSIS
DESCRIPTION
Update the gems specified (all gems, if --all flag is used), ignoring
- the previously installed gems specified in the Gemfile.lock. In gen-
- eral, you should use bundle install(1) bundle-install.1.html to install
- the same exact gems and versions across machines.
+ the previously installed gems specified in the Gemfile.lock. In
+ general, 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.
@@ -22,114 +22,114 @@ 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
- group, for example.
+ 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
- --source rails
+ 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
- instead.
+ 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.
+ Ruby.
--bundler
- Update the locked version of bundler to the invoked bundler ver-
- sion.
+ Update the locked version of bundler to the invoked bundler
+ version.
--full-index
- Fall back to using the single-file index of all gems.
+ Fall back to using the single-file index of all gems.
--jobs=[<number>], -j[<number>]
- Specify the number of jobs to run in parallel. The default is 1.
+ Specify the number of jobs to run in parallel. The default is 1.
--retry=[<number>]
- Retry failed network or git requests for number times.
+ Retry failed network or git requests for number times.
--quiet
- Only output warnings and errors.
+ Only output warnings and errors.
--redownload
- Force downloading every gem.
+ Force downloading every gem.
--patch
- Prefer updating only to next patch version.
+ Prefer updating only to next patch version.
--minor
- Prefer updating only to next minor version.
+ Prefer updating only to next minor version.
--major
- Prefer updating to next major version (default).
+ Prefer updating to next major version (default).
--strict
- Do not allow any gem to be updated past latest --patch | --minor
- | --major.
+ Do not allow any gem to be updated past latest --patch | --minor
+ | --major.
--conservative
- Use bundle install conservative update behavior and do not allow
- shared dependencies to be updated.
+ Use bundle install conservative update behavior and do not allow
+ shared dependencies to be updated.
UPDATING ALL GEMS
- If you run bundle update --all, bundler will ignore any previously
- installed gems and resolve all dependencies again based on the latest
+ If you run bundle update --all, bundler will ignore any previously
+ installed gems and resolve all dependencies again based on the latest
versions of all gems available in the sources.
Consider the following Gemfile(5):
- source "https://rubygems.org"
+ source "https://rubygems.org"
- gem "rails", "3.0.0.rc"
- gem "nokogiri"
+ gem "rails", "3.0.0.rc"
+ gem "nokogiri"
When you run bundle install(1) bundle-install.1.html the first time,
- bundler will resolve all of the dependencies, all the way down, and
+ bundler will resolve all of the dependencies, all the way down, and
install what you need:
- Fetching gem metadata from https://rubygems.org/.........
- Resolving dependencies...
- Installing builder 2.1.2
- Installing abstract 1.0.0
- Installing rack 1.2.8
- Using bundler 1.7.6
- Installing rake 10.4.0
- Installing polyglot 0.3.5
- Installing mime-types 1.25.1
- Installing i18n 0.4.2
- Installing mini_portile 0.6.1
- Installing tzinfo 0.3.42
- Installing rack-mount 0.6.14
- Installing rack-test 0.5.7
- Installing treetop 1.4.15
- Installing thor 0.14.6
- Installing activesupport 3.0.0.rc
- Installing erubis 2.6.6
- Installing activemodel 3.0.0.rc
- Installing arel 0.4.0
- Installing mail 2.2.20
- Installing activeresource 3.0.0.rc
- Installing actionpack 3.0.0.rc
- Installing activerecord 3.0.0.rc
- Installing actionmailer 3.0.0.rc
- Installing railties 3.0.0.rc
- Installing rails 3.0.0.rc
- Installing nokogiri 1.6.5
-
- Bundle complete! 2 Gemfile dependencies, 26 gems total.
- Use `bundle show [gemname]` to see where a bundled gem is installed.
+ Fetching gem metadata from https://rubygems.org/.........
+ Resolving dependencies...
+ Installing builder 2.1.2
+ Installing abstract 1.0.0
+ Installing rack 1.2.8
+ Using bundler 1.7.6
+ Installing rake 10.4.0
+ Installing polyglot 0.3.5
+ Installing mime-types 1.25.1
+ Installing i18n 0.4.2
+ Installing mini_portile 0.6.1
+ Installing tzinfo 0.3.42
+ Installing rack-mount 0.6.14
+ Installing rack-test 0.5.7
+ Installing treetop 1.4.15
+ Installing thor 0.14.6
+ Installing activesupport 3.0.0.rc
+ Installing erubis 2.6.6
+ Installing activemodel 3.0.0.rc
+ Installing arel 0.4.0
+ Installing mail 2.2.20
+ Installing activeresource 3.0.0.rc
+ Installing actionpack 3.0.0.rc
+ Installing activerecord 3.0.0.rc
+ Installing actionmailer 3.0.0.rc
+ Installing railties 3.0.0.rc
+ Installing rails 3.0.0.rc
+ Installing nokogiri 1.6.5
+
+ Bundle complete! 2 Gemfile dependencies, 26 gems total.
+ Use `bundle show [gemname]` to see where a bundled gem is installed.
@@ -146,13 +146,13 @@ UPDATING ALL GEMS
use.
However, from time to time, you might want to update the gems you are
- using to the newest versions that still match the gems in your Gem-
- file(5).
+ using to the newest versions that still match the gems in your
+ Gemfile(5).
- To do this, run bundle update --all, which will ignore the Gem-
- file.lock, and resolve all the dependencies again. Keep in mind that
+ To do this, run bundle update --all, which will ignore the
+ Gemfile.lock, and resolve all the dependencies again. Keep in mind that
this process can result in a significantly different set of the 25
- gems, based on the requirements of new gems that the gem authors
+ gems, based on the requirements of new gems that the gem authors
released since the last time you ran bundle update --all.
UPDATING A LIST OF GEMS
@@ -164,7 +164,7 @@ UPDATING A LIST OF GEMS
version 1.4.4, and you want to update it without updating Rails and all
of its dependencies. To do this, run bundle update nokogiri.
- Bundler will update nokogiri and any of its dependencies, but leave
+ Bundler will update nokogiri and any of its dependencies, but leave
alone Rails and its dependencies.
OVERLAPPING DEPENDENCIES
@@ -174,34 +174,34 @@ OVERLAPPING DEPENDENCIES
- source "https://rubygems.org"
+ source "https://rubygems.org"
- gem "thin"
- gem "rack-perftools-profiler"
+ gem "thin"
+ gem "rack-perftools-profiler"
- The thin gem depends on rack >= 1.0, while rack-perftools-profiler
+ The thin gem depends on rack >= 1.0, while rack-perftools-profiler
depends on rack ~> 1.0. If you run bundle install, you get:
- Fetching source index for https://rubygems.org/
- Installing daemons (1.1.0)
- Installing eventmachine (0.12.10) with native extensions
- Installing open4 (1.0.1)
- Installing perftools.rb (0.4.7) with native extensions
- Installing rack (1.2.1)
- Installing rack-perftools_profiler (0.0.2)
- Installing thin (1.2.7) with native extensions
- Using bundler (1.0.0.rc.3)
+ Fetching source index for https://rubygems.org/
+ Installing daemons (1.1.0)
+ Installing eventmachine (0.12.10) with native extensions
+ Installing open4 (1.0.1)
+ Installing perftools.rb (0.4.7) with native extensions
+ Installing rack (1.2.1)
+ Installing rack-perftools_profiler (0.0.2)
+ Installing thin (1.2.7) with native extensions
+ Using bundler (1.0.0.rc.3)
In this case, the two gems have their own set of dependencies, but they
- share rack in common. If you run bundle update thin, bundler will
+ share rack in common. If you run bundle update thin, bundler will
update daemons, eventmachine and rack, which are dependencies of thin,
- but not open4 or perftools.rb, which are dependencies of
+ but not open4 or perftools.rb, which are dependencies of
rack-perftools_profiler. Note that bundle update thin will update rack
even though it's also a dependency of rack-perftools_profiler.
@@ -210,85 +210,85 @@ OVERLAPPING DEPENDENCIES
are also dependencies of another gem.
To prevent updating shared dependencies, prior to version 1.14 the only
- option was the CONSERVATIVE UPDATING behavior in bundle install(1) bun-
- dle-install.1.html:
+ option was the CONSERVATIVE UPDATING behavior in bundle install(1)
+ bundle-install.1.html:
In this scenario, updating the thin version manually in the Gemfile(5),
and then running bundle install(1) bundle-install.1.html will only
- update daemons and eventmachine, but not rack. For more information,
- see the CONSERVATIVE UPDATING section of bundle install(1) bun-
- dle-install.1.html.
+ update daemons and eventmachine, but not rack. For more information,
+ see the CONSERVATIVE UPDATING section of bundle install(1)
+ bundle-install.1.html.
- Starting with 1.14, specifying the --conservative option will also pre-
- vent shared dependencies from being updated.
+ Starting with 1.14, specifying the --conservative option will also
+ prevent shared dependencies from being updated.
PATCH LEVEL OPTIONS
- Version 1.14 introduced 4 patch-level options that will influence how
+ Version 1.14 introduced 4 patch-level options that will influence how
gem versions are resolved. One of the following options can be used:
--patch, --minor or --major. --strict can be added to further influence
resolution.
--patch
- Prefer updating only to next patch version.
+ Prefer updating only to next patch version.
--minor
- Prefer updating only to next minor version.
+ Prefer updating only to next minor version.
--major
- Prefer updating to next major version (default).
+ Prefer updating to next major version (default).
--strict
- Do not allow any gem to be updated past latest --patch | --minor
- | --major.
+ Do not allow any gem to be updated past latest --patch | --minor
+ | --major.
- When Bundler is resolving what versions to use to satisfy declared
- requirements in the Gemfile or in parent gems, it looks up all avail-
- able versions, filters out any versions that don't satisfy the require-
- ment, and then, by default, sorts them from newest to oldest, consider-
- ing them in that order.
+ When Bundler is resolving what versions to use to satisfy declared
+ requirements in the Gemfile or in parent gems, it looks up all
+ available versions, filters out any versions that don't satisfy the
+ requirement, and then, by default, sorts them from newest to oldest,
+ considering them in that order.
- Providing one of the patch level options (e.g. --patch) changes the
+ Providing one of the patch level options (e.g. --patch) changes the
sort order of the satisfying versions, causing Bundler to consider the
latest --patch or --minor version available before other versions. Note
that versions outside the stated patch level could still be resolved to
if necessary to find a suitable dependency graph.
For example, if gem 'foo' is locked at 1.0.2, with no gem requirement
- defined in the Gemfile, and versions 1.0.3, 1.0.4, 1.1.0, 1.1.1, 2.0.0
+ defined in the Gemfile, and versions 1.0.3, 1.0.4, 1.1.0, 1.1.1, 2.0.0
all exist, the default order of preference by default (--major) will be
"2.0.0, 1.1.1, 1.1.0, 1.0.4, 1.0.3, 1.0.2".
- If the --patch option is used, the order of preference will change to
+ If the --patch option is used, the order of preference will change to
"1.0.4, 1.0.3, 1.0.2, 1.1.1, 1.1.0, 2.0.0".
If the --minor option is used, the order of preference will change to
"1.1.1, 1.1.0, 1.0.4, 1.0.3, 1.0.2, 2.0.0".
Combining the --strict option with any of the patch level options will
- remove any versions beyond the scope of the patch level option, to
+ remove any versions beyond the scope of the patch level option, to
ensure that no gem is updated that far.
To continue the previous example, if both --patch and --strict options
are used, the available versions for resolution would be "1.0.4, 1.0.3,
- 1.0.2". If --minor and --strict are used, it would be "1.1.1, 1.1.0,
+ 1.0.2". If --minor and --strict are used, it would be "1.1.1, 1.1.0,
1.0.4, 1.0.3, 1.0.2".
- Gem requirements as defined in the Gemfile will still be the first
- determining factor for what versions are available. If the gem require-
- ment for foo in the Gemfile is '~> 1.0', that will accomplish the same
- thing as providing the --minor and --strict options.
+ Gem requirements as defined in the Gemfile will still be the first
+ determining factor for what versions are available. If the gem
+ requirement for foo in the Gemfile is '~> 1.0', that will accomplish
+ the same thing as providing the --minor and --strict options.
PATCH LEVEL EXAMPLES
Given the following gem specifications:
- foo 1.4.3, requires: ~> bar 2.0
- foo 1.4.4, requires: ~> bar 2.0
- foo 1.4.5, requires: ~> bar 2.1
- foo 1.5.0, requires: ~> bar 2.1
- foo 1.5.1, requires: ~> bar 3.0
- bar with versions 2.0.3, 2.0.4, 2.1.0, 2.1.1, 3.0.0
+ foo 1.4.3, requires: ~> bar 2.0
+ foo 1.4.4, requires: ~> bar 2.0
+ foo 1.4.5, requires: ~> bar 2.1
+ foo 1.5.0, requires: ~> bar 2.1
+ foo 1.5.1, requires: ~> bar 3.0
+ bar with versions 2.0.3, 2.0.4, 2.1.0, 2.1.1, 3.0.0
@@ -296,7 +296,7 @@ PATCH LEVEL EXAMPLES
- gem 'foo'
+ gem 'foo'
@@ -304,9 +304,9 @@ PATCH LEVEL EXAMPLES
- foo (1.4.3)
- bar (~> 2.0)
- bar (2.0.3)
+ foo (1.4.3)
+ bar (~> 2.0)
+ bar (2.0.3)
@@ -314,13 +314,13 @@ PATCH LEVEL EXAMPLES
- # Command Line Result
- ------------------------------------------------------------
- 1 bundle update --patch 'foo 1.4.5', 'bar 2.1.1'
- 2 bundle update --patch foo 'foo 1.4.5', 'bar 2.1.1'
- 3 bundle update --minor 'foo 1.5.1', 'bar 3.0.0'
- 4 bundle update --minor --strict 'foo 1.5.0', 'bar 2.1.1'
- 5 bundle update --patch --strict 'foo 1.4.4', 'bar 2.0.4'
+ # Command Line Result
+ ------------------------------------------------------------
+ 1 bundle update --patch 'foo 1.4.5', 'bar 2.1.1'
+ 2 bundle update --patch foo 'foo 1.4.5', 'bar 2.1.1'
+ 3 bundle update --minor 'foo 1.5.1', 'bar 3.0.0'
+ 4 bundle update --minor --strict 'foo 1.5.0', 'bar 2.1.1'
+ 5 bundle update --patch --strict 'foo 1.4.4', 'bar 2.0.4'
@@ -348,43 +348,44 @@ RECOMMENDED WORKFLOW
o After you create your Gemfile(5) for the first time, run
- $ bundle install
+ $ bundle install
o Check the resulting Gemfile.lock into version control
- $ git add Gemfile.lock
+ $ git add Gemfile.lock
o When checking out this repository on another development machine,
- run
+ run
- $ bundle install
+ $ bundle install
o When checking out this repository on a deployment machine, run
- $ bundle install --deployment
+ $ bundle install --deployment
- o After changing the Gemfile(5) to reflect a new or update depen-
- dency, run
+ o After changing the Gemfile(5) to reflect a new or update
+ dependency, run
- $ bundle install
+ $ bundle install
o Make sure to check the updated Gemfile.lock into version control
- $ git add Gemfile.lock
+ $ git add Gemfile.lock
- o If bundle install(1) bundle-install.1.html reports a conflict, man-
- ually update the specific gems that you changed in the Gemfile(5)
+ o If bundle install(1) bundle-install.1.html reports a conflict,
+ manually update the specific gems that you changed in the
+ Gemfile(5)
- $ bundle update rails thin
+ $ bundle update rails thin
- 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
+ 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
+ $ bundle update --all
- January 2020 BUNDLE-UPDATE(1)
+ May 2020 BUNDLE-UPDATE(1)
diff --git a/man/bundle-viz.1 b/man/bundle-viz.1
index a2153da28d..5e3f059122 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" "January 2020" "" ""
+.TH "BUNDLE\-VIZ" "1" "May 2020" "" ""
.
.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 c934b4cf5b..2dffec48ce 100644
--- a/man/bundle-viz.1.txt
+++ b/man/bundle-viz.1.txt
@@ -1,4 +1,4 @@
-BUNDLE-VIZ(1) BUNDLE-VIZ(1)
+BUNDLE-VIZ(1) BUNDLE-VIZ(1)
@@ -10,30 +10,30 @@ SYNOPSIS
[--without=GROUP GROUP]
DESCRIPTION
- viz generates a PNG file of the current Gemfile(5) as a dependency
+ viz generates a PNG file of the current Gemfile(5) as a dependency
graph. viz requires the ruby-graphviz gem (and its dependencies).
- The associated gems must also be installed via bundle install(1) bun-
- dle-install.1.html.
+ The associated gems must also be installed via bundle install(1)
+ bundle-install.1.html.
OPTIONS
--file, -f
- The name to use for the generated file. See --format option
+ The name to use for the generated file. See --format option
--format, -F
- This is output format option. Supported format is png, jpg, svg,
- dot ...
+ This is output format option. Supported format is png, jpg, svg,
+ dot ...
--requirements, -R
- Set to show the version of each required dependency.
+ Set to show the version of each required dependency.
--version, -v
- Set to show each gem version.
+ Set to show each gem version.
--without, -W
- Exclude gems that are part of the specified named group.
+ Exclude gems that are part of the specified named group.
- January 2020 BUNDLE-VIZ(1)
+ May 2020 BUNDLE-VIZ(1)
diff --git a/man/bundle.1 b/man/bundle.1
index 4a9a9bec4d..59e7841ed4 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" "January 2020" "" ""
+.TH "BUNDLE" "1" "May 2020" "" ""
.
.SH "NAME"
\fBbundle\fR \- Ruby Dependency Management
diff --git a/man/bundle.1.txt b/man/bundle.1.txt
index e7eb35aa14..8579d10943 100644
--- a/man/bundle.1.txt
+++ b/man/bundle.1.txt
@@ -1,4 +1,4 @@
-BUNDLE(1) BUNDLE(1)
+BUNDLE(1) BUNDLE(1)
@@ -9,7 +9,7 @@ SYNOPSIS
bundle COMMAND [--no-color] [--verbose] [ARGS]
DESCRIPTION
- Bundler manages an application's dependencies through its entire life
+ Bundler manages an application's dependencies through its entire life
across many machines systematically and repeatably.
See the bundler website https://bundler.io for information on getting
@@ -17,87 +17,87 @@ DESCRIPTION
OPTIONS
--no-color
- Print all output without color
+ Print all output without color
--retry, -r
- Specify the number of times you wish to attempt network commands
+ Specify the number of times you wish to attempt network commands
--verbose, -V
- Print out additional logging information
+ Print out additional logging information
BUNDLE COMMANDS
We divide bundle subcommands into primary commands and utilities:
PRIMARY COMMANDS
bundle install(1) bundle-install.1.html
- Install the gems specified by the Gemfile or Gemfile.lock
+ Install the gems specified by the Gemfile or Gemfile.lock
bundle update(1) bundle-update.1.html
- Update dependencies to their latest versions
+ Update dependencies to their latest versions
bundle package(1) bundle-package.1.html
- Package the .gem files required by your application into the
- vendor/cache directory
+ Package the .gem files required by your application into the
+ vendor/cache directory
bundle exec(1) bundle-exec.1.html
- Execute a script in the current bundle
+ Execute a script in the current bundle
bundle config(1) bundle-config.1.html
- Specify and read configuration options for Bundler
+ Specify and read configuration options for Bundler
bundle help(1)
- Display detailed help for each subcommand
+ Display detailed help for each subcommand
UTILITIES
bundle add(1) bundle-add.1.html
- Add the named gem to the Gemfile and run bundle install
+ Add the named gem to the Gemfile and run bundle install
bundle binstubs(1) bundle-binstubs.1.html
- Generate binstubs for executables in a gem
+ Generate binstubs for executables in a gem
bundle check(1) bundle-check.1.html
- Determine whether the requirements for your application are
- installed and available to Bundler
+ Determine whether the requirements for your application are
+ installed and available to Bundler
bundle show(1) bundle-show.1.html
- Show the source location of a particular gem in the bundle
+ Show the source location of a particular gem in the bundle
bundle outdated(1) bundle-outdated.1.html
- Show all of the outdated gems in the current bundle
+ Show all of the outdated gems in the current bundle
bundle console(1)
- Start an IRB session in the current bundle
+ Start an IRB session in the current bundle
bundle open(1) bundle-open.1.html
- Open an installed gem in the editor
+ Open an installed gem in the editor
bundle lock(1) bundle-lock.1.html
- Generate a lockfile for your dependencies
+ Generate a lockfile for your dependencies
bundle viz(1) bundle-viz.1.html
- Generate a visual representation of your dependencies
+ Generate a visual representation of your dependencies
bundle init(1) bundle-init.1.html
- Generate a simple Gemfile, placed in the current directory
+ Generate a simple Gemfile, placed in the current directory
bundle gem(1) bundle-gem.1.html
- Create a simple gem, suitable for development with Bundler
+ Create a simple gem, suitable for development with Bundler
bundle platform(1) bundle-platform.1.html
- Display platform compatibility information
+ Display platform compatibility information
bundle clean(1) bundle-clean.1.html
- Clean up unused gems in your Bundler directory
+ Clean up unused gems in your Bundler directory
bundle doctor(1) bundle-doctor.1.html
- Display warnings about common problems
+ Display warnings about common problems
bundle remove(1) bundle-remove.1.html
- Removes gems from the Gemfile
+ 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
+ When running a command that isn't listed in PRIMARY COMMANDS or
+ UTILITIES, Bundler will try to find an executable on your path named
bundler-<command> and execute it, passing down any extra arguments to
it.
@@ -113,4 +113,4 @@ OBSOLETE
- January 2020 BUNDLE(1)
+ May 2020 BUNDLE(1)
diff --git a/man/gemfile.5 b/man/gemfile.5
index a9d2cee7c7..aceb361812 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" "January 2020" "" ""
+.TH "GEMFILE" "5" "May 2020" "" ""
.
.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 71d2513271..17e70ede6f 100644
--- a/man/gemfile.5.txt
+++ b/man/gemfile.5.txt
@@ -1,4 +1,4 @@
-GEMFILE(5) GEMFILE(5)
+GEMFILE(5) GEMFILE(5)
@@ -9,21 +9,21 @@ SYNOPSIS
A Gemfile describes the gem dependencies required to execute associated
Ruby code.
- Place the Gemfile in the root of the directory containing the associ-
- ated code. For instance, in a Rails application, place the Gemfile in
- the same directory as the Rakefile.
+ Place the Gemfile in the root of the directory containing the
+ associated code. For instance, in a Rails application, place the
+ Gemfile in the same directory as the Rakefile.
SYNTAX
A Gemfile is evaluated as Ruby code, in a context which makes available
a number of methods used to describe the gem requirements.
GLOBAL SOURCES
- At the top of the Gemfile, add a line for the Rubygems source that con-
- tains the gems listed in the Gemfile.
+ At the top of the Gemfile, add a line for the Rubygems source that
+ contains the gems listed in the Gemfile.
- source "https://rubygems.org"
+ source "https://rubygems.org"
@@ -31,24 +31,24 @@ GLOBAL SOURCES
global source lines. Each of these sources MUST be a valid Rubygems
repository.
- Sources are checked for gems following the heuristics described in
+ Sources are checked for gems following the heuristics described in
SOURCE PRIORITY. If a gem is found in more than one global source,
Bundler will print a warning after installing the gem indicating which
- source was used, and listing the other sources where the gem is avail-
- able. A specific source can be selected for gems that need to use a
- non-standard repository, suppressing this warning, by using the :source
- option or a source block.
+ source was used, and listing the other sources where the gem is
+ available. A specific source can be selected for gems that need to use
+ a non-standard repository, suppressing this warning, by using the
+ :source option or a source block.
CREDENTIALS
Some gem sources require a username and password. Use bundle config(1)
bundle-config.1.html to set the username and password for any of the
- sources that need it. The command must be run once on each computer
+ sources that need it. The command must be run once on each computer
that will install the Gemfile, but this keeps the credentials from
being stored in plain text in version control.
- bundle config gems.example.com user:password
+ bundle config gems.example.com user:password
@@ -57,7 +57,7 @@ GLOBAL SOURCES
- source "https://user:password@gems.example.com"
+ source "https://user:password@gems.example.com"
@@ -71,13 +71,13 @@ RUBY
VERSION (required)
The version of Ruby that your application requires. If your application
- requires an alternate Ruby engine, such as JRuby, Rubinius or Truf-
- fleRuby, this should be the Ruby version that the engine is compatible
- with.
+ requires an alternate Ruby engine, such as JRuby, Rubinius or
+ TruffleRuby, this should be the Ruby version that the engine is
+ compatible with.
- ruby "1.9.3"
+ ruby "1.9.3"
@@ -88,29 +88,29 @@ RUBY
What exactly is an Engine? - A Ruby engine is an implementation of the
Ruby language.
- o For background: the reference or original implementation of the
- Ruby programming language is called Matz's Ruby Interpreter
- https://en.wikipedia.org/wiki/Ruby_MRI, or MRI for short. This is
- named after Ruby creator Yukihiro Matsumoto, also known as Matz.
- MRI is also known as CRuby, because it is written in C. MRI is the
- most widely used Ruby engine.
+ o For background: the reference or original implementation of the
+ Ruby programming language is called Matz's Ruby Interpreter
+ https://en.wikipedia.org/wiki/Ruby_MRI, or MRI for short. This is
+ named after Ruby creator Yukihiro Matsumoto, also known as Matz.
+ MRI is also known as CRuby, because it is written in C. MRI is the
+ most widely used Ruby engine.
o Other implementations https://www.ruby-lang.org/en/about/ of 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.
+ 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.
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
- "ruby" the engine version specified must match the Ruby version.
+ Each application may specify a Ruby engine version. If an engine
+ version is specified, an engine must also be specified. If the engine
+ is "ruby" the engine version specified must match the Ruby version.
- ruby "1.8.7", :engine => "jruby", :engine_version => "1.6.7"
+ ruby "1.8.7", :engine => "jruby", :engine_version => "1.6.7"
@@ -119,20 +119,20 @@ RUBY
- ruby "2.0.0", :patchlevel => "247"
+ ruby "2.0.0", :patchlevel => "247"
GEMS
- Specify gem requirements using the gem method, with the following argu-
- ments. All parameters are OPTIONAL unless otherwise specified.
+ Specify gem requirements using the gem method, with the following
+ arguments. All parameters are OPTIONAL unless otherwise specified.
NAME (required)
For each gem requirement, list a single gem line.
- gem "nokogiri"
+ gem "nokogiri"
@@ -141,22 +141,22 @@ GEMS
- gem "nokogiri", ">= 1.4.2"
- gem "RedCloth", ">= 4.1.0", "< 4.2.0"
+ gem "nokogiri", ">= 1.4.2"
+ gem "RedCloth", ">= 4.1.0", "< 4.2.0"
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
+ file you want required has same name as gem or false to prevent any
file from being autorequired.
- gem "redis", :require => ["redis/connection/hiredis", "redis"]
- gem "webmock", :require => false
- gem "byebug", :require => true
+ gem "redis", :require => ["redis/connection/hiredis", "redis"]
+ gem "webmock", :require => false
+ gem "byebug", :require => true
@@ -165,21 +165,21 @@ GEMS
- gem "nokogiri"
- gem "nokogiri", :require => "nokogiri"
- gem "nokogiri", :require => true
+ gem "nokogiri"
+ gem "nokogiri", :require => "nokogiri"
+ gem "nokogiri", :require => true
GROUPS
- Each gem MAY specify membership in one or more groups. Any gem that
+ 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.
- gem "rspec", :group => :test
- gem "wirble", :groups => [:development, :test]
+ gem "rspec", :group => :test
+ gem "wirble", :groups => [:development, :test]
@@ -188,47 +188,47 @@ GEMS
- # setup adds gems to Ruby's load path
- Bundler.setup # defaults to all groups
- require "bundler/setup" # same as Bundler.setup
- Bundler.setup(:default) # only set up the _default_ group
- Bundler.setup(:test) # only set up the _test_ group (but `not` _default_)
- Bundler.setup(:default, :test) # set up the _default_ and _test_ groups, but no others
+ # setup adds gems to Ruby's load path
+ Bundler.setup # defaults to all groups
+ require "bundler/setup" # same as Bundler.setup
+ Bundler.setup(:default) # only set up the _default_ group
+ Bundler.setup(:test) # only set up the _test_ group (but `not` _default_)
+ Bundler.setup(:default, :test) # set up the _default_ and _test_ groups, but no others
- # require requires all of the gems in the specified groups
- Bundler.require # defaults to the _default_ group
- Bundler.require(:default) # identical
- Bundler.require(:default, :test) # requires the _default_ and _test_ groups
- Bundler.require(:test) # requires the _test_ group
+ # require requires all of the gems in the specified groups
+ Bundler.require # defaults to the _default_ group
+ Bundler.require(:default) # identical
+ Bundler.require(:default, :test) # requires the _default_ and _test_ groups
+ Bundler.require(:test) # requires the _test_ group
- The Bundler CLI allows you to specify a list of groups whose gems bun-
- dle install should not install with the without configuration.
+ The Bundler CLI allows you to specify a list of groups whose gems
+ bundle install should not install with the without configuration.
- To specify multiple groups to ignore, specify a list of groups sepa-
- rated by spaces.
+ To specify multiple groups to ignore, specify a list of groups
+ separated by spaces.
- bundle config set without test
- bundle config set without development test
+ bundle config set without test
+ bundle config set without development test
Also, calling Bundler.setup with no parameters, or calling require
- "bundler/setup" will setup all groups except for the ones you excluded
+ "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
+ and their dependencies. This means that you cannot list different
+ versions 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
+ If a gem should only be used in a particular platform or set of
+ platforms, 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.
@@ -241,27 +241,27 @@ GEMS
mingw Windows 32 bit 'mingw32' platform (aka RubyInstaller)
x64_mingw
- Windows 64 bit 'mingw32' platform (aka RubyInstaller x64)
+ Windows 64 bit 'mingw32' platform (aka RubyInstaller x64)
rbx Rubinius
jruby JRuby
truffleruby
- TruffleRuby
+ TruffleRuby
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-
- ber without the delimiter to the platform. For example, to specify that
- a gem should only be used on platforms with Ruby 2.3, use:
+ To specify a version in addition to a platform, append the version
+ number without the delimiter to the platform. For example, to specify
+ that a gem should only be used on platforms with Ruby 2.3, use:
- ruby_23
+ ruby_23
@@ -274,19 +274,19 @@ GEMS
mingw 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
x64_mingw
- 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
+ 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
As with groups, you can specify one or more platforms:
- gem "weakling", :platforms => :jruby
- gem "ruby-debug", :platforms => :mri_18
- gem "nokogiri", :platforms => [:mri_18, :jruby]
+ gem "weakling", :platforms => :jruby
+ gem "ruby-debug", :platforms => :mri_18
+ gem "nokogiri", :platforms => [:mri_18, :jruby]
- All operations involving groups (bundle install bundle-install.1.html,
+ 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.
@@ -296,7 +296,7 @@ GEMS
- gem "some_internal_gem", :source => "https://gems.example.com"
+ gem "some_internal_gem", :source => "https://gems.example.com"
@@ -314,7 +314,7 @@ GEMS
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
+ 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.
@@ -324,7 +324,7 @@ GEMS
several protocols:
HTTP(S)
- gem "rails", :git => "https://github.com/rails/rails.git"
+ gem "rails", :git => "https://github.com/rails/rails.git"
SSH gem "rails", :git => "git@github.com:rails/rails.git"
@@ -333,95 +333,95 @@ 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.
+ 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
+ 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
create one, but it will not contain any dependencies, executables, or C
- extension compilation instructions. As a result, it may fail to prop-
- erly integrate into your application.
+ extension compilation instructions. As a result, it may fail to
+ properly 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
+ only valid if the .gemspec specifies a version matching the version
specifier. If not, bundler will print a warning.
- gem "rails", "2.3.8", :git => "https://github.com/rails/rails.git"
- # bundle install will fail, because the .gemspec in the rails
- # repository's master branch specifies version 3.0.0
+ gem "rails", "2.3.8", :git => "https://github.com/rails/rails.git"
+ # bundle install will fail, because the .gemspec in the rails
+ # repository's master branch specifies version 3.0.0
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.
+ it to, a version specifier MUST be provided. Bundler will use this
+ version 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
- is :branch => "master". For example:
+ 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",
- :branch => "5-0-stable"
+ gem "rails", :git => "https://github.com/rails/rails.git",
+ :branch => "5-0-stable"
- gem "rails", :git => "https://github.com/rails/rails.git", :tag
- => "v5.0.0"
+ gem "rails", :git => "https://github.com/rails/rails.git", :tag
+ => "v5.0.0"
- gem "rails", :git => "https://github.com/rails/rails.git", :ref
- => "4aded"
+ gem "rails", :git => "https://github.com/rails/rails.git", :ref
+ => "4aded"
submodules
- 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-
- tory. Specify :submodules => true to cause bundler to expand any
- submodules included in the git repository
+ 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
+ repository. 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-
- spec.
+ If a git repository contains multiple .gemspecs, each .gemspec
+ represents a gem located at the same place in the file system as the
+ .gemspec.
- |~rails [git root]
- | |-rails.gemspec [rails gem located here]
- |~actionpack
- | |-actionpack.gemspec [actionpack gem located here]
- |~activesupport
- | |-activesupport.gemspec [activesupport gem located here]
- |...
+ |~rails [git root]
+ | |-rails.gemspec [rails gem located here]
+ |~actionpack
+ | |-actionpack.gemspec [actionpack gem located here]
+ |~activesupport
+ | |-activesupport.gemspec [activesupport gem located here]
+ |...
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
+ 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:
- git_source(:stash){ |repo_name| "https://stash.corp.acme.pl/#{repo_name}.git" }
- gem 'rails', :stash => 'forks/rails'
+ git_source(:stash){ |repo_name| "https://stash.corp.acme.pl/#{repo_name}.git" }
+ gem 'rails', :stash => 'forks/rails'
@@ -429,25 +429,25 @@ GEMS
- gem "rails", :stash => "forks/rails", :branch => "branch_name"
+ gem "rails", :stash => "forks/rails", :branch => "branch_name"
GITHUB
- NOTE: This shorthand should be avoided until Bundler 2.0, since it cur-
- rently expands to an insecure git:// URL. This allows a man-in-the-mid-
- dle attacker to compromise your system.
+ NOTE: This shorthand should be avoided until Bundler 2.0, since it
+ currently expands to an insecure git:// URL. This allows a
+ man-in-the-middle 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
- omit one.
+ If the git repository you want to use is hosted on GitHub and is
+ public, 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.
- gem "rails", :github => "rails/rails"
- gem "rails", :github => "rails"
+ gem "rails", :github => "rails/rails"
+ gem "rails", :github => "rails"
@@ -455,7 +455,7 @@ GEMS
- gem "rails", :git => "git://github.com/rails/rails.git"
+ gem "rails", :git => "git://github.com/rails/rails.git"
@@ -469,7 +469,7 @@ GEMS
- gem "the_hatch", :gist => "4815162342"
+ gem "the_hatch", :gist => "4815162342"
@@ -477,7 +477,7 @@ GEMS
- gem "the_hatch", :git => "https://gist.github.com/4815162342.git"
+ gem "the_hatch", :git => "https://gist.github.com/4815162342.git"
@@ -485,16 +485,16 @@ GEMS
: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
+ 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.
- gem "rails", :bitbucket => "rails/rails"
- gem "rails", :bitbucket => "rails"
+ gem "rails", :bitbucket => "rails/rails"
+ gem "rails", :bitbucket => "rails"
@@ -502,19 +502,19 @@ GEMS
- gem "rails", :git => "https://rails@bitbucket.org/rails/rails.git"
+ gem "rails", :git => "https://rails@bitbucket.org/rails/rails.git"
- 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
- file system. Relative paths are resolved relative to the directory con-
- taining the Gemfile.
+ file system. Relative paths are resolved relative to the directory
+ containing the Gemfile.
- Similar to the semantics of the :git option, the :path option requires
+ 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.
@@ -523,20 +523,21 @@ GEMS
- gem "rails", :path => "vendor/rails"
+ gem "rails", :path => "vendor/rails"
- 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.
+ If you would like to use multiple local gems directly from the
+ filesystem, you can set a global path option to the path containing the
+ gem's files. This will automatically load gemspec files from
+ subdirectories.
- path 'components' do
- gem 'admin_ui'
- gem 'public_ui'
- end
+ path 'components' do
+ gem 'admin_ui'
+ gem 'public_ui'
+ end
@@ -546,104 +547,105 @@ BLOCK FORM OF SOURCE, GIT, PATH, GROUP and PLATFORMS
- source "https://gems.example.com" do
- gem "some_internal_gem"
- gem "another_internal_gem"
- end
+ source "https://gems.example.com" do
+ gem "some_internal_gem"
+ gem "another_internal_gem"
+ end
- git "https://github.com/rails/rails.git" do
- gem "activesupport"
- gem "actionpack"
- end
+ git "https://github.com/rails/rails.git" do
+ gem "activesupport"
+ gem "actionpack"
+ end
- platforms :ruby do
- gem "ruby-debug"
- gem "sqlite3"
- end
+ platforms :ruby do
+ gem "ruby-debug"
+ gem "sqlite3"
+ end
- group :development, :optional => true do
- gem "wirble"
- gem "faker"
- end
+ group :development, :optional => true do
+ gem "wirble"
+ gem "faker"
+ end
- In the case of the group block form the :optional option can be given
- to prevent a group from being installed unless listed in the --with
+ In the case of the group block form the :optional option can be given
+ to prevent a group from being installed unless listed in the --with
option given to the bundle install command.
- In the case of the git block form, the :ref, :branch, :tag, and :sub-
- modules options may be passed to the git method, and all gems in the
- block will inherit those options.
+ In the case of the git block form, the :ref, :branch, :tag, and
+ :submodules options may be passed to the git method, and all gems in
+ the block will inherit those options.
- The presence of a source block in a Gemfile also makes that source
- available as a possible global source for any other gems which do not
- specify explicit sources. Thus, when defining source blocks, it is rec-
- ommended that you also ensure all other gems in the Gemfile are using
- explicit sources, either via source blocks or :source directives on
- individual gems.
+ The presence of a source block in a Gemfile also makes that source
+ available as a possible global source for any other gems which do not
+ specify explicit sources. Thus, when defining source blocks, it is
+ recommended that you also ensure all other gems in the Gemfile are
+ using explicit sources, either via source blocks or :source directives
+ on individual gems.
INSTALL_IF
- The install_if method allows gems to be installed based on a proc or
- lambda. This is especially useful for optional gems that can only be
+ The install_if method allows gems to be installed based on a proc or
+ lambda. This is especially useful for optional gems that can only be
used if certain software is installed or some other conditions are met.
- install_if -> { RUBY_PLATFORM =~ /darwin/ } do
- gem "pasteboard"
- end
+ install_if -> { RUBY_PLATFORM =~ /darwin/ } do
+ gem "pasteboard"
+ end
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-
- cies listed in the .gemspec file.
+ it is being developed, use the gemspec method to pull in the
+ dependencies 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-
- 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
- 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
- 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
- for the gemspec gem.
+ the default group. It also adds development dependencies as gem
+ requirements in the development group. Finally, it adds a gem
+ requirement 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 load path manually or require project files via relative
+ paths.
+
+ The gemspec method supports optional :path, :glob, :name, and
+ :development_group options, which control where bundler looks for the
+ .gemspec, the glob it uses to look for the gemspec (defaults to:
+ "{,,/*}.gemspec"), 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
+ resolution, 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
uses the following priority order:
1. The source explicitly attached to the gem (using :source, :path, or
- :git)
+ :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
- over ones from rubygems.org
+ 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
- source in your Gemfile from last added to first added.
+ source in your Gemfile from last added to first added.
- January 2020 GEMFILE(5)
+ May 2020 GEMFILE(5)
diff --git a/spec/bundler/bundler/bundler_spec.rb b/spec/bundler/bundler/bundler_spec.rb
index 247838600b..56ef4ce75a 100644
--- a/spec/bundler/bundler/bundler_spec.rb
+++ b/spec/bundler/bundler/bundler_spec.rb
@@ -124,7 +124,15 @@ RSpec.describe Bundler do
describe "#which" do
let(:executable) { "executable" }
- let(:path) { %w[/a /b c ../d /e] }
+
+ let(:path) do
+ if Gem.win_platform?
+ %w[C:/a C:/b C:/c C:/../d C:/e]
+ else
+ %w[/a /b c ../d /e]
+ end
+ end
+
let(:expected) { "executable" }
before do
@@ -149,7 +157,13 @@ RSpec.describe Bundler do
it_behaves_like "it returns the correct executable"
context "when the executable in inside a quoted path" do
- let(:expected) { "/e/executable" }
+ let(:expected) do
+ if Gem.win_platform?
+ "C:/e/executable"
+ else
+ "/e/executable"
+ end
+ end
it_behaves_like "it returns the correct executable"
end
@@ -196,6 +210,8 @@ EOF
gem "rack"
G
+ allow(Bundler).to receive(:root).and_return(bundled_app)
+
Bundler.mkdir_p(bundled_app.join("foo", "bar"))
expect(bundled_app.join("foo", "bar")).to exist
end
@@ -322,7 +338,7 @@ EOF
end
context "with unwritable files in a parent dir" do
- # Regression test for https://github.com/bundler/bundler/pull/6316
+ # Regression test for https://github.com/rubygems/bundler/pull/6316
# It doesn't matter if there are other unwritable files so long as
# bundle_path can be created
before do
diff --git a/spec/bundler/bundler/cli_spec.rb b/spec/bundler/bundler/cli_spec.rb
index ddcd699d6c..a56e148e89 100644
--- a/spec/bundler/bundler/cli_spec.rb
+++ b/spec/bundler/bundler/cli_spec.rb
@@ -14,6 +14,8 @@ RSpec.describe "bundle executable" do
end
it "looks for a binary and executes it if it's named bundler-<task>" do
+ skip "obscure error" if Gem.win_platform?
+
File.open(tmp("bundler-testtasks"), "w", 0o755) do |f|
ruby = ENV["RUBY"] || "/usr/bin/env ruby"
f.puts "#!#{ruby}\nputs 'Hello, world'\n"
@@ -91,7 +93,7 @@ RSpec.describe "bundle executable" do
context "when ENV['BUNDLE_GEMFILE'] is set to an empty string" do
it "ignores it" do
- gemfile bundled_app("Gemfile"), <<-G
+ gemfile bundled_app_gemfile, <<-G
source "#{file_uri_for(gem_repo1)}"
gem 'rack'
G
@@ -104,7 +106,7 @@ RSpec.describe "bundle executable" do
context "when ENV['RUBYGEMS_GEMDEPS'] is set" do
it "displays a warning" do
- gemfile bundled_app("Gemfile"), <<-G
+ gemfile bundled_app_gemfile, <<-G
source "#{file_uri_for(gem_repo1)}"
gem 'rack'
G
@@ -149,7 +151,7 @@ RSpec.describe "bundle executable" do
before do
bundle! "config set --global disable_version_check false"
- simulate_bundler_version(bundler_version)
+ system_gems "bundler-#{bundler_version}"
if latest_version
info_path = home(".bundle/cache/compact_index/rubygems.org.443.29b0360b937aa4d161703e6160654e47/info/bundler")
info_path.parent.mkpath
@@ -174,7 +176,7 @@ RSpec.describe "bundle executable" do
context "when the latest version is greater than the current version" do
let(:latest_version) { "222.0" }
it "prints the version warning" do
- bundle "fail"
+ bundle "fail", :system_bundler => true, :env => { "BUNDLER_SPEC_IGNORE_DEFAULT_BUNDLER_GEM" => "true" }
expect(err).to start_with(<<-EOS.strip)
The latest bundler is #{latest_version}, but you are currently running #{bundler_version}.
To install the latest version, run `gem install bundler`
@@ -199,7 +201,7 @@ To install the latest version, run `gem install bundler`
context "and is a pre-release" do
let(:latest_version) { "222.0.0.pre.4" }
it "prints the version warning" do
- bundle "fail"
+ bundle "fail", :system_bundler => true, :env => { "BUNDLER_SPEC_IGNORE_DEFAULT_BUNDLER_GEM" => "true" }
expect(err).to start_with(<<-EOS.strip)
The latest bundler is #{latest_version}, but you are currently running #{bundler_version}.
To install the latest version, run `gem install bundler --pre`
diff --git a/spec/bundler/bundler/compact_index_client/gem_parser_spec.rb b/spec/bundler/bundler/compact_index_client/gem_parser_spec.rb
new file mode 100644
index 0000000000..5f5305426f
--- /dev/null
+++ b/spec/bundler/bundler/compact_index_client/gem_parser_spec.rb
@@ -0,0 +1,174 @@
+# frozen_string_literal: true
+
+require "bundler/compact_index_client/gem_parser"
+
+RSpec.describe Bundler::CompactIndexClient::GemParser do
+ def parse(line)
+ parser = Bundler::CompactIndexClient::GemParser.new
+ parser.parse(line)
+ end
+
+ context "platform" do
+ it "existent" do
+ checksum = "d5956d2bcb509af2cd07c90d9e5fdb331be8845a75bfd823a31c147b52cff471"
+ line = "1.11.3-java |checksum:#{checksum}"
+ expected = [
+ "1.11.3",
+ "java",
+ [],
+ [
+ ["checksum", [checksum]],
+ ],
+ ]
+ expect(parse(line)).to eq expected
+ end
+
+ it "nonexistent" do
+ checksum = "6da2eb3c4867e64df28d3e0b1008422dfacda7c046f9a8f3c56c52505b195e81"
+ line = "1.11.3 |checksum:#{checksum}"
+ expected = [
+ "1.11.3",
+ nil,
+ [],
+ [
+ ["checksum", [checksum]],
+ ],
+ ]
+ expect(parse(line)).to eq expected
+ end
+ end
+
+ context "dependencies" do
+ it "nothing" do
+ checksum = "6da2eb3c4867e64df28d3e0b1008422dfacda7c046f9a8f3c56c52505b195e81"
+ line = "1.11.3 |checksum:#{checksum}"
+ expected = [
+ "1.11.3",
+ nil,
+ [],
+ [
+ ["checksum", [checksum]],
+ ],
+ ]
+ expect(parse(line)).to eq expected
+ end
+
+ it "one" do
+ checksum = "5f0b378d12ab5665e2b6a1525274de97350238963002583cf088dae988527647"
+ line = "0.3.2 bones:>= 2.4.2|checksum:#{checksum}"
+ expected = [
+ "0.3.2",
+ nil,
+ [
+ ["bones", [">= 2.4.2"]],
+ ],
+ [
+ ["checksum", [checksum]],
+ ],
+ ]
+ expect(parse(line)).to eq expected
+ end
+
+ it "multiple" do
+ checksum = "199e892ada86c44d1f2e110b822d5da46b52fa2cbd2f00d89695b4cf610f9927"
+ line = "3.1.2 native-package-installer:>= 0,pkg-config:>= 0|checksum:#{checksum}"
+ expected = [
+ "3.1.2",
+ nil,
+ [
+ ["native-package-installer", [">= 0"]],
+ ["pkg-config", [">= 0"]],
+ ],
+ [
+ ["checksum", [checksum]],
+ ],
+ ]
+ expect(parse(line)).to eq expected
+ end
+
+ context "version" do
+ it "multiple" do
+ checksum = "1ec894b8090cb2c9393153552be2f3b6b1975265cbc1e0a3c6b28ebfea7e76a1"
+ line = "3.1.5 multi_json:< 1.3&>= 1.0|checksum:#{checksum}"
+ expected = [
+ "3.1.5",
+ nil,
+ [
+ ["multi_json", ["< 1.3", ">= 1.0"]],
+ ],
+ [
+ ["checksum", [checksum]],
+ ],
+ ]
+ expect(parse(line)).to eq expected
+ end
+ end
+ end
+
+ context "requirements" do
+ context "ruby" do
+ it "one version" do
+ checksum ="6da2eb3c4867e64df28d3e0b1008422dfacda7c046f9a8f3c56c52505b195e81"
+ line = "1.11.3 |checksum:#{checksum},ruby:>= 2.0"
+ expected = [
+ "1.11.3",
+ nil,
+ [],
+ [
+ ["checksum", [checksum]],
+ ["ruby", [">= 2.0"]],
+ ],
+ ]
+ expect(parse(line)).to eq expected
+ end
+
+ it "multiple versions" do
+ checksum = "99e4845796c8dec1c3fc80dc772860a01633b33291bd7534007f5c7724f0b876"
+ line = "1.11.3-x86-mingw32 |checksum:#{checksum},ruby:>= 2.2, < 2.7.dev"
+ expected = [
+ "1.11.3",
+ "x86-mingw32",
+ [],
+ [
+ ["checksum", [checksum]],
+ ["ruby", [">= 2.2", "< 2.7.dev"]],
+ ],
+ ]
+ expect(parse(line)).to eq expected
+ end
+
+ it "with rubygems" do
+ checksum = "7a82b358f00da749b01f8c84df8e8eb21c1bc389740aab9a2bf4ce59894564ac"
+ line = "1.9.23.pre1 |checksum:#{checksum},ruby:>= 1.9, < 2.7.dev,rubygems:> 1.3.1"
+ expected = [
+ "1.9.23.pre1",
+ nil,
+ [],
+ [
+ ["checksum", [checksum]],
+ ["ruby", [">= 1.9", "< 2.7.dev"]],
+ ["rubygems", ["> 1.3.1"]],
+ ],
+ ]
+ expect(parse(line)).to eq expected
+ end
+ end
+
+ context "rubygems" do
+ it "existent" do
+ checksum = "91ddb4c1b5482a4aff957f6733e282ce2767b2d3051138e0203e39d6df4eba10"
+ line = "1.0.12.pre |checksum:#{checksum},rubygems:> 1.3.1"
+ expected = [
+ "1.0.12.pre",
+ nil,
+ [],
+ [
+ ["checksum", [checksum]],
+ ["rubygems", ["> 1.3.1"]],
+ ],
+ ]
+ expect(parse(line)).to eq expected
+ end
+ end
+ end
+end
diff --git a/spec/bundler/bundler/compact_index_client/updater_spec.rb b/spec/bundler/bundler/compact_index_client/updater_spec.rb
index fd554a7b0d..26159dccd8 100644
--- a/spec/bundler/bundler/compact_index_client/updater_spec.rb
+++ b/spec/bundler/bundler/compact_index_client/updater_spec.rb
@@ -9,10 +9,10 @@ RSpec.describe Bundler::CompactIndexClient::Updater do
let(:local_path) { Pathname("/tmp/localpath") }
let(:remote_path) { double(:remote_path) }
- subject(:updater) { described_class.new(fetcher) }
+ let!(:updater) { described_class.new(fetcher) }
context "when the ETag header is missing" do
- # Regression test for https://github.com/bundler/bundler/issues/5463
+ # Regression test for https://github.com/rubygems/bundler/issues/5463
let(:response) { double(:response, :body => "") }
@@ -42,8 +42,6 @@ RSpec.describe Bundler::CompactIndexClient::Updater do
end
context "when bundler doesn't have permissions on Dir.tmpdir" do
- let(:response) { double(:response, :body => "") }
-
it "Errno::EACCES is raised" do
allow(Dir).to receive(:mktmpdir) { raise Errno::EACCES }
diff --git a/spec/bundler/bundler/definition_spec.rb b/spec/bundler/bundler/definition_spec.rb
index 1f4c1a0807..d0ebb37933 100644
--- a/spec/bundler/bundler/definition_spec.rb
+++ b/spec/bundler/bundler/definition_spec.rb
@@ -210,10 +210,12 @@ RSpec.describe Bundler::Definition do
source "#{file_uri_for(gem_repo1)}"
gem "foo"
G
+
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
end
it "should get a locked specs list when updating all" do
- definition = Bundler::Definition.new(bundled_app("Gemfile.lock"), [], Bundler::SourceList.new, true)
+ definition = Bundler::Definition.new(bundled_app_lock, [], Bundler::SourceList.new, true)
locked_specs = definition.gem_version_promoter.locked_specs
expect(locked_specs.to_a.map(&:name)).to eq ["foo"]
expect(definition.instance_variable_get("@locked_specs").empty?).to eq true
@@ -267,6 +269,8 @@ RSpec.describe Bundler::Definition do
BUNDLED WITH
1.13.0
L
+
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
end
it "should not eagerly unlock shared dependency with bundle install conservative updating behavior" do
@@ -275,7 +279,7 @@ RSpec.describe Bundler::Definition do
Bundler::Dependency.new("shared_owner_b", ">= 0")]
unlock_hash_for_bundle_install = {}
definition = Bundler::Definition.new(
- bundled_app("Gemfile.lock"),
+ bundled_app_lock,
updated_deps_in_gemfile,
source_list,
unlock_hash_for_bundle_install
@@ -289,7 +293,7 @@ RSpec.describe Bundler::Definition do
Bundler::Dependency.new("shared_owner_a", ">= 0"),
Bundler::Dependency.new("shared_owner_b", ">= 0")]
definition = Bundler::Definition.new(
- bundled_app("Gemfile.lock"),
+ bundled_app_lock,
updated_deps_in_gemfile,
source_list,
:gems => ["shared_owner_a"], :lock_shared_dependencies => true
diff --git a/spec/bundler/bundler/dsl_spec.rb b/spec/bundler/bundler/dsl_spec.rb
index 40739a431b..9299c014af 100644
--- a/spec/bundler/bundler/dsl_spec.rb
+++ b/spec/bundler/bundler/dsl_spec.rb
@@ -72,7 +72,7 @@ RSpec.describe Bundler::Dsl do
describe "#method_missing" do
it "raises an error for unknown DSL methods" do
- expect(Bundler).to receive(:read_file).with(bundled_app("Gemfile").to_s).
+ expect(Bundler).to receive(:read_file).with(root.join("Gemfile").to_s).
and_return("unknown")
error_msg = "There was an error parsing `Gemfile`: Undefined local variable or method `unknown' for Gemfile. Bundler cannot continue."
@@ -83,13 +83,13 @@ RSpec.describe Bundler::Dsl do
describe "#eval_gemfile" do
it "handles syntax errors with a useful message" do
- expect(Bundler).to receive(:read_file).with(bundled_app("Gemfile").to_s).and_return("}")
+ expect(Bundler).to receive(:read_file).with(root.join("Gemfile").to_s).and_return("}")
expect { subject.eval_gemfile("Gemfile") }.
to raise_error(Bundler::GemfileError, /There was an error parsing `Gemfile`: (syntax error, unexpected tSTRING_DEND|(compile error - )?syntax error, unexpected '\}'). Bundler cannot continue./)
end
it "distinguishes syntax errors from evaluation errors" do
- expect(Bundler).to receive(:read_file).with(bundled_app("Gemfile").to_s).and_return(
+ expect(Bundler).to receive(:read_file).with(root.join("Gemfile").to_s).and_return(
"ruby '2.1.5', :engine => 'ruby', :engine_version => '1.2.4'"
)
expect { subject.eval_gemfile("Gemfile") }.
@@ -174,40 +174,6 @@ RSpec.describe Bundler::Dsl do
end
end
- describe "#gemspec" do
- let(:spec) do
- Gem::Specification.new do |gem|
- gem.name = "example"
- gem.platform = platform
- end
- end
-
- before do
- allow(Dir).to receive(:[]).and_return(["spec_path"])
- allow(Bundler).to receive(:load_gemspec).with("spec_path").and_return(spec)
- allow(Bundler).to receive(:default_gemfile).and_return(Pathname.new("./Gemfile"))
- end
-
- context "with a ruby platform" do
- let(:platform) { "ruby" }
-
- it "keeps track of the ruby platforms in the dependency" do
- subject.gemspec
- expect(subject.dependencies.last.platforms).to eq(Bundler::Dependency::REVERSE_PLATFORM_MAP[Gem::Platform::RUBY])
- end
- end
-
- context "with a jruby platform" do
- let(:platform) { "java" }
-
- it "keeps track of the jruby platforms in the dependency" do
- allow(Gem::Platform).to receive(:local).and_return(java)
- subject.gemspec
- expect(subject.dependencies.last.platforms).to eq(Bundler::Dependency::REVERSE_PLATFORM_MAP[Gem::Platform::JAVA])
- end
- end
- end
-
context "can bundle groups of gems with" do
# git "https://github.com/rails/rails.git" do
# gem "railties"
@@ -270,7 +236,7 @@ RSpec.describe Bundler::Dsl do
describe "syntax errors" do
it "will raise a Bundler::GemfileError" do
gemfile "gem 'foo', :path => /unquoted/string/syntax/error"
- expect { Bundler::Dsl.evaluate(bundled_app("Gemfile"), nil, true) }.
+ expect { Bundler::Dsl.evaluate(bundled_app_gemfile, nil, true) }.
to raise_error(Bundler::GemfileError, /There was an error parsing `Gemfile`:( compile error -)? unknown regexp options - trg.+ Bundler cannot continue./)
end
end
@@ -278,7 +244,7 @@ RSpec.describe Bundler::Dsl do
describe "Runtime errors" do
it "will raise a Bundler::GemfileError" do
gemfile "raise RuntimeError, 'foo'"
- expect { Bundler::Dsl.evaluate(bundled_app("Gemfile"), nil, true) }.
+ expect { Bundler::Dsl.evaluate(bundled_app_gemfile, nil, true) }.
to raise_error(Bundler::GemfileError, /There was an error parsing `Gemfile`: foo. Bundler cannot continue./i)
end
end
diff --git a/spec/bundler/bundler/env_spec.rb b/spec/bundler/bundler/env_spec.rb
index 9631a109bd..fb593639bd 100644
--- a/spec/bundler/bundler/env_spec.rb
+++ b/spec/bundler/bundler/env_spec.rb
@@ -34,6 +34,8 @@ RSpec.describe Bundler::Env do
end
it "prints user home" do
+ skip "needs to use a valid HOME" if Gem.win_platform? && RUBY_VERSION < "2.6.0"
+
with_clear_paths("HOME", "/a/b/c") do
out = described_class.report
expect(out).to include("User Home /a/b/c")
@@ -41,15 +43,13 @@ RSpec.describe Bundler::Env do
end
it "prints user path" do
- if Gem::VERSION >= "3.2.0.pre.1"
- allow(Gem).to receive(:data_home) { "/a/b/c/.local/share" }
+ skip "needs to use a valid HOME" if Gem.win_platform? && RUBY_VERSION < "2.6.0"
+
+ with_clear_paths("HOME", "/a/b/c") do
+ allow(File).to receive(:exist?)
+ allow(File).to receive(:exist?).with("/a/b/c/.gem").and_return(true)
out = described_class.report
- expect(out).to include("User Path /a/b/c/.local/share/gem")
- else
- with_clear_paths("HOME", "/a/b/c") do
- out = described_class.report
- expect(out).to include("User Path /a/b/c/.gem")
- end
+ expect(out).to include("User Path /a/b/c/.gem")
end
end
@@ -88,6 +88,8 @@ RSpec.describe Bundler::Env do
BUNDLED WITH
1.10.0
L
+
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
end
let(:output) { described_class.report(:print_gemfile => true) }
@@ -127,6 +129,8 @@ RSpec.describe Bundler::Env do
File.open(bundled_app.join("foo.gemspec"), "wb") do |f|
f.write(gemspec)
end
+
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
end
it "prints the gemspec" do
@@ -139,13 +143,15 @@ RSpec.describe Bundler::Env do
context "when eval_gemfile is used" do
it "prints all gemfiles" do
- create_file "other/Gemfile-other", "gem 'rack'"
- create_file "other/Gemfile", "eval_gemfile 'Gemfile-other'"
- create_file "Gemfile-alt", <<-G
+ create_file bundled_app("other/Gemfile-other"), "gem 'rack'"
+ create_file bundled_app("other/Gemfile"), "eval_gemfile 'Gemfile-other'"
+ create_file bundled_app("Gemfile-alt"), <<-G
source "#{file_uri_for(gem_repo1)}"
eval_gemfile "other/Gemfile"
G
- gemfile "eval_gemfile #{File.expand_path("Gemfile-alt").dump}"
+ gemfile "eval_gemfile #{bundled_app("Gemfile-alt").to_s.dump}"
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
+ allow(Bundler::SharedHelpers).to receive(:pwd).and_return(bundled_app)
output = described_class.report(:print_gemspecs => true)
expect(output).to include(strip_whitespace(<<-ENV))
@@ -154,7 +160,7 @@ RSpec.describe Bundler::Env do
### Gemfile
```ruby
- eval_gemfile #{File.expand_path("Gemfile-alt").dump}
+ eval_gemfile #{bundled_app("Gemfile-alt").to_s.dump}
```
### Gemfile-alt
@@ -179,7 +185,7 @@ RSpec.describe Bundler::Env do
### Gemfile.lock
```
- <No #{bundled_app("Gemfile.lock")} found>
+ <No #{bundled_app_lock} found>
```
ENV
end
diff --git a/spec/bundler/bundler/fetcher/compact_index_spec.rb b/spec/bundler/bundler/fetcher/compact_index_spec.rb
index c9419d3eb1..b00eadceab 100644
--- a/spec/bundler/bundler/fetcher/compact_index_spec.rb
+++ b/spec/bundler/bundler/fetcher/compact_index_spec.rb
@@ -1,5 +1,8 @@
# frozen_string_literal: true
+# load CompactIndexClient upfront to prevent thread safety issues during parallel specs
+require "bundler/compact_index_client"
+
RSpec.describe Bundler::Fetcher::CompactIndex do
let(:downloader) { double(:downloader) }
let(:display_uri) { Bundler::URI("http://sampleuri.com") }
diff --git a/spec/bundler/bundler/fetcher_spec.rb b/spec/bundler/bundler/fetcher_spec.rb
index 539179db43..256d342775 100644
--- a/spec/bundler/bundler/fetcher_spec.rb
+++ b/spec/bundler/bundler/fetcher_spec.rb
@@ -150,9 +150,10 @@ RSpec.describe Bundler::Fetcher do
end
it "from many CI" do
- with_env_vars("TRAVIS" => "foo", "CI_NAME" => "my_ci") do
+ with_env_vars("TRAVIS" => "foo", "GITLAB_CI" => "gitlab", "CI_NAME" => "my_ci") do
ci_part = fetcher.user_agent.split(" ").find {|x| x.start_with?("ci/") }
expect(ci_part).to match("travis")
+ expect(ci_part).to match("gitlab")
expect(ci_part).to match("my_ci")
end
end
diff --git a/spec/bundler/bundler/friendly_errors_spec.rb b/spec/bundler/bundler/friendly_errors_spec.rb
index dc9d539a30..747d774b25 100644
--- a/spec/bundler/bundler/friendly_errors_spec.rb
+++ b/spec/bundler/bundler/friendly_errors_spec.rb
@@ -6,59 +6,26 @@ require "cgi"
RSpec.describe Bundler, "friendly errors" do
context "with invalid YAML in .gemrc" do
- context "with the old ~/.gemrc" do
- before do
- File.open(home(".gemrc"), "w") do |f|
- f.write "invalid: yaml: hah"
- end
- end
-
- after do
- FileUtils.rm(home(".gemrc"))
- end
-
- it "reports a relevant friendly error message" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
- G
-
- bundle :install, :env => { "DEBUG" => "true" }
-
- expect(err).to include("Failed to load #{home(".gemrc")}")
- expect(exitstatus).to eq(0) if exitstatus
+ before do
+ File.open(home(".gemrc"), "w") do |f|
+ f.write "invalid: yaml: hah"
end
end
- context "with XDG_CONFIG_HOME" do
- let(:config_home) { File.dirname(Gem.configuration.config_file_name) }
-
- before do
- FileUtils.mkdir_p config_home
- File.open(Gem.configuration.config_file_name, "w") do |f|
- f.write "invalid: yaml: hah"
- end
- end
-
- after do
- FileUtils.rm(Gem.configuration.config_file_name)
- end
+ after do
+ FileUtils.rm(home(".gemrc"))
+ end
- it "reports a relevant friendly error message" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
- G
+ it "reports a relevant friendly error message" do
+ gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ gem "rack"
+ G
- bundle :install, :env => { "DEBUG" => "true" }
+ bundle :install, :env => { "DEBUG" => "true" }
- if Gem::VERSION >= "3.2.0.pre.1"
- expect(err).to include("Failed to load #{File.join(config_home, "gemrc")}")
- else
- expect(err).to include("Failed to load #{home(".gemrc")}")
- end
- expect(exitstatus).to eq(0) if exitstatus
- end
+ expect(err).to include("Failed to load #{home(".gemrc")}")
+ expect(exitstatus).to eq(0) if exitstatus
end
end
@@ -148,18 +115,12 @@ RSpec.describe Bundler, "friendly errors" do
context "LoadError" do
let(:error) { LoadError.new("cannot load such file -- openssl") }
- it "Bundler.ui receive error" do
- expect(Bundler.ui).to receive(:error).with("\nCould not load OpenSSL.")
- Bundler::FriendlyErrors.log_error(error)
- end
-
- it "Bundler.ui receive warn" do
- expect(Bundler.ui).to receive(:warn).with(any_args, :wrap => true)
- Bundler::FriendlyErrors.log_error(error)
+ before do
+ allow(error).to receive(:backtrace).and_return(["backtrace"])
end
- it "Bundler.ui receive trace" do
- expect(Bundler.ui).to receive(:trace).with(error)
+ it "Bundler.ui receive error" do
+ expect(Bundler.ui).to receive(:error).with("\nCould not load OpenSSL. LoadError: cannot load such file -- openssl\nbacktrace")
Bundler::FriendlyErrors.log_error(error)
end
end
@@ -254,7 +215,7 @@ RSpec.describe Bundler, "friendly errors" do
it "generates a search URL for the exception message" do
exception = Exception.new("Exception message")
- expect(Bundler::FriendlyErrors.issues_url(exception)).to eq("https://github.com/bundler/bundler/search?q=Exception+message&type=Issues")
+ expect(Bundler::FriendlyErrors.issues_url(exception)).to eq("https://github.com/rubygems/bundler/search?q=Exception+message&type=Issues")
end
it "generates a search URL for only the first line of a multi-line exception message" do
@@ -263,7 +224,7 @@ First line of the exception message
Second line of the exception message
END
- expect(Bundler::FriendlyErrors.issues_url(exception)).to eq("https://github.com/bundler/bundler/search?q=First+line+of+the+exception+message&type=Issues")
+ expect(Bundler::FriendlyErrors.issues_url(exception)).to eq("https://github.com/rubygems/bundler/search?q=First+line+of+the+exception+message&type=Issues")
end
it "generates the url without colons" do
@@ -272,7 +233,7 @@ Exception ::: with ::: colons :::
END
issues_url = Bundler::FriendlyErrors.issues_url(exception)
expect(issues_url).not_to include("%3A")
- expect(issues_url).to eq("https://github.com/bundler/bundler/search?q=#{CGI.escape("Exception with colons ")}&type=Issues")
+ expect(issues_url).to eq("https://github.com/rubygems/bundler/search?q=#{CGI.escape("Exception with colons ")}&type=Issues")
end
it "removes information after - for Errono::EACCES" do
@@ -282,7 +243,7 @@ END
allow(exception).to receive(:is_a?).with(Errno).and_return(true)
issues_url = Bundler::FriendlyErrors.issues_url(exception)
expect(issues_url).not_to include("/Users/foo/bar")
- expect(issues_url).to eq("https://github.com/bundler/bundler/search?q=#{CGI.escape("Errno EACCES Permission denied @ dir_s_mkdir ")}&type=Issues")
+ expect(issues_url).to eq("https://github.com/rubygems/bundler/search?q=#{CGI.escape("Errno EACCES Permission denied @ dir_s_mkdir ")}&type=Issues")
end
end
end
diff --git a/spec/bundler/bundler/gem_helper_spec.rb b/spec/bundler/bundler/gem_helper_spec.rb
index 29e10d64f8..548425b11e 100644
--- a/spec/bundler/bundler/gem_helper_spec.rb
+++ b/spec/bundler/bundler/gem_helper_spec.rb
@@ -9,7 +9,7 @@ RSpec.describe Bundler::GemHelper do
let(:app_gemspec_path) { app_path.join("#{app_name}.gemspec") }
before(:each) do
- global_config "BUNDLE_GEM__MIT" => "false", "BUNDLE_GEM__TEST" => "false", "BUNDLE_GEM__COC" => "false"
+ global_config "BUNDLE_GEM__MIT" => "false", "BUNDLE_GEM__TEST" => "false", "BUNDLE_GEM__COC" => "false", "BUNDLE_GEM__RUBOCOP" => "false"
bundle "gem #{app_name}"
prepare_gemspec(app_gemspec_path)
end
@@ -138,6 +138,26 @@ RSpec.describe Bundler::GemHelper do
expect(app_gem_path).to exist
end
end
+
+ context "when building in the current working directory" do
+ it "creates .gem file" do
+ mock_build_message app_name, app_version
+ Dir.chdir app_path do
+ Bundler::GemHelper.new.build_gem
+ end
+ expect(app_gem_path).to exist
+ end
+ end
+
+ context "when building in a location relative to the current working directory" do
+ it "creates .gem file" do
+ mock_build_message app_name, app_version
+ Dir.chdir File.dirname(app_path) do
+ Bundler::GemHelper.new(File.basename(app_path)).build_gem
+ end
+ expect(app_gem_path).to exist
+ end
+ end
end
describe "#install_gem" do
@@ -178,13 +198,11 @@ RSpec.describe Bundler::GemHelper do
end
before do
- Dir.chdir(app_path) do
- `git init`
- `git config user.email "you@example.com"`
- `git config user.name "name"`
- `git config commit.gpgsign false`
- `git config push.default simple`
- end
+ sys_exec("git init", :dir => app_path)
+ sys_exec("git config user.email \"you@example.com\"", :dir => app_path)
+ sys_exec("git config user.name \"name\"", :dir => app_path)
+ sys_exec("git config commit.gpgsign false", :dir => app_path)
+ sys_exec("git config push.default simple", :dir => app_path)
# silence messages
allow(Bundler.ui).to receive(:confirm)
@@ -198,13 +216,13 @@ RSpec.describe Bundler::GemHelper do
end
it "when there are uncommitted files" do
- Dir.chdir(app_path) { `git add .` }
+ sys_exec("git add .", :dir => app_path)
expect { Rake.application["release"].invoke }.
to raise_error("There are files that need to be committed first.")
end
it "when there is no git remote" do
- Dir.chdir(app_path) { `git commit -a -m "initial commit"` }
+ sys_exec("git commit -a -m \"initial commit\"", :dir => app_path)
expect { Rake.application["release"].invoke }.to raise_error(RuntimeError)
end
end
@@ -213,10 +231,8 @@ RSpec.describe Bundler::GemHelper do
let(:repo) { build_git("foo", :bare => true) }
before do
- Dir.chdir(app_path) do
- sys_exec("git remote add origin #{file_uri_for(repo.path)}")
- sys_exec('git commit -a -m "initial commit"')
- end
+ sys_exec("git remote add origin #{file_uri_for(repo.path)}", :dir => app_path)
+ sys_exec('git commit -a -m "initial commit"', :dir => app_path)
end
context "on releasing" do
@@ -225,7 +241,7 @@ RSpec.describe Bundler::GemHelper do
mock_confirm_message "Tagged v#{app_version}."
mock_confirm_message "Pushed git commits and tags."
- Dir.chdir(app_path) { sys_exec("git push -u origin master") }
+ sys_exec("git push -u origin master", :dir => app_path)
end
it "calls rubygem_push with proper arguments" do
@@ -235,7 +251,8 @@ RSpec.describe Bundler::GemHelper do
end
it "uses Kernel.system" do
- expect(Kernel).to receive(:system).with(gem_bin, "push", app_gem_path.to_s, "--host", "http://example.org").and_return(true)
+ cmd = gem_bin.shellsplit
+ expect(Kernel).to receive(:system).with(*cmd, "push", app_gem_path.to_s, "--host", "http://example.org").and_return(true)
Rake.application["release"].invoke
end
@@ -246,9 +263,7 @@ RSpec.describe Bundler::GemHelper do
mock_confirm_message "Tag v#{app_version} has already been created."
expect(subject).to receive(:rubygem_push).with(app_gem_path.to_s)
- Dir.chdir(app_path) do
- `git tag -a -m \"Version #{app_version}\" v#{app_version}`
- end
+ sys_exec("git tag -a -m \"Version #{app_version}\" v#{app_version}", :dir => app_path)
Rake.application["release"].invoke
end
@@ -269,12 +284,10 @@ RSpec.describe Bundler::GemHelper do
end
before do
- Dir.chdir(app_path) do
- `git init`
- `git config user.email "you@example.com"`
- `git config user.name "name"`
- `git config push.default simple`
- end
+ sys_exec("git init", :dir => app_path)
+ sys_exec("git config user.email \"you@example.com\"", :dir => app_path)
+ sys_exec("git config user.name \"name\"", :dir => app_path)
+ sys_exec("git config push.gpgsign simple", :dir => app_path)
# silence messages
allow(Bundler.ui).to receive(:confirm)
diff --git a/spec/bundler/bundler/mirror_spec.rb b/spec/bundler/bundler/mirror_spec.rb
index 4a8a0c7c48..1eaf1e9a8e 100644
--- a/spec/bundler/bundler/mirror_spec.rb
+++ b/spec/bundler/bundler/mirror_spec.rb
@@ -305,6 +305,8 @@ RSpec.describe Bundler::Settings::TCPSocketProbe do
end
it "probes the server correctly" do
+ skip "obscure error" if Gem.win_platform?
+
with_server_and_mirror do |server, mirror|
expect(server.closed?).to be_falsey
expect(probe.replies?(mirror)).to be_truthy
diff --git a/spec/bundler/bundler/plugin/index_spec.rb b/spec/bundler/bundler/plugin/index_spec.rb
index e18e960fb8..925dc558ac 100644
--- a/spec/bundler/bundler/plugin/index_spec.rb
+++ b/spec/bundler/bundler/plugin/index_spec.rb
@@ -4,6 +4,7 @@ RSpec.describe Bundler::Plugin::Index do
Index = Bundler::Plugin::Index
before do
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
gemfile ""
path = lib_path(plugin_name)
index.register_plugin("new-plugin", path.to_s, [path.join("lib").to_s], commands, sources, hooks)
@@ -117,11 +118,11 @@ RSpec.describe Bundler::Plugin::Index do
describe "global index" do
before do
- Dir.chdir(tmp) do
- Bundler::Plugin.reset!
- path = lib_path("gplugin")
- index.register_plugin("gplugin", path.to_s, [path.join("lib").to_s], [], ["glb_source"], [])
- end
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(nil)
+
+ Bundler::Plugin.reset!
+ path = lib_path("gplugin")
+ index.register_plugin("gplugin", path.to_s, [path.join("lib").to_s], [], ["glb_source"], [])
end
it "skips sources" do
diff --git a/spec/bundler/bundler/plugin_spec.rb b/spec/bundler/bundler/plugin_spec.rb
index e0e2e9afdf..8c95723bcc 100644
--- a/spec/bundler/bundler/plugin_spec.rb
+++ b/spec/bundler/bundler/plugin_spec.rb
@@ -107,7 +107,7 @@ RSpec.describe Bundler::Plugin do
describe "evaluate gemfile for plugins" do
let(:definition) { double("definition") }
let(:builder) { double("builder") }
- let(:gemfile) { bundled_app("Gemfile") }
+ let(:gemfile) { bundled_app_gemfile }
before do
allow(Plugin::DSL).to receive(:new) { builder }
@@ -237,7 +237,7 @@ RSpec.describe Bundler::Plugin do
describe "#root" do
context "in app dir" do
before do
- gemfile ""
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
end
it "returns plugin dir in app .bundle path" do
@@ -246,8 +246,11 @@ RSpec.describe Bundler::Plugin do
end
context "outside app dir" do
+ before do
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(nil)
+ end
+
it "returns plugin dir in global bundle path" do
- Dir.chdir tmp
expect(subject.root).to eq(home.join(".bundle/plugin"))
end
end
diff --git a/spec/bundler/bundler/settings_spec.rb b/spec/bundler/bundler/settings_spec.rb
index b83d768477..116a038445 100644
--- a/spec/bundler/bundler/settings_spec.rb
+++ b/spec/bundler/bundler/settings_spec.rb
@@ -130,6 +130,8 @@ that would suck --ehhh=oh geez it looks like i might have broken bundler somehow
describe "#temporary" do
it "reset after used" do
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
+
Bundler.settings.set_command_option :no_install, true
Bundler.settings.temporary(:no_install => false) do
diff --git a/spec/bundler/bundler/shared_helpers_spec.rb b/spec/bundler/bundler/shared_helpers_spec.rb
index 4530a9a5cd..73adcf44d6 100644
--- a/spec/bundler/bundler/shared_helpers_spec.rb
+++ b/spec/bundler/bundler/shared_helpers_spec.rb
@@ -4,10 +4,13 @@ RSpec.describe Bundler::SharedHelpers do
let(:ext_lock_double) { double(:ext_lock) }
before do
+ pwd_stub
allow(Bundler.rubygems).to receive(:ext_lock).and_return(ext_lock_double)
allow(ext_lock_double).to receive(:synchronize) {|&block| block.call }
end
+ let(:pwd_stub) { allow(subject).to receive(:pwd).and_return(bundled_app) }
+
subject { Bundler::SharedHelpers }
describe "#default_gemfile" do
@@ -77,7 +80,7 @@ RSpec.describe Bundler::SharedHelpers do
let(:global_rubygems_dir) { Pathname.new(bundled_app) }
before do
- Dir.mkdir ".bundle"
+ Dir.mkdir bundled_app(".bundle")
allow(Bundler.rubygems).to receive(:user_home).and_return(global_rubygems_dir)
end
@@ -91,7 +94,7 @@ RSpec.describe Bundler::SharedHelpers do
let(:expected_bundle_dir_path) { Pathname.new("#{bundled_app}/.bundle") }
before do
- Dir.mkdir ".bundle"
+ Dir.mkdir bundled_app(".bundle")
allow(Bundler.rubygems).to receive(:user_home).and_return(global_rubygems_dir)
end
@@ -109,7 +112,8 @@ RSpec.describe Bundler::SharedHelpers do
shared_examples_for "correctly determines whether to return a Gemfile path" do
context "currently in directory with a Gemfile" do
- before { File.new("Gemfile", "w") }
+ before { FileUtils.touch(bundled_app_gemfile) }
+ after { FileUtils.rm(bundled_app_gemfile) }
it "returns path of the bundle Gemfile" do
expect(subject.in_bundle?).to eq("#{bundled_app}/Gemfile")
@@ -147,22 +151,24 @@ RSpec.describe Bundler::SharedHelpers do
describe "#chdir" do
let(:op_block) { proc { Dir.mkdir "nested_dir" } }
- before { Dir.mkdir "chdir_test_dir" }
+ before { Dir.mkdir bundled_app("chdir_test_dir") }
it "executes the passed block while in the specified directory" do
- subject.chdir("chdir_test_dir", &op_block)
- expect(Pathname.new("chdir_test_dir/nested_dir")).to exist
+ subject.chdir(bundled_app("chdir_test_dir"), &op_block)
+ expect(bundled_app("chdir_test_dir/nested_dir")).to exist
end
end
describe "#pwd" do
+ let(:pwd_stub) { nil }
+
it "returns the current absolute path" do
- expect(subject.pwd).to eq(bundled_app)
+ expect(subject.pwd).to eq(root)
end
end
describe "#with_clean_git_env" do
- let(:with_clean_git_env_block) { proc { Dir.mkdir "with_clean_git_env_test_dir" } }
+ let(:with_clean_git_env_block) { proc { Dir.mkdir bundled_app("with_clean_git_env_test_dir") } }
before do
ENV["GIT_DIR"] = "ORIGINAL_ENV_GIT_DIR"
@@ -171,20 +177,20 @@ RSpec.describe Bundler::SharedHelpers do
it "executes the passed block" do
subject.with_clean_git_env(&with_clean_git_env_block)
- expect(Pathname.new("with_clean_git_env_test_dir")).to exist
+ expect(bundled_app("with_clean_git_env_test_dir")).to exist
end
context "when a block is passed" do
let(:with_clean_git_env_block) do
proc do
- Dir.mkdir "git_dir_test_dir" unless ENV["GIT_DIR"].nil?
- Dir.mkdir "git_work_tree_test_dir" unless ENV["GIT_WORK_TREE"].nil?
+ Dir.mkdir bundled_app("git_dir_test_dir") unless ENV["GIT_DIR"].nil?
+ Dir.mkdir bundled_app("git_work_tree_test_dir") unless ENV["GIT_WORK_TREE"].nil?
end end
it "uses a fresh git env for execution" do
subject.with_clean_git_env(&with_clean_git_env_block)
- expect(Pathname.new("git_dir_test_dir")).to_not exist
- expect(Pathname.new("git_work_tree_test_dir")).to_not exist
+ expect(bundled_app("git_dir_test_dir")).to_not exist
+ expect(bundled_app("git_work_tree_test_dir")).to_not exist
end
end
@@ -224,7 +230,7 @@ RSpec.describe Bundler::SharedHelpers do
end
shared_examples_for "ENV['PATH'] gets set correctly" do
- before { Dir.mkdir ".bundle" }
+ before { Dir.mkdir bundled_app(".bundle") }
it "ensures bundle bin path is in ENV['PATH']" do
subject.set_bundle_environment
@@ -244,7 +250,7 @@ RSpec.describe Bundler::SharedHelpers do
let(:ruby_lib_path) { "stubbed_ruby_lib_dir" }
before do
- allow(Bundler::SharedHelpers).to receive(:bundler_ruby_lib).and_return(ruby_lib_path)
+ allow(subject).to receive(:bundler_ruby_lib).and_return(ruby_lib_path)
end
it "ensures bundler's ruby version lib path is in ENV['RUBYLIB']" do
@@ -263,7 +269,7 @@ RSpec.describe Bundler::SharedHelpers do
end
it "ignores if bundler_ruby_lib is same as rubylibdir" do
- allow(Bundler::SharedHelpers).to receive(:bundler_ruby_lib).and_return(RbConfig::CONFIG["rubylibdir"])
+ allow(subject).to receive(:bundler_ruby_lib).and_return(RbConfig::CONFIG["rubylibdir"])
subject.set_bundle_environment
@@ -422,8 +428,8 @@ RSpec.describe Bundler::SharedHelpers do
let(:file_op_block) { proc {|path| FileUtils.mkdir_p(path) } }
it "performs the operation in the passed block" do
- subject.filesystem_access("./test_dir", &file_op_block)
- expect(Pathname.new("test_dir")).to exist
+ subject.filesystem_access(bundled_app("test_dir"), &file_op_block)
+ expect(bundled_app("test_dir")).to exist
end
end
diff --git a/spec/bundler/bundler/source/git/git_proxy_spec.rb b/spec/bundler/bundler/source/git/git_proxy_spec.rb
index c18490233d..169d7234b4 100644
--- a/spec/bundler/bundler/source/git/git_proxy_spec.rb
+++ b/spec/bundler/bundler/source/git/git_proxy_spec.rb
@@ -123,6 +123,7 @@ RSpec.describe Bundler::Source::Git::GitProxy do
end
describe "#copy_to" do
+ let(:cache) { tmpdir("cache_path") }
let(:destination) { tmpdir("copy_to_path") }
let(:submodules) { false }
@@ -132,8 +133,8 @@ RSpec.describe Bundler::Source::Git::GitProxy do
it "fails gracefully when resetting to the revision fails" do
expect(subject).to receive(:git_retry).with(start_with("clone ")) { destination.mkpath }
- expect(subject).to receive(:git_retry).with(start_with("fetch "))
- expect(subject).to receive(:git).with(command).and_raise(Bundler::Source::Git::GitCommandError, command)
+ expect(subject).to receive(:git_retry).with(start_with("fetch "), :dir => destination)
+ expect(subject).to receive(:git).with(command, :dir => destination).and_raise(Bundler::Source::Git::GitCommandError.new(command, cache, destination))
expect(subject).not_to receive(:git)
expect { subject.copy_to(destination, submodules) }.
diff --git a/spec/bundler/cache/gems_spec.rb b/spec/bundler/cache/gems_spec.rb
index 89d6d41570..a67aab8a7b 100644
--- a/spec/bundler/cache/gems_spec.rb
+++ b/spec/bundler/cache/gems_spec.rb
@@ -7,7 +7,7 @@ RSpec.describe "bundle cache" do
gem 'rack'
G
- system_gems "rack-1.0.0", :path => :bundle_path
+ system_gems "rack-1.0.0", :path => path
bundle! :cache
end
@@ -27,7 +27,7 @@ RSpec.describe "bundle cache" do
end
it "uses the cache as a source when installing gems with --local" do
- system_gems [], :path => :bundle_path
+ system_gems [], :path => default_bundle_path
bundle "install --local"
expect(the_bundle).to include_gems("rack 1.0.0")
@@ -46,7 +46,7 @@ RSpec.describe "bundle cache" do
end
it "does not reinstall gems from the cache if they exist in the bundle" do
- system_gems "rack-1.0.0", :path => :bundle_path
+ system_gems "rack-1.0.0", :path => default_bundle_path
gemfile <<-G
gem "rack"
@@ -69,17 +69,19 @@ RSpec.describe "bundle cache" do
bundle "cache"
- expect(bundled_app("Gemfile.lock")).to exist
+ expect(bundled_app_lock).to exist
end
end
context "using system gems" do
before { bundle! "config set path.system true" }
+ let(:path) { system_gem_path }
it_behaves_like "when there are only gemsources"
end
context "installing into a local path" do
before { bundle! "config set path ./.bundle" }
+ let(:path) { local_gem_path }
it_behaves_like "when there are only gemsources"
end
@@ -165,11 +167,11 @@ RSpec.describe "bundle cache" do
end
it "should not explode if the lockfile is not present" do
- FileUtils.rm(bundled_app("Gemfile.lock"))
+ FileUtils.rm(bundled_app_lock)
bundle :cache
- expect(bundled_app("Gemfile.lock")).to exist
+ expect(bundled_app_lock).to exist
end
end
diff --git a/spec/bundler/cache/git_spec.rb b/spec/bundler/cache/git_spec.rb
index 75525d405b..ecdc97f837 100644
--- a/spec/bundler/cache/git_spec.rb
+++ b/spec/bundler/cache/git_spec.rb
@@ -155,10 +155,8 @@ RSpec.describe "bundle cache with git" do
s.add_dependency "submodule"
end
- 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
+ sys_exec "git submodule add #{lib_path("submodule-1.0")} submodule-1.0", :dir => lib_path("has_submodule-1.0")
+ sys_exec "git commit -m \"submodulator\"", :dir => lib_path("has_submodule-1.0")
install_gemfile <<-G
git "#{lib_path("has_submodule-1.0")}", :submodules => true do
diff --git a/spec/bundler/cache/path_spec.rb b/spec/bundler/cache/path_spec.rb
index 79e8b4a82b..bd47ac925d 100644
--- a/spec/bundler/cache/path_spec.rb
+++ b/spec/bundler/cache/path_spec.rb
@@ -26,13 +26,12 @@ RSpec.describe "bundle cache with path" do
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
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)
+ libname = File.basename(bundled_app) + "_gem"
+ libpath = File.join(File.dirname(bundled_app), libname)
build_lib libname, :path => libpath
@@ -45,7 +44,6 @@ RSpec.describe "bundle cache with path" do
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
@@ -66,7 +64,6 @@ RSpec.describe "bundle cache with path" do
bundle :cache
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")
diff --git a/spec/bundler/commands/add_spec.rb b/spec/bundler/commands/add_spec.rb
index 35fd43d3d2..7ea384c1dc 100644
--- a/spec/bundler/commands/add_spec.rb
+++ b/spec/bundler/commands/add_spec.rb
@@ -13,7 +13,7 @@ RSpec.describe "bundle add" do
build_git "foo", "2.0"
- install_gemfile <<-G
+ install_gemfile! <<-G
source "#{file_uri_for(gem_repo2)}"
gem "weakling", "~> 0.0.1"
G
@@ -30,25 +30,25 @@ RSpec.describe "bundle add" do
describe "without version specified" do
it "version requirement becomes ~> major.minor.patch when resolved version is < 1.0" do
bundle "add 'bar'"
- expect(bundled_app("Gemfile").read).to match(/gem "bar", "~> 0.12.3"/)
+ expect(bundled_app_gemfile.read).to match(/gem "bar", "~> 0.12.3"/)
expect(the_bundle).to include_gems "bar 0.12.3"
end
it "version requirement becomes ~> major.minor when resolved version is > 1.0" do
bundle "add 'baz'"
- expect(bundled_app("Gemfile").read).to match(/gem "baz", "~> 1.2"/)
+ expect(bundled_app_gemfile.read).to match(/gem "baz", "~> 1.2"/)
expect(the_bundle).to include_gems "baz 1.2.3"
end
it "version requirement becomes ~> major.minor.patch.pre when resolved version is < 1.0" do
bundle "add 'cat'"
- expect(bundled_app("Gemfile").read).to match(/gem "cat", "~> 0.12.3.pre"/)
+ expect(bundled_app_gemfile.read).to match(/gem "cat", "~> 0.12.3.pre"/)
expect(the_bundle).to include_gems "cat 0.12.3.pre"
end
it "version requirement becomes ~> major.minor.pre when resolved version is > 1.0.pre" do
bundle "add 'dog'"
- expect(bundled_app("Gemfile").read).to match(/gem "dog", "~> 1.1.pre"/)
+ expect(bundled_app_gemfile.read).to match(/gem "dog", "~> 1.1.pre"/)
expect(the_bundle).to include_gems "dog 1.1.3.pre"
end
end
@@ -56,14 +56,14 @@ RSpec.describe "bundle add" do
describe "with --version" do
it "adds dependency of specified version and runs install" do
bundle "add 'foo' --version='~> 1.0'"
- expect(bundled_app("Gemfile").read).to match(/gem "foo", "~> 1.0"/)
+ expect(bundled_app_gemfile.read).to match(/gem "foo", "~> 1.0"/)
expect(the_bundle).to include_gems "foo 1.1"
end
it "adds multiple version constraints when specified" do
requirements = ["< 3.0", "> 1.0"]
bundle "add 'foo' --version='#{requirements.join(", ")}'"
- expect(bundled_app("Gemfile").read).to match(/gem "foo", #{Gem::Requirement.new(requirements).as_list.map(&:dump).join(', ')}/)
+ expect(bundled_app_gemfile.read).to match(/gem "foo", #{Gem::Requirement.new(requirements).as_list.map(&:dump).join(', ')}/)
expect(the_bundle).to include_gems "foo 2.0"
end
end
@@ -71,13 +71,13 @@ RSpec.describe "bundle add" do
describe "with --group" do
it "adds dependency for the specified group" do
bundle "add 'foo' --group='development'"
- expect(bundled_app("Gemfile").read).to match(/gem "foo", "~> 2.0", :group => :development/)
+ expect(bundled_app_gemfile.read).to match(/gem "foo", "~> 2.0", :group => :development/)
expect(the_bundle).to include_gems "foo 2.0"
end
it "adds dependency to more than one group" do
bundle "add 'foo' --group='development, test'"
- expect(bundled_app("Gemfile").read).to match(/gem "foo", "~> 2.0", :groups => \[:development, :test\]/)
+ expect(bundled_app_gemfile.read).to match(/gem "foo", "~> 2.0", :groups => \[:development, :test\]/)
expect(the_bundle).to include_gems "foo 2.0"
end
end
@@ -86,7 +86,7 @@ RSpec.describe "bundle add" do
it "adds dependency with specified source" do
bundle "add 'foo' --source='#{file_uri_for(gem_repo2)}'"
- expect(bundled_app("Gemfile").read).to match(/gem "foo", "~> 2.0", :source => "#{file_uri_for(gem_repo2)}"/)
+ expect(bundled_app_gemfile.read).to match(/gem "foo", "~> 2.0", :source => "#{file_uri_for(gem_repo2)}"/)
expect(the_bundle).to include_gems "foo 2.0"
end
end
@@ -95,7 +95,7 @@ RSpec.describe "bundle add" do
it "adds dependency with specified github source" do
bundle "add foo --git=#{lib_path("foo-2.0")}"
- expect(bundled_app("Gemfile").read).to match(/gem "foo", "~> 2.0", :git => "#{lib_path("foo-2.0")}"/)
+ expect(bundled_app_gemfile.read).to match(/gem "foo", "~> 2.0", :git => "#{lib_path("foo-2.0")}"/)
expect(the_bundle).to include_gems "foo 2.0"
end
end
@@ -108,7 +108,7 @@ RSpec.describe "bundle add" do
it "adds dependency with specified github source and branch" do
bundle "add foo --git=#{lib_path("foo-2.0")} --branch=test"
- expect(bundled_app("Gemfile").read).to match(/gem "foo", "~> 2.0", :git => "#{lib_path("foo-2.0")}", :branch => "test"/)
+ expect(bundled_app_gemfile.read).to match(/gem "foo", "~> 2.0", :git => "#{lib_path("foo-2.0")}", :branch => "test"/)
expect(the_bundle).to include_gems "foo 2.0"
end
end
@@ -117,14 +117,14 @@ RSpec.describe "bundle add" do
it "adds gem to Gemfile but is not installed" do
bundle "add foo --skip-install --version=2.0"
- expect(bundled_app("Gemfile").read).to match(/gem "foo", "= 2.0"/)
+ expect(bundled_app_gemfile.read).to match(/gem "foo", "= 2.0"/)
expect(the_bundle).to_not include_gems "foo 2.0"
end
end
it "using combination of short form options works like long form" do
bundle "add 'foo' -s='#{file_uri_for(gem_repo2)}' -g='development' -v='~>1.0'"
- expect(bundled_app("Gemfile").read).to include %(gem "foo", "~> 1.0", :group => :development, :source => "#{file_uri_for(gem_repo2)}")
+ expect(bundled_app_gemfile.read).to include %(gem "foo", "~> 1.0", :group => :development, :source => "#{file_uri_for(gem_repo2)}")
expect(the_bundle).to include_gems "foo 1.1"
end
@@ -153,7 +153,7 @@ RSpec.describe "bundle add" do
describe "with --optimistic" do
it "adds optimistic version" do
bundle! "add 'foo' --optimistic"
- expect(bundled_app("Gemfile").read).to include %(gem "foo", ">= 2.0")
+ expect(bundled_app_gemfile.read).to include %(gem "foo", ">= 2.0")
expect(the_bundle).to include_gems "foo 2.0"
end
end
@@ -161,7 +161,7 @@ RSpec.describe "bundle add" do
describe "with --strict option" do
it "adds strict version" do
bundle! "add 'foo' --strict"
- expect(bundled_app("Gemfile").read).to include %(gem "foo", "= 2.0")
+ expect(bundled_app_gemfile.read).to include %(gem "foo", "= 2.0")
expect(the_bundle).to include_gems "foo 2.0"
end
end
@@ -169,7 +169,7 @@ RSpec.describe "bundle add" do
describe "with no option" do
it "adds pessimistic version" do
bundle! "add 'foo'"
- expect(bundled_app("Gemfile").read).to include %(gem "foo", "~> 2.0")
+ expect(bundled_app_gemfile.read).to include %(gem "foo", "~> 2.0")
expect(the_bundle).to include_gems "foo 2.0"
end
end
@@ -186,8 +186,8 @@ RSpec.describe "bundle add" do
it "adds multiple gems to gemfile" do
bundle! "add bar baz"
- expect(bundled_app("Gemfile").read).to match(/gem "bar", "~> 0.12.3"/)
- expect(bundled_app("Gemfile").read).to match(/gem "baz", "~> 1.2"/)
+ expect(bundled_app_gemfile.read).to match(/gem "bar", "~> 0.12.3"/)
+ expect(bundled_app_gemfile.read).to match(/gem "baz", "~> 1.2"/)
end
it "throws error if any of the specified gems are present in the gemfile with different version" do
@@ -200,7 +200,7 @@ RSpec.describe "bundle add" do
describe "when a gem is added which is already specified in Gemfile with version" do
it "shows an error when added with different version requirement" do
- install_gemfile <<-G
+ install_gemfile! <<-G
source "#{file_uri_for(gem_repo2)}"
gem "rack", "1.0"
G
@@ -212,7 +212,7 @@ RSpec.describe "bundle add" do
end
it "shows error when added without version requirements" do
- install_gemfile <<-G
+ install_gemfile! <<-G
source "#{file_uri_for(gem_repo2)}"
gem "rack", "1.0"
G
@@ -227,7 +227,7 @@ RSpec.describe "bundle add" do
describe "when a gem is added which is already specified in Gemfile without version" do
it "shows an error when added with different version requirement" do
- install_gemfile <<-G
+ install_gemfile! <<-G
source "#{file_uri_for(gem_repo2)}"
gem "rack"
G
diff --git a/spec/bundler/commands/binstubs_spec.rb b/spec/bundler/commands/binstubs_spec.rb
index 7c04e8ddbd..409c32c4f0 100644
--- a/spec/bundler/commands/binstubs_spec.rb
+++ b/spec/bundler/commands/binstubs_spec.rb
@@ -1,6 +1,10 @@
# frozen_string_literal: true
RSpec.describe "bundle binstubs <gem>" do
+ before do
+ skip "https://github.com/rubygems/bundler/issues/6894" if Gem.win_platform?
+ end
+
context "when the gem exists in the lockfile" do
it "sets up the binstub" do
install_gemfile <<-G
@@ -82,7 +86,7 @@ RSpec.describe "bundle binstubs <gem>" do
bundle "binstubs rack"
- File.open("bin/bundle", "wb") do |file|
+ File.open(bundled_app("bin/bundle"), "wb") do |file|
file.print "OMG"
end
@@ -94,18 +98,7 @@ RSpec.describe "bundle binstubs <gem>" do
context "the bundle binstub" do
before do
- if system_bundler_version == :bundler
- system_gems :bundler
- elsif system_bundler_version
- build_repo4 do
- build_gem "bundler", system_bundler_version do |s|
- s.executables = "bundle"
- s.bindir = "exe"
- s.write "exe/bundle", "puts %(system bundler #{system_bundler_version}\\n\#{ARGV.inspect})"
- end
- end
- system_gems "bundler-#{system_bundler_version}", :gem_repo => gem_repo4
- end
+ system_gems "bundler-#{system_bundler_version}"
build_repo2 do
build_gem "prints_loaded_gems", "1.0" do |s|
s.executables = "print_loaded_gems"
@@ -127,13 +120,13 @@ RSpec.describe "bundle binstubs <gem>" do
let(:system_bundler_version) { Bundler::VERSION }
it "runs bundler" do
- sys_exec! "#{bundled_app("bin/bundle")} install"
- expect(out).to eq %(system bundler #{system_bundler_version}\n["install"])
+ sys_exec! "bin/bundle install", :env => { "DEBUG" => "1" }
+ expect(out).to include %(Using bundler #{system_bundler_version}\n)
end
context "when BUNDLER_VERSION is set" do
it "runs the correct version of bundler" do
- sys_exec "#{bundled_app("bin/bundle")} install", "BUNDLER_VERSION" => "999.999.999"
+ sys_exec "bin/bundle install", :env => { "BUNDLER_VERSION" => "999.999.999" }
expect(exitstatus).to eq(42) if exitstatus
expect(err).to include("Activating bundler (~> 999.999) failed:").
and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 999.999'`")
@@ -147,7 +140,7 @@ RSpec.describe "bundle binstubs <gem>" do
end
it "runs the correct version of bundler" do
- sys_exec "#{bundled_app("bin/bundle")} install"
+ sys_exec "bin/bundle install"
expect(exitstatus).to eq(42) if exitstatus
expect(err).to include("Activating bundler (~> 999.999) failed:").
and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 999.999'`")
@@ -162,7 +155,7 @@ RSpec.describe "bundle binstubs <gem>" do
end
it "runs the correct version of bundler" do
- sys_exec "#{bundled_app("bin/bundle")} install"
+ sys_exec "bin/bundle install"
expect(exitstatus).to eq(42) if exitstatus
expect(err).to include("Activating bundler (~> 44.0) failed:").
and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 44.0'`")
@@ -177,7 +170,7 @@ RSpec.describe "bundle binstubs <gem>" do
end
it "runs the available version of bundler when the version is older and the same major" do
- sys_exec "#{bundled_app("bin/bundle")} install"
+ sys_exec "bin/bundle install"
expect(exitstatus).not_to eq(42) if exitstatus
expect(err).not_to include("Activating bundler (~> 55.0) failed:")
end
@@ -191,7 +184,7 @@ RSpec.describe "bundle binstubs <gem>" do
end
it "runs the correct version of bundler when the version is a pre-release" do
- sys_exec "#{bundled_app("bin/bundle")} install"
+ sys_exec "bin/bundle install"
expect(exitstatus).to eq(42) if exitstatus
expect(err).to include("Activating bundler (~> 2.12.a) failed:").
and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 2.12.a'`")
@@ -203,12 +196,12 @@ RSpec.describe "bundle binstubs <gem>" do
before { lockfile.gsub(system_bundler_version, "1.1.1") }
it "calls through to the latest bundler version" do
- sys_exec! "#{bundled_app("bin/bundle")} update --bundler"
- expect(out).to eq %(system bundler #{system_bundler_version}\n["update", "--bundler"])
+ sys_exec! "bin/bundle update --bundler", :env => { "DEBUG" => "1" }
+ expect(out).to include %(Using bundler #{system_bundler_version}\n)
end
it "calls through to the explicit bundler version" do
- sys_exec "#{bundled_app("bin/bundle")} update --bundler=999.999.999"
+ sys_exec "bin/bundle update --bundler=999.999.999"
expect(exitstatus).to eq(42) if exitstatus
expect(err).to include("Activating bundler (~> 999.999) failed:").
and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 999.999'`")
@@ -217,14 +210,13 @@ RSpec.describe "bundle binstubs <gem>" do
context "without a lockfile" do
it "falls back to the latest installed bundler" do
- FileUtils.rm bundled_app("Gemfile.lock")
- sys_exec! bundled_app("bin/bundle").to_s
- expect(out).to eq "system bundler #{system_bundler_version}\n[]"
+ FileUtils.rm bundled_app_lock
+ sys_exec! "bin/bundle install", :env => { "DEBUG" => "1" }
+ expect(out).to include "Using bundler #{system_bundler_version}\n"
end
end
context "using another binstub" do
- let(:system_bundler_version) { :bundler }
it "loads all gems" do
sys_exec! bundled_app("bin/print_loaded_gems").to_s
expect(out).to eq %(["bundler-#{Bundler::VERSION}", "prints_loaded_gems-1.0", "rack-1.2"])
@@ -274,6 +266,8 @@ RSpec.describe "bundle binstubs <gem>" do
end
it "sets correct permissions for binstubs" do
+ skip "https://github.com/rubygems/bundler/issues/6895" if Gem.win_platform?
+
with_umask(0o002) do
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
@@ -295,7 +289,7 @@ RSpec.describe "bundle binstubs <gem>" do
bundle "binstubs rack --shebang jruby"
- expect(File.open("bin/rackup").gets).to eq("#!/usr/bin/env jruby\n")
+ expect(File.open(bundled_app("bin/rackup")).gets).to eq("#!/usr/bin/env jruby\n")
end
end
end
diff --git a/spec/bundler/commands/cache_spec.rb b/spec/bundler/commands/cache_spec.rb
index 07ec186c2f..04dfee5b16 100644
--- a/spec/bundler/commands/cache_spec.rb
+++ b/spec/bundler/commands/cache_spec.rb
@@ -198,6 +198,10 @@ RSpec.describe "bundle cache" do
end
context "with --all-platforms" do
+ before do
+ skip "doesn't put gems where it should" if Gem.win_platform?
+ end
+
it "puts the gems in vendor/cache even for other rubies" do
gemfile <<-D
source "#{file_uri_for(gem_repo1)}"
diff --git a/spec/bundler/commands/check_spec.rb b/spec/bundler/commands/check_spec.rb
index c755ef2804..8955e51dff 100644
--- a/spec/bundler/commands/check_spec.rb
+++ b/spec/bundler/commands/check_spec.rb
@@ -18,8 +18,7 @@ RSpec.describe "bundle check" do
gem "rails"
G
- Dir.chdir tmp
- bundle "check --gemfile bundled_app/Gemfile"
+ bundle "check --gemfile bundled_app/Gemfile", :dir => tmp
expect(out).to include("The Gemfile's dependencies are satisfied")
end
@@ -29,11 +28,11 @@ RSpec.describe "bundle check" do
gem "rails"
G
- FileUtils.rm("Gemfile.lock")
+ FileUtils.rm(bundled_app_lock)
bundle "check"
- expect(bundled_app("Gemfile.lock")).to exist
+ expect(bundled_app_lock).to exist
end
it "does not create a Gemfile.lock if --dry-run was passed" do
@@ -42,11 +41,11 @@ RSpec.describe "bundle check" do
gem "rails"
G
- FileUtils.rm("Gemfile.lock")
+ FileUtils.rm(bundled_app_lock)
bundle "check --dry-run"
- expect(bundled_app("Gemfile.lock")).not_to exist
+ expect(bundled_app_lock).not_to exist
end
it "prints a generic error if the missing gems are unresolvable" do
@@ -145,7 +144,7 @@ RSpec.describe "bundle check" do
end
G
- system_gems "rack-1.0.0", :path => :bundle_path
+ system_gems "rack-1.0.0", :path => default_bundle_path
lockfile <<-G
GEM
@@ -176,7 +175,7 @@ RSpec.describe "bundle check" do
end
G
- system_gems "rack-1.0.0", :path => :bundle_path
+ system_gems "rack-1.0.0", :path => default_bundle_path
lockfile <<-G
GEM
@@ -232,7 +231,7 @@ RSpec.describe "bundle check" do
G
bundle! "install", forgotten_command_line_options(:deployment => true)
- FileUtils.rm(bundled_app("Gemfile.lock"))
+ FileUtils.rm(bundled_app_lock)
bundle :check
expect(last_command).to be_failure
diff --git a/spec/bundler/commands/clean_spec.rb b/spec/bundler/commands/clean_spec.rb
index 5cc97de912..590852b02d 100644
--- a/spec/bundler/commands/clean_spec.rb
+++ b/spec/bundler/commands/clean_spec.rb
@@ -536,7 +536,7 @@ RSpec.describe "bundle clean" do
expect(out).to include("rack (1.0.0)")
end
- describe "when missing permissions" do
+ describe "when missing permissions", :permissions do
before { ENV["BUNDLE_PATH__SYSTEM"] = "true" }
let(:system_cache_path) { system_gem_path("cache") }
after do
@@ -585,11 +585,11 @@ RSpec.describe "bundle clean" do
bundle "install"
# mimic 7 length git revisions in Gemfile.lock
- gemfile_lock = File.read(bundled_app("Gemfile.lock")).split("\n")
+ gemfile_lock = File.read(bundled_app_lock).split("\n")
gemfile_lock.each_with_index do |line, index|
gemfile_lock[index] = line[0..(11 + 7)] if line.include?(" revision:")
end
- lockfile(bundled_app("Gemfile.lock"), gemfile_lock.join("\n"))
+ lockfile(bundled_app_lock, gemfile_lock.join("\n"))
bundle "config set path vendor/bundle"
bundle "install"
diff --git a/spec/bundler/commands/config_spec.rb b/spec/bundler/commands/config_spec.rb
index ef580463e5..3a6b72d988 100644
--- a/spec/bundler/commands/config_spec.rb
+++ b/spec/bundler/commands/config_spec.rb
@@ -35,7 +35,7 @@ RSpec.describe ".bundle/config" do
end
end
- describe "location" do
+ describe "location with a gemfile" do
before :each do
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
@@ -54,14 +54,23 @@ RSpec.describe ".bundle/config" do
it "can provide a relative path with the environment variable" do
FileUtils.mkdir_p bundled_app("omg")
- Dir.chdir bundled_app("omg")
ENV["BUNDLE_APP_CONFIG"] = "../foo"
- bundle "install", forgotten_command_line_options(:path => "vendor/bundle")
+ bundle "install", forgotten_command_line_options(:path => "vendor/bundle").merge(:dir => bundled_app("omg"))
expect(bundled_app(".bundle")).not_to exist
expect(bundled_app("../foo/config")).to exist
- expect(the_bundle).to include_gems "rack 1.0.0"
+ expect(the_bundle).to include_gems "rack 1.0.0", :dir => bundled_app("omg")
+ end
+ end
+
+ describe "location without a gemfile" do
+ it "works with an absolute path" do
+ ENV["BUNDLE_APP_CONFIG"] = tmp("foo/bar").to_s
+ bundle "config set --local path vendor/bundle"
+
+ expect(bundled_app(".bundle")).not_to exist
+ expect(tmp("foo/bar/config")).to exist
end
end
@@ -138,7 +147,7 @@ RSpec.describe ".bundle/config" do
it "expands the path at time of setting" do
bundle "config set --global local.foo .."
run "puts Bundler.settings['local.foo']"
- expect(out).to eq(File.expand_path(Dir.pwd + "/.."))
+ expect(out).to eq(File.expand_path(bundled_app.to_s + "/.."))
end
it "saves with parseable option" do
@@ -205,7 +214,7 @@ RSpec.describe ".bundle/config" do
it "expands the path at time of setting" do
bundle "config set --local local.foo .."
run "puts Bundler.settings['local.foo']"
- expect(out).to eq(File.expand_path(Dir.pwd + "/.."))
+ expect(out).to eq(File.expand_path(bundled_app.to_s + "/.."))
end
it "can be deleted with parseable option" do
@@ -484,7 +493,7 @@ RSpec.describe "setting gemfile via config" do
G
bundle "config set --local gemfile #{bundled_app("NotGemfile")}"
- expect(File.exist?(".bundle/config")).to eq(true)
+ expect(File.exist?(bundled_app(".bundle/config"))).to eq(true)
bundle "config list"
expect(out).to include("NotGemfile")
diff --git a/spec/bundler/commands/console_spec.rb b/spec/bundler/commands/console_spec.rb
index a0b71ff016..3092184f45 100644
--- a/spec/bundler/commands/console_spec.rb
+++ b/spec/bundler/commands/console_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe "bundle console", :bundler => "< 3" do
+RSpec.describe "bundle console", :bundler => "< 3", :readline => true do
before :each do
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
diff --git a/spec/bundler/commands/doctor_spec.rb b/spec/bundler/commands/doctor_spec.rb
index d829f00092..0731bb08db 100644
--- a/spec/bundler/commands/doctor_spec.rb
+++ b/spec/bundler/commands/doctor_spec.rb
@@ -32,6 +32,7 @@ RSpec.describe "bundle doctor" do
before(:each) do
stat = double("stat")
unwritable_file = double("file")
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
allow(Find).to receive(:find).with(Bundler.bundle_path.to_s) { [unwritable_file] }
allow(File).to receive(:stat).with(unwritable_file) { stat }
allow(stat).to receive(:uid) { Process.uid }
@@ -72,6 +73,7 @@ RSpec.describe "bundle doctor" do
before(:each) do
@stat = double("stat")
@unwritable_file = double("file")
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
allow(Find).to receive(:find).with(Bundler.bundle_path.to_s) { [@unwritable_file] }
allow(File).to receive(:stat).with(@unwritable_file) { @stat }
end
@@ -87,7 +89,7 @@ RSpec.describe "bundle doctor" do
expect(@stdout.string).not_to include("No issues")
end
- context "when home contains files that are not owned by the current process" do
+ context "when home contains files that are not owned by the current process", :permissions do
before(:each) do
allow(@stat).to receive(:uid) { 0o0000 }
end
diff --git a/spec/bundler/commands/exec_spec.rb b/spec/bundler/commands/exec_spec.rb
index 42f760ab12..442f5be8b9 100644
--- a/spec/bundler/commands/exec_spec.rb
+++ b/spec/bundler/commands/exec_spec.rb
@@ -3,7 +3,7 @@
RSpec.describe "bundle exec" do
let(:system_gems_to_install) { %w[rack-1.0.0 rack-0.9.1] }
before :each do
- system_gems(system_gems_to_install, :path => :bundle_path)
+ system_gems(system_gems_to_install, :path => default_bundle_path)
end
it "works with --gemfile flag" do
@@ -68,6 +68,8 @@ RSpec.describe "bundle exec" do
end
it "respects custom process title when loading through ruby" do
+ skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform?
+
script_that_changes_its_own_title_and_checks_if_picked_up_by_ps_unix_utility = <<~'RUBY'
Process.setproctitle("1-2-3-4-5-6-7-8-9-10-11-12-13-14-15")
puts `ps -ocommand= -p#{$$}`
@@ -91,6 +93,8 @@ RSpec.describe "bundle exec" do
end
it "handles --keep-file-descriptors" do
+ skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform?
+
require "tempfile"
command = Tempfile.new("io-test")
@@ -122,12 +126,14 @@ RSpec.describe "bundle exec" do
end
it "can run a command named --verbose" do
+ skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform?
+
install_gemfile 'gem "rack"'
- File.open("--verbose", "w") do |f|
+ File.open(bundled_app("--verbose"), "w") do |f|
f.puts "#!/bin/sh"
f.puts "echo foobar"
end
- File.chmod(0o744, "--verbose")
+ File.chmod(0o744, bundled_app("--verbose"))
with_path_as(".") do
bundle "exec -- --verbose"
end
@@ -146,21 +152,17 @@ RSpec.describe "bundle exec" do
gem "rack", "0.9.1"
G
- Dir.chdir bundled_app2 do
- install_gemfile bundled_app2("Gemfile"), <<-G
- source "#{file_uri_for(gem_repo2)}"
- gem "rack_two", "1.0.0"
- G
- end
+ install_gemfile bundled_app2("Gemfile"), <<-G, :dir => bundled_app2
+ source "#{file_uri_for(gem_repo2)}"
+ gem "rack_two", "1.0.0"
+ G
bundle! "exec rackup"
expect(out).to eq("0.9.1")
- Dir.chdir bundled_app2 do
- bundle! "exec rackup"
- expect(out).to eq("1.0.0")
- end
+ bundle! "exec rackup", :dir => bundled_app2
+ expect(out).to eq("1.0.0")
end
context "with default gems" do
@@ -254,12 +256,10 @@ RSpec.describe "bundle exec" do
gem "rack", "0.9.1"
G
- Dir.chdir bundled_app2 do
- install_gemfile bundled_app2("Gemfile"), <<-G
- source "#{file_uri_for(gem_repo2)}"
- gem "rack_two", "1.0.0"
- G
- end
+ install_gemfile bundled_app2("Gemfile"), <<-G, :dir => bundled_app2
+ source "#{file_uri_for(gem_repo2)}"
+ gem "rack_two", "1.0.0"
+ G
bundle! "exec rackup"
@@ -286,21 +286,26 @@ RSpec.describe "bundle exec" do
end
it "does not duplicate already exec'ed RUBYOPT" do
+ skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform?
+
install_gemfile <<-G
gem "rack"
G
- rubyopt = ENV["RUBYOPT"]
- rubyopt = "-r#{lib_dir}/bundler/setup #{rubyopt}"
+ bundler_setup_opt = "-r#{lib_dir}/bundler/setup"
+
+ rubyopt = opt_add(bundler_setup_opt, ENV["RUBYOPT"])
bundle "exec 'echo $RUBYOPT'"
- expect(out).to have_rubyopts(rubyopt)
+ expect(out.split(" ").count(bundler_setup_opt)).to eq(1)
bundle "exec 'echo $RUBYOPT'", :env => { "RUBYOPT" => rubyopt }
- expect(out).to have_rubyopts(rubyopt)
+ expect(out.split(" ").count(bundler_setup_opt)).to eq(1)
end
it "does not duplicate already exec'ed RUBYLIB" do
+ skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform?
+
install_gemfile <<-G
gem "rack"
G
@@ -368,6 +373,8 @@ RSpec.describe "bundle exec" do
each_prefix.call("exec") do |exec|
describe "when #{exec} is used" do
before(:each) do
+ skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform?
+
install_gemfile <<-G
gem "rack"
G
@@ -581,6 +588,8 @@ RSpec.describe "bundle exec" do
describe "with gems bundled for deployment" do
it "works when calling bundler from another script" do
+ skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform?
+
gemfile <<-G
module Monkey
def bin_path(a,b,c)
@@ -610,8 +619,8 @@ RSpec.describe "bundle exec" do
RUBY
before do
- path.open("w") {|f| f << executable }
- path.chmod(0o755)
+ bundled_app(path).open("w") {|f| f << executable }
+ bundled_app(path).chmod(0o755)
install_gemfile <<-G
gem "rack"
@@ -634,6 +643,8 @@ RSpec.describe "bundle exec" do
shared_examples_for "it runs" do
it "like a normally executed executable" do
+ skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform?
+
subject
expect(exitstatus).to eq(exit_code) if exitstatus
expect(err).to eq(expected_err)
@@ -782,7 +793,7 @@ __FILE__: #{path.to_s.inspect}
end
context "when the path is relative with a leading ./" do
- let(:path) { Pathname.new("./#{super().relative_path_from(Pathname.pwd)}") }
+ let(:path) { Pathname.new("./#{super().relative_path_from(bundled_app)}") }
pending "relative paths with ./ have absolute __FILE__"
end
@@ -813,6 +824,8 @@ __FILE__: #{path.to_s.inspect}
RUBY
it "receives the signal" do
+ skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform?
+
bundle!("exec #{path}") do |_, o, thr|
o.gets # Consumes 'Started' and ensures that thread has started
Process.kill("INT", thr.pid)
@@ -834,6 +847,8 @@ __FILE__: #{path.to_s.inspect}
RUBY
it "makes sure no unexpected signals are restored to DEFAULT" do
+ skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform?
+
test_signals.each do |n|
Signal.trap(n, "IGNORE")
end
@@ -858,11 +873,13 @@ __FILE__: #{path.to_s.inspect}
end
it "correctly shells out", :ruby_repo do
+ skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform?
+
file = bundled_app("file_that_bundle_execs.rb")
- create_file(file, <<-RB)
+ create_file(file, <<-RUBY)
#!#{Gem.ruby}
puts `bundle exec echo foo`
- RB
+ RUBY
file.chmod(0o777)
bundle! "exec #{file}"
expect(out).to eq("foo")
@@ -874,27 +891,28 @@ __FILE__: #{path.to_s.inspect}
let(:expected) { ruby "gem 'openssl', '< 999999'; require 'openssl'; puts OpenSSL::VERSION", :artifice => nil }
it "only leaves the default gem in the stdlib available" do
+ skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform?
skip "openssl isn't a default gem" if expected.empty?
install_gemfile! "" # must happen before installing the broken system gem
build_repo4 do
build_gem "openssl", openssl_version do |s|
- s.write("lib/openssl.rb", <<-RB)
+ s.write("lib/openssl.rb", <<-RUBY)
raise "custom openssl should not be loaded, it's not in the gemfile!"
- RB
+ RUBY
end
end
system_gems(:bundler, "openssl-#{openssl_version}", :gem_repo => gem_repo4)
file = bundled_app("require_openssl.rb")
- create_file(file, <<-RB)
+ create_file(file, <<-RUBY)
#!/usr/bin/env ruby
require "openssl"
puts OpenSSL::VERSION
warn Gem.loaded_specs.values.map(&:full_name)
- RB
+ RUBY
file.chmod(0o777)
aggregate_failures do
diff --git a/spec/bundler/commands/help_spec.rb b/spec/bundler/commands/help_spec.rb
index f4f90b9347..658b1374d4 100644
--- a/spec/bundler/commands/help_spec.rb
+++ b/spec/bundler/commands/help_spec.rb
@@ -28,6 +28,8 @@ RSpec.describe "bundle help" do
end
it "looks for a binary and executes it with --help option if it's named bundler-<task>" do
+ skip "obscure error" if Gem.win_platform?
+
File.open(tmp("bundler-testtasks"), "w", 0o755) do |f|
f.puts "#!/usr/bin/env ruby\nputs ARGV.join(' ')\n"
end
diff --git a/spec/bundler/commands/info_spec.rb b/spec/bundler/commands/info_spec.rb
index 4572823498..df2d5f2824 100644
--- a/spec/bundler/commands/info_spec.rb
+++ b/spec/bundler/commands/info_spec.rb
@@ -3,22 +3,23 @@
RSpec.describe "bundle info" do
context "with a standard Gemfile" do
before do
- install_gemfile <<-G
+ install_gemfile! <<-G
source "#{file_uri_for(gem_repo1)}"
gem "rails"
+ gem "has_metadata"
G
end
it "creates a Gemfile.lock when invoked with a gem name" do
- FileUtils.rm("Gemfile.lock")
+ FileUtils.rm(bundled_app_lock)
- bundle "info rails"
+ bundle! "info rails"
- expect(bundled_app("Gemfile.lock")).to exist
+ expect(bundled_app_lock).to exist
end
it "prints information if gem exists in bundle" do
- bundle "info rails"
+ bundle! "info rails"
expect(out).to include "* rails (2.3.2)
\tSummary: This is just a fake gem for testing
\tHomepage: http://example.com
@@ -26,12 +27,12 @@ RSpec.describe "bundle info" do
end
it "prints path if gem exists in bundle" do
- bundle "info rails --path"
+ bundle! "info rails --path"
expect(out).to eq(default_bundle_path("gems", "rails-2.3.2").to_s)
end
it "prints the path to the running bundler" do
- bundle "info bundler --path"
+ bundle! "info bundler --path"
expect(out).to eq(root.to_s)
end
@@ -42,12 +43,28 @@ RSpec.describe "bundle info" do
context "given a default gem shippped in ruby", :ruby_repo do
it "prints information about the default gem" do
- bundle "info rdoc"
+ bundle! "info rdoc"
expect(out).to include("* rdoc")
expect(out).to include("Default Gem: yes")
end
end
+ context "given a gem with metadata" do
+ it "prints the gem metadata" do
+ bundle! "info has_metadata"
+ expect(out).to include "* has_metadata (1.0)
+\tSummary: This is just a fake gem for testing
+\tHomepage: http://example.com
+\tDocumentation: https://www.example.info/gems/bestgemever/0.0.1
+\tSource Code: https://example.com/user/bestgemever
+\tWiki: https://example.com/user/bestgemever/wiki
+\tChangelog: https://example.com/user/bestgemever/CHANGELOG.md
+\tBug Tracker: https://example.com/user/bestgemever/issues
+\tMailing List: https://groups.example.com/bestgemever
+\tPath: #{default_bundle_path("gems", "has_metadata-1.0")}"
+ end
+ end
+
context "when gem does not have homepage" do
before do
build_repo2 do
@@ -70,12 +87,12 @@ RSpec.describe "bundle info" do
end
it "prints out git info" do
- install_gemfile <<-G
+ install_gemfile! <<-G
gem "foo", :git => "#{lib_path("foo-1.0")}"
G
expect(the_bundle).to include_gems "foo 1.0"
- bundle "info foo"
+ bundle! "info foo"
expect(out).to include("foo (1.0 #{@git.ref_for("master", 6)}")
end
@@ -85,28 +102,28 @@ RSpec.describe "bundle info" do
end
@revision = revision_for(lib_path("foo-1.0"))[0...6]
- install_gemfile <<-G
+ install_gemfile! <<-G
gem "foo", :git => "#{lib_path("foo-1.0")}", :branch => "omg"
G
expect(the_bundle).to include_gems "foo 1.0.omg"
- bundle "info foo"
+ bundle! "info foo"
expect(out).to include("foo (1.0 #{@git.ref_for("omg", 6)}")
end
it "doesn't print the branch when tied to a ref" do
sha = revision_for(lib_path("foo-1.0"))
- install_gemfile <<-G
+ install_gemfile! <<-G
gem "foo", :git => "#{lib_path("foo-1.0")}", :ref => "#{sha}"
G
- bundle "info foo"
+ bundle! "info foo"
expect(out).to include("foo (1.0 #{sha[0..6]})")
end
it "handles when a version is a '-' prerelease" do
@git = build_git("foo", "1.0.0-beta.1", :path => lib_path("foo"))
- install_gemfile <<-G
+ install_gemfile! <<-G
gem "foo", "1.0.0-beta.1", :git => "#{lib_path("foo")}"
G
expect(the_bundle).to include_gems "foo 1.0.0.pre.beta.1"
@@ -117,21 +134,21 @@ RSpec.describe "bundle info" do
end
context "with a valid regexp for gem name" do
- it "presents alternatives" do
- install_gemfile <<-G
+ it "presents alternatives", :readline do
+ install_gemfile! <<-G
source "#{file_uri_for(gem_repo1)}"
gem "rack"
gem "rack-obama"
G
- bundle "info rac"
+ bundle! "info rac"
expect(out).to eq "1 : rack\n2 : rack-obama\n0 : - exit -\n>"
end
end
context "with an invalid regexp for gem name" do
it "does not find the gem" do
- install_gemfile <<-G
+ install_gemfile! <<-G
source "#{file_uri_for(gem_repo1)}"
gem "rails"
G
diff --git a/spec/bundler/commands/init_spec.rb b/spec/bundler/commands/init_spec.rb
index 7960ce85bd..ed52187115 100644
--- a/spec/bundler/commands/init_spec.rb
+++ b/spec/bundler/commands/init_spec.rb
@@ -4,7 +4,7 @@ RSpec.describe "bundle init" do
it "generates a Gemfile" do
bundle! :init
expect(out).to include("Writing new Gemfile")
- expect(bundled_app("Gemfile")).to be_file
+ expect(bundled_app_gemfile).to be_file
end
context "when a Gemfile already exists" do
@@ -15,7 +15,7 @@ RSpec.describe "bundle init" do
end
it "does not change existing Gemfiles" do
- expect { bundle :init }.not_to change { File.read(bundled_app("Gemfile")) }
+ expect { bundle :init }.not_to change { File.read(bundled_app_gemfile) }
end
it "notifies the user that an existing Gemfile already exists" do
@@ -32,9 +32,7 @@ RSpec.describe "bundle init" do
FileUtils.mkdir bundled_app(subdir)
- Dir.chdir bundled_app(subdir) do
- bundle! :init
- end
+ bundle! :init, :dir => bundled_app(subdir)
expect(out).to include("Writing new Gemfile")
expect(bundled_app("#{subdir}/Gemfile")).to be_file
@@ -50,9 +48,7 @@ RSpec.describe "bundle init" do
mode = File.stat(bundled_app(subdir)).mode ^ 0o222
FileUtils.chmod mode, bundled_app(subdir)
- Dir.chdir bundled_app(subdir) do
- bundle :init
- end
+ bundle :init, :dir => bundled_app(subdir)
expect(err).to include("directory is not writable")
expect(Dir[bundled_app("#{subdir}/*")]).to be_empty
@@ -75,7 +71,7 @@ RSpec.describe "bundle init" do
bundle :init, :gemspec => spec_file
- gemfile = bundled_app("Gemfile").read
+ gemfile = bundled_app_gemfile.read
expect(gemfile).to match(%r{source 'https://rubygems.org'})
expect(gemfile.scan(/gem "rack", "= 1.0.1"/).size).to eq(1)
expect(gemfile.scan(/gem "rspec", "= 1.2"/).size).to eq(1)
@@ -133,9 +129,7 @@ RSpec.describe "bundle init" do
FileUtils.mkdir bundled_app(subdir)
- Dir.chdir bundled_app(subdir) do
- bundle! :init
- end
+ bundle! :init, :dir => bundled_app(subdir)
expect(out).to include("Writing new gems.rb")
expect(bundled_app("#{subdir}/gems.rb")).to be_file
diff --git a/spec/bundler/commands/inject_spec.rb b/spec/bundler/commands/inject_spec.rb
index 01c1f91877..78355edab3 100644
--- a/spec/bundler/commands/inject_spec.rb
+++ b/spec/bundler/commands/inject_spec.rb
@@ -10,9 +10,9 @@ RSpec.describe "bundle inject", :bundler => "< 3" do
context "without a lockfile" do
it "locks with the injected gems" do
- expect(bundled_app("Gemfile.lock")).not_to exist
+ expect(bundled_app_lock).not_to exist
bundle "inject 'rack-obama' '> 0'"
- expect(bundled_app("Gemfile.lock").read).to match(/rack-obama/)
+ expect(bundled_app_lock.read).to match(/rack-obama/)
end
end
@@ -22,15 +22,15 @@ RSpec.describe "bundle inject", :bundler => "< 3" do
end
it "adds the injected gems to the Gemfile" do
- expect(bundled_app("Gemfile").read).not_to match(/rack-obama/)
+ expect(bundled_app_gemfile.read).not_to match(/rack-obama/)
bundle "inject 'rack-obama' '> 0'"
- expect(bundled_app("Gemfile").read).to match(/rack-obama/)
+ expect(bundled_app_gemfile.read).to match(/rack-obama/)
end
it "locks with the injected gems" do
- expect(bundled_app("Gemfile.lock").read).not_to match(/rack-obama/)
+ expect(bundled_app_lock.read).not_to match(/rack-obama/)
bundle "inject 'rack-obama' '> 0'"
- expect(bundled_app("Gemfile.lock").read).to match(/rack-obama/)
+ expect(bundled_app_lock.read).to match(/rack-obama/)
end
end
@@ -54,7 +54,7 @@ Usage: "bundle inject GEM VERSION"
context "with source option" do
it "add gem with source option in gemfile" do
bundle "inject 'foo' '>0' --source #{file_uri_for(gem_repo1)}"
- gemfile = bundled_app("Gemfile").read
+ gemfile = bundled_app_gemfile.read
str = "gem \"foo\", \"> 0\", :source => \"#{file_uri_for(gem_repo1)}\""
expect(gemfile).to include str
end
@@ -63,14 +63,14 @@ Usage: "bundle inject GEM VERSION"
context "with group option" do
it "add gem with group option in gemfile" do
bundle "inject 'rack-obama' '>0' --group=development"
- gemfile = bundled_app("Gemfile").read
+ gemfile = bundled_app_gemfile.read
str = "gem \"rack-obama\", \"> 0\", :group => :development"
expect(gemfile).to include str
end
it "add gem with multiple groups in gemfile" do
bundle "inject 'rack-obama' '>0' --group=development,test"
- gemfile = bundled_app("Gemfile").read
+ gemfile = bundled_app_gemfile.read
str = "gem \"rack-obama\", \"> 0\", :groups => [:development, :test]"
expect(gemfile).to include str
end
@@ -88,13 +88,13 @@ Usage: "bundle inject GEM VERSION"
it "injects anyway" do
bundle "inject 'rack-obama' '> 0'"
- expect(bundled_app("Gemfile").read).to match(/rack-obama/)
+ expect(bundled_app_gemfile.read).to match(/rack-obama/)
end
it "locks with the injected gems" do
- expect(bundled_app("Gemfile.lock").read).not_to match(/rack-obama/)
+ expect(bundled_app_lock.read).not_to match(/rack-obama/)
bundle "inject 'rack-obama' '> 0'"
- expect(bundled_app("Gemfile.lock").read).to match(/rack-obama/)
+ expect(bundled_app_lock.read).to match(/rack-obama/)
end
it "restores frozen afterwards" do
@@ -111,7 +111,7 @@ Usage: "bundle inject GEM VERSION"
bundle "inject 'rack' '> 0'"
expect(err).to match(/trying to install in deployment mode after changing/)
- expect(bundled_app("Gemfile.lock").read).not_to match(/rack-obama/)
+ expect(bundled_app_lock.read).not_to match(/rack-obama/)
end
end
end
diff --git a/spec/bundler/commands/install_spec.rb b/spec/bundler/commands/install_spec.rb
index b57d81b10a..87f34c1563 100644
--- a/spec/bundler/commands/install_spec.rb
+++ b/spec/bundler/commands/install_spec.rb
@@ -17,7 +17,7 @@ RSpec.describe "bundle install with gem sources" do
G
expect(err).to include('StandardError, "FAIL"')
- expect(bundled_app("Gemfile.lock")).not_to exist
+ expect(bundled_app_lock).not_to exist
end
it "creates a Gemfile.lock" do
@@ -26,7 +26,7 @@ RSpec.describe "bundle install with gem sources" do
gem "rack"
G
- expect(bundled_app("Gemfile.lock")).to exist
+ expect(bundled_app_lock).to exist
end
it "does not create ./.bundle by default", :bundler => "< 3" do
@@ -66,13 +66,13 @@ RSpec.describe "bundle install with gem sources" do
gem 'rack'
G
- lockfile = File.read(bundled_app("Gemfile.lock"))
+ lockfile = File.read(bundled_app_lock)
install_gemfile <<-G
raise StandardError, "FAIL"
G
- expect(File.read(bundled_app("Gemfile.lock"))).to eq(lockfile)
+ expect(File.read(bundled_app_lock)).to eq(lockfile)
end
it "does not touch the lockfile if nothing changed" do
@@ -81,7 +81,7 @@ RSpec.describe "bundle install with gem sources" do
gem "rack"
G
- expect { run "1" }.not_to change { File.mtime(bundled_app("Gemfile.lock")) }
+ expect { run "1" }.not_to change { File.mtime(bundled_app_lock) }
end
it "fetches gems" do
@@ -176,7 +176,7 @@ RSpec.describe "bundle install with gem sources" do
end
it "does not reinstall any gem that is already available locally" do
- system_gems "activesupport-2.3.2", :path => :bundle_path
+ system_gems "activesupport-2.3.2", :path => default_bundle_path
build_repo2 do
build_gem "activesupport", "2.3.2" do |s|
@@ -218,6 +218,8 @@ RSpec.describe "bundle install with gem sources" do
describe "with a gem that installs multiple platforms" do
it "installs gems for the local platform as first choice" do
+ skip "version is 1.0, not 1.0.0" if Gem.win_platform?
+
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem "platform_specific"
@@ -318,7 +320,7 @@ RSpec.describe "bundle install with gem sources" do
install_gemfile <<-G
G
- expect(File.exist?(bundled_app("Gemfile.lock"))).to eq(true)
+ expect(File.exist?(bundled_app_lock)).to eq(true)
end
context "throws a warning if a gem is added twice in Gemfile" do
@@ -372,6 +374,8 @@ RSpec.describe "bundle install with gem sources" do
end
it "gracefully handles error when rubygems server is unavailable" do
+ skip "networking issue" if Gem.win_platform?
+
install_gemfile <<-G, :artifice => nil
source "#{file_uri_for(gem_repo1)}"
source "http://0.0.0.0:9384" do
@@ -500,23 +504,20 @@ RSpec.describe "bundle install with gem sources" do
end
describe "when Bundler root contains regex chars" do
- before do
+ it "doesn't blow up" do
root_dir = tmp("foo[]bar")
FileUtils.mkdir_p(root_dir)
- in_app_root_custom(root_dir)
- end
- it "doesn't blow up" do
build_lib "foo"
gemfile = <<-G
gem 'foo', :path => "#{lib_path("foo-1.0")}"
G
- File.open("Gemfile", "w") do |file|
+ File.open("#{root_dir}/Gemfile", "w") do |file|
file.puts gemfile
end
- bundle :install
+ bundle :install, :dir => root_dir
expect(exitstatus).to eq(0) if exitstatus
end
@@ -536,7 +537,7 @@ RSpec.describe "bundle install with gem sources" do
end
end
- describe "when bundle path does not have write access" do
+ describe "when bundle path does not have write access", :permissions do
before do
FileUtils.mkdir_p(bundled_app("vendor"))
gemfile <<-G
diff --git a/spec/bundler/commands/list_spec.rb b/spec/bundler/commands/list_spec.rb
index 71d2136d38..60efd38cb7 100644
--- a/spec/bundler/commands/list_spec.rb
+++ b/spec/bundler/commands/list_spec.rb
@@ -24,6 +24,7 @@ RSpec.describe "bundle list" do
gem "rack"
gem "rspec", :group => [:test]
+ gem "rails", :group => [:production]
G
end
@@ -32,6 +33,7 @@ RSpec.describe "bundle list" do
bundle! "list --without-group test"
expect(out).to include(" * rack (1.0.0)")
+ expect(out).to include(" * rails (2.3.2)")
expect(out).not_to include(" * rspec (1.2.7)")
end
end
@@ -43,6 +45,16 @@ RSpec.describe "bundle list" do
expect(err).to eq "`random` group could not be found."
end
end
+
+ context "when multiple groups" do
+ it "prints the gems not in the specified groups" do
+ bundle! "list --without-group test production"
+
+ expect(out).to include(" * rack (1.0.0)")
+ expect(out).not_to include(" * rails (2.3.2)")
+ expect(out).not_to include(" * rspec (1.2.7)")
+ end
+ end
end
describe "with only-group option" do
@@ -52,6 +64,7 @@ RSpec.describe "bundle list" do
gem "rack"
gem "rspec", :group => [:test]
+ gem "rails", :group => [:production]
G
end
@@ -71,6 +84,16 @@ RSpec.describe "bundle list" do
expect(err).to eq "`random` group could not be found."
end
end
+
+ context "when multiple groups" do
+ it "prints the gems in the specified groups" do
+ bundle! "list --only-group default production"
+
+ expect(out).to include(" * rack (1.0.0)")
+ expect(out).to include(" * rails (2.3.2)")
+ expect(out).not_to include(" * rspec (1.2.7)")
+ end
+ end
end
context "with name-only option" do
diff --git a/spec/bundler/commands/lock_spec.rb b/spec/bundler/commands/lock_spec.rb
index 1d9813a835..466f4b739d 100644
--- a/spec/bundler/commands/lock_spec.rb
+++ b/spec/bundler/commands/lock_spec.rb
@@ -38,8 +38,8 @@ RSpec.describe "bundle lock" do
actionpack (= 2.3.2)
activerecord (= 2.3.2)
activeresource (= 2.3.2)
- rake (= 12.3.2)
- rake (12.3.2)
+ rake (= 13.0.1)
+ rake (13.0.1)
with_license (1.0)
PLATFORMS
@@ -133,7 +133,7 @@ RSpec.describe "bundle lock" do
end
it "update specific gems using --update" do
- lockfile @lockfile.gsub("2.3.2", "2.3.1").gsub("12.3.2", "10.0.1")
+ lockfile @lockfile.gsub("2.3.2", "2.3.1").gsub("13.0.1", "10.0.1")
bundle "lock --update rails rake"
@@ -195,6 +195,8 @@ RSpec.describe "bundle lock" do
gem 'foo'
gem 'qux'
G
+
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
end
it "single gem updates dependent gem to minor" do
@@ -213,12 +215,15 @@ RSpec.describe "bundle lock" do
it "supports adding new platforms" do
bundle! "lock --add-platform java x86-mingw32"
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
lockfile = Bundler::LockfileParser.new(read_lockfile)
expect(lockfile.platforms).to match_array(local_platforms.unshift(java, mingw).uniq)
end
it "supports adding the `ruby` platform" do
bundle! "lock --add-platform ruby"
+
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
lockfile = Bundler::LockfileParser.new(read_lockfile)
expect(lockfile.platforms).to match_array(local_platforms.unshift("ruby").uniq)
end
@@ -231,6 +236,7 @@ RSpec.describe "bundle lock" do
it "allows removing platforms" do
bundle! "lock --add-platform java x86-mingw32"
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
lockfile = Bundler::LockfileParser.new(read_lockfile)
expect(lockfile.platforms).to match_array(local_platforms.unshift(java, mingw).uniq)
@@ -245,7 +251,7 @@ RSpec.describe "bundle lock" do
expect(err).to include("Removing all platforms from the bundle is not allowed")
end
- # from https://github.com/bundler/bundler/issues/4896
+ # from https://github.com/rubygems/bundler/issues/4896
it "properly adds platforms when platform requirements come from different dependencies" do
build_repo4 do
build_gem "ffi", "1.9.14"
diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb
index 708b41f623..62ffaedcc0 100644
--- a/spec/bundler/commands/newgem_spec.rb
+++ b/spec/bundler/commands/newgem_spec.rb
@@ -17,7 +17,6 @@ RSpec.describe "bundle gem" do
let(:require_path) { "mygem" }
before do
- global_config "BUNDLE_GEM__MIT" => "false", "BUNDLE_GEM__TEST" => "false", "BUNDLE_GEM__COC" => "false"
git_config_content = <<-EOF
[user]
name = "Bundler User"
@@ -64,7 +63,7 @@ RSpec.describe "bundle gem" do
bundle! "gem #{gem_name} #{flags}"
end
- it "generates a gem skeleton with a .git folder" do
+ it "generates a gem skeleton with a .git folder", :readline do
gem_skeleton_assertions
expect(bundled_app("#{gem_name}/.git")).to exist
end
@@ -82,7 +81,7 @@ RSpec.describe "bundle gem" do
end
end
- context "when passing --no-git" do
+ context "when passing --no-git", :readline do
before do
bundle! "gem #{gem_name} --no-git"
end
@@ -148,7 +147,54 @@ RSpec.describe "bundle gem" do
end
end
- context "README.md" do
+ shared_examples_for "--rubocop flag" do
+ before do
+ bundle! "gem #{gem_name} --rubocop"
+ end
+
+ it "generates a gem skeleton with rubocop" do
+ gem_skeleton_assertions
+ expect(bundled_app("test-gem/Rakefile")).to read_as(
+ include('require "rubocop/rake_task"').
+ and(include("RuboCop::RakeTask.new").
+ and(match(/:default.+:rubocop/)))
+ )
+ end
+
+ it "includes rubocop in generated Gemfile" do
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
+ builder = Bundler::Dsl.new
+ builder.eval_gemfile(bundled_app("#{gem_name}/Gemfile"))
+ builder.dependencies
+ rubocop_dep = builder.dependencies.find {|d| d.name == "rubocop" }
+ expect(rubocop_dep).not_to be_nil
+ end
+ end
+
+ shared_examples_for "--no-rubocop flag" do
+ define_negated_matcher :exclude, :include
+
+ before do
+ bundle! "gem #{gem_name} --no-rubocop"
+ end
+
+ it "generates a gem skeleton without rubocop" do
+ gem_skeleton_assertions
+ expect(bundled_app("test-gem/Rakefile")).to read_as(exclude("rubocop"))
+ expect(bundled_app("test-gem/#{gem_name}.gemspec")).to read_as(exclude("rubocop"))
+ end
+
+ it "does not include rubocop in generated Gemfile" do
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
+ builder = Bundler::Dsl.new
+ builder.eval_gemfile(bundled_app("#{gem_name}/Gemfile"))
+ builder.dependencies
+ rubocop_dep = builder.dependencies.find {|d| d.name == "rubocop" }
+ expect(rubocop_dep).to be_nil
+ end
+ end
+
+ context "README.md", :readline do
context "git config github.user present" do
before do
bundle! "gem #{gem_name}"
@@ -163,7 +209,7 @@ RSpec.describe "bundle gem" do
context "git config github.user is absent" do
before do
sys_exec("git config --unset github.user")
- bundle "gem #{gem_name}"
+ bundle! "gem #{gem_name}"
end
it "contribute URL set to [USERNAME]" do
@@ -173,18 +219,18 @@ RSpec.describe "bundle gem" do
end
end
- it "creates a new git repository" do
- bundle "gem #{gem_name}"
+ it "creates a new git repository", :readline do
+ bundle! "gem #{gem_name}"
expect(bundled_app("#{gem_name}/.git")).to exist
end
- context "when git is not available" do
+ context "when git is not available", :readline do
# This spec cannot have `git` available in the test env
before do
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" => ""
+ sys_exec! "#{Gem.ruby} #{load_path_str} #{bindir.join("bundle")} gem #{gem_name}", :env => { "PATH" => "" }
end
it "creates the gem without the need for git" do
@@ -200,25 +246,24 @@ RSpec.describe "bundle gem" do
end
end
- it "generates a valid gemspec" do
+ it "generates a valid gemspec", :readline do
bundle! "gem newgem --bin"
prepare_gemspec(bundled_app("newgem", "newgem.gemspec"))
- Dir.chdir(bundled_app("newgem")) do
- gems = ["rake-12.3.2"]
- system_gems gems, :path => :bundle_path
- bundle! "exec rake build"
- end
+ gems = ["rake-13.0.1"]
+ path = Bundler.feature_flag.default_install_uses_path? ? local_gem_path(:base => bundled_app("newgem")) : system_gem_path
+ system_gems gems, :path => path
+ bundle! "exec rake build", :dir => bundled_app("newgem")
expect(last_command.stdboth).not_to include("ERROR")
end
- context "gem naming with relative paths" do
+ context "gem naming with relative paths", :readline do
it "resolves ." do
create_temporary_dir("tmp")
- bundle "gem ."
+ bundle! "gem .", :dir => bundled_app("tmp")
expect(bundled_app("tmp/lib/tmp.rb")).to exist
end
@@ -226,7 +271,7 @@ RSpec.describe "bundle gem" do
it "resolves .." do
create_temporary_dir("temp/empty_dir")
- bundle "gem .."
+ bundle! "gem ..", :dir => bundled_app("temp/empty_dir")
expect(bundled_app("temp/lib/temp.rb")).to exist
end
@@ -234,14 +279,13 @@ RSpec.describe "bundle gem" do
it "resolves relative directory" do
create_temporary_dir("tmp/empty/tmp")
- bundle "gem ../../empty"
+ bundle! "gem ../../empty", :dir => bundled_app("tmp/empty/tmp")
expect(bundled_app("tmp/empty/lib/empty.rb")).to exist
end
def create_temporary_dir(dir)
- FileUtils.mkdir_p(dir)
- Dir.chdir(dir)
+ FileUtils.mkdir_p(bundled_app(dir))
end
end
@@ -278,9 +322,9 @@ RSpec.describe "bundle gem" do
context "git config user.{name,email} is not set" do
before do
- `git config --unset user.name`
- `git config --unset user.email`
- bundle "gem #{gem_name}"
+ sys_exec("git config --unset user.name", :dir => bundled_app)
+ sys_exec("git config --unset user.email", :dir => bundled_app)
+ bundle! "gem #{gem_name}"
end
it_should_behave_like "git config is absent"
@@ -316,7 +360,7 @@ RSpec.describe "bundle gem" do
it "runs rake without problems" do
bundle! "gem #{gem_name}"
- system_gems ["rake-12.3.2"]
+ system_gems ["rake-13.0.1"]
rakefile = strip_whitespace <<-RAKEFILE
task :default do
@@ -327,15 +371,13 @@ RSpec.describe "bundle gem" do
file.puts rakefile
end
- Dir.chdir(bundled_app(gem_name)) do
- sys_exec(rake)
- expect(out).to include("SUCCESS")
- end
+ sys_exec(rake, :dir => bundled_app(gem_name))
+ expect(out).to include("SUCCESS")
end
context "--exe parameter set" do
before do
- bundle "gem #{gem_name} --exe"
+ bundle! "gem #{gem_name} --exe"
end
it "builds exe skeleton" do
@@ -349,7 +391,7 @@ RSpec.describe "bundle gem" do
context "--bin parameter set" do
before do
- bundle "gem #{gem_name} --bin"
+ bundle! "gem #{gem_name} --bin"
end
it "builds exe skeleton" do
@@ -363,7 +405,7 @@ RSpec.describe "bundle gem" do
context "no --test parameter" do
before do
- bundle "gem #{gem_name}"
+ bundle! "gem #{gem_name}"
end
it "doesn't create any spec/test file" do
@@ -371,13 +413,13 @@ RSpec.describe "bundle gem" do
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
+ expect(bundled_app("#{gem_name}/test/test_helper.rb")).to_not exist
end
end
context "--test parameter set to rspec" do
before do
- bundle "gem #{gem_name} --test=rspec"
+ bundle! "gem #{gem_name} --test=rspec"
end
it "builds spec skeleton" do
@@ -387,13 +429,12 @@ RSpec.describe "bundle gem" do
end
it "depends on a specific version of rspec in generated Gemfile" do
- Dir.chdir(bundled_app(gem_name)) do
- builder = Bundler::Dsl.new
- 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
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
+ builder = Bundler::Dsl.new
+ 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
it "requires the main file" do
@@ -408,7 +449,7 @@ RSpec.describe "bundle gem" do
context "gem.test setting set to rspec" do
before do
bundle "config set gem.test rspec"
- bundle "gem #{gem_name}"
+ bundle! "gem #{gem_name}"
end
it "builds spec skeleton" do
@@ -421,7 +462,7 @@ RSpec.describe "bundle gem" do
context "gem.test setting set to rspec and --test is set to minitest" do
before do
bundle "config set gem.test rspec"
- bundle "gem #{gem_name} --test=minitest"
+ bundle! "gem #{gem_name} --test=minitest"
end
it "builds spec skeleton" do
@@ -436,13 +477,12 @@ RSpec.describe "bundle gem" do
end
it "depends on a specific version of minitest" do
- Dir.chdir(bundled_app(gem_name)) do
- builder = Bundler::Dsl.new
- 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
- end
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
+ builder = Bundler::Dsl.new
+ 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
end
it "builds spec skeleton" do
@@ -454,7 +494,7 @@ RSpec.describe "bundle gem" do
expect(bundled_app("#{gem_name}/test/test_helper.rb").read).to include(%(require "#{require_path}"))
end
- it "requires 'minitest_helper'" do
+ it "requires 'test_helper'" do
expect(bundled_app("#{gem_name}/test/#{require_path}_test.rb").read).to include(%(require "test_helper"))
end
@@ -466,6 +506,62 @@ RSpec.describe "bundle gem" do
context "gem.test setting set to minitest" do
before do
bundle "config set gem.test minitest"
+ bundle! "gem #{gem_name}"
+ 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("#{gem_name}/Rakefile").read).to eq(rakefile)
+ end
+ end
+
+ context "--test parameter set to test-unit" do
+ before do
+ bundle "gem #{gem_name} --test=test-unit"
+ end
+
+ it "depends on a specific version of test-unit" do
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
+ builder = Bundler::Dsl.new
+ builder.eval_gemfile(bundled_app("#{gem_name}/Gemfile"))
+ builder.dependencies
+ test_unit_dep = builder.dependencies.find {|d| d.name == "test-unit" }
+ expect(test_unit_dep).to be_specific
+ end
+
+ it "builds spec skeleton" do
+ 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 the main file" do
+ expect(bundled_app("#{gem_name}/test/test_helper.rb").read).to include(%(require "#{require_path}"))
+ end
+
+ it "requires 'test_helper'" do
+ 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("#{gem_name}/test/#{require_path}_test.rb").read).to include("assert_equal(\"expected\", \"actual\")")
+ end
+ end
+
+ context "gem.test setting set to test-unit" do
+ before do
+ bundle "config set gem.test test-unit"
bundle "gem #{gem_name}"
end
@@ -489,12 +585,12 @@ RSpec.describe "bundle gem" do
context "--test with no arguments" do
before do
- bundle "gem #{gem_name} --test"
+ bundle! "gem #{gem_name} --test"
end
it "defaults to rspec" do
expect(bundled_app("#{gem_name}/spec/spec_helper.rb")).to exist
- expect(bundled_app("#{gem_name}/test/minitest_helper.rb")).to_not exist
+ expect(bundled_app("#{gem_name}/test/test_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
@@ -505,56 +601,75 @@ RSpec.describe "bundle gem" do
context "--edit option" do
it "opens the generated gemspec in the user's text editor" do
output = bundle "gem #{gem_name} --edit=echo"
- gemspec_path = File.join(Dir.pwd, gem_name, "#{gem_name}.gemspec")
+ gemspec_path = File.join(bundled_app, gem_name, "#{gem_name}.gemspec")
expect(output).to include("echo \"#{gemspec_path}\"")
end
end
end
- context "testing --mit and --coc options against bundle config settings" do
+ context "testing --mit and --coc options against bundle config settings", :readline 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"
+ global_config "BUNDLE_GEM__MIT" => "true"
end
it_behaves_like "--mit flag"
it_behaves_like "--no-mit flag"
end
context "with mit option in bundle config settings set to false" do
+ before do
+ global_config "BUNDLE_GEM__MIT" => "false"
+ end
it_behaves_like "--mit flag"
it_behaves_like "--no-mit flag"
end
context "with coc option in bundle config settings set to true" do
before do
- global_config "BUNDLE_GEM__MIT" => "false", "BUNDLE_GEM__TEST" => "false", "BUNDLE_GEM__COC" => "true"
+ global_config "BUNDLE_GEM__COC" => "true"
end
it_behaves_like "--coc flag"
it_behaves_like "--no-coc flag"
end
context "with coc option in bundle config settings set to false" do
+ before do
+ global_config "BUNDLE_GEM__COC" => "false"
+ end
it_behaves_like "--coc flag"
it_behaves_like "--no-coc flag"
end
+
+ context "with rubocop option in bundle config settings set to true" do
+ before do
+ global_config "BUNDLE_GEM__RUBOCOP" => "true"
+ end
+ it_behaves_like "--rubocop flag"
+ it_behaves_like "--no-rubocop flag"
+ end
+
+ context "with rubocop option in bundle config settings set to false" do
+ before do
+ global_config "BUNDLE_GEM__RUBOCOP" => "false"
+ end
+ it_behaves_like "--rubocop flag"
+ it_behaves_like "--no-rubocop flag"
+ end
end
- context "gem naming with underscore" do
+ context "gem naming with underscore", :readline do
let(:gem_name) { "test_gem" }
let(:require_path) { "test_gem" }
let(:flags) { nil }
- before do
- bundle! ["gem", gem_name, flags].compact.join(" ")
- end
-
it "does not nest constants" do
+ bundle! ["gem", gem_name, flags].compact.join(" ")
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
@@ -564,6 +679,10 @@ RSpec.describe "bundle gem" do
context "--ext parameter set" do
let(:flags) { "--ext" }
+ before do
+ bundle! ["gem", gem_name, flags].compact.join(" ")
+ end
+
it "builds ext skeleton" do
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
@@ -585,7 +704,7 @@ RSpec.describe "bundle gem" do
ext.lib_dir = "lib/#{gem_name}"
end
- task :default => [:clobber, :compile, :spec]
+ task :default => [:clobber, :compile]
RAKEFILE
expect(bundled_app("#{gem_name}/Rakefile").read).to eq(rakefile)
@@ -593,16 +712,13 @@ RSpec.describe "bundle gem" do
end
end
- context "gem naming with dashed" do
+ context "gem naming with dashed", :readline 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
+ bundle! "gem #{gem_name}"
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
@@ -611,7 +727,7 @@ RSpec.describe "bundle gem" do
end
describe "uncommon gem names" do
- it "can deal with two dashes" do
+ it "can deal with two dashes", :readline do
bundle! "gem a--a"
expect(bundled_app("a--a/a--a.gemspec")).to exist
@@ -641,7 +757,7 @@ Usage: "bundle gem NAME [OPTIONS]"
end
end
- describe "#ensure_safe_gem_name" do
+ describe "#ensure_safe_gem_name", :readline do
before do
bundle "gem #{subject}"
end
@@ -667,11 +783,11 @@ Usage: "bundle gem NAME [OPTIONS]"
end
end
- context "on first run" do
+ context "on first run", :readline do
it "asks about test framework" do
global_config "BUNDLE_GEM__MIT" => "false", "BUNDLE_GEM__COC" => "false"
- bundle "gem foobar" do |input, _, _|
+ bundle! "gem foobar" do |input, _, _|
input.puts "rspec"
end
@@ -694,7 +810,7 @@ Usage: "bundle gem NAME [OPTIONS]"
bundle "config list"
- bundle "gem foobar" do |input, _, _|
+ bundle! "gem foobar" do |input, _, _|
input.puts "yes"
end
@@ -704,7 +820,7 @@ Usage: "bundle gem NAME [OPTIONS]"
it "asks about CoC" do
global_config "BUNDLE_GEM__MIT" => "false", "BUNDLE_GEM__TEST" => "false"
- bundle "gem foobar" do |input, _, _|
+ bundle! "gem foobar" do |input, _, _|
input.puts "yes"
end
@@ -712,18 +828,18 @@ Usage: "bundle gem NAME [OPTIONS]"
end
end
- context "on conflicts with a previously created file" do
+ context "on conflicts with a previously created file", :readline do
it "should fail gracefully" do
- FileUtils.touch("conflict-foobar")
+ FileUtils.touch(bundled_app("conflict-foobar"))
bundle "gem conflict-foobar"
expect(err).to include("Errno::ENOTDIR")
expect(exitstatus).to eql(32) if exitstatus
end
end
- context "on conflicts with a previously created directory" do
+ context "on conflicts with a previously created directory", :readline do
it "should succeed" do
- FileUtils.mkdir_p("conflict-foobar/Gemfile")
+ FileUtils.mkdir_p(bundled_app("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/commands/open_spec.rb b/spec/bundler/commands/open_spec.rb
index 8fae4af5b4..31dc0315ac 100644
--- a/spec/bundler/commands/open_spec.rb
+++ b/spec/bundler/commands/open_spec.rb
@@ -58,7 +58,7 @@ RSpec.describe "bundle open" do
expect(out).to include("bundler_editor #{default_bundle_path("gems", "activerecord-2.3.2")}")
end
- it "select the gem from many match gems" do
+ it "select the gem from many match gems", :readline do
env = { "EDITOR" => "echo editor", "VISUAL" => "echo visual", "BUNDLER_EDITOR" => "echo bundler_editor" }
bundle "open active", :env => env do |input, _, _|
input.puts "2"
@@ -67,7 +67,7 @@ RSpec.describe "bundle open" do
expect(out).to match(/bundler_editor #{default_bundle_path('gems', 'activerecord-2.3.2')}\z/)
end
- it "allows selecting exit from many match gems" do
+ it "allows selecting exit from many match gems", :readline do
env = { "EDITOR" => "echo editor", "VISUAL" => "echo visual", "BUNDLER_EDITOR" => "echo bundler_editor" }
bundle! "open active", :env => env do |input, _, _|
input.puts "0"
diff --git a/spec/bundler/commands/outdated_spec.rb b/spec/bundler/commands/outdated_spec.rb
index df911eaffd..2fa3e26865 100644
--- a/spec/bundler/commands/outdated_spec.rb
+++ b/spec/bundler/commands/outdated_spec.rb
@@ -29,13 +29,35 @@ RSpec.describe "bundle outdated" do
bundle "outdated"
- expect(out).to include("activesupport (newest 3.0, installed 2.3.5, requested = 2.3.5)")
- expect(out).to include("weakling (newest 0.2, installed 0.0.3, requested ~> 0.0.1)")
- expect(out).to include("foo (newest 1.0")
+ expected_output = <<~TABLE.gsub("x", "\\\h").tr(".", "\.").strip
+ Gem Current Latest Requested Groups
+ activesupport 2.3.5 3.0 = 2.3.5 default
+ foo 1.0 xxxxxxx 1.0 xxxxxxx >= 0 default
+ weakling 0.0.3 0.2 ~> 0.0.1 default
+ zebra 1.0 xxxxxxx 1.0 xxxxxxx >= 0 default
+ TABLE
- # Gem names are one per-line, between "*" and their parenthesized version.
- gem_list = out.split("\n").map {|g| g[/\* (.*) \(/, 1] }.compact
- expect(gem_list).to eq(gem_list.sort)
+ expect(out).to match(Regexp.new(expected_output))
+ end
+
+ it "excludes header row from the sorting" do
+ update_repo2 do
+ build_gem "AAA", %w[1.0.0 2.0.0]
+ end
+
+ install_gemfile <<-G
+ source "#{file_uri_for(gem_repo2)}"
+ gem "AAA", "1.0.0"
+ G
+
+ bundle "outdated"
+
+ expected_output = <<~TABLE
+ Gem Current Latest Requested Groups
+ AAA 1.0.0 2.0.0 = 1.0.0 default
+ TABLE
+
+ expect(out).to include(expected_output.strip)
end
it "returns non zero exit status if outdated gems present" do
@@ -69,9 +91,48 @@ RSpec.describe "bundle outdated" do
update_repo2 { build_gem "activesupport", "3.0" }
update_repo2 { build_gem "terranova", "9" }
+ bundle "outdated"
+
+ expected_output = <<~TABLE.strip
+ Gem Current Latest Requested Groups
+ activesupport 2.3.5 3.0 = 2.3.5 development, test
+ terranova 8 9 = 8 default
+ TABLE
+
+ expect(out).to end_with(expected_output)
+ end
+ end
+
+ describe "with --verbose option" do
+ it "shows the location of the latest version's gemspec if installed" do
+ bundle! "config set clean false"
+
+ update_repo2 { build_gem "activesupport", "3.0" }
+ update_repo2 { build_gem "terranova", "9" }
+
+ install_gemfile <<-G
+ source "#{file_uri_for(gem_repo2)}"
+
+ gem "terranova", '9'
+ gem 'activesupport', '2.3.5'
+ G
+
+ gemfile <<-G
+ source "#{file_uri_for(gem_repo2)}"
+
+ gem "terranova", '8'
+ gem 'activesupport', '2.3.5'
+ G
+
bundle "outdated --verbose"
- expect(out).to include("activesupport (newest 3.0, installed 2.3.5, requested = 2.3.5) in groups \"development, test\"")
- expect(out).to include("terranova (newest 9, installed 8, requested = 8) in group \"default\"")
+
+ expected_output = <<~TABLE.strip
+ Gem Current Latest Requested Groups Path
+ activesupport 2.3.5 3.0 = 2.3.5 default
+ terranova 8 9 = 8 default #{default_bundle_path("specifications/terranova-9.gemspec")}
+ TABLE
+
+ expect(out).to end_with(expected_output)
end
end
@@ -89,7 +150,7 @@ RSpec.describe "bundle outdated" do
G
end
- def test_group_option(group = nil, gems_list_size = 1)
+ def test_group_option(group)
update_repo2 do
build_gem "activesupport", "3.0"
build_gem "terranova", "9"
@@ -97,49 +158,79 @@ RSpec.describe "bundle outdated" do
end
bundle "outdated --group #{group}"
-
- # Gem names are one per-line, between "*" and their parenthesized version.
- gem_list = out.split("\n").map {|g| g[/\* (.*) \(/, 1] }.compact
- expect(gem_list).to eq(gem_list.sort)
- expect(gem_list.size).to eq gems_list_size
end
- it "not outdated gems" do
+ it "works when the bundle is up to date" do
bundle "outdated --group"
- expect(out).to include("Bundle up to date!")
+ expect(out).to end_with("Bundle up to date!")
end
it "returns a sorted list of outdated gems from one group => 'default'" do
test_group_option("default")
- expect(out).to include("===== Group \"default\" =====")
- expect(out).to include("terranova (")
+ expected_output = <<~TABLE.strip
+ Gem Current Latest Requested Groups
+ terranova 8 9 = 8 default
+ TABLE
- expect(out).not_to include("===== Groups \"development, test\" =====")
- expect(out).not_to include("activesupport")
- expect(out).not_to include("duradura")
+ expect(out).to end_with(expected_output)
end
it "returns a sorted list of outdated gems from one group => 'development'" do
- test_group_option("development", 2)
+ test_group_option("development")
- expect(out).not_to include("===== Group \"default\" =====")
- expect(out).not_to include("terranova (")
+ expected_output = <<~TABLE.strip
+ Gem Current Latest Requested Groups
+ activesupport 2.3.5 3.0 = 2.3.5 development, test
+ duradura 7.0 8.0 = 7.0 development, test
+ TABLE
- expect(out).to include("===== Groups \"development, test\" =====")
- expect(out).to include("activesupport")
- expect(out).to include("duradura")
+ expect(out).to end_with(expected_output)
end
it "returns a sorted list of outdated gems from one group => 'test'" do
- test_group_option("test", 2)
+ test_group_option("test")
- expect(out).not_to include("===== Group \"default\" =====")
- expect(out).not_to include("terranova (")
+ expected_output = <<~TABLE.strip
+ Gem Current Latest Requested Groups
+ activesupport 2.3.5 3.0 = 2.3.5 development, test
+ duradura 7.0 8.0 = 7.0 development, test
+ TABLE
- expect(out).to include("===== Groups \"development, test\" =====")
- expect(out).to include("activesupport")
- expect(out).to include("duradura")
+ expect(out).to end_with(expected_output)
+ end
+ end
+
+ describe "with --groups option and outdated transitive dependencies" do
+ before do
+ update_repo2 do
+ build_gem "bar", %w[2.0.0]
+
+ build_gem "bar_dependant", "7.0" do |s|
+ s.add_dependency "bar", "~> 2.0"
+ end
+ end
+
+ install_gemfile <<-G
+ source "#{file_uri_for(gem_repo2)}"
+
+ gem "bar_dependant", '7.0'
+ G
+
+ update_repo2 do
+ build_gem "bar", %w[3.0.0]
+ end
+ end
+
+ it "returns a sorted list of outdated gems" do
+ bundle "outdated --groups"
+
+ expected_output = <<~TABLE.strip
+ Gem Current Latest Requested Groups
+ bar 2.0.0 3.0.0
+ TABLE
+
+ expect(out).to end_with(expected_output)
end
end
@@ -159,7 +250,7 @@ RSpec.describe "bundle outdated" do
it "not outdated gems" do
bundle "outdated --groups"
- expect(out).to include("Bundle up to date!")
+ expect(out).to end_with("Bundle up to date!")
end
it "returns a sorted list of outdated gems by groups" do
@@ -170,15 +261,15 @@ RSpec.describe "bundle outdated" do
end
bundle "outdated --groups"
- expect(out).to include("===== Group \"default\" =====")
- expect(out).to include("terranova (newest 9, installed 8, requested = 8)")
- expect(out).to include("===== Groups \"development, test\" =====")
- expect(out).to include("activesupport (newest 3.0, installed 2.3.5, requested = 2.3.5)")
- expect(out).to include("duradura (newest 8.0, installed 7.0, requested = 7.0)")
- expect(out).not_to include("weakling (")
+ expected_output = <<~TABLE.strip
+ Gem Current Latest Requested Groups
+ activesupport 2.3.5 3.0 = 2.3.5 development, test
+ duradura 7.0 8.0 = 7.0 development, test
+ terranova 8 9 = 8 default
+ TABLE
- # TODO: check gems order inside the group
+ expect(out).to end_with(expected_output)
end
end
@@ -197,7 +288,12 @@ RSpec.describe "bundle outdated" do
bundle "outdated --local"
- expect(out).to include("activesupport (newest 2.3.5, installed 2.3.4, requested = 2.3.4)")
+ expected_output = <<~TABLE.strip
+ Gem Current Latest Requested Groups
+ activesupport 2.3.4 2.3.5 = 2.3.4 default
+ TABLE
+
+ expect(out).to end_with(expected_output)
end
it "doesn't hit repo2" do
@@ -253,8 +349,13 @@ RSpec.describe "bundle outdated" do
end
bundle "outdated foo"
- expect(out).not_to include("activesupport (newest")
- expect(out).to include("foo (newest 1.0")
+
+ expected_output = <<~TABLE.gsub("x", "\\\h").tr(".", "\.").strip
+ Gem Current Latest Requested Groups
+ foo 1.0 xxxxxxx 1.0 xxxxxxx >= 0 default
+ TABLE
+
+ expect(out).to match(Regexp.new(expected_output))
end
end
@@ -266,7 +367,8 @@ RSpec.describe "bundle outdated" do
end
bundle "outdated"
- expect(out).not_to include("activesupport (3.0.0.beta > 2.3.5)")
+
+ expect(out).to end_with("Bundle up to date!")
end
end
@@ -277,7 +379,13 @@ RSpec.describe "bundle outdated" do
end
bundle "outdated --pre"
- expect(out).to include("activesupport (newest 3.0.0.beta, installed 2.3.5, requested = 2.3.5)")
+
+ expected_output = <<~TABLE.strip
+ Gem Current Latest Requested Groups
+ activesupport 2.3.5 3.0.0.beta = 2.3.5 default
+ TABLE
+
+ expect(out).to end_with(expected_output)
end
end
@@ -294,7 +402,13 @@ RSpec.describe "bundle outdated" do
G
bundle "outdated"
- expect(out).to include("(newest 3.0.0.beta.2, installed 3.0.0.beta.1, requested = 3.0.0.beta.1)")
+
+ expected_output = <<~TABLE.strip
+ Gem Current Latest Requested Groups
+ activesupport 3.0.0.beta.1 3.0.0.beta.2 = 3.0.0.beta.1 default
+ TABLE
+
+ expect(out).to end_with(expected_output)
end
end
end
@@ -309,8 +423,12 @@ RSpec.describe "bundle outdated" do
bundle :outdated, filter_strict_option => true
- expect(out).to_not include("activesupport (newest")
- expect(out).to include("(newest 0.0.5, installed 0.0.3, requested ~> 0.0.1)")
+ expected_output = <<~TABLE.strip
+ Gem Current Latest Requested Groups
+ weakling 0.0.3 0.0.5 ~> 0.0.1 default
+ TABLE
+
+ expect(out).to end_with(expected_output)
end
it "only reports gem dependencies when they can actually be updated" do
@@ -321,7 +439,7 @@ RSpec.describe "bundle outdated" do
bundle :outdated, filter_strict_option => true
- expect(out).to_not include("rack (1.2")
+ expect(out).to end_with("Bundle up to date!")
end
describe "and filter options" do
@@ -339,8 +457,12 @@ RSpec.describe "bundle outdated" do
bundle :outdated, filter_strict_option => true, "filter-patch" => true
- expect(out).to_not include("activesupport (newest")
- expect(out).to include("(newest 0.0.5, installed 0.0.3")
+ expected_output = <<~TABLE.strip
+ Gem Current Latest Requested Groups
+ weakling 0.0.3 0.0.5 >= 0.0.1 default
+ TABLE
+
+ expect(out).to end_with(expected_output)
end
it "only reports gems that match requirement and minor filter level" do
@@ -357,8 +479,12 @@ RSpec.describe "bundle outdated" do
bundle :outdated, filter_strict_option => true, "filter-minor" => true
- expect(out).to_not include("activesupport (newest")
- expect(out).to include("(newest 0.1.5, installed 0.0.3")
+ expected_output = <<~TABLE.strip
+ Gem Current Latest Requested Groups
+ weakling 0.0.3 0.1.5 >= 0.0.1 default
+ TABLE
+
+ expect(out).to end_with(expected_output)
end
it "only reports gems that match requirement and major filter level" do
@@ -375,8 +501,12 @@ RSpec.describe "bundle outdated" do
bundle :outdated, filter_strict_option => true, "filter-major" => true
- expect(out).to_not include("activesupport (newest")
- expect(out).to include("(newest 1.1.5, installed 0.0.3")
+ expected_output = <<~TABLE.strip
+ Gem Current Latest Requested Groups
+ weakling 0.0.3 1.1.5 >= 0.0.1 default
+ TABLE
+
+ expect(out).to end_with(expected_output)
end
end
end
@@ -460,7 +590,7 @@ RSpec.describe "bundle outdated" do
it "reports that no updates are available" do
bundle "outdated"
- expect(out).to include("Bundle up to date!")
+ expect(out).to end_with("Bundle up to date!")
end
end
@@ -472,31 +602,33 @@ RSpec.describe "bundle outdated" do
G
bundle "outdated"
- expect(out).to include("Bundle up to date!")
+ expect(out).to end_with("Bundle up to date!")
end
- it "reports that updates are available if the JRuby platform is used" do
- simulate_ruby_engine "jruby", "1.6.7" do
- simulate_platform "jruby" do
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo2)}"
- gem "laduradura", '= 5.15.2', :platforms => [:ruby, :jruby]
- G
+ it "reports that updates are available if the JRuby platform is used", :jruby do
+ install_gemfile <<-G
+ source "#{file_uri_for(gem_repo2)}"
+ gem "laduradura", '= 5.15.2', :platforms => [:ruby, :jruby]
+ G
- bundle "outdated"
- expect(out).to include("Outdated gems included in the bundle:")
- expect(out).to include("laduradura (newest 5.15.3, installed 5.15.2, requested = 5.15.2)")
- end
- end
+ bundle "outdated"
+
+ expected_output = <<~TABLE.strip
+ Gem Current Latest Requested Groups
+ laduradura 5.15.2 5.15.3 = 5.15.2 default
+ TABLE
+
+ expect(out).to end_with(expected_output)
end
end
shared_examples_for "version update is detected" do
it "reports that a gem has a newer version" do
subject
- expect(out).to include("Outdated gems included in the bundle:")
- expect(out).to include("activesupport (newest")
- expect(out).to_not include("ERROR REPORT TEMPLATE")
+
+ outdated_gems = out.split("\n").drop_while {|l| !l.start_with?("Gem") }[1..-1]
+
+ expect(outdated_gems.size).to be > 0
end
end
@@ -551,10 +683,7 @@ RSpec.describe "bundle outdated" do
shared_examples_for "no version updates are detected" do
it "does not detect any version updates" do
subject
- expect(out).to include("updates to display.")
- expect(out).to_not include("ERROR REPORT TEMPLATE")
- expect(out).to_not include("activesupport (newest")
- expect(out).to_not include("weakling (newest")
+ expect(out).to end_with("updates to display.")
end
end
@@ -658,45 +787,51 @@ RSpec.describe "bundle outdated" do
# establish a lockfile set to 1.0.0
install_gemfile <<-G
- source "#{file_uri_for(gem_repo4)}"
- gem 'patch', '1.0.0'
- gem 'minor', '1.0.0'
- gem 'major', '1.0.0'
+ source "#{file_uri_for(gem_repo4)}"
+ gem 'patch', '1.0.0'
+ gem 'minor', '1.0.0'
+ gem 'major', '1.0.0'
G
# remove 1.4.3 requirement and bar altogether
# to setup update specs below
gemfile <<-G
- source "#{file_uri_for(gem_repo4)}"
- gem 'patch'
- gem 'minor'
- gem 'major'
+ source "#{file_uri_for(gem_repo4)}"
+ gem 'patch'
+ gem 'minor'
+ gem 'major'
G
end
it "shows nothing when patching and filtering to minor" do
bundle "outdated --patch --filter-minor"
- expect(out).to include("No minor updates to display.")
- expect(out).not_to include("patch (newest")
- expect(out).not_to include("minor (newest")
- expect(out).not_to include("major (newest")
+ expect(out).to end_with("No minor updates to display.")
end
it "shows all gems when patching and filtering to patch" do
bundle "outdated --patch --filter-patch"
- expect(out).to include("patch (newest 1.0.1")
- expect(out).to include("minor (newest 1.0.1")
- expect(out).to include("major (newest 1.0.1")
+ expected_output = <<~TABLE.strip
+ Gem Current Latest Requested Groups
+ major 1.0.0 1.0.1 >= 0 default
+ minor 1.0.0 1.0.1 >= 0 default
+ patch 1.0.0 1.0.1 >= 0 default
+ TABLE
+
+ expect(out).to end_with(expected_output)
end
it "shows minor and major when updating to minor and filtering to patch and minor" do
bundle "outdated --minor --filter-minor"
- expect(out).not_to include("patch (newest")
- expect(out).to include("minor (newest 1.1.0")
- expect(out).to include("major (newest 1.1.0")
+ expected_output = <<~TABLE.strip
+ Gem Current Latest Requested Groups
+ major 1.0.0 1.1.0 >= 0 default
+ minor 1.0.0 1.1.0 >= 0 default
+ TABLE
+
+ expect(out).to end_with(expected_output)
end
it "shows minor when updating to major and filtering to minor with parseable" do
@@ -744,9 +879,13 @@ RSpec.describe "bundle outdated" do
it "shows gems with update-strict updating to patch and filtering to patch" do
bundle "outdated --patch --update-strict --filter-patch"
- expect(out).to include("foo (newest 1.4.4")
- expect(out).to include("bar (newest 2.0.5")
- expect(out).not_to include("qux (newest")
+ expected_output = <<~TABLE.strip
+ Gem Current Latest Requested Groups
+ bar 2.0.3 2.0.5
+ foo 1.4.3 1.4.4 >= 0 default
+ TABLE
+
+ expect(out).to end_with(expected_output)
end
end
end
@@ -773,8 +912,12 @@ RSpec.describe "bundle outdated" do
bundle "outdated --only-explicit"
- expect(out).to include("weakling (newest 0.3")
- expect(out).not_to include("bar (newest 2.2")
+ expected_output = <<~TABLE.strip
+ Gem Current Latest Requested Groups
+ weakling 0.2 0.3 >= 0 default
+ TABLE
+
+ expect(out).to end_with(expected_output)
end
end
end
diff --git a/spec/bundler/commands/pristine_spec.rb b/spec/bundler/commands/pristine_spec.rb
index cc7f760d74..15336137b6 100644
--- a/spec/bundler/commands/pristine_spec.rb
+++ b/spec/bundler/commands/pristine_spec.rb
@@ -22,12 +22,14 @@ RSpec.describe "bundle pristine", :ruby_repo do
source "#{file_uri_for(gem_repo2)}"
gem "weakling"
gem "very_simple_binary"
- gem "foo", :git => "#{lib_path("foo")}"
+ gem "foo", :git => "#{lib_path("foo")}", :branch => "master"
gem "git_with_ext", :git => "#{lib_path("git_with_ext")}"
gem "bar", :path => "#{lib_path("bar")}"
gemspec
G
+
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
end
context "when sourced from RubyGems" do
@@ -81,6 +83,19 @@ RSpec.describe "bundle pristine", :ruby_repo do
bundle! "pristine"
expect(changes_txt).not_to be_file
end
+
+ it "displays warning and ignores changes when a local config exists" do
+ spec = Bundler.definition.specs["foo"].first
+ bundle "config set local.#{spec.name} #{lib_path(spec.name)}"
+
+ changes_txt = Pathname.new(spec.full_gem_path).join("lib/changes.txt")
+ FileUtils.touch(changes_txt)
+ expect(changes_txt).to be_file
+
+ bundle "pristine"
+ expect(changes_txt).to be_file
+ expect(err).to include("Cannot pristine #{spec.name} (#{spec.version}#{spec.git_version}). Gem is locally overriden.")
+ end
end
context "when sourced from gemspec" do
diff --git a/spec/bundler/commands/remove_spec.rb b/spec/bundler/commands/remove_spec.rb
index 402faaf1f3..ef313928e2 100644
--- a/spec/bundler/commands/remove_spec.rb
+++ b/spec/bundler/commands/remove_spec.rb
@@ -54,7 +54,7 @@ RSpec.describe "bundle remove" do
bundle "remove rack"
- expect(err).to include("`rack` is not specified in #{bundled_app("Gemfile")} so it could not be removed.")
+ expect(err).to include("`rack` is not specified in #{bundled_app_gemfile} so it could not be removed.")
end
end
end
@@ -91,7 +91,7 @@ RSpec.describe "bundle remove" do
bundle "remove rails rack minitest"
- expect(err).to include("`rack` is not specified in #{bundled_app("Gemfile")} so it could not be removed.")
+ expect(err).to include("`rack` is not specified in #{bundled_app_gemfile} so it could not be removed.")
gemfile_should_be <<-G
source "#{file_uri_for(gem_repo1)}"
@@ -436,7 +436,7 @@ RSpec.describe "bundle remove" do
bundle "remove rack"
- expect(err).to include("`rack` is not specified in #{bundled_app("Gemfile")} so it could not be removed.")
+ expect(err).to include("`rack` is not specified in #{bundled_app_gemfile} so it could not be removed.")
end
end
diff --git a/spec/bundler/commands/show_spec.rb b/spec/bundler/commands/show_spec.rb
index 61b8f73e7f..de3c41f172 100644
--- a/spec/bundler/commands/show_spec.rb
+++ b/spec/bundler/commands/show_spec.rb
@@ -3,35 +3,35 @@
RSpec.describe "bundle show", :bundler => "< 3" do
context "with a standard Gemfile" do
before :each do
- install_gemfile <<-G
+ install_gemfile! <<-G
source "#{file_uri_for(gem_repo1)}"
gem "rails"
G
end
it "creates a Gemfile.lock if one did not exist" do
- FileUtils.rm("Gemfile.lock")
+ FileUtils.rm(bundled_app_lock)
- bundle "show"
+ bundle! "show"
- expect(bundled_app("Gemfile.lock")).to exist
+ expect(bundled_app_lock).to exist
end
it "creates a Gemfile.lock when invoked with a gem name" do
- FileUtils.rm("Gemfile.lock")
+ FileUtils.rm(bundled_app_lock)
- bundle "show rails"
+ bundle! "show rails"
- expect(bundled_app("Gemfile.lock")).to exist
+ expect(bundled_app_lock).to exist
end
it "prints path if gem exists in bundle" do
- bundle "show rails"
+ bundle! "show rails"
expect(out).to eq(default_bundle_path("gems", "rails-2.3.2").to_s)
end
it "prints path if gem exists in bundle (with --paths option)" do
- bundle "show rails --paths"
+ bundle! "show rails --paths"
expect(out).to eq(default_bundle_path("gems", "rails-2.3.2").to_s)
end
@@ -45,7 +45,7 @@ RSpec.describe "bundle show", :bundler => "< 3" do
end
it "prints the path to the running bundler" do
- bundle "show bundler"
+ bundle! "show bundler"
expect(out).to eq(root.to_s)
end
@@ -55,9 +55,9 @@ RSpec.describe "bundle show", :bundler => "< 3" do
end
it "prints path of all gems in bundle sorted by name" do
- bundle "show --paths"
+ bundle! "show --paths"
- expect(out).to include(default_bundle_path("gems", "rake-12.3.2").to_s)
+ expect(out).to include(default_bundle_path("gems", "rake-13.0.1").to_s)
expect(out).to include(default_bundle_path("gems", "rails-2.3.2").to_s)
# Gem names are the last component of their path.
@@ -66,7 +66,7 @@ RSpec.describe "bundle show", :bundler => "< 3" do
end
it "prints summary of gems" do
- bundle "show --verbose"
+ bundle! "show --verbose"
expect(out).to include <<~MSG
* actionmailer (2.3.2)
@@ -77,7 +77,7 @@ RSpec.describe "bundle show", :bundler => "< 3" do
end
it "includes bundler in the summary of gems" do
- bundle "show --verbose"
+ bundle! "show --verbose"
expect(out).to include <<~MSG
* bundler (#{Bundler::VERSION})
@@ -94,12 +94,12 @@ RSpec.describe "bundle show", :bundler => "< 3" do
end
it "prints out git info" do
- install_gemfile <<-G
+ install_gemfile! <<-G
gem "foo", :git => "#{lib_path("foo-1.0")}"
G
expect(the_bundle).to include_gems "foo 1.0"
- bundle :show
+ bundle! :show
expect(out).to include("foo (1.0 #{@git.ref_for("master", 6)}")
end
@@ -109,28 +109,28 @@ RSpec.describe "bundle show", :bundler => "< 3" do
end
@revision = revision_for(lib_path("foo-1.0"))[0...6]
- install_gemfile <<-G
+ install_gemfile! <<-G
gem "foo", :git => "#{lib_path("foo-1.0")}", :branch => "omg"
G
expect(the_bundle).to include_gems "foo 1.0.omg"
- bundle :show
+ bundle! :show
expect(out).to include("foo (1.0 #{@git.ref_for("omg", 6)}")
end
it "doesn't print the branch when tied to a ref" do
sha = revision_for(lib_path("foo-1.0"))
- install_gemfile <<-G
+ install_gemfile! <<-G
gem "foo", :git => "#{lib_path("foo-1.0")}", :ref => "#{sha}"
G
- bundle :show
+ bundle! :show
expect(out).to include("foo (1.0 #{sha[0..6]})")
end
it "handles when a version is a '-' prerelease" do
@git = build_git("foo", "1.0.0-beta.1", :path => lib_path("foo"))
- install_gemfile <<-G
+ install_gemfile! <<-G
gem "foo", "1.0.0-beta.1", :git => "#{lib_path("foo")}"
G
expect(the_bundle).to include_gems "foo 1.0.0.pre.beta.1"
@@ -143,13 +143,12 @@ RSpec.describe "bundle show", :bundler => "< 3" do
context "in a fresh gem in a blank git repo" do
before :each do
build_git "foo", :path => lib_path("foo")
- in_app_root_custom lib_path("foo")
- File.open("Gemfile", "w") {|f| f.puts "gemspec" }
- sys_exec "rm -rf .git && git init"
+ File.open(lib_path("foo/Gemfile"), "w") {|f| f.puts "gemspec" }
+ sys_exec "rm -rf .git && git init", :dir => lib_path("foo")
end
it "does not output git errors" do
- bundle :show
+ bundle :show, :dir => lib_path("foo")
expect(err_without_deprecations).to be_empty
end
end
@@ -161,26 +160,26 @@ RSpec.describe "bundle show", :bundler => "< 3" do
G
bundle "config set auto_install 1"
- bundle :show
+ bundle! :show
expect(out).to include("Installing foo 1.0")
end
context "with a valid regexp for gem name" do
- it "presents alternatives" do
- install_gemfile <<-G
+ it "presents alternatives", :readline do
+ install_gemfile! <<-G
source "#{file_uri_for(gem_repo1)}"
gem "rack"
gem "rack-obama"
G
- bundle "show rac"
+ bundle! "show rac"
expect(out).to eq "1 : rack\n2 : rack-obama\n0 : - exit -\n>"
end
end
context "with an invalid regexp for gem name" do
it "does not find the gem" do
- install_gemfile <<-G
+ install_gemfile! <<-G
source "#{file_uri_for(gem_repo1)}"
gem "rails"
G
@@ -193,7 +192,7 @@ RSpec.describe "bundle show", :bundler => "< 3" do
end
context "--outdated option" do
- # Regression test for https://github.com/bundler/bundler/issues/5375
+ # Regression test for https://github.com/rubygems/bundler/issues/5375
before do
build_repo2
end
diff --git a/spec/bundler/commands/update_spec.rb b/spec/bundler/commands/update_spec.rb
index e4449312eb..f8b8800de4 100644
--- a/spec/bundler/commands/update_spec.rb
+++ b/spec/bundler/commands/update_spec.rb
@@ -31,7 +31,7 @@ RSpec.describe "bundle update" do
exit!
G
bundle "update"
- expect(bundled_app("Gemfile.lock")).to exist
+ expect(bundled_app_lock).to exist
end
end
@@ -54,7 +54,7 @@ RSpec.describe "bundle update" do
exit!
G
bundle "update", :all => true
- expect(bundled_app("Gemfile.lock")).to exist
+ expect(bundled_app_lock).to exist
end
end
@@ -681,8 +681,7 @@ RSpec.describe "bundle update" do
G
bundle! "update", :all => true
- out.gsub!(/RubyGems [\d\.]+ is not threadsafe.*\n?/, "")
- expect(out).to include "Resolving dependencies...\nBundle updated!"
+ expect(out).to match(/Resolving dependencies\.\.\.\.*\nBundle updated!/)
update_repo4 do
build_gem "foo", "2.0"
@@ -690,13 +689,7 @@ RSpec.describe "bundle update" do
bundle! "update", :all => true
out.sub!("Removing foo (1.0)\n", "")
- out.gsub!(/RubyGems [\d\.]+ is not threadsafe.*\n?/, "")
- expect(out).to include strip_whitespace(<<-EOS).strip
- Resolving dependencies...
- Fetching foo 2.0 (was 1.0)
- Installing foo 2.0 (was 1.0)
- Bundle updated
- EOS
+ expect(out).to match(/Resolving dependencies\.\.\.\.*\nFetching foo 2\.0 \(was 1\.0\)\nInstalling foo 2\.0 \(was 1\.0\)\nBundle updated/)
end
end
@@ -831,6 +824,7 @@ RSpec.describe "bundle update --bundler" do
source "#{file_uri_for(gem_repo4)}"
gem "rack"
G
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
lockfile lockfile.sub(/(^\s*)#{Bundler::VERSION}($)/, '\11.0.0\2')
FileUtils.rm_r gem_repo4
diff --git a/spec/bundler/install/allow_offline_install_spec.rb b/spec/bundler/install/allow_offline_install_spec.rb
index 8af88b7efe..7813a3426d 100644
--- a/spec/bundler/install/allow_offline_install_spec.rb
+++ b/spec/bundler/install/allow_offline_install_spec.rb
@@ -26,7 +26,7 @@ RSpec.describe "bundle install with :allow_offline_install" do
context "with cached data locally" do
it "will install from the compact index" do
- system_gems ["rack-1.0.0"], :path => :bundle_path
+ system_gems ["rack-1.0.0"], :path => default_bundle_path
bundle! "config set clean false"
install_gemfile! <<-G, :artifice => "compact_index"
@@ -70,6 +70,8 @@ RSpec.describe "bundle install with :allow_offline_install" do
end
it "will install from a cached git repo" do
+ skip "doesn't print errors" if Gem.win_platform?
+
git = build_git "a", "1.0.0", :path => lib_path("a")
update_git("a", :path => git.path, :branch => "new_branch")
install_gemfile! <<-G
diff --git a/spec/bundler/install/bundler_spec.rb b/spec/bundler/install/bundler_spec.rb
index 6ea15d13b5..25cc12160c 100644
--- a/spec/bundler/install/bundler_spec.rb
+++ b/spec/bundler/install/bundler_spec.rb
@@ -133,27 +133,29 @@ RSpec.describe "bundle install" do
it "can install dependencies with newer bundler version with system gems" do
bundle! "config set path.system true"
- install_gemfile! <<-G
+
+ system_gems "bundler-99999999.99.1"
+
+ install_gemfile! <<-G, :system_bundler => true
source "#{file_uri_for(gem_repo2)}"
gem "rails", "3.0"
G
- simulate_bundler_version "99999999.99.1"
-
- bundle! "check"
+ bundle! "check", :system_bundler => true
expect(out).to include("The Gemfile's dependencies are satisfied")
end
it "can install dependencies with newer bundler version with a local path" do
bundle! "config set path .bundle"
- install_gemfile! <<-G
+
+ system_gems "bundler-99999999.99.1"
+
+ install_gemfile! <<-G, :system_bundler => true
source "#{file_uri_for(gem_repo2)}"
gem "rails", "3.0"
G
- simulate_bundler_version "99999999.99.1"
-
- bundle! "check"
+ bundle! "check", :system_bundler => true
expect(out).to include("The Gemfile's dependencies are satisfied")
end
diff --git a/spec/bundler/install/deploy_spec.rb b/spec/bundler/install/deploy_spec.rb
index f92a531bf5..121b99fd8c 100644
--- a/spec/bundler/install/deploy_spec.rb
+++ b/spec/bundler/install/deploy_spec.rb
@@ -43,13 +43,12 @@ RSpec.describe "install with --deployment or --frozen" do
it "still works if you are not in the app directory and specify --gemfile" do
bundle! "install"
- Dir.chdir tmp do
- simulate_new_machine
- bundle! :install,
- forgotten_command_line_options(:gemfile => "#{tmp}/bundled_app/Gemfile",
- :deployment => true,
- :path => "vendor/bundle")
- end
+ simulate_new_machine
+ bundle! :install,
+ forgotten_command_line_options(:gemfile => "#{tmp}/bundled_app/Gemfile",
+ :deployment => true,
+ :path => "vendor/bundle",
+ :dir => tmp)
expect(the_bundle).to include_gems "rack 1.0"
end
@@ -65,6 +64,8 @@ RSpec.describe "install with --deployment or --frozen" do
end
it "works when you bundle exec bundle" do
+ skip "doesn't find bundle" if Gem.win_platform?
+
bundle! :install
bundle "install --deployment"
bundle! "exec bundle check"
@@ -332,6 +333,8 @@ RSpec.describe "install with --deployment or --frozen" do
end
it "explodes if you unpin a source" do
+ skip "some of monorepo issues" if Gem.win_platform?
+
build_git "rack"
install_gemfile <<-G
@@ -352,6 +355,8 @@ RSpec.describe "install with --deployment or --frozen" do
end
it "explodes if you unpin a source, leaving it pinned somewhere else" do
+ skip "some of monorepo issues" if Gem.win_platform?
+
build_lib "foo", :path => lib_path("rack/foo")
build_git "rack", :path => lib_path("rack")
diff --git a/spec/bundler/install/gemfile/eval_gemfile_spec.rb b/spec/bundler/install/gemfile/eval_gemfile_spec.rb
index 7df94aaff5..69341250c3 100644
--- a/spec/bundler/install/gemfile/eval_gemfile_spec.rb
+++ b/spec/bundler/install/gemfile/eval_gemfile_spec.rb
@@ -28,8 +28,8 @@ RSpec.describe "bundle install with gemfile that uses eval_gemfile" do
context "eval-ed Gemfile has relative-path gems" do
before do
- build_lib("a", :path => "gems/a")
- create_file "nested/Gemfile-nested", <<-G
+ build_lib("a", :path => bundled_app("gems/a"))
+ create_file bundled_app("nested/Gemfile-nested"), <<-G
gem "a", :path => "../gems/a"
G
diff --git a/spec/bundler/install/gemfile/gemspec_spec.rb b/spec/bundler/install/gemfile/gemspec_spec.rb
index 26a6235166..b42587c65f 100644
--- a/spec/bundler/install/gemfile/gemspec_spec.rb
+++ b/spec/bundler/install/gemfile/gemspec_spec.rb
@@ -117,21 +117,19 @@ RSpec.describe "bundle install from an existing gemspec" do
build_lib("foo", :path => tmp.join("foo")) do |s|
s.write("Gemfile", "source '#{file_uri_for(gem_repo1)}'\ngemspec")
s.add_dependency "actionpack", "=2.3.2"
- s.add_development_dependency "rake", "=12.3.2"
+ s.add_development_dependency "rake", "=13.0.1"
end
- Dir.chdir(tmp.join("foo")) do
- bundle "install"
- # This should really be able to rely on $stderr, but, it's not written
- # right, so we can't. In fact, this is a bug negation test, and so it'll
- # ghost pass in future, and will only catch a regression if the message
- # doesn't change. Exit codes should be used correctly (they can be more
- # than just 0 and 1).
- output = bundle("install --deployment")
- expect(output).not_to match(/You have added to the Gemfile/)
- expect(output).not_to match(/You have deleted from the Gemfile/)
- expect(output).not_to match(/install in deployment mode after changing/)
- end
+ bundle "install", :dir => tmp.join("foo")
+ # This should really be able to rely on $stderr, but, it's not written
+ # right, so we can't. In fact, this is a bug negation test, and so it'll
+ # ghost pass in future, and will only catch a regression if the message
+ # doesn't change. Exit codes should be used correctly (they can be more
+ # than just 0 and 1).
+ output = bundle("install --deployment", :dir => tmp.join("foo"))
+ expect(output).not_to match(/You have added to the Gemfile/)
+ expect(output).not_to match(/You have deleted from the Gemfile/)
+ expect(output).not_to match(/install in deployment mode after changing/)
end
it "should match a lockfile without needing to re-resolve" do
@@ -169,15 +167,12 @@ RSpec.describe "bundle install from an existing gemspec" do
expect(out.scan(message).size).to eq(1)
end
- it "should match a lockfile on non-ruby platforms with a transitive platform dependency" do
- simulate_platform java
- simulate_ruby_engine "jruby"
-
+ it "should match a lockfile on non-ruby platforms with a transitive platform dependency", :jruby do
build_lib("foo", :path => tmp.join("foo")) do |s|
s.add_dependency "platform_specific"
end
- system_gems "platform_specific-1.0-java", :path => :bundle_path, :keep_path => true
+ system_gems "platform_specific-1.0-java", :path => default_bundle_path, :keep_path => true
install_gemfile! <<-G
gemspec :path => '#{tmp.join("foo")}'
@@ -201,7 +196,7 @@ RSpec.describe "bundle install from an existing gemspec" do
it "allows the gemspec to activate other gems" do
ENV["BUNDLE_PATH__SYSTEM"] = "true"
- # see https://github.com/bundler/bundler/issues/5409
+ # see https://github.com/rubygems/bundler/issues/5409
#
# issue was caused by rubygems having an unresolved gem during a require,
# so emulate that
@@ -333,6 +328,8 @@ RSpec.describe "bundle install from an existing gemspec" do
let(:platform) { "ruby" }
before do
+ skip "not installing for some reason" if Gem.win_platform?
+
build_lib("foo", :path => tmp.join("foo")) do |s|
s.add_dependency "rack", "=1.0.0"
end
@@ -365,13 +362,11 @@ RSpec.describe "bundle install from an existing gemspec" do
L
end
- context "using JRuby with explicit platform" do
- let(:platform) { "java" }
-
+ context "using JRuby with explicit platform", :jruby do
before do
create_file(
- tmp.join("foo", "foo-#{platform}.gemspec"),
- build_spec("foo", "1.0", platform) do
+ tmp.join("foo", "foo-java.gemspec"),
+ build_spec("foo", "1.0", "java") do
dep "rack", "=1.0.0"
@spec.authors = "authors"
@spec.summary = "summary"
@@ -380,27 +375,17 @@ RSpec.describe "bundle install from an existing gemspec" do
end
it "should install" do
- simulate_ruby_engine "jruby" do
- simulate_platform "java" do
- results = bundle "install", :artifice => "endpoint"
- expect(results).to include("Installing rack 1.0.0")
- expect(the_bundle).to include_gems "rack 1.0.0"
- end
- end
+ results = bundle "install", :artifice => "endpoint"
+ expect(results).to include("Installing rack 1.0.0")
+ expect(the_bundle).to include_gems "rack 1.0.0"
end
end
- context "using JRuby" do
- let(:platform) { "java" }
-
+ context "using JRuby", :jruby do
it "should install" do
- simulate_ruby_engine "jruby" do
- simulate_platform "java" do
- results = bundle "install", :artifice => "endpoint"
- expect(results).to include("Installing rack 1.0.0")
- expect(the_bundle).to include_gems "rack 1.0.0"
- end
- end
+ results = bundle "install", :artifice => "endpoint"
+ expect(results).to include("Installing rack 1.0.0")
+ expect(the_bundle).to include_gems "rack 1.0.0"
end
end
@@ -425,7 +410,7 @@ RSpec.describe "bundle install from an existing gemspec" do
end
end
- build_lib "foo", :path => "." do |s|
+ build_lib "foo", :path => bundled_app do |s|
if platform_specific_type == :runtime
s.add_runtime_dependency dependency
elsif platform_specific_type == :development
diff --git a/spec/bundler/install/gemfile/git_spec.rb b/spec/bundler/install/gemfile/git_spec.rb
index 00f8e96625..fd5cde4fb1 100644
--- a/spec/bundler/install/gemfile/git_spec.rb
+++ b/spec/bundler/install/gemfile/git_spec.rb
@@ -57,22 +57,18 @@ RSpec.describe "bundle install with git sources" do
it "does not update the git source implicitly" do
update_git "foo"
- in_app_root2 do
- install_gemfile bundled_app2("Gemfile"), <<-G
- git "#{lib_path("foo-1.0")}" do
- gem 'foo'
- end
- G
- end
+ install_gemfile bundled_app2("Gemfile"), <<-G, :dir => bundled_app2
+ git "#{lib_path("foo-1.0")}" do
+ gem 'foo'
+ end
+ G
- in_app_root do
- run <<-RUBY
- require 'foo'
- puts "fail" if defined?(FOO_PREV_REF)
- RUBY
+ run <<-RUBY
+ require 'foo'
+ puts "fail" if defined?(FOO_PREV_REF)
+ RUBY
- expect(out).to be_empty
- end
+ expect(out).to be_empty
end
it "sets up git gem executables on the path" do
@@ -129,19 +125,19 @@ RSpec.describe "bundle install with git sources" do
it "still works after moving the application directory" do
bundle "install --path vendor/bundle"
+
FileUtils.mv bundled_app, tmp("bundled_app.bck")
- Dir.chdir tmp("bundled_app.bck")
- expect(the_bundle).to include_gems "foo 1.0"
+ expect(the_bundle).to include_gems "foo 1.0", :dir => tmp("bundled_app.bck")
end
it "can still install after moving the application directory" do
bundle "install --path vendor/bundle"
+
FileUtils.mv bundled_app, tmp("bundled_app.bck")
update_git "foo", "1.1", :path => lib_path("foo-1.0")
- Dir.chdir tmp("bundled_app.bck")
gemfile tmp("bundled_app.bck/Gemfile"), <<-G
source "#{file_uri_for(gem_repo1)}"
git "#{lib_path("foo-1.0")}" do
@@ -151,9 +147,9 @@ RSpec.describe "bundle install with git sources" do
gem "rack", "1.0"
G
- bundle "update foo"
+ bundle "update foo", :dir => tmp("bundled_app.bck")
- expect(the_bundle).to include_gems "foo 1.1", "rack 1.0"
+ expect(the_bundle).to include_gems "foo 1.1", "rack 1.0", :dir => tmp("bundled_app.bck")
end
end
@@ -220,9 +216,7 @@ RSpec.describe "bundle install with git sources" do
s.write("lib/foo.rb", "raise 'FAIL'")
end
- Dir.chdir(lib_path("foo-1.0")) do
- `git update-ref -m "Bundler Spec!" refs/bundler/1 master~1`
- end
+ sys_exec("git update-ref -m \"Bundler Spec!\" refs/bundler/1 master~1", :dir => lib_path("foo-1.0"))
# want to ensure we don't fallback to HEAD
update_git "foo", :path => lib_path("foo-1.0"), :branch => "rando" do |s|
@@ -256,9 +250,7 @@ RSpec.describe "bundle install with git sources" do
s.write("lib/foo.rb", "raise 'FAIL'")
end
- Dir.chdir(lib_path("foo-1.0")) do
- `git update-ref -m "Bundler Spec!" refs/bundler/1 master~1`
- end
+ sys_exec("git update-ref -m \"Bundler Spec!\" refs/bundler/1 master~1", :dir => lib_path("foo-1.0"))
# want to ensure we don't fallback to HEAD
update_git "foo", :path => lib_path("foo-1.0"), :branch => "rando" do |s|
@@ -281,9 +273,7 @@ RSpec.describe "bundle install with git sources" do
end
it "does not download random non-head refs" do
- Dir.chdir(lib_path("foo-1.0")) do
- sys_exec!('git update-ref -m "Bundler Spec!" refs/bundler/1 master~1')
- end
+ sys_exec("git update-ref -m \"Bundler Spec!\" refs/bundler/1 master~1", :dir => lib_path("foo-1.0"))
bundle! "config set global_gem_cache true"
@@ -296,9 +286,7 @@ RSpec.describe "bundle install with git sources" do
# ensure we also git fetch after cloning
bundle! :update, :all => true
- Dir.chdir(Dir[home(".bundle/cache/git/foo-*")].first) do
- sys_exec("git ls-remote .")
- end
+ sys_exec("git ls-remote .", :dir => Dir[home(".bundle/cache/git/foo-*")].first)
expect(out).not_to include("refs/bundler/1")
end
@@ -307,11 +295,10 @@ RSpec.describe "bundle install with git sources" do
describe "when specifying a branch" do
let(:branch) { "branch" }
let(:repo) { build_git("foo").path }
- before(:each) do
- update_git("foo", :path => repo, :branch => branch)
- end
it "works" do
+ update_git("foo", :path => repo, :branch => branch)
+
install_gemfile <<-G
git "#{repo}", :branch => #{branch.dump} do
gem "foo"
@@ -324,6 +311,10 @@ RSpec.describe "bundle install with git sources" do
context "when the branch starts with a `#`" do
let(:branch) { "#149/redirect-url-fragment" }
it "works" do
+ skip "git does not accept this" if Gem.win_platform?
+
+ update_git("foo", :path => repo, :branch => branch)
+
install_gemfile <<-G
git "#{repo}", :branch => #{branch.dump} do
gem "foo"
@@ -337,6 +328,10 @@ RSpec.describe "bundle install with git sources" do
context "when the branch includes quotes" do
let(:branch) { %('") }
it "works" do
+ skip "git does not accept this" if Gem.win_platform?
+
+ update_git("foo", :path => repo, :branch => branch)
+
install_gemfile <<-G
git "#{repo}", :branch => #{branch.dump} do
gem "foo"
@@ -351,11 +346,10 @@ RSpec.describe "bundle install with git sources" do
describe "when specifying a tag" do
let(:tag) { "tag" }
let(:repo) { build_git("foo").path }
- before(:each) do
- update_git("foo", :path => repo, :tag => tag)
- end
it "works" do
+ update_git("foo", :path => repo, :tag => tag)
+
install_gemfile <<-G
git "#{repo}", :tag => #{tag.dump} do
gem "foo"
@@ -368,6 +362,10 @@ RSpec.describe "bundle install with git sources" do
context "when the tag starts with a `#`" do
let(:tag) { "#149/redirect-url-fragment" }
it "works" do
+ skip "git does not accept this" if Gem.win_platform?
+
+ update_git("foo", :path => repo, :tag => tag)
+
install_gemfile <<-G
git "#{repo}", :tag => #{tag.dump} do
gem "foo"
@@ -381,6 +379,10 @@ RSpec.describe "bundle install with git sources" do
context "when the tag includes quotes" do
let(:tag) { %('") }
it "works" do
+ skip "git does not accept this" if Gem.win_platform?
+
+ update_git("foo", :path => repo, :tag => tag)
+
install_gemfile <<-G
git "#{repo}", :tag => #{tag.dump} do
gem "foo"
@@ -463,7 +465,7 @@ RSpec.describe "bundle install with git sources" do
gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
G
- lockfile0 = File.read(bundled_app("Gemfile.lock"))
+ lockfile0 = File.read(bundled_app_lock)
FileUtils.cp_r("#{lib_path("rack-0.8")}/.", lib_path("local-rack"))
update_git "rack", "0.8", :path => lib_path("local-rack") do |s|
@@ -473,7 +475,7 @@ RSpec.describe "bundle install with git sources" do
bundle %(config set local.rack #{lib_path("local-rack")})
run "require 'rack'"
- lockfile1 = File.read(bundled_app("Gemfile.lock"))
+ lockfile1 = File.read(bundled_app_lock)
expect(lockfile1).not_to eq(lockfile0)
end
@@ -485,7 +487,7 @@ RSpec.describe "bundle install with git sources" do
gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
G
- lockfile0 = File.read(bundled_app("Gemfile.lock"))
+ lockfile0 = File.read(bundled_app_lock)
FileUtils.cp_r("#{lib_path("rack-0.8")}/.", lib_path("local-rack"))
update_git "rack", "0.8", :path => lib_path("local-rack")
@@ -493,7 +495,7 @@ RSpec.describe "bundle install with git sources" do
bundle %(config set local.rack #{lib_path("local-rack")})
bundle :install
- lockfile1 = File.read(bundled_app("Gemfile.lock"))
+ lockfile1 = File.read(bundled_app_lock)
expect(lockfile1).not_to eq(lockfile0)
end
@@ -621,6 +623,8 @@ RSpec.describe "bundle install with git sources" do
end
it "installs dependencies from git even if a newer gem is available elsewhere" do
+ skip "override is not winning" if Gem.win_platform?
+
system_gems "rack-1.0.0"
build_lib "rack", "1.0", :path => lib_path("nested/bar") do |s|
@@ -817,9 +821,7 @@ RSpec.describe "bundle install with git sources" do
bundle "update", :all => true
expect(the_bundle).to include_gems "forced 1.1"
- Dir.chdir(lib_path("forced-1.0")) do
- `git reset --hard HEAD^`
- end
+ sys_exec("git reset --hard HEAD^", :dir => lib_path("forced-1.0"))
bundle "update", :all => true
expect(the_bundle).to include_gems "forced 1.0"
@@ -830,10 +832,8 @@ RSpec.describe "bundle install with git sources" do
build_git "has_submodule", "1.0" do |s|
s.add_dependency "submodule"
end
- 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
+ sys_exec "git submodule add #{lib_path("submodule-1.0")} submodule-1.0", :dir => lib_path("has_submodule-1.0")
+ sys_exec "git commit -m \"submodulator\"", :dir => lib_path("has_submodule-1.0")
install_gemfile <<-G
git "#{lib_path("has_submodule-1.0")}" do
@@ -850,10 +850,8 @@ RSpec.describe "bundle install with git sources" do
build_git "has_submodule", "1.0" do |s|
s.add_dependency "submodule"
end
- 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
+ sys_exec "git submodule add #{lib_path("submodule-1.0")} submodule-1.0", :dir => lib_path("has_submodule-1.0")
+ sys_exec "git commit -m \"submodulator\"", :dir => lib_path("has_submodule-1.0")
install_gemfile <<-G
git "#{lib_path("has_submodule-1.0")}", :submodules => true do
@@ -916,6 +914,8 @@ RSpec.describe "bundle install with git sources" do
end
it "prints a friendly error if a file blocks the git repo" do
+ skip "drive letter is not detected correctly in error message" if Gem.win_platform?
+
build_git "foo"
FileUtils.mkdir_p(default_bundle_path)
@@ -943,7 +943,7 @@ RSpec.describe "bundle install with git sources" do
gem "bar", :git => "#{lib_path("nested")}"
G
- expect(File.read(bundled_app("Gemfile.lock")).scan("GIT").size).to eq(1)
+ expect(File.read(bundled_app_lock).scan("GIT").size).to eq(1)
end
describe "switching sources" do
@@ -1003,8 +1003,8 @@ RSpec.describe "bundle install with git sources" do
update_git "valim"
new_revision = revision_for(lib_path("valim-1.0"))
- old_lockfile = File.read(bundled_app("Gemfile.lock"))
- lockfile(bundled_app("Gemfile.lock"), old_lockfile.gsub(/revision: #{old_revision}/, "revision: #{new_revision}"))
+ old_lockfile = File.read(bundled_app_lock)
+ lockfile(bundled_app_lock, old_lockfile.gsub(/revision: #{old_revision}/, "revision: #{new_revision}"))
bundle "install"
@@ -1150,16 +1150,15 @@ RSpec.describe "bundle install with git sources" do
end
2.times do |i|
- Dir.chdir(git_reader.path) do
- File.open("ext/foo.c", "w") do |file|
- file.write <<-C
- #include "ruby.h"
- VALUE foo() { return INT2FIX(#{i}); }
- void Init_foo() { rb_define_global_function("foo", &foo, 0); }
- C
- end
- `git commit -m "commit for iteration #{i}" ext/foo.c`
+ File.open(git_reader.path.join("ext/foo.c"), "w") do |file|
+ file.write <<-C
+ #include "ruby.h"
+ VALUE foo() { return INT2FIX(#{i}); }
+ void Init_foo() { rb_define_global_function("foo", &foo, 0); }
+ C
end
+ sys_exec("git commit -m \"commit for iteration #{i}\" ext/foo.c", :dir => git_reader.path)
+
git_commit_sha = git_reader.ref_for("HEAD")
install_gemfile <<-G
@@ -1311,9 +1310,10 @@ In Gemfile:
puts FOO
R
+ installed_time = out
+
update_git("foo", :branch => "branch2")
- installed_time = out
expect(installed_time).to match(/\A\d+\.\d+\z/)
install_gemfile <<-G
diff --git a/spec/bundler/install/gemfile/install_if.rb b/spec/bundler/install/gemfile/install_if_spec.rb
index 468a2e9052..786e0e9258 100644
--- a/spec/bundler/install/gemfile/install_if.rb
+++ b/spec/bundler/install/gemfile/install_if_spec.rb
@@ -29,7 +29,7 @@ RSpec.describe "bundle install with install_if conditionals" do
rack
PLATFORMS
- ruby
+ #{lockfile_platforms}
DEPENDENCIES
activesupport (= 2.3.5)
diff --git a/spec/bundler/install/gemfile/path_spec.rb b/spec/bundler/install/gemfile/path_spec.rb
index e53636da09..a733c02512 100644
--- a/spec/bundler/install/gemfile/path_spec.rb
+++ b/spec/bundler/install/gemfile/path_spec.rb
@@ -37,7 +37,7 @@ RSpec.describe "bundle install with explicit source paths" do
it "supports relative paths" do
build_lib "foo"
- relative_path = lib_path("foo-1.0").relative_path_from(Pathname.new(Dir.pwd))
+ relative_path = lib_path("foo-1.0").relative_path_from(bundled_app)
install_gemfile <<-G
gem 'foo', :path => "#{relative_path}"
@@ -59,6 +59,8 @@ RSpec.describe "bundle install with explicit source paths" do
end
it "expands paths raise error with not existing user's home dir" do
+ skip "problems with ~ expansion" if Gem.win_platform?
+
build_lib "foo"
username = "some_unexisting_user"
relative_path = lib_path("foo-1.0").relative_path_from(Pathname.new("/home/#{username}").expand_path)
@@ -77,10 +79,7 @@ RSpec.describe "bundle install with explicit source paths" do
gem 'foo', :path => "./foo-1.0"
G
- bundled_app("subdir").mkpath
- Dir.chdir(bundled_app("subdir")) do
- expect(the_bundle).to include_gems("foo 1.0")
- end
+ expect(the_bundle).to include_gems("foo 1.0", :dir => bundled_app("subdir").mkpath)
end
it "sorts paths consistently on install and update when they start with ./" do
@@ -119,12 +118,10 @@ RSpec.describe "bundle install with explicit source paths" do
#{Bundler::VERSION}
L
- Dir.chdir(lib_path("demo")) do
- bundle :install
- expect(lib_path("demo/Gemfile.lock")).to have_lockfile(lockfile)
- bundle :update, :all => true
- expect(lib_path("demo/Gemfile.lock")).to have_lockfile(lockfile)
- end
+ bundle :install, :dir => lib_path("demo")
+ expect(lib_path("demo/Gemfile.lock")).to have_lockfile(lockfile)
+ bundle :update, :all => true, :dir => lib_path("demo")
+ expect(lib_path("demo/Gemfile.lock")).to have_lockfile(lockfile)
end
it "expands paths when comparing locked paths to Gemfile paths" do
@@ -139,6 +136,8 @@ RSpec.describe "bundle install with explicit source paths" do
end
it "installs dependencies from the path even if a newer gem is available elsewhere" do
+ skip "override is not winning" if Gem.win_platform?
+
system_gems "rack-1.0.0"
build_lib "rack", "1.0", :path => lib_path("nested/bar") do |s|
@@ -227,7 +226,6 @@ RSpec.describe "bundle install with explicit source paths" do
gem "foo", :path => "#{lib_path("foo-1.0")}"
G
- expect(err).to_not include("ERROR REPORT")
expect(err).to_not include("Your Gemfile has no gem server sources.")
expect(err).to match(/is not valid. Please fix this gemspec./)
expect(err).to match(/The validation error was 'missing value for attribute version'/)
@@ -246,11 +244,9 @@ RSpec.describe "bundle install with explicit source paths" do
File.open(lib_path("foo/Gemfile"), "w") {|f| f.puts gemfile }
- Dir.chdir(lib_path("foo")) do
- bundle "install"
- expect(the_bundle).to include_gems "foo 1.0"
- expect(the_bundle).to include_gems "rack 1.0"
- end
+ bundle "install", :dir => lib_path("foo")
+ expect(the_bundle).to include_gems "foo 1.0", :dir => lib_path("foo")
+ expect(the_bundle).to include_gems "rack 1.0", :dir => lib_path("foo")
end
it "supports gemspec syntax with an alternative path" do
@@ -272,19 +268,17 @@ RSpec.describe "bundle install with explicit source paths" do
s.add_dependency "rack", ">= 1.0"
end
- Dir.chdir lib_path("foo")
-
- install_gemfile lib_path("foo/Gemfile"), <<-G
+ install_gemfile lib_path("foo/Gemfile"), <<-G, :dir => lib_path("foo")
source "#{file_uri_for(gem_repo1)}"
gemspec
G
build_gem "rack", "1.0.1", :to_system => true
- bundle "install"
+ bundle "install", :dir => lib_path("foo")
- expect(the_bundle).to include_gems "foo 1.0"
- expect(the_bundle).to include_gems "rack 1.0"
+ expect(the_bundle).to include_gems "foo 1.0", :dir => lib_path("foo")
+ expect(the_bundle).to include_gems "rack 1.0", :dir => lib_path("foo")
end
it "doesn't automatically unlock dependencies when using the gemspec syntax and the gem has development dependencies" do
@@ -293,19 +287,17 @@ RSpec.describe "bundle install with explicit source paths" do
s.add_development_dependency "activesupport"
end
- Dir.chdir lib_path("foo")
-
- install_gemfile lib_path("foo/Gemfile"), <<-G
+ install_gemfile lib_path("foo/Gemfile"), <<-G, :dir => lib_path("foo")
source "#{file_uri_for(gem_repo1)}"
gemspec
G
build_gem "rack", "1.0.1", :to_system => true
- bundle "install"
+ bundle "install", :dir => lib_path("foo")
- expect(the_bundle).to include_gems "foo 1.0"
- expect(the_bundle).to include_gems "rack 1.0"
+ expect(the_bundle).to include_gems "foo 1.0", :dir => lib_path("foo")
+ expect(the_bundle).to include_gems "rack 1.0", :dir => lib_path("foo")
end
it "raises if there are multiple gemspecs" do
@@ -423,7 +415,7 @@ RSpec.describe "bundle install with explicit source paths" do
remote: http://rubygems.org
L
- in_app_root { FileUtils.mkdir_p("vendor/bar") }
+ FileUtils.mkdir_p(bundled_app("vendor/bar"))
install_gemfile <<-G
gem "bar", "1.0.0", path: "vendor/bar", require: "bar/nyard"
@@ -645,6 +637,8 @@ RSpec.describe "bundle install with explicit source paths" do
describe "when there are both a gemspec and remote gems" do
it "doesn't query rubygems for local gemspec name" do
+ skip "platform issues" if Gem.win_platform?
+
build_lib "private_lib", "2.2", :path => lib_path("private_lib")
gemfile = <<-G
source "http://localgemserver.test"
@@ -653,13 +647,11 @@ RSpec.describe "bundle install with explicit source paths" do
G
File.open(lib_path("private_lib/Gemfile"), "w") {|f| f.puts gemfile }
- Dir.chdir(lib_path("private_lib")) do
- bundle :install, :env => { "DEBUG" => "1" }, :artifice => "endpoint"
- expect(out).to match(%r{^HTTP GET http://localgemserver\.test/api/v1/dependencies\?gems=rack$})
- expect(out).not_to match(/^HTTP GET.*private_lib/)
- expect(the_bundle).to include_gems "private_lib 2.2"
- expect(the_bundle).to include_gems "rack 1.0"
- end
+ bundle :install, :env => { "DEBUG" => "1" }, :artifice => "endpoint", :dir => lib_path("private_lib")
+ expect(out).to match(%r{^HTTP GET http://localgemserver\.test/api/v1/dependencies\?gems=rack$})
+ expect(out).not_to match(/^HTTP GET.*private_lib/)
+ expect(the_bundle).to include_gems "private_lib 2.2", :dir => lib_path("private_lib")
+ expect(the_bundle).to include_gems "rack 1.0", :dir => lib_path("private_lib")
end
end
diff --git a/spec/bundler/install/gemfile/platform_spec.rb b/spec/bundler/install/gemfile/platform_spec.rb
index c096531398..e33cb29ef8 100644
--- a/spec/bundler/install/gemfile/platform_spec.rb
+++ b/spec/bundler/install/gemfile/platform_spec.rb
@@ -274,6 +274,8 @@ end
RSpec.describe "bundle install with platform conditionals" do
it "installs gems tagged w/ the current platforms" do
+ skip "platform issues" if Gem.win_platform?
+
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
@@ -299,6 +301,8 @@ RSpec.describe "bundle install with platform conditionals" do
end
it "installs gems tagged w/ the current platforms inline" do
+ skip "platform issues" if Gem.win_platform?
+
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem "nokogiri", :platforms => :#{local_tag}
@@ -317,6 +321,8 @@ RSpec.describe "bundle install with platform conditionals" do
end
it "installs gems tagged w/ the current platform inline" do
+ skip "platform issues" if Gem.win_platform?
+
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem "nokogiri", :platform => :#{local_tag}
@@ -347,7 +353,6 @@ RSpec.describe "bundle install with platform conditionals" do
it "does not attempt to install gems from :rbx when using --local" do
simulate_platform "ruby"
- simulate_ruby_engine "ruby"
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
@@ -360,7 +365,6 @@ RSpec.describe "bundle install with platform conditionals" do
it "does not attempt to install gems from other rubies when using --local" do
simulate_platform "ruby"
- simulate_ruby_engine "ruby"
other_ruby_version_tag = RUBY_VERSION =~ /^1\.8/ ? :ruby_19 : :ruby_18
gemfile <<-G
@@ -372,9 +376,8 @@ RSpec.describe "bundle install with platform conditionals" do
expect(out).not_to match(/Could not find gem 'some_gem/)
end
- it "prints a helpful warning when a dependency is unused on any platform" do
+ it "resolves all platforms by default and without warning messages" do
simulate_platform "ruby"
- simulate_ruby_engine "ruby"
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
@@ -384,28 +387,27 @@ RSpec.describe "bundle install with platform conditionals" do
bundle! "install"
- expect(err).to include <<-O.strip
-The dependency #{Gem::Dependency.new("rack", ">= 0")} will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
- O
- end
-
- context "when disable_platform_warnings is true" do
- before { bundle! "config set disable_platform_warnings true" }
+ expect(err).to be_empty
- it "does not print the warning when a dependency is unused on any platform" do
- simulate_platform "ruby"
- simulate_ruby_engine "ruby"
-
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
+ lockfile_should_be <<-L
+ GEM
+ remote: #{file_uri_for(gem_repo1)}/
+ specs:
+ rack (1.0.0)
- gem "rack", :platform => [:mingw, :mswin, :x64_mingw, :jruby]
- G
+ PLATFORMS
+ java
+ ruby
+ x64-mingw32
+ x86-mingw32
+ x86-mswin32
- bundle! "install"
+ DEPENDENCIES
+ rack
- expect(out).not_to match(/The dependency (.*) will be unused/)
- end
+ BUNDLED WITH
+ #{Bundler::VERSION}
+ L
end
end
diff --git a/spec/bundler/install/gemfile/ruby_spec.rb b/spec/bundler/install/gemfile/ruby_spec.rb
index d1e9fc7e05..aab269b325 100644
--- a/spec/bundler/install/gemfile/ruby_spec.rb
+++ b/spec/bundler/install/gemfile/ruby_spec.rb
@@ -2,10 +2,10 @@
RSpec.describe "ruby requirement" do
def locked_ruby_version
- Bundler::RubyVersion.from_string(Bundler::LockfileParser.new(lockfile).ruby_version)
+ Bundler::RubyVersion.from_string(Bundler::LockfileParser.new(File.read(bundled_app_lock)).ruby_version)
end
- # As discovered by https://github.com/bundler/bundler/issues/4147, there is
+ # As discovered by https://github.com/rubygems/bundler/issues/4147, there is
# no test coverage to ensure that adding a gem is possible with a ruby
# requirement. This test verifies the fix, committed in bfbad5c5.
it "allows adding gems" do
@@ -51,6 +51,7 @@ RSpec.describe "ruby requirement" do
gem "rack"
G
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
expect(locked_ruby_version).to eq(Bundler::RubyVersion.system)
simulate_ruby_version "5100"
@@ -72,6 +73,7 @@ RSpec.describe "ruby requirement" do
gem "rack"
G
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
expect(locked_ruby_version).to eq(Bundler::RubyVersion.system)
simulate_ruby_version "5100"
diff --git a/spec/bundler/install/gemfile/sources_spec.rb b/spec/bundler/install/gemfile/sources_spec.rb
index 61943ef2e5..6e29d786f1 100644
--- a/spec/bundler/install/gemfile/sources_spec.rb
+++ b/spec/bundler/install/gemfile/sources_spec.rb
@@ -285,7 +285,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
expect(err).not_to include("Warning: the gem 'rack' was found in multiple sources.")
expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0")
- # In https://github.com/bundler/bundler/issues/3585 this failed
+ # In https://github.com/rubygems/bundler/issues/3585 this failed
# when there is already a lock file, and the gems are missing, so try again
system_gems []
bundle :install
@@ -402,7 +402,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
context "with an existing lockfile" do
before do
- system_gems "rack-0.9.1", "rack-1.0.0", :path => :bundle_path
+ system_gems "rack-0.9.1", "rack-1.0.0", :path => default_bundle_path
lockfile <<-L
GEM
@@ -426,7 +426,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
G
end
- # Reproduction of https://github.com/bundler/bundler/issues/3298
+ # Reproduction of https://github.com/rubygems/bundler/issues/3298
it "does not unlock the installed gem on exec" do
expect(the_bundle).to include_gems("rack 0.9.1")
end
diff --git a/spec/bundler/install/gemfile/specific_platform_spec.rb b/spec/bundler/install/gemfile/specific_platform_spec.rb
index 24b602589f..a1cc6b3551 100644
--- a/spec/bundler/install/gemfile/specific_platform_spec.rb
+++ b/spec/bundler/install/gemfile/specific_platform_spec.rb
@@ -58,6 +58,7 @@ RSpec.describe "bundle install with specific_platform enabled" do
it "locks to both the specific darwin platform and ruby" do
install_gemfile!(google_protobuf)
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
expect(the_bundle.locked_gems.platforms).to eq([pl("ruby"), pl("x86_64-darwin-15")])
expect(the_bundle).to include_gem("google-protobuf 3.0.0.alpha.5.0.5.1 universal-darwin")
expect(the_bundle.locked_gems.specs.map(&:full_name)).to eq(%w[
@@ -78,6 +79,7 @@ RSpec.describe "bundle install with specific_platform enabled" do
source "#{file_uri_for(gem_repo2)}"
gem "facter"
G
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
expect(the_bundle.locked_gems.platforms).to eq([pl("ruby"), pl("x86_64-darwin-15")])
expect(the_bundle).to include_gems("facter 2.4.6 universal-darwin", "CFPropertyList 1.0")
@@ -87,6 +89,10 @@ RSpec.describe "bundle install with specific_platform enabled" do
end
context "when adding a platform via lock --add_platform" do
+ before do
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
+ end
+
it "adds the foreign platform" do
install_gemfile!(google_protobuf)
bundle! "lock --add-platform=#{x64_mingw}"
diff --git a/spec/bundler/install/gemfile_spec.rb b/spec/bundler/install/gemfile_spec.rb
index dd08939cb0..4988bfea47 100644
--- a/spec/bundler/install/gemfile_spec.rb
+++ b/spec/bundler/install/gemfile_spec.rb
@@ -44,20 +44,14 @@ RSpec.describe "bundle install" do
end
it "uses the gemfile while in a subdirectory" do
bundled_app("subdir").mkpath
- Dir.chdir(bundled_app("subdir")) do
- bundle "install"
- bundle "list"
+ bundle "install", :dir => bundled_app("subdir")
+ bundle "list", :dir => bundled_app("subdir")
- expect(out).to include("rack (1.0.0)")
- end
+ expect(out).to include("rack (1.0.0)")
end
end
context "with deprecated features" do
- before :each do
- in_app_root
- end
-
it "reports that lib is an invalid option" do
gemfile <<-G
gem "rack", :lib => "rack"
@@ -68,32 +62,24 @@ RSpec.describe "bundle install" do
end
end
- context "with engine specified in symbol" do
+ context "with engine specified in symbol", :jruby do
it "does not raise any error parsing Gemfile" do
- simulate_ruby_version "2.3.0" do
- simulate_ruby_engine "jruby", "9.1.2.0" do
- install_gemfile! <<-G
- source "#{file_uri_for(gem_repo1)}"
- ruby "2.3.0", :engine => :jruby, :engine_version => "9.1.2.0"
- G
-
- expect(out).to match(/Bundle complete!/)
- end
- end
+ install_gemfile! <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ ruby "#{RUBY_VERSION}", :engine => :jruby, :engine_version => "#{RUBY_ENGINE_VERSION}"
+ G
+
+ expect(out).to match(/Bundle complete!/)
end
it "installation succeeds" do
- simulate_ruby_version "2.3.0" do
- simulate_ruby_engine "jruby", "9.1.2.0" do
- install_gemfile! <<-G
- source "#{file_uri_for(gem_repo1)}"
- ruby "2.3.0", :engine => :jruby, :engine_version => "9.1.2.0"
- gem "rack"
- G
-
- expect(the_bundle).to include_gems "rack 1.0.0"
- end
- end
+ install_gemfile! <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ ruby "#{RUBY_VERSION}", :engine => :jruby, :engine_version => "#{RUBY_ENGINE_VERSION}"
+ gem "rack"
+ G
+
+ expect(the_bundle).to include_gems "rack 1.0.0"
end
end
diff --git a/spec/bundler/install/gems/compact_index_spec.rb b/spec/bundler/install/gems/compact_index_spec.rb
index a294b83d1c..2452d82667 100644
--- a/spec/bundler/install/gems/compact_index_spec.rb
+++ b/spec/bundler/install/gems/compact_index_spec.rb
@@ -404,22 +404,19 @@ The checksum of /versions does not match the checksum provided by the server! So
s.add_dependency "foo"
end
build_gem "missing"
- # need to hit the limit
- 1.upto(Bundler::Source::Rubygems::API_REQUEST_LIMIT) do |i|
- build_gem "gem#{i}"
- end
FileUtils.rm_rf Dir[gem_repo2("gems/foo-*.gem")]
end
- gemfile <<-G
+ api_request_limit = low_api_request_limit_for(gem_repo2)
+
+ install_gemfile! <<-G, :artifice => "compact_index_extra_missing", :env => { "BUNDLER_SPEC_API_REQUEST_LIMIT" => api_request_limit.to_s }
source "#{source_uri}"
source "#{source_uri}/extra" do
gem "back_deps"
end
G
- bundle! :install, :artifice => "compact_index_extra_missing"
expect(the_bundle).to include_gems "back_deps 1.0"
end
@@ -429,15 +426,13 @@ The checksum of /versions does not match the checksum provided by the server! So
s.add_dependency "foo"
end
build_gem "missing"
- # need to hit the limit
- 1.upto(Bundler::Source::Rubygems::API_REQUEST_LIMIT) do |i|
- build_gem "gem#{i}"
- end
FileUtils.rm_rf Dir[gem_repo4("gems/foo-*.gem")]
end
- install_gemfile! <<-G, :artifice => "compact_index_extra_api_missing"
+ api_request_limit = low_api_request_limit_for(gem_repo4)
+
+ install_gemfile! <<-G, :artifice => "compact_index_extra_api_missing", :env => { "BUNDLER_SPEC_API_REQUEST_LIMIT" => api_request_limit.to_s }
source "#{source_uri}"
source "#{source_uri}/extra" do
gem "back_deps"
@@ -523,6 +518,8 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "installs the binstubs", :bundler => "< 3" do
+ skip "exec format error" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem "rack"
@@ -581,7 +578,7 @@ The checksum of /versions does not match the checksum provided by the server! So
let(:user) { "user" }
let(:password) { "pass" }
let(:basic_auth_source_uri) do
- uri = URI.parse(source_uri)
+ uri = Bundler::URI.parse(source_uri)
uri.user = user
uri.password = password
@@ -736,7 +733,7 @@ The checksum of /versions does not match the checksum provided by the server! So
gem "rack"
G
- bundle :install, :env => { "RUBYOPT" => "-I#{bundled_app("broken_ssl")}" }
+ bundle :install, :env => { "RUBYOPT" => opt_add("-I#{bundled_app("broken_ssl")}", ENV["RUBYOPT"]) }
expect(err).to include("OpenSSL")
end
end
@@ -762,27 +759,29 @@ The checksum of /versions does not match the checksum provided by the server! So
end
context ".gemrc with sources is present" do
- before do
+ it "uses other sources declared in the Gemfile" do
File.open(home(".gemrc"), "w") do |file|
file.puts({ :sources => ["https://rubygems.org"] }.to_yaml)
end
- end
- after do
- home(".gemrc").rmtree
- end
+ begin
+ gemfile <<-G
+ source "#{source_uri}"
+ gem 'rack'
+ G
- it "uses other sources declared in the Gemfile" do
- gemfile <<-G
- source "#{source_uri}"
- gem 'rack'
- G
+ bundle! :install, :artifice => "compact_index_forbidden"
- bundle! :install, :artifice => "compact_index_forbidden"
+ expect(exitstatus).to eq(0) if exitstatus
+ ensure
+ home(".gemrc").rmtree
+ end
end
end
it "performs partial update with a non-empty range" do
+ skip "HTTP_RANGE not set" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem 'rack', '0.9.1'
@@ -885,7 +884,7 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "raises when the checksum is the wrong length" do
- install_gemfile <<-G, :artifice => "compact_index_wrong_gem_checksum", :env => { "BUNDLER_SPEC_RACK_CHECKSUM" => "checksum!" }
+ install_gemfile <<-G, :artifice => "compact_index_wrong_gem_checksum", :env => { "BUNDLER_SPEC_RACK_CHECKSUM" => "checksum!", "DEBUG" => "1" }, :verbose => true
source "#{source_uri}"
gem "rack"
G
@@ -915,7 +914,7 @@ The checksum of /versions does not match the checksum provided by the server! So
source "#{source_uri}"
gem "rails"
G
- deps = [Gem::Dependency.new("rake", "= 12.3.2"),
+ deps = [Gem::Dependency.new("rake", "= 13.0.1"),
Gem::Dependency.new("actionpack", "= 2.3.2"),
Gem::Dependency.new("activerecord", "= 2.3.2"),
Gem::Dependency.new("actionmailer", "= 2.3.2"),
@@ -933,7 +932,7 @@ Either installing with `--full-index` or running `bundle update rails` should fi
gem "activemerchant"
end
G
- gem_command! :uninstall, "activemerchant"
+ gem_command! "uninstall activemerchant"
bundle! "update rails", :artifice => "compact_index"
expect(lockfile.scan(/activemerchant \(/).size).to eq(1)
end
diff --git a/spec/bundler/install/gems/dependency_api_spec.rb b/spec/bundler/install/gems/dependency_api_spec.rb
index a8713eb445..863966a0e1 100644
--- a/spec/bundler/install/gems/dependency_api_spec.rb
+++ b/spec/bundler/install/gems/dependency_api_spec.rb
@@ -378,21 +378,18 @@ RSpec.describe "gemcutter's dependency API" do
s.add_dependency "foo"
end
build_gem "missing"
- # need to hit the limit
- 1.upto(Bundler::Source::Rubygems::API_REQUEST_LIMIT) do |i|
- build_gem "gem#{i}"
- end
FileUtils.rm_rf Dir[gem_repo2("gems/foo-*.gem")]
end
- gemfile <<-G
+ api_request_limit = low_api_request_limit_for(gem_repo2)
+
+ install_gemfile! <<-G, :artifice => "endpoint_extra_missing", :env => { "BUNDLER_SPEC_API_REQUEST_LIMIT" => api_request_limit.to_s }
source "#{source_uri}"
source "#{source_uri}/extra"
gem "back_deps"
G
- bundle :install, :artifice => "endpoint_extra_missing"
expect(the_bundle).to include_gems "back_deps 1.0"
end
@@ -402,22 +399,19 @@ RSpec.describe "gemcutter's dependency API" do
s.add_dependency "foo"
end
build_gem "missing"
- # need to hit the limit
- 1.upto(Bundler::Source::Rubygems::API_REQUEST_LIMIT) do |i|
- build_gem "gem#{i}"
- end
FileUtils.rm_rf Dir[gem_repo2("gems/foo-*.gem")]
end
- gemfile <<-G
+ api_request_limit = low_api_request_limit_for(gem_repo2)
+
+ install_gemfile! <<-G, :artifice => "endpoint_extra_missing", :env => { "BUNDLER_SPEC_API_REQUEST_LIMIT" => api_request_limit.to_s }
source "#{source_uri}"
source "#{source_uri}/extra" do
gem "back_deps"
end
G
- bundle :install, :artifice => "endpoint_extra_missing"
expect(the_bundle).to include_gems "back_deps 1.0"
end
@@ -497,6 +491,8 @@ RSpec.describe "gemcutter's dependency API" do
end
it "installs the binstubs", :bundler => "< 3" do
+ skip "exec format error" if Gem.win_platform?
+
gemfile <<-G
source "#{source_uri}"
gem "rack"
@@ -555,7 +551,7 @@ RSpec.describe "gemcutter's dependency API" do
let(:user) { "user" }
let(:password) { "pass" }
let(:basic_auth_source_uri) do
- uri = URI.parse(source_uri)
+ uri = Bundler::URI.parse(source_uri)
uri.user = user
uri.password = password
@@ -710,7 +706,7 @@ RSpec.describe "gemcutter's dependency API" do
gem "rack"
G
- bundle :install, :env => { "RUBYOPT" => "-I#{bundled_app("broken_ssl")}" }
+ bundle :install, :env => { "RUBYOPT" => opt_add("-I#{bundled_app("broken_ssl")}", ENV["RUBYOPT"]) }
expect(err).to include("OpenSSL")
end
end
@@ -736,25 +732,23 @@ RSpec.describe "gemcutter's dependency API" do
end
context ".gemrc with sources is present" do
- before do
+ it "uses other sources declared in the Gemfile" do
File.open(home(".gemrc"), "w") do |file|
file.puts({ :sources => ["https://rubygems.org"] }.to_yaml)
end
- end
- after do
- home(".gemrc").rmtree
- end
-
- it "uses other sources declared in the Gemfile" do
- gemfile <<-G
- source "#{source_uri}"
- gem 'rack'
- G
+ begin
+ gemfile <<-G
+ source "#{source_uri}"
+ gem 'rack'
+ G
- bundle "install", :artifice => "endpoint_marshal_fail"
+ bundle "install", :artifice => "endpoint_marshal_fail"
- expect(exitstatus).to eq(0) if exitstatus
+ expect(exitstatus).to eq(0) if exitstatus
+ ensure
+ home(".gemrc").rmtree
+ end
end
end
end
diff --git a/spec/bundler/install/gems/flex_spec.rb b/spec/bundler/install/gems/flex_spec.rb
index 865bc7b72a..77891acc24 100644
--- a/spec/bundler/install/gems/flex_spec.rb
+++ b/spec/bundler/install/gems/flex_spec.rb
@@ -233,7 +233,7 @@ RSpec.describe "bundle flex_install" do
it "does something" do
expect do
bundle "install"
- end.not_to change { File.read(bundled_app("Gemfile.lock")) }
+ end.not_to change { File.read(bundled_app_lock) }
expect(err).to include("rack = 0.9.1")
expect(err).to include("locked at 1.0.0")
diff --git a/spec/bundler/install/gems/native_extensions_spec.rb b/spec/bundler/install/gems/native_extensions_spec.rb
index 3e59a3cebd..a057d0d152 100644
--- a/spec/bundler/install/gems/native_extensions_spec.rb
+++ b/spec/bundler/install/gems/native_extensions_spec.rb
@@ -38,9 +38,8 @@ RSpec.describe "installing a gem with native extensions", :ruby_repo do
G
bundle "config set build.c_extension --with-c_extension=hello"
- bundle "install"
+ bundle! "install"
- expect(out).not_to include("extconf.rb failed")
expect(out).to include("Installing c_extension 1.0 with native extensions")
run "Bundler.require; puts CExtension.new.its_true"
@@ -82,12 +81,64 @@ RSpec.describe "installing a gem with native extensions", :ruby_repo do
gem "c_extension", :git => #{lib_path("c_extension-1.0").to_s.dump}
G
- expect(out).not_to include("extconf.rb failed")
+ expect(err).to_not include("warning: conflicting chdir during another chdir block")
run! "Bundler.require; puts CExtension.new.its_true"
expect(out).to eq("true")
end
+ it "installs correctly from git when multiple gems with extensions share one repository" do
+ build_repo2 do
+ ["one", "two"].each do |n|
+ build_lib "c_extension_#{n}", "1.0", :path => lib_path("gems/c_extension_#{n}") do |s|
+ s.extensions = ["ext/extconf.rb"]
+ s.write "ext/extconf.rb", <<-E
+ require "mkmf"
+ name = "c_extension_bundle_#{n}"
+ dir_config(name)
+ raise "OMG" unless with_config("c_extension_#{n}") == "#{n}"
+ create_makefile(name)
+ E
+
+ s.write "ext/c_extension_#{n}.c", <<-C
+ #include "ruby.h"
+
+ VALUE c_extension_#{n}_value(VALUE self) {
+ return rb_str_new_cstr("#{n}");
+ }
+
+ void Init_c_extension_bundle_#{n}() {
+ VALUE c_Extension = rb_define_class("CExtension_#{n}", rb_cObject);
+ rb_define_method(c_Extension, "value", c_extension_#{n}_value, 0);
+ }
+ C
+
+ s.write "lib/c_extension_#{n}.rb", <<-C
+ require "c_extension_bundle_#{n}"
+ C
+ end
+ end
+ build_git "gems", :path => lib_path("gems"), :gemspec => false
+ end
+
+ bundle! "config set build.c_extension_one --with-c_extension_one=one"
+ bundle! "config set build.c_extension_two --with-c_extension_two=two"
+
+ # 1st time, require only one gem -- only one of the extensions gets built.
+ install_gemfile! <<-G
+ gem "c_extension_one", :git => #{lib_path("gems").to_s.dump}
+ G
+
+ # 2nd time, require both gems -- we need both extensions to be built now.
+ install_gemfile! <<-G
+ gem "c_extension_one", :git => #{lib_path("gems").to_s.dump}
+ gem "c_extension_two", :git => #{lib_path("gems").to_s.dump}
+ G
+
+ run! "Bundler.require; puts CExtension_one.new.value; puts CExtension_two.new.value"
+ expect(out).to eq("one\ntwo")
+ end
+
it "install with multiple build flags" do
build_git "c_extension" do |s|
s.extensions = ["ext/extconf.rb"]
@@ -123,8 +174,6 @@ RSpec.describe "installing a gem with native extensions", :ruby_repo do
gem "c_extension", :git => #{lib_path("c_extension-1.0").to_s.dump}
G
- expect(out).not_to include("extconf.rb failed")
-
run! "Bundler.require; puts CExtension.new.its_true"
expect(out).to eq("true")
end
diff --git a/spec/bundler/install/gems/resolving_spec.rb b/spec/bundler/install/gems/resolving_spec.rb
index 52511ff67f..315d615604 100644
--- a/spec/bundler/install/gems/resolving_spec.rb
+++ b/spec/bundler/install/gems/resolving_spec.rb
@@ -19,6 +19,8 @@ RSpec.describe "bundle install with install-time dependencies" do
end
it "installs gems with a dependency with no type" do
+ skip "incorrect data check error" if Gem.win_platform?
+
build_repo2
path = "#{gem_repo2}/#{Gem::MARSHAL_SPEC_DIR}/actionpack-2.3.2.gemspec.rz"
@@ -67,6 +69,20 @@ RSpec.describe "bundle install with install-time dependencies" do
expect(the_bundle).to include_gems "net_a 1.0", "net_b 1.0", "net_c 1.0", "net_d 1.0", "net_e 1.0"
end
+ context "with ENV['BUNDLER_DEBUG_RESOLVER'] set" do
+ it "produces debug output" do
+ gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ gem "net_c"
+ gem "net_e"
+ G
+
+ bundle :install, :env => { "BUNDLER_DEBUG_RESOLVER" => "1" }
+
+ expect(err).to include("BUNDLER: Starting resolution")
+ end
+ end
+
context "with ENV['DEBUG_RESOLVER'] set" do
it "produces debug output" do
gemfile <<-G
@@ -77,7 +93,7 @@ RSpec.describe "bundle install with install-time dependencies" do
bundle :install, :env => { "DEBUG_RESOLVER" => "1" }
- expect(err).to include("Creating possibility state for net_c")
+ expect(err).to include("BUNDLER: Starting resolution")
end
end
@@ -92,8 +108,8 @@ RSpec.describe "bundle install with install-time dependencies" do
bundle :install, :env => { "DEBUG_RESOLVER_TREE" => "1" }
expect(err).to include(" net_b").
- and include("Starting resolution").
- and include("Finished resolution").
+ and include("BUNDLER: Starting resolution").
+ and include("BUNDLER: Finished resolution").
and include("Attempting to activate")
end
end
@@ -101,6 +117,10 @@ RSpec.describe "bundle install with install-time dependencies" do
describe "when a required ruby version" do
context "allows only an older version" do
+ before do
+ skip "gem not found" if Gem.win_platform?
+ end
+
it "installs the older version" do
build_repo2 do
build_gem "rack", "9001.0.0" do |s|
@@ -137,6 +157,31 @@ RSpec.describe "bundle install with install-time dependencies" do
expect(out).to_not include("rack-9001.0.0 requires ruby version > 9000")
expect(the_bundle).to include_gems("rack 1.2")
end
+
+ it "installs the older not platform specific version" do
+ build_repo4 do
+ build_gem "rack", "9001.0.0" do |s|
+ s.required_ruby_version = "> 9000"
+ end
+ build_gem "rack", "1.2" do |s|
+ s.platform = mingw
+ s.required_ruby_version = "> 9000"
+ end
+ build_gem "rack", "1.2"
+ end
+
+ simulate_platform mingw do
+ install_gemfile <<-G, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s }
+ ruby "#{RUBY_VERSION}"
+ source "http://localgemserver.test/"
+ gem 'rack'
+ G
+ end
+
+ expect(out).to_not include("rack-9001.0.0 requires ruby version > 9000")
+ expect(out).to_not include("rack-1.2-#{Bundler.local_platform} requires ruby version > 9000")
+ expect(the_bundle).to include_gems("rack 1.2")
+ end
end
context "allows no gems" do
@@ -150,9 +195,18 @@ RSpec.describe "bundle install with install-time dependencies" do
let(:ruby_requirement) { %("#{RUBY_VERSION}") }
let(:error_message_requirement) { "~> #{RUBY_VERSION}.0" }
+ let(:error_message_platform) do
+ if Bundler.feature_flag.specific_platform?
+ " #{Bundler.local_platform}"
+ else
+ ""
+ end
+ end
shared_examples_for "ruby version conflicts" do
it "raises an error during resolution" do
+ skip "ruby requirement includes platform and it shouldn't" if Gem.win_platform?
+
install_gemfile <<-G, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s }
source "http://localgemserver.test/"
ruby #{ruby_requirement}
@@ -164,9 +218,9 @@ RSpec.describe "bundle install with install-time dependencies" do
nice_error = strip_whitespace(<<-E).strip
Bundler found conflicting requirements for the Ruby\0 version:
In Gemfile:
- Ruby\0 (#{error_message_requirement})
+ Ruby\0 (#{error_message_requirement})#{error_message_platform}
- require_ruby was resolved to 1.0, which depends on
+ require_ruby#{error_message_platform} was resolved to 1.0, which depends on
Ruby\0 (> 9000)
Ruby\0 (> 9000), which is required by gem 'require_ruby', is not available in the local ruby installation
@@ -179,7 +233,7 @@ RSpec.describe "bundle install with install-time dependencies" do
describe "with a < requirement" do
let(:ruby_requirement) { %("< 5000") }
- let(:error_message_requirement) { "< 5000" }
+ let(:error_message_requirement) { Gem::Requirement.new(["< 5000", "= #{Bundler::RubyVersion.system.to_gem_version_with_patchlevel}"]).to_s }
it_behaves_like "ruby version conflicts"
end
@@ -187,7 +241,7 @@ RSpec.describe "bundle install with install-time dependencies" do
describe "with a compound requirement" do
let(:reqs) { ["> 0.1", "< 5000"] }
let(:ruby_requirement) { reqs.map(&:dump).join(", ") }
- let(:error_message_requirement) { Gem::Requirement.new(reqs).to_s }
+ let(:error_message_requirement) { Gem::Requirement.new(reqs + ["= #{Bundler::RubyVersion.system.to_gem_version_with_patchlevel}"]).to_s }
it_behaves_like "ruby version conflicts"
end
diff --git a/spec/bundler/install/gems/standalone_spec.rb b/spec/bundler/install/gems/standalone_spec.rb
index f1d5c8b505..521499a5df 100644
--- a/spec/bundler/install/gems/standalone_spec.rb
+++ b/spec/bundler/install/gems/standalone_spec.rb
@@ -21,15 +21,18 @@ RSpec.shared_examples "bundle install --standalone" do
testrb << "\nrequire \"#{k}\""
testrb << "\nputs #{k.upcase}"
end
- Dir.chdir(bundled_app) do
- ruby testrb, :no_lib => true
- end
+ ruby testrb, :no_lib => true
expect(out).to eq(expected_gems.values.join("\n"))
end
it "works on a different system" do
- FileUtils.mv(bundled_app, "#{bundled_app}2")
+ begin
+ FileUtils.mv(bundled_app, "#{bundled_app}2")
+ rescue Errno::ENOTEMPTY
+ puts "Couldn't rename test app since the target folder has these files: #{Dir.glob("#{bundled_app}2/*")}"
+ raise
+ end
testrb = String.new <<-RUBY
$:.unshift File.expand_path("bundle")
@@ -40,9 +43,7 @@ RSpec.shared_examples "bundle install --standalone" do
testrb << "\nrequire \"#{k}\""
testrb << "\nputs #{k.upcase}"
end
- Dir.chdir("#{bundled_app}2") do
- ruby testrb, :no_lib => true
- end
+ ruby testrb, :no_lib => true, :dir => "#{bundled_app}2"
expect(out).to eq(expected_gems.values.join("\n"))
end
@@ -54,7 +55,7 @@ RSpec.shared_examples "bundle install --standalone" do
source "#{file_uri_for(gem_repo1)}"
gem "rails"
G
- bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true)
+ bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true, :dir => cwd)
end
let(:expected_gems) do
@@ -69,7 +70,7 @@ RSpec.shared_examples "bundle install --standalone" do
describe "with gems with native extension", :ruby_repo do
before do
- install_gemfile <<-G, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true)
+ install_gemfile <<-G, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true, :dir => cwd)
source "#{file_uri_for(gem_repo1)}"
gem "very_simple_binary"
G
@@ -102,7 +103,7 @@ RSpec.shared_examples "bundle install --standalone" do
end
G
end
- install_gemfile <<-G, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true)
+ install_gemfile <<-G, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true, :dir => cwd)
gem "bar", :git => "#{lib_path("bar-1.0")}"
G
end
@@ -122,7 +123,7 @@ RSpec.shared_examples "bundle install --standalone" do
gem "rails"
gem "devise", :git => "#{lib_path("devise-1.0")}"
G
- bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true)
+ bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true, :dir => cwd)
end
let(:expected_gems) do
@@ -149,7 +150,7 @@ RSpec.shared_examples "bundle install --standalone" do
gem "rack-test"
end
G
- bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true)
+ bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true, :dir => cwd)
end
let(:expected_gems) do
@@ -162,88 +163,63 @@ RSpec.shared_examples "bundle install --standalone" do
include_examples "common functionality"
it "allows creating a standalone file with limited groups" do
- bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => "default")
+ bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => "default", :dir => cwd)
- Dir.chdir(bundled_app) do
- load_error_ruby <<-RUBY, "spec", :no_lib => true
- $:.unshift File.expand_path("bundle")
- require "bundler/setup"
+ load_error_ruby <<-RUBY, "spec", :no_lib => true
+ $:.unshift File.expand_path("bundle")
+ require "bundler/setup"
- require "actionpack"
- puts ACTIONPACK
- require "spec"
- RUBY
- end
+ require "actionpack"
+ puts ACTIONPACK
+ require "spec"
+ RUBY
expect(out).to eq("2.3.2")
expect(err).to eq("ZOMG LOAD ERROR")
end
it "allows --without to limit the groups used in a standalone" do
- bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle"), :without => "test").merge(:standalone => true)
+ bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle"), :without => "test").merge(:standalone => true, :dir => cwd)
- Dir.chdir(bundled_app) do
- load_error_ruby <<-RUBY, "spec", :no_lib => true
- $:.unshift File.expand_path("bundle")
- require "bundler/setup"
+ load_error_ruby <<-RUBY, "spec", :no_lib => true
+ $:.unshift File.expand_path("bundle")
+ require "bundler/setup"
- require "actionpack"
- puts ACTIONPACK
- require "spec"
- RUBY
- end
+ require "actionpack"
+ puts ACTIONPACK
+ require "spec"
+ RUBY
expect(out).to eq("2.3.2")
expect(err).to eq("ZOMG LOAD ERROR")
end
- it "allows --path to change the location of the standalone bundle", :bundler => "< 3" do
- bundle! "install", forgotten_command_line_options(:path => "path/to/bundle").merge(:standalone => true)
+ it "allows --path to change the location of the standalone bundle" do
+ bundle! "install", forgotten_command_line_options(:path => "path/to/bundle").merge(:standalone => true, :dir => cwd)
- Dir.chdir(bundled_app) do
- ruby <<-RUBY, :no_lib => true
- $:.unshift File.expand_path("path/to/bundle")
- require "bundler/setup"
+ ruby <<-RUBY, :no_lib => true
+ $:.unshift File.expand_path("path/to/bundle")
+ require "bundler/setup"
- require "actionpack"
- puts ACTIONPACK
- RUBY
- end
+ require "actionpack"
+ puts ACTIONPACK
+ RUBY
expect(out).to eq("2.3.2")
end
- it "allows --path to change the location of the standalone bundle", :bundler => "3" do
- bundle! "install", forgotten_command_line_options(:path => "path/to/bundle").merge(:standalone => true)
- path = File.expand_path("path/to/bundle")
-
- Dir.chdir(bundled_app) do
- ruby <<-RUBY, :no_lib => true
- $:.unshift File.expand_path(#{path.dump})
- require "bundler/setup"
-
- require "actionpack"
- puts ACTIONPACK
- RUBY
- end
+ it "allows remembered --without to limit the groups used in a standalone" do
+ bundle! :install, forgotten_command_line_options(:without => "test").merge(:dir => cwd)
+ bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true, :dir => cwd)
- expect(out).to eq("2.3.2")
- end
+ load_error_ruby <<-RUBY, "spec", :no_lib => true
+ $:.unshift File.expand_path("bundle")
+ require "bundler/setup"
- it "allows remembered --without to limit the groups used in a standalone" do
- bundle! :install, forgotten_command_line_options(:without => "test")
- bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true)
-
- Dir.chdir(bundled_app) do
- load_error_ruby <<-RUBY, "spec", :no_lib => true
- $:.unshift File.expand_path("bundle")
- require "bundler/setup"
-
- require "actionpack"
- puts ACTIONPACK
- require "spec"
- RUBY
- end
+ require "actionpack"
+ puts ACTIONPACK
+ require "spec"
+ RUBY
expect(out).to eq("2.3.2")
expect(err).to eq("ZOMG LOAD ERROR")
@@ -259,7 +235,7 @@ RSpec.shared_examples "bundle install --standalone" do
source "#{source_uri}"
gem "rails"
G
- bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true, :artifice => "endpoint")
+ bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true, :artifice => "endpoint", :dir => cwd)
end
let(:expected_gems) do
@@ -279,7 +255,7 @@ RSpec.shared_examples "bundle install --standalone" do
source "#{file_uri_for(gem_repo1)}"
gem "rails"
G
- bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true, :binstubs => true)
+ bundle! :install, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true, :binstubs => true, :dir => cwd)
end
let(:expected_gems) do
@@ -292,21 +268,21 @@ RSpec.shared_examples "bundle install --standalone" do
include_examples "common functionality"
it "creates stubs that use the standalone load path" do
- Dir.chdir(bundled_app) do
- expect(`bin/rails -v`.chomp).to eql "2.3.2"
- end
+ skip "exec format error" if Gem.win_platform?
+
+ expect(sys_exec("bin/rails -v").chomp).to eql "2.3.2"
end
it "creates stubs that can be executed from anywhere" do
+ skip "exec format error" if Gem.win_platform?
+
require "tmpdir"
- Dir.chdir(Dir.tmpdir) do
- sys_exec!(%(#{bundled_app("bin/rails")} -v))
- expect(out).to eq("2.3.2")
- end
+ sys_exec!(%(#{bundled_app("bin/rails")} -v), :dir => Dir.tmpdir)
+ expect(out).to eq("2.3.2")
end
it "creates stubs that can be symlinked" do
- pending "File.symlink is unsupported on Windows" if Bundler::WINDOWS
+ skip "symlinks unsupported" if Gem.win_platform?
symlink_dir = tmp("symlink")
FileUtils.mkdir_p(symlink_dir)
@@ -325,13 +301,13 @@ RSpec.shared_examples "bundle install --standalone" do
end
RSpec.describe "bundle install --standalone" do
+ let(:cwd) { bundled_app }
+
include_examples("bundle install --standalone")
end
RSpec.describe "bundle install --standalone run in a subdirectory" do
- before do
- Dir.chdir(bundled_app("bob").tap(&:mkpath))
- end
+ let(:cwd) { bundled_app("bob").tap(&:mkpath) }
include_examples("bundle install --standalone")
end
diff --git a/spec/bundler/install/gems/sudo_spec.rb b/spec/bundler/install/gems/sudo_spec.rb
index 170ffaca03..3e4c1ad1c1 100644
--- a/spec/bundler/install/gems/sudo_spec.rb
+++ b/spec/bundler/install/gems/sudo_spec.rb
@@ -166,7 +166,7 @@ RSpec.describe "when using sudo", :sudo => true do
end
it "warns against that" do
- bundle :install, :sudo => true
+ bundle :install, :sudo => :preserve_env
expect(err).to include(warning)
end
@@ -179,7 +179,7 @@ RSpec.describe "when using sudo", :sudo => true do
context "when silence_root_warning = false" do
it "warns against that" do
- bundle :install, :sudo => true, :env => { "BUNDLE_SILENCE_ROOT_WARNING" => "false" }
+ bundle :install, :sudo => :preserve_env, :env => { "BUNDLE_SILENCE_ROOT_WARNING" => "false" }
expect(err).to include(warning)
end
end
diff --git a/spec/bundler/install/gems/win32_spec.rb b/spec/bundler/install/gems/win32_spec.rb
index 01edcca803..972a455bee 100644
--- a/spec/bundler/install/gems/win32_spec.rb
+++ b/spec/bundler/install/gems/win32_spec.rb
@@ -2,7 +2,7 @@
RSpec.describe "bundle install with win32-generated lockfile" do
it "should read lockfile" do
- File.open(bundled_app("Gemfile.lock"), "wb") do |f|
+ File.open(bundled_app_lock, "wb") do |f|
f << "GEM\r\n"
f << " remote: #{file_uri_for(gem_repo1)}/\r\n"
f << " specs:\r\n"
diff --git a/spec/bundler/install/gemspecs_spec.rb b/spec/bundler/install/gemspecs_spec.rb
index 4c00caa60c..048987af9b 100644
--- a/spec/bundler/install/gemspecs_spec.rb
+++ b/spec/bundler/install/gemspecs_spec.rb
@@ -28,6 +28,8 @@ RSpec.describe "bundle install" do
end
it "should use gemspecs in the system cache when available" do
+ skip "weird incompatible marshal file format error" if Gem.win_platform?
+
gemfile <<-G
source "http://localtestserver.gem"
gem 'rack'
diff --git a/spec/bundler/install/git_spec.rb b/spec/bundler/install/git_spec.rb
index cc8bf70b03..1b32991fa8 100644
--- a/spec/bundler/install/git_spec.rb
+++ b/spec/bundler/install/git_spec.rb
@@ -5,16 +5,17 @@ RSpec.describe "bundle install" do
it "displays the revision hash of the gem repository", :bundler => "< 3" do
build_git "foo", "1.0", :path => lib_path("foo")
- install_gemfile <<-G
- gem "foo", :git => "#{lib_path("foo")}"
+ install_gemfile! <<-G
+ gem "foo", :git => "#{file_uri_for(lib_path("foo"))}"
G
- bundle! :install
- expect(out).to include("Using foo 1.0 from #{lib_path("foo")} (at master@#{revision_for(lib_path("foo"))[0..6]})")
+ expect(out).to include("Using foo 1.0 from #{file_uri_for(lib_path("foo"))} (at master@#{revision_for(lib_path("foo"))[0..6]})")
expect(the_bundle).to include_gems "foo 1.0", :source => "git@#{lib_path("foo")}"
end
it "displays the ref of the gem repository when using branch~num as a ref", :bundler => "< 3" do
+ skip "maybe branch~num notation doesn't work on Windows' git" if Gem.win_platform?
+
build_git "foo", "1.0", :path => lib_path("foo")
rev = revision_for(lib_path("foo"))[0..6]
update_git "foo", "2.0", :path => lib_path("foo"), :gemspec => true
@@ -22,17 +23,16 @@ RSpec.describe "bundle install" do
update_git "foo", "3.0", :path => lib_path("foo"), :gemspec => true
install_gemfile! <<-G
- gem "foo", :git => "#{lib_path("foo")}", :ref => "master~2"
+ gem "foo", :git => "#{file_uri_for(lib_path("foo"))}", :ref => "master~2"
G
- bundle! :install
- expect(out).to include("Using foo 1.0 from #{lib_path("foo")} (at master~2@#{rev})")
+ expect(out).to include("Using foo 1.0 from #{file_uri_for(lib_path("foo"))} (at master~2@#{rev})")
expect(the_bundle).to include_gems "foo 1.0", :source => "git@#{lib_path("foo")}"
update_git "foo", "4.0", :path => lib_path("foo"), :gemspec => true
bundle! :update, :all => true
- expect(out).to include("Using foo 2.0 (was 1.0) from #{lib_path("foo")} (at master~2@#{rev2})")
+ expect(out).to include("Using foo 2.0 (was 1.0) from #{file_uri_for(lib_path("foo"))} (at master~2@#{rev2})")
expect(the_bundle).to include_gems "foo 2.0", :source => "git@#{lib_path("foo")}"
end
@@ -69,10 +69,10 @@ RSpec.describe "bundle install" do
build_git "gems", :path => lib_path("gems"), :gemspec => false
end
- install_gemfile <<-G
+ install_gemfile! <<-G
source "#{file_uri_for(gem_repo2)}"
- gem "foo", :git => "#{lib_path("gems")}", :glob => "foo/*.gemspec"
- gem "zebra", :git => "#{lib_path("gems")}", :glob => "zebra/*.gemspec"
+ gem "foo", :git => "#{file_uri_for(lib_path("gems"))}", :glob => "foo/*.gemspec"
+ gem "zebra", :git => "#{file_uri_for(lib_path("gems"))}", :glob => "zebra/*.gemspec"
G
bundle "info foo"
diff --git a/spec/bundler/install/global_cache_spec.rb b/spec/bundler/install/global_cache_spec.rb
index 023e52b060..de7b511a1d 100644
--- a/spec/bundler/install/global_cache_spec.rb
+++ b/spec/bundler/install/global_cache_spec.rb
@@ -161,34 +161,34 @@ RSpec.describe "global gem caching" do
expect(source_global_cache("rack-1.0.0.gem")).to exist
expect(source_global_cache("activesupport-2.3.5.gem")).to exist
- Dir.chdir bundled_app2 do
- create_file bundled_app2("gems.rb"), <<-G
- source "#{source}"
- gem "activesupport"
- G
-
- # Neither gem is installed and both are in the global cache
- expect(the_bundle).not_to include_gems "rack 1.0.0"
- expect(the_bundle).not_to include_gems "activesupport 2.3.5"
- expect(source_global_cache("rack-1.0.0.gem")).to exist
- expect(source_global_cache("activesupport-2.3.5.gem")).to exist
-
- # Install using the global cache instead of by downloading the .gem
- # from the server
- bundle! :install, :artifice => "compact_index_no_gem"
-
- # activesupport is installed and both are in the global cache
- expect(the_bundle).not_to include_gems "rack 1.0.0"
- expect(the_bundle).to include_gems "activesupport 2.3.5"
- expect(source_global_cache("rack-1.0.0.gem")).to exist
- expect(source_global_cache("activesupport-2.3.5.gem")).to exist
- end
+ create_file bundled_app2("gems.rb"), <<-G
+ source "#{source}"
+ gem "activesupport"
+ G
+
+ # Neither gem is installed and both are in the global cache
+ expect(the_bundle).not_to include_gems "rack 1.0.0", :dir => bundled_app2
+ expect(the_bundle).not_to include_gems "activesupport 2.3.5", :dir => bundled_app2
+ expect(source_global_cache("rack-1.0.0.gem")).to exist
+ expect(source_global_cache("activesupport-2.3.5.gem")).to exist
+
+ # Install using the global cache instead of by downloading the .gem
+ # from the server
+ bundle! :install, :artifice => "compact_index_no_gem", :dir => bundled_app2
+
+ # activesupport is installed and both are in the global cache
+ expect(the_bundle).not_to include_gems "rack 1.0.0", :dir => bundled_app2
+ expect(the_bundle).to include_gems "activesupport 2.3.5", :dir => bundled_app2
+ expect(source_global_cache("rack-1.0.0.gem")).to exist
+ expect(source_global_cache("activesupport-2.3.5.gem")).to exist
end
end
end
describe "extension caching", :ruby_repo do
it "works" do
+ skip "gets incorrect ref in path" if Gem.win_platform?
+
build_git "very_simple_git_binary", &:add_c_extension
build_lib "very_simple_path_binary", &:add_c_extension
revision = revision_for(lib_path("very_simple_git_binary-1.0"))[0, 12]
diff --git a/spec/bundler/install/path_spec.rb b/spec/bundler/install/path_spec.rb
index 5240c5820c..bed28ed3e2 100644
--- a/spec/bundler/install/path_spec.rb
+++ b/spec/bundler/install/path_spec.rb
@@ -22,10 +22,8 @@ RSpec.describe "bundle install" do
dir = bundled_app("bun++dle")
dir.mkpath
- Dir.chdir(dir) do
- bundle! :install, forgotten_command_line_options(:path => dir.join("vendor/bundle"))
- expect(out).to include("installed into `./vendor/bundle`")
- end
+ bundle! :install, forgotten_command_line_options(:path => dir.join("vendor/bundle")).merge(:dir => dir)
+ expect(out).to include("installed into `./vendor/bundle`")
dir.rmtree
end
@@ -54,30 +52,24 @@ RSpec.describe "bundle install" do
before { bundle! "config set path_relative_to_cwd true" }
it "installs the bundle relatively to current working directory", :bundler => "< 3" do
- Dir.chdir(bundled_app.parent) do
- bundle! "install --gemfile='#{bundled_app}/Gemfile' --path vendor/bundle"
- expect(out).to include("installed into `./vendor/bundle`")
- expect(bundled_app("../vendor/bundle")).to be_directory
- end
+ bundle! "install --gemfile='#{bundled_app}/Gemfile' --path vendor/bundle", :dir => bundled_app.parent
+ expect(out).to include("installed into `./vendor/bundle`")
+ expect(bundled_app("../vendor/bundle")).to be_directory
expect(the_bundle).to include_gems "rack 1.0.0"
end
it "installs the standalone bundle relative to the cwd" do
- Dir.chdir(bundled_app.parent) do
- bundle! :install, :gemfile => bundled_app("Gemfile"), :standalone => true
- expect(out).to include("installed into `./bundled_app/bundle`")
- expect(bundled_app("bundle")).to be_directory
- expect(bundled_app("bundle/ruby")).to be_directory
- end
+ bundle! :install, :gemfile => bundled_app_gemfile, :standalone => true, :dir => bundled_app.parent
+ expect(out).to include("installed into `./bundled_app/bundle`")
+ expect(bundled_app("bundle")).to be_directory
+ expect(bundled_app("bundle/ruby")).to be_directory
bundle! "config unset path"
- Dir.chdir(bundled_app("subdir").tap(&:mkpath)) do
- bundle! :install, :gemfile => bundled_app("Gemfile"), :standalone => true
- expect(out).to include("installed into `../bundle`")
- expect(bundled_app("bundle")).to be_directory
- expect(bundled_app("bundle/ruby")).to be_directory
- end
+ bundle! :install, :gemfile => bundled_app_gemfile, :standalone => true, :dir => bundled_app("subdir").tap(&:mkpath)
+ expect(out).to include("installed into `../bundle`")
+ expect(bundled_app("bundle")).to be_directory
+ expect(bundled_app("bundle/ruby")).to be_directory
end
end
end
@@ -137,9 +129,7 @@ RSpec.describe "bundle install" do
set_bundle_path(type, "vendor")
FileUtils.mkdir_p bundled_app("lol")
- Dir.chdir(bundled_app("lol")) do
- bundle! :install
- end
+ bundle! :install, :dir => bundled_app("lol")
expect(bundled_app("vendor", Bundler.ruby_scope, "gems/rack-1.0.0")).to be_directory
expect(the_bundle).to include_gems "rack 1.0.0"
@@ -203,9 +193,7 @@ RSpec.describe "bundle install" do
describe "to a file" do
before do
- in_app_root do
- FileUtils.touch "bundle"
- end
+ FileUtils.touch bundled_app("bundle")
end
it "reports the file exists" do
diff --git a/spec/bundler/lock/lockfile_spec.rb b/spec/bundler/lock/lockfile_spec.rb
index ddab4831a5..c4d06bd96e 100644
--- a/spec/bundler/lock/lockfile_spec.rb
+++ b/spec/bundler/lock/lockfile_spec.rb
@@ -746,8 +746,8 @@ RSpec.describe "the lockfile format" do
actionpack (= 2.3.2)
activerecord (= 2.3.2)
activeresource (= 2.3.2)
- rake (= 12.3.2)
- rake (12.3.2)
+ rake (= 13.0.1)
+ rake (13.0.1)
PLATFORMS
#{lockfile_platforms}
@@ -1209,7 +1209,7 @@ RSpec.describe "the lockfile format" do
gem "rack", "1.1"
G
- expect(bundled_app("Gemfile.lock")).not_to exist
+ expect(bundled_app_lock).not_to exist
expect(err).to include "rack (= 1.0) and rack (= 1.1)"
end
@@ -1220,7 +1220,7 @@ RSpec.describe "the lockfile format" do
gem "rack", :git => "git://hubz.com"
G
- expect(bundled_app("Gemfile.lock")).not_to exist
+ expect(bundled_app_lock).not_to exist
expect(err).to include "rack (>= 0) should come from an unspecified source and git://hubz.com (at master)"
end
@@ -1376,7 +1376,7 @@ RSpec.describe "the lockfile format" do
describe "a line ending" do
def set_lockfile_mtime_to_known_value
time = Time.local(2000, 1, 1, 0, 0, 0)
- File.utime(time, time, bundled_app("Gemfile.lock"))
+ File.utime(time, time, bundled_app_lock)
end
before(:each) do
build_repo2
@@ -1389,7 +1389,7 @@ RSpec.describe "the lockfile format" do
end
it "generates Gemfile.lock with \\n line endings" do
- expect(File.read(bundled_app("Gemfile.lock"))).not_to match("\r\n")
+ expect(File.read(bundled_app_lock)).not_to match("\r\n")
expect(the_bundle).to include_gems "rack 1.0"
end
@@ -1397,19 +1397,21 @@ RSpec.describe "the lockfile format" do
it "preserves Gemfile.lock \\n line endings" do
update_repo2
- expect { bundle "update", :all => true }.to change { File.mtime(bundled_app("Gemfile.lock")) }
- expect(File.read(bundled_app("Gemfile.lock"))).not_to match("\r\n")
+ expect { bundle "update", :all => true }.to change { File.mtime(bundled_app_lock) }
+ expect(File.read(bundled_app_lock)).not_to match("\r\n")
expect(the_bundle).to include_gems "rack 1.2"
end
it "preserves Gemfile.lock \\n\\r line endings" do
+ skip "needs to be adapted" if Gem.win_platform?
+
update_repo2
- win_lock = File.read(bundled_app("Gemfile.lock")).gsub(/\n/, "\r\n")
- File.open(bundled_app("Gemfile.lock"), "wb") {|f| f.puts(win_lock) }
+ win_lock = File.read(bundled_app_lock).gsub(/\n/, "\r\n")
+ File.open(bundled_app_lock, "wb") {|f| f.puts(win_lock) }
set_lockfile_mtime_to_known_value
- expect { bundle "update", :all => true }.to change { File.mtime(bundled_app("Gemfile.lock")) }
- expect(File.read(bundled_app("Gemfile.lock"))).to match("\r\n")
+ expect { bundle "update", :all => true }.to change { File.mtime(bundled_app_lock) }
+ expect(File.read(bundled_app_lock)).to match("\r\n")
expect(the_bundle).to include_gems "rack 1.2"
end
end
@@ -1421,12 +1423,12 @@ RSpec.describe "the lockfile format" do
require 'bundler'
Bundler.setup
RUBY
- end.not_to change { File.mtime(bundled_app("Gemfile.lock")) }
+ end.not_to change { File.mtime(bundled_app_lock) }
end
it "preserves Gemfile.lock \\n\\r line endings" do
- win_lock = File.read(bundled_app("Gemfile.lock")).gsub(/\n/, "\r\n")
- File.open(bundled_app("Gemfile.lock"), "wb") {|f| f.puts(win_lock) }
+ win_lock = File.read(bundled_app_lock).gsub(/\n/, "\r\n")
+ File.open(bundled_app_lock, "wb") {|f| f.puts(win_lock) }
set_lockfile_mtime_to_known_value
expect do
@@ -1434,7 +1436,7 @@ RSpec.describe "the lockfile format" do
require 'bundler'
Bundler.setup
RUBY
- end.not_to change { File.mtime(bundled_app("Gemfile.lock")) }
+ end.not_to change { File.mtime(bundled_app_lock) }
end
end
end
diff --git a/spec/bundler/other/major_deprecation_spec.rb b/spec/bundler/other/major_deprecation_spec.rb
index df2fdd263a..17bf923d84 100644
--- a/spec/bundler/other/major_deprecation_spec.rb
+++ b/spec/bundler/other/major_deprecation_spec.rb
@@ -121,6 +121,28 @@ RSpec.describe "major deprecations" do
pending "should fail with a helpful error", :bundler => "3"
end
+ context "bundle check --path=" do
+ before do
+ install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ gem "rack"
+ G
+
+ bundle "check --path=vendor/bundle"
+ end
+
+ 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 invocations, which bundler will no " \
+ "longer do in future versions. Instead please use `bundle config set " \
+ "path 'vendor/bundle'`, and stop using this flag"
+ )
+ end
+
+ pending "should fail with a helpful error", :bundler => "3"
+ end
+
describe "bundle config" do
describe "old list interface" do
before do
diff --git a/spec/bundler/other/platform_spec.rb b/spec/bundler/other/platform_spec.rb
index 7fb4a7404f..4d5be3f784 100644
--- a/spec/bundler/other/platform_spec.rb
+++ b/spec/bundler/other/platform_spec.rb
@@ -298,20 +298,18 @@ G
#{ruby_version_correct}
G
- expect(bundled_app("Gemfile.lock")).to exist
+ expect(bundled_app_lock).to exist
end
- it "installs fine with any engine" do
- simulate_ruby_engine "jruby" do
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
+ it "installs fine with any engine", :jruby do
+ install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ gem "rack"
- #{ruby_version_correct_engineless}
- G
+ #{ruby_version_correct_engineless}
+ G
- expect(bundled_app("Gemfile.lock")).to exist
- end
+ expect(bundled_app_lock).to exist
end
it "installs fine when the patchlevel matches" do
@@ -322,7 +320,7 @@ G
#{ruby_version_correct_patchlevel}
G
- expect(bundled_app("Gemfile.lock")).to exist
+ expect(bundled_app_lock).to exist
end
it "doesn't install when the ruby version doesn't match" do
@@ -333,7 +331,7 @@ G
#{ruby_version_incorrect}
G
- expect(bundled_app("Gemfile.lock")).not_to exist
+ expect(bundled_app_lock).not_to exist
should_be_ruby_version_incorrect
end
@@ -345,22 +343,20 @@ G
#{engine_incorrect}
G
- expect(bundled_app("Gemfile.lock")).not_to exist
+ expect(bundled_app_lock).not_to exist
should_be_engine_incorrect
end
- it "doesn't install when engine version doesn't match" do
- simulate_ruby_engine "jruby" do
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
+ it "doesn't install when engine version doesn't match", :jruby do
+ install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ gem "rack"
- #{engine_version_incorrect}
- G
+ #{engine_version_incorrect}
+ G
- expect(bundled_app("Gemfile.lock")).not_to exist
- should_be_engine_version_incorrect
- end
+ expect(bundled_app_lock).not_to exist
+ should_be_engine_version_incorrect
end
it "doesn't install when patchlevel doesn't match" do
@@ -371,7 +367,7 @@ G
#{patchlevel_incorrect}
G
- expect(bundled_app("Gemfile.lock")).not_to exist
+ expect(bundled_app_lock).not_to exist
should_be_patchlevel_incorrect
end
end
@@ -392,27 +388,25 @@ G
bundle :check
expect(exitstatus).to eq(0) if exitstatus
- expect(out).to eq("Resolving dependencies...\nThe Gemfile's dependencies are satisfied")
+ expect(out).to match(/\AResolving dependencies\.\.\.\.*\nThe Gemfile's dependencies are satisfied\z/)
end
- it "checks fine with any engine" do
- simulate_ruby_engine "jruby" do
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
- G
+ it "checks fine with any engine", :jruby do
+ install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ gem "rack"
+ G
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
+ gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ gem "rack"
- #{ruby_version_correct_engineless}
- G
+ #{ruby_version_correct_engineless}
+ G
- bundle :check
- expect(exitstatus).to eq(0) if exitstatus
- expect(out).to eq("Resolving dependencies...\nThe Gemfile's dependencies are satisfied")
- end
+ bundle :check
+ expect(exitstatus).to eq(0) if exitstatus
+ expect(out).to match(/\AResolving dependencies\.\.\.\.*\nThe Gemfile's dependencies are satisfied\z/)
end
it "fails when ruby version doesn't match" do
@@ -449,23 +443,21 @@ G
should_be_engine_incorrect
end
- it "fails when engine version doesn't match" do
- simulate_ruby_engine "ruby" do
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
- G
+ it "fails when engine version doesn't match", :jruby do
+ install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ gem "rack"
+ G
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
+ gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ gem "rack"
- #{engine_version_incorrect}
- G
+ #{engine_version_incorrect}
+ G
- bundle :check
- should_be_engine_version_incorrect
- end
+ bundle :check
+ should_be_engine_version_incorrect
end
it "fails when patchlevel doesn't match" do
@@ -513,22 +505,20 @@ G
expect(the_bundle).to include_gems "rack 1.2", "rack-obama 1.0", "activesupport 3.0"
end
- it "updates fine with any engine" do
- simulate_ruby_engine "jruby" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo2)}"
- gem "activesupport"
- gem "rack-obama"
-
- #{ruby_version_correct_engineless}
- G
- update_repo2 do
- build_gem "activesupport", "3.0"
- end
+ it "updates fine with any engine", :jruby do
+ gemfile <<-G
+ source "#{file_uri_for(gem_repo2)}"
+ gem "activesupport"
+ gem "rack-obama"
- bundle "update", :all => true
- expect(the_bundle).to include_gems "rack 1.2", "rack-obama 1.0", "activesupport 3.0"
+ #{ruby_version_correct_engineless}
+ G
+ update_repo2 do
+ build_gem "activesupport", "3.0"
end
+
+ bundle "update", :all => true
+ expect(the_bundle).to include_gems "rack 1.2", "rack-obama 1.0", "activesupport 3.0"
end
it "fails when ruby version doesn't match" do
@@ -547,7 +537,7 @@ G
should_be_ruby_version_incorrect
end
- it "fails when ruby engine doesn't match" do
+ it "fails when ruby engine doesn't match", :jruby do
gemfile <<-G
source "#{file_uri_for(gem_repo2)}"
gem "activesupport"
@@ -563,22 +553,20 @@ G
should_be_engine_incorrect
end
- it "fails when ruby engine version doesn't match" do
- simulate_ruby_engine "jruby" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo2)}"
- gem "activesupport"
- gem "rack-obama"
-
- #{engine_version_incorrect}
- G
- update_repo2 do
- build_gem "activesupport", "3.0"
- end
+ it "fails when ruby engine version doesn't match", :jruby do
+ gemfile <<-G
+ source "#{file_uri_for(gem_repo2)}"
+ gem "activesupport"
+ gem "rack-obama"
- bundle :update, :all => true
- should_be_engine_version_incorrect
+ #{engine_version_incorrect}
+ G
+ update_repo2 do
+ build_gem "activesupport", "3.0"
end
+
+ bundle :update, :all => true
+ should_be_engine_version_incorrect
end
it "fails when patchlevel doesn't match" do
@@ -617,18 +605,16 @@ G
expect(out).to eq(default_bundle_path("gems", "rails-2.3.2").to_s)
end
- it "prints path if ruby version is correct for any engine" do
- simulate_ruby_engine "jruby" do
- install_gemfile! <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rails"
+ it "prints path if ruby version is correct for any engine", :jruby do
+ install_gemfile! <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ gem "rails"
- #{ruby_version_correct_engineless}
- G
+ #{ruby_version_correct_engineless}
+ G
- bundle "info rails --path"
- expect(out).to eq(default_bundle_path("gems", "rails-2.3.2").to_s)
- end
+ bundle "info rails --path"
+ expect(out).to eq(default_bundle_path("gems", "rails-2.3.2").to_s)
end
it "fails if ruby version doesn't match", :bundler => "< 3" do
@@ -655,18 +641,16 @@ G
should_be_engine_incorrect
end
- it "fails if engine version doesn't match", :bundler => "< 3" do
- simulate_ruby_engine "jruby" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rails"
+ it "fails if engine version doesn't match", :bundler => "< 3", :jruby => true do
+ gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ gem "rails"
- #{engine_version_incorrect}
- G
+ #{engine_version_incorrect}
+ G
- bundle "show rails"
- should_be_engine_version_incorrect
- end
+ bundle "show rails"
+ should_be_engine_version_incorrect
end
it "fails when patchlevel doesn't match", :bundler => "< 3" do
@@ -704,18 +688,16 @@ G
expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
end
- it "copies the .gem file to vendor/cache when ruby version matches for any engine" do
- simulate_ruby_engine "jruby" do
- install_gemfile! <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem 'rack'
+ it "copies the .gem file to vendor/cache when ruby version matches for any engine", :jruby do
+ install_gemfile! <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ gem 'rack'
- #{ruby_version_correct_engineless}
- G
+ #{ruby_version_correct_engineless}
+ G
- bundle! :cache
- expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
- end
+ bundle! :cache
+ expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
end
it "fails if the ruby version doesn't match" do
@@ -740,17 +722,15 @@ G
should_be_engine_incorrect
end
- it "fails if the engine version doesn't match" do
- simulate_ruby_engine "jruby" do
- gemfile <<-G
- gem 'rack'
+ it "fails if the engine version doesn't match", :jruby do
+ gemfile <<-G
+ gem 'rack'
- #{engine_version_incorrect}
- G
+ #{engine_version_incorrect}
+ G
- bundle :cache
- should_be_engine_version_incorrect
- end
+ bundle :cache
+ should_be_engine_version_incorrect
end
it "fails when patchlevel doesn't match" do
@@ -785,18 +765,16 @@ G
expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
end
- it "copies the .gem file to vendor/cache when ruby version matches any engine" do
- simulate_ruby_engine "jruby" do
- install_gemfile! <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem 'rack'
+ it "copies the .gem file to vendor/cache when ruby version matches any engine", :jruby do
+ install_gemfile! <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ gem 'rack'
- #{ruby_version_correct_engineless}
- G
+ #{ruby_version_correct_engineless}
+ G
- bundle :cache
- expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
- end
+ bundle :cache
+ expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
end
it "fails if the ruby version doesn't match" do
@@ -821,17 +799,15 @@ G
should_be_engine_incorrect
end
- it "fails if the engine version doesn't match" do
- simulate_ruby_engine "jruby" do
- gemfile <<-G
- gem 'rack'
+ it "fails if the engine version doesn't match", :jruby do
+ gemfile <<-G
+ gem 'rack'
- #{engine_version_incorrect}
- G
+ #{engine_version_incorrect}
+ G
- bundle :cache
- should_be_engine_version_incorrect
- end
+ bundle :cache
+ should_be_engine_version_incorrect
end
it "fails when patchlevel doesn't match" do
@@ -850,7 +826,7 @@ G
context "bundle exec" do
before do
ENV["BUNDLER_FORCE_TTY"] = "true"
- system_gems "rack-1.0.0", "rack-0.9.1", :path => :bundle_path
+ system_gems "rack-1.0.0", "rack-0.9.1", :path => default_bundle_path
end
it "activates the correct gem when ruby version matches" do
@@ -864,18 +840,16 @@ G
expect(out).to include("0.9.1")
end
- it "activates the correct gem when ruby version matches any engine" do
- simulate_ruby_engine "jruby" do
- system_gems "rack-1.0.0", "rack-0.9.1", :path => :bundle_path
- gemfile <<-G
- gem "rack", "0.9.1"
+ it "activates the correct gem when ruby version matches any engine", :jruby do
+ system_gems "rack-1.0.0", "rack-0.9.1", :path => default_bundle_path
+ gemfile <<-G
+ gem "rack", "0.9.1"
- #{ruby_version_correct_engineless}
- G
+ #{ruby_version_correct_engineless}
+ G
- bundle "exec rackup"
- expect(out).to include("0.9.1")
- end
+ bundle "exec rackup"
+ expect(out).to include("0.9.1")
end
it "fails when the ruby version doesn't match" do
@@ -900,17 +874,15 @@ G
should_be_engine_incorrect
end
- # it "fails when the engine version doesn't match" do
- # simulate_ruby_engine "jruby" do
- # gemfile <<-G
- # gem "rack", "0.9.1"
+ # it "fails when the engine version doesn't match", :jruby do
+ # gemfile <<-G
+ # gem "rack", "0.9.1"
#
- # #{engine_version_incorrect}
- # G
+ # #{engine_version_incorrect}
+ # G
#
- # bundle "exec rackup"
- # should_be_engine_version_incorrect
- # end
+ # bundle "exec rackup"
+ # should_be_engine_version_incorrect
# end
it "fails when patchlevel doesn't match" do
@@ -936,7 +908,7 @@ G
G
end
- it "starts IRB with the default group loaded when ruby version matches" do
+ it "starts IRB with the default group loaded when ruby version matches", :readline do
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem "rack"
@@ -953,24 +925,21 @@ G
expect(out).to include("0.9.1")
end
- it "starts IRB with the default group loaded when ruby version matches any engine" do
- skip "MRI cannot simulate JRuby" if RUBY_ENGINE == "ruby"
- simulate_ruby_engine "jruby" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
- gem "activesupport", :group => :test
- gem "rack_middleware", :group => :development
+ it "starts IRB with the default group loaded when ruby version matches", :readline, :jruby do
+ gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ gem "rack"
+ gem "activesupport", :group => :test
+ gem "rack_middleware", :group => :development
- #{ruby_version_correct_engineless}
- G
+ #{ruby_version_correct_engineless}
+ G
- bundle "console" do |input, _, _|
- input.puts("puts RACK")
- input.puts("exit")
- end
- expect(out).to include("0.9.1")
+ bundle "console" do |input, _, _|
+ input.puts("puts RACK")
+ input.puts("exit")
end
+ expect(out).to include("0.9.1")
end
it "fails when ruby version doesn't match" do
@@ -1001,20 +970,18 @@ G
should_be_engine_incorrect
end
- it "fails when engine version doesn't match" do
- simulate_ruby_engine "jruby" do
- gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
- gem "activesupport", :group => :test
- gem "rack_middleware", :group => :development
+ it "fails when engine version doesn't match", :jruby do
+ gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ gem "rack"
+ gem "activesupport", :group => :test
+ gem "rack_middleware", :group => :development
- #{engine_version_incorrect}
- G
+ #{engine_version_incorrect}
+ G
- bundle "console"
- should_be_engine_version_incorrect
- end
+ bundle "console"
+ should_be_engine_version_incorrect
end
it "fails when patchlevel doesn't match" do
@@ -1052,27 +1019,25 @@ G
#{ruby_version_correct}
G
- FileUtils.rm(bundled_app("Gemfile.lock"))
+ FileUtils.rm(bundled_app_lock)
run "1"
- expect(bundled_app("Gemfile.lock")).to exist
+ expect(bundled_app_lock).to exist
end
- it "makes a Gemfile.lock if setup succeeds for any engine" do
- simulate_ruby_engine "jruby" do
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "yard"
- gem "rack"
+ it "makes a Gemfile.lock if setup succeeds for any engine", :jruby do
+ install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ gem "yard"
+ gem "rack"
- #{ruby_version_correct_engineless}
- G
+ #{ruby_version_correct_engineless}
+ G
- FileUtils.rm(bundled_app("Gemfile.lock"))
+ FileUtils.rm(bundled_app_lock)
- run "1"
- expect(bundled_app("Gemfile.lock")).to exist
- end
+ run "1"
+ expect(bundled_app_lock).to exist
end
it "fails when ruby version doesn't match" do
@@ -1084,13 +1049,11 @@ G
#{ruby_version_incorrect}
G
- FileUtils.rm(bundled_app("Gemfile.lock"))
+ FileUtils.rm(bundled_app_lock)
- ruby <<-R
- require 'bundler/setup'
- R
+ ruby "require 'bundler/setup'"
- expect(bundled_app("Gemfile.lock")).not_to exist
+ expect(bundled_app_lock).not_to exist
should_be_ruby_version_incorrect
end
@@ -1103,35 +1066,29 @@ G
#{engine_incorrect}
G
- FileUtils.rm(bundled_app("Gemfile.lock"))
+ FileUtils.rm(bundled_app_lock)
- ruby <<-R
- require 'bundler/setup'
- R
+ ruby "require 'bundler/setup'"
- expect(bundled_app("Gemfile.lock")).not_to exist
+ expect(bundled_app_lock).not_to exist
should_be_engine_incorrect
end
- it "fails when engine version doesn't match" do
- simulate_ruby_engine "jruby" do
- install_gemfile <<-G
- source "#{file_uri_for(gem_repo1)}"
- gem "yard"
- gem "rack"
+ it "fails when engine version doesn't match", :jruby do
+ install_gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ gem "yard"
+ gem "rack"
- #{engine_version_incorrect}
- G
+ #{engine_version_incorrect}
+ G
- FileUtils.rm(bundled_app("Gemfile.lock"))
+ FileUtils.rm(bundled_app_lock)
- ruby <<-R
- require 'bundler/setup'
- R
+ ruby "require 'bundler/setup'"
- expect(bundled_app("Gemfile.lock")).not_to exist
- should_be_engine_version_incorrect
- end
+ expect(bundled_app_lock).not_to exist
+ should_be_engine_version_incorrect
end
it "fails when patchlevel doesn't match" do
@@ -1143,13 +1100,11 @@ G
#{patchlevel_incorrect}
G
- FileUtils.rm(bundled_app("Gemfile.lock"))
+ FileUtils.rm(bundled_app_lock)
- ruby <<-R
- require 'bundler/setup'
- R
+ ruby "require 'bundler/setup'"
- expect(bundled_app("Gemfile.lock")).not_to exist
+ expect(bundled_app_lock).not_to exist
should_be_patchlevel_incorrect
end
end
@@ -1182,30 +1137,40 @@ G
G
bundle "outdated"
- expect(out).to include("activesupport (newest 3.0, installed 2.3.5, requested = 2.3.5")
- expect(out).to include("foo (newest 1.0")
+
+ expected_output = <<~TABLE.gsub("x", "\\\h").tr(".", "\.").strip
+ Gem Current Latest Requested Groups
+ activesupport 2.3.5 3.0 = 2.3.5 default
+ foo 1.0 xxxxxxx 1.0 xxxxxxx >= 0 default
+ TABLE
+
+ expect(out).to match(Regexp.new(expected_output))
end
- it "returns list of outdated gems when the ruby version matches for any engine" do
- simulate_ruby_engine "jruby" do
- bundle! :install
- update_repo2 do
- build_gem "activesupport", "3.0"
- update_git "foo", :path => lib_path("foo")
- end
+ it "returns list of outdated gems when the ruby version matches for any engine", :jruby do
+ bundle! :install
+ update_repo2 do
+ build_gem "activesupport", "3.0"
+ update_git "foo", :path => lib_path("foo")
+ end
- gemfile <<-G
- source "#{file_uri_for(gem_repo2)}"
- gem "activesupport", "2.3.5"
- gem "foo", :git => "#{lib_path("foo")}"
+ gemfile <<-G
+ source "#{file_uri_for(gem_repo2)}"
+ gem "activesupport", "2.3.5"
+ gem "foo", :git => "#{lib_path("foo")}"
- #{ruby_version_correct_engineless}
- G
+ #{ruby_version_correct_engineless}
+ G
- bundle "outdated"
- expect(out).to include("activesupport (newest 3.0, installed 2.3.5, requested = 2.3.5)")
- expect(out).to include("foo (newest 1.0")
- end
+ bundle "outdated"
+
+ expected_output = <<~TABLE.gsub("x", "\\\h").tr(".", "\.").strip
+ Gem Current Latest Requested Groups
+ activesupport 2.3.5 3.0 = 2.3.5 default
+ foo 1.0 xxxxxxx 1.0 xxxxxxx >= 0 default
+ TABLE
+
+ expect(out).to match(Regexp.new(expected_output))
end
it "fails when the ruby version doesn't match" do
@@ -1244,64 +1209,58 @@ G
should_be_engine_incorrect
end
- it "fails when the engine version doesn't match" do
- simulate_ruby_engine "jruby" do
- update_repo2 do
- build_gem "activesupport", "3.0"
- update_git "foo", :path => lib_path("foo")
- end
+ it "fails when the engine version doesn't match", :jruby do
+ update_repo2 do
+ build_gem "activesupport", "3.0"
+ update_git "foo", :path => lib_path("foo")
+ end
- gemfile <<-G
- source "#{file_uri_for(gem_repo2)}"
- gem "activesupport", "2.3.5"
- gem "foo", :git => "#{lib_path("foo")}"
+ gemfile <<-G
+ source "#{file_uri_for(gem_repo2)}"
+ gem "activesupport", "2.3.5"
+ gem "foo", :git => "#{lib_path("foo")}"
- #{engine_version_incorrect}
- G
+ #{engine_version_incorrect}
+ G
- bundle "outdated"
- should_be_engine_version_incorrect
- end
+ bundle "outdated"
+ should_be_engine_version_incorrect
end
- it "fails when the patchlevel doesn't match" do
- simulate_ruby_engine "jruby" do
- update_repo2 do
- build_gem "activesupport", "3.0"
- update_git "foo", :path => lib_path("foo")
- end
+ it "fails when the patchlevel doesn't match", :jruby do
+ update_repo2 do
+ build_gem "activesupport", "3.0"
+ update_git "foo", :path => lib_path("foo")
+ end
- gemfile <<-G
- source "#{file_uri_for(gem_repo2)}"
- gem "activesupport", "2.3.5"
- gem "foo", :git => "#{lib_path("foo")}"
+ gemfile <<-G
+ source "#{file_uri_for(gem_repo2)}"
+ gem "activesupport", "2.3.5"
+ gem "foo", :git => "#{lib_path("foo")}"
- #{patchlevel_incorrect}
- G
+ #{patchlevel_incorrect}
+ G
- bundle "outdated"
- should_be_patchlevel_incorrect
- end
+ bundle "outdated"
+ should_be_patchlevel_incorrect
end
- it "fails when the patchlevel is a fixnum" do
- simulate_ruby_engine "jruby" do
- update_repo2 do
- build_gem "activesupport", "3.0"
- update_git "foo", :path => lib_path("foo")
- end
+ it "fails when the patchlevel is a fixnum", :jruby do
+ update_repo2 do
+ build_gem "activesupport", "3.0"
+ update_git "foo", :path => lib_path("foo")
+ end
- gemfile <<-G
- source "#{file_uri_for(gem_repo2)}"
- gem "activesupport", "2.3.5"
- gem "foo", :git => "#{lib_path("foo")}"
+ gemfile <<-G
+ source "#{file_uri_for(gem_repo2)}"
+ gem "activesupport", "2.3.5"
+ gem "foo", :git => "#{lib_path("foo")}"
- #{patchlevel_fixnum}
- G
+ #{patchlevel_fixnum}
+ G
- bundle "outdated"
- should_be_patchlevel_fixnum
- end
+ bundle "outdated"
+ should_be_patchlevel_fixnum
end
end
end
diff --git a/spec/bundler/plugins/install_spec.rb b/spec/bundler/plugins/install_spec.rb
index 669ed09fb5..663363ca21 100644
--- a/spec/bundler/plugins/install_spec.rb
+++ b/spec/bundler/plugins/install_spec.rb
@@ -155,6 +155,10 @@ RSpec.describe "bundler plugin install" do
end
context "Gemfile eval" do
+ before do
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
+ end
+
it "installs plugins listed in gemfile" do
gemfile <<-G
source '#{file_uri_for(gem_repo2)}'
@@ -245,6 +249,7 @@ RSpec.describe "bundler plugin install" do
describe "local plugin" do
it "is installed when inside an app" do
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
gemfile ""
bundle "plugin install foo --source #{file_uri_for(gem_repo2)}"
@@ -287,21 +292,16 @@ RSpec.describe "bundler plugin install" do
end
# outside the app
- Dir.chdir tmp
- bundle "plugin install fubar --source #{file_uri_for(gem_repo2)}"
+ bundle "plugin install fubar --source #{file_uri_for(gem_repo2)}", :dir => tmp
end
it "inside the app takes precedence over global plugin" do
- Dir.chdir bundled_app
-
bundle "shout"
expect(out).to eq("local_one")
end
it "outside the app global plugin is used" do
- Dir.chdir tmp
-
- bundle "shout"
+ bundle "shout", :dir => tmp
expect(out).to eq("global_one")
end
end
diff --git a/spec/bundler/plugins/source/example_spec.rb b/spec/bundler/plugins/source/example_spec.rb
index f2151a5a73..aac506dc9a 100644
--- a/spec/bundler/plugins/source/example_spec.rb
+++ b/spec/bundler/plugins/source/example_spec.rb
@@ -215,6 +215,8 @@ RSpec.describe "real source plugins" do
build_repo2 do
build_plugin "bundler-source-gitp" do |s|
s.write "plugins.rb", <<-RUBY
+ require "open3"
+
class SPlugin < Bundler::Plugin::API
source "gitp"
@@ -254,9 +256,7 @@ RSpec.describe "real source plugins" do
mkdir_p(install_path.dirname)
rm_rf(install_path)
`git clone --no-checkout --quiet "\#{cache_path}" "\#{install_path}"`
- Dir.chdir install_path do
- `git reset --hard \#{revision}`
- end
+ Open3.capture2e("git reset --hard \#{revision}", :chdir => install_path)
spec_path = install_path.join("\#{spec.full_name}.gemspec")
spec_path.open("wb") {|f| f.write spec.to_ruby }
@@ -310,9 +310,8 @@ RSpec.describe "real source plugins" do
cache_repo
end
- Dir.chdir cache_path do
- `git rev-parse --verify \#{@ref}`.strip
- end
+ output, _status = Open3.capture2e("git rev-parse --verify \#{@ref}", :chdir => cache_path)
+ output.strip
end
def base_name
diff --git a/spec/bundler/plugins/source_spec.rb b/spec/bundler/plugins/source_spec.rb
index c8deee96b1..14643e5c81 100644
--- a/spec/bundler/plugins/source_spec.rb
+++ b/spec/bundler/plugins/source_spec.rb
@@ -21,6 +21,7 @@ RSpec.describe "bundler source plugin" do
end
G
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
plugin_should_be_installed("bundler-source-psource")
end
@@ -75,6 +76,7 @@ RSpec.describe "bundler source plugin" do
end
it "installs the explicit one" do
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
plugin_should_be_installed("another-psource")
end
@@ -100,6 +102,7 @@ RSpec.describe "bundler source plugin" do
end
it "installs the default one" do
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
plugin_should_be_installed("bundler-source-psource")
end
end
diff --git a/spec/bundler/plugins/uninstall_spec.rb b/spec/bundler/plugins/uninstall_spec.rb
new file mode 100644
index 0000000000..8180241911
--- /dev/null
+++ b/spec/bundler/plugins/uninstall_spec.rb
@@ -0,0 +1,49 @@
+# frozen_string_literal: true
+
+RSpec.describe "bundler plugin uninstall" do
+ before do
+ build_repo2 do
+ build_plugin "foo"
+ build_plugin "kung-foo"
+ end
+ end
+
+ it "shows proper error message when plugins are not specified" do
+ bundle "plugin uninstall"
+ expect(err).to include("No plugins to uninstall")
+ end
+
+ it "uninstalls specified plugins" do
+ bundle "plugin install foo kung-foo --source #{file_uri_for(gem_repo2)}"
+ plugin_should_be_installed("foo")
+ plugin_should_be_installed("kung-foo")
+
+ bundle "plugin uninstall foo"
+ expect(out).to include("Uninstalled plugin foo")
+ plugin_should_not_be_installed("foo")
+ plugin_should_be_installed("kung-foo")
+ end
+
+ it "shows proper message when plugin is not installed" do
+ bundle "plugin uninstall foo"
+ expect(err).to include("Plugin foo is not installed")
+ plugin_should_not_be_installed("foo")
+ end
+
+ describe "with --all" do
+ it "uninstalls all installed plugins" do
+ bundle "plugin install foo kung-foo --source #{file_uri_for(gem_repo2)}"
+ plugin_should_be_installed("foo")
+ plugin_should_be_installed("kung-foo")
+
+ bundle "plugin uninstall --all"
+ plugin_should_not_be_installed("foo")
+ plugin_should_not_be_installed("kung-foo")
+ end
+
+ it "shows proper no plugins installed message when no plugins installed" do
+ bundle "plugin uninstall --all"
+ expect(out).to include("No plugins installed")
+ end
+ end
+end
diff --git a/spec/bundler/quality_es_spec.rb b/spec/bundler/quality_es_spec.rb
index 4238ac7452..90968e6270 100644
--- a/spec/bundler/quality_es_spec.rb
+++ b/spec/bundler/quality_es_spec.rb
@@ -40,12 +40,10 @@ RSpec.describe "La biblioteca si misma" do
it "mantiene la calidad de lenguaje de la documentación" do
included = /ronn/
error_messages = []
- Dir.chdir(root) do
- `git ls-files -z -- man`.split("\x0").each do |filename|
- next unless filename =~ included
- error_messages << check_for_expendable_words(filename)
- error_messages << check_for_specific_pronouns(filename)
- end
+ man_tracked_files.each do |filename|
+ next unless filename =~ included
+ error_messages << check_for_expendable_words(filename)
+ error_messages << check_for_specific_pronouns(filename)
end
expect(error_messages.compact).to be_well_formed
end
@@ -53,12 +51,10 @@ RSpec.describe "La biblioteca si misma" do
it "mantiene la calidad de lenguaje de oraciones usadas en el código fuente" do
error_messages = []
exempt = /vendor/
- Dir.chdir(root) do
- lib_tracked_files.split("\x0").each do |filename|
- next if filename =~ exempt
- error_messages << check_for_expendable_words(filename)
- error_messages << check_for_specific_pronouns(filename)
- end
+ lib_tracked_files.each do |filename|
+ next if filename =~ exempt
+ error_messages << check_for_expendable_words(filename)
+ error_messages << check_for_specific_pronouns(filename)
end
expect(error_messages.compact).to be_well_formed
end
diff --git a/spec/bundler/quality_spec.rb b/spec/bundler/quality_spec.rb
index 09e59d88ae..177eb505a1 100644
--- a/spec/bundler/quality_spec.rb
+++ b/spec/bundler/quality_spec.rb
@@ -107,12 +107,10 @@ RSpec.describe "The library itself" do
it "has no malformed whitespace" do
exempt = /\.gitmodules|fixtures|vendor|LICENSE|vcr_cassettes|rbreadline\.diff|\.txt$/
error_messages = []
- Dir.chdir(root) do
- tracked_files.split("\x0").each do |filename|
- next if filename =~ exempt
- error_messages << check_for_tab_characters(filename)
- error_messages << check_for_extra_spaces(filename)
- end
+ tracked_files.each do |filename|
+ next if filename =~ exempt
+ error_messages << check_for_tab_characters(filename)
+ error_messages << check_for_extra_spaces(filename)
end
expect(error_messages.compact).to be_well_formed
end
@@ -120,11 +118,9 @@ RSpec.describe "The library itself" do
it "has no estraneous quotes" do
exempt = /vendor|vcr_cassettes|LICENSE|rbreadline\.diff/
error_messages = []
- Dir.chdir(root) do
- tracked_files.split("\x0").each do |filename|
- next if filename =~ exempt
- error_messages << check_for_straneous_quotes(filename)
- end
+ tracked_files.each do |filename|
+ next if filename =~ exempt
+ error_messages << check_for_straneous_quotes(filename)
end
expect(error_messages.compact).to be_well_formed
end
@@ -132,11 +128,9 @@ RSpec.describe "The library itself" do
it "does not include any leftover debugging or development mechanisms" do
exempt = %r{quality_spec.rb|support/helpers|vcr_cassettes|\.md|\.ronn|\.txt|\.5|\.1}
error_messages = []
- Dir.chdir(root) do
- tracked_files.split("\x0").each do |filename|
- next if filename =~ exempt
- error_messages << check_for_debugging_mechanisms(filename)
- end
+ tracked_files.each do |filename|
+ next if filename =~ exempt
+ error_messages << check_for_debugging_mechanisms(filename)
end
expect(error_messages.compact).to be_well_formed
end
@@ -144,11 +138,9 @@ RSpec.describe "The library itself" do
it "does not include any unresolved merge conflicts" do
error_messages = []
exempt = %r{lock/lockfile_spec|quality_spec|vcr_cassettes|\.ronn|lockfile_parser\.rb}
- Dir.chdir(root) do
- tracked_files.split("\x0").each do |filename|
- next if filename =~ exempt
- error_messages << check_for_git_merge_conflicts(filename)
- end
+ tracked_files.each do |filename|
+ next if filename =~ exempt
+ error_messages << check_for_git_merge_conflicts(filename)
end
expect(error_messages.compact).to be_well_formed
end
@@ -156,32 +148,27 @@ RSpec.describe "The library itself" do
it "maintains language quality of the documentation" do
included = /ronn/
error_messages = []
- Dir.chdir(root) do
- `git ls-files -z -- man`.split("\x0").each do |filename|
- next unless filename =~ included
- error_messages << check_for_expendable_words(filename)
- error_messages << check_for_specific_pronouns(filename)
- end
+ man_tracked_files.each do |filename|
+ next unless filename =~ included
+ error_messages << check_for_expendable_words(filename)
+ error_messages << check_for_specific_pronouns(filename)
end
expect(error_messages.compact).to be_well_formed
end
it "maintains language quality of sentences used in source code" do
error_messages = []
- exempt = /vendor|vcr_cassettes/
- Dir.chdir(root) do
- lib_tracked_files.split("\x0").each do |filename|
- next if filename =~ exempt
- error_messages << check_for_expendable_words(filename)
- error_messages << check_for_specific_pronouns(filename)
- end
+ exempt = /vendor|vcr_cassettes|CODE_OF_CONDUCT/
+ lib_tracked_files.each do |filename|
+ next if filename =~ exempt
+ error_messages << check_for_expendable_words(filename)
+ error_messages << check_for_specific_pronouns(filename)
end
expect(error_messages.compact).to be_well_formed
end
it "documents all used settings" do
exemptions = %w[
- auto_config_jobs
deployment_means_frozen
forget_cli_options
gem.coc
@@ -197,15 +184,13 @@ RSpec.describe "The library itself" do
Bundler::Settings::NUMBER_KEYS.each {|k| all_settings[k] << "in Bundler::Settings::NUMBER_KEYS" }
Bundler::Settings::ARRAY_KEYS.each {|k| all_settings[k] << "in Bundler::Settings::ARRAY_KEYS" }
- Dir.chdir(root) do
- key_pattern = /([a-z\._-]+)/i
- lib_tracked_files.split("\x0").each do |filename|
- each_line(filename) do |line, number|
- line.scan(/Bundler\.settings\[:#{key_pattern}\]/).flatten.each {|s| all_settings[s] << "referenced at `#{filename}:#{number.succ}`" }
- end
+ key_pattern = /([a-z\._-]+)/i
+ lib_tracked_files.each do |filename|
+ each_line(filename) do |line, number|
+ line.scan(/Bundler\.settings\[:#{key_pattern}\]/).flatten.each {|s| all_settings[s] << "referenced at `#{filename}:#{number.succ}`" }
end
- documented_settings = File.read("man/bundle-config.ronn")[/LIST OF AVAILABLE KEYS.*/m].scan(/^\* `#{key_pattern}`/).flatten
end
+ documented_settings = File.read("man/bundle-config.ronn")[/LIST OF AVAILABLE KEYS.*/m].scan(/^\* `#{key_pattern}`/).flatten
documented_settings.each do |s|
all_settings.delete(s)
@@ -231,54 +216,48 @@ RSpec.describe "The library itself" do
end
it "ships the correct set of files" do
- Dir.chdir(root) do
- git_list = shipped_files.split("\x0")
+ git_list = shipped_files
- gem_list = Gem::Specification.load(gemspec.to_s).files
+ gem_list = Gem::Specification.load(gemspec.to_s).files
- expect(git_list.to_set).to eq(gem_list.to_set)
- end
+ expect(git_list.to_set).to eq(gem_list.to_set)
end
it "does not contain any warnings" do
- Dir.chdir(root) do
- exclusions = %w[
- lib/bundler/capistrano.rb
- lib/bundler/deployment.rb
- lib/bundler/gem_tasks.rb
- lib/bundler/vlad.rb
- lib/bundler/templates/gems.rb
- ]
- files_to_require = lib_tracked_files.split("\x0").grep(/\.rb$/) - exclusions
- files_to_require.reject! {|f| f.start_with?("lib/bundler/vendor") }
- files_to_require.map! {|f| f.chomp(".rb") }
- sys_exec!("ruby -w -Ilib") do |input, _, _|
- files_to_require.each do |f|
- input.puts "require '#{f.sub(%r{\Alib/}, "")}'"
- end
+ exclusions = %w[
+ lib/bundler/capistrano.rb
+ lib/bundler/deployment.rb
+ lib/bundler/gem_tasks.rb
+ lib/bundler/vlad.rb
+ lib/bundler/templates/gems.rb
+ ]
+ files_to_require = lib_tracked_files.grep(/\.rb$/) - exclusions
+ files_to_require.reject! {|f| f.start_with?("lib/bundler/vendor") }
+ files_to_require.map! {|f| File.expand_path("../#{f}", __dir__) }
+ sys_exec!("ruby -w") do |input, _, _|
+ files_to_require.each do |f|
+ input.puts "require '#{f}'"
end
+ end
- warnings = last_command.stdboth.split("\n")
- # ignore warnings around deprecated Object#=~ method in RubyGems
- warnings.reject! {|w| w =~ %r{rubygems\/version.rb.*deprecated\ Object#=~} }
+ warnings = last_command.stdboth.split("\n")
+ # ignore warnings around deprecated Object#=~ method in RubyGems
+ warnings.reject! {|w| w =~ %r{rubygems\/version.rb.*deprecated\ Object#=~} }
- expect(warnings).to be_well_formed
- end
+ expect(warnings).to be_well_formed
end
it "does not use require internally, but require_relative" do
- Dir.chdir(root) do
- exempt = %r{templates/|vendor/}
- all_bad_requires = []
- lib_tracked_files.split("\x0").each do |filename|
- next if filename =~ exempt
- each_line(filename) do |line, number|
- line.scan(/^ *require "bundler/).each { all_bad_requires << "#{filename}:#{number.succ}" }
- end
+ exempt = %r{templates/|vendor/}
+ all_bad_requires = []
+ lib_tracked_files.each do |filename|
+ next if filename =~ exempt
+ each_line(filename) do |line, number|
+ line.scan(/^ *require "bundler/).each { all_bad_requires << "#{filename}:#{number.succ}" }
end
-
- expect(all_bad_requires).to be_empty, "#{all_bad_requires.size} internal requires that should use `require_relative`: #{all_bad_requires}"
end
+
+ expect(all_bad_requires).to be_empty, "#{all_bad_requires.size} internal requires that should use `require_relative`: #{all_bad_requires}"
end
private
diff --git a/spec/bundler/realworld/edgecases_spec.rb b/spec/bundler/realworld/edgecases_spec.rb
index a91e6a359e..48c37093b5 100644
--- a/spec/bundler/realworld/edgecases_spec.rb
+++ b/spec/bundler/realworld/edgecases_spec.rb
@@ -62,7 +62,7 @@ RSpec.describe "real world edgecases", :realworld => true, :sometimes => true do
end
it "is able to update a top-level dependency when there is a conflict on a shared transitive child" do
- # from https://github.com/bundler/bundler/issues/5031
+ # from https://github.com/rubygems/bundler/issues/5031
gemfile <<-G
source "https://rubygems.org"
@@ -194,7 +194,7 @@ RSpec.describe "real world edgecases", :realworld => true, :sometimes => true do
expect(lockfile).to include(rubygems_version("paperclip", "~> 5.1.0"))
end
- # https://github.com/bundler/bundler/issues/1500
+ # https://github.com/rubygems/bundler/issues/1500
it "does not fail install because of gem plugins" do
realworld_system_gems("open_gem --version 1.4.2", "rake --version 0.9.2")
gemfile <<-G
diff --git a/spec/bundler/realworld/fixtures/warbler/.gitignore b/spec/bundler/realworld/fixtures/warbler/.gitignore
new file mode 100644
index 0000000000..d392f0e82c
--- /dev/null
+++ b/spec/bundler/realworld/fixtures/warbler/.gitignore
@@ -0,0 +1 @@
+*.jar
diff --git a/spec/bundler/realworld/fixtures/warbler/Gemfile b/spec/bundler/realworld/fixtures/warbler/Gemfile
new file mode 100644
index 0000000000..4fbf2d05a7
--- /dev/null
+++ b/spec/bundler/realworld/fixtures/warbler/Gemfile
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+source "https://rubygems.org"
+
+gem "demo", :path => "./demo"
+gem "jruby-jars", "~> 9.2"
+gem "warbler", "~> 2.0"
diff --git a/spec/bundler/realworld/fixtures/warbler/Gemfile.lock b/spec/bundler/realworld/fixtures/warbler/Gemfile.lock
new file mode 100644
index 0000000000..6363b8bbd8
--- /dev/null
+++ b/spec/bundler/realworld/fixtures/warbler/Gemfile.lock
@@ -0,0 +1,29 @@
+PATH
+ remote: demo
+ specs:
+ demo (1.0)
+
+GEM
+ remote: https://rubygems.org/
+ specs:
+ jruby-jars (9.2.9.0)
+ jruby-rack (1.1.21)
+ rake (13.0.1)
+ rubyzip (1.3.0)
+ warbler (2.0.5)
+ jruby-jars (>= 9.0.0.0)
+ jruby-rack (>= 1.1.1, < 1.3)
+ rake (>= 10.1.0)
+ rubyzip (~> 1.0, < 1.4)
+
+PLATFORMS
+ java
+ ruby
+
+DEPENDENCIES
+ demo!
+ jruby-jars (~> 9.2)
+ warbler (~> 2.0)
+
+BUNDLED WITH
+ 2.2.0.dev
diff --git a/spec/bundler/realworld/fixtures/warbler/bin/warbler-example.rb b/spec/bundler/realworld/fixtures/warbler/bin/warbler-example.rb
new file mode 100644
index 0000000000..25f614ecc2
--- /dev/null
+++ b/spec/bundler/realworld/fixtures/warbler/bin/warbler-example.rb
@@ -0,0 +1,3 @@
+# frozen_string_literal: true
+
+puts require "bundler/setup"
diff --git a/spec/bundler/realworld/fixtures/warbler/demo/demo.gemspec b/spec/bundler/realworld/fixtures/warbler/demo/demo.gemspec
new file mode 100644
index 0000000000..ed5a0dc080
--- /dev/null
+++ b/spec/bundler/realworld/fixtures/warbler/demo/demo.gemspec
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+
+Gem::Specification.new do |spec|
+ spec.name = "demo"
+ spec.version = "1.0"
+ spec.author = "Somebody"
+ spec.summary = "A demo gem"
+ spec.license = "MIT"
+ spec.homepage = "https://example.org"
+end
diff --git a/spec/bundler/resolver/platform_spec.rb b/spec/bundler/resolver/platform_spec.rb
index fee0cf1f1c..415c5458df 100644
--- a/spec/bundler/resolver/platform_spec.rb
+++ b/spec/bundler/resolver/platform_spec.rb
@@ -28,6 +28,98 @@ RSpec.describe "Resolving platform craziness" do
end
end
+ it "takes the latest ruby gem, even if an older platform specific version is available" do
+ @index = build_index do
+ gem "foo", "1.0.0"
+ gem "foo", "1.0.0", "x64-mingw32"
+ gem "foo", "1.1.0"
+ end
+ dep "foo"
+ platforms "x64-mingw32"
+
+ should_resolve_as %w[foo-1.1.0]
+ end
+
+ it "takes the ruby version if the platform version is incompatible" do
+ @index = build_index do
+ gem "bar", "1.0.0"
+ gem "foo", "1.0.0"
+ gem "foo", "1.0.0", "x64-mingw32" do
+ dep "bar", "< 1"
+ end
+ end
+ dep "foo"
+ platforms "x64-mingw32"
+
+ should_resolve_as %w[foo-1.0.0]
+ end
+
+ it "prefers the platform specific gem to the ruby version" do
+ @index = build_index do
+ gem "foo", "1.0.0"
+ gem "foo", "1.0.0", "x64-mingw32"
+ end
+ dep "foo"
+ platforms "x64-mingw32"
+
+ should_resolve_as %w[foo-1.0.0-x64-mingw32]
+ end
+
+ it "takes the latest ruby gem if the platform specific gem doesn't match the required_ruby_version" do
+ @index = build_index do
+ gem "foo", "1.0.0"
+ gem "foo", "1.0.0", "x64-mingw32"
+ gem "foo", "1.1.0"
+ gem "foo", "1.1.0", "x64-mingw32" do |s|
+ s.required_ruby_version = [">= 2.0", "< 2.4"]
+ end
+ gem "Ruby\0", "2.5.1"
+ end
+ dep "foo"
+ dep "Ruby\0", "2.5.1"
+ platforms "x64-mingw32"
+
+ should_resolve_as %w[foo-1.1.0]
+ end
+
+ it "takes the latest ruby gem with required_ruby_version if the platform specific gem doesn't match the required_ruby_version" do
+ @index = build_index do
+ gem "foo", "1.0.0"
+ gem "foo", "1.0.0", "x64-mingw32"
+ gem "foo", "1.1.0" do |s|
+ s.required_ruby_version = [">= 2.0"]
+ end
+ gem "foo", "1.1.0", "x64-mingw32" do |s|
+ s.required_ruby_version = [">= 2.0", "< 2.4"]
+ end
+ gem "Ruby\0", "2.5.1"
+ end
+ dep "foo"
+ dep "Ruby\0", "2.5.1"
+ platforms "x64-mingw32"
+
+ should_resolve_as %w[foo-1.1.0]
+ end
+
+ it "takes the latest ruby gem if the platform specific gem doesn't match the required_ruby_version with multiple platforms" do
+ @index = build_index do
+ gem "foo", "1.0.0"
+ gem "foo", "1.0.0", "x64-mingw32"
+ gem "foo", "1.1.0" do |s|
+ s.required_ruby_version = [">= 2.0"]
+ end
+ gem "foo", "1.1.0", "x64-mingw32" do |s|
+ s.required_ruby_version = [">= 2.0", "< 2.4"]
+ end
+ gem "Ruby\0", "2.5.1"
+ end
+ dep "foo"
+ dep "Ruby\0", "2.5.1"
+ platforms "x86_64-linux", "x64-mingw32"
+
+ should_resolve_as %w[foo-1.1.0]
+ end
+
describe "with mingw32" do
before :each do
@index = build_index do
@@ -90,11 +182,11 @@ RSpec.describe "Resolving platform craziness" do
end
end
- it "reports on the conflict" do
+ it "takes the ruby version as fallback" do
platforms "ruby", "java"
dep "foo"
- should_conflict_on "baz"
+ should_resolve_as %w[bar-1.0.0 baz-1.0.0 foo-1.0.0]
end
end
end
diff --git a/spec/bundler/runtime/executable_spec.rb b/spec/bundler/runtime/executable_spec.rb
index 003be97cd6..e420594f52 100644
--- a/spec/bundler/runtime/executable_spec.rb
+++ b/spec/bundler/runtime/executable_spec.rb
@@ -9,6 +9,8 @@ RSpec.describe "Running bin/* commands" do
end
it "runs the bundled command when in the bundle" do
+ skip "exec format error" if Gem.win_platform?
+
bundle! "binstubs rack"
build_gem "rack", "2.0", :to_system => true do |s|
@@ -20,6 +22,8 @@ RSpec.describe "Running bin/* commands" do
end
it "allows the location of the gem stubs to be specified" do
+ skip "created in bin :/" if Gem.win_platform?
+
bundle! "binstubs rack", :path => "gbin"
expect(bundled_app("bin")).not_to exist
@@ -30,6 +34,8 @@ RSpec.describe "Running bin/* commands" do
end
it "allows absolute paths as a specification of where to install bin stubs" do
+ skip "exec format error" if Gem.win_platform?
+
bundle! "binstubs rack", :path => tmp("bin")
gembin tmp("bin/rackup")
@@ -38,28 +44,32 @@ RSpec.describe "Running bin/* commands" do
it "uses the default ruby install name when shebang is not specified" do
bundle! "binstubs rack"
- expect(File.open("bin/rackup").gets).to eq("#!/usr/bin/env #{RbConfig::CONFIG["ruby_install_name"]}\n")
+ expect(File.open(bundled_app("bin/rackup")).gets).to eq("#!/usr/bin/env #{RbConfig::CONFIG["ruby_install_name"]}\n")
end
it "allows the name of the shebang executable to be specified" do
+ skip "not created with custom name :/" if Gem.win_platform?
+
bundle! "binstubs rack", :shebang => "ruby-foo"
- expect(File.open("bin/rackup").gets).to eq("#!/usr/bin/env ruby-foo\n")
+ expect(File.open(bundled_app("bin/rackup")).gets).to eq("#!/usr/bin/env ruby-foo\n")
end
it "runs the bundled command when out of the bundle" do
+ skip "exec format error" if Gem.win_platform?
+
bundle! "binstubs rack"
build_gem "rack", "2.0", :to_system => true do |s|
s.executables = "rackup"
end
- Dir.chdir(tmp) do
- gembin "rackup"
- expect(out).to eq("1.0.0")
- end
+ gembin "rackup", :dir => tmp
+ expect(out).to eq("1.0.0")
end
it "works with gems in path" do
+ skip "exec format error" if Gem.win_platform?
+
build_lib "rack", :path => lib_path("rack") do |s|
s.executables = "rackup"
end
@@ -94,12 +104,16 @@ RSpec.describe "Running bin/* commands" do
end
it "does not generate bin stubs if the option was not specified" do
+ skip "generated :/" if Gem.win_platform?
+
bundle! "install"
expect(bundled_app("bin/rackup")).not_to exist
end
it "allows you to stop installing binstubs", :bundler => "< 3" do
+ skip "delete permission error" if Gem.win_platform?
+
bundle! "install --binstubs bin/"
bundled_app("bin/rackup").rmtree
bundle! "install --binstubs \"\""
@@ -143,6 +157,8 @@ RSpec.describe "Running bin/* commands" do
end
it "use BUNDLE_GEMFILE gemfile for binstub" do
+ skip "exec format error" if Gem.win_platform?
+
# context with bin/bundler w/ default Gemfile
bundle! "binstubs bundler"
diff --git a/spec/bundler/runtime/gem_tasks_spec.rb b/spec/bundler/runtime/gem_tasks_spec.rb
index 74270a2316..9d673bb9cc 100644
--- a/spec/bundler/runtime/gem_tasks_spec.rb
+++ b/spec/bundler/runtime/gem_tasks_spec.rb
@@ -29,7 +29,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_dir}"
+ sys_exec "#{rake} -T", :env => { "RUBYOPT" => opt_add("-I#{lib_dir}", ENV["RUBYOPT"]) }
end
expect(err).to be_empty
@@ -47,7 +47,7 @@ RSpec.describe "require 'bundler/gem_tasks'" do
it "defines a working `rake install` task" do
with_gem_path_as(Spec::Path.base_system_gems.to_s) do
- sys_exec "#{rake} install", "RUBYOPT" => "-I#{lib_dir}"
+ sys_exec "#{rake} install", :env => { "RUBYOPT" => opt_add("-I#{lib_dir}", ENV["RUBYOPT"]) }
end
expect(err).to be_empty
@@ -60,13 +60,11 @@ RSpec.describe "require 'bundler/gem_tasks'" do
context "rake build when path has spaces" do
before do
spaced_bundled_app = tmp.join("bundled app")
- FileUtils.mv bundled_app, spaced_bundled_app
- Dir.chdir(spaced_bundled_app)
+ FileUtils.cp_r bundled_app, spaced_bundled_app
+ bundle! "exec rake build", :dir => spaced_bundled_app
end
it "still runs successfully" do
- bundle! "exec rake build"
-
expect(err).to be_empty
end
end
diff --git a/spec/bundler/runtime/inline_spec.rb b/spec/bundler/runtime/inline_spec.rb
index cd762fe636..fb6c6e90ad 100644
--- a/spec/bundler/runtime/inline_spec.rb
+++ b/spec/bundler/runtime/inline_spec.rb
@@ -46,6 +46,8 @@ RSpec.describe "bundler/inline#gemfile" do
end
it "requires the gems" do
+ skip "gems not found" if Gem.win_platform?
+
script <<-RUBY
gemfile do
path "#{lib_path}" do
@@ -95,6 +97,8 @@ RSpec.describe "bundler/inline#gemfile" do
end
it "lets me use my own ui object" do
+ skip "prints just one CONFIRMED" if Gem.win_platform?
+
script <<-RUBY, :artifice => "endpoint"
require '#{lib_dir}/bundler'
class MyBundlerUI < Bundler::UI::Silent
@@ -229,16 +233,14 @@ RSpec.describe "bundler/inline#gemfile" do
1.13.6
G
- in_app_root do
- script <<-RUBY
- gemfile do
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
- end
+ script <<-RUBY
+ gemfile do
+ source "#{file_uri_for(gem_repo1)}"
+ gem "rack"
+ end
- puts RACK
- RUBY
- end
+ puts RACK
+ RUBY
expect(err).to be_empty
expect(exitstatus).to be_zero if exitstatus
@@ -261,16 +263,14 @@ RSpec.describe "bundler/inline#gemfile" do
it "installs inline gems when BUNDLE_GEMFILE is set to an empty string" do
ENV["BUNDLE_GEMFILE"] = ""
- in_app_root do
- script <<-RUBY
- gemfile do
- source "#{file_uri_for(gem_repo1)}"
- gem "rack"
- end
+ script <<-RUBY
+ gemfile do
+ source "#{file_uri_for(gem_repo1)}"
+ gem "rack"
+ end
- puts RACK
- RUBY
- end
+ puts RACK
+ RUBY
expect(err).to be_empty
expect(exitstatus).to be_zero if exitstatus
diff --git a/spec/bundler/runtime/load_spec.rb b/spec/bundler/runtime/load_spec.rb
index 7de67e247c..a406fbaf49 100644
--- a/spec/bundler/runtime/load_spec.rb
+++ b/spec/bundler/runtime/load_spec.rb
@@ -7,6 +7,7 @@ RSpec.describe "Bundler.load" do
source "#{file_uri_for(gem_repo1)}"
gem "rack"
G
+ allow(Bundler::SharedHelpers).to receive(:pwd).and_return(bundled_app)
end
it "provides a list of the env dependencies" do
@@ -32,6 +33,7 @@ RSpec.describe "Bundler.load" do
gem "rack"
G
bundle! :install
+ allow(Bundler::SharedHelpers).to receive(:pwd).and_return(bundled_app)
end
it "provides a list of the env dependencies" do
@@ -101,7 +103,7 @@ RSpec.describe "Bundler.load" do
source "#{file_uri_for(gem_repo1)}"
gem "activerecord"
G
-
+ allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
Bundler.load.specs.each do |spec|
expect(spec.to_yaml).not_to match(/^\s+source:/)
expect(spec.to_yaml).not_to match(/^\s+groups:/)
diff --git a/spec/bundler/runtime/platform_spec.rb b/spec/bundler/runtime/platform_spec.rb
index f7e93eacf1..70c7594395 100644
--- a/spec/bundler/runtime/platform_spec.rb
+++ b/spec/bundler/runtime/platform_spec.rb
@@ -113,11 +113,12 @@ RSpec.describe "Bundler.setup with multi platform stuff" do
bundle! "install"
expect(the_bundle).to include_gems "platform_specific 1.0 RUBY"
+ expect(the_bundle).to not_include_gems "nokogiri"
end
end
it "allows specifying only-ruby-platform on windows with gemspec dependency" do
- build_lib("foo", "1.0", :path => ".") do |s|
+ build_lib("foo", "1.0", :path => bundled_app) do |s|
s.add_dependency "rack"
end
diff --git a/spec/bundler/runtime/require_spec.rb b/spec/bundler/runtime/require_spec.rb
index a8d7826123..3b9021b4fc 100644
--- a/spec/bundler/runtime/require_spec.rb
+++ b/spec/bundler/runtime/require_spec.rb
@@ -155,7 +155,7 @@ RSpec.describe "Bundler.require" do
begin
Bundler.require
rescue LoadError => e
- $stderr.puts "ZOMG LOAD ERROR: \#{e.message}"
+ warn "ZOMG LOAD ERROR: \#{e.message}"
end
RUBY
run(cmd)
@@ -228,7 +228,7 @@ RSpec.describe "Bundler.require" do
begin
Bundler.require
rescue LoadError => e
- $stderr.puts "ZOMG LOAD ERROR" if e.message.include?("Could not open library 'libfuuu-1.0'")
+ warn "ZOMG LOAD ERROR" if e.message.include?("Could not open library 'libfuuu-1.0'")
end
RUBY
run(cmd)
@@ -251,7 +251,7 @@ RSpec.describe "Bundler.require" do
begin
Bundler.require
rescue LoadError => e
- $stderr.puts "ZOMG LOAD ERROR: \#{e.message}"
+ warn "ZOMG LOAD ERROR: \#{e.message}"
end
RUBY
run(cmd)
@@ -423,7 +423,7 @@ RSpec.describe "Bundler.require with platform specific dependencies" do
source "#{file_uri_for(gem_repo1)}"
platforms :#{not_local_tag} do
- gem "fail", :require => "omgomg"
+ gem "platform_specific", :require => "omgomg"
end
gem "rack", "1.0.0"
@@ -434,6 +434,8 @@ RSpec.describe "Bundler.require with platform specific dependencies" do
end
it "requires gems pinned to multiple platforms, including the current one" do
+ skip "platform issues" if Gem.win_platform?
+
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
diff --git a/spec/bundler/runtime/setup_spec.rb b/spec/bundler/runtime/setup_spec.rb
index 7f00a63078..b39a740653 100644
--- a/spec/bundler/runtime/setup_spec.rb
+++ b/spec/bundler/runtime/setup_spec.rb
@@ -159,7 +159,7 @@ RSpec.describe "Bundler.setup" do
"/gems/actionpack-2.3.2/lib",
"/gems/actionmailer-2.3.2/lib",
"/gems/activesupport-2.3.2/lib",
- "/gems/rake-12.3.2/lib"
+ "/gems/rake-13.0.1/lib"
)
end
@@ -218,7 +218,7 @@ RSpec.describe "Bundler.setup" do
Bundler.setup
R
- expect(bundled_app("Gemfile.lock")).not_to exist
+ expect(bundled_app_lock).not_to exist
end
it "doesn't change the Gemfile.lock if the setup fails" do
@@ -227,7 +227,7 @@ RSpec.describe "Bundler.setup" do
gem "rack"
G
- lockfile = File.read(bundled_app("Gemfile.lock"))
+ lockfile = File.read(bundled_app_lock)
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
@@ -241,7 +241,7 @@ RSpec.describe "Bundler.setup" do
Bundler.setup
R
- expect(File.read(bundled_app("Gemfile.lock"))).to eq(lockfile)
+ expect(File.read(bundled_app_lock)).to eq(lockfile)
end
it "makes a Gemfile.lock if setup succeeds" do
@@ -250,12 +250,12 @@ RSpec.describe "Bundler.setup" do
gem "rack"
G
- File.read(bundled_app("Gemfile.lock"))
+ File.read(bundled_app_lock)
- FileUtils.rm(bundled_app("Gemfile.lock"))
+ FileUtils.rm(bundled_app_lock)
run "1"
- expect(bundled_app("Gemfile.lock")).to exist
+ expect(bundled_app_lock).to exist
end
describe "$BUNDLE_GEMFILE" do
@@ -460,7 +460,7 @@ RSpec.describe "Bundler.setup" do
it "provides a good exception if the lockfile is unavailable" do
bundle "install"
- FileUtils.rm(bundled_app("Gemfile.lock"))
+ FileUtils.rm(bundled_app_lock)
break_git!
@@ -489,15 +489,16 @@ RSpec.describe "Bundler.setup" do
it "does not randomly change the path when specifying --path and the bundle directory becomes read only" do
bundle! :install, forgotten_command_line_options(:path => "vendor/bundle")
- with_read_only("**/*") do
+ with_read_only("#{bundled_app}/**/*") do
expect(the_bundle).to include_gems "rack 1.0.0"
end
end
it "finds git gem when default bundle path becomes read only" do
+ bundle "config set --local path .bundle"
bundle "install"
- with_read_only("#{Bundler.bundle_path}/**/*") do
+ with_read_only("#{bundled_app(".bundle")}/**/*") do
expect(the_bundle).to include_gems "rack 1.0.0"
end
end
@@ -708,7 +709,7 @@ end
end
context "when the user has one set" do
- before { ENV["MANPATH"] = "/foo:" }
+ before { ENV["MANPATH"] = "/foo#{File::PATH_SEPARATOR}" }
it "adds the gem's man dir to the MANPATH" do
install_gemfile! <<-G
@@ -717,7 +718,7 @@ end
G
run! "puts ENV['MANPATH']"
- expect(out).to eq("#{default_bundle_path("gems/with_man-1.0/man")}:/foo")
+ expect(out).to eq("#{default_bundle_path("gems/with_man-1.0/man")}#{File::PATH_SEPARATOR}/foo")
end
end
@@ -793,6 +794,8 @@ end
let(:full_name) { "bundler-#{Bundler::VERSION}" }
before do
+ skip "symlink destination exists" if Gem.win_platform?
+
FileUtils.ln_sf(gem_home, symlinked_gem_home)
gems_dir = File.join(gem_home, "gems")
specifications_dir = File.join(gem_home, "specifications")
@@ -863,11 +866,9 @@ end
gem 'foo', '1.2.3', :path => 'vendor/foo'
G
- Dir.chdir(bundled_app.parent) do
- run <<-R, :env => { "BUNDLE_GEMFILE" => bundled_app("Gemfile").to_s }
- require 'foo'
- R
- end
+ run <<-R, :env => { "BUNDLE_GEMFILE" => bundled_app_gemfile.to_s }, :dir => bundled_app.parent
+ require 'foo'
+ R
expect(err).to be_empty
end
@@ -887,11 +888,9 @@ end
bundle :install
- Dir.chdir(bundled_app.parent) do
- run <<-R, :env => { "BUNDLE_GEMFILE" => bundled_app("Gemfile").to_s }
- require 'foo'
- R
- end
+ run <<-R, :env => { "BUNDLE_GEMFILE" => bundled_app_gemfile.to_s }, :dir => bundled_app.parent
+ require 'foo'
+ R
expect(err).to be_empty
end
@@ -1015,6 +1014,8 @@ end
end
it "error intelligently if the gemspec has a LoadError" do
+ skip "whitespace issue?" if Gem.win_platform?
+
ref = update_git "bar", :gemspec => false do |s|
s.write "bar.gemspec", "require 'foobarbaz'"
end.ref_for("HEAD")
@@ -1202,11 +1203,13 @@ end
describe "default gem activation" do
let(:exemptions) do
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new("2.7")
+ exempts = if Gem::Version.new(Gem::VERSION) >= Gem::Version.new("2.7")
%w[did_you_mean]
else
%w[io-console openssl]
end << "bundler"
+ exempts << "fiddle" if Gem.win_platform? && Gem::Version.new(Gem::VERSION) >= Gem::Version.new("2.7")
+ exempts
end
let(:activation_warning_hack) { strip_whitespace(<<-RUBY) }
@@ -1256,6 +1259,8 @@ end
end
it "activates no gems with bundle exec that is loaded" do
+ skip "not executable" if Gem.win_platform?
+
install_gemfile! ""
create_file("script.rb", "#!/usr/bin/env ruby\n\n#{code}")
FileUtils.chmod(0o777, bundled_app("script.rb"))
@@ -1367,7 +1372,7 @@ end
end
it "takes care of requiring rubygems" do
- sys_exec("#{Gem.ruby} -I#{lib_dir} -e \"puts require('bundler/setup')\"", "RUBYOPT" => "--disable=gems")
+ sys_exec("#{Gem.ruby} -I#{lib_dir} -rbundler/setup -e'puts true'", :env => { "RUBYOPT" => opt_add("--disable=gems", ENV["RUBYOPT"]) })
expect(last_command.stdboth).to eq("true")
end
diff --git a/spec/bundler/runtime/with_unbundled_env_spec.rb b/spec/bundler/runtime/with_unbundled_env_spec.rb
index 4aaf9d499c..80c5d92b76 100644
--- a/spec/bundler/runtime/with_unbundled_env_spec.rb
+++ b/spec/bundler/runtime/with_unbundled_env_spec.rb
@@ -1,9 +1,9 @@
# frozen_string_literal: true
RSpec.describe "Bundler.with_env helpers" do
- def bundle_exec_ruby!(code, options = {})
+ def bundle_exec_ruby!(args, options = {})
build_bundler_context options
- bundle! "exec '#{Gem.ruby}' -e #{code}", options
+ bundle! "exec '#{Gem.ruby}' #{args}", options
end
def build_bundler_context(options = {})
@@ -12,39 +12,47 @@ RSpec.describe "Bundler.with_env helpers" do
bundle "install", options
end
+ def run_bundler_script(env, script)
+ system(env, "ruby", "-I#{lib_dir}", "-rbundler", script.to_s)
+ end
+
describe "Bundler.original_env" do
it "should return the PATH present before bundle was activated" do
- code = "print Bundler.original_env['PATH']"
+ create_file("source.rb", <<-RUBY)
+ print Bundler.original_env["PATH"]
+ RUBY
path = `getconf PATH`.strip + "#{File::PATH_SEPARATOR}/foo"
with_path_as(path) do
- bundle_exec_ruby!(code.dump)
+ bundle_exec_ruby!(bundled_app("source.rb").to_s)
expect(last_command.stdboth).to eq(path)
end
end
it "should return the GEM_PATH present before bundle was activated" do
- code = "print Bundler.original_env['GEM_PATH']"
- gem_path = ENV["GEM_PATH"] + ":/foo"
+ create_file("source.rb", <<-RUBY)
+ print Bundler.original_env['GEM_PATH']
+ RUBY
+ gem_path = ENV["GEM_PATH"] + "#{File::PATH_SEPARATOR}/foo"
with_gem_path_as(gem_path) do
- bundle_exec_ruby!(code.dump)
+ bundle_exec_ruby!(bundled_app("source.rb").to_s)
expect(last_command.stdboth).to eq(gem_path)
end
end
it "works with nested bundle exec invocations" do
- create_file("exe.rb", <<-'RB')
+ create_file("exe.rb", <<-'RUBY')
count = ARGV.first.to_i
exit if count < 0
- STDERR.puts "#{count} #{ENV["PATH"].end_with?(":/foo")}"
+ STDERR.puts "#{count} #{ENV["PATH"].end_with?("#{File::PATH_SEPARATOR}/foo")}"
if count == 2
- ENV["PATH"] = "#{ENV["PATH"]}:/foo"
+ ENV["PATH"] = "#{ENV["PATH"]}#{File::PATH_SEPARATOR}/foo"
end
exec(Gem.ruby, __FILE__, (count - 1).to_s)
- RB
+ RUBY
path = `getconf PATH`.strip + File::PATH_SEPARATOR + File.dirname(Gem.ruby)
with_path_as(path) do
build_bundler_context
- bundle! "exec '#{Gem.ruby}' #{bundled_app("exe.rb")} 2"
+ bundle_exec_ruby!("#{bundled_app("exe.rb")} 2")
end
expect(err).to eq <<-EOS.strip
2 false
@@ -58,40 +66,50 @@ RSpec.describe "Bundler.with_env helpers" do
ENV.replace(ENV.to_hash.delete_if {|k, _v| k.start_with?(Bundler::EnvironmentPreserver::BUNDLER_PREFIX) })
original = ruby!('puts ENV.to_a.map {|e| e.join("=") }.sort.join("\n")')
- code = 'puts Bundler.original_env.to_a.map {|e| e.join("=") }.sort.join("\n")'
- bundle_exec_ruby! code.dump
+ create_file("source.rb", <<-RUBY)
+ puts Bundler.original_env.to_a.map {|e| e.join("=") }.sort.join("\n")
+ RUBY
+ bundle_exec_ruby! bundled_app("source.rb")
expect(out).to eq original
end
end
shared_examples_for "an unbundling helper" do
it "should delete BUNDLE_PATH" do
- code = "print #{modified_env}.has_key?('BUNDLE_PATH')"
+ create_file("source.rb", <<-RUBY)
+ print #{modified_env}.has_key?('BUNDLE_PATH')
+ RUBY
ENV["BUNDLE_PATH"] = "./foo"
- bundle_exec_ruby! code.dump
+ bundle_exec_ruby! bundled_app("source.rb")
expect(last_command.stdboth).to include "false"
end
it "should remove '-rbundler/setup' from RUBYOPT" do
- code = "print #{modified_env}['RUBYOPT']"
+ create_file("source.rb", <<-RUBY)
+ print #{modified_env}['RUBYOPT']
+ RUBY
ENV["RUBYOPT"] = "-W2 -rbundler/setup #{ENV["RUBYOPT"]}"
- bundle_exec_ruby! code.dump, :env => { "BUNDLER_SPEC_DISABLE_DEFAULT_BUNDLER_GEM" => "true" }
+ bundle_exec_ruby! bundled_app("source.rb"), :env => { "BUNDLER_SPEC_DISABLE_DEFAULT_BUNDLER_GEM" => "true" }
expect(last_command.stdboth).not_to include("-rbundler/setup")
end
it "should restore RUBYLIB", :ruby_repo do
- code = "print #{modified_env}['RUBYLIB']"
+ create_file("source.rb", <<-RUBY)
+ print #{modified_env}['RUBYLIB']
+ RUBY
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
+ bundle_exec_ruby! bundled_app("source.rb")
expect(last_command.stdboth).to include("/foo-original")
end
it "should restore the original MANPATH" do
- code = "print #{modified_env}['MANPATH']"
+ create_file("source.rb", <<-RUBY)
+ print #{modified_env}['MANPATH']
+ RUBY
ENV["MANPATH"] = "/foo"
ENV["BUNDLER_ORIG_MANPATH"] = "/foo-original"
- bundle_exec_ruby! code.dump
+ bundle_exec_ruby! bundled_app("source.rb")
expect(last_command.stdboth).to include("/foo-original")
end
end
@@ -111,7 +129,7 @@ RSpec.describe "Bundler.with_env helpers" do
describe "Bundler.with_original_env" do
it "should set ENV to original_env in the block" do
expected = Bundler.original_env
- actual = Bundler.with_original_env { ENV.to_hash }
+ actual = Bundler.with_original_env { Bundler::EnvironmentPreserver.env_to_hash(ENV) }
expect(actual).to eq(expected)
end
@@ -129,7 +147,7 @@ RSpec.describe "Bundler.with_env helpers" do
expected = Bundler.unbundled_env
actual = Bundler.ui.silence do
- Bundler.with_clean_env { ENV.to_hash }
+ Bundler.with_clean_env { Bundler::EnvironmentPreserver.env_to_hash(ENV) }
end
expect(actual).to eq(expected)
@@ -147,7 +165,7 @@ RSpec.describe "Bundler.with_env helpers" do
describe "Bundler.with_unbundled_env" do
it "should set ENV to unbundled_env in the block" do
expected = Bundler.unbundled_env
- actual = Bundler.with_unbundled_env { ENV.to_hash }
+ actual = Bundler.with_unbundled_env { Bundler::EnvironmentPreserver.env_to_hash(ENV) }
expect(actual).to eq(expected)
end
@@ -161,53 +179,53 @@ RSpec.describe "Bundler.with_env helpers" do
end
describe "Bundler.original_system" do
- let(:code) do
- <<~RUBY
- Bundler.original_system(%([ "\$BUNDLE_FOO" = "bar" ] && exit 42))
+ before do
+ create_file("source.rb", <<-'RUBY')
+ Bundler.original_system("ruby", "-e", "exit(42) if ENV['BUNDLE_FOO'] == 'bar'")
exit $?.exitstatus
RUBY
end
it "runs system inside with_original_env" do
- system({ "BUNDLE_FOO" => "bar" }, "ruby -I#{lib_dir} -rbundler -e '#{code}'")
+ run_bundler_script({ "BUNDLE_FOO" => "bar" }, bundled_app("source.rb"))
expect($?.exitstatus).to eq(42)
end
end
describe "Bundler.clean_system", :bundler => 2 do
- let(:code) do
- <<~RUBY
- Bundler.ui.silence { Bundler.clean_system(%([ "\$BUNDLE_FOO" = "bar" ] || exit 42)) }
+ before do
+ create_file("source.rb", <<-'RUBY')
+ Bundler.ui.silence { Bundler.clean_system("ruby", "-e", "exit(42) unless ENV['BUNDLE_FOO'] == 'bar'") }
exit $?.exitstatus
RUBY
end
it "runs system inside with_clean_env" do
- system({ "BUNDLE_FOO" => "bar" }, "ruby -I#{lib_dir} -rbundler -e '#{code}'")
+ run_bundler_script({ "BUNDLE_FOO" => "bar" }, bundled_app("source.rb"))
expect($?.exitstatus).to eq(42)
end
end
describe "Bundler.unbundled_system" do
- let(:code) do
- <<~RUBY
- Bundler.unbundled_system(%([ "\$BUNDLE_FOO" = "bar" ] || exit 42))
+ before do
+ create_file("source.rb", <<-'RUBY')
+ Bundler.unbundled_system("ruby", "-e", "exit(42) unless ENV['BUNDLE_FOO'] == 'bar'")
exit $?.exitstatus
RUBY
end
it "runs system inside with_unbundled_env" do
- system({ "BUNDLE_FOO" => "bar" }, "ruby -I#{lib_dir} -rbundler -e '#{code}'")
+ run_bundler_script({ "BUNDLE_FOO" => "bar" }, bundled_app("source.rb"))
expect($?.exitstatus).to eq(42)
end
end
describe "Bundler.original_exec" do
- let(:code) do
- <<~RUBY
+ before do
+ create_file("source.rb", <<-'RUBY')
Process.fork do
exit Bundler.original_exec(%(test "\$BUNDLE_FOO" = "bar"))
end
@@ -221,14 +239,14 @@ RSpec.describe "Bundler.with_env helpers" do
it "runs exec inside with_original_env" do
skip "Fork not implemented" if Gem.win_platform?
- system({ "BUNDLE_FOO" => "bar" }, "ruby -I#{lib_dir} -rbundler -e '#{code}'")
+ run_bundler_script({ "BUNDLE_FOO" => "bar" }, bundled_app("source.rb"))
expect($?.exitstatus).to eq(0)
end
end
describe "Bundler.clean_exec", :bundler => 2 do
- let(:code) do
- <<~RUBY
+ before do
+ create_file("source.rb", <<-'RUBY')
Process.fork do
exit Bundler.ui.silence { Bundler.clean_exec(%(test "\$BUNDLE_FOO" = "bar")) }
end
@@ -242,14 +260,14 @@ RSpec.describe "Bundler.with_env helpers" do
it "runs exec inside with_clean_env" do
skip "Fork not implemented" if Gem.win_platform?
- system({ "BUNDLE_FOO" => "bar" }, "ruby -I#{lib_dir} -rbundler -e '#{code}'")
+ run_bundler_script({ "BUNDLE_FOO" => "bar" }, bundled_app("source.rb"))
expect($?.exitstatus).to eq(1)
end
end
describe "Bundler.unbundled_exec" do
- let(:code) do
- <<~RUBY
+ before do
+ create_file("source.rb", <<-'RUBY')
Process.fork do
exit Bundler.unbundled_exec(%(test "\$BUNDLE_FOO" = "bar"))
end
@@ -263,7 +281,7 @@ RSpec.describe "Bundler.with_env helpers" do
it "runs exec inside with_clean_env" do
skip "Fork not implemented" if Gem.win_platform?
- system({ "BUNDLE_FOO" => "bar" }, "ruby -I#{lib_dir} -rbundler -e '#{code}'")
+ run_bundler_script({ "BUNDLE_FOO" => "bar" }, bundled_app("source.rb"))
expect($?.exitstatus).to eq(1)
end
end
diff --git a/spec/bundler/spec_helper.rb b/spec/bundler/spec_helper.rb
index 0a49b46aaa..6b08cb203f 100644
--- a/spec/bundler/spec_helper.rb
+++ b/spec/bundler/spec_helper.rb
@@ -2,7 +2,6 @@
require_relative "support/path"
-$:.unshift Spec::Path.spec_dir.to_s
$:.unshift Spec::Path.lib_dir.to_s
require "bundler/psyched_yaml"
@@ -15,14 +14,15 @@ if File.expand_path(__FILE__) =~ %r{([^\w/\.:\-])}
end
require "bundler"
-require "rspec"
+require "rspec/core"
+require "rspec/expectations"
+require "rspec/mocks"
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"
@@ -49,6 +49,8 @@ RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
+ config.silence_filter_announcements = !ENV["TEST_ENV_NUMBER"].nil?
+
config.disable_monkey_patching!
# Since failures cause us to keep a bunch of long strings in memory, stop
@@ -59,7 +61,6 @@ RSpec.configure do |config|
config.bisect_runner = :shell
- original_wd = Dir.pwd
original_env = ENV.to_hash
config.expect_with :rspec do |c|
@@ -81,8 +82,7 @@ RSpec.configure do |config|
config.before :suite do
require_relative "support/rubygems_ext"
- Spec::Rubygems.setup
- ENV["RUBYOPT"] = "#{ENV["RUBYOPT"]} -r#{Spec::Path.spec_dir}/support/hax.rb"
+ Spec::Rubygems.test_setup
ENV["BUNDLE_SPEC_RUN"] = "true"
ENV["BUNDLE_USER_CONFIG"] = ENV["BUNDLE_USER_CACHE"] = ENV["BUNDLE_USER_PLUGIN"] = nil
ENV["GEMRC"] = nil
@@ -105,7 +105,7 @@ RSpec.configure do |config|
ENV.replace(original_env)
reset!
system_gems []
- in_app_root
+
@command_executions = []
Bundler.ui.silence { example.run }
@@ -118,8 +118,6 @@ RSpec.configure do |config|
message
end
end
-
- Dir.chdir(original_wd)
end
config.after :suite do
diff --git a/spec/bundler/support/artifice/compact_index.rb b/spec/bundler/support/artifice/compact_index.rb
index 72abf26224..67fd05f9a2 100644
--- a/spec/bundler/support/artifice/compact_index.rb
+++ b/spec/bundler/support/artifice/compact_index.rb
@@ -100,7 +100,7 @@ class CompactIndexAPI < Endpoint
get "/versions" do
etag_response do
file = tmp("versions.list")
- file.delete if file.file?
+ FileUtils.rm_f(file)
file = CompactIndex::VersionsFile.new(file.to_s)
file.create(gems)
file.contents
diff --git a/spec/bundler/support/artifice/compact_index_concurrent_download.rb b/spec/bundler/support/artifice/compact_index_concurrent_download.rb
index 7f989a3f37..14c31f35a4 100644
--- a/spec/bundler/support/artifice/compact_index_concurrent_download.rb
+++ b/spec/bundler/support/artifice/compact_index_concurrent_download.rb
@@ -10,7 +10,7 @@ class CompactIndexConcurrentDownload < CompactIndexAPI
"localgemserver.test.80.dd34752a738ee965a2a4298dc16db6c5", "versions")
# Verify the original (empty) content hasn't been deleted, e.g. on a retry
- File.read(versions) == "" || raise("Original file should be present and empty")
+ File.binread(versions) == "" || raise("Original file should be present and empty")
# Verify this is only requested once for a partial download
env["HTTP_RANGE"] || raise("Missing Range header for expected partial download")
@@ -21,7 +21,7 @@ class CompactIndexConcurrentDownload < CompactIndexAPI
etag_response do
file = tmp("versions.list")
- file.delete if file.file?
+ FileUtils.rm_f(file)
file = CompactIndex::VersionsFile.new(file.to_s)
file.create(gems)
file.contents
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 6c3442e14b..cfe22c7f51 100644
--- a/spec/bundler/support/artifice/compact_index_creds_diff_host.rb
+++ b/spec/bundler/support/artifice/compact_index_creds_diff_host.rb
@@ -31,7 +31,7 @@ class CompactIndexCredsDiffHost < CompactIndexAPI
get "/no/creds/:id" do
if request.host.include?("diffhost") && !auth.provided?
- File.read("#{gem_repo1}/gems/#{params[:id]}")
+ File.binread("#{gem_repo1}/gems/#{params[:id]}")
end
end
end
diff --git a/spec/bundler/support/artifice/compact_index_extra.rb b/spec/bundler/support/artifice/compact_index_extra.rb
index 3a09afd06f..cec368276a 100644
--- a/spec/bundler/support/artifice/compact_index_extra.rb
+++ b/spec/bundler/support/artifice/compact_index_extra.rb
@@ -14,11 +14,11 @@ class CompactIndexExtra < CompactIndexAPI
end
get "/extra/specs.4.8.gz" do
- File.read("#{gem_repo2}/specs.4.8.gz")
+ File.binread("#{gem_repo2}/specs.4.8.gz")
end
get "/extra/prerelease_specs.4.8.gz" do
- File.read("#{gem_repo2}/prerelease_specs.4.8.gz")
+ File.binread("#{gem_repo2}/prerelease_specs.4.8.gz")
end
get "/extra/quick/Marshal.4.8/:id" do
@@ -26,11 +26,11 @@ class CompactIndexExtra < CompactIndexAPI
end
get "/extra/fetch/actual/gem/:id" do
- File.read("#{gem_repo2}/quick/Marshal.4.8/#{params[:id]}")
+ File.binread("#{gem_repo2}/quick/Marshal.4.8/#{params[:id]}")
end
get "/extra/gems/:id" do
- File.read("#{gem_repo2}/gems/#{params[:id]}")
+ File.binread("#{gem_repo2}/gems/#{params[:id]}")
end
end
diff --git a/spec/bundler/support/artifice/compact_index_extra_api.rb b/spec/bundler/support/artifice/compact_index_extra_api.rb
index 3c716763c0..5cc13421a8 100644
--- a/spec/bundler/support/artifice/compact_index_extra_api.rb
+++ b/spec/bundler/support/artifice/compact_index_extra_api.rb
@@ -14,7 +14,7 @@ class CompactIndexExtraApi < CompactIndexAPI
get "/extra/versions" do
etag_response do
file = tmp("versions.list")
- file.delete if file.file?
+ FileUtils.rm_f(file)
file = CompactIndex::VersionsFile.new(file.to_s)
file.create(gems(gem_repo4))
file.contents
@@ -29,11 +29,11 @@ class CompactIndexExtraApi < CompactIndexAPI
end
get "/extra/specs.4.8.gz" do
- File.read("#{gem_repo4}/specs.4.8.gz")
+ File.binread("#{gem_repo4}/specs.4.8.gz")
end
get "/extra/prerelease_specs.4.8.gz" do
- File.read("#{gem_repo4}/prerelease_specs.4.8.gz")
+ File.binread("#{gem_repo4}/prerelease_specs.4.8.gz")
end
get "/extra/quick/Marshal.4.8/:id" do
@@ -41,11 +41,11 @@ class CompactIndexExtraApi < CompactIndexAPI
end
get "/extra/fetch/actual/gem/:id" do
- File.read("#{gem_repo4}/quick/Marshal.4.8/#{params[:id]}")
+ File.binread("#{gem_repo4}/quick/Marshal.4.8/#{params[:id]}")
end
get "/extra/gems/:id" do
- File.read("#{gem_repo4}/gems/#{params[:id]}")
+ File.binread("#{gem_repo4}/gems/#{params[:id]}")
end
end
diff --git a/spec/bundler/support/artifice/compact_index_partial_update.rb b/spec/bundler/support/artifice/compact_index_partial_update.rb
index 6e7c05d423..cb1c7b9481 100644
--- a/spec/bundler/support/artifice/compact_index_partial_update.rb
+++ b/spec/bundler/support/artifice/compact_index_partial_update.rb
@@ -18,19 +18,19 @@ class CompactIndexPartialUpdate < CompactIndexAPI
)
# Verify a cached copy of the versions file exists
- unless File.read(cached_versions_path).start_with?("created_at: ")
+ unless File.binread(cached_versions_path).start_with?("created_at: ")
raise("Cached versions file should be present and have content")
end
# Verify that a partial request is made, starting from the index of the
# final byte of the cached file.
- unless env["HTTP_RANGE"] == "bytes=#{File.read(cached_versions_path).bytesize - 1}-"
+ unless env["HTTP_RANGE"] == "bytes=#{File.binread(cached_versions_path).bytesize - 1}-"
raise("Range header should be present, and start from the index of the final byte of the cache.")
end
etag_response do
# Return the exact contents of the cache.
- File.read(cached_versions_path)
+ File.binread(cached_versions_path)
end
end
end
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 788f9d6f99..bb616125bb 100644
--- a/spec/bundler/support/artifice/compact_index_range_not_satisfiable.rb
+++ b/spec/bundler/support/artifice/compact_index_range_not_satisfiable.rb
@@ -11,7 +11,7 @@ class CompactIndexRangeNotSatisfiable < CompactIndexAPI
else
etag_response do
file = tmp("versions.list")
- file.delete if file.file?
+ FileUtils.rm_f(file)
file = CompactIndex::VersionsFile.new(file.to_s)
file.create(gems)
file.contents
diff --git a/spec/bundler/support/artifice/endpoint.rb b/spec/bundler/support/artifice/endpoint.rb
index 7f4cafc239..3ed9a3f0f7 100644
--- a/spec/bundler/support/artifice/endpoint.rb
+++ b/spec/bundler/support/artifice/endpoint.rb
@@ -77,11 +77,11 @@ class Endpoint < Sinatra::Base
end
get "/fetch/actual/gem/:id" do
- File.read("#{GEM_REPO}/quick/Marshal.4.8/#{params[:id]}")
+ File.binread("#{GEM_REPO}/quick/Marshal.4.8/#{params[:id]}")
end
get "/gems/:id" do
- File.read("#{GEM_REPO}/gems/#{params[:id]}")
+ File.binread("#{GEM_REPO}/gems/#{params[:id]}")
end
get "/api/v1/dependencies" do
@@ -89,11 +89,11 @@ class Endpoint < Sinatra::Base
end
get "/specs.4.8.gz" do
- File.read("#{GEM_REPO}/specs.4.8.gz")
+ File.binread("#{GEM_REPO}/specs.4.8.gz")
end
get "/prerelease_specs.4.8.gz" do
- File.read("#{GEM_REPO}/prerelease_specs.4.8.gz")
+ File.binread("#{GEM_REPO}/prerelease_specs.4.8.gz")
end
end
diff --git a/spec/bundler/support/artifice/endpoint_creds_diff_host.rb b/spec/bundler/support/artifice/endpoint_creds_diff_host.rb
index f20ef74ac6..8b8972cedd 100644
--- a/spec/bundler/support/artifice/endpoint_creds_diff_host.rb
+++ b/spec/bundler/support/artifice/endpoint_creds_diff_host.rb
@@ -31,7 +31,7 @@ class EndpointCredsDiffHost < Endpoint
get "/no/creds/:id" do
if request.host.include?("diffhost") && !auth.provided?
- File.read("#{gem_repo1}/gems/#{params[:id]}")
+ File.binread("#{gem_repo1}/gems/#{params[:id]}")
end
end
end
diff --git a/spec/bundler/support/artifice/endpoint_extra.rb b/spec/bundler/support/artifice/endpoint_extra.rb
index 31f6822161..942c4352b7 100644
--- a/spec/bundler/support/artifice/endpoint_extra.rb
+++ b/spec/bundler/support/artifice/endpoint_extra.rb
@@ -10,11 +10,11 @@ class EndpointExtra < Endpoint
end
get "/extra/specs.4.8.gz" do
- File.read("#{gem_repo2}/specs.4.8.gz")
+ File.binread("#{gem_repo2}/specs.4.8.gz")
end
get "/extra/prerelease_specs.4.8.gz" do
- File.read("#{gem_repo2}/prerelease_specs.4.8.gz")
+ File.binread("#{gem_repo2}/prerelease_specs.4.8.gz")
end
get "/extra/quick/Marshal.4.8/:id" do
@@ -22,11 +22,11 @@ class EndpointExtra < Endpoint
end
get "/extra/fetch/actual/gem/:id" do
- File.read("#{gem_repo2}/quick/Marshal.4.8/#{params[:id]}")
+ File.binread("#{gem_repo2}/quick/Marshal.4.8/#{params[:id]}")
end
get "/extra/gems/:id" do
- File.read("#{gem_repo2}/gems/#{params[:id]}")
+ File.binread("#{gem_repo2}/gems/#{params[:id]}")
end
end
diff --git a/spec/bundler/support/artifice/endpoint_extra_api.rb b/spec/bundler/support/artifice/endpoint_extra_api.rb
index 213b8e5895..1cfef7a7fc 100644
--- a/spec/bundler/support/artifice/endpoint_extra_api.rb
+++ b/spec/bundler/support/artifice/endpoint_extra_api.rb
@@ -11,11 +11,11 @@ class EndpointExtraApi < Endpoint
end
get "/extra/specs.4.8.gz" do
- File.read("#{gem_repo4}/specs.4.8.gz")
+ File.binread("#{gem_repo4}/specs.4.8.gz")
end
get "/extra/prerelease_specs.4.8.gz" do
- File.read("#{gem_repo4}/prerelease_specs.4.8.gz")
+ File.binread("#{gem_repo4}/prerelease_specs.4.8.gz")
end
get "/extra/quick/Marshal.4.8/:id" do
@@ -23,11 +23,11 @@ class EndpointExtraApi < Endpoint
end
get "/extra/fetch/actual/gem/:id" do
- File.read("#{gem_repo4}/quick/Marshal.4.8/#{params[:id]}")
+ File.binread("#{gem_repo4}/quick/Marshal.4.8/#{params[:id]}")
end
get "/extra/gems/:id" do
- File.read("#{gem_repo4}/gems/#{params[:id]}")
+ File.binread("#{gem_repo4}/gems/#{params[:id]}")
end
end
diff --git a/spec/bundler/support/artifice/endpoint_mirror_source.rb b/spec/bundler/support/artifice/endpoint_mirror_source.rb
index 318866e420..788a9027f3 100644
--- a/spec/bundler/support/artifice/endpoint_mirror_source.rb
+++ b/spec/bundler/support/artifice/endpoint_mirror_source.rb
@@ -5,7 +5,7 @@ require_relative "endpoint"
class EndpointMirrorSource < Endpoint
get "/gems/:id" do
if request.env["HTTP_X_GEMFILE_SOURCE"] == "https://server.example.org/"
- File.read("#{gem_repo1}/gems/#{params[:id]}")
+ File.binread("#{gem_repo1}/gems/#{params[:id]}")
else
halt 500
end
diff --git a/spec/bundler/support/artifice/vcr.rb b/spec/bundler/support/artifice/vcr.rb
index a46f8e9391..150436f0e3 100644
--- a/spec/bundler/support/artifice/vcr.rb
+++ b/spec/bundler/support/artifice/vcr.rb
@@ -79,7 +79,7 @@ class BundlerVCRHTTP < Net::HTTP
end
def read_stored_request(path)
- contents = File.read(path)
+ contents = File.binread(path)
headers = {}
method = nil
path = nil
diff --git a/spec/bundler/support/builders.rb b/spec/bundler/support/builders.rb
index b3f5f9b876..5ce6e01da3 100644
--- a/spec/bundler/support/builders.rb
+++ b/spec/bundler/support/builders.rb
@@ -17,6 +17,18 @@ module Spec
Gem::Platform.new(platform)
end
+ # Returns a number smaller than the size of the index. Useful for specs that
+ # need the API request limit to be reached for some reason.
+ def low_api_request_limit_for(gem_repo)
+ all_gems = Dir[gem_repo.join("gems/*.gem")]
+
+ all_gem_names = all_gems.map do |file|
+ File.basename(file, ".gem").match(/\A(?<gem_name>[^-]+)-.*\z/)[:gem_name]
+ end.uniq
+
+ (all_gem_names - ["bundler"]).size
+ end
+
def build_repo1
build_repo gem_repo1 do
build_gem "rack", %w[0.9.1 1.0.0] do |s|
@@ -40,7 +52,7 @@ module Spec
build_gem "rails", "2.3.2" do |s|
s.executables = "rails"
- s.add_dependency "rake", "12.3.2"
+ s.add_dependency "rake", "13.0.1"
s.add_dependency "actionpack", "2.3.2"
s.add_dependency "activerecord", "2.3.2"
s.add_dependency "actionmailer", "2.3.2"
@@ -302,6 +314,18 @@ module Spec
end
RUBY
end
+
+ build_gem "has_metadata" do |s|
+ s.metadata = {
+ "bug_tracker_uri" => "https://example.com/user/bestgemever/issues",
+ "changelog_uri" => "https://example.com/user/bestgemever/CHANGELOG.md",
+ "documentation_uri" => "https://www.example.info/gems/bestgemever/0.0.1",
+ "homepage_uri" => "https://bestgemever.example.io",
+ "mailing_list_uri" => "https://groups.example.com/bestgemever",
+ "source_code_uri" => "https://example.com/user/bestgemever",
+ "wiki_uri" => "https://example.com/user/bestgemever/wiki",
+ }
+ end
end
end
@@ -358,8 +382,8 @@ module Spec
rake_path = Dir["#{Path.base_system_gems}/**/rake*.gem"].first
if rake_path.nil?
- Spec::Path.base_system_gems.rmtree
- Spec::Rubygems.setup
+ FileUtils.rm_rf(Path.base_system_gems)
+ Spec::Rubygems.install_test_deps
rake_path = Dir["#{Path.base_system_gems}/**/rake*.gem"].first
end
@@ -382,7 +406,7 @@ module Spec
@_build_repo = File.basename(path)
yield
with_gem_path_as Path.base_system_gems do
- Dir.chdir(path) { gem_command! :generate_index }
+ gem_command! :generate_index, :dir => path
end
ensure
@_build_path = nil
@@ -424,13 +448,13 @@ module Spec
opts = args.last.is_a?(Hash) ? args.last : {}
builder = opts[:bare] ? GitBareBuilder : GitBuilder
spec = build_with(builder, name, args, &block)
- GitReader.new(opts[:path] || lib_path(spec.full_name))
+ GitReader.new(self, opts[:path] || lib_path(spec.full_name))
end
def update_git(name, *args, &block)
opts = args.last.is_a?(Hash) ? args.last : {}
spec = build_with(GitUpdater, name, args, &block)
- GitReader.new(opts[:path] || lib_path(spec.full_name))
+ GitReader.new(self, opts[:path] || lib_path(spec.full_name))
end
def build_plugin(name, *args, &blk)
@@ -451,7 +475,6 @@ module Spec
Array(versions).each do |version|
spec = builder.new(self, name, version)
- spec.authors = ["no one"] if !spec.authors || spec.authors.empty?
yield spec if block_given?
spec._build(options)
end
@@ -599,15 +622,6 @@ module Spec
def @spec.validate(*); end
end
- case options[:gemspec]
- when false
- # do nothing
- when :yaml
- @files["#{name}.gemspec"] = @spec.to_yaml
- else
- @files["#{name}.gemspec"] = @spec.to_ruby
- end
-
unless options[:no_default]
gem_source = options[:source] || "path@#{path}"
@files = _default_files.
@@ -616,13 +630,24 @@ module Spec
end
@spec.authors = ["no one"]
+ @spec.files = @files.keys
+
+ case options[:gemspec]
+ when false
+ # do nothing
+ when :yaml
+ @spec.files << "#{name}.gemspec"
+ @files["#{name}.gemspec"] = @spec.to_yaml
+ else
+ @spec.files << "#{name}.gemspec"
+ @files["#{name}.gemspec"] = @spec.to_ruby
+ end
@files.each do |file, source|
file = Pathname.new(path).join(file)
FileUtils.mkdir_p(file.dirname)
File.open(file, "w") {|f| f.puts source }
end
- @spec.files = @files.keys
path
end
@@ -648,14 +673,12 @@ module Spec
path = options[:path] || _default_path
source = options[:source] || "git@#{path}"
super(options.merge(:path => path, :source => source))
- Dir.chdir(path) do
- `git init`
- `git add *`
- `git config user.email "lol@wut.com"`
- `git config user.name "lolwut"`
- `git config commit.gpgsign false`
- `git commit -m "OMG INITIAL COMMIT"`
- end
+ @context.git("init", path)
+ @context.git("add *", path)
+ @context.git("config user.email lol@wut.com", path)
+ @context.git("config user.name lolwut", path)
+ @context.git("config commit.gpgsign false", path)
+ @context.git("commit -m OMG_INITIAL_COMMIT", path)
end
end
@@ -663,91 +686,81 @@ module Spec
def _build(options)
path = options[:path] || _default_path
super(options.merge(:path => path))
- Dir.chdir(path) do
- `git init --bare`
- end
+ @context.git("init --bare", path)
end
end
class GitUpdater < LibBuilder
- def silently(str)
- `#{str} 2>#{Bundler::NULL}`
- end
-
def _build(options)
libpath = options[:path] || _default_path
update_gemspec = options[:gemspec] || false
source = options[:source] || "git@#{libpath}"
- Dir.chdir(libpath) do
- silently "git checkout master"
+ @context.git "checkout master", libpath
- if branch = options[:branch]
- raise "You can't specify `master` as the branch" if branch == "master"
- escaped_branch = Shellwords.shellescape(branch)
+ if branch = options[:branch]
+ raise "You can't specify `master` as the branch" if branch == "master"
+ escaped_branch = Shellwords.shellescape(branch)
- if `git branch | grep #{escaped_branch}`.empty?
- silently("git branch #{escaped_branch}")
- end
-
- silently("git checkout #{escaped_branch}")
- elsif tag = options[:tag]
- `git tag #{Shellwords.shellescape(tag)}`
- elsif options[:remote]
- silently("git remote add origin #{options[:remote]}")
- elsif options[:push]
- silently("git push origin #{options[:push]}")
+ if @context.git("branch -l #{escaped_branch}", libpath).empty?
+ @context.git("branch #{escaped_branch}", libpath)
end
- current_ref = `git rev-parse HEAD`.strip
- _default_files.keys.each do |path|
- _default_files[path] += "\n#{Builders.constantize(name)}_PREV_REF = '#{current_ref}'"
- end
- super(options.merge(:path => libpath, :gemspec => update_gemspec, :source => source))
- `git add *`
- `git commit -m "BUMP"`
+ @context.git("checkout #{escaped_branch}", libpath)
+ elsif tag = options[:tag]
+ @context.git("tag #{Shellwords.shellescape(tag)}", libpath)
+ elsif options[:remote]
+ @context.git("remote add origin #{options[:remote]}", libpath)
+ elsif options[:push]
+ @context.git("push origin #{options[:push]}", libpath)
end
+
+ current_ref = @context.git("rev-parse HEAD", libpath).strip
+ _default_files.keys.each do |path|
+ _default_files[path] += "\n#{Builders.constantize(name)}_PREV_REF = '#{current_ref}'"
+ end
+ super(options.merge(:path => libpath, :gemspec => update_gemspec, :source => source))
+ @context.git("add *", libpath)
+ @context.git("commit -m BUMP", libpath)
end
end
class GitReader
- attr_reader :path
+ attr_reader :context, :path
- def initialize(path)
+ def initialize(context, path)
+ @context = context
@path = path
end
def ref_for(ref, len = nil)
- ref = git "rev-parse #{ref}"
+ ref = context.git "rev-parse #{ref}", path
ref = ref[0..len] if len
ref
end
-
- private
-
- def git(cmd)
- Bundler::SharedHelpers.with_clean_git_env do
- Dir.chdir(@path) { `git #{cmd}`.strip }
- end
- end
end
class GemBuilder < LibBuilder
def _build(opts)
lib_path = super(opts.merge(:path => @context.tmp(".tmp/#{@spec.full_name}"), :no_default => opts[:no_default]))
destination = opts[:path] || _default_path
- Dir.chdir(lib_path) do
- FileUtils.mkdir_p(destination)
-
- @spec.authors = ["that guy"] if !@spec.authors || @spec.authors.empty?
+ FileUtils.mkdir_p(lib_path.join(destination))
- Bundler.rubygems.build(@spec, opts[:skip_validation])
+ if opts[:gemspec] == :yaml || opts[:gemspec] == false
+ Dir.chdir(lib_path) do
+ Bundler.rubygems.build(@spec, opts[:skip_validation])
+ end
+ elsif opts[:skip_validation]
+ @context.gem_command "build --force #{@spec.name}", :dir => lib_path
+ else
+ @context.gem_command! "build #{@spec.name}", :dir => lib_path
end
+
gem_path = File.expand_path("#{@spec.full_name}.gem", lib_path)
if opts[:to_system]
@context.system_gems gem_path, :keep_path => true
elsif opts[:to_bundle]
- @context.system_gems gem_path, :path => :bundle_path, :keep_path => true
+ @context.system_gems gem_path, :path => @context.default_bundle_path, :keep_path => true
else
FileUtils.mv(gem_path, destination)
end
diff --git a/spec/bundler/support/command_execution.rb b/spec/bundler/support/command_execution.rb
index b3c289979f..68e5c56c75 100644
--- a/spec/bundler/support/command_execution.rb
+++ b/spec/bundler/support/command_execution.rb
@@ -3,18 +3,7 @@
module Spec
CommandExecution = Struct.new(:command, :working_directory, :exitstatus, :stdout, :stderr) do
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|
- concat = acc + " " + elem
-
- last_line = concat.match(/.*\z/)[0]
- if last_line.size >= 100
- acc + " \\\n " + elem
- else
- concat
- end
- end
- "$ #{c.strip}"
+ "$ #{command}"
end
alias_method :inspect, :to_s
diff --git a/spec/bundler/support/filters.rb b/spec/bundler/support/filters.rb
index 4ce6648cdc..6322efda8b 100644
--- a/spec/bundler/support/filters.rb
+++ b/spec/bundler/support/filters.rb
@@ -21,17 +21,8 @@ class RequirementChecker < Proc
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
+ config.filter_run_excluding :sudo => true
+ config.filter_run_excluding :realworld => true
git_version = Bundler::Source::Git::GitProxy.new(nil, nil, nil).version
@@ -40,6 +31,9 @@ RSpec.configure do |config|
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_excluding :permissions => Gem.win_platform?
+ config.filter_run_excluding :readline => Gem.win_platform?
+ config.filter_run_excluding :jruby => RUBY_PLATFORM != "java"
config.filter_run_when_matching :focus unless ENV["CI"]
end
diff --git a/spec/bundler/support/hax.rb b/spec/bundler/support/hax.rb
index c18470acd2..4b5c5dd94c 100644
--- a/spec/bundler/support/hax.rb
+++ b/spec/bundler/support/hax.rb
@@ -9,11 +9,6 @@ module Gem
Gem.ruby = ENV["RUBY"]
end
- if version = ENV["BUNDLER_SPEC_RUBYGEMS_VERSION"]
- remove_const(:VERSION) if const_defined?(:VERSION)
- VERSION = version
- end
-
class Platform
@local = new(ENV["BUNDLER_SPEC_PLATFORM"]) if ENV["BUNDLER_SPEC_PLATFORM"]
end
@@ -27,16 +22,6 @@ module Gem
end
end
-if ENV["BUNDLER_SPEC_VERSION"]
- require_relative "path"
- require "#{Spec::Path.lib_dir}/bundler/version"
-
- module Bundler
- remove_const(:VERSION) if const_defined?(:VERSION)
- VERSION = ENV["BUNDLER_SPEC_VERSION"].dup
- end
-end
-
if ENV["BUNDLER_SPEC_WINDOWS"] == "true"
require_relative "path"
require "#{Spec::Path.lib_dir}/bundler/constants"
@@ -47,22 +32,17 @@ if ENV["BUNDLER_SPEC_WINDOWS"] == "true"
end
end
-class Object
- if ENV["BUNDLER_SPEC_RUBY_ENGINE"]
- if RUBY_ENGINE != "jruby" && ENV["BUNDLER_SPEC_RUBY_ENGINE"] == "jruby"
- begin
- # this has to be done up front because psych will try to load a .jar
- # if it thinks its on jruby
- require "psych"
- rescue LoadError
- nil
+if ENV["BUNDLER_SPEC_API_REQUEST_LIMIT"]
+ require_relative "path"
+ require "#{Spec::Path.lib_dir}/bundler/source"
+ require "#{Spec::Path.lib_dir}/bundler/source/rubygems"
+
+ module Bundler
+ class Source
+ class Rubygems < Source
+ remove_const :API_REQUEST_LIMIT
+ API_REQUEST_LIMIT = ENV["BUNDLER_SPEC_API_REQUEST_LIMIT"].to_i
end
end
-
- remove_const :RUBY_ENGINE
- RUBY_ENGINE = ENV["BUNDLER_SPEC_RUBY_ENGINE"]
-
- remove_const :RUBY_ENGINE_VERSION
- RUBY_ENGINE_VERSION = ENV["BUNDLER_SPEC_RUBY_ENGINE_VERSION"]
end
end
diff --git a/spec/bundler/support/helpers.rb b/spec/bundler/support/helpers.rb
index e9c9e766cf..7ef32a5e8e 100644
--- a/spec/bundler/support/helpers.rb
+++ b/spec/bundler/support/helpers.rb
@@ -8,11 +8,7 @@ module Spec
def reset!
Dir.glob("#{tmp}/{gems/*,*}", File::FNM_DOTMATCH).each do |dir|
next if %w[base remote1 gems rubygems . ..].include?(File.basename(dir))
- if ENV["BUNDLER_SUDO_TESTS"]
- `sudo rm -rf "#{dir}"`
- else
- FileUtils.rm_rf(dir)
- end
+ FileUtils.rm_rf(dir)
end
FileUtils.mkdir_p(home)
FileUtils.mkdir_p(tmpdir)
@@ -59,23 +55,11 @@ module Spec
last_command.exitstatus
end
- def in_app_root(&blk)
- Dir.chdir(bundled_app, &blk)
- end
-
- def in_app_root2(&blk)
- Dir.chdir(bundled_app2, &blk)
- end
-
- def in_app_root_custom(root, &blk)
- Dir.chdir(root, &blk)
- end
-
def run(cmd, *args)
opts = args.last.is_a?(Hash) ? args.pop : {}
groups = args.map(&:inspect).join(", ")
- setup = "require '#{lib_dir}/bundler' ; Bundler.ui.silence { Bundler.setup(#{groups}) }\n"
- ruby(setup + cmd, opts)
+ setup = "require '#{lib_dir}/bundler' ; Bundler.ui.silence { Bundler.setup(#{groups}) }"
+ ruby([setup, cmd].join(" ; "), opts)
end
bang :run
@@ -84,7 +68,7 @@ module Spec
begin
#{ruby}
rescue LoadError => e
- $stderr.puts "ZOMG LOAD ERROR" if e.message.include?("-- #{name}")
+ warn "ZOMG LOAD ERROR" if e.message.include?("-- #{name}")
end
RUBY
opts = args.last.is_a?(Hash) ? args.pop : {}
@@ -92,9 +76,9 @@ module Spec
run(cmd, *args)
end
- def bundle(cmd, options = {})
+ def bundle(cmd, options = {}, &block)
with_sudo = options.delete(:sudo)
- sudo = with_sudo == :preserve_env ? "sudo -E" : "sudo" if with_sudo
+ sudo = with_sudo == :preserve_env ? "sudo -E --preserve-env=RUBYOPT" : "sudo" if with_sudo
bundle_bin = options.delete("bundle_bin") || bindir.join("bundle")
@@ -106,7 +90,6 @@ module Spec
env["PATH"].gsub!("#{Path.root}/exe", "") if env["PATH"] && system_bundler
requires = options.delete(:requires) || []
- requires << "support/hax"
artifice = options.delete(:artifice) do
if RSpec.current_example.metadata[:realworld]
@@ -116,15 +99,14 @@ module Spec
end
end
if artifice
- requires << "support/artifice/#{artifice}"
+ requires << "#{Path.spec_dir}/support/artifice/#{artifice}.rb"
end
- requires_str = requires.map {|r| "-r#{r}" }.join(" ")
-
load_path = []
load_path << lib_dir unless system_bundler
load_path << spec_dir
- load_path_str = "-I#{load_path.join(File::PATH_SEPARATOR)}"
+
+ dir = options.delete(:dir) || bundled_app
args = options.map do |k, v|
case v
@@ -139,8 +121,9 @@ module Spec
end
end.join
- cmd = "#{sudo} #{Gem.ruby} #{load_path_str} #{requires_str} #{bundle_bin} #{cmd}#{args}"
- sys_exec(cmd, env) {|i, o, thr| yield i, o, thr if block_given? }
+ ruby_cmd = build_ruby_cmd({ :sudo => sudo, :load_path => load_path, :requires => requires })
+ cmd = "#{ruby_cmd} #{bundle_bin} #{cmd}#{args}"
+ sys_exec(cmd, { :env => env, :dir => dir }, &block)
end
bang :bundle
@@ -167,10 +150,9 @@ module Spec
end
def ruby(ruby, options = {})
- env = options.delete(:env) || {}
- ruby = ruby.gsub(/["`\$]/) {|m| "\\#{m}" }
- lib_option = options[:no_lib] ? "" : " -I#{lib_dir}"
- sys_exec(%(#{Gem.ruby}#{lib_option} -w -e "#{ruby}"), env)
+ ruby_cmd = build_ruby_cmd({ :load_path => options[:no_lib] ? [] : [lib_dir] })
+ escaped_ruby = RUBY_PLATFORM == "java" ? ruby.shellescape.dump : ruby.shellescape
+ sys_exec(%(#{ruby_cmd} -w -e #{escaped_ruby}), options)
end
bang :ruby
@@ -179,22 +161,35 @@ module Spec
begin
#{ruby}
rescue LoadError => e
- $stderr.puts "ZOMG LOAD ERROR"# if e.message.include?("-- #{name}")
+ warn "ZOMG LOAD ERROR" if e.message.include?("-- #{name}")
end
R
end
- def gembin(cmd)
+ def build_ruby_cmd(options = {})
+ sudo = options.delete(:sudo)
+
+ libs = options.delete(:load_path) || []
+ lib_option = "-I#{libs.join(File::PATH_SEPARATOR)}"
+
+ requires = options.delete(:requires) || []
+ requires << "#{Path.spec_dir}/support/hax.rb"
+ require_option = requires.map {|r| "-r#{r}" }
+
+ [sudo, Gem.ruby, *lib_option, *require_option].compact.join(" ")
+ end
+
+ def gembin(cmd, options = {})
old = ENV["RUBYOPT"]
ENV["RUBYOPT"] = "#{ENV["RUBYOPT"]} -I#{lib_dir}"
cmd = bundled_app("bin/#{cmd}") unless cmd.to_s.include?("/")
- sys_exec(cmd.to_s)
+ sys_exec(cmd.to_s, options)
ensure
ENV["RUBYOPT"] = old
end
- def gem_command(command, args = "")
- sys_exec("#{Path.gem_bin} #{command} #{args}")
+ def gem_command(command, options = {})
+ sys_exec("#{Path.gem_bin} #{command}", options)
end
bang :gem_command
@@ -202,11 +197,19 @@ module Spec
"#{Gem.ruby} -S #{ENV["GEM_PATH"]}/bin/rake"
end
- def sys_exec(cmd, env = {})
- command_execution = CommandExecution.new(cmd.to_s, Dir.pwd)
+ def git(cmd, path)
+ sys_exec("git #{cmd}", :dir => path)
+ end
+
+ def sys_exec(cmd, options = {})
+ env = options[:env] || {}
+ env["RUBYOPT"] = opt_add("-r#{spec_dir}/support/switch_rubygems.rb", env["RUBYOPT"] || ENV["RUBYOPT"])
+ dir = options[:dir] || bundled_app
+ command_execution = CommandExecution.new(cmd.to_s, dir)
require "open3"
- Open3.popen3(env, cmd.to_s) do |stdin, stdout, stderr, wait_thr|
+ require "shellwords"
+ Open3.popen3(env, *cmd.shellsplit, :chdir => dir) do |stdin, stdout, stderr, wait_thr|
yield stdin, stdout, wait_thr if block_given?
stdin.close
@@ -250,7 +253,7 @@ module Spec
contents = args.shift
if contents.nil?
- File.open("Gemfile", "r", &:read)
+ File.open(bundled_app_gemfile, "r", &:read)
else
create_file("Gemfile", contents, *args)
end
@@ -260,7 +263,7 @@ module Spec
contents = args.shift
if contents.nil?
- File.open("Gemfile.lock", "r", &:read)
+ File.open(bundled_app_lock, "r", &:read)
else
create_file("Gemfile.lock", contents, *args)
end
@@ -291,12 +294,14 @@ module Spec
options = gems.last.is_a?(Hash) ? gems.pop : {}
gem_repo = options.fetch(:gem_repo) { gem_repo1 }
gems.each do |g|
- if g == :bundler
- with_built_bundler {|gem_path| install_gem(gem_path) }
- elsif g.to_s =~ %r{\A(?:[A-Z]:)?/.*\.gem\z}
- install_gem(g)
+ gem_name = g.to_s
+ if gem_name.start_with?("bundler")
+ version = gem_name.match(/\Abundler-(?<version>.*)\z/)[:version] if gem_name != "bundler"
+ with_built_bundler(version) {|gem_path| install_gem(gem_path) }
+ elsif gem_name =~ %r{\A(?:[a-zA-Z]:)?/.*\.gem\z}
+ install_gem(gem_name)
else
- install_gem("#{gem_repo}/gems/#{g}.gem")
+ install_gem("#{gem_repo}/gems/#{gem_name}.gem")
end
end
end
@@ -304,20 +309,32 @@ module Spec
def install_gem(path)
raise "OMG `#{path}` does not exist!" unless File.exist?(path)
- gem_command! :install, "--no-document --ignore-dependencies '#{path}'"
+ gem_command! "install --no-document --ignore-dependencies '#{path}'"
end
- def with_built_bundler
- with_root_gemspec do |gemspec|
- Dir.chdir(root) { gem_command! :build, gemspec.to_s }
- end
+ def with_built_bundler(version = nil)
+ version ||= Bundler::VERSION
+ full_name = "bundler-#{version}"
+ build_path = tmp + full_name
+ bundler_path = build_path + "#{full_name}.gem"
- bundler_path = root + "bundler-#{Bundler::VERSION}.gem"
+ Dir.mkdir build_path
begin
+ shipped_files.each do |shipped_file|
+ target_shipped_file = build_path + shipped_file
+ target_shipped_dir = File.dirname(target_shipped_file)
+ FileUtils.mkdir_p target_shipped_dir unless File.directory?(target_shipped_dir)
+ FileUtils.cp shipped_file, target_shipped_file, :preserve => true
+ end
+
+ replace_version_file(version, dir: build_path) # rubocop:disable Style/HashSyntax
+
+ gem_command! "build bundler.gemspec", :dir => build_path
+
yield(bundler_path)
ensure
- bundler_path.rmtree
+ build_path.rmtree
end
end
@@ -346,6 +363,16 @@ module Spec
end
end
+ def opt_add(option, options)
+ [option.strip, options].compact.reject(&:empty?).join(" ")
+ end
+
+ def opt_remove(option, options)
+ return unless options
+
+ options.split(" ").reject {|opt| opt.strip == option.strip }.join(" ")
+ end
+
def break_git!
FileUtils.mkdir_p(tmp("broken_path"))
File.open(tmp("broken_path/git"), "w", 0o755) do |f|
@@ -356,6 +383,8 @@ module Spec
end
def with_fake_man
+ skip "fake_man is not a Windows friendly binstub" if Gem.win_platform?
+
FileUtils.mkdir_p(tmp("fake_man"))
File.open(tmp("fake_man/man"), "w", 0o755) do |f|
f.puts "#!/usr/bin/env ruby\nputs ARGV.inspect\n"
@@ -366,18 +395,6 @@ module Spec
def system_gems(*gems)
opts = gems.last.is_a?(Hash) ? gems.last : {}
path = opts.fetch(:path, system_gem_path)
- if path == :bundle_path
- path = ruby!(<<-RUBY)
- require "bundler"
- begin
- puts Bundler.bundle_path
- rescue Bundler::GemfileNotFound
- ENV["BUNDLE_GEMFILE"] = "Gemfile"
- retry
- end
-
- RUBY
- end
gems = gems.flatten
unless opts[:keep_path]
@@ -416,7 +433,7 @@ module Spec
ENV["GEM_PATH"] = system_gem_path.to_s
gems.each do |gem|
- gem_command! :install, "--no-document #{gem}"
+ gem_command! "install --no-document #{gem}"
end
return unless block_given?
begin
@@ -464,35 +481,6 @@ module Spec
ENV["BUNDLER_SPEC_RUBY_VERSION"] = old if block_given?
end
- def simulate_ruby_engine(engine, version = "1.6.0")
- return if engine == local_ruby_engine
-
- old = ENV["BUNDLER_SPEC_RUBY_ENGINE"]
- ENV["BUNDLER_SPEC_RUBY_ENGINE"] = engine
- old_version = ENV["BUNDLER_SPEC_RUBY_ENGINE_VERSION"]
- ENV["BUNDLER_SPEC_RUBY_ENGINE_VERSION"] = version
- yield if block_given?
- ensure
- ENV["BUNDLER_SPEC_RUBY_ENGINE"] = old if block_given?
- ENV["BUNDLER_SPEC_RUBY_ENGINE_VERSION"] = old_version if block_given?
- end
-
- def simulate_bundler_version(version)
- old = ENV["BUNDLER_SPEC_VERSION"]
- ENV["BUNDLER_SPEC_VERSION"] = version.to_s
- yield if block_given?
- ensure
- ENV["BUNDLER_SPEC_VERSION"] = old if block_given?
- end
-
- def simulate_rubygems_version(version)
- old = ENV["BUNDLER_SPEC_RUBYGEMS_VERSION"]
- ENV["BUNDLER_SPEC_RUBYGEMS_VERSION"] = version.to_s
- yield if block_given?
- ensure
- ENV["BUNDLER_SPEC_RUBYGEMS_VERSION"] = old if block_given?
- end
-
def simulate_windows(platform = mswin)
old = ENV["BUNDLER_SPEC_WINDOWS"]
ENV["BUNDLER_SPEC_WINDOWS"] = "true"
@@ -504,7 +492,7 @@ module Spec
end
def revision_for(path)
- Dir.chdir(path) { `git rev-parse HEAD`.strip }
+ sys_exec("git rev-parse HEAD", :dir => path).strip
end
def with_read_only(pattern)
diff --git a/spec/bundler/support/indexes.rb b/spec/bundler/support/indexes.rb
index dc6e0bd1e9..7440523fc9 100644
--- a/spec/bundler/support/indexes.rb
+++ b/spec/bundler/support/indexes.rb
@@ -26,6 +26,10 @@ module Spec
end
end
source_requirements ||= {}
+ args[0] ||= [] # base
+ args[1] ||= Bundler::GemVersionPromoter.new # gem_version_promoter
+ args[2] ||= [] # additional_base_requirements
+ args[3] ||= @platforms # platforms
Bundler::Resolver.resolve(deps, @index, source_requirements, *args)
end
diff --git a/spec/bundler/support/matchers.rb b/spec/bundler/support/matchers.rb
index df35854c2f..e6275064a8 100644
--- a/spec/bundler/support/matchers.rb
+++ b/spec/bundler/support/matchers.rb
@@ -75,16 +75,6 @@ module Spec
end
end
- RSpec::Matchers.define :have_rubyopts do |*args|
- args = args.flatten
- args = args.first.split(/\s+/) if args.size == 1
-
- match do |actual|
- actual = actual.split(/\s+/) if actual.is_a?(String)
- args.all? {|arg| actual.include?(arg) } && actual.uniq.size == actual.size
- end
- end
-
RSpec::Matchers.define :be_sorted do
diffable
attr_reader :expected
@@ -214,11 +204,11 @@ module Spec
end
def lockfile_should_be(expected)
- expect(bundled_app("Gemfile.lock")).to have_lockfile(expected)
+ expect(bundled_app_lock).to have_lockfile(expected)
end
def gemfile_should_be(expected)
- expect(bundled_app("Gemfile")).to read_as(strip_whitespace(expected))
+ expect(bundled_app_gemfile).to read_as(strip_whitespace(expected))
end
end
end
diff --git a/spec/bundler/support/parallel.rb b/spec/bundler/support/parallel.rb
deleted file mode 100644
index 8763cb9ec4..0000000000
--- a/spec/bundler/support/parallel.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-# frozen_string_literal: true
-
-RSpec.configure do |config|
- config.silence_filter_announcements = true
-end
diff --git a/spec/bundler/support/path.rb b/spec/bundler/support/path.rb
index 645da52c97..b851fa389a 100644
--- a/spec/bundler/support/path.rb
+++ b/spec/bundler/support/path.rb
@@ -34,21 +34,19 @@ module Spec
end
def tracked_files
- skip "not in git working directory" unless git_root_dir?
-
- @tracked_files ||= ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb spec/bundler man/bundler*` : `git ls-files -z`
+ @tracked_files ||= sys_exec(ruby_core? ? "git ls-files -z -- lib/bundler lib/bundler.rb spec/bundler man/bundler*" : "git ls-files -z", :dir => root).split("\x0")
end
def shipped_files
- skip "not in git working directory" unless git_root_dir?
-
- @shipped_files ||= ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb man/bundler* libexec/bundle*` : `git ls-files -z -- lib man exe CHANGELOG.md LICENSE.md README.md bundler.gemspec`
+ @shipped_files ||= sys_exec(ruby_core? ? "git ls-files -z -- lib/bundler lib/bundler.rb man/bundler* libexec/bundle*" : "git ls-files -z -- lib man exe CHANGELOG.md LICENSE.md README.md bundler.gemspec", :dir => root).split("\x0")
end
def lib_tracked_files
- skip "not in git working directory" unless git_root_dir?
+ @lib_tracked_files ||= sys_exec(ruby_core? ? "git ls-files -z -- lib/bundler lib/bundler.rb" : "git ls-files -z -- lib", :dir => root).split("\x0")
+ end
- @lib_tracked_files ||= ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb` : `git ls-files -z -- lib`
+ def man_tracked_files
+ @man_tracked_files ||= sys_exec(ruby_core? ? "git ls-files -z -- man/bundler*" : "git ls-files -z -- man", :dir => root).split("\x0")
end
def tmp(*path)
@@ -67,10 +65,10 @@ module Spec
end
def default_bundle_path(*path)
- if Bundler::VERSION.split(".").first.to_i < 3
- system_gem_path(*path)
+ if Bundler.feature_flag.default_install_uses_path?
+ local_gem_path(*path)
else
- bundled_app(*[".bundle", ENV.fetch("BUNDLER_SPEC_RUBY_ENGINE", Gem.ruby_engine), RbConfig::CONFIG["ruby_version"], *path].compact)
+ system_gem_path(*path)
end
end
@@ -80,8 +78,6 @@ module Spec
root.join(*path)
end
- alias_method :bundled_app1, :bundled_app
-
def bundled_app2(*path)
root = tmp.join("bundled_app2")
FileUtils.mkdir_p(root)
@@ -96,6 +92,14 @@ module Spec
bundled_app("vendor/cache/#{path}.gem")
end
+ def bundled_app_gemfile
+ bundled_app("Gemfile")
+ end
+
+ def bundled_app_lock
+ bundled_app("Gemfile.lock")
+ end
+
def base_system_gems
tmp.join("gems/base")
end
@@ -135,6 +139,10 @@ module Spec
tmp("gems/system", *path)
end
+ def local_gem_path(*path, base: bundled_app)
+ base.join(*[".bundle", Gem.ruby_engine, RbConfig::CONFIG["ruby_version"], *path].compact)
+ end
+
def lib_path(*args)
tmp("libs", *args)
end
@@ -155,18 +163,11 @@ module Spec
tmp "tmpdir", *args
end
- def with_root_gemspec
- if ruby_core?
- root_gemspec = root.join("bundler.gemspec")
- # Dir.chdir(root) for Dir.glob in gemspec
- spec = Dir.chdir(root) { Gem::Specification.load(gemspec.to_s) }
- spec.bindir = "libexec"
- File.open(root_gemspec.to_s, "w") {|f| f.write spec.to_ruby }
- yield(root_gemspec)
- FileUtils.rm(root_gemspec)
- else
- yield(gemspec)
- end
+ def replace_version_file(version, dir: root)
+ version_file = File.expand_path("lib/bundler/version.rb", dir)
+ contents = File.read(version_file)
+ contents.sub!(/(^\s+VERSION\s*=\s*)"#{Gem::Version::VERSION_PATTERN}"/, %(\\1"#{version}"))
+ File.open(version_file, "w") {|f| f << contents }
end
def ruby_core?
@@ -181,11 +182,5 @@ module Spec
end
extend self
-
- private
-
- def git_root_dir?
- root.to_s == `git rev-parse --show-toplevel`.chomp
- end
end
end
diff --git a/spec/bundler/support/platforms.rb b/spec/bundler/support/platforms.rb
index f4d63c8ded..a6ebd7510f 100644
--- a/spec/bundler/support/platforms.rb
+++ b/spec/bundler/support/platforms.rb
@@ -65,12 +65,10 @@ module Spec
end
def local_ruby_engine
- ENV["BUNDLER_SPEC_RUBY_ENGINE"] || RUBY_ENGINE
+ RUBY_ENGINE
end
def local_engine_version
- return ENV["BUNDLER_SPEC_RUBY_ENGINE_VERSION"] if ENV["BUNDLER_SPEC_RUBY_ENGINE_VERSION"]
-
RUBY_ENGINE_VERSION
end
diff --git a/spec/bundler/support/rubygems_ext.rb b/spec/bundler/support/rubygems_ext.rb
index ee9c750a52..03c47ce57c 100644
--- a/spec/bundler/support/rubygems_ext.rb
+++ b/spec/bundler/support/rubygems_ext.rb
@@ -2,45 +2,18 @@
require_relative "path"
+$LOAD_PATH.unshift(Spec::Path.lib_dir.to_s)
+
module Spec
module Rubygems
- DEV_DEPS = {
- "automatiek" => "~> 0.3.0",
- "parallel_tests" => "~> 2.29",
- "rake" => "~> 12.0",
- "ronn" => "~> 0.7.3",
- "rspec" => "~> 3.8",
- "rubocop" => "= 0.77.0",
- "rubocop-performance" => "= 1.5.1",
- }.freeze
-
- DEPS = {
- "rack" => "~> 2.0",
- "rack-test" => "~> 1.1",
- "artifice" => "~> 0.6.0",
- "compact_index" => "~> 0.11.0",
- "sinatra" => "~> 2.0",
- # Rake version has to be consistent for tests to pass
- "rake" => "12.3.2",
- "builder" => "~> 3.2",
- # ruby-graphviz is used by the viz tests
- "ruby-graphviz" => ">= 0.a",
- }.freeze
-
extend self
def dev_setup
- deps = DEV_DEPS
-
- # JRuby can't build ronn, so we skip that
- deps.delete("ronn") if RUBY_ENGINE == "jruby"
-
- install_gems(deps)
+ install_gems(dev_gemfile, dev_lockfile)
end
def gem_load(gem_name, bin_container)
- require_relative "rubygems_version_manager"
- RubygemsVersionManager.new(ENV["RGV"]).switch
+ require_relative "switch_rubygems"
gem_load_and_activate(gem_name, bin_container)
end
@@ -50,25 +23,10 @@ module Spec
require gem_name
end
- def setup
- require "fileutils"
-
- Gem.clear_paths
-
- ENV["BUNDLE_PATH"] = nil
- ENV["GEM_HOME"] = ENV["GEM_PATH"] = Path.base_system_gems.to_s
- ENV["PATH"] = [Path.bindir, Path.system_gem_path.join("bin"), ENV["PATH"]].join(File::PATH_SEPARATOR)
+ def test_setup
+ setup_test_paths
- manifest = DEPS.to_a.sort_by(&:first).map {|k, v| "#{k} => #{v}\n" }
- manifest_path = Path.base_system_gems.join("manifest.txt")
- # it's OK if there are extra gems
- if !manifest_path.file? || !(manifest - manifest_path.readlines).empty?
- FileUtils.rm_rf(Path.base_system_gems)
- FileUtils.mkdir_p(Path.base_system_gems)
- puts "installing gems for the tests to use..."
- install_gems(DEPS)
- manifest_path.open("wb") {|f| f << manifest.join }
- end
+ require "fileutils"
FileUtils.mkdir_p(Path.home)
FileUtils.mkdir_p(Path.tmpdir)
@@ -80,8 +38,52 @@ module Spec
Gem::DefaultUserInteraction.ui = Gem::SilentUI.new
end
+ def install_parallel_test_deps
+ require "parallel"
+
+ prev_env_test_number = ENV["TEST_ENV_NUMBER"]
+
+ begin
+ Parallel.processor_count.times do |n|
+ ENV["TEST_ENV_NUMBER"] = (n + 1).to_s
+
+ install_test_deps
+ end
+ ensure
+ ENV["TEST_ENV_NUMBER"] = prev_env_test_number
+ end
+ end
+
+ def setup_test_paths
+ Gem.clear_paths
+
+ ENV["BUNDLE_PATH"] = nil
+ ENV["GEM_HOME"] = ENV["GEM_PATH"] = Path.base_system_gems.to_s
+ ENV["PATH"] = [Path.bindir, Path.system_gem_path.join("bin"), ENV["PATH"]].join(File::PATH_SEPARATOR)
+ end
+
+ def install_test_deps
+ setup_test_paths
+
+ workaround_loaded_specs_issue
+
+ install_gems(test_gemfile, test_lockfile)
+ end
+
private
+ # Some rubygems versions include loaded specs when loading gemspec stubs
+ # from the file system. In this situation, that makes bundler incorrectly
+ # assume that `rake` is already installed at `tmp/` because it's installed
+ # globally, and makes it skip installing it to the proper location for our
+ # tests. To workaround, we remove `rake` from the loaded specs when running
+ # under those versions, so that `bundler` does the right thing.
+ def workaround_loaded_specs_issue
+ current_rubygems_version = Gem::Version.new(Gem::VERSION)
+
+ Gem.loaded_specs.delete("rake") if current_rubygems_version >= Gem::Version.new("3.0.0.beta2") && current_rubygems_version < Gem::Version.new("3.2.0")
+ end
+
def gem_load_and_activate(gem_name, bin_container)
gem_activate(gem_name)
load Gem.bin_path(gem_name, bin_container)
@@ -90,18 +92,40 @@ module Spec
end
def gem_activate(gem_name)
- gem_requirement = DEV_DEPS[gem_name]
+ require "bundler"
+ gem_requirement = Bundler::LockfileParser.new(File.read(dev_lockfile)).dependencies[gem_name]&.requirement
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 = ENV["GEM_COMMAND"] || "#{Gem.ruby} -S gem --backtrace"
- cmd = "#{gem} install #{deps} --no-document --conservative"
- system(cmd) || raise("Installing gems #{deps} for the tests to use failed!")
+ def install_gems(gemfile, lockfile)
+ old_gemfile = ENV["BUNDLE_GEMFILE"]
+ ENV["BUNDLE_GEMFILE"] = gemfile.to_s
+ require "bundler"
+ definition = Bundler::Definition.build(gemfile, lockfile, nil)
+ definition.validate_runtime!
+ Bundler::Installer.install(Path.root, definition, :path => ENV["GEM_HOME"])
+ ensure
+ ENV["BUNDLE_GEMFILE"] = old_gemfile
+ end
+
+ def test_gemfile
+ Path.root.join("test_gems.rb")
+ end
+
+ def test_lockfile
+ lockfile_for(test_gemfile)
+ end
+
+ def dev_gemfile
+ Path.root.join("dev_gems.rb")
+ end
+
+ def dev_lockfile
+ lockfile_for(dev_gemfile)
+ end
+
+ def lockfile_for(gemfile)
+ Pathname.new("#{gemfile.expand_path}.lock")
end
end
end
diff --git a/spec/bundler/support/rubygems_version_manager.rb b/spec/bundler/support/rubygems_version_manager.rb
index 854bce890d..aa4cfc460b 100644
--- a/spec/bundler/support/rubygems_version_manager.rb
+++ b/spec/bundler/support/rubygems_version_manager.rb
@@ -15,11 +15,34 @@ class RubygemsVersionManager
def switch
return if use_system?
+ assert_system_features_not_loaded!
+
switch_local_copy_if_needed
reexec_if_needed
end
+ def assert_system_features_not_loaded!
+ at_exit do
+ rubylibdir = RbConfig::CONFIG["rubylibdir"]
+
+ rubygems_path = rubylibdir + "/rubygems"
+ rubygems_default_path = rubygems_path + "/defaults"
+
+ bundler_path = rubylibdir + "/bundler"
+ bundler_exemptions = Gem.rubygems_version < Gem::Version.new("3.2.0") ? [bundler_path + "/errors.rb"] : []
+
+ bad_loaded_features = $LOADED_FEATURES.select do |loaded_feature|
+ (loaded_feature.start_with?(rubygems_path) && !loaded_feature.start_with?(rubygems_default_path)) ||
+ (loaded_feature.start_with?(bundler_path) && !bundler_exemptions.any? {|bundler_exemption| loaded_feature.start_with?(bundler_exemption) })
+ end
+
+ if bad_loaded_features.any?
+ raise "the following features were incorrectly loaded:\n#{bad_loaded_features.join("\n")}"
+ end
+ end
+ end
+
private
def use_system?
@@ -36,7 +59,7 @@ private
cmd = [ruby, $0, *ARGV].compact
- ENV["RUBYOPT"] = "-I#{local_copy_path.join("lib")} #{ENV["RUBYOPT"]}"
+ ENV["RUBYOPT"] = opt_add("-I#{local_copy_path.join("lib")}", opt_remove("--disable-gems", ENV["RUBYOPT"]))
exec(ENV, *cmd)
end
@@ -44,10 +67,8 @@ private
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} --quiet")
- end
+ sys_exec!("git remote update", :dir => local_copy_path)
+ sys_exec!("git checkout #{target_tag} --quiet", :dir => local_copy_path)
ENV["RGV"] = local_copy_path.to_s
end
@@ -65,9 +86,7 @@ private
end
def local_copy_tag
- Dir.chdir(local_copy_path) do
- sys_exec!("git rev-parse --abbrev-ref HEAD")
- end
+ sys_exec!("git rev-parse --abbrev-ref HEAD", :dir => local_copy_path)
end
def local_copy_path
diff --git a/spec/bundler/support/switch_rubygems.rb b/spec/bundler/support/switch_rubygems.rb
new file mode 100644
index 0000000000..d3dd685d31
--- /dev/null
+++ b/spec/bundler/support/switch_rubygems.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+require_relative "rubygems_version_manager"
+RubygemsVersionManager.new(ENV["RGV"]).switch
+
+if ENV["BUNDLER_SPEC_IGNORE_DEFAULT_BUNDLER_GEM"]
+ module NoBundlerStubs
+ def default_stubs(pattern = "*.gemspec")
+ super(pattern).reject {|s| s.name == "bundler" }
+ end
+ end
+
+ Gem::Specification.singleton_class.prepend(NoBundlerStubs)
+end
diff --git a/spec/bundler/update/gemfile_spec.rb b/spec/bundler/update/gemfile_spec.rb
index 8c2bd9ccbf..4a902e59e2 100644
--- a/spec/bundler/update/gemfile_spec.rb
+++ b/spec/bundler/update/gemfile_spec.rb
@@ -38,12 +38,10 @@ RSpec.describe "bundle update" do
it "uses the gemfile while in a subdirectory" do
bundled_app("subdir").mkpath
- Dir.chdir(bundled_app("subdir")) do
- bundle! "update", :all => true
- bundle "list"
+ bundle! "update", :all => true, :dir => bundled_app("subdir")
+ bundle "list", :dir => bundled_app("subdir")
- expect(out).to include("rack (1.0.0)")
- end
+ expect(out).to include("rack (1.0.0)")
end
end
end
diff --git a/spec/bundler/update/git_spec.rb b/spec/bundler/update/git_spec.rb
index 752033c842..71f0e8496a 100644
--- a/spec/bundler/update/git_spec.rb
+++ b/spec/bundler/update/git_spec.rb
@@ -75,6 +75,8 @@ RSpec.describe "bundle update" do
end
it "notices when you change the repo url in the Gemfile" do
+ skip "some of monorepo issues" if Gem.win_platform?
+
build_git "foo", :path => lib_path("foo_one")
build_git "foo", :path => lib_path("foo_two")
@@ -131,10 +133,8 @@ RSpec.describe "bundle update" do
s.add_dependency "submodule"
end
- 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
+ sys_exec "git submodule add #{lib_path("submodule-1.0")} submodule-1.0", :dir => lib_path("has_submodule-1.0")
+ sys_exec "git commit -m \"submodulator\"", :dir => lib_path("has_submodule-1.0")
end
it "it unlocks the source when submodules are added to a git source" do
@@ -183,6 +183,8 @@ RSpec.describe "bundle update" do
end
it "errors with a message when the .git repo is gone" do
+ skip "some of monorepo issues" if Gem.win_platform?
+
build_git "foo", "1.0"
install_gemfile <<-G
@@ -214,24 +216,15 @@ RSpec.describe "bundle update" do
end
it "shows the previous version of the gem" do
- build_git "rails", "3.0", :path => lib_path("rails")
+ skip "some of monorepo issues" if Gem.win_platform?
+
+ build_git "rails", "2.3.2", :path => lib_path("rails")
install_gemfile <<-G
gem "rails", :git => "#{lib_path("rails")}"
G
- lockfile <<-G
- GIT
- remote: #{lib_path("rails")}
- specs:
- rails (2.3.2)
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- rails!
- G
+ update_git "rails", "3.0", :path => lib_path("rails"), :gemspec => true
bundle "update", :all => true
expect(out).to include("Using rails 3.0 (was 2.3.2) from #{lib_path("rails")} (at master@#{revision_for(lib_path("rails"))[0..6]})")
@@ -259,14 +252,12 @@ RSpec.describe "bundle update" do
bundle "update --source foo"
- in_app_root do
- run <<-RUBY
- require 'foo'
- puts "WIN" if defined?(FOO_PREV_REF)
- RUBY
+ run <<-RUBY
+ require 'foo'
+ puts "WIN" if defined?(FOO_PREV_REF)
+ RUBY
- expect(out).to eq("WIN")
- end
+ expect(out).to eq("WIN")
end
it "unlocks gems that were originally pulled in by the source" do