summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/bundler.rb75
-rw-r--r--lib/bundler/bundler.gemspec15
-rw-r--r--lib/bundler/capistrano.rb2
-rw-r--r--lib/bundler/cli.rb174
-rw-r--r--lib/bundler/cli/cache.rb2
-rw-r--r--lib/bundler/cli/common.rb12
-rw-r--r--lib/bundler/cli/config.rb247
-rw-r--r--lib/bundler/cli/console.rb4
-rw-r--r--lib/bundler/cli/doctor.rb4
-rw-r--r--lib/bundler/cli/gem.rb6
-rw-r--r--lib/bundler/cli/info.rb22
-rw-r--r--lib/bundler/cli/init.rb2
-rw-r--r--lib/bundler/cli/install.rb19
-rw-r--r--lib/bundler/cli/issue.rb4
-rw-r--r--lib/bundler/cli/outdated.rb8
-rw-r--r--lib/bundler/cli/package.rb2
-rw-r--r--lib/bundler/cli/plugin.rb9
-rw-r--r--lib/bundler/cli/pristine.rb2
-rw-r--r--lib/bundler/cli/show.rb2
-rw-r--r--lib/bundler/cli/update.rb2
-rw-r--r--lib/bundler/compact_index_client.rb30
-rw-r--r--lib/bundler/compact_index_client/updater.rb6
-rw-r--r--lib/bundler/compatibility_guard.rb5
-rw-r--r--lib/bundler/definition.rb20
-rw-r--r--lib/bundler/deployment.rb2
-rw-r--r--lib/bundler/dsl.rb51
-rw-r--r--lib/bundler/env.rb10
-rw-r--r--lib/bundler/feature_flag.rb11
-rw-r--r--lib/bundler/fetcher.rb10
-rw-r--r--lib/bundler/fetcher/compact_index.rb32
-rw-r--r--lib/bundler/fetcher/downloader.rb4
-rw-r--r--lib/bundler/friendly_errors.rb5
-rw-r--r--lib/bundler/gem_helper.rb48
-rw-r--r--lib/bundler/gem_helpers.rb2
-rw-r--r--lib/bundler/gem_version_promoter.rb2
-rw-r--r--lib/bundler/graph.rb4
-rw-r--r--lib/bundler/injector.rb14
-rw-r--r--lib/bundler/inline.rb1
-rw-r--r--lib/bundler/installer.rb11
-rw-r--r--lib/bundler/installer/gem_installer.rb6
-rw-r--r--lib/bundler/installer/parallel_installer.rb8
-rw-r--r--lib/bundler/lazy_specification.rb2
-rw-r--r--lib/bundler/lockfile_parser.rb24
-rw-r--r--lib/bundler/plugin.rb44
-rw-r--r--lib/bundler/plugin/api/source.rb2
-rw-r--r--lib/bundler/plugin/index.rb13
-rw-r--r--lib/bundler/plugin/installer.rb39
-rw-r--r--lib/bundler/resolver.rb90
-rw-r--r--lib/bundler/resolver/spec_group.rb4
-rw-r--r--lib/bundler/retry.rb4
-rw-r--r--lib/bundler/ruby_version.rb4
-rw-r--r--lib/bundler/rubygems_ext.rb15
-rw-r--r--lib/bundler/rubygems_gem_installer.rb2
-rw-r--r--lib/bundler/rubygems_integration.rb59
-rw-r--r--lib/bundler/runtime.rb2
-rw-r--r--lib/bundler/settings.rb40
-rw-r--r--lib/bundler/setup.rb7
-rw-r--r--lib/bundler/shared_helpers.rb49
-rw-r--r--lib/bundler/similarity_detector.rb2
-rw-r--r--lib/bundler/source/git.rb17
-rw-r--r--lib/bundler/source/git/git_proxy.rb2
-rw-r--r--lib/bundler/source/metadata.rb6
-rw-r--r--lib/bundler/source/path.rb8
-rw-r--r--lib/bundler/source/rubygems.rb14
-rw-r--r--lib/bundler/source_list.rb21
-rw-r--r--lib/bundler/spec_set.rb1
-rw-r--r--lib/bundler/ssl_certs/.document1
-rw-r--r--lib/bundler/ssl_certs/certificate_manager.rb66
-rw-r--r--lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem21
-rw-r--r--lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem23
-rw-r--r--lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem25
-rw-r--r--lib/bundler/stub_specification.rb42
-rw-r--r--lib/bundler/templates/Executable.bundler2
-rw-r--r--lib/bundler/templates/newgem/README.md.tt2
-rw-r--r--lib/bundler/templates/newgem/newgem.gemspec.tt23
-rw-r--r--lib/bundler/templates/newgem/test/test_helper.rb.tt2
-rw-r--r--lib/bundler/templates/newgem/travis.yml.tt1
-rw-r--r--lib/bundler/vendor/fileutils/lib/fileutils.rb199
-rw-r--r--lib/bundler/vendor/fileutils/lib/fileutils/version.rb5
-rw-r--r--lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb38
-rw-r--r--lib/bundler/vendor/thor/lib/thor/actions.rb18
-rw-r--r--lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb13
-rw-r--r--lib/bundler/vendor/thor/lib/thor/base.rb9
-rw-r--r--lib/bundler/vendor/thor/lib/thor/error.rb82
-rw-r--r--lib/bundler/vendor/thor/lib/thor/group.rb4
-rw-r--r--lib/bundler/vendor/thor/lib/thor/parser/options.rb9
-rw-r--r--lib/bundler/vendor/thor/lib/thor/runner.rb4
-rw-r--r--lib/bundler/vendor/thor/lib/thor/shell.rb2
-rw-r--r--lib/bundler/vendor/thor/lib/thor/shell/basic.rb59
-rw-r--r--lib/bundler/vendor/thor/lib/thor/util.rb2
-rw-r--r--lib/bundler/vendor/thor/lib/thor/version.rb2
-rw-r--r--lib/bundler/version.rb5
-rw-r--r--lib/bundler/version_ranges.rb56
-rw-r--r--lib/bundler/vlad.rb2
-rw-r--r--lib/bundler/worker.rb4
-rw-r--r--lib/bundler/yaml_serializer.rb5
-rwxr-xr-xlibexec/bundle_ruby60
-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.txt40
-rw-r--r--man/bundle-check.12
-rw-r--r--man/bundle-check.1.txt32
-rw-r--r--man/bundle-clean.12
-rw-r--r--man/bundle-clean.1.txt20
-rw-r--r--man/bundle-config.162
-rw-r--r--man/bundle-config.1.txt474
-rw-r--r--man/bundle-config.ronn68
-rw-r--r--man/bundle-doctor.12
-rw-r--r--man/bundle-doctor.1.txt22
-rw-r--r--man/bundle-exec.12
-rw-r--r--man/bundle-exec.1.txt136
-rw-r--r--man/bundle-gem.12
-rw-r--r--man/bundle-gem.1.txt92
-rw-r--r--man/bundle-info.12
-rw-r--r--man/bundle-info.1.txt16
-rw-r--r--man/bundle-init.14
-rw-r--r--man/bundle-init.1.txt36
-rw-r--r--man/bundle-init.ronn2
-rw-r--r--man/bundle-inject.12
-rw-r--r--man/bundle-inject.1.txt18
-rw-r--r--man/bundle-install.113
-rw-r--r--man/bundle-install.1.txt397
-rw-r--r--man/bundle-install.ronn13
-rw-r--r--man/bundle-list.12
-rw-r--r--man/bundle-list.1.txt22
-rw-r--r--man/bundle-lock.12
-rw-r--r--man/bundle-lock.1.txt96
-rw-r--r--man/bundle-open.12
-rw-r--r--man/bundle-open.1.txt14
-rw-r--r--man/bundle-outdated.12
-rw-r--r--man/bundle-outdated.1.txt84
-rw-r--r--man/bundle-package.12
-rw-r--r--man/bundle-package.1.txt82
-rw-r--r--man/bundle-platform.12
-rw-r--r--man/bundle-platform.1.txt26
-rw-r--r--man/bundle-pristine.12
-rw-r--r--man/bundle-pristine.1.txt42
-rw-r--r--man/bundle-remove.12
-rw-r--r--man/bundle-remove.1.txt22
-rw-r--r--man/bundle-show.12
-rw-r--r--man/bundle-show.1.txt24
-rw-r--r--man/bundle-update.18
-rw-r--r--man/bundle-update.1.txt267
-rw-r--r--man/bundle-update.ronn6
-rw-r--r--man/bundle-viz.12
-rw-r--r--man/bundle-viz.1.txt34
-rw-r--r--man/bundle.14
-rw-r--r--man/bundle.1.txt104
-rw-r--r--man/bundle.ronn2
-rw-r--r--man/gemfile.54
-rw-r--r--man/gemfile.5.ronn2
-rw-r--r--man/gemfile.5.txt438
-rw-r--r--spec/bundler/bundler/bundler_spec.rb16
-rw-r--r--spec/bundler/bundler/cli_spec.rb12
-rw-r--r--spec/bundler/bundler/definition_spec.rb49
-rw-r--r--spec/bundler/bundler/dsl_spec.rb94
-rw-r--r--spec/bundler/bundler/fetcher/compact_index_spec.rb2
-rw-r--r--spec/bundler/bundler/fetcher/downloader_spec.rb12
-rw-r--r--spec/bundler/bundler/friendly_errors_spec.rb17
-rw-r--r--spec/bundler/bundler/gem_helper_spec.rb27
-rw-r--r--spec/bundler/bundler/installer/gem_installer_spec.rb15
-rw-r--r--spec/bundler/bundler/mirror_spec.rb4
-rw-r--r--spec/bundler/bundler/plugin/index_spec.rb11
-rw-r--r--spec/bundler/bundler/plugin/installer_spec.rb35
-rw-r--r--spec/bundler/bundler/plugin_spec.rb23
-rw-r--r--spec/bundler/bundler/rubygems_integration_spec.rb22
-rw-r--r--spec/bundler/bundler/settings_spec.rb4
-rw-r--r--spec/bundler/bundler/shared_helpers_spec.rb8
-rw-r--r--spec/bundler/bundler/source/git/git_proxy_spec.rb32
-rw-r--r--spec/bundler/bundler/source/rubygems/remote_spec.rb24
-rw-r--r--spec/bundler/bundler/source_list_spec.rb16
-rw-r--r--spec/bundler/bundler/ssl_certs/certificate_manager_spec.rb140
-rw-r--r--spec/bundler/bundler/stub_specification_spec.rb10
-rw-r--r--spec/bundler/bundler/ui/shell_spec.rb12
-rw-r--r--spec/bundler/bundler/ui_spec.rb4
-rw-r--r--spec/bundler/bundler/vendored_persistent_spec.rb3
-rw-r--r--spec/bundler/bundler/version_ranges_spec.rb3
-rw-r--r--spec/bundler/cache/cache_path_spec.rb2
-rw-r--r--spec/bundler/cache/gems_spec.rb14
-rw-r--r--spec/bundler/cache/git_spec.rb10
-rw-r--r--spec/bundler/cache/path_spec.rb2
-rw-r--r--spec/bundler/cache/platform_spec.rb2
-rw-r--r--spec/bundler/commands/add_spec.rb32
-rw-r--r--spec/bundler/commands/binstubs_spec.rb78
-rw-r--r--spec/bundler/commands/check_spec.rb20
-rw-r--r--spec/bundler/commands/clean_spec.rb79
-rw-r--r--spec/bundler/commands/config_spec.rb237
-rw-r--r--spec/bundler/commands/console_spec.rb6
-rw-r--r--spec/bundler/commands/exec_spec.rb211
-rw-r--r--spec/bundler/commands/help_spec.rb11
-rw-r--r--spec/bundler/commands/info_spec.rb118
-rw-r--r--spec/bundler/commands/init_spec.rb102
-rw-r--r--spec/bundler/commands/inject_spec.rb10
-rw-r--r--spec/bundler/commands/install_spec.rb46
-rw-r--r--spec/bundler/commands/licenses_spec.rb11
-rw-r--r--spec/bundler/commands/list_spec.rb83
-rw-r--r--spec/bundler/commands/lock_spec.rb54
-rw-r--r--spec/bundler/commands/newgem_spec.rb54
-rw-r--r--spec/bundler/commands/open_spec.rb6
-rw-r--r--spec/bundler/commands/outdated_spec.rb50
-rw-r--r--spec/bundler/commands/package_spec.rb24
-rw-r--r--spec/bundler/commands/pristine_spec.rb16
-rw-r--r--spec/bundler/commands/remove_spec.rb52
-rw-r--r--spec/bundler/commands/show_spec.rb102
-rw-r--r--spec/bundler/commands/update_spec.rb76
-rw-r--r--spec/bundler/commands/viz_spec.rb2
-rw-r--r--spec/bundler/install/allow_offline_install_spec.rb10
-rw-r--r--spec/bundler/install/binstubs_spec.rb21
-rw-r--r--spec/bundler/install/bundler_spec.rb14
-rw-r--r--spec/bundler/install/deploy_spec.rb126
-rw-r--r--spec/bundler/install/failure_spec.rb19
-rw-r--r--spec/bundler/install/gemfile/gemspec_spec.rb123
-rw-r--r--spec/bundler/install/gemfile/git_spec.rb206
-rw-r--r--spec/bundler/install/gemfile/groups_spec.rb8
-rw-r--r--spec/bundler/install/gemfile/lockfile_spec.rb2
-rw-r--r--spec/bundler/install/gemfile/path_spec.rb40
-rw-r--r--spec/bundler/install/gemfile/platform_spec.rb11
-rw-r--r--spec/bundler/install/gemfile/ruby_spec.rb2
-rw-r--r--spec/bundler/install/gemfile/sources_spec.rb147
-rw-r--r--spec/bundler/install/gemfile/specific_platform_spec.rb2
-rw-r--r--spec/bundler/install/gemfile_spec.rb27
-rw-r--r--spec/bundler/install/gems/compact_index_spec.rb44
-rw-r--r--spec/bundler/install/gems/dependency_api_spec.rb28
-rw-r--r--spec/bundler/install/gems/flex_spec.rb12
-rw-r--r--spec/bundler/install/gems/mirror_spec.rb4
-rw-r--r--spec/bundler/install/gems/native_extensions_spec.rb45
-rw-r--r--spec/bundler/install/gems/post_install_spec.rb4
-rw-r--r--spec/bundler/install/gems/resolving_spec.rb37
-rw-r--r--spec/bundler/install/gems/standalone_spec.rb6
-rw-r--r--spec/bundler/install/gems/sudo_spec.rb18
-rw-r--r--spec/bundler/install/gemspecs_spec.rb19
-rw-r--r--spec/bundler/install/git_spec.rb2
-rw-r--r--spec/bundler/install/global_cache_spec.rb10
-rw-r--r--spec/bundler/install/path_spec.rb16
-rw-r--r--spec/bundler/install/post_bundle_message_spec.rb14
-rw-r--r--spec/bundler/install/process_lock_spec.rb2
-rw-r--r--spec/bundler/install/redownload_spec.rb14
-rw-r--r--spec/bundler/install/security_policy_spec.rb13
-rw-r--r--spec/bundler/install/yanked_spec.rb14
-rw-r--r--spec/bundler/lock/lockfile_bundler_1_spec.rb1386
-rw-r--r--spec/bundler/lock/lockfile_spec.rb288
-rw-r--r--spec/bundler/other/bundle_ruby_spec.rb155
-rw-r--r--spec/bundler/other/cli_dispatch_spec.rb2
-rw-r--r--spec/bundler/other/compatibility_guard_spec.rb9
-rw-r--r--spec/bundler/other/ext_spec.rb7
-rw-r--r--spec/bundler/other/major_deprecation_spec.rb473
-rw-r--r--spec/bundler/other/platform_spec.rb28
-rw-r--r--spec/bundler/other/ssl_cert_spec.rb18
-rw-r--r--spec/bundler/plugins/command_spec.rb4
-rw-r--r--spec/bundler/plugins/install_spec.rb58
-rw-r--r--spec/bundler/plugins/list_spec.rb60
-rw-r--r--spec/bundler/plugins/source/example_spec.rb16
-rw-r--r--spec/bundler/quality_es_spec.rb70
-rw-r--r--spec/bundler/quality_spec.rb39
-rw-r--r--spec/bundler/realworld/dependency_api_spec.rb4
-rw-r--r--spec/bundler/realworld/double_check_spec.rb2
-rw-r--r--spec/bundler/realworld/edgecases_spec.rb61
-rw-r--r--spec/bundler/realworld/gemfile_source_header_spec.rb6
-rw-r--r--spec/bundler/realworld/mirror_probe_spec.rb18
-rw-r--r--spec/bundler/realworld/parallel_spec.rb14
-rw-r--r--spec/bundler/resolver/basic_spec.rb8
-rw-r--r--spec/bundler/runtime/executable_spec.rb17
-rw-r--r--spec/bundler/runtime/gem_tasks_spec.rb2
-rw-r--r--spec/bundler/runtime/inline_spec.rb29
-rw-r--r--spec/bundler/runtime/platform_spec.rb4
-rw-r--r--spec/bundler/runtime/require_spec.rb32
-rw-r--r--spec/bundler/runtime/setup_spec.rb178
-rw-r--r--spec/bundler/runtime/with_clean_env_spec.rb151
-rw-r--r--spec/bundler/runtime/with_unbundled_env_spec.rb241
-rw-r--r--spec/bundler/spec_helper.rb48
-rw-r--r--spec/bundler/support/artifice/compact_index.rb12
-rw-r--r--spec/bundler/support/artifice/compact_index_api_missing.rb2
-rw-r--r--spec/bundler/support/artifice/compact_index_rate_limited.rb48
-rw-r--r--spec/bundler/support/artifice/endpoint.rb2
-rw-r--r--spec/bundler/support/artifice/endpoint_api_missing.rb2
-rw-r--r--spec/bundler/support/artifice/vcr.rb7
-rw-r--r--spec/bundler/support/builders.rb12
-rw-r--r--spec/bundler/support/helpers.rb72
-rw-r--r--spec/bundler/support/indexes.rb4
-rw-r--r--spec/bundler/support/less_than_proc.rb20
-rw-r--r--spec/bundler/support/matchers.rb50
-rw-r--r--spec/bundler/support/path.rb2
-rw-r--r--spec/bundler/support/platforms.rb5
-rw-r--r--spec/bundler/support/requirement_checker.rb11
-rw-r--r--spec/bundler/support/rubygems_ext.rb42
-rw-r--r--spec/bundler/update/gemfile_spec.rb25
-rw-r--r--spec/bundler/update/gems/post_install_spec.rb6
-rw-r--r--spec/bundler/update/git_spec.rb24
-rw-r--r--spec/bundler/update/redownload_spec.rb16
290 files changed, 5780 insertions, 6121 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb
index cf3a289df2..f792a3bc98 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -5,7 +5,6 @@ require "bundler/compatibility_guard"
require "bundler/vendored_fileutils"
require "pathname"
require "rbconfig"
-require "thread"
require "bundler/errors"
require "bundler/environment_preserver"
@@ -119,7 +118,7 @@ module Bundler
end
def environment
- SharedHelpers.major_deprecation 3, "Bundler.environment has been removed in favor of Bundler.load"
+ SharedHelpers.major_deprecation 2, "Bundler.environment has been removed in favor of Bundler.load"
load
end
@@ -280,10 +279,19 @@ EOF
ORIGINAL_ENV.clone
end
- # @deprecated Use `original_env` instead
- # @return [Hash] Environment with all bundler-related variables removed
+ # @deprecated Use `unbundled_env` instead
def clean_env
- Bundler::SharedHelpers.major_deprecation(3, "`Bundler.clean_env` has weird edge cases, use `.original_env` instead")
+ Bundler::SharedHelpers.major_deprecation(
+ 2,
+ "`Bundler.clean_env` has been deprecated in favor of `Bundler.unbundled_env`. " \
+ "If you instead want the environment before bundler was originally loaded, use `Bundler.original_env`"
+ )
+
+ unbundled_env
+ end
+
+ # @return [Hash] Environment with all bundler-related variables removed
+ def unbundled_env
env = original_env
if env.key?("BUNDLER_ORIG_MANPATH")
@@ -305,20 +313,67 @@ EOF
env
end
+ # Run block with environment present before Bundler was activated
def with_original_env
with_env(original_env) { yield }
end
+ # @deprecated Use `with_unbundled_env` instead
def with_clean_env
- with_env(clean_env) { yield }
+ Bundler::SharedHelpers.major_deprecation(
+ 2,
+ "`Bundler.with_clean_env` has been deprecated in favor of `Bundler.with_unbundled_env`. " \
+ "If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env`"
+ )
+
+ with_env(unbundled_env) { yield }
+ end
+
+ # Run block with all bundler-related variables removed
+ def with_unbundled_env
+ with_env(unbundled_env) { yield }
+ end
+
+ # Run subcommand with the environment present before Bundler was activated
+ def original_system(*args)
+ with_original_env { Kernel.system(*args) }
end
+ # @deprecated Use `unbundled_system` instead
def clean_system(*args)
- with_clean_env { Kernel.system(*args) }
+ Bundler::SharedHelpers.major_deprecation(
+ 2,
+ "`Bundler.clean_system` has been deprecated in favor of `Bundler.unbundled_system`. " \
+ "If you instead want to run the command in the environment before bundler was originally loaded, use `Bundler.original_system`"
+ )
+
+ with_env(unbundled_env) { Kernel.system(*args) }
end
+ # Run subcommand in an environment with all bundler related variables removed
+ def unbundled_system(*args)
+ with_unbundled_env { Kernel.system(*args) }
+ end
+
+ # Run a `Kernel.exec` to a subcommand with the environment present before Bundler was activated
+ def original_exec(*args)
+ with_original_env { Kernel.exec(*args) }
+ end
+
+ # @deprecated Use `unbundled_exec` instead
def clean_exec(*args)
- with_clean_env { Kernel.exec(*args) }
+ Bundler::SharedHelpers.major_deprecation(
+ 2,
+ "`Bundler.clean_exec` has been deprecated in favor of `Bundler.unbundled_exec`. " \
+ "If you instead want to exec to a command in the environment before bundler was originally loaded, use `Bundler.original_exec`"
+ )
+
+ with_env(unbundled_env) { Kernel.exec(*args) }
+ end
+
+ # Run a `Kernel.exec` to a subcommand in an environment with all bundler related variables removed
+ def unbundled_exec(*args)
+ with_env(unbundled_env) { Kernel.exec(*args) }
end
def local_platform
@@ -343,7 +398,7 @@ EOF
# system binaries. If you put '-n foo' in your .gemrc, RubyGems will
# install binstubs there instead. Unfortunately, RubyGems doesn't expose
# that directory at all, so rather than parse .gemrc ourselves, we allow
- # the directory to be set as well, via `bundle config bindir foo`.
+ # the directory to be set as well, via `bundle config set bindir foo`.
Bundler.settings[:system_bindir] || Bundler.rubygems.gem_bindir
end
@@ -523,7 +578,7 @@ EOF
rescue ScriptError, StandardError => e
msg = "There was an error while loading `#{path.basename}`: #{e.message}"
- if e.is_a?(LoadError) && RUBY_VERSION >= "1.9"
+ if e.is_a?(LoadError)
msg += "\nDoes it try to require a relative path? That's been removed in Ruby 1.9"
end
diff --git a/lib/bundler/bundler.gemspec b/lib/bundler/bundler.gemspec
index b229ab224d..d8abb2b16f 100644
--- a/lib/bundler/bundler.gemspec
+++ b/lib/bundler/bundler.gemspec
@@ -1,4 +1,3 @@
-# coding: utf-8
# frozen_string_literal: true
begin
@@ -19,16 +18,16 @@ Gem::Specification.new do |s|
"Yehuda Katz"
]
s.email = ["team@bundler.io"]
- s.homepage = "http://bundler.io"
+ s.homepage = "https://bundler.io"
s.summary = "The best way to manage your application's dependencies"
s.description = "Bundler manages an application's dependencies through its entire life, across many machines, systematically and repeatably"
if s.respond_to?(:metadata=)
s.metadata = {
- "bug_tracker_uri" => "http://github.com/bundler/bundler/issues",
+ "bug_tracker_uri" => "https://github.com/bundler/bundler/issues",
"changelog_uri" => "https://github.com/bundler/bundler/blob/master/CHANGELOG.md",
"homepage_uri" => "https://bundler.io/",
- "source_code_uri" => "http://github.com/bundler/bundler/",
+ "source_code_uri" => "https://github.com/bundler/bundler/",
}
end
@@ -41,14 +40,12 @@ Gem::Specification.new do |s|
end
s.add_development_dependency "automatiek", "~> 0.1.0"
- s.add_development_dependency "mustache", "0.99.6"
- s.add_development_dependency "rake", "~> 10.0"
- s.add_development_dependency "rdiscount", "~> 2.2"
+ s.add_development_dependency "rake", "~> 12.0"
s.add_development_dependency "ronn", "~> 0.7.3"
s.add_development_dependency "rspec", "~> 3.6"
+ s.add_development_dependency "rubocop", "= 0.65.0"
- # base_dir = File.dirname(__FILE__).gsub(%r{([^A-Za-z0-9_\-.,:\/@\n])}, "\\\\\\1")
- # s.files = IO.popen("git -C #{base_dir} ls-files -z", &:read).split("\x0").select {|f| f.match(%r{^(lib|exe)/}) }
+ # s.files = Dir.glob("{lib,exe}/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) }
# we don't check in man pages, but we need to ship them because
# we use them to generate the long-form help for each command.
diff --git a/lib/bundler/capistrano.rb b/lib/bundler/capistrano.rb
index 40e2e5dbe8..1b7145b72b 100644
--- a/lib/bundler/capistrano.rb
+++ b/lib/bundler/capistrano.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
require "bundler/shared_helpers"
-Bundler::SharedHelpers.major_deprecation 3,
+Bundler::SharedHelpers.major_deprecation 2,
"The Bundler task for Capistrano. Please use http://github.com/capistrano/bundler"
# Capistrano task for Bundler.
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index 3efe193613..4e3735847e 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -16,7 +16,7 @@ module Bundler
def self.start(*)
super
- rescue Exception => e
+ rescue Exception => e # rubocop:disable Lint/RescueException
Bundler.ui = UI::Shell.new
raise e
ensure
@@ -61,11 +61,6 @@ module Bundler
end
end
- def self.deprecated_option(*args, &blk)
- return if Bundler.feature_flag.forget_cli_options?
- method_option(*args, &blk)
- end
-
check_unknown_options!(:except => [:config, :exec])
stop_on_unknown_option! :exec
@@ -142,7 +137,7 @@ module Bundler
Gemfile to a gem with a gemspec, the --gemspec option will automatically add each
dependency listed in the gemspec file to the newly created Gemfile.
D
- deprecated_option "gemspec", :type => :string, :banner => "Use the specified .gemspec to create the Gemfile"
+ method_option "gemspec", :type => :string, :banner => "Use the specified .gemspec to create the Gemfile"
def init
require "bundler/cli/init"
Init.new(options.dup).run
@@ -188,13 +183,13 @@ module Bundler
If the bundle has already been installed, bundler will tell you so and then exit.
D
- deprecated_option "binstubs", :type => :string, :lazy_default => "bin", :banner =>
+ method_option "binstubs", :type => :string, :lazy_default => "bin", :banner =>
"Generate bin stubs for bundled gems to ./bin"
- deprecated_option "clean", :type => :boolean, :banner =>
+ method_option "clean", :type => :boolean, :banner =>
"Run bundle clean automatically after install"
- deprecated_option "deployment", :type => :boolean, :banner =>
+ method_option "deployment", :type => :boolean, :banner =>
"Install using defaults tuned for deployment environments"
- deprecated_option "frozen", :type => :boolean, :banner =>
+ method_option "frozen", :type => :boolean, :banner =>
"Do not allow the Gemfile.lock to be updated after this install"
method_option "full-index", :type => :boolean, :banner =>
"Fall back to using the single-file index of all gems"
@@ -204,32 +199,37 @@ module Bundler
"Specify the number of jobs to run in parallel"
method_option "local", :type => :boolean, :banner =>
"Do not attempt to fetch gems remotely and use the gem cache instead"
- deprecated_option "no-cache", :type => :boolean, :banner =>
+ method_option "no-cache", :type => :boolean, :banner =>
"Don't update the existing gem cache."
method_option "redownload", :type => :boolean, :aliases => "--force", :banner =>
"Force downloading every gem."
- deprecated_option "no-prune", :type => :boolean, :banner =>
+ method_option "no-prune", :type => :boolean, :banner =>
"Don't remove stale gems from the cache."
- deprecated_option "path", :type => :string, :banner =>
+ method_option "path", :type => :string, :banner =>
"Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME). Bundler will remember this value for future installs on this machine"
method_option "quiet", :type => :boolean, :banner =>
"Only output warnings and errors."
- deprecated_option "shebang", :type => :string, :banner =>
+ method_option "shebang", :type => :string, :banner =>
"Specify a different shebang executable name than the default (usually 'ruby')"
method_option "standalone", :type => :array, :lazy_default => [], :banner =>
"Make a bundle that can work without the Bundler runtime"
- deprecated_option "system", :type => :boolean, :banner =>
+ method_option "system", :type => :boolean, :banner =>
"Install to the system location ($BUNDLE_PATH or $GEM_HOME) even if the bundle was previously installed somewhere else for this application"
method_option "trust-policy", :alias => "P", :type => :string, :banner =>
"Gem trust policy (like gem install -P). Must be one of " +
Bundler.rubygems.security_policy_keys.join("|")
- deprecated_option "without", :type => :array, :banner =>
+ method_option "without", :type => :array, :banner =>
"Exclude gems that are part of the specified named group."
- deprecated_option "with", :type => :array, :banner =>
+ method_option "with", :type => :array, :banner =>
"Include gems that are part of the specified named group."
map "i" => "install"
def install
- SharedHelpers.major_deprecation(3, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force")
+ SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force")
+
+ %w[clean deployment frozen no-cache no-prune path shebang system without with].each do |option|
+ remembered_flag_deprecation(option)
+ end
+
require "bundler/cli/install"
Bundler.settings.temporary(:no_install => false) do
Install.new(options.dup).run
@@ -275,57 +275,60 @@ module Bundler
method_option "all", :type => :boolean, :banner =>
"Update everything."
def update(*gems)
- SharedHelpers.major_deprecation(3, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force")
+ SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force")
require "bundler/cli/update"
- Update.new(options, gems).run
+ Bundler.settings.temporary(:no_install => false) do
+ Update.new(options, gems).run
+ end
end
- desc "show GEM [OPTIONS]", "Shows all gems that are part of the bundle, or the path to a given gem"
- long_desc <<-D
- Show lists the names and versions of all gems that are required by your Gemfile.
- Calling show with [GEM] will list the exact location of that gem on your machine.
- D
- method_option "paths", :type => :boolean,
- :banner => "List the paths of all gems that are required by your Gemfile."
- method_option "outdated", :type => :boolean,
- :banner => "Show verbose output including whether gems are outdated."
- def show(gem_name = nil)
- if ARGV[0] == "show"
- rest = ARGV[1..-1]
-
- new_command = rest.find {|arg| !arg.start_with?("--") } ? "info" : "list"
-
- new_arguments = rest.map do |arg|
- next arg if arg != "--paths"
- next "--path" if new_command == "info"
+ unless Bundler.feature_flag.bundler_3_mode?
+ desc "show GEM [OPTIONS]", "Shows all gems that are part of the bundle, or the path to a given gem"
+ long_desc <<-D
+ Show lists the names and versions of all gems that are required by your Gemfile.
+ Calling show with [GEM] will list the exact location of that gem on your machine.
+ D
+ method_option "paths", :type => :boolean,
+ :banner => "List the paths of all gems that are required by your Gemfile."
+ method_option "outdated", :type => :boolean,
+ :banner => "Show verbose output including whether gems are outdated."
+ def show(gem_name = nil)
+ if ARGV[0] == "show"
+ rest = ARGV[1..-1]
+
+ if flag = rest.find{|arg| ["--verbose", "--outdated"].include?(arg) }
+ Bundler::SharedHelpers.major_deprecation(2, "the `#{flag}` flag to `bundle show` was undocumented and will be removed without replacement")
+ else
+ new_command = rest.find {|arg| !arg.start_with?("--") } ? "info" : "list"
+
+ new_arguments = rest.map do |arg|
+ next arg if arg != "--paths"
+ next "--path" if new_command == "info"
+ end
+
+ old_argv = ARGV.join(" ")
+ new_argv = [new_command, *new_arguments.compact].join(" ")
+
+ Bundler::SharedHelpers.major_deprecation(2, "use `bundle #{new_argv}` instead of `bundle #{old_argv}`")
+ end
end
-
- old_argv = ARGV.join(" ")
- new_argv = [new_command, *new_arguments.compact].join(" ")
-
- Bundler::SharedHelpers.major_deprecation(3, "use `bundle #{new_argv}` instead of `bundle #{old_argv}`")
- end
- require "bundler/cli/show"
- Show.new(options, gem_name).run
- end
- # TODO: 2.0 remove `bundle show`
-
- if Bundler.feature_flag.list_command?
- 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 expect from a group"
- method_option "paths", :type => :boolean, :banner => "print the path to each gem in the bundle"
- def list
- require "bundler/cli/list"
- List.new(options).run
+ require "bundler/cli/show"
+ Show.new(options, gem_name).run
end
+ end
- map %w[ls] => "list"
- else
- map %w[list] => "show"
+ 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 "paths", :type => :boolean, :banner => "print the path to each gem in the bundle"
+ def list
+ require "bundler/cli/list"
+ List.new(options).run
end
+ map %w[ls] => "list"
+
desc "info GEM [OPTIONS]", "Show information for the given gem"
method_option "path", :type => :boolean, :banner => "Print full path to gem"
def info(gem_name)
@@ -386,9 +389,10 @@ module Bundler
"Do not attempt to fetch gems remotely and use the gem cache instead"
method_option "pre", :type => :boolean, :banner => "Check for newer pre-release gems"
method_option "source", :type => :array, :banner => "Check against a specific source"
- method_option "strict", :type => :boolean, :banner =>
+ strict_is_update = Bundler.feature_flag.forget_cli_options?
+ method_option "filter-strict", :type => :boolean, :aliases => strict_is_update ? [] : %w[--strict], :banner =>
"Only list newer versions allowed by your Gemfile requirements"
- method_option "update-strict", :type => :boolean, :banner =>
+ method_option "update-strict", :type => :boolean, :aliases => strict_is_update ? %w[--strict] : [], :banner =>
"Strict conservative resolution, do not allow any gem to be updated past latest --patch | --minor | --major"
method_option "minor", :type => :boolean, :banner => "Prefer updating only to next minor version"
method_option "major", :type => :boolean, :banner => "Prefer updating to next major version (default)"
@@ -475,11 +479,8 @@ module Bundler
will show the current value, as well as any superceded values and
where they were specified.
D
- method_option "parseable", :type => :boolean, :banner => "Use minimal formatting for more parseable output"
- def config(*args)
- require "bundler/cli/config"
- Config.new(options, args, self).run
- end
+ require "bundler/cli/config"
+ subcommand "config", Config
desc "open GEM", "Opens the source directory of the given bundled gem"
def open(name)
@@ -487,7 +488,7 @@ module Bundler
Open.new(options, name).run
end
- if Bundler.feature_flag.console_command?
+ unless Bundler.feature_flag.bundler_3_mode?
desc "console [GROUP]", "Opens an IRB session with the bundle pre-loaded"
def console(group = nil)
require "bundler/cli/console"
@@ -524,7 +525,7 @@ module Bundler
end
end
- if Bundler.feature_flag.viz_command?
+ unless Bundler.feature_flag.bundler_3_mode?
desc "viz [OPTIONS]", "Generates a visual dependency graph", :hide => true
long_desc <<-D
Viz generates a PNG file of the current Gemfile as a dependency graph.
@@ -537,7 +538,7 @@ module Bundler
method_option :version, :type => :boolean, :default => false, :aliases => "-v", :desc => "Set to show each gem version."
method_option :without, :type => :array, :default => [], :aliases => "-W", :banner => "GROUP[ GROUP...]", :desc => "Exclude gems that are part of the specified named group."
def viz
- SharedHelpers.major_deprecation 3, "The `viz` command has been moved to the `bundle-viz` gem, see https://github.com/bundler/bundler-viz"
+ SharedHelpers.major_deprecation 2, "The `viz` command has been moved to the `bundle-viz` gem, see https://github.com/bundler/bundler-viz"
require "bundler/cli/viz"
Viz.new(options.dup).run
end
@@ -547,14 +548,14 @@ module Bundler
desc "gem NAME [OPTIONS]", "Creates a skeleton for creating a rubygem"
method_option :exe, :type => :boolean, :default => false, :aliases => ["--bin", "-b"], :desc => "Generate a binary executable for your library."
- method_option :coc, :type => :boolean, :desc => "Generate a code of conduct file. Set a default with `bundle config gem.coc true`."
+ method_option :coc, :type => :boolean, :desc => "Generate a code of conduct file. Set a default with `bundle config set gem.coc true`."
method_option :edit, :type => :string, :aliases => "-e", :required => false, :banner => "EDITOR",
:lazy_default => [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find {|e| !e.nil? && !e.empty? },
:desc => "Open generated gemspec in the specified editor (defaults to $EDITOR or $BUNDLER_EDITOR)"
method_option :ext, :type => :boolean, :default => false, :desc => "Generate the boilerplate for C extension code"
- method_option :mit, :type => :boolean, :desc => "Generate an MIT license file. Set a default with `bundle config gem.mit true`."
+ method_option :mit, :type => :boolean, :desc => "Generate an MIT license file. Set a default with `bundle config set gem.mit 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 gem.test rspec`."
+ :desc => "Generate a test directory for your library, either rspec or minitest. Set a default with `bundle config set gem.test rspec`."
def gem(name)
end
@@ -608,7 +609,7 @@ module Bundler
method_option "group", :type => :string, :banner =>
"Install gem into a bundler group"
def inject(name, version)
- SharedHelpers.major_deprecation 3, "The `inject` command has been replaced by the `add` command"
+ SharedHelpers.major_deprecation 2, "The `inject` command has been replaced by the `add` command"
require "bundler/cli/inject"
Inject.new(options.dup, name, version).run
end
@@ -620,6 +621,8 @@ module Bundler
"do not attempt to fetch remote gemspecs and use the local gem cache only"
method_option "print", :type => :boolean, :default => false, :banner =>
"print the lockfile to STDOUT instead of writing to the file system"
+ method_option "gemfile", :type => :string, :banner =>
+ "Use the specified gemfile instead of Gemfile"
method_option "lockfile", :type => :string, :default => nil, :banner =>
"the path the lockfile should be written to"
method_option "full-index", :type => :boolean, :default => false, :banner =>
@@ -714,7 +717,7 @@ module Bundler
# Automatically invoke `bundle install` and resume if
# Bundler.settings[:auto_install] exists. This is set through config cmd
- # `bundle config auto_install 1`.
+ # `bundle config set auto_install 1`.
#
# Note that this method `nil`s out the global Definition object, so it
# should be called first, before you instantiate anything like an
@@ -786,5 +789,22 @@ module Bundler
rescue RuntimeError
nil
end
+
+ def remembered_flag_deprecation(name)
+ option = current_command.options[name]
+ flag_name = option.switch_name
+
+ name_index = ARGV.find {|arg| flag_name == arg }
+ return unless name_index
+
+ value = options[name]
+ value = value.join(" ").to_s if option.type == :array
+
+ Bundler::SharedHelpers.major_deprecation 2,\
+ "The `#{flag_name}` flag is deprecated because it relies on being " \
+ "remembered accross bundler invokations, which bundler will no longer " \
+ "do in future versions. Instead please use `bundle config #{name} " \
+ "'#{value}'`, and stop using this flag"
+ end
end
end
diff --git a/lib/bundler/cli/cache.rb b/lib/bundler/cli/cache.rb
index 9d2ba87d34..cb7958e5d0 100644
--- a/lib/bundler/cli/cache.rb
+++ b/lib/bundler/cli/cache.rb
@@ -29,7 +29,7 @@ module Bundler
if Bundler.definition.has_local_dependencies? && !Bundler.feature_flag.cache_all?
Bundler.ui.warn "Your Gemfile contains path and git dependencies. If you want " \
"to package them as well, please pass the --all flag. This will be the default " \
- "on Bundler 2.0."
+ "on Bundler 3.0."
end
end
end
diff --git a/lib/bundler/cli/common.rb b/lib/bundler/cli/common.rb
index 9d40ee9dfd..9ea52baa6b 100644
--- a/lib/bundler/cli/common.rb
+++ b/lib/bundler/cli/common.rb
@@ -23,7 +23,7 @@ module Bundler
groups = Bundler.settings[:without]
group_list = [groups[0...-1].join(", "), groups[-1..-1]].
reject {|s| s.to_s.empty? }.join(" and ")
- group_str = (groups.size == 1) ? "group" : "groups"
+ group_str = groups.size == 1 ? "group" : "groups"
"Gems in the #{group_str} #{group_list} were not installed."
end
@@ -49,10 +49,6 @@ module Bundler
end
def self.ask_for_spec_from(specs)
- if !$stdout.tty? && ENV["BUNDLE_SPEC_RUN"].nil?
- raise GemNotFound, gem_not_found_message(name, Bundler.definition.dependencies)
- end
-
specs.each_with_index do |spec, index|
Bundler.ui.info "#{index.succ} : #{spec.name}", true
end
@@ -72,7 +68,7 @@ module Bundler
end
def self.ensure_all_gems_in_lockfile!(names, locked_gems = Bundler.locked_gems)
- locked_names = locked_gems.specs.map(&:name)
+ locked_names = locked_gems.specs.map(&:name).uniq
names.-(locked_names).each do |g|
raise GemNotFound, gem_not_found_message(g, locked_names)
end
@@ -80,10 +76,12 @@ module Bundler
def self.configure_gem_version_promoter(definition, options)
patch_level = patch_level_options(options)
+ patch_level << :patch if patch_level.empty? && Bundler.settings[:prefer_patch]
raise InvalidOption, "Provide only one of the following options: #{patch_level.join(", ")}" unless patch_level.length <= 1
+
definition.gem_version_promoter.tap do |gvp|
gvp.level = patch_level.first || :major
- gvp.strict = options[:strict] || options["update-strict"]
+ gvp.strict = options[:strict] || options["update-strict"] || options["filter-strict"]
end
end
diff --git a/lib/bundler/cli/config.rb b/lib/bundler/cli/config.rb
index 12f71ea8fe..1df2a55d9a 100644
--- a/lib/bundler/cli/config.rb
+++ b/lib/bundler/cli/config.rb
@@ -1,119 +1,194 @@
# frozen_string_literal: true
module Bundler
- class CLI::Config
- attr_reader :name, :options, :scope, :thor
- attr_accessor :args
-
- def initialize(options, args, thor)
- @options = options
- @args = args
- @thor = thor
- @name = peek = args.shift
- @scope = "global"
- return unless peek && peek.start_with?("--")
- @name = args.shift
- @scope = peek[2..-1]
+ class CLI::Config < Thor
+ class_option :parseable, :type => :boolean, :banner => "Use minimal formatting for more parseable output"
+
+ def self.scope_options
+ method_option :global, :type => :boolean, :banner => "Only change the global config"
+ method_option :local, :type => :boolean, :banner => "Only change the local config"
end
+ private_class_method :scope_options
- def run
- unless name
- confirm_all
- return
- end
+ desc "base NAME [VALUE]", "The Bundler 1 config interface", :hide => true
+ scope_options
+ method_option :delete, :type => :boolean, :banner => "delete"
+ def base(name = nil, *value)
+ new_args =
+ if ARGV.size == 1
+ ["config", "list"]
+ elsif ARGV.include?("--delete")
+ ARGV.map {|arg| arg == "--delete" ? "unset" : arg }
+ elsif ARGV.include?("--global") || ARGV.include?("--local") || ARGV.size == 3
+ ["config", "set", *ARGV[1..-1]]
+ else
+ ["config", "get", ARGV[1]]
+ end
- unless valid_scope?(scope)
- Bundler.ui.error "Invalid scope --#{scope} given. Please use --local or --global."
- exit 1
- end
+ SharedHelpers.major_deprecation 2,
+ "Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle #{new_args.join(" ")}` instead."
+
+ Base.new(options, name, value, self).run
+ end
+
+ desc "list", "List out all configured settings"
+ def list
+ Base.new(options, nil, nil, self).run
+ end
+
+ desc "get NAME", "Returns the value for the given key"
+ def get(name)
+ Base.new(options, name, nil, self).run
+ end
+
+ desc "set NAME VALUE", "Sets the given value for the given key"
+ scope_options
+ def set(name, value, *value_)
+ Base.new(options, name, value_.unshift(value), self).run
+ end
- if scope == "delete"
- Bundler.settings.set_local(name, nil)
- Bundler.settings.set_global(name, nil)
- return
+ desc "unset NAME", "Unsets the value for the given key"
+ scope_options
+ def unset(name)
+ options[:delete] = true
+ Base.new(options, name, nil, self).run
+ end
+
+ default_task :base
+
+ class Base
+ attr_reader :name, :value, :options, :scope, :thor
+
+ def initialize(options, name, value, thor)
+ @options = options
+ @name = name
+ value = Array(value)
+ @value = value.empty? ? nil : value.join(" ")
+ @thor = thor
+ validate_scope!
end
- if args.empty?
- if options[:parseable]
- if value = Bundler.settings[name]
- Bundler.ui.info("#{name}=#{value}")
+ def run
+ unless name
+ warn_unused_scope "Ignoring --#{scope}"
+ confirm_all
+ return
+ end
+
+ if options[:delete]
+ if !explicit_scope? || scope != "global"
+ Bundler.settings.set_local(name, nil)
+ end
+ if !explicit_scope? || scope != "local"
+ Bundler.settings.set_global(name, nil)
end
return
end
- confirm(name)
- return
- end
+ if value.nil?
+ warn_unused_scope "Ignoring --#{scope} since no value to set was given"
- Bundler.ui.info(message) if message
- Bundler.settings.send("set_#{scope}", name, new_value)
- end
+ if options[:parseable]
+ if value = Bundler.settings[name]
+ Bundler.ui.info("#{name}=#{value}")
+ end
+ return
+ end
- private
+ confirm(name)
+ return
+ end
- def confirm_all
- if @options[:parseable]
- thor.with_padding do
+ Bundler.ui.info(message) if message
+ Bundler.settings.send("set_#{scope}", name, new_value)
+ end
+
+ def confirm_all
+ if @options[:parseable]
+ thor.with_padding do
+ Bundler.settings.all.each do |setting|
+ val = Bundler.settings[setting]
+ Bundler.ui.info "#{setting}=#{val}"
+ end
+ end
+ else
+ Bundler.ui.confirm "Settings are listed in order of priority. The top value will be used.\n"
Bundler.settings.all.each do |setting|
- val = Bundler.settings[setting]
- Bundler.ui.info "#{setting}=#{val}"
+ Bundler.ui.confirm "#{setting}"
+ show_pretty_values_for(setting)
+ Bundler.ui.confirm ""
end
end
- else
- Bundler.ui.confirm "Settings are listed in order of priority. The top value will be used.\n"
- Bundler.settings.all.each do |setting|
- Bundler.ui.confirm "#{setting}"
- show_pretty_values_for(setting)
- Bundler.ui.confirm ""
- end
end
- end
- def confirm(name)
- Bundler.ui.confirm "Settings for `#{name}` in order of priority. The top value will be used"
- show_pretty_values_for(name)
- end
+ def confirm(name)
+ Bundler.ui.confirm "Settings for `#{name}` in order of priority. The top value will be used"
+ show_pretty_values_for(name)
+ end
- def new_value
- pathname = Pathname.new(args.join(" "))
- if name.start_with?("local.") && pathname.directory?
- pathname.expand_path.to_s
- else
- args.join(" ")
+ def new_value
+ pathname = Pathname.new(value)
+ if name.start_with?("local.") && pathname.directory?
+ pathname.expand_path.to_s
+ else
+ value
+ end
end
- end
- def message
- locations = Bundler.settings.locations(name)
- if @options[:parseable]
- "#{name}=#{new_value}" if new_value
- elsif scope == "global"
- if locations[:local]
- "Your application has set #{name} to #{locations[:local].inspect}. " \
- "This will override the global value you are currently setting"
- elsif locations[:env]
- "You have a bundler environment variable for #{name} set to " \
- "#{locations[:env].inspect}. This will take precedence over the global value you are setting"
- elsif locations[:global] && locations[:global] != args.join(" ")
- "You are replacing the current global value of #{name}, which is currently " \
- "#{locations[:global].inspect}"
+ def message
+ locations = Bundler.settings.locations(name)
+ if @options[:parseable]
+ "#{name}=#{new_value}" if new_value
+ elsif scope == "global"
+ if !locations[:local].nil?
+ "Your application has set #{name} to #{locations[:local].inspect}. " \
+ "This will override the global value you are currently setting"
+ elsif locations[:env]
+ "You have a bundler environment variable for #{name} set to " \
+ "#{locations[:env].inspect}. This will take precedence over the global value you are setting"
+ elsif !locations[:global].nil? && locations[:global] != value
+ "You are replacing the current global value of #{name}, which is currently " \
+ "#{locations[:global].inspect}"
+ end
+ elsif scope == "local" && !locations[:local].nil? && locations[:local] != value
+ "You are replacing the current local value of #{name}, which is currently " \
+ "#{locations[:local].inspect}"
end
- elsif scope == "local" && locations[:local] != args.join(" ")
- "You are replacing the current local value of #{name}, which is currently " \
- "#{locations[:local].inspect}"
end
- end
- def show_pretty_values_for(setting)
- thor.with_padding do
- Bundler.settings.pretty_values_for(setting).each do |line|
- Bundler.ui.info line
+ def show_pretty_values_for(setting)
+ thor.with_padding do
+ Bundler.settings.pretty_values_for(setting).each do |line|
+ Bundler.ui.info line
+ end
end
end
- end
- def valid_scope?(scope)
- %w[delete local global].include?(scope)
+ def explicit_scope?
+ @explicit_scope
+ end
+
+ def warn_unused_scope(msg)
+ return unless explicit_scope?
+ return if options[:parseable]
+
+ Bundler.ui.warn(msg)
+ end
+
+ def validate_scope!
+ @explicit_scope = true
+ scopes = %w[global local].select {|s| options[s] }
+ case scopes.size
+ when 0
+ @scope = "global"
+ @explicit_scope = false
+ when 1
+ @scope = scopes.first
+ else
+ raise InvalidOption,
+ "The options #{scopes.join " and "} were specified. Please only use one of the switches at a time."
+ end
+ end
end
end
end
diff --git a/lib/bundler/cli/console.rb b/lib/bundler/cli/console.rb
index d45f30cdcf..6e0dfe28af 100644
--- a/lib/bundler/cli/console.rb
+++ b/lib/bundler/cli/console.rb
@@ -9,10 +9,10 @@ module Bundler
end
def run
- Bundler::SharedHelpers.major_deprecation 3, "bundle console will be replaced " \
+ Bundler::SharedHelpers.major_deprecation 2, "bundle console will be replaced " \
"by `bin/console` generated by `bundle gem <name>`"
- 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/doctor.rb b/lib/bundler/cli/doctor.rb
index 3e0898ff8a..6d038937c0 100644
--- a/lib/bundler/cli/doctor.rb
+++ b/lib/bundler/cli/doctor.rb
@@ -4,8 +4,8 @@ require "rbconfig"
module Bundler
class CLI::Doctor
- DARWIN_REGEX = /\s+(.+) \(compatibility /
- LDD_REGEX = /\t\S+ => (\S+) \(\S+\)/
+ DARWIN_REGEX = /\s+(.+) \(compatibility /.freeze
+ LDD_REGEX = /\t\S+ => (\S+) \(\S+\)/.freeze
attr_reader :options
diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb
index 58e2f8a3fd..3db1ec7843 100644
--- a/lib/bundler/cli/gem.rb
+++ b/lib/bundler/cli/gem.rb
@@ -11,7 +11,7 @@ module Bundler
class CLI::Gem
TEST_FRAMEWORK_VERSIONS = {
"rspec" => "3.0",
- "minitest" => "5.0"
+ "minitest" => "5.0",
}.freeze
attr_reader :options, :gem_name, :thor, :name, :target
@@ -57,7 +57,7 @@ module Bundler
:ext => options[:ext],
:exe => options[:exe],
:bundler_version => bundler_dependency_version,
- :github_username => github_username.empty? ? "[USERNAME]" : github_username
+ :github_username => github_username.empty? ? "[USERNAME]" : github_username,
}
ensure_safe_gem_name(name, constant_array)
@@ -69,7 +69,7 @@ module Bundler
"Rakefile.tt" => "Rakefile",
"README.md.tt" => "README.md",
"bin/console.tt" => "bin/console",
- "bin/setup.tt" => "bin/setup"
+ "bin/setup.tt" => "bin/setup",
}
executables = %w[
diff --git a/lib/bundler/cli/info.rb b/lib/bundler/cli/info.rb
index 958b525067..4733675e8c 100644
--- a/lib/bundler/cli/info.rb
+++ b/lib/bundler/cli/info.rb
@@ -9,18 +9,24 @@ module Bundler
end
def run
+ Bundler.ui.silence do
+ Bundler.definition.validate_runtime!
+ Bundler.load.lock
+ end
+
spec = spec_for_gem(gem_name)
- spec_not_found(gem_name) unless spec
- return print_gem_path(spec) if @options[:path]
- print_gem_info(spec)
+ if spec
+ return print_gem_path(spec) if @options[:path]
+ print_gem_info(spec)
+ end
end
private
def spec_for_gem(gem_name)
spec = Bundler.definition.specs.find {|s| s.name == gem_name }
- spec || default_gem_spec(gem_name)
+ spec || default_gem_spec(gem_name) || Bundler::CLI::Common.select_spec(gem_name, :regex_match)
end
def default_gem_spec(gem_name)
@@ -34,7 +40,13 @@ module Bundler
end
def print_gem_path(spec)
- Bundler.ui.info spec.full_gem_path
+ path = if spec.name == "bundler"
+ File.expand_path("../../../..", __FILE__)
+ else
+ spec.full_gem_path
+ end
+
+ Bundler.ui.info path
end
def print_gem_info(spec)
diff --git a/lib/bundler/cli/init.rb b/lib/bundler/cli/init.rb
index 40df797269..65dd08dfe9 100644
--- a/lib/bundler/cli/init.rb
+++ b/lib/bundler/cli/init.rb
@@ -41,7 +41,7 @@ module Bundler
private
def gemfile
- @gemfile ||= Bundler.feature_flag.init_gems_rb? ? "gems.rb" : "Gemfile"
+ @gemfile ||= Bundler.settings[:init_gems_rb] ? "gems.rb" : "Gemfile"
end
end
end
diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb
index 55e90ead0e..03edc7fbd2 100644
--- a/lib/bundler/cli/install.rb
+++ b/lib/bundler/cli/install.rb
@@ -53,7 +53,7 @@ module Bundler
Bundler::Fetcher.disable_endpoint = options["full-index"]
if options["binstubs"]
- Bundler::SharedHelpers.major_deprecation 3,
+ Bundler::SharedHelpers.major_deprecation 2,
"The --binstubs option will be removed in favor of `bundle binstubs`"
end
@@ -202,15 +202,16 @@ module Bundler
end
def warn_ambiguous_gems
+ # TODO: remove this when we drop Bundler 1.x support
Installer.ambiguous_gems.to_a.each do |name, installed_from_uri, *also_found_in_uris|
- Bundler.ui.error "Warning: the gem '#{name}' was found in multiple sources."
- Bundler.ui.error "Installed from: #{installed_from_uri}"
- Bundler.ui.error "Also found in:"
- also_found_in_uris.each {|uri| Bundler.ui.error " * #{uri}" }
- Bundler.ui.error "You should add a source requirement to restrict this gem to your preferred source."
- Bundler.ui.error "For example:"
- Bundler.ui.error " gem '#{name}', :source => '#{installed_from_uri}'"
- Bundler.ui.error "Then uninstall the gem '#{name}' (or delete all bundled gems) and then install again."
+ Bundler.ui.warn "Warning: the gem '#{name}' was found in multiple sources."
+ Bundler.ui.warn "Installed from: #{installed_from_uri}"
+ Bundler.ui.warn "Also found in:"
+ also_found_in_uris.each {|uri| Bundler.ui.warn " * #{uri}" }
+ Bundler.ui.warn "You should add a source requirement to restrict this gem to your preferred source."
+ Bundler.ui.warn "For example:"
+ Bundler.ui.warn " gem '#{name}', :source => '#{installed_from_uri}'"
+ Bundler.ui.warn "Then uninstall the gem '#{name}' (or delete all bundled gems) and then install again."
end
end
end
diff --git a/lib/bundler/cli/issue.rb b/lib/bundler/cli/issue.rb
index 91f827ea99..bba1619340 100644
--- a/lib/bundler/cli/issue.rb
+++ b/lib/bundler/cli/issue.rb
@@ -13,10 +13,10 @@ module Bundler
https://github.com/bundler/bundler/blob/master/doc/TROUBLESHOOTING.md
2. Instructions for common Bundler uses can be found on the documentation
- site: http://bundler.io/
+ site: https://bundler.io/
3. Information about each Bundler command can be found in the Bundler
- man pages: http://bundler.io/man/bundle.1.html
+ man pages: https://bundler.io/man/bundle.1.html
Hopefully the troubleshooting steps above resolved your problem! If things
still aren't working the way you expect them to, please let us know so
diff --git a/lib/bundler/cli/outdated.rb b/lib/bundler/cli/outdated.rb
index 2ca90293db..3a0521de1e 100644
--- a/lib/bundler/cli/outdated.rb
+++ b/lib/bundler/cli/outdated.rb
@@ -41,7 +41,7 @@ module Bundler
# the patch level options imply strict is also true. It wouldn't make
# sense otherwise.
- strict = options[:strict] ||
+ strict = options["filter-strict"] ||
Bundler::CLI::Common.patch_level_options(options).any?
filter_options_patch = options.keys &
@@ -124,7 +124,7 @@ module Bundler
[nil, ordered_groups].flatten.each do |groups|
gems = outdated_gems_by_groups[groups]
contains_group = if groups
- groups.split(",").include?(options[:group])
+ groups.split(", ").include?(options[:group])
else
options[:group] == "group"
end
@@ -221,9 +221,9 @@ module Bundler
def check_for_deployment_mode
return unless Bundler.frozen_bundle?
suggested_command = if Bundler.settings.locations("frozen")[:global]
- "bundle config --delete frozen"
+ "bundle config unset frozen"
elsif Bundler.settings.locations("deployment").keys.&([:global, :local]).any?
- "bundle config --delete deployment"
+ "bundle config unset deployment"
else
"bundle install --no-deployment"
end
diff --git a/lib/bundler/cli/package.rb b/lib/bundler/cli/package.rb
index 2dcd0e1e29..cd01ce422e 100644
--- a/lib/bundler/cli/package.rb
+++ b/lib/bundler/cli/package.rb
@@ -42,7 +42,7 @@ module Bundler
if Bundler.definition.has_local_dependencies? && !Bundler.feature_flag.cache_all?
Bundler.ui.warn "Your Gemfile contains path and git dependencies. If you want " \
"to package them as well, please pass the --all flag. This will be the default " \
- "on Bundler 2.0."
+ "on Bundler 3.0."
end
end
end
diff --git a/lib/bundler/cli/plugin.rb b/lib/bundler/cli/plugin.rb
index 5488a9f28d..b5dd5b6d4b 100644
--- a/lib/bundler/cli/plugin.rb
+++ b/lib/bundler/cli/plugin.rb
@@ -5,7 +5,7 @@ module Bundler
class CLI::Plugin < Thor
desc "install PLUGINS", "Install the plugin from the source"
long_desc <<-D
- Install plugins either from the rubygems source provided (with --source option) or from a git source provided with (--git option). If no sources are provided, it uses Gem.sources
+ Install plugins either from the rubygems source provided (with --source option) or from a git source provided with --git (for remote repos) or --local_git (for local repos). If no sources are provided, it uses Gem.sources
D
method_option "source", :type => :string, :default => nil, :banner =>
"URL of the RubyGems source to fetch the plugin from"
@@ -13,6 +13,8 @@ module Bundler
"The version of the plugin to fetch"
method_option "git", :type => :string, :default => nil, :banner =>
"URL of the git repo to fetch from"
+ method_option "local_git", :type => :string, :default => nil, :banner =>
+ "Path of the local git repo to fetch from"
method_option "branch", :type => :string, :default => nil, :banner =>
"The git branch to checkout"
method_option "ref", :type => :string, :default => nil, :banner =>
@@ -20,5 +22,10 @@ module Bundler
def install(*plugins)
Bundler::Plugin.install(plugins, options)
end
+
+ desc "list", "List the installed plugins and available commands"
+ def list
+ Bundler::Plugin.list
+ end
end
end
diff --git a/lib/bundler/cli/pristine.rb b/lib/bundler/cli/pristine.rb
index 4a411a83fc..532b3e0b5b 100644
--- a/lib/bundler/cli/pristine.rb
+++ b/lib/bundler/cli/pristine.rb
@@ -33,7 +33,7 @@ module Bundler
if extension_cache_path = source.extension_cache_path(spec)
FileUtils.rm_rf extension_cache_path
end
- FileUtils.rm_rf spec.extension_dir if spec.respond_to?(:extension_dir)
+ FileUtils.rm_rf spec.extension_dir
FileUtils.rm_rf spec.full_gem_path
else
Bundler.ui.warn("Cannot pristine #{gem_name}. Gem is sourced from local path.")
diff --git a/lib/bundler/cli/show.rb b/lib/bundler/cli/show.rb
index 61756801b2..3748c25b89 100644
--- a/lib/bundler/cli/show.rb
+++ b/lib/bundler/cli/show.rb
@@ -24,7 +24,7 @@ module Bundler
return unless spec
path = spec.full_gem_path
unless File.directory?(path)
- Bundler.ui.warn "The gem #{gem_name} has been deleted. It was installed at:"
+ return Bundler.ui.warn "The gem #{gem_name} has been deleted. It was installed at: #{path}"
end
end
return Bundler.ui.info(path)
diff --git a/lib/bundler/cli/update.rb b/lib/bundler/cli/update.rb
index bf300a8437..b088853768 100644
--- a/lib/bundler/cli/update.rb
+++ b/lib/bundler/cli/update.rb
@@ -22,7 +22,7 @@ module Bundler
if Bundler.feature_flag.update_requires_all_flag?
raise InvalidOption, "To update everything, pass the `--all` flag."
end
- SharedHelpers.major_deprecation 3, "Pass --all to `bundle update` to update everything"
+ SharedHelpers.major_deprecation 2, "Pass --all to `bundle update` to update everything"
elsif !full_update && options[:all]
raise InvalidOption, "Cannot specify --all along with specific options."
end
diff --git a/lib/bundler/compact_index_client.rb b/lib/bundler/compact_index_client.rb
index 6c241ca07a..2f713041c8 100644
--- a/lib/bundler/compact_index_client.rb
+++ b/lib/bundler/compact_index_client.rb
@@ -18,11 +18,6 @@ module Bundler
attr_reader :directory
- # @return [Lambda] A lambda that takes an array of inputs and a block, and
- # maps the inputs with the block in parallel.
- #
- attr_accessor :in_parallel
-
def initialize(directory, fetcher)
@directory = Pathname.new(directory)
@updater = Updater.new(fetcher)
@@ -31,7 +26,28 @@ module Bundler
@info_checksums_by_name = {}
@parsed_checksums = false
@mutex = Mutex.new
- @in_parallel = lambda do |inputs, &blk|
+ end
+
+ def execution_mode=(block)
+ Bundler::CompactIndexClient.debug { "execution_mode=" }
+ @endpoints = Set.new
+
+ @execution_mode = block
+ end
+
+ # @return [Lambda] A lambda that takes an array of inputs and a block, and
+ # maps the inputs with the block in parallel.
+ #
+ def execution_mode
+ @execution_mode || sequentially
+ end
+
+ def sequential_execution_mode!
+ self.execution_mode = sequentially
+ end
+
+ def sequentially
+ @sequentially ||= lambda do |inputs, &blk|
inputs.map(&blk)
end
end
@@ -51,7 +67,7 @@ module Bundler
def dependencies(names)
Bundler::CompactIndexClient.debug { "dependencies(#{names})" }
- in_parallel.call(names) do |name|
+ execution_mode.call(names) do |name|
update_info(name)
@cache.dependencies(name).map {|d| d.unshift(name) }
end.flatten(1)
diff --git a/lib/bundler/compact_index_client/updater.rb b/lib/bundler/compact_index_client/updater.rb
index 4d6eb80044..d77285072c 100644
--- a/lib/bundler/compact_index_client/updater.rb
+++ b/lib/bundler/compact_index_client/updater.rb
@@ -95,11 +95,7 @@ module Bundler
end
def slice_body(body, range)
- if body.respond_to?(:byteslice)
- body.byteslice(range)
- else # pre-1.9.3
- body.unpack("@#{range.first}a#{range.end + 1}").first
- end
+ body.byteslice(range)
end
def checksum_for_file(path)
diff --git a/lib/bundler/compatibility_guard.rb b/lib/bundler/compatibility_guard.rb
index 750a1db04f..958116ce55 100644
--- a/lib/bundler/compatibility_guard.rb
+++ b/lib/bundler/compatibility_guard.rb
@@ -1,14 +1,9 @@
# frozen_string_literal: false
-require "rubygems"
require "bundler/version"
if Bundler::VERSION.split(".").first.to_i >= 2
if Gem::Version.new(Object::RUBY_VERSION.dup) < Gem::Version.new("2.3")
abort "Bundler 2 requires Ruby 2.3 or later. Either install bundler 1 or update to a supported Ruby version."
end
-
- if Gem::Version.new(Gem::VERSION.dup) < Gem::Version.new("2.5")
- abort "Bundler 2 requires RubyGems 2.5 or later. Either install bundler 1 or update to a supported RubyGems version."
- end
end
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index c5e94c7123..f9daae067c 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -331,7 +331,7 @@ module Bundler
# i.e., Windows with `git config core.autocrlf=true`
contents.gsub!(/\n/, "\r\n") if @lockfile_contents.match("\r\n")
- if @locked_bundler_version && Bundler.feature_flag.lockfile_upgrade_warning?
+ if @locked_bundler_version
locked_major = @locked_bundler_version.segments.first
current_major = Gem::Version.create(Bundler::VERSION).segments.first
@@ -397,9 +397,9 @@ module Bundler
unless explicit_flag
suggested_command = if Bundler.settings.locations("frozen")[:global]
- "bundle config --delete frozen"
+ "bundle config unset frozen"
elsif Bundler.settings.locations("deployment").keys.&([:global, :local]).any?
- "bundle config --delete deployment"
+ "bundle config unset deployment"
else
"bundle install --no-deployment"
end
@@ -643,7 +643,7 @@ module Bundler
end
def converge_rubygems_sources
- return false if Bundler.feature_flag.lockfile_uses_separate_rubygems_sources?
+ return false if Bundler.feature_flag.disable_multisource?
changes = false
@@ -855,8 +855,8 @@ module Bundler
concat_ruby_version_requirements(locked_ruby_version_object) unless @unlock[:ruby]
end
[
- Dependency.new("ruby\0", ruby_versions),
- Dependency.new("rubygems\0", Gem::VERSION),
+ Dependency.new("Ruby\0", ruby_versions),
+ Dependency.new("RubyGems\0", Gem::VERSION),
]
end
end
@@ -915,7 +915,7 @@ module Bundler
# look for that gemspec (or its dependencies)
default = sources.default_source
source_requirements = { :default => default }
- default = nil unless Bundler.feature_flag.lockfile_uses_separate_rubygems_sources?
+ default = nil unless Bundler.feature_flag.disable_multisource?
dependencies.each do |dep|
next unless source = dep.source || default
source_requirements[dep.name] = source
@@ -929,7 +929,7 @@ module Bundler
def pinned_spec_names(skip = nil)
pinned_names = []
- default = Bundler.feature_flag.lockfile_uses_separate_rubygems_sources? && sources.default_source
+ default = Bundler.feature_flag.disable_multisource? && sources.default_source
@dependencies.each do |dep|
next unless dep_source = dep.source || default
next if dep_source == skip
@@ -977,7 +977,9 @@ module Bundler
dependencies_by_name = dependencies.inject({}) {|memo, dep| memo.update(dep.name => dep) }
@locked_gems.specs.reduce({}) do |requirements, locked_spec|
name = locked_spec.name
- next requirements if @locked_gems.dependencies[name] != dependencies_by_name[name]
+ dependency = dependencies_by_name[name]
+ next requirements if @locked_gems.dependencies[name] != dependency
+ next requirements if dependency && dependency.source.is_a?(Source::Path)
dep = Gem::Dependency.new(name, ">= #{locked_spec.version}")
requirements[name] = DepProxy.new(dep, locked_spec.platform)
requirements
diff --git a/lib/bundler/deployment.rb b/lib/bundler/deployment.rb
index 4c8f48d405..291e158ca0 100644
--- a/lib/bundler/deployment.rb
+++ b/lib/bundler/deployment.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
require "bundler/shared_helpers"
-Bundler::SharedHelpers.major_deprecation 3, "Bundler no longer integrates with " \
+Bundler::SharedHelpers.major_deprecation 2, "Bundler no longer integrates with " \
"Capistrano, but Capistrano provides its own integration with " \
"Bundler via the capistrano-bundler gem. Use it instead."
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb
index 90ac073c36..7424a5c8a4 100644
--- a/lib/bundler/dsl.rb
+++ b/lib/bundler/dsl.rb
@@ -45,7 +45,7 @@ module Bundler
@gemfiles << expanded_gemfile_path
contents ||= Bundler.read_file(@gemfile.to_s)
instance_eval(contents.dup.untaint, gemfile.to_s, 1)
- rescue Exception => e
+ rescue Exception => e # rubocop:disable Lint/RescueException
message = "There was an error " \
"#{e.is_a?(GemfileEvalError) ? "evaluating" : "parsing"} " \
"`#{File.basename gemfile.to_s}`: #{e.message}"
@@ -194,7 +194,7 @@ module Bundler
" end\n\n"
raise DeprecatedError, msg if Bundler.feature_flag.disable_multisource?
- SharedHelpers.major_deprecation(3, msg.strip)
+ SharedHelpers.major_deprecation(2, msg.strip)
end
source_options = normalize_hash(options).merge(
@@ -290,37 +290,21 @@ module Bundler
warn_deprecated_git_source(:github, <<-'RUBY'.strip, 'Change any "reponame" :github sources to "username/reponame".')
"https://github.com/#{repo_name}.git"
RUBY
- # It would be better to use https instead of the git protocol, but this
- # can break deployment of existing locked bundles when switching between
- # different versions of Bundler. The change will be made in 2.0, which
- # does not guarantee compatibility with the 1.x series.
- #
- # See https://github.com/bundler/bundler/pull/2569 for discussion
- #
- # This can be overridden by adding this code to your Gemfiles:
- #
- # git_source(:github) do |repo_name|
- # repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
- # "https://github.com/#{repo_name}.git"
- # end
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
- # TODO: 2.0 upgrade this setting to the default
- if Bundler.settings["github.https"]
- Bundler::SharedHelpers.major_deprecation 3, "The `github.https` setting will be removed"
+ if Bundler.feature_flag.github_https?
"https://github.com/#{repo_name}.git"
else
+ Bundler::SharedHelpers.major_deprecation 2, "Setting `github.https` to false is deprecated and won't be supported in the future."
"git://github.com/#{repo_name}.git"
end
end
- # TODO: 2.0 remove this deprecated git source
git_source(:gist) do |repo_name|
warn_deprecated_git_source(:gist, '"https://gist.github.com/#{repo_name}.git"')
"https://gist.github.com/#{repo_name}.git"
end
- # TODO: 2.0 remove this deprecated git source
git_source(:bitbucket) do |repo_name|
warn_deprecated_git_source(:bitbucket, <<-'RUBY'.strip)
user_name, repo_name = repo_name.split("/")
@@ -363,9 +347,7 @@ repo_name ||= user_name
if name =~ /\s/
raise GemfileError, %('#{name}' is not a valid gem name because it contains whitespace)
end
- if name.empty?
- raise GemfileError, %(an empty gem name is not valid)
- end
+ raise GemfileError, %(an empty gem name is not valid) if name.empty?
normalize_hash(opts)
@@ -443,10 +425,10 @@ repo_name ||= user_name
message = String.new
message << "You passed #{invalid_keys.map {|k| ":" + k }.join(", ")} "
message << if invalid_keys.size > 1
- "as options for #{command}, but they are invalid."
- else
- "as an option for #{command}, but it is invalid."
- end
+ "as options for #{command}, but they are invalid."
+ else
+ "as an option for #{command}, but it is invalid."
+ end
message << " Valid options are: #{valid_keys.join(", ")}."
message << " You may be able to resolve this by upgrading Bundler to the newest version."
@@ -456,7 +438,7 @@ repo_name ||= user_name
def normalize_source(source)
case source
when :gemcutter, :rubygems, :rubyforge
- Bundler::SharedHelpers.major_deprecation 3, "The source :#{source} is deprecated because HTTP " \
+ Bundler::SharedHelpers.major_deprecation 2, "The source :#{source} is deprecated because HTTP " \
"requests are insecure.\nPlease change your source to 'https://" \
"rubygems.org' if possible, or 'http://rubygems.org' if not."
"http://rubygems.org"
@@ -474,23 +456,22 @@ repo_name ||= user_name
msg = "This Gemfile contains multiple primary sources. " \
"Each source after the first must include a block to indicate which gems " \
"should come from that source"
- unless Bundler.feature_flag.bundler_3_mode?
+ unless Bundler.feature_flag.bundler_2_mode?
msg += ". To downgrade this error to a warning, run " \
- "`bundle config --delete disable_multisource`"
+ "`bundle config unset disable_multisource`"
end
raise GemfileEvalError, msg
else
- Bundler::SharedHelpers.major_deprecation 3, "Your Gemfile contains multiple primary sources. " \
+ Bundler::SharedHelpers.major_deprecation 2, "Your Gemfile contains multiple primary sources. " \
"Using `source` more than once without a block is a security risk, and " \
"may result in installing unexpected gems. To resolve this warning, use " \
"a block to indicate which gems should come from the secondary source. " \
- "To upgrade this warning to an error, run `bundle config " \
+ "To upgrade this warning to an error, run `bundle config set " \
"disable_multisource true`."
end
end
def warn_deprecated_git_source(name, replacement, additional_message = nil)
- # TODO: 2.0 remove deprecation
additional_message &&= " #{additional_message}"
replacement = if replacement.count("\n").zero?
"{|repo_name| #{replacement} }"
@@ -499,7 +480,7 @@ repo_name ||= user_name
end
Bundler::SharedHelpers.major_deprecation 3, <<-EOS
-The :#{name} git source is deprecated, and will be removed in Bundler 3.0.#{additional_message} Add this code to the top of your Gemfile to ensure it continues to work:
+The :#{name} git source is deprecated, and will be removed in the future.#{additional_message} Add this code to the top of your Gemfile to ensure it continues to work:
git_source(:#{name}) #{replacement}
@@ -601,7 +582,7 @@ The :#{name} git source is deprecated, and will be removed in Bundler 3.0.#{addi
description = self.description
if dsl_path && description =~ /((#{Regexp.quote File.expand_path(dsl_path)}|#{Regexp.quote dsl_path.to_s}):\d+)/
trace_line = Regexp.last_match[1]
- description = description.sub(/#{Regexp.quote trace_line}:\s*/, "").sub("\n", " - ")
+ description = description.sub(/\n.*\n(\.\.\.)? *\^~+$/, "").sub(/#{Regexp.quote trace_line}:\s*/, "").sub("\n", " - ")
end
[trace_line, description]
end
diff --git a/lib/bundler/env.rb b/lib/bundler/env.rb
index 51738139fa..9cd9b8baca 100644
--- a/lib/bundler/env.rb
+++ b/lib/bundler/env.rb
@@ -70,14 +70,8 @@ module Bundler
def self.ruby_version
str = String.new("#{RUBY_VERSION}")
- if RUBY_VERSION < "1.9"
- str << " (#{RUBY_RELEASE_DATE}"
- str << " patchlevel #{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
- str << ") [#{RUBY_PLATFORM}]"
- else
- str << "p#{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
- str << " (#{RUBY_RELEASE_DATE} revision #{RUBY_REVISION}) [#{RUBY_PLATFORM}]"
- end
+ str << "p#{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
+ str << " (#{RUBY_RELEASE_DATE} revision #{RUBY_REVISION}) [#{RUBY_PLATFORM}]"
end
def self.git_version
diff --git a/lib/bundler/feature_flag.rb b/lib/bundler/feature_flag.rb
index e5b4e84063..982f0fa540 100644
--- a/lib/bundler/feature_flag.rb
+++ b/lib/bundler/feature_flag.rb
@@ -19,7 +19,7 @@ module Bundler
def self.settings_method(name, key, &default)
define_method(name) do
value = Bundler.settings[key]
- value = instance_eval(&default) if value.nil? && !default.nil?
+ value = instance_eval(&default) if value.nil?
value
end
end
@@ -33,7 +33,6 @@ module Bundler
settings_flag(:auto_config_jobs) { bundler_3_mode? }
settings_flag(:cache_all) { bundler_3_mode? }
settings_flag(:cache_command_is_package) { bundler_3_mode? }
- settings_flag(:console_command) { !bundler_3_mode? }
settings_flag(:default_install_uses_path) { bundler_3_mode? }
settings_flag(:deployment_means_frozen) { bundler_3_mode? }
settings_flag(:disable_multisource) { bundler_3_mode? }
@@ -41,23 +40,17 @@ module Bundler
settings_flag(:forget_cli_options) { bundler_3_mode? }
settings_flag(:global_path_appends_ruby_scope) { bundler_3_mode? }
settings_flag(:global_gem_cache) { bundler_3_mode? }
- settings_flag(:init_gems_rb) { bundler_3_mode? }
- settings_flag(:list_command) { bundler_3_mode? }
- settings_flag(:lockfile_uses_separate_rubygems_sources) { bundler_3_mode? }
- settings_flag(:lockfile_upgrade_warning) { bundler_3_mode? }
settings_flag(:only_update_to_newer_versions) { bundler_3_mode? }
settings_flag(:path_relative_to_cwd) { bundler_3_mode? }
settings_flag(:plugins) { @bundler_version >= Gem::Version.new("1.14") }
- settings_flag(:prefer_gems_rb) { bundler_3_mode? }
settings_flag(:print_only_version_number) { bundler_3_mode? }
settings_flag(:setup_makes_kernel_gem_public) { !bundler_3_mode? }
- settings_flag(:skip_default_git_sources) { bundler_3_mode? }
+ settings_flag(:skip_default_git_sources) { bundler_4_mode? }
settings_flag(:specific_platform) { bundler_3_mode? }
settings_flag(:suppress_install_using_messages) { bundler_3_mode? }
settings_flag(:unlock_source_unlocks_spec) { !bundler_3_mode? }
settings_flag(:update_requires_all_flag) { bundler_3_mode? }
settings_flag(:use_gem_version_promoter_for_major_updates) { bundler_3_mode? }
- settings_flag(:viz_command) { !bundler_3_mode? }
settings_option(:default_cli_command) { bundler_3_mode? ? :cli_help : :install }
diff --git a/lib/bundler/fetcher.rb b/lib/bundler/fetcher.rb
index 4dd42e42ff..8397f7b72b 100644
--- a/lib/bundler/fetcher.rb
+++ b/lib/bundler/fetcher.rb
@@ -4,6 +4,7 @@ require "bundler/vendored_persistent"
require "cgi"
require "securerandom"
require "zlib"
+require "rubygems/request"
module Bundler
# Handles all the fetching with the rubygems server
@@ -15,6 +16,8 @@ module Bundler
# This error is raised when it looks like the network is down
class NetworkDownError < HTTPError; end
+ # This error is raised if we should rate limit our requests to the API
+ class TooManyRequestsError < HTTPError; end
# This error is raised if the API returns a 413 (only printed in verbose)
class FallbackError < HTTPError; end
# This is the error raised if OpenSSL fails the cert verification
@@ -44,7 +47,7 @@ module Bundler
remote_uri = filter_uri(remote_uri)
super "Authentication is required for #{remote_uri}.\n" \
"Please supply credentials for this source. You can do this by running:\n" \
- " bundle config #{remote_uri} username:password"
+ " bundle config set #{remote_uri} username:password"
end
end
# This error is raised if HTTP authentication is provided, but incorrect.
@@ -226,7 +229,7 @@ module Bundler
"GO_SERVER_URL" => "go",
"SNAP_CI" => "snap",
"CI_NAME" => ENV["CI_NAME"],
- "CI" => "ci"
+ "CI" => "ci",
}
env_cis.find_all {|env, _| ENV[env] }.map {|_, ci| ci }
end
@@ -293,8 +296,7 @@ module Bundler
end
else
store.set_default_paths
- certs = File.expand_path("../ssl_certs/*/*.pem", __FILE__)
- Dir.glob(certs).each {|c| store.add_file c }
+ Gem::Request.get_cert_files.each {|c| store.add_file c }
end
store
end
diff --git a/lib/bundler/fetcher/compact_index.rb b/lib/bundler/fetcher/compact_index.rb
index cfc74d642c..a117af72fa 100644
--- a/lib/bundler/fetcher/compact_index.rb
+++ b/lib/bundler/fetcher/compact_index.rb
@@ -39,7 +39,13 @@ module Bundler
until remaining_gems.empty?
log_specs "Looking up gems #{remaining_gems.inspect}"
- deps = compact_index_client.dependencies(remaining_gems)
+ deps = begin
+ parallel_compact_index_client.dependencies(remaining_gems)
+ rescue TooManyRequestsError
+ @bundle_worker.stop if @bundle_worker
+ @bundle_worker = nil # reset it. Not sure if necessary
+ serial_compact_index_client.dependencies(remaining_gems)
+ end
next_gems = deps.map {|d| d[3].map(&:first).flatten(1) }.flatten(1).uniq
deps.each {|dep| gem_info << dep }
complete_gems.concat(deps.map(&:first)).uniq!
@@ -80,18 +86,26 @@ module Bundler
private
def compact_index_client
- @compact_index_client ||= begin
+ @compact_index_client ||=
SharedHelpers.filesystem_access(cache_path) do
CompactIndexClient.new(cache_path, client_fetcher)
- end.tap do |client|
- client.in_parallel = lambda do |inputs, &blk|
- func = lambda {|object, _index| blk.call(object) }
- worker = bundle_worker(func)
- inputs.each {|input| worker.enq(input) }
- inputs.map { worker.deq }
- end
end
+ end
+
+ def parallel_compact_index_client
+ compact_index_client.execution_mode = lambda do |inputs, &blk|
+ func = lambda {|object, _index| blk.call(object) }
+ worker = bundle_worker(func)
+ inputs.each {|input| worker.enq(input) }
+ inputs.map { worker.deq }
end
+
+ compact_index_client
+ end
+
+ def serial_compact_index_client
+ compact_index_client.sequential_execution_mode!
+ compact_index_client
end
def bundle_worker(func = nil)
diff --git a/lib/bundler/fetcher/downloader.rb b/lib/bundler/fetcher/downloader.rb
index e0e0cbf1c9..2aeb9962c4 100644
--- a/lib/bundler/fetcher/downloader.rb
+++ b/lib/bundler/fetcher/downloader.rb
@@ -34,10 +34,12 @@ module Bundler
fetch(uri, new_headers)
when Net::HTTPRequestEntityTooLarge
raise FallbackError, response.body
+ when Net::HTTPTooManyRequests
+ raise TooManyRequestsError, response.body
when Net::HTTPUnauthorized
raise AuthenticationRequiredError, uri.host
when Net::HTTPNotFound
- raise FallbackError, "Net::HTTPNotFound"
+ raise FallbackError, "Net::HTTPNotFound: #{URICredentialsFilter.credential_filtered_uri(uri)}"
else
raise HTTPError, "#{response.class}#{": #{response.body}" unless response.body.empty?}"
end
diff --git a/lib/bundler/friendly_errors.rb b/lib/bundler/friendly_errors.rb
index ae3299a7c8..dd9b847f10 100644
--- a/lib/bundler/friendly_errors.rb
+++ b/lib/bundler/friendly_errors.rb
@@ -1,4 +1,3 @@
-# encoding: utf-8
# frozen_string_literal: true
require "cgi"
@@ -45,7 +44,7 @@ module Bundler
"Alternatively, you can increase the amount of memory the JVM is able to use by running Bundler with jruby -J-Xmx1024m -S bundle (JRuby defaults to 500MB)."
else request_issue_report_for(error)
end
- rescue
+ rescue StandardError
raise error
end
@@ -124,7 +123,7 @@ module Bundler
yield
rescue SignalException
raise
- rescue Exception => e
+ rescue Exception => e # rubocop:disable Lint/RescueException
FriendlyErrors.log_error(e)
exit FriendlyErrors.exit_status(e)
end
diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb
index 55f484f723..e9ee03b8a2 100644
--- a/lib/bundler/gem_helper.rb
+++ b/lib/bundler/gem_helper.rb
@@ -2,6 +2,7 @@
require "bundler/vendored_thor" unless defined?(Thor)
require "bundler"
+require "shellwords"
module Bundler
class GemHelper
@@ -75,7 +76,7 @@ module Bundler
def build_gem
file_name = nil
gem = ENV["BUNDLE_GEM"] ? ENV["BUNDLE_GEM"] : "gem"
- sh("#{gem} build -V '#{spec_path}'") do
+ sh(%W[#{gem} 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")
@@ -87,17 +88,21 @@ module Bundler
def install_gem(built_gem_path = nil, local = false)
built_gem_path ||= build_gem
gem = ENV["BUNDLE_GEM"] ? ENV["BUNDLE_GEM"] : "gem"
- out, _ = sh_with_code("#{gem} install '#{built_gem_path}'#{" --local" if local}")
- raise "Couldn't install gem, run `gem install #{built_gem_path}' for more detailed output" unless out[/Successfully installed/]
+ cmd = %W[#{gem} install #{built_gem_path}]
+ cmd << "--local" if local
+ out, status = sh_with_status(cmd)
+ unless status.success? && out[/Successfully installed/]
+ raise "Couldn't install gem, run `gem install #{built_gem_path}' for more detailed output"
+ end
Bundler.ui.confirm "#{name} (#{version}) installed."
end
protected
def rubygem_push(path)
- gem_command = "gem push '#{path}'"
- gem_command += " --key #{gem_key}" if gem_key
- gem_command += " --host #{allowed_push_host}" if allowed_push_host
+ gem_command = %W[gem push #{path}]
+ gem_command << "--key" << gem_key if gem_key
+ gem_command << "--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."
end
@@ -129,12 +134,14 @@ module Bundler
def perform_git_push(options = "")
cmd = "git push #{options}"
- out, code = sh_with_code(cmd)
- raise "Couldn't git push. `#{cmd}' failed with the following output:\n\n#{out}\n" unless code == 0
+ out, status = sh_with_status(cmd)
+ return if status.success?
+ cmd = cmd.shelljoin if cmd.respond_to?(:shelljoin)
+ raise "Couldn't git push. `#{cmd}' failed with the following output:\n\n#{out}\n"
end
def already_tagged?
- return false unless sh("git tag").split(/\n/).include?(version_tag)
+ return false unless sh(%w[git tag]).split(/\n/).include?(version_tag)
Bundler.ui.confirm "Tag #{version_tag} has already been created."
true
end
@@ -144,20 +151,20 @@ module Bundler
end
def clean?
- sh_with_code("git diff --exit-code")[1] == 0
+ sh_with_status(%w[git diff --exit-code])[1].success?
end
def committed?
- sh_with_code("git diff-index --quiet --cached HEAD")[1] == 0
+ sh_with_status(%w[git diff-index --quiet --cached HEAD])[1].success?
end
def tag_version
- sh "git tag -m \"Version #{version}\" #{version_tag}"
+ sh %W[git tag -m Version\ #{version} #{version_tag}]
Bundler.ui.confirm "Tagged #{version_tag}."
yield if block_given?
rescue RuntimeError
Bundler.ui.error "Untagging #{version_tag} due to error."
- sh_with_code "git tag -d #{version_tag}"
+ sh_with_status %W[git tag -d #{version_tag}]
raise
end
@@ -174,21 +181,20 @@ module Bundler
end
def sh(cmd, &block)
- out, code = sh_with_code(cmd, &block)
- unless code.zero?
+ out, status = sh_with_status(cmd, &block)
+ unless status.success?
+ cmd = cmd.shelljoin if cmd.respond_to?(:shelljoin)
raise(out.empty? ? "Running `#{cmd}` failed. Run this command directly for more detailed output." : out)
end
out
end
- def sh_with_code(cmd, &block)
- cmd += " 2>&1"
- outbuf = String.new
+ def sh_with_status(cmd, &block)
Bundler.ui.debug(cmd)
SharedHelpers.chdir(base) do
- outbuf = `#{cmd}`
- status = $?.exitstatus
- block.call(outbuf) if status.zero? && block
+ outbuf = IO.popen(cmd, :err => [:child, :out], &:read)
+ status = $?
+ block.call(outbuf) if status.success? && block
[outbuf, status]
end
end
diff --git a/lib/bundler/gem_helpers.rb b/lib/bundler/gem_helpers.rb
index 019ae10c66..9d35169b99 100644
--- a/lib/bundler/gem_helpers.rb
+++ b/lib/bundler/gem_helpers.rb
@@ -10,7 +10,7 @@ module Bundler
[Gem::Platform.new("universal-mingw32"), Gem::Platform.new("universal-mingw32")],
[Gem::Platform.new("x64-mingw32"), Gem::Platform.new("x64-mingw32")],
[Gem::Platform.new("x86_64-mingw32"), Gem::Platform.new("x64-mingw32")],
- [Gem::Platform.new("mingw32"), Gem::Platform.new("x86-mingw32")]
+ [Gem::Platform.new("mingw32"), Gem::Platform.new("x86-mingw32")],
].freeze
def generic(p)
diff --git a/lib/bundler/gem_version_promoter.rb b/lib/bundler/gem_version_promoter.rb
index adb951a7a0..ed950ad28b 100644
--- a/lib/bundler/gem_version_promoter.rb
+++ b/lib/bundler/gem_version_promoter.rb
@@ -109,7 +109,7 @@ module Bundler
must_match = minor? ? [0] : [0, 1]
matches = must_match.map {|idx| gsv.segments[idx] == lsv.segments[idx] }
- (matches.uniq == [true]) ? (gsv >= lsv) : false
+ matches.uniq == [true] ? (gsv >= lsv) : false
else
true
end
diff --git a/lib/bundler/graph.rb b/lib/bundler/graph.rb
index de6bba0214..5644e41079 100644
--- a/lib/bundler/graph.rb
+++ b/lib/bundler/graph.rb
@@ -117,7 +117,7 @@ module Bundler
:style => "filled",
:fillcolor => "#B9B9D5",
:shape => "box3d",
- :fontsize => 16
+ :fontsize => 16,
}.merge(@node_options[group])
)
end
@@ -142,7 +142,7 @@ module Bundler
g.output @output_format.to_sym => "#{@output_file}.#{@output_format}"
Bundler.ui.info "#{@output_file}.#{@output_format}"
rescue ArgumentError => e
- $stderr.puts "Unsupported output format. See Ruby-Graphviz/lib/graphviz/constants.rb"
+ warn "Unsupported output format. See Ruby-Graphviz/lib/graphviz/constants.rb"
raise e
end
end
diff --git a/lib/bundler/injector.rb b/lib/bundler/injector.rb
index 1bb29f0b36..e67469f2dd 100644
--- a/lib/bundler/injector.rb
+++ b/lib/bundler/injector.rb
@@ -123,7 +123,7 @@ module Bundler
end
end
- # evalutes a gemfile to remove the specified gem
+ # evaluates a gemfile to remove the specified gem
# from it.
def remove_deps(gemfile_path)
initial_gemfile = IO.readlines(gemfile_path)
@@ -136,8 +136,8 @@ module Bundler
removed_deps = remove_gems_from_dependencies(builder, @deps, gemfile_path)
- # abort the opertion if no gems were removed
- # no need to operate on gemfile furthur
+ # abort the operation if no gems were removed
+ # no need to operate on gemfile further
return [] if removed_deps.empty?
cleaned_gemfile = remove_gems_from_gemfile(@deps, gemfile_path)
@@ -153,8 +153,8 @@ module Bundler
# @param [Dsl] builder Dsl object of current Gemfile.
# @param [Array] gems Array of names of gems to be removed.
- # @param [Pathname] path of the Gemfile
- # @return [Array] removed_deps Array of removed dependencies.
+ # @param [Pathname] gemfile_path Path of the Gemfile.
+ # @return [Array] Array of removed dependencies.
def remove_gems_from_dependencies(builder, gems, gemfile_path)
removed_deps = []
@@ -206,7 +206,7 @@ module Bundler
nested_blocks -= 1
gemfile.each_with_index do |line, index|
- next unless !line.nil? && line.include?(block_name)
+ next unless !line.nil? && line.strip.start_with?(block_name)
if gemfile[index + 1] =~ /^\s*end\s*$/
gemfile[index] = nil
gemfile[index + 1] = nil
@@ -222,7 +222,7 @@ module Bundler
# @param [Array] removed_deps Array of removed dependencies.
# @param [Array] initial_gemfile Contents of original Gemfile before any operation.
def cross_check_for_errors(gemfile_path, original_deps, removed_deps, initial_gemfile)
- # evalute the new gemfile to look for any failure cases
+ # evaluate the new gemfile to look for any failure cases
builder = Dsl.new
builder.eval_gemfile(gemfile_path)
diff --git a/lib/bundler/inline.rb b/lib/bundler/inline.rb
index 9d25f3261a..93355c9460 100644
--- a/lib/bundler/inline.rb
+++ b/lib/bundler/inline.rb
@@ -36,6 +36,7 @@ def gemfile(install = false, options = {}, &gemfile)
opts = options.dup
ui = opts.delete(:ui) { Bundler::UI::Shell.new }
+ ui.level = "silent" if opts.delete(:quiet)
raise ArgumentError, "Unknown options: #{opts.keys.join(", ")}" unless opts.empty?
old_root = Bundler.method(:root)
diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb
index b49cfb6703..49143b38f9 100644
--- a/lib/bundler/installer.rb
+++ b/lib/bundler/installer.rb
@@ -221,7 +221,7 @@ module Bundler
def processor_count
require "etc"
Etc.nprocessors
- rescue
+ rescue StandardError
1
end
@@ -275,14 +275,7 @@ module Bundler
end
def can_install_in_parallel?
- if Bundler.rubygems.provides?(">= 2.1.0")
- true
- else
- Bundler.ui.warn "RubyGems #{Gem::VERSION} is not threadsafe, so your "\
- "gems will be installed one at a time. Upgrade to RubyGems 2.1.0 " \
- "or higher to enable parallel gem installation."
- false
- end
+ true
end
def install_in_parallel(size, standalone, force = false)
diff --git a/lib/bundler/installer/gem_installer.rb b/lib/bundler/installer/gem_installer.rb
index e5e245f970..9689911d6c 100644
--- a/lib/bundler/installer/gem_installer.rb
+++ b/lib/bundler/installer/gem_installer.rb
@@ -1,5 +1,7 @@
# frozen_string_literal: true
+require "shellwords"
+
module Bundler
class GemInstaller
attr_reader :spec, :standalone, :worker, :force, :installer
@@ -56,7 +58,9 @@ module Bundler
def spec_settings
# Fetch the build settings, if there are any
- Bundler.settings["build.#{spec.name}"]
+ if settings = Bundler.settings["build.#{spec.name}"]
+ Shellwords.shellsplit(settings)
+ end
end
def install
diff --git a/lib/bundler/installer/parallel_installer.rb b/lib/bundler/installer/parallel_installer.rb
index f8a849ccfc..469b15b96c 100644
--- a/lib/bundler/installer/parallel_installer.rb
+++ b/lib/bundler/installer/parallel_installer.rb
@@ -91,10 +91,6 @@ module Bundler
end
def call
- # Since `autoload` has the potential for threading issues on 1.8.7
- # TODO: remove in bundler 2.0
- require "bundler/gem_remote_fetcher" if RUBY_VERSION < "1.9"
-
check_for_corrupt_lockfile
if @size > 1
@@ -115,7 +111,7 @@ module Bundler
s,
s.missing_lockfile_dependencies(@specs.map(&:name)),
]
- end.reject { |a| a.last.empty? }
+ end.reject {|a| a.last.empty? }
return if missing_dependencies.empty?
warning = []
@@ -150,7 +146,7 @@ module Bundler
end
def worker_pool
- @worker_pool ||= Bundler::Worker.new @size, "Parallel Installer", lambda { |spec_install, worker_num|
+ @worker_pool ||= Bundler::Worker.new @size, "Parallel Installer", lambda {|spec_install, worker_num|
do_install(spec_install, worker_num)
}
end
diff --git a/lib/bundler/lazy_specification.rb b/lib/bundler/lazy_specification.rb
index d9cb01f810..69a721c120 100644
--- a/lib/bundler/lazy_specification.rb
+++ b/lib/bundler/lazy_specification.rb
@@ -77,7 +77,7 @@ module Bundler
if search && Gem::Platform.new(search.platform) != Gem::Platform.new(platform) && !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 specific_platform true` and install again."
+ "To use the platform-specific version of the gem, run `bundle config set specific_platform true` and install again."
search = source.specs.search(self).last
end
search.dependencies = dependencies if search && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification))
diff --git a/lib/bundler/lockfile_parser.rb b/lib/bundler/lockfile_parser.rb
index ff706fca1d..50dc1381fe 100644
--- a/lib/bundler/lockfile_parser.rb
+++ b/lib/bundler/lockfile_parser.rb
@@ -23,16 +23,14 @@ module Bundler
PATH = "PATH".freeze
PLUGIN = "PLUGIN SOURCE".freeze
SPECS = " specs:".freeze
- OPTIONS = /^ ([a-z]+): (.*)$/i
+ OPTIONS = /^ ([a-z]+): (.*)$/i.freeze
SOURCE = [GIT, GEM, PATH, PLUGIN].freeze
SECTIONS_BY_VERSION_INTRODUCED = {
- # The strings have to be dup'ed for old RG on Ruby 2.3+
- # TODO: remove dup in Bundler 2.0
- Gem::Version.create("1.0".dup) => [DEPENDENCIES, PLATFORMS, GIT, GEM, PATH].freeze,
- Gem::Version.create("1.10".dup) => [BUNDLED].freeze,
- Gem::Version.create("1.12".dup) => [RUBY].freeze,
- Gem::Version.create("1.13".dup) => [PLUGIN].freeze,
+ Gem::Version.create("1.0") => [DEPENDENCIES, PLATFORMS, GIT, GEM, PATH].freeze,
+ Gem::Version.create("1.10") => [BUNDLED].freeze,
+ Gem::Version.create("1.12") => [RUBY].freeze,
+ Gem::Version.create("1.13") => [PLUGIN].freeze,
}.freeze
KNOWN_SECTIONS = SECTIONS_BY_VERSION_INTRODUCED.values.flatten.freeze
@@ -90,7 +88,7 @@ module Bundler
send("parse_#{@state}", line)
end
end
- @sources << @rubygems_aggregate unless Bundler.feature_flag.lockfile_uses_separate_rubygems_sources?
+ @sources << @rubygems_aggregate unless Bundler.feature_flag.disable_multisource?
@specs = @specs.values.sort_by(&:identifier)
warn_for_outdated_bundler_version
rescue ArgumentError => e
@@ -109,9 +107,9 @@ module Bundler
when 0
if current_version < bundler_version
Bundler.ui.warn "Warning: the running version of Bundler (#{current_version}) is older " \
- "than the version that created the lockfile (#{bundler_version}). We suggest you " \
- "upgrade to the latest version of Bundler by running `gem " \
- "install bundler#{prerelease_text}`.\n"
+ "than the version that created the lockfile (#{bundler_version}). We suggest you to " \
+ "upgrade to the version that created the lockfile by running `gem install " \
+ "bundler:#{bundler_version}#{prerelease_text}`.\n"
end
end
end
@@ -141,7 +139,7 @@ module Bundler
@sources << @current_source
end
when GEM
- if Bundler.feature_flag.lockfile_uses_separate_rubygems_sources?
+ if Bundler.feature_flag.disable_multisource?
@opts["remotes"] = @opts.delete("remote")
@current_source = TYPES[@type].from_lock(@opts)
@sources << @current_source
@@ -185,7 +183,7 @@ module Bundler
(?:-(.*))?\))? # Optional platform
(!)? # Optional pinned marker
$ # Line end
- /xo
+ /xo.freeze
def parse_dependency(line)
return unless line =~ NAME_VERSION
diff --git a/lib/bundler/plugin.rb b/lib/bundler/plugin.rb
index 53f9806b73..996d29aafb 100644
--- a/lib/bundler/plugin.rb
+++ b/lib/bundler/plugin.rb
@@ -47,26 +47,48 @@ module Bundler
Bundler.ui.error "Failed to install plugin #{name}: #{e.message}\n #{e.backtrace.join("\n ")}"
end
+ # List installed plugins and commands
+ #
+ def list
+ installed_plugins = index.installed_plugins
+ if installed_plugins.any?
+ output = String.new
+ installed_plugins.each do |plugin|
+ output << "#{plugin}\n"
+ output << "-----\n"
+ index.plugin_commands(plugin).each do |command|
+ output << " #{command}\n"
+ end
+ output << "\n"
+ end
+ else
+ output = "No plugins installed"
+ end
+ Bundler.ui.info output
+ end
+
# Evaluates the Gemfile with a limited DSL and installs the plugins
# specified by plugin method
#
# @param [Pathname] gemfile path
# @param [Proc] block that can be evaluated for (inline) Gemfile
def gemfile_install(gemfile = nil, &inline)
- builder = DSL.new
- if block_given?
- builder.instance_eval(&inline)
- else
- builder.eval_gemfile(gemfile)
- end
- definition = builder.to_definition(nil, true)
+ Bundler.settings.temporary(:frozen => false, :deployment => false) do
+ builder = DSL.new
+ if block_given?
+ builder.instance_eval(&inline)
+ else
+ builder.eval_gemfile(gemfile)
+ end
+ definition = builder.to_definition(nil, true)
- return if definition.dependencies.empty?
+ return if definition.dependencies.empty?
- plugins = definition.dependencies.map(&:name).reject {|p| index.installed? p }
- installed_specs = Installer.new.install_definition(definition)
+ plugins = definition.dependencies.map(&:name).reject {|p| index.installed? p }
+ installed_specs = Installer.new.install_definition(definition)
- save_plugins plugins, installed_specs, builder.inferred_plugins
+ save_plugins plugins, installed_specs, builder.inferred_plugins
+ end
rescue RuntimeError => e
unless e.is_a?(GemfileError)
Bundler.ui.error "Failed to install plugin: #{e.message}\n #{e.backtrace[0]}"
diff --git a/lib/bundler/plugin/api/source.rb b/lib/bundler/plugin/api/source.rb
index 586477efb5..b33926a181 100644
--- a/lib/bundler/plugin/api/source.rb
+++ b/lib/bundler/plugin/api/source.rb
@@ -37,7 +37,7 @@ module Bundler
#
# @!attribute [rw] dependency_names
# @return [Array<String>] Names of dependencies that the source should
- # try to resolve. It is not necessary to use this list intenally. This
+ # try to resolve. It is not necessary to use this list internally. This
# is present to be compatible with `Definition` and is used by
# rubygems source.
module Source
diff --git a/lib/bundler/plugin/index.rb b/lib/bundler/plugin/index.rb
index f09587dfda..faabf3a8d1 100644
--- a/lib/bundler/plugin/index.rb
+++ b/lib/bundler/plugin/index.rb
@@ -58,7 +58,10 @@ module Bundler
raise SourceConflict.new(name, common) unless common.empty?
sources.each {|k| @sources[k] = name }
- hooks.each {|e| (@hooks[e] ||= []) << name }
+ hooks.each do |event|
+ event_hooks = (@hooks[event] ||= []) << name
+ event_hooks.uniq!
+ end
@plugin_paths[name] = path
@load_paths[name] = load_paths
@@ -100,6 +103,14 @@ module Bundler
@plugin_paths[name]
end
+ def installed_plugins
+ @plugin_paths.keys
+ end
+
+ def plugin_commands(plugin)
+ @commands.find_all {|_, n| n == plugin }.map(&:first)
+ end
+
def source?(source)
@sources.key? source
end
diff --git a/lib/bundler/plugin/installer.rb b/lib/bundler/plugin/installer.rb
index 5379c38979..4a262efac2 100644
--- a/lib/bundler/plugin/installer.rb
+++ b/lib/bundler/plugin/installer.rb
@@ -12,10 +12,15 @@ module Bundler
autoload :Git, "bundler/plugin/installer/git"
def install(names, options)
+ check_sources_consistency!(options)
+
version = options[:version] || [">= 0"]
- Bundler.settings.temporary(:lockfile_uses_separate_rubygems_sources => false, :disable_multisource => false) do
+
+ Bundler.settings.temporary(:disable_multisource => false) do
if options[:git]
install_git(names, version, options)
+ elsif options[:local_git]
+ install_local_git(names, version, options)
else
sources = options[:source] || Bundler.rubygems.sources
install_rubygems(names, version, sources)
@@ -38,22 +43,24 @@ module Bundler
private
+ def check_sources_consistency!(options)
+ if options.key?(:git) && options.key?(:local_git)
+ raise InvalidOption, "Remote and local plugin git sources can't be both specified"
+ end
+ end
+
def install_git(names, version, options)
uri = options.delete(:git)
options["uri"] = uri
- source_list = SourceList.new
- source_list.add_git_source(options)
-
- # To support both sources
- if options[:source]
- source_list.add_rubygems_source("remotes" => options[:source])
- end
+ install_all_sources(names, version, options, options[:source])
+ end
- deps = names.map {|name| Dependency.new name, version }
+ def install_local_git(names, version, options)
+ uri = options.delete(:local_git)
+ options["uri"] = uri
- definition = Definition.new(nil, deps, source_list, true)
- install_definition(definition)
+ install_all_sources(names, version, options, options[:source])
end
# Installs the plugin from rubygems source and returns the path where the
@@ -65,10 +72,16 @@ module Bundler
#
# @return [Hash] map of names to the specs of plugins installed
def install_rubygems(names, version, sources)
- deps = names.map {|name| Dependency.new name, version }
+ install_all_sources(names, version, nil, sources)
+ end
+ def install_all_sources(names, version, git_source_options, rubygems_source)
source_list = SourceList.new
- source_list.add_rubygems_source("remotes" => sources)
+
+ source_list.add_git_source(git_source_options) if git_source_options
+ source_list.add_rubygems_source("remotes" => rubygems_source) if rubygems_source
+
+ deps = names.map {|name| Dependency.new name, version }
definition = Definition.new(nil, deps, source_list, true)
install_definition(definition)
diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb
index 545b4cc88a..90f833bef1 100644
--- a/lib/bundler/resolver.rb
+++ b/lib/bundler/resolver.rb
@@ -38,8 +38,8 @@ module Bundler
@platforms = platforms
@gem_version_promoter = gem_version_promoter
@allow_bundler_dependency_conflicts = Bundler.feature_flag.allow_bundler_dependency_conflicts?
- @lockfile_uses_separate_rubygems_sources = Bundler.feature_flag.lockfile_uses_separate_rubygems_sources?
@use_gvp = Bundler.feature_flag.use_gem_version_promoter_for_major_updates? || !@gem_version_promoter.major?
+ @lockfile_uses_separate_rubygems_sources = Bundler.feature_flag.disable_multisource?
end
def start(requirements)
@@ -48,9 +48,12 @@ module Bundler
verify_gemfile_dependencies_are_found!(requirements)
dg = @resolver.resolve(requirements, @base_dg)
- dg.map(&:payload).
+ dg.
+ tap {|resolved| validate_resolved_specs!(resolved) }.
+ map(&:payload).
reject {|sg| sg.name.end_with?("\0") }.
- map(&:to_specs).flatten
+ map(&:to_specs).
+ flatten
rescue Molinillo::VersionConflict => e
message = version_conflict_message(e)
raise VersionConflict.new(e.conflicts.keys.uniq, message)
@@ -169,13 +172,13 @@ module Bundler
def name_for_explicit_dependency_source
Bundler.default_gemfile.basename.to_s
- rescue
+ rescue StandardError
"Gemfile"
end
def name_for_locking_dependency_source
Bundler.default_lockfile.basename.to_s
- rescue
+ rescue StandardError
"Gemfile.lock"
end
@@ -276,10 +279,10 @@ module Bundler
versions_with_platforms = specs.map {|s| [s.version, s.platform] }
message = String.new("Could not find gem '#{SharedHelpers.pretty_dependency(requirement)}' in #{source}#{cache_message}.\n")
message << if versions_with_platforms.any?
- "The source contains '#{name}' at: #{formatted_versions_with_platforms(versions_with_platforms)}"
- else
- "The source does not contain any versions of '#{name}'"
- end
+ "The source contains '#{name}' at: #{formatted_versions_with_platforms(versions_with_platforms)}"
+ else
+ "The source does not contain any versions of '#{name}'"
+ end
else
message = "Could not find gem '#{requirement}' in any of the gem sources " \
"listed in your Gemfile#{cache_message}."
@@ -300,9 +303,19 @@ module Bundler
end
def version_conflict_message(e)
+ # only show essential conflicts, if possible
+ conflicts = e.conflicts.dup
+ conflicts.delete_if do |_name, conflict|
+ deps = conflict.requirement_trees.map(&:last).flatten(1)
+ !Bundler::VersionRanges.empty?(*Bundler::VersionRanges.for_many(deps.map(&:requirement)))
+ end
+ e = Molinillo::VersionConflict.new(conflicts, e.specification_provider) unless conflicts.empty?
+
+ solver_name = "Bundler"
+ possibility_type = "gem"
e.message_with_trees(
- :solver_name => "Bundler",
- :possibility_type => "gem",
+ :solver_name => solver_name,
+ :possibility_type => possibility_type,
:reduce_trees => lambda do |trees|
# called first, because we want to reduce the amount of work required to find maximal empty sets
trees = trees.uniq {|t| t.flatten.map {|dep| [dep.name, dep.requirement] } }
@@ -314,10 +327,8 @@ module Bundler
end.flatten(1).select do |deps|
Bundler::VersionRanges.empty?(*Bundler::VersionRanges.for_many(deps.map(&:requirement)))
end.min_by(&:size)
- trees.reject! {|t| !maximal.include?(t.last) } if maximal
- trees = trees.sort_by {|t| t.flatten.map(&:to_s) }
- trees.uniq! {|t| t.flatten.map {|dep| [dep.name, dep.requirement] } }
+ trees.reject! {|t| !maximal.include?(t.last) } if maximal
trees.sort_by {|t| t.reverse.map(&:name) }
end,
@@ -325,7 +336,7 @@ module Bundler
:additional_message_for_conflict => lambda do |o, name, conflict|
if name == "bundler"
o << %(\n Current Bundler version:\n bundler (#{Bundler::VERSION}))
- other_bundler_required = !conflict.requirement.requirement.satisfied_by?(Gem::Version.new Bundler::VERSION)
+ other_bundler_required = !conflict.requirement.requirement.satisfied_by?(Gem::Version.new(Bundler::VERSION))
end
if name == "bundler" && other_bundler_required
@@ -352,7 +363,11 @@ module Bundler
[]
end.compact.map(&:to_s).uniq.sort
- o << "Could not find gem '#{SharedHelpers.pretty_dependency(conflict.requirement)}'"
+ metadata_requirement = name.end_with?("\0")
+
+ o << "Could not find gem '" unless metadata_requirement
+ o << SharedHelpers.pretty_dependency(conflict.requirement)
+ o << "'" unless metadata_requirement
if conflict.requirement_trees.first.size > 1
o << ", which is required by "
o << "gem '#{SharedHelpers.pretty_dependency(conflict.requirement_trees.first[-2])}',"
@@ -360,14 +375,47 @@ module Bundler
o << " "
o << if relevant_sources.empty?
- "in any of the sources.\n"
- else
- "in any of the relevant sources:\n #{relevant_sources * "\n "}\n"
- end
+ "in any of the sources.\n"
+ elsif metadata_requirement
+ "is not available in #{relevant_sources.join(" or ")}"
+ else
+ "in any of the relevant sources:\n #{relevant_sources * "\n "}\n"
+ end
end
end,
- :version_for_spec => lambda {|spec| spec.version }
+ :version_for_spec => lambda {|spec| spec.version },
+ :incompatible_version_message_for_conflict => lambda do |name, _conflict|
+ if name.end_with?("\0")
+ %(#{solver_name} found conflicting requirements for the #{name} version:)
+ else
+ %(#{solver_name} could not find compatible versions for #{possibility_type} "#{name}":)
+ end
+ end
)
end
+
+ def validate_resolved_specs!(resolved_specs)
+ resolved_specs.each do |v|
+ name = v.name
+ next unless sources = relevant_sources_for_vertex(v)
+ sources.compact!
+ if default_index = sources.index(@source_requirements[:default])
+ sources.delete_at(default_index)
+ end
+ sources.reject! {|s| s.specs[name].empty? }
+ sources.uniq!
+ next if sources.size <= 1
+
+ multisource_disabled = Bundler.feature_flag.disable_multisource?
+
+ msg = ["The gem '#{name}' was found in multiple relevant sources."]
+ msg.concat sources.map {|s| " * #{s}" }.sort
+ msg << "You #{multisource_disabled ? :must : :should} add this gem to the source block for the source you wish it to be installed from."
+ msg = msg.join("\n")
+
+ raise SecurityError, msg if multisource_disabled
+ Bundler.ui.warn "Warning: #{msg}"
+ end
+ end
end
end
diff --git a/lib/bundler/resolver/spec_group.rb b/lib/bundler/resolver/spec_group.rb
index 34d043aed7..119f63b5c8 100644
--- a/lib/bundler/resolver/spec_group.rb
+++ b/lib/bundler/resolver/spec_group.rb
@@ -94,10 +94,10 @@ module Bundler
return [] if !spec.is_a?(EndpointSpecification) && !spec.is_a?(Gem::Specification)
dependencies = []
if !spec.required_ruby_version.nil? && !spec.required_ruby_version.none?
- dependencies << DepProxy.new(Gem::Dependency.new("ruby\0", spec.required_ruby_version), platform)
+ dependencies << DepProxy.new(Gem::Dependency.new("Ruby\0", spec.required_ruby_version), platform)
end
if !spec.required_rubygems_version.nil? && !spec.required_rubygems_version.none?
- dependencies << DepProxy.new(Gem::Dependency.new("rubygems\0", spec.required_rubygems_version), platform)
+ dependencies << DepProxy.new(Gem::Dependency.new("RubyGems\0", spec.required_rubygems_version), platform)
end
dependencies
end
diff --git a/lib/bundler/retry.rb b/lib/bundler/retry.rb
index 244606dcc9..d64958ba70 100644
--- a/lib/bundler/retry.rb
+++ b/lib/bundler/retry.rb
@@ -35,10 +35,10 @@ module Bundler
private
def run(&block)
- @failed = false
+ @failed = false
@current_run += 1
@result = block.call
- rescue => e
+ rescue StandardError => e
fail_attempt(e)
end
diff --git a/lib/bundler/ruby_version.rb b/lib/bundler/ruby_version.rb
index e6c31a94c9..80dc444f93 100644
--- a/lib/bundler/ruby_version.rb
+++ b/lib/bundler/ruby_version.rb
@@ -49,7 +49,7 @@ module Bundler
([\d.]+) # ruby version
(?:p(-?\d+))? # optional patchlevel
(?:\s\((\S+)\s(.+)\))? # optional engine info
- /xo
+ /xo.freeze
# Returns a RubyVersion from the given string.
# @param [String] the version string to match.
@@ -74,7 +74,7 @@ module Bundler
@host ||= [
RbConfig::CONFIG["host_cpu"],
RbConfig::CONFIG["host_vendor"],
- RbConfig::CONFIG["host_os"]
+ RbConfig::CONFIG["host_os"],
].join("-")
end
diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb
index e9f0eac355..ccf71c8c00 100644
--- a/lib/bundler/rubygems_ext.rb
+++ b/lib/bundler/rubygems_ext.rb
@@ -2,12 +2,6 @@
require "pathname"
-if defined?(Gem::QuickLoader)
- # Gem Prelude makes me a sad panda :'(
- Gem::QuickLoader.load_full_rubygems_library
-end
-
-require "rubygems"
require "rubygems/specification"
begin
@@ -27,14 +21,16 @@ module Gem
class Specification
attr_accessor :remote, :location, :relative_loaded_from
- if instance_methods(false).map(&:to_sym).include?(:source)
+ if instance_methods(false).include?(:source)
remove_method :source
attr_writer :source
def source
(defined?(@source) && @source) || Gem::Source::Installed.new
end
else
+ # rubocop:disable Lint/DuplicateMethods
attr_accessor :source
+ # rubocop:enable Lint/DuplicateMethods
end
alias_method :rg_full_gem_path, :full_gem_path
@@ -85,10 +81,7 @@ module Gem
end
end
- # RubyGems 1.8+ used only.
- methods = instance_methods(false)
- gem_dir = methods.first.is_a?(String) ? "gem_dir" : :gem_dir
- remove_method :gem_dir if methods.include?(gem_dir)
+ remove_method :gem_dir if instance_methods(false).include?(:gem_dir)
def gem_dir
full_gem_path
end
diff --git a/lib/bundler/rubygems_gem_installer.rb b/lib/bundler/rubygems_gem_installer.rb
index 2b7fa8e0f6..b1076b4554 100644
--- a/lib/bundler/rubygems_gem_installer.rb
+++ b/lib/bundler/rubygems_gem_installer.rb
@@ -66,7 +66,7 @@ module Bundler
If you wish to continue installing the downloaded gem, and are certain it does not pose a \
security issue despite the mismatching checksum, do the following:
- 1. run `bundle config disable_checksum_validation true` to turn off checksum verification
+ 1. run `bundle config set disable_checksum_validation true` to turn off checksum verification
2. run `bundle install`
(More info: The expected SHA256 checksum was #{checksum.inspect}, but the \
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index f088c2fdfb..a4519246a9 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true
require "monitor"
-require "rubygems"
-require "rubygems/config_file"
module Bundler
class RubygemsIntegration
@@ -307,7 +305,7 @@ module Bundler
gem_from_path(path, security_policies[policy]).spec
rescue Gem::Package::FormatError
raise GemspecError, "Could not read gem at #{path}. It may be corrupted."
- rescue Exception, Gem::Exception, Gem::Security::Exception => e
+ rescue Exception, Gem::Exception, Gem::Security::Exception => e # rubocop:disable Lint/RescueException
if e.is_a?(Gem::Security::Exception) ||
e.message =~ /unknown trust policy|unsigned gem/i ||
e.message =~ /couldn't verify (meta)?data signature/i
@@ -436,40 +434,42 @@ module Bundler
# Used to make bin stubs that are not created by bundler work
# under bundler. The new Gem.bin_path only considers gems in
# +specs+
- def replace_bin_path(specs, specs_by_name)
+ def replace_bin_path(specs_by_name)
gem_class = (class << Gem; self; end)
redefine_method(gem_class, :find_spec_for_exe) do |gem_name, *args|
exec_name = args.first
+ raise ArgumentError, "you must supply exec_name" unless exec_name
spec_with_name = specs_by_name[gem_name]
- spec = if exec_name
- if spec_with_name && spec_with_name.executables.include?(exec_name)
- spec_with_name
- else
- specs.find {|s| s.executables.include?(exec_name) }
- end
- else
- spec_with_name
- end
+ matching_specs_by_exec_name = specs_by_name.values.select {|s| s.executables.include?(exec_name) }
+ spec = matching_specs_by_exec_name.delete(spec_with_name)
- unless spec
+ unless spec || !matching_specs_by_exec_name.empty?
message = "can't find executable #{exec_name} for gem #{gem_name}"
- if !exec_name || spec_with_name.nil?
+ if spec_with_name.nil?
message += ". #{gem_name} is not currently included in the bundle, " \
"perhaps you meant to add it to your #{Bundler.default_gemfile.basename}?"
end
raise Gem::Exception, message
end
- raise Gem::Exception, "no default executable for #{spec.full_name}" unless exec_name ||= spec.default_executable
-
- unless spec.name == gem_name
- Bundler::SharedHelpers.major_deprecation 3,
+ unless spec
+ spec = matching_specs_by_exec_name.shift
+ warn \
"Bundler is using a binstub that was created for a different gem (#{spec.name}).\n" \
"You should run `bundle binstub #{gem_name}` " \
"to work around a system/bundle conflict."
end
+
+ unless matching_specs_by_exec_name.empty?
+ conflicting_names = matching_specs_by_exec_name.map(&:name).join(", ")
+ warn \
+ "The `#{exec_name}` executable in the `#{spec.name}` gem is being loaded, but it's also present in other gems (#{conflicting_names}).\n" \
+ "If you meant to run the executable for another gem, make sure you use a project specific binstub (`bundle binstub <gem_name>`).\n" \
+ "If you plan to use multiple conflicting executables, generate binstubs for them and disambiguate their names."
+ end
+
spec
end
@@ -514,9 +514,18 @@ module Bundler
h
end
+ Bundler.rubygems.default_stubs.each do |stub|
+ default_spec = stub.to_spec
+ default_spec_name = default_spec.name
+ next if specs_by_name.key?(default_spec_name)
+
+ specs << default_spec
+ specs_by_name[default_spec_name] = default_spec
+ end
+
replace_gem(specs, specs_by_name)
stub_rubygems(specs)
- replace_bin_path(specs, specs_by_name)
+ replace_bin_path(specs_by_name)
replace_refresh
Gem.clear_paths
@@ -850,6 +859,16 @@ module Bundler
end
end
+ if Gem::Specification.respond_to?(:default_stubs)
+ def default_stubs
+ Gem::Specification.default_stubs("*.gemspec")
+ end
+ else
+ def default_stubs
+ Gem::Specification.send(:default_stubs, "*.gemspec")
+ end
+ end
+
def use_gemdeps(gemfile)
ENV["BUNDLE_GEMFILE"] ||= File.expand_path(gemfile)
require "bundler/gemdeps"
diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb
index 762e7b3ec6..83945868f9 100644
--- a/lib/bundler/runtime.rb
+++ b/lib/bundler/runtime.rb
@@ -163,7 +163,7 @@ module Bundler
gem_dirs = Dir["#{Gem.dir}/gems/*"]
gem_files = Dir["#{Gem.dir}/cache/*.gem"]
gemspec_files = Dir["#{Gem.dir}/specifications/*.gemspec"]
- extension_dirs = Dir["#{Gem.dir}/extensions/*/*/*"]
+ extension_dirs = Dir["#{Gem.dir}/extensions/*/*/*"] + Dir["#{Gem.dir}/bundler/gems/extensions/*/*/*"]
spec_gem_paths = []
# need to keep git sources around
spec_git_paths = @definition.spec_git_paths
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb
index 66af31dab2..5bc190865f 100644
--- a/lib/bundler/settings.rb
+++ b/lib/bundler/settings.rb
@@ -18,7 +18,6 @@ module Bundler
cache_all
cache_all_platforms
cache_command_is_package
- console_command
default_install_uses_path
deployment
deployment_means_frozen
@@ -35,23 +34,21 @@ module Bundler
frozen
gem.coc
gem.mit
+ github.https
global_path_appends_ruby_scope
global_gem_cache
ignore_messages
init_gems_rb
- list_command
- lockfile_upgrade_warning
- lockfile_uses_separate_rubygems_sources
- major_deprecations
no_install
no_prune
only_update_to_newer_versions
path_relative_to_cwd
path.system
plugins
- prefer_gems_rb
+ prefer_patch
print_only_version_number
setup_makes_kernel_gem_public
+ silence_deprecations
silence_root_warning
skip_default_git_sources
specific_platform
@@ -59,7 +56,6 @@ module Bundler
unlock_source_unlocks_spec
update_requires_all_flag
use_gem_version_promoter_for_major_updates
- viz_command
].freeze
NUMBER_KEYS = %w[
@@ -76,7 +72,9 @@ module Bundler
].freeze
DEFAULT_CONFIG = {
+ :silence_deprecations => false,
:disable_version_check => true,
+ :prefer_patch => false,
:redirect => 5,
:retry => 3,
:timeout => 10,
@@ -107,18 +105,6 @@ module Bundler
temporary(key => value)
value
else
- command = if value.nil?
- "bundle config --delete #{key}"
- else
- "bundle config #{key} #{Array(value).join(":")}"
- end
-
- Bundler::SharedHelpers.major_deprecation 3,\
- "flags passed to commands " \
- "will no longer be automatically remembered. Instead please set flags " \
- "you want remembered between commands using `bundle config " \
- "<setting name> <setting value>`, i.e. `#{command}`"
-
set_local(key, value)
end
end
@@ -407,20 +393,6 @@ module Bundler
Pathname.new(@root).join("config") if @root
end
- CONFIG_REGEX = %r{ # rubocop:disable Style/RegexpLiteral
- ^
- (BUNDLE_.+):\s # the key
- (?: !\s)? # optional exclamation mark found with ruby 1.9.3
- (['"]?) # optional opening quote
- (.* # contents of the value
- (?: # optionally, up until the next key
- (\n(?!BUNDLE).+)*
- )
- )
- \2 # matching closing quote
- $
- }xo
-
def load_config(config_file)
return {} if !config_file || ignore_config?
SharedHelpers.filesystem_access(config_file, :read) do |file|
@@ -442,7 +414,7 @@ module Bundler
(https?.*?) # URI
(\.#{Regexp.union(PER_URI_OPTIONS)})? # optional suffix key
\z
- /ix
+ /ix.freeze
# TODO: duplicates Rubygems#normalize_uri
# TODO: is this the correct place to validate mirror URIs?
diff --git a/lib/bundler/setup.rb b/lib/bundler/setup.rb
index ac6a5bf861..52a5b8889a 100644
--- a/lib/bundler/setup.rb
+++ b/lib/bundler/setup.rb
@@ -6,13 +6,14 @@ if Bundler::SharedHelpers.in_bundle?
require "bundler"
if STDOUT.tty? || ENV["BUNDLER_FORCE_TTY"]
+ Bundler.ui = Bundler::UI::Shell.new
begin
Bundler.setup
rescue Bundler::BundlerError => e
- puts "\e[31m#{e.message}\e[0m"
- puts e.backtrace.join("\n") if ENV["DEBUG"]
+ Bundler.ui.warn "\e[31m#{e.message}\e[0m"
+ Bundler.ui.warn e.backtrace.join("\n") if ENV["DEBUG"]
if e.is_a?(Bundler::GemNotFound)
- puts "\e[33mRun `bundle install` to install missing gems.\e[0m"
+ Bundler.ui.warn "\e[33mRun `bundle install` to install missing gems.\e[0m"
end
exit e.status_code
end
diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb
index d6ef25dc95..1b703c5cbc 100644
--- a/lib/bundler/shared_helpers.rb
+++ b/lib/bundler/shared_helpers.rb
@@ -3,6 +3,7 @@
require "bundler/compatibility_guard"
require "pathname"
+require "rbconfig"
require "rubygems"
require "bundler/version"
@@ -10,17 +11,6 @@ require "bundler/constants"
require "bundler/rubygems_integration"
require "bundler/current_ruby"
-module Gem
- class Dependency
- # This is only needed for RubyGems < 1.4
- unless method_defined? :requirement
- def requirement
- version_requirements
- end
- end
- end
-end
-
module Bundler
module SharedHelpers
def root
@@ -140,33 +130,28 @@ module Bundler
end
def major_deprecation(major_version, message)
- if Bundler.bundler_major_version >= major_version
+ bundler_major_version = Bundler.bundler_major_version
+ if bundler_major_version > major_version
require "bundler/errors"
- raise DeprecatedError, "[REMOVED FROM #{major_version}.0] #{message}"
+ raise DeprecatedError, "[REMOVED] #{message}"
end
- return unless prints_major_deprecations?
+ return unless bundler_major_version >= major_version && prints_major_deprecations?
@major_deprecation_ui ||= Bundler::UI::Shell.new("no-color" => true)
ui = Bundler.ui.is_a?(@major_deprecation_ui.class) ? Bundler.ui : @major_deprecation_ui
- ui.warn("[DEPRECATED FOR #{major_version}.0] #{message}")
+ ui.warn("[DEPRECATED] #{message}")
end
def print_major_deprecations!
multiple_gemfiles = search_up(".") do |dir|
gemfiles = gemfile_names.select {|gf| File.file? File.expand_path(gf, dir) }
next if gemfiles.empty?
- break false if gemfiles.size == 1
+ break gemfiles.size != 1
end
- if multiple_gemfiles && Bundler.bundler_major_version == 2
- Bundler::SharedHelpers.major_deprecation 3, \
- "gems.rb and gems.locked will be preferred to Gemfile and Gemfile.lock."
- end
-
- if RUBY_VERSION < "2"
- major_deprecation(2, "Bundler will only support ruby >= 2.0, you are running #{RUBY_VERSION}")
- end
- return if Bundler.rubygems.provides?(">= 2")
- major_deprecation(2, "Bundler will only support rubygems >= 2.0, you are running #{Bundler.rubygems.version}")
+ return unless multiple_gemfiles
+ message = "Multiple gemfiles (gems.rb and Gemfile) detected. " \
+ "Make sure you remove Gemfile and Gemfile.lock since bundler is ignoring them in favor of gems.rb and gems.rb.locked."
+ Bundler.ui.warn message
end
def trap(signal, override = false, &block)
@@ -246,13 +231,11 @@ module Bundler
def find_gemfile(order_matters = false)
given = ENV["BUNDLE_GEMFILE"]
return given if given && !given.empty?
- names = gemfile_names
- names.reverse! if order_matters && Bundler.feature_flag.prefer_gems_rb?
- find_file(*names)
+ find_file(*gemfile_names)
end
def gemfile_names
- ["Gemfile", "gems.rb"]
+ ["gems.rb", "Gemfile"]
end
def find_file(*names)
@@ -349,9 +332,6 @@ module Bundler
end
def clean_load_path
- # handle 1.9 where system gems are always on the load path
- return unless defined?(::Gem)
-
bundler_lib = bundler_ruby_lib
loaded_gem_paths = Bundler.rubygems.loaded_gem_paths
@@ -372,8 +352,7 @@ module Bundler
def prints_major_deprecations?
require "bundler"
- deprecation_release = Bundler::VERSION.split(".").drop(1).include?("99")
- return false if !deprecation_release && !Bundler.settings[:major_deprecations]
+ return false if Bundler.settings[:silence_deprecations]
require "bundler/deprecate"
return false if Bundler::Deprecate.skip
true
diff --git a/lib/bundler/similarity_detector.rb b/lib/bundler/similarity_detector.rb
index b7f3ee7afa..f698f46a4c 100644
--- a/lib/bundler/similarity_detector.rb
+++ b/lib/bundler/similarity_detector.rb
@@ -51,7 +51,7 @@ module Bundler
dm[i][j] = [
dm[i - 1][j - 1] + (this[j - 1] == that[i - 1] ? 0 : sub),
dm[i][j - 1] + ins,
- dm[i - 1][j] + del
+ dm[i - 1][j] + del,
].min
end
end
diff --git a/lib/bundler/source/git.rb b/lib/bundler/source/git.rb
index 0b00608bdd..a8afb341d8 100644
--- a/lib/bundler/source/git.rb
+++ b/lib/bundler/source/git.rb
@@ -118,18 +118,19 @@ module Bundler
def local_override!(path)
return false if local?
+ original_path = path
path = Pathname.new(path)
path = path.expand_path(Bundler.root) unless path.relative?
unless options["branch"] || Bundler.settings[:disable_local_branch_check]
raise GitError, "Cannot use local override for #{name} at #{path} because " \
- ":branch is not specified in Gemfile. Specify a branch or use " \
- "`bundle config --delete` to remove the local override"
+ ":branch is not specified in Gemfile. Specify a branch or run " \
+ "`bundle config unset local.#{override_for(original_path)}` to remove the local override"
end
unless path.exist?
raise GitError, "Cannot use local override for #{name} because #{path} " \
- "does not exist. Check `bundle config --delete` to remove the local override"
+ "does not exist. Run `bundle config unset local.#{override_for(original_path)}` to remove the local override"
end
set_local!(path)
@@ -260,7 +261,11 @@ module Bundler
end
def requires_checkout?
- allow_git_ops? && !local?
+ allow_git_ops? && !local? && !cached_revision_checked_out?
+ end
+
+ def cached_revision_checked_out?
+ cached_revision && cached_revision == revision && install_path.exist?
end
def base_name
@@ -324,6 +329,10 @@ module Bundler
def extension_cache_slug(_)
extension_dir_name
end
+
+ def override_for(path)
+ Bundler.settings.local_overrides.key(path)
+ end
end
end
end
diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb
index cd964f7e56..3db31f0237 100644
--- a/lib/bundler/source/git/git_proxy.rb
+++ b/lib/bundler/source/git/git_proxy.rb
@@ -253,7 +253,7 @@ module Bundler
ensure
STDERR.reopen backup_stderr
end
- $stderr.puts URICredentialsFilter.credential_filtered_string(captured_err, uri) if uri && !captured_err.empty?
+ Bundler.ui.warn URICredentialsFilter.credential_filtered_string(captured_err, uri) if uri && !captured_err.empty?
return_value
end
end
diff --git a/lib/bundler/source/metadata.rb b/lib/bundler/source/metadata.rb
index d9c93bfb67..559b912ffd 100644
--- a/lib/bundler/source/metadata.rb
+++ b/lib/bundler/source/metadata.rb
@@ -5,8 +5,10 @@ module Bundler
class Metadata < Source
def specs
@specs ||= Index.build do |idx|
- idx << Gem::Specification.new("ruby\0", RubyVersion.system.to_gem_version_with_patchlevel)
- idx << Gem::Specification.new("rubygems\0", Gem::VERSION)
+ idx << Gem::Specification.new("Ruby\0", RubyVersion.system.to_gem_version_with_patchlevel)
+ idx << Gem::Specification.new("RubyGems\0", Gem::VERSION) do |s|
+ s.required_rubygems_version = Gem::Requirement.default
+ end
idx << Gem::Specification.new do |s|
s.name = "bundler"
diff --git a/lib/bundler/source/path.rb b/lib/bundler/source/path.rb
index ed734bf549..5f3f1bc2e4 100644
--- a/lib/bundler/source/path.rb
+++ b/lib/bundler/source/path.rb
@@ -191,10 +191,10 @@ module Bundler
else
message = String.new("The path `#{expanded_path}` ")
message << if File.exist?(expanded_path)
- "is not a directory."
- else
- "does not exist."
- end
+ "is not a directory."
+ else
+ "does not exist."
+ end
raise PathError, message
end
diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb
index 485b388a32..86fd329089 100644
--- a/lib/bundler/source/rubygems.rb
+++ b/lib/bundler/source/rubygems.rb
@@ -51,7 +51,7 @@ module Bundler
end
def can_lock?(spec)
- return super if Bundler.feature_flag.lockfile_uses_separate_rubygems_sources?
+ return super if Bundler.feature_flag.disable_multisource?
spec.source.is_a?(Rubygems)
end
@@ -106,7 +106,7 @@ module Bundler
end
end
- if installed?(spec) && !force
+ if (installed?(spec) || Plugin.installed?(spec.name)) && !force
print_using_message "Using #{version_message(spec)}"
return nil # no post-install message
end
@@ -120,8 +120,14 @@ module Bundler
uris.uniq!
Installer.ambiguous_gems << [spec.name, *uris] if uris.length > 1
- s = Bundler.rubygems.spec_from_gem(fetch_gem(spec), Bundler.settings["trust-policy"])
- spec.__swap__(s)
+ path = fetch_gem(spec)
+ begin
+ s = Bundler.rubygems.spec_from_gem(path, Bundler.settings["trust-policy"])
+ spec.__swap__(s)
+ rescue StandardError
+ Bundler.rm_rf(path)
+ raise
+ end
end
unless Bundler.settings[:no_install]
diff --git a/lib/bundler/source_list.rb b/lib/bundler/source_list.rb
index ac2adacb3d..d3f649a12c 100644
--- a/lib/bundler/source_list.rb
+++ b/lib/bundler/source_list.rb
@@ -1,5 +1,7 @@
# frozen_string_literal: true
+require "set"
+
module Bundler
class SourceList
attr_reader :path_sources,
@@ -41,17 +43,14 @@ module Bundler
end
def global_rubygems_source=(uri)
- if Bundler.feature_flag.lockfile_uses_separate_rubygems_sources?
+ if Bundler.feature_flag.disable_multisource?
@global_rubygems_source ||= rubygems_aggregate_class.new("remotes" => uri)
end
add_rubygems_remote(uri)
end
def add_rubygems_remote(uri)
- if Bundler.feature_flag.lockfile_uses_separate_rubygems_sources?
- return if Bundler.feature_flag.disable_multisource?
- raise InvalidOption, "`lockfile_uses_separate_rubygems_sources` cannot be set without `disable_multisource` being set"
- end
+ return if Bundler.feature_flag.disable_multisource?
@rubygems_aggregate.add_remote(uri)
@rubygems_aggregate
end
@@ -77,12 +76,10 @@ module Bundler
end
def lock_sources
- if Bundler.feature_flag.lockfile_uses_separate_rubygems_sources?
- [[default_source], @rubygems_sources, git_sources, path_sources, plugin_sources].map do |sources|
- sources.sort_by(&:to_s)
- end.flatten(1)
+ lock_sources = (path_sources + git_sources + plugin_sources).sort_by(&:to_s)
+ if Bundler.feature_flag.disable_multisource?
+ lock_sources + rubygems_sources.sort_by(&:to_s)
else
- lock_sources = (path_sources + git_sources + plugin_sources).sort_by(&:to_s)
lock_sources << combine_rubygems_sources
end
end
@@ -97,7 +94,7 @@ module Bundler
end
end
- replacement_rubygems = !Bundler.feature_flag.lockfile_uses_separate_rubygems_sources? &&
+ replacement_rubygems = !Bundler.feature_flag.disable_multisource? &&
replacement_sources.detect {|s| s.is_a?(Source::Rubygems) }
@rubygems_aggregate = replacement_rubygems if replacement_rubygems
@@ -150,7 +147,7 @@ module Bundler
if source.uri =~ /^git\:/
Bundler.ui.warn "The git source `#{source.uri}` uses the `git` protocol, " \
"which transmits data without encryption. Disable this warning with " \
- "`bundle config git.allow_insecure true`, or switch to the `https` " \
+ "`bundle config set git.allow_insecure true`, or switch to the `https` " \
"protocol to keep your data secure."
end
end
diff --git a/lib/bundler/spec_set.rb b/lib/bundler/spec_set.rb
index bbdf04a7d6..2c5d9e6580 100644
--- a/lib/bundler/spec_set.rb
+++ b/lib/bundler/spec_set.rb
@@ -60,7 +60,6 @@ module Bundler
@specs << value
@lookup = nil
@sorted = nil
- value
end
def sort!
diff --git a/lib/bundler/ssl_certs/.document b/lib/bundler/ssl_certs/.document
deleted file mode 100644
index fb66f13c33..0000000000
--- a/lib/bundler/ssl_certs/.document
+++ /dev/null
@@ -1 +0,0 @@
-# Ignore all files in this directory
diff --git a/lib/bundler/ssl_certs/certificate_manager.rb b/lib/bundler/ssl_certs/certificate_manager.rb
deleted file mode 100644
index 26fc38ec18..0000000000
--- a/lib/bundler/ssl_certs/certificate_manager.rb
+++ /dev/null
@@ -1,66 +0,0 @@
-# frozen_string_literal: true
-
-require "bundler/vendored_fileutils"
-require "net/https"
-require "openssl"
-
-module Bundler
- module SSLCerts
- class CertificateManager
- attr_reader :bundler_cert_path, :bundler_certs, :rubygems_certs
-
- def self.update_from!(rubygems_path)
- new(rubygems_path).update!
- end
-
- def initialize(rubygems_path = nil)
- if rubygems_path
- rubygems_cert_path = File.join(rubygems_path, "lib/rubygems/ssl_certs")
- @rubygems_certs = certificates_in(rubygems_cert_path)
- end
-
- @bundler_cert_path = File.expand_path("..", __FILE__)
- @bundler_certs = certificates_in(bundler_cert_path)
- end
-
- def up_to_date?
- rubygems_certs.all? do |rc|
- bundler_certs.find do |bc|
- File.basename(bc) == File.basename(rc) && FileUtils.compare_file(bc, rc)
- end
- end
- end
-
- def update!
- return if up_to_date?
-
- FileUtils.rm bundler_certs
- FileUtils.cp rubygems_certs, bundler_cert_path
- end
-
- def connect_to(host)
- http = Net::HTTP.new(host, 443)
- http.use_ssl = true
- http.verify_mode = OpenSSL::SSL::VERIFY_PEER
- http.cert_store = store
- http.head("/")
- end
-
- private
-
- def certificates_in(path)
- Dir[File.join(path, "**/*.pem")].sort
- end
-
- def store
- @store ||= begin
- store = OpenSSL::X509::Store.new
- bundler_certs.each do |cert|
- store.add_file cert
- end
- store
- end
- end
- end
- end
-end
diff --git a/lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem b/lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem
deleted file mode 100644
index f4ce4ca43d..0000000000
--- a/lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem
+++ /dev/null
@@ -1,21 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkG
-A1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jv
-b3QgQ0ExGzAZBgNVBAMTEkdsb2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAw
-MDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9i
-YWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYDVQQDExJHbG9iYWxT
-aWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDaDuaZ
-jc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavp
-xy0Sy6scTHAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp
-1Wrjsok6Vjk4bwY8iGlbKk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdG
-snUOhugZitVtbNV4FpWi6cgKOOvyJBNPc1STE4U6G7weNLWLBYy5d4ux2x8gkasJ
-U26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrXgzT/LCrBbBlDSgeF59N8
-9iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8E
-BTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0B
-AQUFAAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOz
-yj1hTdNGCbM+w6DjY1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE
-38NflNUVyRRBnMRddWQVDf9VMOyGj/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymP
-AbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhHhm4qxFYxldBniYUr+WymXUad
-DKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveCX4XSQRjbgbME
-HMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
------END CERTIFICATE-----
diff --git a/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem b/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem
deleted file mode 100644
index 9e6810ab70..0000000000
--- a/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem
+++ /dev/null
@@ -1,23 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBs
-MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
-d3cuZGlnaWNlcnQuY29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5j
-ZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAwMFoXDTMxMTExMDAwMDAwMFowbDEL
-MAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UECxMQd3d3
-LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFuY2Ug
-RVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm
-+9S75S0tMqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTW
-PNt0OKRKzE0lgvdKpVMSOO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEM
-xChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFB
-Ik5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQNAQTXKFx01p8VdteZOE3
-hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUeh10aUAsg
-EsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQF
-MAMBAf8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaA
-FLE+w2kD+L9HAdSYJhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3Nec
-nzyIZgYIVyHbIUf4KmeqvxgydkAQV8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6z
-eM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFpmyPInngiK3BD41VHMWEZ71jF
-hS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkKmNEVX58Svnw2
-Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
-vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep
-+OkuE6N36B9K
------END CERTIFICATE-----
diff --git a/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem b/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem
deleted file mode 100644
index 20585f1c01..0000000000
--- a/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem
+++ /dev/null
@@ -1,25 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEU
-MBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFs
-IFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290
-MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEwNDgzOFowbzELMAkGA1UEBhMCU0Ux
-FDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRUcnVzdCBFeHRlcm5h
-bCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0EgUm9v
-dDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvt
-H7xsD821+iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9
-uMq/NzgtHj6RQa1wVsfwTz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzX
-mk6vBbOmcZSccbNQYArHE504B4YCqOmoaSYYkKtMsE8jqzpPhNjfzp/haW+710LX
-a0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy2xSoRcRdKn23tNbE7qzN
-E0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv77+ldU9U0
-WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYD
-VR0PBAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0
-Jvf6xCZU7wO94CTLVBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRU
-cnVzdCBBQjEmMCQGA1UECxMdQWRkVHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsx
-IjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENBIFJvb3SCAQEwDQYJKoZIhvcN
-AQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZlj7DYd7usQWxH
-YINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5
-6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvC
-Nr4TDea9Y355e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEX
-c4g/VhsxOBi0cQ+azcgOno4uG+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5a
-mnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ=
------END CERTIFICATE-----
diff --git a/lib/bundler/stub_specification.rb b/lib/bundler/stub_specification.rb
index 0dd024024a..bef94b505e 100644
--- a/lib/bundler/stub_specification.rb
+++ b/lib/bundler/stub_specification.rb
@@ -13,17 +13,13 @@ module Bundler
attr_accessor :stub, :ignored
- # Pre 2.2.0 did not include extension_dir
- # https://github.com/rubygems/rubygems/commit/9485ca2d101b82a946d6f327f4bdcdea6d4946ea
- if Bundler.rubygems.provides?(">= 2.2.0")
- def source=(source)
- super
- # Stub has no concept of source, which means that extension_dir may be wrong
- # This is the case for git-based gems. So, instead manually assign the extension dir
- return unless source.respond_to?(:extension_dir_name)
- path = File.join(stub.extensions_dir, source.extension_dir_name)
- stub.extension_dir = File.expand_path(path)
- end
+ def source=(source)
+ super
+ # Stub has no concept of source, which means that extension_dir may be wrong
+ # This is the case for git-based gems. So, instead manually assign the extension dir
+ return unless source.respond_to?(:extension_dir_name)
+ path = File.join(stub.extensions_dir, source.extension_dir_name)
+ stub.extension_dir = File.expand_path(path)
end
def to_yaml
@@ -32,11 +28,9 @@ module Bundler
# @!group Stub Delegates
- if Bundler.rubygems.provides?(">= 2.3")
- # This is defined directly to avoid having to load every installed spec
- def missing_extensions?
- stub.missing_extensions?
- end
+ # This is defined directly to avoid having to load every installed spec
+ def missing_extensions?
+ stub.missing_extensions?
end
def activated
@@ -57,16 +51,14 @@ module Bundler
stub.full_gem_path || method_missing(:full_gem_path)
end
- if Bundler.rubygems.provides?(">= 2.2.0")
- def full_require_paths
- stub.full_require_paths
- end
+ def full_require_paths
+ stub.full_require_paths
+ end
- # This is what we do in bundler/rubygems_ext
- # full_require_paths is always implemented in >= 2.2.0
- def load_paths
- full_require_paths
- end
+ # This is what we do in bundler/rubygems_ext
+ # full_require_paths is always implemented
+ def load_paths
+ full_require_paths
end
def loaded_from
diff --git a/lib/bundler/templates/Executable.bundler b/lib/bundler/templates/Executable.bundler
index eeda90b584..3adac41e74 100644
--- a/lib/bundler/templates/Executable.bundler
+++ b/lib/bundler/templates/Executable.bundler
@@ -11,7 +11,7 @@
require "rubygems"
m = Module.new do
- module_function
+ module_function
def invoked_as_script?
File.expand_path($0) == File.expand_path(__FILE__)
diff --git a/lib/bundler/templates/newgem/README.md.tt b/lib/bundler/templates/newgem/README.md.tt
index 868a0afe67..22ddeaa91a 100644
--- a/lib/bundler/templates/newgem/README.md.tt
+++ b/lib/bundler/templates/newgem/README.md.tt
@@ -14,7 +14,7 @@ gem '<%= config[:name] %>'
And then execute:
- $ bundle
+ $ bundle install
Or install it yourself as:
diff --git a/lib/bundler/templates/newgem/newgem.gemspec.tt b/lib/bundler/templates/newgem/newgem.gemspec.tt
index faf6f7bbc5..5505540b9e 100644
--- a/lib/bundler/templates/newgem/newgem.gemspec.tt
+++ b/lib/bundler/templates/newgem/newgem.gemspec.tt
@@ -1,8 +1,4 @@
-<%- if RUBY_VERSION < "2.0.0" -%>
-# coding: utf-8
-<%- end -%>
-
-lib = File.expand_path("../lib", __FILE__)
+lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "<%= config[:namespaced_path] %>/version"
@@ -19,18 +15,11 @@ Gem::Specification.new do |spec|
spec.license = "MIT"
<%- end -%>
- # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
- # to allow pushing to a single host or delete this section to allow pushing to any host.
- if spec.respond_to?(:metadata)
- spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
+ spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
- spec.metadata["homepage_uri"] = spec.homepage
- spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
- spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
- else
- raise "RubyGems 2.0 or newer is required to protect against " \
- "public gem pushes."
- end
+ spec.metadata["homepage_uri"] = spec.homepage
+ spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
+ spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
# 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.
@@ -45,7 +34,7 @@ Gem::Specification.new do |spec|
<%- end -%>
spec.add_development_dependency "bundler", "~> <%= config[:bundler_version] %>"
- spec.add_development_dependency "rake", "~> 10.0"
+ spec.add_development_dependency "rake", "~> 12.0"
<%- if config[:ext] -%>
spec.add_development_dependency "rake-compiler"
<%- end -%>
diff --git a/lib/bundler/templates/newgem/test/test_helper.rb.tt b/lib/bundler/templates/newgem/test/test_helper.rb.tt
index 725e3e4647..7d7db165ec 100644
--- a/lib/bundler/templates/newgem/test/test_helper.rb.tt
+++ b/lib/bundler/templates/newgem/test/test_helper.rb.tt
@@ -1,4 +1,4 @@
-$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
+$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
require "<%= config[:namespaced_path] %>"
require "minitest/autorun"
diff --git a/lib/bundler/templates/newgem/travis.yml.tt b/lib/bundler/templates/newgem/travis.yml.tt
index 7a3381a889..eab16addca 100644
--- a/lib/bundler/templates/newgem/travis.yml.tt
+++ b/lib/bundler/templates/newgem/travis.yml.tt
@@ -1,5 +1,4 @@
---
-sudo: false
language: ruby
cache: bundler
rvm:
diff --git a/lib/bundler/vendor/fileutils/lib/fileutils.rb b/lib/bundler/vendor/fileutils/lib/fileutils.rb
index cc69740845..fb7777eb49 100644
--- a/lib/bundler/vendor/fileutils/lib/fileutils.rb
+++ b/lib/bundler/vendor/fileutils/lib/fileutils.rb
@@ -1,4 +1,13 @@
# frozen_string_literal: true
+
+begin
+ require 'rbconfig'
+rescue LoadError
+ # for make mjit-headers
+end
+
+require "bundler/vendor/fileutils/lib/fileutils/version"
+
#
# = fileutils.rb
#
@@ -56,7 +65,7 @@
#
# There are some `low level' methods, which do not accept any option:
#
-# Bundler::FileUtils.copy_entry(src, dest, preserve = false, dereference = false)
+# Bundler::FileUtils.copy_entry(src, dest, preserve = false, dereference_root = false, remove_destination = false)
# Bundler::FileUtils.copy_file(src, dest, preserve = false, dereference = true)
# Bundler::FileUtils.copy_stream(srcstream, deststream)
# Bundler::FileUtils.remove_entry(path, force = false)
@@ -84,7 +93,6 @@
# files/directories. This equates to passing the <tt>:noop</tt> and
# <tt>:verbose</tt> flags to methods in Bundler::FileUtils.
#
-
module Bundler::FileUtils
def self.private_module_function(name) #:nodoc:
@@ -106,19 +114,22 @@ module Bundler::FileUtils
#
# Changes the current directory to the directory +dir+.
#
- # If this method is called with block, resumes to the old
- # working directory after the block execution finished.
+ # If this method is called with block, resumes to the previous
+ # working directory after the block execution has finished.
#
- # Bundler::FileUtils.cd('/', :verbose => true) # chdir and report it
+ # Bundler::FileUtils.cd('/') # change directory
#
- # Bundler::FileUtils.cd('/') do # chdir
+ # Bundler::FileUtils.cd('/', :verbose => true) # change directory and report it
+ #
+ # Bundler::FileUtils.cd('/') do # change directory
# # ... # do something
# end # return to original directory
#
def cd(dir, verbose: nil, &block) # :yield: dir
fu_output_message "cd #{dir}" if verbose
- Dir.chdir(dir, &block)
+ result = Dir.chdir(dir, &block)
fu_output_message 'cd -' if verbose and block
+ result
end
module_function :cd
@@ -245,15 +256,15 @@ module Bundler::FileUtils
fu_output_message "rmdir #{parents ? '-p ' : ''}#{list.join ' '}" if verbose
return if noop
list.each do |dir|
- begin
- Dir.rmdir(dir = remove_trailing_slash(dir))
- if parents
+ Dir.rmdir(dir = remove_trailing_slash(dir))
+ if parents
+ begin
until (parent = File.dirname(dir)) == '.' or parent == dir
dir = parent
Dir.rmdir(dir)
end
+ rescue Errno::ENOTEMPTY, Errno::EEXIST, Errno::ENOENT
end
- rescue Errno::ENOTEMPTY, Errno::EEXIST, Errno::ENOENT
end
end
end
@@ -295,6 +306,39 @@ module Bundler::FileUtils
#
# :call-seq:
+ # Bundler::FileUtils.cp_lr(src, dest, noop: nil, verbose: nil, dereference_root: true, remove_destination: false)
+ #
+ # Hard link +src+ to +dest+. If +src+ is a directory, this method links
+ # all its contents recursively. If +dest+ is a directory, links
+ # +src+ to +dest/src+.
+ #
+ # +src+ can be a list of files.
+ #
+ # # Installing the library "mylib" under the site_ruby directory.
+ # Bundler::FileUtils.rm_r site_ruby + '/mylib', :force => true
+ # Bundler::FileUtils.cp_lr 'lib/', site_ruby + '/mylib'
+ #
+ # # Examples of linking several files to target directory.
+ # Bundler::FileUtils.cp_lr %w(mail.rb field.rb debug/), site_ruby + '/tmail'
+ # Bundler::FileUtils.cp_lr Dir.glob('*.rb'), '/home/aamine/lib/ruby', :noop => true, :verbose => true
+ #
+ # # If you want to link all contents of a directory instead of the
+ # # directory itself, c.f. src/x -> dest/x, src/y -> dest/y,
+ # # use the following code.
+ # Bundler::FileUtils.cp_lr 'src/.', 'dest' # cp_lr('src', 'dest') makes dest/src, but this doesn't.
+ #
+ def cp_lr(src, dest, noop: nil, verbose: nil,
+ dereference_root: true, remove_destination: false)
+ fu_output_message "cp -lr#{remove_destination ? ' --remove-destination' : ''} #{[src,dest].flatten.join ' '}" if verbose
+ return if noop
+ fu_each_src_dest(src, dest) do |s, d|
+ link_entry s, d, dereference_root, remove_destination
+ end
+ end
+ module_function :cp_lr
+
+ #
+ # :call-seq:
# Bundler::FileUtils.ln_s(target, link, force: nil, noop: nil, verbose: nil)
# Bundler::FileUtils.ln_s(target, dir, force: nil, noop: nil, verbose: nil)
# Bundler::FileUtils.ln_s(targets, dir, force: nil, noop: nil, verbose: nil)
@@ -340,6 +384,26 @@ module Bundler::FileUtils
module_function :ln_sf
#
+ # Hard links a file system entry +src+ to +dest+.
+ # If +src+ is a directory, this method links its contents recursively.
+ #
+ # Both of +src+ and +dest+ must be a path name.
+ # +src+ must exist, +dest+ must not exist.
+ #
+ # If +dereference_root+ is true, this method dereferences the tree root.
+ #
+ # If +remove_destination+ is true, this method removes each destination file before copy.
+ #
+ def link_entry(src, dest, dereference_root = false, remove_destination = false)
+ Entry_.new(src, nil, dereference_root).traverse do |ent|
+ destent = Entry_.new(dest, ent.rel, false)
+ File.unlink destent.path if remove_destination && File.file?(destent.path)
+ ent.link destent.path
+ end
+ end
+ module_function :link_entry
+
+ #
# Copies a file content +src+ to +dest+. If +dest+ is a directory,
# copies +src+ to +dest/src+.
#
@@ -412,7 +476,7 @@ module Bundler::FileUtils
def copy_entry(src, dest, preserve = false, dereference_root = false, remove_destination = false)
Entry_.new(src, nil, dereference_root).wrap_traverse(proc do |ent|
destent = Entry_.new(dest, ent.rel, false)
- File.unlink destent.path if remove_destination && File.file?(destent.path)
+ File.unlink destent.path if remove_destination && (File.file?(destent.path) || File.symlink?(destent.path))
ent.copy destent.path
end, proc do |ent|
destent = Entry_.new(dest, ent.rel, false)
@@ -461,13 +525,12 @@ module Bundler::FileUtils
if destent.exist?
if destent.directory?
raise Errno::EEXIST, d
- else
- destent.remove_file if rename_cannot_overwrite_file?
end
end
begin
File.rename s, d
- rescue Errno::EXDEV
+ rescue Errno::EXDEV,
+ Errno::EPERM # move from unencrypted to encrypted dir (ext4)
copy_entry s, d, true
if secure
remove_entry_secure s, force
@@ -485,11 +548,6 @@ module Bundler::FileUtils
alias move mv
module_function :move
- def rename_cannot_overwrite_file? #:nodoc:
- /emx/ =~ RUBY_PLATFORM
- end
- private_module_function :rename_cannot_overwrite_file?
-
#
# Remove file(s) specified in +list+. This method cannot remove directories.
# All StandardErrors are ignored when the :force option is set.
@@ -601,8 +659,8 @@ module Bundler::FileUtils
#
# For details of this security vulnerability, see Perl's case:
#
- # * http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2005-0448
- # * http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2004-0452
+ # * https://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2005-0448
+ # * https://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2004-0452
#
# For fileutils.rb, this vulnerability is reported in [ruby-dev:26100].
#
@@ -626,22 +684,38 @@ module Bundler::FileUtils
unless parent_st.sticky?
raise ArgumentError, "parent directory is world writable, Bundler::FileUtils#remove_entry_secure does not work; abort: #{path.inspect} (parent directory mode #{'%o' % parent_st.mode})"
end
+
# freeze tree root
euid = Process.euid
- File.open(fullpath + '/.') {|f|
- unless fu_stat_identical_entry?(st, f.stat)
- # symlink (TOC-to-TOU attack?)
- File.unlink fullpath
- return
- end
- f.chown euid, -1
- f.chmod 0700
- unless fu_stat_identical_entry?(st, File.lstat(fullpath))
- # TOC-to-TOU attack?
- File.unlink fullpath
- return
- end
- }
+ dot_file = fullpath + "/."
+ begin
+ File.open(dot_file) {|f|
+ unless fu_stat_identical_entry?(st, f.stat)
+ # symlink (TOC-to-TOU attack?)
+ File.unlink fullpath
+ return
+ end
+ f.chown euid, -1
+ f.chmod 0700
+ }
+ rescue Errno::EISDIR # JRuby in non-native mode can't open files as dirs
+ File.lstat(dot_file).tap {|fstat|
+ unless fu_stat_identical_entry?(st, fstat)
+ # symlink (TOC-to-TOU attack?)
+ File.unlink fullpath
+ return
+ end
+ File.chown euid, -1, dot_file
+ File.chmod 0700, dot_file
+ }
+ end
+
+ unless fu_stat_identical_entry?(st, File.lstat(fullpath))
+ # TOC-to-TOU attack?
+ File.unlink fullpath
+ return
+ end
+
# ---- tree root is frozen ----
root = Entry_.new(path)
root.preorder_traverse do |ent|
@@ -742,8 +816,15 @@ module Bundler::FileUtils
#
def compare_stream(a, b)
bsize = fu_stream_blksize(a, b)
- sa = String.new(capacity: bsize)
- sb = String.new(capacity: bsize)
+
+ if RUBY_VERSION > "2.4"
+ sa = String.new(capacity: bsize)
+ sb = String.new(capacity: bsize)
+ else
+ sa = String.new
+ sb = String.new
+ end
+
begin
a.read(bsize, sa)
b.read(bsize, sb)
@@ -1001,11 +1082,6 @@ module Bundler::FileUtils
end
module_function :chown_R
- begin
- require 'etc'
- rescue LoadError # rescue LoadError for miniruby
- end
-
def fu_get_uid(user) #:nodoc:
return nil unless user
case user
@@ -1014,6 +1090,7 @@ module Bundler::FileUtils
when /\A\d+\z/
user.to_i
else
+ require 'etc'
Etc.getpwnam(user) ? Etc.getpwnam(user).uid : nil
end
end
@@ -1027,6 +1104,7 @@ module Bundler::FileUtils
when /\A\d+\z/
group.to_i
else
+ require 'etc'
Etc.getgrnam(group) ? Etc.getgrnam(group).gid : nil
end
end
@@ -1067,8 +1145,11 @@ module Bundler::FileUtils
module StreamUtils_
private
- def fu_windows?
- /mswin|mingw|bccwin|emx/ =~ RUBY_PLATFORM
+ case (defined?(::RbConfig) ? ::RbConfig::CONFIG['host_os'] : ::RUBY_PLATFORM)
+ when /mswin|mingw/
+ def fu_windows?; true end
+ else
+ def fu_windows?; false end
end
def fu_copy_stream0(src, dest, blksize = nil) #:nodoc:
@@ -1193,9 +1274,15 @@ module Bundler::FileUtils
def entries
opts = {}
opts[:encoding] = ::Encoding::UTF_8 if fu_windows?
- Dir.entries(path(), opts)\
- .reject {|n| n == '.' or n == '..' }\
- .map {|n| Entry_.new(prefix(), join(rel(), n.untaint)) }
+
+ files = if Dir.respond_to?(:children)
+ Dir.children(path, opts)
+ else
+ Dir.entries(path(), opts)
+ .reject {|n| n == '.' or n == '..' }
+ end
+
+ files.map {|n| Entry_.new(prefix(), join(rel(), n.untaint)) }
end
def stat
@@ -1250,6 +1337,22 @@ module Bundler::FileUtils
end
end
+ def link(dest)
+ case
+ when directory?
+ if !File.exist?(dest) and descendant_directory?(dest, path)
+ raise ArgumentError, "cannot link directory %s to itself %s" % [path, dest]
+ end
+ begin
+ Dir.mkdir dest
+ rescue
+ raise unless File.directory?(dest)
+ end
+ else
+ File.link path(), dest
+ end
+ end
+
def copy(dest)
lstat
case
diff --git a/lib/bundler/vendor/fileutils/lib/fileutils/version.rb b/lib/bundler/vendor/fileutils/lib/fileutils/version.rb
new file mode 100644
index 0000000000..6d8504ccd5
--- /dev/null
+++ b/lib/bundler/vendor/fileutils/lib/fileutils/version.rb
@@ -0,0 +1,5 @@
+# frozen_string_literal: true
+
+module Bundler::FileUtils
+ VERSION = "1.2.0"
+end
diff --git a/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb b/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb
index 7ecdc4b65a..41bc013143 100644
--- a/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb
+++ b/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb
@@ -50,14 +50,25 @@ module Bundler::Molinillo
incoming_edges.map(&:origin)
end
- # @return [Array<Vertex>] the vertices of {#graph} where `self` is a
+ # @return [Set<Vertex>] the vertices of {#graph} where `self` is a
# {#descendent?}
def recursive_predecessors
- vertices = predecessors
- vertices += Compatibility.flat_map(vertices, &:recursive_predecessors)
- vertices.uniq!
+ _recursive_predecessors
+ end
+
+ # @param [Set<Vertex>] vertices the set to add the predecessors to
+ # @return [Set<Vertex>] the vertices of {#graph} where `self` is a
+ # {#descendent?}
+ def _recursive_predecessors(vertices = Set.new)
+ incoming_edges.each do |edge|
+ vertex = edge.origin
+ next unless vertices.add?(vertex)
+ vertex._recursive_predecessors(vertices)
+ end
+
vertices
end
+ protected :_recursive_predecessors
# @return [Array<Vertex>] the vertices of {#graph} that have an edge with
# `self` as their {Edge#origin}
@@ -65,14 +76,25 @@ module Bundler::Molinillo
outgoing_edges.map(&:destination)
end
- # @return [Array<Vertex>] the vertices of {#graph} where `self` is an
+ # @return [Set<Vertex>] the vertices of {#graph} where `self` is an
# {#ancestor?}
def recursive_successors
- vertices = successors
- vertices += Compatibility.flat_map(vertices, &:recursive_successors)
- vertices.uniq!
+ _recursive_successors
+ end
+
+ # @param [Set<Vertex>] vertices the set to add the successors to
+ # @return [Set<Vertex>] the vertices of {#graph} where `self` is an
+ # {#ancestor?}
+ def _recursive_successors(vertices = Set.new)
+ outgoing_edges.each do |edge|
+ vertex = edge.destination
+ next unless vertices.add?(vertex)
+ vertex._recursive_successors(vertices)
+ end
+
vertices
end
+ protected :_recursive_successors
# @return [String] a string suitable for debugging
def inspect
diff --git a/lib/bundler/vendor/thor/lib/thor/actions.rb b/lib/bundler/vendor/thor/lib/thor/actions.rb
index e6698572a9..b06feac2a0 100644
--- a/lib/bundler/vendor/thor/lib/thor/actions.rb
+++ b/lib/bundler/vendor/thor/lib/thor/actions.rb
@@ -113,8 +113,10 @@ class Bundler::Thor
# the script started).
#
def relative_to_original_destination_root(path, remove_dot = true)
- path = path.dup
- if path.gsub!(@destination_stack[0], ".")
+ root = @destination_stack[0]
+ if path.start_with?(root) && [File::SEPARATOR, File::ALT_SEPARATOR, nil, ''].include?(path[root.size..root.size])
+ path = path.dup
+ path[0...root.size] = '.'
remove_dot ? (path[2..-1] || "") : path
else
path
@@ -217,6 +219,7 @@ class Bundler::Thor
shell.padding += 1 if verbose
contents = if is_uri
+ require "open-uri"
open(path, "Accept" => "application/x-thor-template", &:read)
else
open(path, &:read)
@@ -252,9 +255,16 @@ class Bundler::Thor
say_status :run, desc, config.fetch(:verbose, true)
- unless options[:pretend]
- config[:capture] ? `#{command}` : system(command.to_s)
+ return if options[:pretend]
+
+ result = config[:capture] ? `#{command}` : system(command.to_s)
+
+ if config[:abort_on_failure]
+ success = config[:capture] ? $?.success? : result
+ abort unless success
end
+
+ result
end
# Executes a ruby script (taking into account WIN32 platform quirks).
diff --git a/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb b/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb
index 4c83bebc86..cc29db05a8 100644
--- a/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb
+++ b/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb
@@ -60,6 +60,9 @@ class Bundler::Thor
# destination. If a block is given instead of destination, the content of
# the url is yielded and used as location.
#
+ # +get+ relies on open-uri, so passing application user input would provide
+ # a command injection attack vector.
+ #
# ==== Parameters
# source<String>:: the address of the given content.
# destination<String>:: the relative path to the destination root.
@@ -117,7 +120,13 @@ class Bundler::Thor
context = config.delete(:context) || instance_eval("binding")
create_file destination, nil, config do
- content = CapturableERB.new(::File.binread(source), nil, "-", "@output_buffer").tap do |erb|
+ match = ERB.version.match(/(\d+\.\d+\.\d+)/)
+ capturable_erb = if match && match[1] >= "2.2.0" # Ruby 2.6+
+ CapturableERB.new(::File.binread(source), :trim_mode => "-", :eoutvar => "@output_buffer")
+ else
+ CapturableERB.new(::File.binread(source), nil, "-", "@output_buffer")
+ end
+ content = capturable_erb.tap do |erb|
erb.filename = source
end.result(context)
content = yield(content) if block
@@ -301,7 +310,7 @@ class Bundler::Thor
def comment_lines(path, flag, *args)
flag = flag.respond_to?(:source) ? flag.source : flag
- gsub_file(path, /^(\s*)([^#|\n]*#{flag})/, '\1# \2', *args)
+ gsub_file(path, /^(\s*)([^#\n]*#{flag})/, '\1# \2', *args)
end
# Removes a file at the given location.
diff --git a/lib/bundler/vendor/thor/lib/thor/base.rb b/lib/bundler/vendor/thor/lib/thor/base.rb
index 9bd1077170..e79d03d087 100644
--- a/lib/bundler/vendor/thor/lib/thor/base.rb
+++ b/lib/bundler/vendor/thor/lib/thor/base.rb
@@ -113,7 +113,7 @@ class Bundler::Thor
end
# Whenever a class inherits from Bundler::Thor or Bundler::Thor::Group, we should track the
- # class and the file on Bundler::Thor::Base. This is the method responsable for it.
+ # class and the file on Bundler::Thor::Base. This is the method responsible for it.
#
def register_klass_file(klass) #:nodoc:
file = caller[1].match(/(.*):\d+/)[1]
@@ -466,13 +466,13 @@ class Bundler::Thor
dispatch(nil, given_args.dup, nil, config)
rescue Bundler::Thor::Error => e
config[:debug] || ENV["THOR_DEBUG"] == "1" ? (raise e) : config[:shell].error(e.message)
- exit(1) if exit_on_failure?
+ exit(false) if exit_on_failure?
rescue Errno::EPIPE
# This happens if a thor command is piped to something like `head`,
# which closes the pipe when it's done reading. This will also
# mean that if the pipe is closed, further unnecessary
# computation will not occur.
- exit(0)
+ exit(true)
end
# Allows to use private methods from parent in child classes as commands.
@@ -493,8 +493,7 @@ class Bundler::Thor
alias_method :public_task, :public_command
def handle_no_command_error(command, has_namespace = $thor_runner) #:nodoc:
- raise UndefinedCommandError, "Could not find command #{command.inspect} in #{namespace.inspect} namespace." if has_namespace
- raise UndefinedCommandError, "Could not find command #{command.inspect}."
+ raise UndefinedCommandError.new(command, all_commands.keys, (namespace if has_namespace))
end
alias_method :handle_no_task_error, :handle_no_command_error
diff --git a/lib/bundler/vendor/thor/lib/thor/error.rb b/lib/bundler/vendor/thor/lib/thor/error.rb
index 2f816081f3..16c68294e4 100644
--- a/lib/bundler/vendor/thor/lib/thor/error.rb
+++ b/lib/bundler/vendor/thor/lib/thor/error.rb
@@ -1,4 +1,23 @@
class Bundler::Thor
+ Correctable =
+ begin
+ require 'did_you_mean'
+
+ # In order to support versions of Ruby that don't have keyword
+ # arguments, we need our own spell checker class that doesn't take key
+ # words. Even though this code wouldn't be hit because of the check
+ # above, it's still necessary because the interpreter would otherwise be
+ # unable to parse the file.
+ class NoKwargSpellChecker < DidYouMean::SpellChecker # :nodoc:
+ def initialize(dictionary)
+ @dictionary = dictionary
+ end
+ end
+
+ DidYouMean::Correctable
+ rescue LoadError, NameError
+ end
+
# Bundler::Thor::Error is raised when it's caused by wrong usage of thor classes. Those
# errors have their backtrace suppressed and are nicely shown to the user.
#
@@ -10,6 +29,35 @@ class Bundler::Thor
# Raised when a command was not found.
class UndefinedCommandError < Error
+ class SpellChecker
+ attr_reader :error
+
+ def initialize(error)
+ @error = error
+ end
+
+ def corrections
+ @corrections ||= spell_checker.correct(error.command).map(&:inspect)
+ end
+
+ def spell_checker
+ NoKwargSpellChecker.new(error.all_commands)
+ end
+ end
+
+ attr_reader :command, :all_commands
+
+ def initialize(command, all_commands, namespace)
+ @command = command
+ @all_commands = all_commands
+
+ message = "Could not find command #{command.inspect}"
+ message = namespace ? "#{message} in #{namespace.inspect} namespace." : "#{message}."
+
+ super(message)
+ end
+
+ prepend Correctable if Correctable
end
UndefinedTaskError = UndefinedCommandError
@@ -22,6 +70,33 @@ class Bundler::Thor
end
class UnknownArgumentError < Error
+ class SpellChecker
+ attr_reader :error
+
+ def initialize(error)
+ @error = error
+ end
+
+ def corrections
+ @corrections ||=
+ error.unknown.flat_map { |unknown| spell_checker.correct(unknown) }.uniq.map(&:inspect)
+ end
+
+ def spell_checker
+ @spell_checker ||= NoKwargSpellChecker.new(error.switches)
+ end
+ end
+
+ attr_reader :switches, :unknown
+
+ def initialize(switches, unknown)
+ @switches = switches
+ @unknown = unknown
+
+ super("Unknown switches #{unknown.map(&:inspect).join(', ')}")
+ end
+
+ prepend Correctable if Correctable
end
class RequiredArgumentMissingError < InvocationError
@@ -29,4 +104,11 @@ class Bundler::Thor
class MalformattedArgumentError < InvocationError
end
+
+ if Correctable
+ DidYouMean::SPELL_CHECKERS.merge!(
+ 'Bundler::Thor::UndefinedCommandError' => UndefinedCommandError::SpellChecker,
+ 'Bundler::Thor::UnknownArgumentError' => UnknownArgumentError::SpellChecker
+ )
+ end
end
diff --git a/lib/bundler/vendor/thor/lib/thor/group.rb b/lib/bundler/vendor/thor/lib/thor/group.rb
index 05ddc10cd3..30db46529e 100644
--- a/lib/bundler/vendor/thor/lib/thor/group.rb
+++ b/lib/bundler/vendor/thor/lib/thor/group.rb
@@ -61,7 +61,7 @@ class Bundler::Thor::Group
invocations[name] = false
invocation_blocks[name] = block if block_given?
- class_eval <<-METHOD, __FILE__, __LINE__
+ class_eval <<-METHOD, __FILE__, __LINE__ + 1
def _invoke_#{name.to_s.gsub(/\W/, '_')}
klass, command = self.class.prepare_for_invocation(nil, #{name.inspect})
@@ -120,7 +120,7 @@ class Bundler::Thor::Group
invocations[name] = true
invocation_blocks[name] = block if block_given?
- class_eval <<-METHOD, __FILE__, __LINE__
+ class_eval <<-METHOD, __FILE__, __LINE__ + 1
def _invoke_from_option_#{name.to_s.gsub(/\W/, '_')}
return unless options[#{name.inspect}]
diff --git a/lib/bundler/vendor/thor/lib/thor/parser/options.rb b/lib/bundler/vendor/thor/lib/thor/parser/options.rb
index 70f6366842..179f4fa015 100644
--- a/lib/bundler/vendor/thor/lib/thor/parser/options.rb
+++ b/lib/bundler/vendor/thor/lib/thor/parser/options.rb
@@ -44,6 +44,7 @@ class Bundler::Thor
@shorts = {}
@switches = {}
@extra = []
+ @stopped_parsing_after_extra_index = nil
options.each do |option|
@switches[option.switch_name] = option
@@ -66,6 +67,7 @@ class Bundler::Thor
if result == OPTS_END
shift
@parsing_options = false
+ @stopped_parsing_after_extra_index ||= @extra.size
super
else
result
@@ -99,6 +101,7 @@ class Bundler::Thor
elsif @stop_on_unknown
@parsing_options = false
@extra << shifted
+ @stopped_parsing_after_extra_index ||= @extra.size
@extra << shift while peek
break
elsif match
@@ -120,9 +123,11 @@ class Bundler::Thor
end
def check_unknown!
+ to_check = @stopped_parsing_after_extra_index ? @extra[0...@stopped_parsing_after_extra_index] : @extra
+
# an unknown option starts with - or -- and has no more --'s afterward.
- unknown = @extra.select { |str| str =~ /^--?(?:(?!--).)*$/ }
- raise UnknownArgumentError, "Unknown switches '#{unknown.join(', ')}'" unless unknown.empty?
+ unknown = to_check.select { |str| str =~ /^--?(?:(?!--).)*$/ }
+ raise UnknownArgumentError.new(@switches.keys, unknown) unless unknown.empty?
end
protected
diff --git a/lib/bundler/vendor/thor/lib/thor/runner.rb b/lib/bundler/vendor/thor/lib/thor/runner.rb
index b110b8d478..65ae422d7f 100644
--- a/lib/bundler/vendor/thor/lib/thor/runner.rb
+++ b/lib/bundler/vendor/thor/lib/thor/runner.rb
@@ -3,7 +3,7 @@ require "bundler/vendor/thor/lib/thor/group"
require "bundler/vendor/thor/lib/thor/core_ext/io_binary_read"
require "yaml"
-require "digest"
+require "digest/md5"
require "pathname"
class Bundler::Thor::Runner < Bundler::Thor #:nodoc: # rubocop:disable ClassLength
@@ -90,7 +90,7 @@ class Bundler::Thor::Runner < Bundler::Thor #:nodoc: # rubocop:disable ClassLeng
end
thor_yaml[as] = {
- :filename => Digest(:MD5).hexdigest(name + as),
+ :filename => Digest::MD5.hexdigest(name + as),
:location => location,
:namespaces => Bundler::Thor::Util.namespaces_in_content(contents, base)
}
diff --git a/lib/bundler/vendor/thor/lib/thor/shell.rb b/lib/bundler/vendor/thor/lib/thor/shell.rb
index e945549324..a68cdf8a98 100644
--- a/lib/bundler/vendor/thor/lib/thor/shell.rb
+++ b/lib/bundler/vendor/thor/lib/thor/shell.rb
@@ -55,7 +55,7 @@ class Bundler::Thor
# Common methods that are delegated to the shell.
SHELL_DELEGATED_METHODS.each do |method|
- module_eval <<-METHOD, __FILE__, __LINE__
+ module_eval <<-METHOD, __FILE__, __LINE__ + 1
def #{method}(*args,&block)
shell.#{method}(*args,&block)
end
diff --git a/lib/bundler/vendor/thor/lib/thor/shell/basic.rb b/lib/bundler/vendor/thor/lib/thor/shell/basic.rb
index 5162390efd..52648fee8f 100644
--- a/lib/bundler/vendor/thor/lib/thor/shell/basic.rb
+++ b/lib/bundler/vendor/thor/lib/thor/shell/basic.rb
@@ -1,6 +1,8 @@
class Bundler::Thor
module Shell
class Basic
+ DEFAULT_TERMINAL_WIDTH = 80
+
attr_accessor :base
attr_reader :padding
@@ -45,6 +47,10 @@ class Bundler::Thor
# Asks something to the user and receives a response.
#
+ # If a default value is specified it will be presented to the user
+ # and allows them to select that value with an empty response. This
+ # option is ignored when limited answers are supplied.
+ #
# If asked to limit the correct responses, you can pass in an
# array of acceptable answers. If one of those is not supplied,
# they will be shown a message stating that one of those answers
@@ -61,6 +67,8 @@ class Bundler::Thor
# ==== Example
# ask("What is your name?")
#
+ # ask("What is the planet furthest from the sun?", :default => "Pluto")
+ #
# ask("What is your favorite Neopolitan flavor?", :limited_to => ["strawberry", "chocolate", "vanilla"])
#
# ask("What is your password?", :echo => false)
@@ -222,8 +230,20 @@ class Bundler::Thor
paras = message.split("\n\n")
paras.map! do |unwrapped|
- unwrapped.strip.tr("\n", " ").squeeze(" ").gsub(/.{1,#{width}}(?:\s|\Z)/) { ($& + 5.chr).gsub(/\n\005/, "\n").gsub(/\005/, "\n") }
- end
+ counter = 0
+ unwrapped.split(" ").inject do |memo, word|
+ word = word.gsub(/\n\005/, "\n").gsub(/\005/, "\n")
+ counter = 0 if word.include? "\n"
+ if (counter + word.length + 1) < width
+ memo = "#{memo} #{word}"
+ counter += (word.length + 1)
+ else
+ memo = "#{memo}\n#{word}"
+ counter = word.length
+ end
+ memo
+ end
+ end.compact!
paras.each do |para|
para.split("\n").each do |line|
@@ -239,11 +259,11 @@ class Bundler::Thor
#
# ==== Parameters
# destination<String>:: the destination file to solve conflicts
- # block<Proc>:: an optional block that returns the value to be used in diff
+ # block<Proc>:: an optional block that returns the value to be used in diff and merge
#
def file_collision(destination)
return true if @always_force
- options = block_given? ? "[Ynaqdh]" : "[Ynaqh]"
+ options = block_given? ? "[Ynaqdhm]" : "[Ynaqh]"
loop do
answer = ask(
@@ -267,6 +287,13 @@ class Bundler::Thor
when is?(:diff)
show_diff(destination, yield) if block_given?
say "Retrying..."
+ when is?(:merge)
+ if block_given? && !merge_tool.empty?
+ merge(destination, yield)
+ return nil
+ end
+
+ say "Please specify merge tool to `THOR_MERGE` env."
else
say file_collision_help
end
@@ -279,11 +306,11 @@ class Bundler::Thor
result = if ENV["THOR_COLUMNS"]
ENV["THOR_COLUMNS"].to_i
else
- unix? ? dynamic_width : 80
+ unix? ? dynamic_width : DEFAULT_TERMINAL_WIDTH
end
- result < 10 ? 80 : result
+ result < 10 ? DEFAULT_TERMINAL_WIDTH : result
rescue
- 80
+ DEFAULT_TERMINAL_WIDTH
end
# Called if something goes wrong during the execution. This is used by Bundler::Thor
@@ -344,6 +371,7 @@ class Bundler::Thor
q - quit, abort
d - diff, show the differences between the old and the new
h - help, show this help
+ m - merge, run merge tool
HELP
end
@@ -432,6 +460,23 @@ class Bundler::Thor
end
correct_answer
end
+
+ def merge(destination, content) #:nodoc:
+ require "tempfile"
+ Tempfile.open([File.basename(destination), File.extname(destination)], File.dirname(destination)) do |temp|
+ temp.write content
+ temp.rewind
+ system %(#{merge_tool} "#{temp.path}" "#{destination}")
+ end
+ end
+
+ def merge_tool #:nodoc:
+ @merge_tool ||= ENV["THOR_MERGE"] || git_merge_tool
+ end
+
+ def git_merge_tool #:nodoc:
+ `git config merge.tool`.rstrip rescue ""
+ end
end
end
end
diff --git a/lib/bundler/vendor/thor/lib/thor/util.rb b/lib/bundler/vendor/thor/lib/thor/util.rb
index 5d03177a28..0fe7d4d859 100644
--- a/lib/bundler/vendor/thor/lib/thor/util.rb
+++ b/lib/bundler/vendor/thor/lib/thor/util.rb
@@ -27,7 +27,7 @@ class Bundler::Thor
end
# Receives a constant and converts it to a Bundler::Thor namespace. Since Bundler::Thor
- # commands can be added to a sandbox, this method is also responsable for
+ # commands can be added to a sandbox, this method is also responsible for
# removing the sandbox namespace.
#
# This method should not be used in general because it's used to deal with
diff --git a/lib/bundler/vendor/thor/lib/thor/version.rb b/lib/bundler/vendor/thor/lib/thor/version.rb
index df8f18821a..98f2b79081 100644
--- a/lib/bundler/vendor/thor/lib/thor/version.rb
+++ b/lib/bundler/vendor/thor/lib/thor/version.rb
@@ -1,3 +1,3 @@
class Bundler::Thor
- VERSION = "0.20.0"
+ VERSION = "0.20.3"
end
diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb
index 401f62447c..cfd6300950 100644
--- a/lib/bundler/version.rb
+++ b/lib/bundler/version.rb
@@ -1,13 +1,10 @@
# frozen_string_literal: false
-# Ruby 1.9.3 and old RubyGems don't play nice with frozen version strings
-# rubocop:disable MutableConstant
-
module Bundler
# We're doing this because we might write tests that deal
# with other versions of bundler and we are unsure how to
# handle this better.
- VERSION = "2.0.1" unless defined?(::Bundler::VERSION)
+ VERSION = "2.1.0.pre.1".freeze unless defined?(::Bundler::VERSION)
def self.overwrite_loaded_gem_version
begin
diff --git a/lib/bundler/version_ranges.rb b/lib/bundler/version_ranges.rb
index ec25716cde..12a956d6a0 100644
--- a/lib/bundler/version_ranges.rb
+++ b/lib/bundler/version_ranges.rb
@@ -5,11 +5,42 @@ module Bundler
NEq = Struct.new(:version)
ReqR = Struct.new(:left, :right)
class ReqR
- Endpoint = Struct.new(:version, :inclusive)
+ Endpoint = Struct.new(:version, :inclusive) do
+ def <=>(other)
+ if version.equal?(INFINITY)
+ return 0 if other.version.equal?(INFINITY)
+ return 1
+ elsif other.version.equal?(INFINITY)
+ return -1
+ end
+
+ comp = version <=> other.version
+ return comp unless comp.zero?
+
+ if inclusive && !other.inclusive
+ 1
+ elsif !inclusive && other.inclusive
+ -1
+ else
+ 0
+ end
+ end
+ end
+
def to_s
"#{left.inclusive ? "[" : "("}#{left.version}, #{right.version}#{right.inclusive ? "]" : ")"}"
end
- INFINITY = Object.new.freeze
+ INFINITY = begin
+ inf = Object.new
+ def inf.to_s
+ "∞"
+ end
+ def inf.<=>(other)
+ return 0 if other.equal?(self)
+ 1
+ end
+ inf.freeze
+ end
ZERO = Gem::Version.new("0.a")
def cover?(v)
@@ -32,6 +63,15 @@ module Bundler
left.version == right.version
end
+ def <=>(other)
+ return -1 if other.equal?(INFINITY)
+
+ comp = left <=> other.left
+ return comp unless comp.zero?
+
+ right <=> other.right
+ end
+
UNIVERSAL = ReqR.new(ReqR::Endpoint.new(Gem::Version.new("0.a"), true), ReqR::Endpoint.new(ReqR::INFINITY, false)).freeze
end
@@ -57,7 +97,7 @@ module Bundler
end.uniq
ranges, neqs = ranges.partition {|r| !r.is_a?(NEq) }
- [ranges.sort_by {|range| [range.left.version, range.left.inclusive ? 0 : 1] }, neqs.map(&:version)]
+ [ranges.sort, neqs.map(&:version)]
end
def self.empty?(ranges, neqs)
@@ -66,8 +106,14 @@ module Bundler
next false if curr_range.single? && neqs.include?(curr_range.left.version)
next curr_range if last_range.right.version == ReqR::INFINITY
case last_range.right.version <=> curr_range.left.version
- when 1 then next curr_range
- when 0 then next(last_range.right.inclusive && curr_range.left.inclusive && !neqs.include?(curr_range.left.version) && curr_range)
+ # higher
+ when 1 then next ReqR.new(curr_range.left, last_range.right)
+ # equal
+ when 0
+ if last_range.right.inclusive && curr_range.left.inclusive && !neqs.include?(curr_range.left.version)
+ ReqR.new(curr_range.left, [curr_range.right, last_range.right].max)
+ end
+ # lower
when -1 then next false
end
end
diff --git a/lib/bundler/vlad.rb b/lib/bundler/vlad.rb
index a6b13435c9..68181e7db8 100644
--- a/lib/bundler/vlad.rb
+++ b/lib/bundler/vlad.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
require "bundler/shared_helpers"
-Bundler::SharedHelpers.major_deprecation 3,
+Bundler::SharedHelpers.major_deprecation 2,
"The Bundler task for Vlad"
# Vlad task for Bundler.
diff --git a/lib/bundler/worker.rb b/lib/bundler/worker.rb
index e91cfa7805..3471654b43 100644
--- a/lib/bundler/worker.rb
+++ b/lib/bundler/worker.rb
@@ -1,7 +1,5 @@
# frozen_string_literal: true
-require "thread"
-
module Bundler
class Worker
POISON = Object.new
@@ -62,7 +60,7 @@ module Bundler
def apply_func(obj, i)
@func.call(obj, i)
- rescue Exception => e
+ rescue Exception => e # rubocop:disable Lint/RescueException
WrappedException.new(e)
end
diff --git a/lib/bundler/yaml_serializer.rb b/lib/bundler/yaml_serializer.rb
index 0fd81c40ef..374b3bb5e3 100644
--- a/lib/bundler/yaml_serializer.rb
+++ b/lib/bundler/yaml_serializer.rb
@@ -32,7 +32,7 @@ module Bundler
(.*) # value
\1 # matching closing quote
$
- /xo
+ /xo.freeze
HASH_REGEX = /
^
@@ -40,12 +40,11 @@ module Bundler
(.+) # key
(?::(?=(?:\s|$))) # : (without the lookahead the #key includes this when : is present in value)
[ ]?
- (?: !\s)? # optional exclamation mark found with ruby 1.9.3
(['"]?) # optional opening quote
(.*) # value
\3 # matching closing quote
$
- /xo
+ /xo.freeze
def load(str)
res = {}
diff --git a/libexec/bundle_ruby b/libexec/bundle_ruby
deleted file mode 100755
index 2209c6195f..0000000000
--- a/libexec/bundle_ruby
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/env ruby
-# frozen_string_literal: true
-
-require "bundler/shared_helpers"
-
-Bundler::SharedHelpers.major_deprecation(3, "the bundle_ruby executable has been removed in favor of `bundle platform --ruby`")
-
-Signal.trap("INT") { exit 1 }
-
-require "bundler/errors"
-require "bundler/ruby_version"
-require "bundler/ruby_dsl"
-
-module Bundler
- class Dsl
- include RubyDsl
-
- attr_accessor :ruby_version
-
- def initialize
- @ruby_version = nil
- end
-
- def eval_gemfile(gemfile, contents = nil)
- contents ||= File.open(gemfile, "rb", &:read)
- instance_eval(contents, gemfile.to_s, 1)
- rescue SyntaxError => e
- bt = e.message.split("\n")[1..-1]
- raise GemfileError, ["Gemfile syntax error:", *bt].join("\n")
- rescue ScriptError, RegexpError, NameError, ArgumentError => e
- e.backtrace[0] = "#{e.backtrace[0]}: #{e.message} (#{e.class})"
- STDERR.puts e.backtrace.join("\n ")
- raise GemfileError, "There was an error in your Gemfile," \
- " and Bundler cannot continue."
- end
-
- def source(source, options = {})
- end
-
- def gem(name, *args)
- end
-
- def group(*args)
- end
- end
-end
-
-dsl = Bundler::Dsl.new
-begin
- dsl.eval_gemfile(Bundler::SharedHelpers.default_gemfile)
- ruby_version = dsl.ruby_version
- if ruby_version
- puts ruby_version
- else
- puts "No ruby version specified"
- end
-rescue Bundler::GemfileError => e
- puts e.message
- exit(-1)
-end
diff --git a/man/bundle-add.1 b/man/bundle-add.1
index 3adf3e8163..e7ef637458 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" "November 2018" "" ""
+.TH "BUNDLE\-ADD" "1" "March 2019" "" ""
.
.SH "NAME"
\fBbundle\-add\fR \- Add gem to the Gemfile and run bundle install
diff --git a/man/bundle-add.1.txt b/man/bundle-add.1.txt
index ccc101a552..59c4b82c49 100644
--- a/man/bundle-add.1.txt
+++ b/man/bundle-add.1.txt
@@ -2,16 +2,16 @@ BUNDLE-ADD(1) BUNDLE-ADD(1)
-1mNAME0m
- 1mbundle-add 22m- Add gem to the Gemfile and run bundle install
+NAME
+ bundle-add - Add gem to the Gemfile and run bundle install
-1mSYNOPSIS0m
- 1mbundle add 4m22mGEM_NAME24m [--group=GROUP] [--version=VERSION]
+SYNOPSIS
+ bundle add GEM_NAME [--group=GROUP] [--version=VERSION]
[--source=SOURCE] [--skip-install] [--strict] [--optimistic]
-1mDESCRIPTION0m
- Adds the named gem to the Gemfile and run 1mbundle install22m. 1mbundle in-0m
- 1mstall 22mcan be avoided by using the flag 1m--skip-install22m.
+DESCRIPTION
+ Adds the named gem to the Gemfile and run bundle install. bundle
+ install can be avoided by using the flag --skip-install.
Example:
@@ -26,27 +26,27 @@ BUNDLE-ADD(1) BUNDLE-ADD(1)
bundle add rails --group "development, test"
-1mOPTIONS0m
- 1m--version22m, 1m-v0m
+OPTIONS
+ --version, -v
Specify version requirements(s) for the added gem.
- 1m--group22m, 1m-g0m
+ --group, -g
Specify the group(s) for the added gem. Multiple groups should
be separated by commas.
- 1m--source22m, , 1m-s0m
+ --source, , -s
Specify the source for the added gem.
- 1m--skip-install0m
+ --skip-install
Adds the gem to the Gemfile but does not install it.
- 1m--optimistic0m
+ --optimistic
Adds optimistic declaration of version
- 1m--strict0m
+ --strict
Adds strict declaration of version
- November 2018 BUNDLE-ADD(1)
+ March 2019 BUNDLE-ADD(1)
diff --git a/man/bundle-binstubs.1 b/man/bundle-binstubs.1
index 583ab83abc..884d0dc569 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" "November 2018" "" ""
+.TH "BUNDLE\-BINSTUBS" "1" "March 2019" "" ""
.
.SH "NAME"
\fBbundle\-binstubs\fR \- Install the binstubs of the listed gems
diff --git a/man/bundle-binstubs.1.txt b/man/bundle-binstubs.1.txt
index f15a875e2d..3000d53876 100644
--- a/man/bundle-binstubs.1.txt
+++ b/man/bundle-binstubs.1.txt
@@ -2,47 +2,47 @@ BUNDLE-BINSTUBS(1) BUNDLE-BINSTUBS(1)
-1mNAME0m
- 1mbundle-binstubs 22m- Install the binstubs of the listed gems
+NAME
+ bundle-binstubs - Install the binstubs of the listed gems
-1mSYNOPSIS0m
- 1mbundle binstubs 4m22mGEM_NAME24m [--force] [--path PATH] [--standalone]
+SYNOPSIS
+ bundle binstubs GEM_NAME [--force] [--path PATH] [--standalone]
-1mDESCRIPTION0m
+DESCRIPTION
Binstubs are scripts that wrap around executables. Bundler creates a
small Ruby file (a binstub) that loads Bundler, runs the command, and
- puts it into 1mbin/22m. Binstubs are a shortcut-or alternative- to always
- using 1mbundle exec22m. This gives you a file that can by run directly, and
+ puts it into bin/. Binstubs are a shortcut-or alternative- to always
+ using bundle exec. This gives you a file that can by run directly, and
one that will always run the correct gem version used by the applica-
tion.
- For example, if you run 1mbundle binstubs rspec-core22m, Bundler will create
- the file 1mbin/rspec22m. That file will contain enough code to load Bundler,
+ 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,
tell it to load the bundled gems, and then run rspec.
- This command generates binstubs for executables in 1mGEM_NAME22m. Binstubs
- are put into 1mbin22m, or the 1m--path 22mdirectory if one has been set. Calling
+ This command generates binstubs for executables in GEM_NAME. Binstubs
+ are put into bin, or the --path directory if one has been set. Calling
binstubs with [GEM [GEM]] will create binstubs for all given gems.
-1mOPTIONS0m
- 1m--force0m
+OPTIONS
+ --force
Overwrite existing binstubs if they exist.
- 1m--path 22mThe location to install the specified binstubs to. This defaults
- to 1mbin22m.
+ --path The location to install the specified binstubs to. This defaults
+ to bin.
- 1m--standalone0m
+ --standalone
Makes binstubs that can work without depending on Rubygems or
Bundler at runtime.
- 1m--shebang0m
+ --shebang
Specify a different shebang executable name than the default
(default 'ruby')
-1mBUNDLE INSTALL --BINSTUBS0m
+BUNDLE INSTALL --BINSTUBS
To create binstubs for all the gems in the bundle you can use the
- 1m--binstubs 22mflag in bundle install(1) 4mbundle-install.1.html24m.
+ --binstubs flag in bundle install(1) bundle-install.1.html.
- November 2018 BUNDLE-BINSTUBS(1)
+ March 2019 BUNDLE-BINSTUBS(1)
diff --git a/man/bundle-check.1 b/man/bundle-check.1
index 35431972d5..1fedfb2c56 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" "November 2018" "" ""
+.TH "BUNDLE\-CHECK" "1" "March 2019" "" ""
.
.SH "NAME"
\fBbundle\-check\fR \- Verifies if dependencies are satisfied by installed gems
diff --git a/man/bundle-check.1.txt b/man/bundle-check.1.txt
index afb3fb84f6..02165ab885 100644
--- a/man/bundle-check.1.txt
+++ b/man/bundle-check.1.txt
@@ -2,32 +2,32 @@ BUNDLE-CHECK(1) BUNDLE-CHECK(1)
-1mNAME0m
- 1mbundle-check 22m- Verifies if dependencies are satisfied by installed gems
+NAME
+ bundle-check - Verifies if dependencies are satisfied by installed gems
-1mSYNOPSIS0m
- 1mbundle check 22m[--dry-run] [--gemfile=FILE] [--path=PATH]
+SYNOPSIS
+ bundle check [--dry-run] [--gemfile=FILE] [--path=PATH]
-1mDESCRIPTION0m
- 1mcheck 22msearches the local machine for each of the gems requested in the
- Gemfile. If all gems are found, Bundler prints a success message and
+DESCRIPTION
+ check searches the local machine for each of the gems requested in the
+ Gemfile. If all gems are found, Bundler prints a success message and
exits with a status of 0.
If not, the first missing gem is listed and Bundler exits status 1.
-1mOPTIONS0m
- 1m--dry-run0m
- Locks the [1mGemfile(5)22m][Gemfile(5)] before running the command.
+OPTIONS
+ --dry-run
+ Locks the [Gemfile(5)][Gemfile(5)] before running the command.
- 1m--gemfile0m
- Use the specified gemfile instead of the [1mGemfile(5)22m][Gem-
+ --gemfile
+ Use the specified gemfile instead of the [Gemfile(5)][Gem-
file(5)].
- 1m--path 22mSpecify a different path than the system default (1m$BUNDLE_PATH0m
- or 1m$GEM_HOME22m). Bundler will remember this value for future in-
- stalls 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.
- November 2018 BUNDLE-CHECK(1)
+ March 2019 BUNDLE-CHECK(1)
diff --git a/man/bundle-clean.1 b/man/bundle-clean.1
index 681f41effc..712b259372 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" "November 2018" "" ""
+.TH "BUNDLE\-CLEAN" "1" "March 2019" "" ""
.
.SH "NAME"
\fBbundle\-clean\fR \- Cleans up unused gems in your bundler directory
diff --git a/man/bundle-clean.1.txt b/man/bundle-clean.1.txt
index f4b507db65..1cfda2150e 100644
--- a/man/bundle-clean.1.txt
+++ b/man/bundle-clean.1.txt
@@ -2,25 +2,25 @@ BUNDLE-CLEAN(1) BUNDLE-CLEAN(1)
-1mNAME0m
- 1mbundle-clean 22m- Cleans up unused gems in your bundler directory
+NAME
+ bundle-clean - Cleans up unused gems in your bundler directory
-1mSYNOPSIS0m
- 1mbundle clean 22m[--dry-run] [--force]
+SYNOPSIS
+ bundle clean [--dry-run] [--force]
-1mDESCRIPTION0m
+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.
-1mOPTIONS0m
- 1m--dry-run0m
+OPTIONS
+ --dry-run
Print the changes, but do not clean the unused gems.
- 1m--force0m
- Force a clean even if 1m--path 22mis not set.
+ --force
+ Force a clean even if --path is not set.
- November 2018 BUNDLE-CLEAN(1)
+ March 2019 BUNDLE-CLEAN(1)
diff --git a/man/bundle-config.1 b/man/bundle-config.1
index 9f6faa1201..6de75c0528 100644
--- a/man/bundle-config.1
+++ b/man/bundle-config.1
@@ -1,13 +1,13 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-CONFIG" "1" "January 2019" "" ""
+.TH "BUNDLE\-CONFIG" "1" "April 2019" "" ""
.
.SH "NAME"
\fBbundle\-config\fR \- Set bundler configuration options
.
.SH "SYNOPSIS"
-\fBbundle config\fR [\fIname\fR [\fIvalue\fR]]
+\fBbundle config\fR [list|get|set|unset] [\fIname\fR [\fIvalue\fR]]
.
.SH "DESCRIPTION"
This command allows you to interact with Bundler\'s configuration system\.
@@ -30,31 +30,37 @@ Bundler default config
.IP "" 0
.
.P
-Executing \fBbundle config\fR with no parameters will print a list of all bundler configuration for the current bundle, and where that configuration was set\.
+Executing \fBbundle config list\fR with will print a list of all bundler configuration for the current bundle, and where that configuration was set\.
.
.P
-Executing \fBbundle config <name>\fR will print the value of that configuration setting, and where it was set\.
+Executing \fBbundle config get <name>\fR will print the value of that configuration setting, and where it was set\.
.
.P
-Executing \fBbundle config <name> <value>\fR will set that configuration to the value specified for all bundles executed as the current user\. The configuration will be stored in \fB~/\.bundle/config\fR\. If \fIname\fR already is set, \fIname\fR will be overridden and user will be warned\.
+Executing \fBbundle config set <name> <value>\fR will set that configuration to the value specified for all bundles executed as the current user\. The configuration will be stored in \fB~/\.bundle/config\fR\. If \fIname\fR already is set, \fIname\fR will be overridden and user will be warned\.
.
.P
-Executing \fBbundle config \-\-global <name> <value>\fR works the same as above\.
+Executing \fBbundle config set \-\-global <name> <value>\fR works the same as above\.
.
.P
-Executing \fBbundle config \-\-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 to the local application\. The configuration will be stored in \fBapp/\.bundle/config\fR\.
.
.P
-Executing \fBbundle config \-\-delete <name>\fR will delete the configuration in both local and global sources\. Not compatible with \-\-global or \-\-local flag\.
+Executing \fBbundle config unset <name>\fR will delete the configuration in both local and global sources\.
+.
+.P
+Executing \fBbundle config unset \-\-global <name>\fR will delete the configuration only from the user configuration\.
+.
+.P
+Executing \fBbundle config unset \-\-local <name> <value>\fR will delete the configuration only from the local application\.
.
.P
Executing bundle with the \fBBUNDLE_IGNORE_CONFIG\fR environment variable set will cause it to ignore all configuration\.
.
.P
-Executing \fBbundle config disable_multisource true\fR upgrades the warning about the Gemfile containing multiple primary sources to an error\. Executing \fBbundle config \-\-delete disable_multisource\fR downgrades this error to a warning\.
+Executing \fBbundle config set disable_multisource true\fR upgrades the warning about the Gemfile containing multiple primary sources to an error\. Executing \fBbundle config unset disable_multisource\fR downgrades this error to a warning\.
.
.SH "REMEMBERING OPTIONS"
-Flags passed to \fBbundle install\fR or the Bundler runtime, such as \fB\-\-path foo\fR or \fB\-\-without production\fR, are not remembered between commands\. If these options must be remembered,they must be set using \fBbundle config\fR (e\.g\., \fBbundle config path foo\fR)\.
+Flags passed to \fBbundle install\fR or the Bundler runtime, such as \fB\-\-path foo\fR or \fB\-\-without production\fR, are not remembered between commands\. If these options must be remembered, they must be set using \fBbundle config\fR (e\.g\., \fBbundle config set path foo\fR)\.
.
.P
The options that can be configured are:
@@ -102,7 +108,7 @@ Since the specific location of that executable can change from machine to machin
.
.nf
-bundle config 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
.
.fi
.
@@ -175,7 +181,7 @@ The following is a list of all configuration keys and their purpose\. You can le
\fBdisable_local_branch_check\fR (\fBBUNDLE_DISABLE_LOCAL_BRANCH_CHECK\fR): Allow Bundler to use a local git override without a branch specified in the Gemfile\.
.
.IP "\(bu" 4
-\fBdisable_multisource\fR (\fBBUNDLE_DISABLE_MULTISOURCE\fR): When set, Gemfiles containing multiple sources will produce errors instead of warnings\. Use \fBbundle config \-\-delete disable_multisource\fR to unset\.
+\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\.
@@ -217,12 +223,6 @@ The following is a list of all configuration keys and their purpose\. You can le
\fBjobs\fR (\fBBUNDLE_JOBS\fR): The number of gems Bundler can install in parallel\. Defaults to 1\.
.
.IP "\(bu" 4
-\fBlist_command\fR (\fBBUNDLE_LIST_COMMAND\fR) Enable new list command feature
-.
-.IP "\(bu" 4
-\fBmajor_deprecations\fR (\fBBUNDLE_MAJOR_DEPRECATIONS\fR): Whether Bundler should print deprecation warnings for behavior that will be changed in the next major version\.
-.
-.IP "\(bu" 4
\fBno_install\fR (\fBBUNDLE_NO_INSTALL\fR): Whether \fBbundle package\fR should skip installing gems\.
.
.IP "\(bu" 4
@@ -238,7 +238,7 @@ The following is a list of all configuration keys and their purpose\. You can le
\fBpath\.system\fR (\fBBUNDLE_PATH__SYSTEM\fR): Whether Bundler will install gems into the default system path (\fBGem\.dir\fR)\.
.
.IP "\(bu" 4
-\fBpath_relative_to_cwd\fR (\fBPATH_RELATIVE_TO_CWD\fR) Makes \fB\-\-path\fR relative to the CWD instead of the \fBGemfile\fR\.
+\fBpath_relative_to_cwd\fR (\fBBUNDLE_PATH_RELATIVE_TO_CWD\fR) Makes \fB\-\-path\fR relative to the CWD instead of the \fBGemfile\fR\.
.
.IP "\(bu" 4
\fBplugins\fR (\fBBUNDLE_PLUGINS\fR): Enable Bundler\'s experimental plugin system\.
@@ -247,6 +247,9 @@ The following is a list of all configuration keys and their purpose\. You can le
\fBprefer_gems_rb\fR (\fBBUNDLE_PREFER_GEMS_RB\fR) Prefer \fBgems\.rb\fR to \fBGemfile\fR when Bundler is searching for a Gemfile\.
.
.IP "\(bu" 4
+\fBprefer_patch\fR (BUNDLE_PREFER_PATCH): Prefer updating only to next patch version during updates\. Makes \fBbundle update\fR calls equivalent to \fBbundler update \-\-patch\fR\.
+.
+.IP "\(bu" 4
\fBprint_only_version_number\fR (\fBBUNDLE_PRINT_ONLY_VERSION_NUMBER\fR) Print only version number from \fBbundler \-\-version\fR\.
.
.IP "\(bu" 4
@@ -262,6 +265,9 @@ The following is a list of all configuration keys and their purpose\. You can le
\fBshebang\fR (\fBBUNDLE_SHEBANG\fR): The program name that should be invoked for generated binstubs\. Defaults to the ruby install name used to generate the binstub\.
.
.IP "\(bu" 4
+\fBsilence_deprecations\fR (\fBBUNDLE_SILENCE_DEPRECATIONS\fR): Whether Bundler should silence deprecation warnings for behavior that will be changed in the next major version\.
+.
+.IP "\(bu" 4
\fBsilence_root_warning\fR (\fBBUNDLE_SILENCE_ROOT_WARNING\fR): Silence the warning Bundler prints when installing gems as root\.
.
.IP "\(bu" 4
@@ -318,7 +324,7 @@ Bundler also allows you to work against a git repository locally instead of usin
.
.nf
-bundle config local\.GEM_NAME /path/to/local/git/repository
+bundle config set local\.GEM_NAME /path/to/local/git/repository
.
.fi
.
@@ -331,7 +337,7 @@ For example, in order to use a local Rack repository, a developer could call:
.
.nf
-bundle config local\.rack ~/Work/git/rack
+bundle config set local\.rack ~/Work/git/rack
.
.fi
.
@@ -353,7 +359,7 @@ Bundler supports overriding gem sources with mirrors\. This allows you to config
.
.nf
-bundle config mirror\.SOURCE_URL MIRROR_URL
+bundle config set mirror\.SOURCE_URL MIRROR_URL
.
.fi
.
@@ -366,7 +372,7 @@ For example, to use a mirror of rubygems\.org hosted at rubygems\-mirror\.org:
.
.nf
-bundle config mirror\.http://rubygems\.org http://rubygems\-mirror\.org
+bundle config set mirror\.http://rubygems\.org http://rubygems\-mirror\.org
.
.fi
.
@@ -379,7 +385,7 @@ Each mirror also provides a fallback timeout setting\. If the mirror does not re
.
.nf
-bundle config mirror\.SOURCE_URL\.fallback_timeout TIMEOUT
+bundle config set mirror\.SOURCE_URL\.fallback_timeout TIMEOUT
.
.fi
.
@@ -392,7 +398,7 @@ For example, to fall back to rubygems\.org after 3 seconds:
.
.nf
-bundle config mirror\.https://rubygems\.org\.fallback_timeout 3
+bundle config set mirror\.https://rubygems\.org\.fallback_timeout 3
.
.fi
.
@@ -408,7 +414,7 @@ Bundler allows you to configure credentials for any gem source, which allows you
.
.nf
-bundle config SOURCE_HOSTNAME USERNAME:PASSWORD
+bundle config set SOURCE_HOSTNAME USERNAME:PASSWORD
.
.fi
.
@@ -421,7 +427,7 @@ For example, to save the credentials of user \fBclaudette\fR for the gem source
.
.nf
-bundle config gems\.longerous\.com claudette:s00pers3krit
+bundle config set gems\.longerous\.com claudette:s00pers3krit
.
.fi
.
@@ -447,7 +453,7 @@ For gems with a git source with HTTP(S) URL you can specify credentials like so:
.
.nf
-bundle config https://github\.com/bundler/bundler\.git username:password
+bundle config set https://github\.com/bundler/bundler\.git username:password
.
.fi
.
diff --git a/man/bundle-config.1.txt b/man/bundle-config.1.txt
index 648edc1b0c..86deec54b5 100644
--- a/man/bundle-config.1.txt
+++ b/man/bundle-config.1.txt
@@ -2,101 +2,106 @@ BUNDLE-CONFIG(1) BUNDLE-CONFIG(1)
-1mNAME0m
- 1mbundle-config 22m- Set bundler configuration options
+NAME
+ bundle-config - Set bundler configuration options
-1mSYNOPSIS0m
- 1mbundle config 22m[4mname24m [4mvalue24m]]
+SYNOPSIS
+ bundle config [list|get|set|unset] [name [value]]
-1mDESCRIPTION0m
+DESCRIPTION
This command allows you to interact with Bundler's configuration sys-
tem.
Bundler loads configuration settings in this order:
- 1. Local config (1mapp/.bundle/config22m)
+ 1. Local config (app/.bundle/config)
- 2. Environmental variables (1mENV22m)
+ 2. Environmental variables (ENV)
- 3. Global config (1m~/.bundle/config22m)
+ 3. Global config (~/.bundle/config)
4. Bundler default config
- Executing 1mbundle config 22mwith no parameters will print a list of all
- bundler configuration for the current bundle, and where that configura-
- tion was set.
+ Executing bundle config list with will print a list of all bundler con-
+ figuration for the current bundle, and where that configuration was
+ set.
- Executing 1mbundle config <name> 22mwill print the value of that configura-
- tion setting, and where it was set.
+ Executing bundle config get <name> will print the value of that config-
+ uration setting, and where it was set.
- Executing 1mbundle config <name> <value> 22mwill set that configuration to
- the value specified for all bundles executed as the current user. The
- configuration will be stored in 1m~/.bundle/config22m. If 4mname24m already is
- set, 4mname24m will be overridden and user will be warned.
+ 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 1mbundle config --global <name> <value> 22mworks the same as
+ Executing bundle config set --global <name> <value> works the same as
above.
- Executing 1mbundle config --local <name> <value> 22mwill set that configura-
- tion to the local application. The configuration will be stored in
- 1mapp/.bundle/config22m.
+ 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 1mbundle config --delete <name> 22mwill delete the configuration
- in both local and global sources. Not compatible with --global or --lo-
- cal flag.
+ Executing bundle config unset <name> will delete the configuration in
+ both local and global sources.
- Executing bundle with the 1mBUNDLE_IGNORE_CONFIG 22menvironment variable set
+ Executing bundle config unset --global <name> will delete the configu-
+ ration only from the user configuration.
+
+ 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 1mbundle config disable_multisource true 22mupgrades the warning
- about the Gemfile containing multiple primary sources to an error. Exe-
- cuting 1mbundle config --delete disable_multisource 22mdowngrades this error
+ 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.
-1mREMEMBERING OPTIONS0m
- Flags passed to 1mbundle install 22mor the Bundler runtime, such as 1m--path0m
- 1mfoo 22mor 1m--without production22m, are not remembered between commands. If
- these options must be remembered,they must be set using 1mbundle config0m
- (e.g., 1mbundle config path foo22m).
+REMEMBERING OPTIONS
+ Flags passed to bundle install or the Bundler runtime, such as --path
+ foo or --without production, are not remembered between commands. If
+ these options must be remembered, they must be set using bundle config
+ (e.g., bundle config set path foo).
The options that can be configured are:
- 1mbin 22mCreates a directory (defaults to 1m~/bin22m) and place any executa-
+ bin Creates a directory (defaults to ~/bin) and place any executa-
bles from the gem there. These executables run in Bundler's con-
- text. If used, you might add this directory to your environ-
- ment's 1mPATH 22mvariable. For instance, if the 1mrails 22mgem comes with
- a 1mrails 22mexecutable, this flag will create a 1mbin/rails 22mexecutable
- that ensures that all referred dependencies will be resolved us-
- ing the bundled gems.
-
- 1mdeployment0m
- In deployment mode, Bundler will 'roll-out' the bundle for 1mpro-0m
- 1mduction 22muse. Please check carefully if you want to have this op-
- tion enabled in 1mdevelopment 22mor 1mtest 22menvironments.
-
- 1mpath 22mThe location to install the specified gems to. This defaults to
- Rubygems' setting. Bundler shares this location with Rubygems,
- 1mgem install ... 22mwill have gem installed there, too. Therefore,
- gems installed without a 1m--path ... 22msetting will show up by
- calling 1mgem list22m. Accordingly, gems installed to other locations
+ 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.
+
+ 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.
+
+ 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.
- 1mwithout0m
+ without
A space-separated list of groups referencing gems to skip during
installation.
- 1mwith 22mA space-separated list of groups referencing gems to include
+ with A space-separated list of groups referencing gems to include
during installation.
-1mBUILD OPTIONS0m
- You can use 1mbundle config 22mto give Bundler the flags to pass to the gem
+BUILD OPTIONS
+ 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 1mmysql 22mgem, requires Snow Leopard users to
- pass configuration flags to 1mgem install 22mto specify where to find the
- 1mmysql_config 22mexecutable.
+ 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.
@@ -104,280 +109,283 @@ BUNDLE-CONFIG(1) BUNDLE-CONFIG(1)
- 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 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
- 1mmysql 22mgem, it will pass along the flags you specified.
+ After running this command, every time bundler needs to install the
+ mysql gem, it will pass along the flags you specified.
-1mCONFIGURATION KEYS0m
- Configuration keys in bundler have two forms: the canonical form and
+CONFIGURATION KEYS
+ Configuration keys in bundler have two forms: the canonical form and
the environment variable form.
- For instance, passing the 1m--without 22mflag to bundle install(1) 4mbun-0m
- 4mdle-install.1.html24m prevents Bundler from installing certain groups
- specified in the Gemfile(5). Bundler persists this value in 1mapp/.bun-0m
- 1mdle/config 22mso that calls to 1mBundler.setup 22mdo not try to find gems from
- the 1mGemfile 22mthat you didn't install. Additionally, subsequent calls to
- bundle install(1) 4mbundle-install.1.html24m remember this setting and skip
+ For instance, passing the --without flag to bundle install(1) bun-
+ dle-install.1.html prevents Bundler from installing certain groups
+ specified in the Gemfile(5). Bundler persists this value in app/.bun-
+ dle/config so that calls to Bundler.setup do not try to find gems from
+ the Gemfile that you didn't install. Additionally, subsequent calls to
+ bundle install(1) bundle-install.1.html remember this setting and skip
those groups.
- The canonical form of this configuration is 1m"without"22m. To convert the
- canonical form to the environment variable form, capitalize it, and
- prepend 1mBUNDLE_22m. The environment variable form of 1m"without" 22mis 1mBUN-0m
- 1mDLE_WITHOUT22m.
+ The canonical form of this configuration is "without". To convert the
+ canonical form to the environment variable form, capitalize it, and
+ prepend BUNDLE_. The environment variable form of "without" is BUN-
+ DLE_WITHOUT.
- Any periods in the configuration keys must be replaced with two under-
+ Any periods in the configuration keys must be replaced with two under-
scores when setting it via environment variables. The configuration key
- 1mlocal.rack 22mbecomes the environment variable 1mBUNDLE_LOCAL__RACK22m.
+ local.rack becomes the environment variable BUNDLE_LOCAL__RACK.
-1mLIST OF AVAILABLE KEYS0m
- The following is a list of all configuration keys and their purpose.
- You can learn more about their operation in bundle install(1) 4mbun-0m
- 4mdle-install.1.html24m.
+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.
- o 1mallow_bundler_dependency_conflicts 22m(1mBUNDLE_ALLOW_BUNDLER_DEPEN-0m
- 1mDENCY_CONFLICTS22m): Allow resolving to specifications that have de-
- pendencies on 1mbundler 22mthat are incompatible with the running
+ 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 1mallow_deployment_source_credential_changes 22m(1mBUNDLE_ALLOW_DEPLOY-0m
- 1mMENT_SOURCE_CREDENTIAL_CHANGES22m): When in deployment mode, allow
- changing the credentials to a gem's source. Ex:
- 1mhttps://some.host.com/gems/path/ 22m-> 1mhttps://user_name:pass-0m
- 1mword@some.host.com/gems/path0m
+ 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 1mallow_offline_install 22m(1mBUNDLE_ALLOW_OFFLINE_INSTALL22m): Allow Bundler
+ o allow_offline_install (BUNDLE_ALLOW_OFFLINE_INSTALL): Allow Bundler
to use cached data when installing without network access.
- o 1mauto_clean_without_path 22m(1mBUNDLE_AUTO_CLEAN_WITHOUT_PATH22m): Automati-
- cally run 1mbundle clean 22mafter installing when an explicit 1mpath 22mhas
+ 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 1mauto_install 22m(1mBUNDLE_AUTO_INSTALL22m): Automatically run 1mbundle in-0m
- 1mstall 22mwhen gems are missing.
+ o auto_install (BUNDLE_AUTO_INSTALL): Automatically run bundle
+ install when gems are missing.
- o 1mbin 22m(1mBUNDLE_BIN22m): Install executables from gems in the bundle to
- the specified directory. Defaults to 1mfalse22m.
+ o bin (BUNDLE_BIN): Install executables from gems in the bundle to
+ the specified directory. Defaults to false.
- o 1mcache_all 22m(1mBUNDLE_CACHE_ALL22m): Cache all gems, including path and
+ o cache_all (BUNDLE_CACHE_ALL): Cache all gems, including path and
git gems.
- o 1mcache_all_platforms 22m(1mBUNDLE_CACHE_ALL_PLATFORMS22m): Cache gems for
+ o cache_all_platforms (BUNDLE_CACHE_ALL_PLATFORMS): Cache gems for
all platforms.
- o 1mcache_path 22m(1mBUNDLE_CACHE_PATH22m): The directory that bundler will
- place cached gems in when running 1mbundle package22m, and that bundler
- will look in when installing gems. Defaults to 1mvendor/bundle22m.
+ 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/bundle.
- o 1mclean 22m(1mBUNDLE_CLEAN22m): Whether Bundler should run 1mbundle clean 22mauto-
- matically after 1mbundle install22m.
+ o clean (BUNDLE_CLEAN): Whether Bundler should run bundle clean auto-
+ matically after bundle install.
- o 1mconsole 22m(1mBUNDLE_CONSOLE22m): The console that 1mbundle console 22mstarts.
- Defaults to 1mirb22m.
+ o console (BUNDLE_CONSOLE): The console that bundle console starts.
+ Defaults to irb.
- o 1mdefault_install_uses_path 22m(1mBUNDLE_DEFAULT_INSTALL_USES_PATH22m):
- Whether a 1mbundle install 22mwithout an explicit 1m--path 22margument de-
- faults to installing gems in 1m.bundle22m.
+ 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 1mdeployment 22m(1mBUNDLE_DEPLOYMENT22m): Disallow changes to the 1mGemfile22m.
- When the 1mGemfile 22mis changed and the lockfile has not been updated,
+ o deployment (BUNDLE_DEPLOYMENT): Disallow changes to the Gemfile.
+ When the Gemfile is changed and the lockfile has not been updated,
running Bundler commands will be blocked.
- o 1mdisable_checksum_validation 22m(1mBUNDLE_DISABLE_CHECKSUM_VALIDATION22m):
- Allow installing gems even if they do not match the checksum pro-
+ o disable_checksum_validation (BUNDLE_DISABLE_CHECKSUM_VALIDATION):
+ Allow installing gems even if they do not match the checksum pro-
vided by RubyGems.
- o 1mdisable_exec_load 22m(1mBUNDLE_DISABLE_EXEC_LOAD22m): Stop Bundler from us-
- ing 1mload 22mto launch an executable in-process in 1mbundle exec22m.
+ o disable_exec_load (BUNDLE_DISABLE_EXEC_LOAD): Stop Bundler from
+ using load to launch an executable in-process in bundle exec.
- o 1mdisable_local_branch_check 22m(1mBUNDLE_DISABLE_LOCAL_BRANCH_CHECK22m): Al-
- low Bundler to use a local git override without a branch specified
- in the Gemfile.
+ 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 1mdisable_multisource 22m(1mBUNDLE_DISABLE_MULTISOURCE22m): When set, Gem-
- files containing multiple sources will produce errors instead of
- warnings. Use 1mbundle config --delete disable_multisource 22mto unset.
+ 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 1mdisable_platform_warnings 22m(1mBUNDLE_DISABLE_PLATFORM_WARNINGS22m): Dis-
- able warnings during bundle install when a dependency is unused on
+ o disable_platform_warnings (BUNDLE_DISABLE_PLATFORM_WARNINGS): Dis-
+ able warnings during bundle install when a dependency is unused on
the current platform.
- o 1mdisable_shared_gems 22m(1mBUNDLE_DISABLE_SHARED_GEMS22m): Stop Bundler from
+ o disable_shared_gems (BUNDLE_DISABLE_SHARED_GEMS): Stop Bundler from
accessing gems installed to RubyGems' normal location.
- o 1mdisable_version_check 22m(1mBUNDLE_DISABLE_VERSION_CHECK22m): Stop Bundler
- from checking if a newer Bundler version is available on
+ o disable_version_check (BUNDLE_DISABLE_VERSION_CHECK): Stop Bundler
+ from checking if a newer Bundler version is available on
rubygems.org.
- o 1merror_on_stderr 22m(1mBUNDLE_ERROR_ON_STDERR22m): Print Bundler errors to
+ o error_on_stderr (BUNDLE_ERROR_ON_STDERR): Print Bundler errors to
stderr.
- o 1mforce_ruby_platform 22m(1mBUNDLE_FORCE_RUBY_PLATFORM22m): Ignore the cur-
- rent machine's platform and install only 1mruby 22mplatform gems. As a
+ o force_ruby_platform (BUNDLE_FORCE_RUBY_PLATFORM): Ignore the cur-
+ rent machine's platform and install only ruby platform gems. As a
result, gems with native extensions will be compiled from source.
- o 1mfrozen 22m(1mBUNDLE_FROZEN22m): Disallow changes to the 1mGemfile22m. When the
- 1mGemfile 22mis changed and the lockfile has not been updated, running
- Bundler commands will be blocked. Defaults to 1mtrue 22mwhen 1m--deploy-0m
- 1mment 22mis 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 --deploy-
+ ment is used.
- o 1mgem.push_key 22m(1mBUNDLE_GEM__PUSH_KEY22m): Sets the 1m--key 22mparameter for
- 1mgem push 22mwhen using the 1mrake release 22mcommand with a private gem-
+ o gem.push_key (BUNDLE_GEM__PUSH_KEY): Sets the --key parameter for
+ gem push when using the rake release command with a private gem-
stash server.
- o 1mgemfile 22m(1mBUNDLE_GEMFILE22m): The name of the file that bundler should
- use as the 1mGemfile22m. This location of this file also sets the root
- of the project, which is used to resolve relative paths in the 1mGem-0m
- 1mfile22m, among other things. By default, bundler will search up from
- the current working directory until it finds a 1mGemfile22m.
+ 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 1mglobal_gem_cache 22m(1mBUNDLE_GLOBAL_GEM_CACHE22m): Whether Bundler should
+ o global_gem_cache (BUNDLE_GLOBAL_GEM_CACHE): Whether Bundler should
cache all gems globally, rather than locally to the installing Ruby
installation.
- o 1mglobal_path_appends_ruby_scope 22m(1mBUNDLE_GLOBAL_PATH_AP-0m
- 1mPENDS_RUBY_SCOPE22m): Whether Bundler should append the Ruby scope
- (e.g. engine and ABI version) to a globally-configured path.
+ o global_path_appends_ruby_scope (BUN-
+ DLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE): Whether Bundler should append
+ the Ruby scope (e.g. engine and ABI version) to a globally-config-
+ ured path.
- o 1mignore_messages 22m(1mBUNDLE_IGNORE_MESSAGES22m): When set, no post install
+ o ignore_messages (BUNDLE_IGNORE_MESSAGES): When set, no post install
messages will be printed. To silence a single gem, use dot notation
- like 1mignore_messages.httparty true22m.
+ like ignore_messages.httparty true.
- o 1minit_gems_rb 22m(1mBUNDLE_INIT_GEMS_RB22m) Generate a 1mgems.rb 22minstead of a
- 1mGemfile 22mwhen running 1mbundle init22m.
+ o init_gems_rb (BUNDLE_INIT_GEMS_RB) Generate a gems.rb instead of a
+ Gemfile when running bundle init.
- o 1mjobs 22m(1mBUNDLE_JOBS22m): The number of gems Bundler can install in par-
+ o jobs (BUNDLE_JOBS): The number of gems Bundler can install in par-
allel. Defaults to 1.
- o 1mlist_command 22m(1mBUNDLE_LIST_COMMAND22m) Enable new list command feature
-
- o 1mmajor_deprecations 22m(1mBUNDLE_MAJOR_DEPRECATIONS22m): Whether Bundler
- should print deprecation warnings for behavior that will be changed
- in the next major version.
-
- o 1mno_install 22m(1mBUNDLE_NO_INSTALL22m): Whether 1mbundle package 22mshould skip
+ o no_install (BUNDLE_NO_INSTALL): Whether bundle package should skip
installing gems.
- o 1mno_prune 22m(1mBUNDLE_NO_PRUNE22m): Whether Bundler should leave outdated
+ o no_prune (BUNDLE_NO_PRUNE): Whether Bundler should leave outdated
gems unpruned when caching.
- o 1monly_update_to_newer_versions 22m(1mBUNDLE_ONLY_UPDATE_TO_NEWER_VER-0m
- 1mSIONS22m): During 1mbundle update22m, only resolve to newer versions of the
+ 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 1mpath 22m(1mBUNDLE_PATH22m): The location on disk where all gems in your
- bundle will be located regardless of 1m$GEM_HOME 22mor 1m$GEM_PATH 22mvalues.
- Bundle gems not found in this location will be installed by 1mbundle0m
- 1minstall22m. Defaults to 1mGem.dir22m. When --deployment is used, defaults
+ 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 1mpath.system 22m(1mBUNDLE_PATH__SYSTEM22m): Whether Bundler will install
- gems into the default system path (1mGem.dir22m).
+ o path.system (BUNDLE_PATH__SYSTEM): Whether Bundler will install
+ gems into the default system path (Gem.dir).
- o 1mpath_relative_to_cwd 22m(1mPATH_RELATIVE_TO_CWD22m) Makes 1m--path 22mrelative
- to the CWD instead of the 1mGemfile22m.
+ o path_relative_to_cwd (BUNDLE_PATH_RELATIVE_TO_CWD) Makes --path
+ relative to the CWD instead of the Gemfile.
- o 1mplugins 22m(1mBUNDLE_PLUGINS22m): Enable Bundler's experimental plugin sys-
+ o plugins (BUNDLE_PLUGINS): Enable Bundler's experimental plugin sys-
tem.
- o 1mprefer_gems_rb 22m(1mBUNDLE_PREFER_GEMS_RB22m) Prefer 1mgems.rb 22mto 1mGemfile0m
+ o prefer_gems_rb (BUNDLE_PREFER_GEMS_RB) Prefer gems.rb to Gemfile
when Bundler is searching for a Gemfile.
- o 1mprint_only_version_number 22m(1mBUNDLE_PRINT_ONLY_VERSION_NUMBER22m) Print
- only version number from 1mbundler --version22m.
+ 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 1mredirect 22m(1mBUNDLE_REDIRECT22m): The number of redirects allowed for
- network requests. Defaults to 1m522m.
+ o redirect (BUNDLE_REDIRECT): The number of redirects allowed for
+ network requests. Defaults to 5.
- o 1mretry 22m(1mBUNDLE_RETRY22m): The number of times to retry failed network
- requests. Defaults to 1m322m.
+ o retry (BUNDLE_RETRY): The number of times to retry failed network
+ requests. Defaults to 3.
- o 1msetup_makes_kernel_gem_public 22m(1mBUNDLE_SETUP_MAKES_KERNEL_GEM_PUB-0m
- 1mLIC22m): Have 1mBundler.setup 22mmake the 1mKernel#gem 22mmethod public, even
+ 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 1mshebang 22m(1mBUNDLE_SHEBANG22m): The program name that should be invoked
+ o shebang (BUNDLE_SHEBANG): The program name that should be invoked
for generated binstubs. Defaults to the ruby install name used to
generate the binstub.
- o 1msilence_root_warning 22m(1mBUNDLE_SILENCE_ROOT_WARNING22m): Silence the
+ o silence_deprecations (BUNDLE_SILENCE_DEPRECATIONS): Whether Bundler
+ 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.
- o 1mskip_default_git_sources 22m(1mBUNDLE_SKIP_DEFAULT_GIT_SOURCES22m): Whether
+ o skip_default_git_sources (BUNDLE_SKIP_DEFAULT_GIT_SOURCES): Whether
Bundler should skip adding default git source shortcuts to the Gem-
file DSL.
- o 1mspecific_platform 22m(1mBUNDLE_SPECIFIC_PLATFORM22m): Allow bundler to re-
- solve for the specific running platform and store it in the lock-
+ 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 1mGem::Platform.local22m, such
- as 1mx86_64-darwin-16 22mor 1muniversal-java-1.822m. On the other hand,
- generic platforms are those such as 1mruby22m, 1mmswin22m, or 1mjava22m. In this
- example, 1mx86_64-darwin-16 22mwould map to 1mruby 22mand 1muniversal-java-1.80m
- to 1mjava22m.
+ 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 1mssl_ca_cert 22m(1mBUNDLE_SSL_CA_CERT22m): Path to a designated CA certifi-
+ o ssl_ca_cert (BUNDLE_SSL_CA_CERT): Path to a designated CA certifi-
cate file or folder containing multiple certificates for trusted
CAs in PEM format.
- o 1mssl_client_cert 22m(1mBUNDLE_SSL_CLIENT_CERT22m): Path to a designated file
+ o ssl_client_cert (BUNDLE_SSL_CLIENT_CERT): Path to a designated file
containing a X.509 client certificate and key in PEM format.
- o 1mssl_verify_mode 22m(1mBUNDLE_SSL_VERIFY_MODE22m): The SSL verification mode
+ o ssl_verify_mode (BUNDLE_SSL_VERIFY_MODE): The SSL verification mode
Bundler uses when making HTTPS requests. Defaults to verify peer.
- o 1msuppress_install_using_messages 22m(1mBUNDLE_SUPPRESS_INSTALL_USING_MES-0m
- 1mSAGES22m): Avoid printing 1mUsing ... 22mmessages during installation when
+ 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 1msystem_bindir 22m(1mBUNDLE_SYSTEM_BINDIR22m): The location where RubyGems
- installs binstubs. Defaults to 1mGem.bindir22m.
+ o system_bindir (BUNDLE_SYSTEM_BINDIR): The location where RubyGems
+ installs binstubs. Defaults to Gem.bindir.
- o 1mtimeout 22m(1mBUNDLE_TIMEOUT22m): The seconds allowed before timing out for
- network requests. Defaults to 1m1022m.
+ o timeout (BUNDLE_TIMEOUT): The seconds allowed before timing out for
+ network requests. Defaults to 10.
- o 1munlock_source_unlocks_spec 22m(1mBUNDLE_UNLOCK_SOURCE_UNLOCKS_SPEC22m):
- Whether running 1mbundle update --source NAME 22munlocks a gem with the
- given name. Defaults to 1mtrue22m.
+ 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 1mupdate_requires_all_flag 22m(1mBUNDLE_UPDATE_REQUIRES_ALL_FLAG22m) Require
- passing 1m--all 22mto 1mbundle update 22mwhen everything should be updated,
- and disallow passing no options to 1mbundle update22m.
+ 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 1muser_agent 22m(1mBUNDLE_USER_AGENT22m): The custom user agent fragment
+ o user_agent (BUNDLE_USER_AGENT): The custom user agent fragment
Bundler includes in API requests.
- o 1mwith 22m(1mBUNDLE_WITH22m): A 1m:22m-separated list of groups whose gems bundler
+ o with (BUNDLE_WITH): A :-separated list of groups whose gems bundler
should install.
- o 1mwithout 22m(1mBUNDLE_WITHOUT22m): A 1m:22m-separated list of groups whose gems
+ o without (BUNDLE_WITHOUT): A :-separated list of groups whose gems
bundler should not install.
In general, you should set these settings per-application by using the
- applicable flag to the bundle install(1) 4mbundle-install.1.html24m or bun-
- dle package(1) 4mbundle-package.1.html24m command.
+ applicable flag to the bundle install(1) bundle-install.1.html or bun-
+ dle package(1) bundle-package.1.html command.
- You can set them globally either via environment variables or 1mbundle0m
- 1mconfig22m, whichever is preferable for your setup. If you use both, envi-
+ You can set them globally either via environment variables or bundle
+ config, whichever is preferable for your setup. If you use both, envi-
ronment variables will take preference over global settings.
-1mLOCAL GIT REPOS0m
- Bundler also allows you to work against a git repository locally in-
- stead of using the remote version. This can be achieved by setting up a
- local override:
+LOCAL GIT REPOS
+ 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 local.GEM_NAME /path/to/local/git/repository
+ bundle config set local.GEM_NAME /path/to/local/git/repository
@@ -386,7 +394,7 @@ BUNDLE-CONFIG(1) BUNDLE-CONFIG(1)
- bundle config local.rack ~/Work/git/rack
+ bundle config set local.rack ~/Work/git/rack
@@ -394,32 +402,32 @@ BUNDLE-CONFIG(1) BUNDLE-CONFIG(1)
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 1mGemfile.lock 22mto the local git repo revision. This requires the same
+ 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 es-
- cape your usernames and passwords as well.
+ mit that only exists in your local machine. You'll also need to CGI
+ escape your usernames and passwords as well.
Bundler does many checks to ensure a developer won't work with invalid
references. Particularly, we force a developer to specify a branch in
- the 1mGemfile 22min order to use this feature. If the branch specified in
- the 1mGemfile 22mand the current branch in the local git repository do not
+ 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 1mGem-0m
- 1mfile.lock 22mexists in the local git repository. By doing this, Bundler
+ Finally, Bundler also ensures that the current revision in the Gem-
+ file.lock exists in the local git repository. By doing this, Bundler
forces you to fetch the latest changes in the remotes.
-1mMIRRORS OF GEM SOURCES0m
+MIRRORS OF GEM SOURCES
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 mirror.SOURCE_URL MIRROR_URL
+ bundle config set mirror.SOURCE_URL MIRROR_URL
@@ -428,7 +436,7 @@ BUNDLE-CONFIG(1) BUNDLE-CONFIG(1)
- bundle config mirror.http://rubygems.org http://rubygems-mirror.org
+ bundle config set mirror.http://rubygems.org http://rubygems-mirror.org
@@ -438,7 +446,7 @@ BUNDLE-CONFIG(1) BUNDLE-CONFIG(1)
- bundle config mirror.SOURCE_URL.fallback_timeout TIMEOUT
+ bundle config set mirror.SOURCE_URL.fallback_timeout TIMEOUT
@@ -446,29 +454,29 @@ BUNDLE-CONFIG(1) BUNDLE-CONFIG(1)
- bundle config 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).
-1mCREDENTIALS FOR GEM SOURCES0m
+CREDENTIALS FOR GEM SOURCES
Bundler allows you to configure credentials for any gem source, which
allows you to avoid putting secrets into your Gemfile.
- bundle config SOURCE_HOSTNAME USERNAME:PASSWORD
+ bundle config set SOURCE_HOSTNAME USERNAME:PASSWORD
- For example, to save the credentials of user 1mclaudette 22mfor the gem
- source at 1mgems.longerous.com22m, you would run:
+ For example, to save the credentials of user claudette for the gem
+ source at gems.longerous.com, you would run:
- bundle config gems.longerous.com claudette:s00pers3krit
+ bundle config set gems.longerous.com claudette:s00pers3krit
@@ -485,7 +493,7 @@ BUNDLE-CONFIG(1) BUNDLE-CONFIG(1)
- bundle config https://github.com/bundler/bundler.git username:password
+ bundle config set https://github.com/bundler/bundler.git username:password
@@ -506,10 +514,10 @@ BUNDLE-CONFIG(1) BUNDLE-CONFIG(1)
-1mCONFIGURE BUNDLER DIRECTORIES0m
+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 1m~/.bundle22m, which all directories inherit
+ Bundler's home directory is ~/.bundle, which all directories inherit
from by default. The following outlines the available environment vari-
ables and their default values
@@ -525,4 +533,4 @@ BUNDLE-CONFIG(1) BUNDLE-CONFIG(1)
- January 2019 BUNDLE-CONFIG(1)
+ April 2019 BUNDLE-CONFIG(1)
diff --git a/man/bundle-config.ronn b/man/bundle-config.ronn
index b5c97ae82d..86c4e21819 100644
--- a/man/bundle-config.ronn
+++ b/man/bundle-config.ronn
@@ -3,7 +3,7 @@ bundle-config(1) -- Set bundler configuration options
## SYNOPSIS
-`bundle config` [<name> [<value>]]
+`bundle config` [list|get|set|unset] [<name> [<value>]]
## DESCRIPTION
@@ -16,39 +16,45 @@ Bundler loads configuration settings in this order:
3. Global config (`~/.bundle/config`)
4. Bundler default config
-Executing `bundle config` with no parameters will print a list of all
-bundler configuration for the current bundle, and where that configuration
+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 <name>` will print the value of that configuration
+Executing `bundle config get <name>` will print the value of that configuration
setting, and where it was set.
-Executing `bundle config <name> <value>` will set that configuration to the
+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 --global <name> <value>` works the same as above.
+Executing `bundle config set --global <name> <value>` works the same as above.
-Executing `bundle config --local <name> <value>` will set that configuration to
+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 --delete <name>` will delete the configuration in both
-local and global sources. Not compatible with --global or --local flag.
+Executing `bundle config unset <name>` will delete the configuration in both
+local and global sources.
+
+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
+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 disable_multisource true` upgrades the warning about
+Executing `bundle config set disable_multisource true` upgrades the warning about
the Gemfile containing multiple primary sources to an error. Executing `bundle
-config --delete disable_multisource` downgrades this error to a warning.
+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 not remembered between commands.
-If these options must be remembered,they must be set using `bundle config`
-(e.g., `bundle config path foo`).
+If these options must be remembered, they must be set using `bundle config`
+(e.g., `bundle config set path foo`).
The options that can be configured are:
@@ -92,7 +98,7 @@ pass configuration flags to `gem install` to specify where to find the
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 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
`mysql` gem, it will pass along the flags you specified.
@@ -169,7 +175,7 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
* `disable_multisource` (`BUNDLE_DISABLE_MULTISOURCE`):
When set, Gemfiles containing multiple sources will produce errors
instead of warnings.
- Use `bundle config --delete disable_multisource` to unset.
+ 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`):
@@ -208,11 +214,6 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
Generate a `gems.rb` instead of a `Gemfile` when running `bundle init`.
* `jobs` (`BUNDLE_JOBS`):
The number of gems Bundler can install in parallel. Defaults to 1.
-* `list_command` (`BUNDLE_LIST_COMMAND`)
- Enable new list command feature
-* `major_deprecations` (`BUNDLE_MAJOR_DEPRECATIONS`):
- Whether Bundler should print deprecation warnings for behavior that will
- be changed in the next major version.
* `no_install` (`BUNDLE_NO_INSTALL`):
Whether `bundle package` should skip installing gems.
* `no_prune` (`BUNDLE_NO_PRUNE`):
@@ -227,12 +228,12 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
is used, defaults to vendor/bundle.
* `path.system` (`BUNDLE_PATH__SYSTEM`):
Whether Bundler will install gems into the default system path (`Gem.dir`).
-* `path_relative_to_cwd` (`PATH_RELATIVE_TO_CWD`)
+* `path_relative_to_cwd` (`BUNDLE_PATH_RELATIVE_TO_CWD`)
Makes `--path` relative to the CWD instead of the `Gemfile`.
* `plugins` (`BUNDLE_PLUGINS`):
Enable Bundler's experimental plugin system.
-* `prefer_gems_rb` (`BUNDLE_PREFER_GEMS_RB`)
- Prefer `gems.rb` to `Gemfile` when Bundler is searching for a Gemfile.
+* `prefer_patch` (BUNDLE_PREFER_PATCH):
+ Prefer updating only to next patch version during updates. Makes `bundle update` calls equivalent to `bundler update --patch`.
* `print_only_version_number` (`BUNDLE_PRINT_ONLY_VERSION_NUMBER`)
Print only version number from `bundler --version`.
* `redirect` (`BUNDLE_REDIRECT`):
@@ -245,6 +246,9 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
* `shebang` (`BUNDLE_SHEBANG`):
The program name that should be invoked for generated binstubs. Defaults to
the ruby install name used to generate the binstub.
+* `silence_deprecations` (`BUNDLE_SILENCE_DEPRECATIONS`):
+ Whether Bundler should silence deprecation warnings for behavior that will
+ be changed in the next major version.
* `silence_root_warning` (`BUNDLE_SILENCE_ROOT_WARNING`):
Silence the warning Bundler prints when installing gems as root.
* `skip_default_git_sources` (`BUNDLE_SKIP_DEFAULT_GIT_SOURCES`):
@@ -300,11 +304,11 @@ 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 local.GEM_NAME /path/to/local/git/repository
+ bundle config set local.GEM_NAME /path/to/local/git/repository
For example, in order to use a local Rack repository, a developer could call:
- bundle config local.rack ~/Work/git/rack
+ bundle config set local.rack ~/Work/git/rack
Now instead of checking out the remote git repository, the local
override will be used. Similar to a path source, every time the local
@@ -334,21 +338,21 @@ 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 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-mirror.org:
- bundle config 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 the original
server instead of the mirror.
- bundle config mirror.SOURCE_URL.fallback_timeout TIMEOUT
+ bundle config set mirror.SOURCE_URL.fallback_timeout TIMEOUT
For example, to fall back to rubygems.org after 3 seconds:
- bundle config 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 currently
only accept whole seconds (for example, 1, 15, or 30).
@@ -358,12 +362,12 @@ only accept whole seconds (for example, 1, 15, or 30).
Bundler allows you to configure credentials for any gem source, which allows
you to avoid putting secrets into your Gemfile.
- bundle config SOURCE_HOSTNAME USERNAME:PASSWORD
+ bundle config set SOURCE_HOSTNAME USERNAME:PASSWORD
For example, to save the credentials of user `claudette` for the gem source at
`gems.longerous.com`, you would run:
- bundle config gems.longerous.com claudette:s00pers3krit
+ bundle config set gems.longerous.com claudette:s00pers3krit
Or you can set the credentials as an environment variable like this:
@@ -371,7 +375,7 @@ Or you can set the credentials as an environment variable like this:
For gems with a git source with HTTP(S) URL you can specify credentials like so:
- bundle config https://github.com/bundler/bundler.git username:password
+ bundle config set https://github.com/bundler/bundler.git username:password
Or you can set the credentials as an environment variable like so:
diff --git a/man/bundle-doctor.1 b/man/bundle-doctor.1
index 53291ba7b9..3dcbaa18cb 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" "November 2018" "" ""
+.TH "BUNDLE\-DOCTOR" "1" "March 2019" "" ""
.
.SH "NAME"
\fBbundle\-doctor\fR \- Checks the bundle for common problems
diff --git a/man/bundle-doctor.1.txt b/man/bundle-doctor.1.txt
index b21291ac0f..e3efa3bcbe 100644
--- a/man/bundle-doctor.1.txt
+++ b/man/bundle-doctor.1.txt
@@ -2,13 +2,13 @@ BUNDLE-DOCTOR(1) BUNDLE-DOCTOR(1)
-1mNAME0m
- 1mbundle-doctor 22m- Checks the bundle for common problems
+NAME
+ bundle-doctor - Checks the bundle for common problems
-1mSYNOPSIS0m
- 1mbundle doctor 22m[--quiet] [--gemfile=GEMFILE]
+SYNOPSIS
+ bundle doctor [--quiet] [--gemfile=GEMFILE]
-1mDESCRIPTION0m
+DESCRIPTION
Checks your Gemfile and gem environment for common problems. If issues
are detected, Bundler prints them and exits status 1. Otherwise,
Bundler prints a success message and exits status 0.
@@ -27,18 +27,18 @@ BUNDLE-DOCTOR(1) BUNDLE-DOCTOR(1)
-1mOPTIONS0m
- 1m--quiet0m
+OPTIONS
+ --quiet
Only output warnings and errors.
- 1m--gemfile=<gemfile>0m
+ --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 1mGemfile.lock 22mand
- 1mvendor/cache 22mrelative to this location.
+ is also the project's root and will try to find Gemfile.lock and
+ vendor/cache relative to this location.
- November 2018 BUNDLE-DOCTOR(1)
+ March 2019 BUNDLE-DOCTOR(1)
diff --git a/man/bundle-exec.1 b/man/bundle-exec.1
index e742141769..4d0fb7dc31 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" "November 2018" "" ""
+.TH "BUNDLE\-EXEC" "1" "March 2019" "" ""
.
.SH "NAME"
\fBbundle\-exec\fR \- Execute a command in the context of the bundle
diff --git a/man/bundle-exec.1.txt b/man/bundle-exec.1.txt
index 864eb0b485..179c3a7577 100644
--- a/man/bundle-exec.1.txt
+++ b/man/bundle-exec.1.txt
@@ -2,53 +2,53 @@ BUNDLE-EXEC(1) BUNDLE-EXEC(1)
-1mNAME0m
- 1mbundle-exec 22m- Execute a command in the context of the bundle
+NAME
+ bundle-exec - Execute a command in the context of the bundle
-1mSYNOPSIS0m
- 1mbundle exec 22m[--keep-file-descriptors] 4mcommand0m
+SYNOPSIS
+ bundle exec [--keep-file-descriptors] command
-1mDESCRIPTION0m
+DESCRIPTION
This command executes the command, making all gems specified in the
- [1mGemfile(5)22m][Gemfile(5)] available to 1mrequire 22min Ruby programs.
+ [Gemfile(5)][Gemfile(5)] available to require in Ruby programs.
- Essentially, if you would normally have run something like 1mrspec0m
- 1mspec/my_spec.rb22m, and you want to use the gems specified in the [1mGem-0m
- 1mfile(5)22m][Gemfile(5)] and installed via bundle install(1) 4mbundle-in-0m
- 4mstall.1.html24m, you should run 1mbundle exec rspec spec/my_spec.rb22m.
+ 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.
- Note that 1mbundle exec 22mdoes not require that an executable is available
- on your shell's 1m$PATH22m.
+ Note that bundle exec does not require that an executable is available
+ on your shell's $PATH.
-1mOPTIONS0m
- 1m--keep-file-descriptors0m
+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.
-1mBUNDLE INSTALL --BINSTUBS0m
- If you use the 1m--binstubs 22mflag in bundle install(1) 4mbundle-in-0m
- 4mstall.1.html24m, Bundler will automatically create a directory (which de-
- faults to 1mapp_root/bin22m) containing all of the executables available
- from gems in the bundle.
+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
+ available from gems in the bundle.
- After using 1m--binstubs22m, 1mbin/rspec spec/my_spec.rb 22mis identical to 1mbun-0m
- 1mdle exec rspec spec/my_spec.rb22m.
+ After using --binstubs, bin/rspec spec/my_spec.rb is identical to bun-
+ dle exec rspec spec/my_spec.rb.
-1mENVIRONMENT MODIFICATIONS0m
- 1mbundle exec 22mmakes a number of changes to the shell environment, then
+ENVIRONMENT MODIFICATIONS
+ 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 1mbundle 22mfrom in-
- side a command invoked by 1mbundle exec 22m(using 1m$BUNDLE_BIN_PATH22m)
+ 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 1mrails22m, 1mrspec22m,
- 1mrackup22m) for your bundle on 1m$PATH0m
+ 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 1mGemfile 22m(by setting 1mBUNDLE_GEMFILE22m)
+ same Gemfile (by setting BUNDLE_GEMFILE)
- o add 1m-rbundler/setup 22mto 1m$RUBYOPT22m, which makes sure that Ruby pro-
+ o add -rbundler/setup to $RUBYOPT, which makes sure that Ruby pro-
grams invoked in the subshell can see the gems in the bundle
@@ -57,43 +57,43 @@ BUNDLE-EXEC(1) BUNDLE-EXEC(1)
o disallow loading additional gems not in the bundle
- o modify the 1mgem 22mmethod to be a no-op if a gem matching the require-
- ments is in the bundle, and to raise a 1mGem::LoadError 22mif it's not
+ 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 Define 1mGem.refresh 22mto be a no-op, since the source index is always
+ 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 1mGem.bin_path 22mto use the gems in the bundle, making system
+ 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, 1mbundle exec 22malso implicitly modifies 1mGemfile.lock 22mif the lock-
+ 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, 1mautorequire22m, and platforms, etc.,
+ 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 1mbundle exec 22msuccessfully, so 1mbundle0m
- 1mexec 22mupdates the lockfile beforehand.
+ lockfile must be synced in order to bundle exec successfully, so bundle
+ exec updates the lockfile beforehand.
- 1mLoading0m
- By default, when attempting to 1mbundle exec 22mto a file with a ruby she-
- bang, Bundler will 1mKernel.load 22mthat file instead of using 1mKernel.exec22m.
+ 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 de-
- pendence on the exact contents of 1m$0 22mor 1m__FILE__22m) and the optimization
- can be disabled by enabling the 1mdisable_exec_load 22msetting.
+ 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.
- 1mShelling out0m
- Any Ruby code that opens a subshell (like 1msystem22m, backticks, or 1m%x{}22m)
+ 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 1mwith_clean_env 22mmethod with a block. Any subshells created in-
- side the block will be given the environment present before Bundler was
- activated. For example, Homebrew commands run Ruby, but don't work in-
- side a 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:
@@ -103,10 +103,10 @@ BUNDLE-EXEC(1) BUNDLE-EXEC(1)
- Using 1mwith_clean_env 22mis also necessary if you are shelling out to 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 1mwith_clean_env22m.
+ different bundle also need to use with_clean_env.
@@ -118,7 +118,7 @@ BUNDLE-EXEC(1) BUNDLE-EXEC(1)
- Bundler provides convenience helpers that wrap 1msystem 22mand 1mexec22m, and
+ Bundler provides convenience helpers that wrap system and exec, and
they can be used like this:
@@ -128,24 +128,24 @@ BUNDLE-EXEC(1) BUNDLE-EXEC(1)
-1mRUBYGEMS PLUGINS0m
+RUBYGEMS PLUGINS
At present, the Rubygems plugin system requires all files named
- 1mrubygems_plugin.rb 22mon the load path of 4many24m installed gem when any Ruby
- code requires 1mrubygems.rb22m. This includes executables installed into the
- system, like 1mrails22m, 1mrackup22m, and 1mrspec22m.
+ 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
end up activating themselves or their dependencies.
- For instance, the 1mgemcutter 0.5 22mgem depended on 1mjson_pure22m. If you had
- that version of gemcutter installed (even if you 4malso24m had a newer ver-
- sion without this problem), Rubygems would activate 1mgemcutter 0.5 22mand
- 1mjson_pure <latest>22m.
+ 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>.
- If your Gemfile(5) also contained 1mjson_pure 22m(or a gem with a dependency
- on 1mjson_pure22m), the latest version on your system might conflict with
- the version in your Gemfile(5), or the snapshot version in your 1mGem-0m
- 1mfile.lock22m.
+ 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.
If this happens, bundler will say:
@@ -158,7 +158,7 @@ BUNDLE-EXEC(1) BUNDLE-EXEC(1)
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 1mgemcutter 22mgem) have released newer versions
+ 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
@@ -170,9 +170,9 @@ BUNDLE-EXEC(1) BUNDLE-EXEC(1)
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 (1mgem0m
- 1muninstall gem_name22m).
+ gem plugin, and also remove all gem plugins that you aren't using (gem
+ uninstall gem_name).
- November 2018 BUNDLE-EXEC(1)
+ March 2019 BUNDLE-EXEC(1)
diff --git a/man/bundle-gem.1 b/man/bundle-gem.1
index 1087a0888c..08e544cd8a 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" "November 2018" "" ""
+.TH "BUNDLE\-GEM" "1" "March 2019" "" ""
.
.SH "NAME"
\fBbundle\-gem\fR \- Generate a project skeleton for creating a rubygem
diff --git a/man/bundle-gem.1.txt b/man/bundle-gem.1.txt
index a951d5b4b6..806939df4f 100644
--- a/man/bundle-gem.1.txt
+++ b/man/bundle-gem.1.txt
@@ -2,90 +2,90 @@ BUNDLE-GEM(1) BUNDLE-GEM(1)
-1mNAME0m
- 1mbundle-gem 22m- Generate a project skeleton for creating a rubygem
+NAME
+ bundle-gem - Generate a project skeleton for creating a rubygem
-1mSYNOPSIS0m
- 1mbundle gem 4m22mGEM_NAME24m 4mOPTIONS0m
+SYNOPSIS
+ bundle gem GEM_NAME OPTIONS
-1mDESCRIPTION0m
- Generates a directory named 1mGEM_NAME 22mwith a 1mRakefile22m, 1mGEM_NAME.gemspec22m,
+DESCRIPTION
+ Generates a directory named GEM_NAME with a Rakefile, GEM_NAME.gemspec,
and other supporting files and directories that can be used to develop
a rubygem with that name.
- Run 1mrake -T 22min the resulting project for a list of Rake tasks that can
+ 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 ex-
- plained 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 1mgem.coc0m
+ o gem.coc
- o 1mgem.mit0m
+ o gem.mit
- o 1mgem.test0m
+ o gem.test
-1mOPTIONS0m
- 1m--exe 22mor 1m-b 22mor 1m--bin0m
+OPTIONS
+ --exe or -b or --bin
Specify that Bundler should create a binary executable (as
- 1mexe/GEM_NAME22m) in the generated rubygem project. This binary will
- also be added to the 1mGEM_NAME.gemspec 22mmanifest. This behavior is
+ 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.
- 1m--no-exe0m
- Do not create a binary (overrides 1m--exe 22mspecified in the global
+ --no-exe
+ Do not create a binary (overrides --exe specified in the global
config).
- 1m--coc 22mAdd a 1mCODE_OF_CONDUCT.md 22mfile to the root of the generated
+ --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 1mbundle gem 22muse.
+ global config for future bundle gem use.
- 1m--no-coc0m
- Do not create a 1mCODE_OF_CONDUCT.md 22m(overrides 1m--coc 22mspecified in
+ --no-coc
+ Do not create a CODE_OF_CONDUCT.md (overrides --coc specified in
the global config).
- 1m--ext 22mAdd boilerplate for C extension code to the generated project.
+ --ext Add boilerplate for C extension code to the generated project.
This behavior is disabled by default.
- 1m--no-ext0m
- Do not add C extension code (overrides 1m--ext 22mspecified in the
+ --no-ext
+ Do not add C extension code (overrides --ext specified in the
global config).
- 1m--mit 22mAdd an MIT license to a 1mLICENSE.txt 22mfile in the root of the gen-
+ --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 in-
- teractive prompt will be displayed and the answer will be saved
- in Bundler's global config for future 1mbundle gem 22muse.
+ 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.
- 1m--no-mit0m
- Do not create a 1mLICENSE.txt 22m(overrides 1m--mit 22mspecified in the
+ --no-mit
+ Do not create a LICENSE.txt (overrides --mit specified in the
global config).
- 1m-t22m, 1m--test=minitest22m, 1m--test=rspec0m
+ -t, --test=minitest, --test=rspec
Specify the test framework that Bundler should use when generat-
- ing the project. Acceptable values are 1mminitest 22mand 1mrspec22m. The
- 1mGEM_NAME.gemspec 22mwill be configured and a skeleton test/spec di-
- rectory will be created based on this option. If this option is
- unspecified, an interactive prompt will be displayed and the an-
- swer will be saved in Bundler's global config for future 1mbundle0m
- 1mgem 22muse. If no option is specified, the default testing frame-
- work is RSpec.
-
- 1m-e22m, 1m--edit[=EDITOR]0m
+ 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.
+
+ -e, --edit[=EDITOR]
Open the resulting GEM_NAME.gemspec in EDITOR, or the default
- editor if not specified. The default is 1m$BUNDLER_EDITOR22m, 1m$VIS-0m
- 1mUAL22m, or 1m$EDITOR22m.
+ editor if not specified. The default is $BUNDLER_EDITOR,
+ $VISUAL, or $EDITOR.
-1mSEE ALSO0m
- o bundle config(1) 4mbundle-config.1.html0m
+SEE ALSO
+ o bundle config(1) bundle-config.1.html
- November 2018 BUNDLE-GEM(1)
+ March 2019 BUNDLE-GEM(1)
diff --git a/man/bundle-info.1 b/man/bundle-info.1
index 9140d27c73..d1db7aa70f 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" "November 2018" "" ""
+.TH "BUNDLE\-INFO" "1" "March 2019" "" ""
.
.SH "NAME"
\fBbundle\-info\fR \- Show information for the given gem in your bundle
diff --git a/man/bundle-info.1.txt b/man/bundle-info.1.txt
index 4d328416e7..7057249188 100644
--- a/man/bundle-info.1.txt
+++ b/man/bundle-info.1.txt
@@ -2,20 +2,20 @@ BUNDLE-INFO(1) BUNDLE-INFO(1)
-1mNAME0m
- 1mbundle-info 22m- Show information for the given gem in your bundle
+NAME
+ bundle-info - Show information for the given gem in your bundle
-1mSYNOPSIS0m
- 1mbundle info 22m[GEM] [--path]
+SYNOPSIS
+ bundle info [GEM] [--path]
-1mDESCRIPTION0m
+DESCRIPTION
Print the basic information about the provided GEM such as homepage,
version, path and summary.
-1mOPTIONS0m
- 1m--path 22mPrint the path of the given gem
+OPTIONS
+ --path Print the path of the given gem
- November 2018 BUNDLE-INFO(1)
+ March 2019 BUNDLE-INFO(1)
diff --git a/man/bundle-init.1 b/man/bundle-init.1
index 70519fda39..67bce69023 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" "November 2018" "" ""
+.TH "BUNDLE\-INIT" "1" "April 2019" "" ""
.
.SH "NAME"
\fBbundle\-init\fR \- Generates a Gemfile into the current working directory
@@ -22,4 +22,4 @@ Use the specified \.gemspec to create the [\fBGemfile(5)\fR][Gemfile(5)]
Included in the default [\fBGemfile(5)\fR][Gemfile(5)] generated is the line \fB# frozen_string_literal: true\fR\. This is a magic comment supported for the first time in Ruby 2\.3\. The presence of this line results in all string literals in the file being implicitly frozen\.
.
.SH "SEE ALSO"
-Gemfile(5) \fIhttp://bundler\.io/man/gemfile\.5\.html\fR
+Gemfile(5) \fIhttps://bundler\.io/man/gemfile\.5\.html\fR
diff --git a/man/bundle-init.1.txt b/man/bundle-init.1.txt
index eb6091bab2..47c996944b 100644
--- a/man/bundle-init.1.txt
+++ b/man/bundle-init.1.txt
@@ -2,33 +2,33 @@ BUNDLE-INIT(1) BUNDLE-INIT(1)
-1mNAME0m
- 1mbundle-init 22m- Generates a Gemfile into the current working directory
+NAME
+ bundle-init - Generates a Gemfile into the current working directory
-1mSYNOPSIS0m
- 1mbundle init 22m[--gemspec=FILE]
+SYNOPSIS
+ bundle init [--gemspec=FILE]
-1mDESCRIPTION0m
- Init generates a default [1mGemfile(5)22m][Gemfile(5)] in the current work-
- ing directory. When adding a [1mGemfile(5)22m][Gemfile(5)] to a gem with a
- gemspec, the 1m--gemspec 22moption will automatically add each dependency
- listed in the gemspec file to the newly created [1mGemfile(5)22m][Gem-
+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)].
-1mOPTIONS0m
- 1m--gemspec0m
- Use the specified .gemspec to create the [1mGemfile(5)22m][Gem-
+OPTIONS
+ --gemspec
+ Use the specified .gemspec to create the [Gemfile(5)][Gem-
file(5)]
-1mFILES0m
- Included in the default [1mGemfile(5)22m][Gemfile(5)] generated is the line
- 1m# frozen_string_literal: true22m. This is a magic comment supported for
+FILES
+ Included in the default [Gemfile(5)][Gemfile(5)] generated is the line
+ # frozen_string_literal: true. This is a magic comment supported for
the first time in Ruby 2.3. The presence of this line results in all
string literals in the file being implicitly frozen.
-1mSEE ALSO0m
- Gemfile(5) 4mhttp://bundler.io/man/gemfile.5.html0m
+SEE ALSO
+ Gemfile(5) https://bundler.io/man/gemfile.5.html
- November 2018 BUNDLE-INIT(1)
+ April 2019 BUNDLE-INIT(1)
diff --git a/man/bundle-init.ronn b/man/bundle-init.ronn
index 7504af7bab..9d3d97deea 100644
--- a/man/bundle-init.ronn
+++ b/man/bundle-init.ronn
@@ -26,4 +26,4 @@ results in all string literals in the file being implicitly frozen.
## SEE ALSO
-[Gemfile(5)](http://bundler.io/man/gemfile.5.html)
+[Gemfile(5)](https://bundler.io/man/gemfile.5.html)
diff --git a/man/bundle-inject.1 b/man/bundle-inject.1
index 4f663e1a85..b88e012182 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" "November 2018" "" ""
+.TH "BUNDLE\-INJECT" "1" "March 2019" "" ""
.
.SH "NAME"
\fBbundle\-inject\fR \- Add named gem(s) with version requirements to Gemfile
diff --git a/man/bundle-inject.1.txt b/man/bundle-inject.1.txt
index 0011dea0c1..7baea1c972 100644
--- a/man/bundle-inject.1.txt
+++ b/man/bundle-inject.1.txt
@@ -2,17 +2,17 @@ BUNDLE-INJECT(1) BUNDLE-INJECT(1)
-1mNAME0m
- 1mbundle-inject 22m- Add named gem(s) with version requirements to Gemfile
+NAME
+ bundle-inject - Add named gem(s) with version requirements to Gemfile
-1mSYNOPSIS0m
- 1mbundle inject 22m[GEM] [VERSION]
+SYNOPSIS
+ bundle inject [GEM] [VERSION]
-1mDESCRIPTION0m
+DESCRIPTION
Adds the named gem(s) with their version requirements to the resolved
- [1mGemfile(5)22m][Gemfile(5)].
+ [Gemfile(5)][Gemfile(5)].
- This command will add the gem to both your [1mGemfile(5)22m][Gemfile(5)] and
+ This command will add the gem to both your [Gemfile(5)][Gemfile(5)] and
Gemfile.lock if it isn't listed yet.
Example:
@@ -25,8 +25,8 @@ BUNDLE-INJECT(1) BUNDLE-INJECT(1)
This will inject the 'rack' gem with a version greater than 0 in your
- [1mGemfile(5)22m][Gemfile(5)] and Gemfile.lock
+ [Gemfile(5)][Gemfile(5)] and Gemfile.lock
- November 2018 BUNDLE-INJECT(1)
+ March 2019 BUNDLE-INJECT(1)
diff --git a/man/bundle-install.1 b/man/bundle-install.1
index 8bd0a7fa3d..dbb0d21c1c 100644
--- a/man/bundle-install.1
+++ b/man/bundle-install.1
@@ -1,13 +1,13 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-INSTALL" "1" "January 2019" "" ""
+.TH "BUNDLE\-INSTALL" "1" "April 2019" "" ""
.
.SH "NAME"
\fBbundle\-install\fR \- Install the dependencies specified in your Gemfile
.
.SH "SYNOPSIS"
-\fBbundle install\fR [\-\-binstubs[=DIRECTORY]] [\-\-clean] [\-\-deployment] [\-\-force] [\-\-frozen] [\-\-full\-index] [\-\-gemfile=GEMFILE] [\-\-jobs=NUMBER] [\-\-local] [\-\-no\-cache] [\-\-no\-prune] [\-\-path PATH] [\-\-quiet] [\-\-retry=NUMBER] [\-\-shebang] [\-\-standalone[=GROUP[ GROUP\.\.\.]]] [\-\-system] [\-\-trust\-policy=POLICY] [\-\-with=GROUP[ GROUP\.\.\.]] [\-\-without=GROUP[ GROUP\.\.\.]]
+\fBbundle install\fR [\-\-binstubs[=DIRECTORY]] [\-\-clean] [\-\-deployment] [\-\-frozen] [\-\-full\-index] [\-\-gemfile=GEMFILE] [\-\-jobs=NUMBER] [\-\-local] [\-\-no\-cache] [\-\-no\-prune] [\-\-path PATH] [\-\-quiet] [\-\-redownload] [\-\-retry=NUMBER] [\-\-shebang] [\-\-standalone[=GROUP[ GROUP\.\.\.]]] [\-\-system] [\-\-trust\-policy=POLICY] [\-\-with=GROUP[ GROUP\.\.\.]] [\-\-without=GROUP[ GROUP\.\.\.]]
.
.SH "DESCRIPTION"
Install the gems specified in your Gemfile(5)\. If this is the first time you run bundle install (and a \fBGemfile\.lock\fR does not exist), Bundler will fetch all remote sources, resolve dependencies and install all needed gems\.
@@ -23,7 +23,10 @@ To apply any of \fB\-\-binstubs\fR, \fB\-\-deployment\fR, \fB\-\-path\fR, or \fB
.
.TP
\fB\-\-binstubs[=<directory>]\fR
-Creates a directory (defaults to \fB~/bin\fR) and place any executables from the gem there\. These executables run in Bundler\'s context\. If used, you might add this directory to your environment\'s \fBPATH\fR variable\. For instance, if the \fBrails\fR gem comes with a \fBrails\fR executable, this flag will create a \fBbin/rails\fR executable that ensures that all referred dependencies will be resolved using the bundled gems\.
+Binstubs are scripts that wrap around executables\. Bundler creates a small Ruby file (a binstub) that loads Bundler, runs the command, and puts it in \fBbin/\fR\. This lets you link the binstub inside of an application to the exact gem version the application needs\.
+.
+.IP
+Creates a directory (defaults to \fB~/bin\fR) and places any executables from the gem there\. These executables run in Bundler\'s context\. If used, you might add this directory to your environment\'s \fBPATH\fR variable\. For instance, if the \fBrails\fR gem comes with a \fBrails\fR executable, this flag will create a \fBbin/rails\fR executable that ensures that all referred dependencies will be resolved using the bundled gems\.
.
.TP
\fB\-\-clean\fR
@@ -34,8 +37,8 @@ On finishing the installation Bundler is going to remove any gems not present in
In \fIdeployment mode\fR, Bundler will \'roll\-out\' the bundle for production or CI use\. Please check carefully if you want to have this option enabled in your development environment\.
.
.TP
-\fB\-\-force\fR
-Force download every gem, even if the required versions are already available locally\. \fB\-\-redownload\fR is an alias of this option\.
+\fB\-\-redownload\fR
+Force download every gem, even if the required versions are already available locally\.
.
.TP
\fB\-\-frozen\fR
diff --git a/man/bundle-install.1.txt b/man/bundle-install.1.txt
index 7637aeb8b7..72499f3d2d 100644
--- a/man/bundle-install.1.txt
+++ b/man/bundle-install.1.txt
@@ -2,245 +2,250 @@ BUNDLE-INSTALL(1) BUNDLE-INSTALL(1)
-1mNAME0m
- 1mbundle-install 22m- Install the dependencies specified in your Gemfile
+NAME
+ bundle-install - Install the dependencies specified in your Gemfile
-1mSYNOPSIS0m
- 1mbundle install 22m[--binstubs[=DIRECTORY]] [--clean] [--deployment]
- [--force] [--frozen] [--full-index] [--gemfile=GEMFILE] [--jobs=NUMBER]
- [--local] [--no-cache] [--no-prune] [--path PATH] [--quiet]
+SYNOPSIS
+ 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...]]
-1mDESCRIPTION0m
+DESCRIPTION
Install the gems specified in your Gemfile(5). If this is the first
- time you run bundle install (and a 1mGemfile.lock 22mdoes not exist),
+ 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 1mGemfile.lock 22mdoes exist, and you have not updated your Gemfile(5),
+ 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 1mGemfile.lock 22minstead of resolving dependencies.
+ fied in the Gemfile.lock instead of resolving dependencies.
- If a 1mGemfile.lock 22mdoes exist, and you have updated your Gemfile(5),
- Bundler will use the dependencies in the 1mGemfile.lock 22mfor all gems that
+ 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
you did not update, but will re-resolve the dependencies of gems that
you did update. You can find more information about this update process
- below under 4mCONSERVATIVE24m 4mUPDATING24m.
+ below under CONSERVATIVE UPDATING.
-1mOPTIONS0m
- To apply any of 1m--binstubs22m, 1m--deployment22m, 1m--path22m, or 1m--without 22mevery
- time 1mbundle install 22mis run, use 1mbundle config 22m(see bundle-config(1)).
+OPTIONS
+ To apply any of --binstubs, --deployment, --path, or --without every
+ time bundle install is run, use bundle config (see bundle-config(1)).
- 1m--binstubs[=<directory>]0m
- Creates a directory (defaults to 1m~/bin22m) and place any executa-
+ --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 1mPATH 22mvariable. For instance, if the 1mrails 22mgem comes with
- a 1mrails 22mexecutable, this flag will create a 1mbin/rails 22mexecutable
- that ensures that all referred dependencies will be resolved us-
- ing the bundled gems.
+ 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.
- 1m--clean0m
+ --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.
- 1m--deployment0m
- In 4mdeployment24m 4mmode24m, Bundler will 'roll-out' the bundle for pro-
+ --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.
- 1m--force0m
- Force download every gem, even if the required versions are al-
- ready available locally. 1m--redownload 22mis an alias of this op-
- tion.
+ --redownload
+ Force download every gem, even if the required versions are
+ already available locally.
- 1m--frozen0m
- 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-
+ --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.
- 1m--full-index0m
+ --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
+ mance can be improved for large bundles that seldom change by
enabling this option.
- 1m--gemfile=<gemfile>0m
- The location of the Gemfile(5) which Bundler should use. This
- defaults to a Gemfile(5) in the current working directory. In
+ --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 1mGemfile.lock 22mand
- 1mvendor/cache 22mrelative to this location.
-
- 1m--jobs=[<number>]22m, 1m-j[<number>]0m
- The maximum number of parallel download and install jobs. The
- default is 1m122m.
-
- 1m--local0m
- Do not attempt to connect to 1mrubygems.org22m. Instead, Bundler will
- use the gems already present in Rubygems' cache or in 1mven-0m
- 1mdor/cache22m. Note that if a appropriate platform-specific gem ex-
- ists on 1mrubygems.org 22mit will not be found.
-
- 1m--no-cache0m
- Do not update the cache in 1mvendor/cache 22mwith the newly bundled
- gems. This does not remove any gems in the cache but keeps the
+ 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.
+
+ --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.
+
+ --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.
- 1m--no-prune0m
- Don't remove stale gems from the cache when the installation
+ --no-prune
+ Don't remove stale gems from the cache when the installation
finishes.
- 1m--path=<path>0m
- The location to install the specified gems to. This defaults to
- Rubygems' setting. Bundler shares this location with Rubygems,
- 1mgem install ... 22mwill have gem installed there, too. Therefore,
- gems installed without a 1m--path ... 22msetting will show up by
- calling 1mgem list22m. Accordingly, gems installed to other locations
+ --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.
- 1m--quiet0m
- Do not print progress information to the standard output. In-
- stead, Bundler will exit using a status code (1m$?22m).
-
- 1m--retry=[<number>]0m
- Retry failed network or git requests for 4mnumber24m times.
-
- 1m--shebang=<ruby-executable>0m
- Uses the specified ruby executable (usually 1mruby22m) to execute the
- scripts created with 1m--binstubs22m. In addition, if you use 1m--bin-0m
- 1mstubs 22mtogether with 1m--shebang jruby 22mthese executables will be
- changed to execute 1mjruby 22minstead.
-
- 1m--standalone[=<list>]0m
- 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 1mbundle0m
- and installs the bundle there. It also generates a 1mbun-0m
- 1mdle/bundler/setup.rb 22mfile to replace Bundler's own setup in the
- manner required. Using this option implicitly sets 1mpath22m, which
+ --quiet
+ 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.
+
+ --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.
+
+ --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].
- 1m--system0m
- Installs the gems specified in the bundle to the system's
- Rubygems location. This overrides any previous configuration of
- 1m--path22m.
+ --system
+ Installs the gems specified in the bundle to the system's
+ Rubygems location. This overrides any previous configuration of
+ --path.
- 1m--trust-policy=[<policy>]0m
- Apply the Rubygems security policy 4mpolicy24m, where policy is one
- of 1mHighSecurity22m, 1mMediumSecurity22m, 1mLowSecurity22m, 1mAlmostNoSecurity22m,
- or 1mNoSecurity22m. For more details, please see the Rubygems signing
- documentation linked below in 4mSEE24m 4mALSO24m.
+ --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.
- 1m--with=<list>0m
+ --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
+ 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.
- 1m--without=<list>0m
+ --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.
-1mDEPLOYMENT MODE0m
+DEPLOYMENT MODE
Bundler's defaults are optimized for development. To switch to defaults
- optimized for deployment and for CI, use the 1m--deployment 22mflag. Do not
- activate deployment mode on development machines, as it will cause an
+ optimized for deployment and for CI, use the --deployment flag. Do not
+ activate deployment mode on development machines, as it will cause an
error when the Gemfile(5) is modified.
- 1. A 1mGemfile.lock 22mis required.
+ 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 1mGemfile.lock 22mis re-
- quired.
+ tested with are also used in deployments, a Gemfile.lock is
+ required.
- This is mainly to ensure that you remember to check your 1mGem-0m
- 1mfile.lock 22minto version control.
+ This is mainly to ensure that you remember to check your Gem-
+ file.lock into version control.
- 2. The 1mGemfile.lock 22mmust be up to date
+ 2. The Gemfile.lock must be up to date
- In development, you can modify your Gemfile(5) and re-run 1mbundle0m
- 1minstall 22mto 4mconservatively24m 4mupdate24m your 1mGemfile.lock 22msnapshot.
+ In development, you can modify your Gemfile(5) and re-run bundle
+ install to conservatively update your Gemfile.lock snapshot.
- In deployment, your 1mGemfile.lock 22mshould be up-to-date with changes
+ In deployment, your Gemfile.lock should be up-to-date with changes
made in your Gemfile(5).
- 3. Gems are installed to 1mvendor/bundle 22mnot your default system loca-
+ 3. Gems are installed to vendor/bundle not your default system loca-
tion
- In development, it's convenient to share the gems used in your ap-
- plication 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 in-
- stall gems to the system, or the web server may not have permission
- 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 permis-
+ sion to read them.
- As a result, 1mbundle install --deployment 22minstalls gems to the 1mven-0m
- 1mdor/bundle 22mdirectory in the application. This may be overridden us-
- ing the 1m--path 22moption.
+ 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.
-1mSUDO USAGE0m
- By default, Bundler installs gems to the same location as 1mgem install22m.
+SUDO USAGE
+ By default, Bundler installs gems to the same location as gem install.
In some cases, that location may not be writable by your Unix user. In
that case, Bundler will stage everything in a temporary directory, then
- ask you for your 1msudo 22mpassword in order to copy the gems into their
+ ask you for your sudo password in order to copy the gems into their
system location.
- From your perspective, this is identical to installing the gems di-
- rectly into the system.
+ From your perspective, this is identical to installing the gems
+ directly into the system.
- You should never use 1msudo bundle install22m. This is because several other
- steps in 1mbundle install 22mmust be performed as the current user:
+ You should never use sudo bundle install. This is because several other
+ steps in bundle install must be performed as the current user:
- o Updating your 1mGemfile.lock0m
+ o Updating your Gemfile.lock
- o Updating your 1mvendor/cache22m, if necessary
+ o Updating your vendor/cache, if necessary
o Checking out private git repositories using your user's SSH keys
Of these three, the first two could theoretically be performed by
- 1mchown22ming the resulting files to 1m$SUDO_USER22m. The third, however, can
- only be performed by invoking the 1mgit 22mcommand as the current user.
- Therefore, git gems are downloaded and installed into 1m~/.bundle 22mrather
+ chowning the resulting files to $SUDO_USER. The third, however, can
+ only be performed by invoking the git command as the current user.
+ Therefore, git gems are downloaded and installed into ~/.bundle rather
than $GEM_HOME or $BUNDLE_PATH.
- As a result, you should run 1mbundle install 22mas the current user, and
+ As a result, you should run bundle install as the current user, and
Bundler will ask for your password if it is needed to put the gems into
their final location.
-1mINSTALLING GROUPS0m
- By default, 1mbundle install 22mwill install all gems in all groups in your
+INSTALLING GROUPS
+ By default, bundle install will install all gems in all groups in your
Gemfile(5), except those declared for a different platform.
However, you can explicitly tell Bundler to skip installing certain
- groups with the 1m--without 22moption. This option takes a space-separated
+ groups with the --without option. This option takes a space-separated
list of groups.
- While the 1m--without 22moption will skip 4minstalling24m the gems in the speci-
- fied groups, it will still 4mdownload24m those gems and use them to resolve
+ While the --without option will skip installing the gems in the speci-
+ fied groups, it will still download those gems and use them to resolve
the dependencies of every gem in your Gemfile(5).
This is so that installing a different set of groups on another machine
(such as a production server) will not change the gems and versions
that you have already developed and tested against.
- 1mBundler offers a rock-solid guarantee that the third-party code you are0m
- 1mrunning in development and testing is also the third-party code you are0m
- 1mrunning in production. You can choose to exclude some of that code in0m
- 1mdifferent environments, but you will never be caught flat-footed by0m
- 1mdifferent versions of third-party code being used in different environ-0m
- 1mments.0m
+ Bundler offers a rock-solid guarantee that the third-party code you are
+ running in development and testing is also the third-party code you are
+ running in production. You can choose to exclude some of that code in
+ different environments, but you will never be caught flat-footed by
+ different versions of third-party code being used in different environ-
+ ments.
For a simple illustration, consider the following Gemfile(5):
@@ -256,18 +261,18 @@ BUNDLE-INSTALL(1) BUNDLE-INSTALL(1)
- In this case, 1msinatra 22mdepends on any version of Rack (1m>= 1.022m), while
- 1mrack-perftools-profiler 22mdepends on 1.x (1m~> 1.022m).
+ 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 1mbundle install --without production 22min development, we
- look at the dependencies of 1mrack-perftools-profiler 22mas well. That way,
+ When you run bundle install --without production in development, we
+ look at the dependencies of rack-perftools-profiler as well. That way,
you do not spend all your time developing against Rack 2.0, using new
APIs unavailable in Rack 1.x, only to have Bundler switch to Rack 1.2
- when the 1mproduction 22mgroup 4mis24m used.
+ when the production group is used.
- This should not cause any problems in practice, because we do not at-
- tempt to 1minstall 22mthe gems in the excluded groups, and only evaluate as
- part of the dependency resolution process.
+ This should not cause any problems in practice, because we do not
+ attempt to install the gems in the excluded groups, and only evaluate
+ as part of the dependency resolution process.
This also means that you cannot include different versions of the same
gem in different groups, because doing so would result in different
@@ -276,12 +281,12 @@ BUNDLE-INSTALL(1) BUNDLE-INSTALL(1)
more than the gems you list in your Gemfile(5), and can (surprisingly)
radically change the gems you are using.
-1mTHE GEMFILE.LOCK0m
- When you run 1mbundle install22m, Bundler will persist the full names and
+THE GEMFILE.LOCK
+ When you run bundle install, Bundler will persist the full names and
versions of all gems that you used (including dependencies of the gems
- specified in the Gemfile(5)) into a file called 1mGemfile.lock22m.
+ specified in the Gemfile(5)) into a file called Gemfile.lock.
- Bundler uses this file in all subsequent calls to 1mbundle install22m, which
+ 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.
@@ -290,29 +295,29 @@ BUNDLE-INSTALL(1) BUNDLE-INSTALL(1)
gem in your Gemfile(5)) can result in radically different gems being
needed to satisfy all dependencies.
- As a result, you 1mSHOULD 22mcheck your 1mGemfile.lock 22minto version control,
+ As a result, you SHOULD check your Gemfile.lock into version control,
in both applications and gems. If you do not, every machine that checks
out your repository (including your production server) will resolve all
dependencies again, which will result in different versions of
- third-party code being used if 1many 22mof the gems in the Gemfile(5) or any
+ 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 1mGemfile.lock 22mwas included in the 1m.git-0m
- 1mignore 22mfile included with generated gems. Over time, however, it became
+ 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 un-
- aware of the problem. Since 1mbundle install 22mis usually the first step
+ 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.
-1mCONSERVATIVE UPDATING0m
- When you make a change to the Gemfile(5) and then run 1mbundle install22m,
+CONSERVATIVE UPDATING
+ When you make a change to the Gemfile(5) and then run bundle install,
Bundler will update only the gems that you modified.
- In other words, if a gem that you 1mdid not modify 22mworked before you
- called 1mbundle install22m, it will continue to use the exact same versions
+ In other words, if a gem that you did not modify worked before you
+ called bundle install, it will continue to use the exact same versions
of all dependencies as it used before the update.
Let's take a look at an example. Here's your original Gemfile(5):
@@ -326,13 +331,13 @@ BUNDLE-INSTALL(1) BUNDLE-INSTALL(1)
- In this case, both 1mactionpack 22mand 1mactivemerchant 22mdepend on 1mactivesup-0m
- 1mport22m. The 1mactionpack 22mgem depends on 1mactivesupport 2.3.8 22mand 1mrack ~>0m
- 1m1.1.022m, while the 1mactivemerchant 22mgem depends on 1mactivesupport >= 2.3.222m,
- 1mbraintree >= 2.0.022m, and 1mbuilder >= 2.0.022m.
+ In this case, both actionpack and activemerchant depend on activesup-
+ port. The actionpack gem depends on activesupport 2.3.8 and rack ~>
+ 1.1.0, while the activemerchant gem depends on activesupport >= 2.3.2,
+ braintree >= 2.0.0, and builder >= 2.0.0.
- When the dependencies are first resolved, Bundler will select 1mac-0m
- 1mtivesupport 2.3.822m, which satisfies the requirements of both gems in
+ When the dependencies are first resolved, Bundler will select
+ activesupport 2.3.8, which satisfies the requirements of both gems in
your Gemfile(5).
Next, you modify your Gemfile(5) to:
@@ -346,51 +351,51 @@ BUNDLE-INSTALL(1) BUNDLE-INSTALL(1)
- The 1mactionpack 3.0.0.rc 22mgem has a number of new dependencies, and up-
- dates the 1mactivesupport 22mdependency to 1m= 3.0.0.rc 22mand the 1mrack 22mdepen-
- dency to 1m~> 1.2.122m.
+ The actionpack 3.0.0.rc gem has a number of new dependencies, and
+ updates the activesupport dependency to = 3.0.0.rc and the rack depen-
+ dency to ~> 1.2.1.
- When you run 1mbundle install22m, Bundler notices that you changed the 1mac-0m
- 1mtionpack 22mgem, but not the 1mactivemerchant 22mgem. It evaluates the gems
+ When you run bundle install, Bundler notices that you changed the
+ actionpack gem, but not the activemerchant gem. It evaluates the gems
currently being used to satisfy its requirements:
- 1mactivesupport 2.3.80m
- also used to satisfy a dependency in 1mactivemerchant22m, which is
+ activesupport 2.3.8
+ also used to satisfy a dependency in activemerchant, which is
not being updated
- 1mrack ~> 1.1.00m
+ rack ~> 1.1.0
not currently being used to satisfy another dependency
- Because you did not explicitly ask to update 1mactivemerchant22m, you would
- not expect it to suddenly stop working after updating 1mactionpack22m. How-
- ever, satisfying the new 1mactivesupport 3.0.0.rc 22mdependency of action-
+ Because you did not explicitly ask to update activemerchant, you would
+ not expect it to suddenly stop working after updating actionpack. How-
+ ever, satisfying the new activesupport 3.0.0.rc dependency of action-
pack requires updating one of its dependencies.
- Even though 1mactivemerchant 22mdeclares a very loose dependency that theo-
- retically matches 1mactivesupport 3.0.0.rc22m, Bundler treats gems in your
+ 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 1mactivemerchant 22mdependency is treated as
- 1mactivemerchant 1.7.1 + activesupport 2.3.822m, so 1mbundle install 22mwill re-
- port that it cannot update 1mactionpack22m.
+ 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 1mactionpack22m, including its dependencies which other
- gems in the Gemfile(5) still depend on, run 1mbundle update actionpack0m
- (see 1mbundle update(1)22m).
+ 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)).
- 1mSummary22m: In general, after making a change to the Gemfile(5) , you
- should first try to run 1mbundle install22m, which will guarantee that no
+ Summary: In general, after making a change to the Gemfile(5) , you
+ should first try to run bundle install, which will guarantee that no
other gem in the Gemfile(5) is impacted by the change. If that does not
- work, run bundle update(1) 4mbundle-update.1.html24m.
+ work, run bundle update(1) bundle-update.1.html.
-1mSEE ALSO0m
- o Gem install docs 4mhttp://guides.rubygems.org/rubygems-basics/#in-0m
- 4mstalling-gems0m
+SEE ALSO
+ o Gem install docs
+ http://guides.rubygems.org/rubygems-basics/#installing-gems
- o Rubygems signing docs 4mhttp://guides.rubygems.org/security/0m
+ o Rubygems signing docs http://guides.rubygems.org/security/
- January 2019 BUNDLE-INSTALL(1)
+ April 2019 BUNDLE-INSTALL(1)
diff --git a/man/bundle-install.ronn b/man/bundle-install.ronn
index a9e375c87c..2ba82f27a5 100644
--- a/man/bundle-install.ronn
+++ b/man/bundle-install.ronn
@@ -6,7 +6,6 @@ bundle-install(1) -- Install the dependencies specified in your Gemfile
`bundle install` [--binstubs[=DIRECTORY]]
[--clean]
[--deployment]
- [--force]
[--frozen]
[--full-index]
[--gemfile=GEMFILE]
@@ -16,6 +15,7 @@ bundle-install(1) -- Install the dependencies specified in your Gemfile
[--no-prune]
[--path PATH]
[--quiet]
+ [--redownload]
[--retry=NUMBER]
[--shebang]
[--standalone[=GROUP[ GROUP...]]]
@@ -47,7 +47,12 @@ To apply any of `--binstubs`, `--deployment`, `--path`, or `--without` every
time `bundle install` is run, use `bundle config` (see bundle-config(1)).
* `--binstubs[=<directory>]`:
- Creates a directory (defaults to `~/bin`) and place any executables from the
+ 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
@@ -64,9 +69,9 @@ time `bundle install` is run, use `bundle config` (see bundle-config(1)).
production or CI use. Please check carefully if you want to have this option
enabled in your development environment.
-* `--force`:
+* `--redownload`:
Force download every gem, even if the required versions are already available
- locally. `--redownload` is an alias of this option.
+ locally.
* `--frozen`:
Do not allow the Gemfile.lock to be updated after this install. Exits
diff --git a/man/bundle-list.1 b/man/bundle-list.1
index c41948f1b5..d282228be2 100644
--- a/man/bundle-list.1
+++ b/man/bundle-list.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-LIST" "1" "November 2018" "" ""
+.TH "BUNDLE\-LIST" "1" "March 2019" "" ""
.
.SH "NAME"
\fBbundle\-list\fR \- List all the gems in the bundle
diff --git a/man/bundle-list.1.txt b/man/bundle-list.1.txt
index aa20d4ebea..7ef2427608 100644
--- a/man/bundle-list.1.txt
+++ b/man/bundle-list.1.txt
@@ -2,14 +2,14 @@ BUNDLE-LIST(1) BUNDLE-LIST(1)
-1mNAME0m
- 1mbundle-list 22m- List all the gems in the bundle
+NAME
+ bundle-list - List all the gems in the bundle
-1mSYNOPSIS0m
- 1mbundle list 22m[--name-only] [--paths] [--without-group=GROUP]
+SYNOPSIS
+ bundle list [--name-only] [--paths] [--without-group=GROUP]
[--only-group=GROUP]
-1mDESCRIPTION0m
+DESCRIPTION
Prints a list of all the gems in the bundle including their version.
Example:
@@ -24,20 +24,20 @@ BUNDLE-LIST(1) BUNDLE-LIST(1)
bundle list --only-group dev --paths
-1mOPTIONS0m
- 1m--name-only0m
+OPTIONS
+ --name-only
Print only the name of each gem.
- 1m--paths0m
+ --paths
Print the path to each gem in the bundle.
- 1m--without-group0m
+ --without-group
Print all gems expect from a group.
- 1m--only-group0m
+ --only-group
Print gems from a particular group.
- November 2018 BUNDLE-LIST(1)
+ March 2019 BUNDLE-LIST(1)
diff --git a/man/bundle-lock.1 b/man/bundle-lock.1
index 03b7e8f9cc..bec1cb5200 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" "November 2018" "" ""
+.TH "BUNDLE\-LOCK" "1" "March 2019" "" ""
.
.SH "NAME"
\fBbundle\-lock\fR \- Creates / Updates a lockfile without installing
diff --git a/man/bundle-lock.1.txt b/man/bundle-lock.1.txt
index 838c1baae5..3da8b29ab3 100644
--- a/man/bundle-lock.1.txt
+++ b/man/bundle-lock.1.txt
@@ -2,92 +2,92 @@ BUNDLE-LOCK(1) BUNDLE-LOCK(1)
-1mNAME0m
- 1mbundle-lock 22m- Creates / Updates a lockfile without installing
+NAME
+ bundle-lock - Creates / Updates a lockfile without installing
-1mSYNOPSIS0m
- 1mbundle lock 22m[--update] [--local] [--print] [--lockfile=PATH]
+SYNOPSIS
+ bundle lock [--update] [--local] [--print] [--lockfile=PATH]
[--full-index] [--add-platform] [--remove-platform] [--patch] [--minor]
[--major] [--strict] [--conservative]
-1mDESCRIPTION0m
+DESCRIPTION
Lock the gems specified in Gemfile.
-1mOPTIONS0m
- 1m--update=<*gems>0m
+OPTIONS
+ --update=<*gems>
Ignores the existing lockfile. Resolve then updates lockfile.
- Taking a list of gems or updating all gems if no list is given.
+ Taking a list of gems or updating all gems if no list is given.
- 1m--local0m
- Do not attempt to connect to 1mrubygems.org22m. Instead, Bundler will
- use the gems already present in Rubygems' cache or in 1mven-0m
- 1mdor/cache22m. Note that if a appropriate platform-specific gem ex-
- ists on 1mrubygems.org 22mit will not be found.
+ --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.
- 1m--print0m
- Prints the lockfile to STDOUT instead of writing to the file
+ --print
+ Prints the lockfile to STDOUT instead of writing to the file
system.
- 1m--lockfile=<path>0m
+ --lockfile=<path>
The path where the lockfile should be written to.
- 1m--full-index0m
+ --full-index
Fall back to using the single-file index of all gems.
- 1m--add-platform0m
- Add a new platform to the lockfile, re-resolving for the addi-
+ --add-platform
+ Add a new platform to the lockfile, re-resolving for the addi-
tion of that platform.
- 1m--remove-platform0m
+ --remove-platform
Remove a platform from the lockfile.
- 1m--patch0m
+ --patch
If updating, prefer updating only to next patch version.
- 1m--minor0m
+ --minor
If updating, prefer updating only to next minor version.
- 1m--major0m
+ --major
If updating, prefer updating to next major version (default).
- 1m--strict0m
- If updating, do not allow any gem to be updated past latest
+ --strict
+ If updating, do not allow any gem to be updated past latest
--patch | --minor | --major.
- 1m--conservative0m
+ --conservative
If updating, use bundle install conservative update behavior and
do not allow shared dependencies to be updated.
-1mUPDATING ALL GEMS0m
- If you run 1mbundle lock 22mwith 1m--update 22moption without list of gems,
- bundler will ignore any previously installed gems and resolve all de-
- pendencies again based on the latest versions of all gems available in
- the sources.
+UPDATING ALL GEMS
+ If you run bundle lock with --update option without list of gems,
+ bundler will ignore any previously installed gems and resolve all
+ dependencies again based on the latest versions of all gems available
+ in the sources.
-1mUPDATING A LIST OF GEMS0m
+UPDATING A LIST OF GEMS
Sometimes, you want to update a single gem in the Gemfile(5), and leave
- the rest of the gems that you specified locked to the versions in the
- 1mGemfile.lock22m.
+ the rest of the gems that you specified locked to the versions in the
+ Gemfile.lock.
- For instance, you only want to update 1mnokogiri22m, run 1mbundle lock --up-0m
- 1mdate nokogiri22m.
+ For instance, you only want to update nokogiri, run bundle lock
+ --update nokogiri.
- Bundler will update 1mnokogiri 22mand any of its dependencies, but leave the
- rest of the gems that you specified locked to the versions in the 1mGem-0m
- 1mfile.lock22m.
+ 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.
-1mSUPPORTING OTHER PLATFORMS0m
- If you want your bundle to support platforms other than the one you're
- running locally, you can run 1mbundle lock --add-platform PLATFORM 22mto add
- PLATFORM to the lockfile, force bundler to re-resolve and consider the
- new platform when picking gems, all without needing to have a machine
+SUPPORTING OTHER PLATFORMS
+ If you want your bundle to support platforms other than the one you're
+ running locally, you can run bundle lock --add-platform PLATFORM to add
+ PLATFORM to the lockfile, force bundler to re-resolve and consider the
+ new platform when picking gems, all without needing to have a machine
that matches PLATFORM handy to install those platform-specific gems on.
- For a full explanation of gem platforms, see 1mgem help platform22m.
+ For a full explanation of gem platforms, see gem help platform.
-1mPATCH LEVEL OPTIONS0m
- See bundle update(1) 4mbundle-update.1.html24m for details.
+PATCH LEVEL OPTIONS
+ See bundle update(1) bundle-update.1.html for details.
- November 2018 BUNDLE-LOCK(1)
+ March 2019 BUNDLE-LOCK(1)
diff --git a/man/bundle-open.1 b/man/bundle-open.1
index 6301cb1fbc..9d8e390265 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" "November 2018" "" ""
+.TH "BUNDLE\-OPEN" "1" "March 2019" "" ""
.
.SH "NAME"
\fBbundle\-open\fR \- Opens the source directory for a gem in your bundle
diff --git a/man/bundle-open.1.txt b/man/bundle-open.1.txt
index 833744ae5e..ac289aa97d 100644
--- a/man/bundle-open.1.txt
+++ b/man/bundle-open.1.txt
@@ -2,16 +2,16 @@ BUNDLE-OPEN(1) BUNDLE-OPEN(1)
-1mNAME0m
- 1mbundle-open 22m- Opens the source directory for a gem in your bundle
+NAME
+ bundle-open - Opens the source directory for a gem in your bundle
-1mSYNOPSIS0m
- 1mbundle open 22m[GEM]
+SYNOPSIS
+ bundle open [GEM]
-1mDESCRIPTION0m
+DESCRIPTION
Opens the source directory of the provided GEM in your editor.
- For this to work the 1mEDITOR 22mor 1mBUNDLER_EDITOR 22menvironment variable has
+ For this to work the EDITOR or BUNDLER_EDITOR environment variable has
to be set.
Example:
@@ -26,4 +26,4 @@ BUNDLE-OPEN(1) BUNDLE-OPEN(1)
- November 2018 BUNDLE-OPEN(1)
+ March 2019 BUNDLE-OPEN(1)
diff --git a/man/bundle-outdated.1 b/man/bundle-outdated.1
index cde4bb09a1..cbb88905ed 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" "November 2018" "" ""
+.TH "BUNDLE\-OUTDATED" "1" "March 2019" "" ""
.
.SH "NAME"
\fBbundle\-outdated\fR \- List installed gems with newer versions available
diff --git a/man/bundle-outdated.1.txt b/man/bundle-outdated.1.txt
index dc9d7a06c7..493ded1646 100644
--- a/man/bundle-outdated.1.txt
+++ b/man/bundle-outdated.1.txt
@@ -2,80 +2,80 @@ BUNDLE-OUTDATED(1) BUNDLE-OUTDATED(1)
-1mNAME0m
- 1mbundle-outdated 22m- List installed gems with newer versions available
+NAME
+ bundle-outdated - List installed gems with newer versions available
-1mSYNOPSIS0m
- 1mbundle outdated 22m[GEM] [--local] [--pre] [--source] [--strict]
- [--parseable | --porcelain] [--group=GROUP] [--groups] [--up-
- date-strict] [--patch|--minor|--major] [--filter-major] [--filter-mi-
- nor] [--filter-patch] [--only-explicit]
+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]
-1mDESCRIPTION0m
+DESCRIPTION
Outdated lists the names and versions of gems that have a newer version
available in the given source. Calling outdated with [GEM [GEM]] will
only check for newer versions of the given gems. Prerelease gems are
ignored by default. If your gems are up to date, Bundler will exit with
a status of 0. Otherwise, it will exit 1.
-1mOPTIONS0m
- 1m--local0m
- Do not attempt to fetch gems remotely and use the gem cache in-
- stead.
+OPTIONS
+ --local
+ Do not attempt to fetch gems remotely and use the gem cache
+ instead.
- 1m--pre 22mCheck for newer pre-release gems.
+ --pre Check for newer pre-release gems.
- 1m--source0m
+ --source
Check against a specific source.
- 1m--strict0m
+ --strict
Only list newer versions allowed by your Gemfile requirements.
- 1m--parseable22m, 1m--porcelain0m
+ --parseable, --porcelain
Use minimal formatting for more parseable output.
- 1m--group0m
+ --group
List gems from a specific group.
- 1m--groups0m
+ --groups
List gems organized by groups.
- 1m--update-strict0m
- Strict conservative resolution, do not allow any gem to be up-
- dated past latest --patch | --minor| --major.
+ --update-strict
+ Strict conservative resolution, do not allow any gem to be
+ updated past latest --patch | --minor| --major.
- 1m--minor0m
+ --minor
Prefer updating only to next minor version.
- 1m--major0m
+ --major
Prefer updating to next major version (default).
- 1m--patch0m
+ --patch
Prefer updating only to next patch version.
- 1m--filter-major0m
+ --filter-major
Only list major newer versions.
- 1m--filter-minor0m
+ --filter-minor
Only list minor newer versions.
- 1m--filter-patch0m
+ --filter-patch
Only list patch newer versions.
- 1m--only-explicit0m
+ --only-explicit
Only list gems specified in your Gemfile, not their dependen-
cies.
-1mPATCH LEVEL OPTIONS0m
- See bundle update(1) 4mbundle-update.1.html24m for details.
+PATCH LEVEL OPTIONS
+ See bundle update(1) bundle-update.1.html for details.
- One difference between the patch level options in 1mbundle update 22mand
- here is the 1m--strict 22moption. 1m--strict 22mwas already an option on outdated
- before the patch level options were added. 1m--strict 22mwasn't altered, and
- the 1m--update-strict 22moption on 1moutdated 22mreflects what 1m--strict 22mdoes on
- 1mbundle update22m.
+ 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
+ bundle update.
-1mFILTERING OUTPUT0m
+FILTERING OUTPUT
The 3 filtering options do not affect the resolution of versions,
merely what versions are shown in the output.
@@ -89,7 +89,7 @@ BUNDLE-OUTDATED(1) BUNDLE-OUTDATED(1)
- 1m--filter-major 22mwould only show:
+ --filter-major would only show:
@@ -97,7 +97,7 @@ BUNDLE-OUTDATED(1) BUNDLE-OUTDATED(1)
- 1m--filter-minor 22mwould only show:
+ --filter-minor would only show:
@@ -105,7 +105,7 @@ BUNDLE-OUTDATED(1) BUNDLE-OUTDATED(1)
- 1m--filter-patch 22mwould only show:
+ --filter-patch would only show:
@@ -113,7 +113,7 @@ BUNDLE-OUTDATED(1) BUNDLE-OUTDATED(1)
- Filter options can be combined. 1m--filter-minor 22mand 1m--filter-patch 22mwould
+ Filter options can be combined. --filter-minor and --filter-patch would
show:
@@ -123,9 +123,9 @@ BUNDLE-OUTDATED(1) BUNDLE-OUTDATED(1)
- Combining all three 1mfilter 22moptions would be the same result as provid-
+ Combining all three filter options would be the same result as provid-
ing none of them.
- November 2018 BUNDLE-OUTDATED(1)
+ March 2019 BUNDLE-OUTDATED(1)
diff --git a/man/bundle-package.1 b/man/bundle-package.1
index db0447be83..d3988935e5 100644
--- a/man/bundle-package.1
+++ b/man/bundle-package.1
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-PACKAGE" "1" "November 2018" "" ""
+.TH "BUNDLE\-PACKAGE" "1" "March 2019" "" ""
.
.SH "NAME"
\fBbundle\-package\fR \- Package your needed \fB\.gem\fR files into your application
diff --git a/man/bundle-package.1.txt b/man/bundle-package.1.txt
index 56b977f0ca..140b7a97b4 100644
--- a/man/bundle-package.1.txt
+++ b/man/bundle-package.1.txt
@@ -2,36 +2,36 @@ BUNDLE-PACKAGE(1) BUNDLE-PACKAGE(1)
-1mNAME0m
- 1mbundle-package 22m- Package your needed 1m.gem 22mfiles into your application
+NAME
+ bundle-package - Package your needed .gem files into your application
-1mSYNOPSIS0m
- 1mbundle package0m
+SYNOPSIS
+ bundle package
-1mDESCRIPTION0m
- Copy all of the 1m.gem 22mfiles needed to run the application into the 1mven-0m
- 1mdor/cache 22mdirectory. In the future, when running [bundle in-
- stall(1)][bundle-install], use the gems in the cache in preference to
- the ones on 1mrubygems.org22m.
+DESCRIPTION
+ Copy all of the .gem files needed to run the application into the ven-
+ dor/cache directory. In the future, when running [bundle
+ install(1)][bundle-install], use the gems in the cache in preference to
+ the ones on rubygems.org.
-1mGIT AND PATH GEMS0m
- Since Bundler 1.2, the 1mbundle package 22mcommand can also package 1m:git 22mand
- 1m:path 22mdependencies besides .gem files. This needs to be explicitly en-
- abled via the 1m--all 22moption. Once used, the 1m--all 22moption will be remem-
- bered.
+GIT AND PATH GEMS
+ Since Bundler 1.2, the bundle package command can also package :git and
+ :path dependencies besides .gem files. This needs to be explicitly
+ enabled via the --all option. Once used, the --all option will be
+ remembered.
-1mSUPPORT FOR MULTIPLE PLATFORMS0m
+SUPPORT FOR MULTIPLE PLATFORMS
When using gems that have different packages for different platforms,
Bundler 1.8 and newer support caching of gems for other platforms where
- the Gemfile has been resolved (i.e. present in the lockfile) in 1mven-0m
- 1mdor/cache22m. This needs to be enabled via the 1m--all-platforms 22moption.
+ the Gemfile has been resolved (i.e. present in the lockfile) in ven-
+ dor/cache. This needs to be enabled via the --all-platforms option.
This setting will be remembered in your local bundler configuration.
-1mREMOTE FETCHING0m
- By default, if you run 1mbundle install(1)22m](bundle-install.1.html) after
- running bundle package(1) 4mbundle-package.1.html24m, bundler will still
- connect to 1mrubygems.org 22mto check whether a platform-specific gem exists
- for any of the gems in 1mvendor/cache22m.
+REMOTE FETCHING
+ By default, if you run bundle install(1)](bundle-install.1.html) after
+ running bundle package(1) bundle-package.1.html, bundler will still
+ connect to rubygems.org to check whether a platform-specific gem exists
+ for any of the gems in vendor/cache.
For instance, consider this Gemfile(5):
@@ -43,37 +43,37 @@ BUNDLE-PACKAGE(1) BUNDLE-PACKAGE(1)
- If you run 1mbundle package 22munder C Ruby, bundler will retrieve the ver-
- sion of 1mnokogiri 22mfor the 1m"ruby" 22mplatform. If you deploy to JRuby and
- run 1mbundle install22m, bundler is forced to check to see whether a 1m"java"0m
- platformed 1mnokogiri 22mexists.
+ If you run bundle package under C Ruby, bundler will retrieve the ver-
+ sion of nokogiri for the "ruby" platform. If you deploy to JRuby and
+ run bundle install, bundler is forced to check to see whether a "java"
+ platformed nokogiri exists.
- Even though the 1mnokogiri 22mgem for the Ruby platform is 4mtechnically24m ac-
- ceptable on JRuby, it has a C extension that does not run on JRuby. As
- a result, bundler will, by default, still connect to 1mrubygems.org 22mto
+ Even though the nokogiri gem for the Ruby platform is technically
+ acceptable on JRuby, it has a C extension that does not run on JRuby.
+ As a result, bundler will, by default, still connect to rubygems.org to
check whether it has a version of one of your gems more specific to
your platform.
- This problem is also not limited to the 1m"java" 22mplatform. A similar
+ 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 1mvendor/cache 22mare appro-
- priate for the platform you are on, you can run 1mbundle install --local0m
- to skip checking for more appropriate gems, and use the ones in 1mven-0m
- 1mdor/cache22m.
+ If you know for sure that the gems packaged in vendor/cache are appro-
+ priate for the platform you are on, you can run bundle install --local
+ to skip checking for more appropriate gems, and use the ones in ven-
+ dor/cache.
One way to be sure that you have the right platformed versions of all
- your gems is to run 1mbundle package 22mon an identical machine and check in
- the gems. For instance, you can run 1mbundle package 22mon an identical
- staging box during your staging process, and check in the 1mvendor/cache0m
+ your gems is to run bundle package on an identical machine and check in
+ the gems. For instance, you can run bundle package on an identical
+ staging box during your staging process, and check in the vendor/cache
before deploying to production.
- By default, bundle package(1) 4mbundle-package.1.html24m fetches and also
+ By default, bundle package(1) bundle-package.1.html fetches and also
installs the gems to the default location. To package the dependencies
- to 1mvendor/cache 22mwithout installing them to the local install location,
- you can run 1mbundle package --no-install22m.
+ to vendor/cache without installing them to the local install location,
+ you can run bundle package --no-install.
- November 2018 BUNDLE-PACKAGE(1)
+ March 2019 BUNDLE-PACKAGE(1)
diff --git a/man/bundle-platform.1 b/man/bundle-platform.1
index 94b5e13cc1..ed3ddc1baf 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" "November 2018" "" ""
+.TH "BUNDLE\-PLATFORM" "1" "March 2019" "" ""
.
.SH "NAME"
\fBbundle\-platform\fR \- Displays platform compatibility information
diff --git a/man/bundle-platform.1.txt b/man/bundle-platform.1.txt
index 26079cc3d5..353b2dfe17 100644
--- a/man/bundle-platform.1.txt
+++ b/man/bundle-platform.1.txt
@@ -2,14 +2,14 @@ BUNDLE-PLATFORM(1) BUNDLE-PLATFORM(1)
-1mNAME0m
- 1mbundle-platform 22m- Displays platform compatibility information
+NAME
+ bundle-platform - Displays platform compatibility information
-1mSYNOPSIS0m
- 1mbundle platform 22m[--ruby]
+SYNOPSIS
+ bundle platform [--ruby]
-1mDESCRIPTION0m
- 1mplatform 22mwill display information from your Gemfile, Gemfile.lock, and
+DESCRIPTION
+ platform will display information from your Gemfile, Gemfile.lock, and
Ruby VM about your platform.
For instance, using this Gemfile(5):
@@ -24,7 +24,7 @@ BUNDLE-PLATFORM(1) BUNDLE-PLATFORM(1)
- If you run 1mbundle platform 22mon Ruby 1.9.3, it will display the following
+ If you run bundle platform on Ruby 1.9.3, it will display the following
output:
@@ -41,17 +41,17 @@ BUNDLE-PLATFORM(1) BUNDLE-PLATFORM(1)
- 1mplatform 22mwill list all the platforms in your 1mGemfile.lock 22mas well as
- the 1mruby 22mdirective if applicable from your Gemfile(5). It will also let
- you know if the 1mruby 22mdirective requirement has been met. If 1mruby 22mdirec-
+ 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.
-1mOPTIONS0m
- 1m--ruby 22mIt will display the ruby directive information, so you don't
+OPTIONS
+ --ruby It will display the ruby directive information, so you don't
have to parse it from the Gemfile(5).
- November 2018 BUNDLE-PLATFORM(1)
+ March 2019 BUNDLE-PLATFORM(1)
diff --git a/man/bundle-pristine.1 b/man/bundle-pristine.1
index d3881ade3d..bd6d2b2993 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" "November 2018" "" ""
+.TH "BUNDLE\-PRISTINE" "1" "March 2019" "" ""
.
.SH "NAME"
\fBbundle\-pristine\fR \- Restores installed gems to their pristine condition
diff --git a/man/bundle-pristine.1.txt b/man/bundle-pristine.1.txt
index 2fd320282a..25b6710d5f 100644
--- a/man/bundle-pristine.1.txt
+++ b/man/bundle-pristine.1.txt
@@ -2,43 +2,43 @@ BUNDLE-PRISTINE(1) BUNDLE-PRISTINE(1)
-1mNAME0m
- 1mbundle-pristine 22m- Restores installed gems to their pristine condition
+NAME
+ bundle-pristine - Restores installed gems to their pristine condition
-1mSYNOPSIS0m
- 1mbundle pristine0m
+SYNOPSIS
+ bundle pristine
-1mDESCRIPTION0m
- 1mpristine 22mrestores the installed gems in the bundle to their pristine
+DESCRIPTION
+ 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.
- For further explanation, 1mbundle pristine 22mignores unpacked files on
- disk. In other words, this command utilizes the local 1m.gem 22mcache or the
+ For further explanation, bundle pristine ignores unpacked files on
+ disk. In other words, this command utilizes the local .gem cache or the
gem's git repository as if one were installing from scratch.
Note: the Bundler gem cannot be restored to its original state with
- 1mpristine22m. One also cannot use 1mbundle pristine 22mon gems with a 'path' op-
- tion in the Gemfile, because bundler has no original copy it can re-
- store from.
+ 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 1mbundle pristine22m?
+ When is it practical to use bundle pristine?
- It comes in handy when a developer is debugging a gem. 1mbundle pristine0m
+ It comes in handy when a developer is debugging a gem. bundle pristine
is a great way to get rid of experimental changes to a gem that one may
not want.
- Why use 1mbundle pristine 22mover 1mgem pristine --all22m?
+ Why use bundle pristine over gem pristine --all?
- Both commands are very similar. For context: 1mbundle pristine22m, without
- arguments, cleans all gems from the lockfile. Meanwhile, 1mgem pristine0m
- 1m--all 22mcleans all installed gems for that Ruby version.
+ Both commands are very similar. For context: bundle pristine, without
+ arguments, cleans all gems from the lockfile. Meanwhile, gem pristine
+ --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 1mgem pristine [GEMNAME] 22mcommand may be inconve-
- nient. One can avoid waiting for 1mgem pristine --all22m, and instead run
- 1mbundle pristine22m.
+ debugging, the Rubygems gem pristine [GEMNAME] command may be inconve-
+ nient. One can avoid waiting for gem pristine --all, and instead run
+ bundle pristine.
- November 2018 BUNDLE-PRISTINE(1)
+ March 2019 BUNDLE-PRISTINE(1)
diff --git a/man/bundle-remove.1 b/man/bundle-remove.1
index 8232ab2887..0b0279001c 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" "November 2018" "" ""
+.TH "BUNDLE\-REMOVE" "1" "March 2019" "" ""
.
.SH "NAME"
\fBbundle\-remove\fR \- Removes gems from the Gemfile
diff --git a/man/bundle-remove.1.txt b/man/bundle-remove.1.txt
index 5248a0ee18..219c50f944 100644
--- a/man/bundle-remove.1.txt
+++ b/man/bundle-remove.1.txt
@@ -2,23 +2,23 @@ BUNDLE-REMOVE(1) BUNDLE-REMOVE(1)
-1mNAME0m
- 1mbundle-remove 22m- Removes gems from the Gemfile
+NAME
+ bundle-remove - Removes gems from the Gemfile
-1mSYNOPSIS0m
- 1mbundle remove [GEM [GEM ...]] [--install]0m
+SYNOPSIS
+ bundle remove [GEM [GEM ...]] [--install]
-1mDESCRIPTION0m
+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
raised.
-1mOPTIONS0m
- 1m--install0m
- Runs 1mbundle install 22mafter the given gems have been removed from
- the Gemfile, which ensures that both the lockfile and the in-
- stalled gems on disk are also updated to remove the given
+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).
Example:
@@ -31,4 +31,4 @@ BUNDLE-REMOVE(1) BUNDLE-REMOVE(1)
- November 2018 BUNDLE-REMOVE(1)
+ March 2019 BUNDLE-REMOVE(1)
diff --git a/man/bundle-show.1 b/man/bundle-show.1
index 72ce37aedd..d3387dcc2f 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" "November 2018" "" ""
+.TH "BUNDLE\-SHOW" "1" "March 2019" "" ""
.
.SH "NAME"
\fBbundle\-show\fR \- Shows all the gems in your bundle, or the path to a gem
diff --git a/man/bundle-show.1.txt b/man/bundle-show.1.txt
index 542ee55f78..b2851ff06e 100644
--- a/man/bundle-show.1.txt
+++ b/man/bundle-show.1.txt
@@ -2,26 +2,26 @@ BUNDLE-SHOW(1) BUNDLE-SHOW(1)
-1mNAME0m
- 1mbundle-show 22m- Shows all the gems in your bundle, or the path to a gem
+NAME
+ bundle-show - Shows all the gems in your bundle, or the path to a gem
-1mSYNOPSIS0m
- 1mbundle show 22m[GEM] [--paths]
+SYNOPSIS
+ bundle show [GEM] [--paths]
-1mDESCRIPTION0m
- Without the [GEM] option, 1mshow 22mwill print a list of the names and ver-
- sions of all gems that are required by your [1mGemfile(5)22m][Gemfile(5)],
+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.
Calling show with [GEM] will list the exact location of that gem on
your machine.
-1mOPTIONS0m
- 1m--paths0m
- List the paths of all gems that are required by your [1mGem-0m
- 1mfile(5)22m][Gemfile(5)], sorted by gem name.
+OPTIONS
+ --paths
+ List the paths of all gems that are required by your [Gem-
+ file(5)][Gemfile(5)], sorted by gem name.
- November 2018 BUNDLE-SHOW(1)
+ March 2019 BUNDLE-SHOW(1)
diff --git a/man/bundle-update.1 b/man/bundle-update.1
index 513bc64905..f980563732 100644
--- a/man/bundle-update.1
+++ b/man/bundle-update.1
@@ -1,13 +1,13 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BUNDLE\-UPDATE" "1" "January 2019" "" ""
+.TH "BUNDLE\-UPDATE" "1" "April 2019" "" ""
.
.SH "NAME"
\fBbundle\-update\fR \- Update your gems to the latest available versions
.
.SH "SYNOPSIS"
-\fBbundle update\fR \fI*gems\fR [\-\-all] [\-\-group=NAME] [\-\-source=NAME] [\-\-local] [\-\-ruby] [\-\-bundler[=VERSION]] [\-\-full\-index] [\-\-jobs=JOBS] [\-\-quiet] [\-\-force] [\-\-patch|\-\-minor|\-\-major] [\-\-strict] [\-\-conservative]
+\fBbundle update\fR \fI*gems\fR [\-\-all] [\-\-group=NAME] [\-\-source=NAME] [\-\-local] [\-\-ruby] [\-\-bundler[=VERSION]] [\-\-full\-index] [\-\-jobs=JOBS] [\-\-quiet] [\-\-patch|\-\-minor|\-\-major] [\-\-redownload] [\-\-strict] [\-\-conservative]
.
.SH "DESCRIPTION"
Update the gems specified (all gems, if \fB\-\-all\fR flag is used), ignoring the previously installed gems specified in the \fBGemfile\.lock\fR\. In general, you should use bundle install(1) \fIbundle\-install\.1\.html\fR to install the same exact gems and versions across machines\.
@@ -58,8 +58,8 @@ Retry failed network or git requests for \fInumber\fR times\.
Only output warnings and errors\.
.
.TP
-\fB\-\-force\fR
-Force downloading every gem\. \fB\-\-redownload\fR is an alias of this option\.
+\fB\-\-redownload\fR
+Force downloading every gem\.
.
.TP
\fB\-\-patch\fR
diff --git a/man/bundle-update.1.txt b/man/bundle-update.1.txt
index d40b05485a..98df74b09c 100644
--- a/man/bundle-update.1.txt
+++ b/man/bundle-update.1.txt
@@ -2,85 +2,84 @@ BUNDLE-UPDATE(1) BUNDLE-UPDATE(1)
-1mNAME0m
- 1mbundle-update 22m- Update your gems to the latest available versions
+NAME
+ bundle-update - Update your gems to the latest available versions
-1mSYNOPSIS0m
- 1mbundle update 4m22m*gems24m [--all] [--group=NAME] [--source=NAME] [--local]
+SYNOPSIS
+ bundle update *gems [--all] [--group=NAME] [--source=NAME] [--local]
[--ruby] [--bundler[=VERSION]] [--full-index] [--jobs=JOBS] [--quiet]
- [--force] [--patch|--minor|--major] [--strict] [--conservative]
+ [--patch|--minor|--major] [--redownload] [--strict] [--conservative]
-1mDESCRIPTION0m
- Update the gems specified (all gems, if 1m--all 22mflag is used), ignoring
- the previously installed gems specified in the 1mGemfile.lock22m. In gen-
- eral, you should use bundle install(1) 4mbundle-install.1.html24m to install
+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.
- You would use 1mbundle update 22mto explicitly update the version of a gem.
+ You would use bundle update to explicitly update the version of a gem.
-1mOPTIONS0m
- 1m--all 22mUpdate all gems specified in Gemfile.
+OPTIONS
+ --all Update all gems specified in Gemfile.
- 1m--group=<name>22m, 1m-g=[<name>]0m
- Only update the gems in the specified group. For instance, you
- can update all gems in the development group with 1mbundle update0m
- 1m--group development22m. You can also call 1mbundle update rails0m
- 1m--group test 22mto update the rails gem and all gems in the test
+ --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.
- 1m--source=<name>0m
- The name of a 1m:git 22mor 1m:path 22msource used in the Gemfile(5). For
- instance, with a 1m:git 22msource of
- 1mhttp://github.com/rails/rails.git22m, you would call 1mbundle update0m
- 1m--source rails0m
+ --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
- 1m--local0m
- Do not attempt to fetch gems remotely and use the gem cache in-
- stead.
+ --local
+ Do not attempt to fetch gems remotely and use the gem cache
+ instead.
- 1m--ruby 22mUpdate the locked version of Ruby to the current version of
+ --ruby Update the locked version of Ruby to the current version of
Ruby.
- 1m--bundler0m
+ --bundler
Update the locked version of bundler to the invoked bundler ver-
sion.
- 1m--full-index0m
+ --full-index
Fall back to using the single-file index of all gems.
- 1m--jobs=[<number>]22m, 1m-j[<number>]0m
- Specify the number of jobs to run in parallel. The default is 1m122m.
+ --jobs=[<number>], -j[<number>]
+ Specify the number of jobs to run in parallel. The default is 1.
- 1m--retry=[<number>]0m
- Retry failed network or git requests for 4mnumber24m times.
+ --retry=[<number>]
+ Retry failed network or git requests for number times.
- 1m--quiet0m
+ --quiet
Only output warnings and errors.
- 1m--force0m
- Force downloading every gem. 1m--redownload 22mis an alias of this
- option.
+ --redownload
+ Force downloading every gem.
- 1m--patch0m
+ --patch
Prefer updating only to next patch version.
- 1m--minor0m
+ --minor
Prefer updating only to next minor version.
- 1m--major0m
+ --major
Prefer updating to next major version (default).
- 1m--strict0m
- Do not allow any gem to be updated past latest 1m--patch 22m| 1m--minor0m
- | 1m--major22m.
+ --strict
+ Do not allow any gem to be updated past latest --patch | --minor
+ | --major.
- 1m--conservative0m
+ --conservative
Use bundle install conservative update behavior and do not allow
shared dependencies to be updated.
-1mUPDATING ALL GEMS0m
- If you run 1mbundle update --all22m, bundler will ignore any previously in-
- stalled gems and resolve all dependencies again based on the latest
+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
versions of all gems available in the sources.
Consider the following Gemfile(5):
@@ -94,9 +93,9 @@ BUNDLE-UPDATE(1) BUNDLE-UPDATE(1)
- When you run bundle install(1) 4mbundle-install.1.html24m the first time,
- bundler will resolve all of the dependencies, all the way down, and in-
- stall what you need:
+ 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
+ install what you need:
@@ -134,44 +133,44 @@ BUNDLE-UPDATE(1) BUNDLE-UPDATE(1)
- As you can see, even though you have two gems in the Gemfile(5), your
- application needs 26 different gems in order to run. Bundler remembers
- the exact versions it installed in 1mGemfile.lock22m. The next time you run
- bundle install(1) 4mbundle-install.1.html24m, bundler skips the dependency
+ As you can see, even though you have two gems in the Gemfile(5), your
+ application needs 26 different gems in order to run. Bundler remembers
+ the exact versions it installed in Gemfile.lock. The next time you run
+ bundle install(1) bundle-install.1.html, bundler skips the dependency
resolution and installs the same gems as it installed last time.
- After checking in the 1mGemfile.lock 22minto version control and cloning it
- on another machine, running bundle install(1) 4mbundle-install.1.html0m
- will 4mstill24m install the gems that you installed last time. You don't
- need to worry that a new release of 1merubis 22mor 1mmail 22mchanges the gems you
+ After checking in the Gemfile.lock into version control and cloning it
+ on another machine, running bundle install(1) bundle-install.1.html
+ will still install the gems that you installed last time. You don't
+ need to worry that a new release of erubis or mail changes the gems you
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-
+ 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).
- To do this, run 1mbundle update --all22m, which will ignore the 1mGem-0m
- 1mfile.lock22m, and resolve all the dependencies again. Keep in mind that
- this process can result in a significantly different set of the 25
- gems, based on the requirements of new gems that the gem authors re-
- leased since the last time you ran 1mbundle update --all22m.
+ To do this, run bundle update --all, which will ignore the Gem-
+ file.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
+ released since the last time you ran bundle update --all.
-1mUPDATING A LIST OF GEMS0m
+UPDATING A LIST OF GEMS
Sometimes, you want to update a single gem in the Gemfile(5), and leave
- the rest of the gems that you specified locked to the versions in the
- 1mGemfile.lock22m.
+ the rest of the gems that you specified locked to the versions in the
+ Gemfile.lock.
- For instance, in the scenario above, imagine that 1mnokogiri 22mreleases
- version 1m1.4.422m, and you want to update it 4mwithout24m updating Rails and all
- of its dependencies. To do this, run 1mbundle update nokogiri22m.
+ For instance, in the scenario above, imagine that nokogiri releases
+ 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 1mnokogiri 22mand any of its dependencies, but leave
+ Bundler will update nokogiri and any of its dependencies, but leave
alone Rails and its dependencies.
-1mOVERLAPPING DEPENDENCIES0m
- Sometimes, multiple gems declared in your Gemfile(5) are satisfied by
- the same second-level dependency. For instance, consider the case of
- 1mthin 22mand 1mrack-perftools-profiler22m.
+OVERLAPPING DEPENDENCIES
+ Sometimes, multiple gems declared in your Gemfile(5) are satisfied by
+ the same second-level dependency. For instance, consider the case of
+ thin and rack-perftools-profiler.
@@ -182,8 +181,8 @@ BUNDLE-UPDATE(1) BUNDLE-UPDATE(1)
- The 1mthin 22mgem depends on 1mrack >= 1.022m, while 1mrack-perftools-profiler 22mde-
- pends on 1mrack ~> 1.022m. If you run bundle install, you get:
+ The thin gem depends on rack >= 1.0, while rack-perftools-profiler
+ depends on rack ~> 1.0. If you run bundle install, you get:
@@ -200,86 +199,86 @@ BUNDLE-UPDATE(1) BUNDLE-UPDATE(1)
In this case, the two gems have their own set of dependencies, but they
- share 1mrack 22min common. If you run 1mbundle update thin22m, bundler will up-
- date 1mdaemons22m, 1meventmachine 22mand 1mrack22m, which are dependencies of 1mthin22m,
- but not 1mopen4 22mor 1mperftools.rb22m, which are dependencies of
- 1mrack-perftools_profiler22m. Note that 1mbundle update thin 22mwill update 1mrack0m
- even though it's 4malso24m a dependency of 1mrack-perftools_profiler22m.
-
- In short, by default, when you update a gem using 1mbundle update22m,
- bundler will update all dependencies of that gem, including those that
+ 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
+ rack-perftools_profiler. Note that bundle update thin will update rack
+ even though it's also a dependency of rack-perftools_profiler.
+
+ In short, by default, when you update a gem using bundle update,
+ bundler will update all dependencies of that gem, including those that
are also dependencies of another gem.
To prevent updating shared dependencies, prior to version 1.14 the only
- option was the 1mCONSERVATIVE UPDATING 22mbehavior in bundle install(1) 4mbun-0m
- 4mdle-install.1.html24m:
+ option was the CONSERVATIVE UPDATING behavior in bundle install(1) bun-
+ dle-install.1.html:
- In this scenario, updating the 1mthin 22mversion manually in the Gemfile(5),
- and then running bundle install(1) 4mbundle-install.1.html24m will only up-
- date 1mdaemons 22mand 1meventmachine22m, but not 1mrack22m. For more information, see
- the 1mCONSERVATIVE UPDATING 22msection of bundle install(1) 4mbundle-in-0m
- 4mstall.1.html24m.
+ 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.
- Starting with 1.14, specifying the 1m--conservative 22moption will also pre-
+ Starting with 1.14, specifying the --conservative option will also pre-
vent shared dependencies from being updated.
-1mPATCH LEVEL OPTIONS0m
- Version 1.14 introduced 4 patch-level options that will influence how
- gem versions are resolved. One of the following options can be used:
- 1m--patch22m, 1m--minor 22mor 1m--major22m. 1m--strict 22mcan be added to further influence
+PATCH LEVEL OPTIONS
+ 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.
- 1m--patch0m
+ --patch
Prefer updating only to next patch version.
- 1m--minor0m
+ --minor
Prefer updating only to next minor version.
- 1m--major0m
+ --major
Prefer updating to next major version (default).
- 1m--strict0m
- Do not allow any gem to be updated past latest 1m--patch 22m| 1m--minor0m
- | 1m--major22m.
+ --strict
+ Do not allow any gem to be updated past latest --patch | --minor
+ | --major.
- When Bundler is resolving what versions to use to satisfy declared re-
- quirements 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.
+ 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.
- Providing one of the patch level options (e.g. 1m--patch22m) changes the
- sort order of the satisfying versions, causing Bundler to consider the
- latest 1m--patch 22mor 1m--minor 22mversion available before other versions. Note
+ 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
- all exist, the default order of preference by default (1m--major22m) will be
+ 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
+ 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 1m--patch 22moption 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 1m--minor 22moption is used, the order of preference will change to
+ 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 1m--strict 22moption with any of the patch level options will
- remove any versions beyond the scope of the patch level option, to en-
- sure that no gem is updated that far.
+ Combining the --strict option with any of the patch level options will
+ 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 1m--patch 22mand 1m--strict 22moptions
+ 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 1m--minor 22mand 1m--strict 22mare 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 de-
- termining factor for what versions are available. If the gem require-
- ment for 1mfoo 22min the Gemfile is '~> 1.0', that will accomplish the same
- thing as providing the 1m--minor 22mand 1m--strict 22moptions.
+ 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.
-1mPATCH LEVEL EXAMPLES0m
+PATCH LEVEL EXAMPLES
Given the following gem specifications:
@@ -325,11 +324,11 @@ BUNDLE-UPDATE(1) BUNDLE-UPDATE(1)
- In case 1, bar is upgraded to 2.1.1, a minor version increase, because
+ In case 1, bar is upgraded to 2.1.1, a minor version increase, because
the dependency from foo 1.4.5 required it.
- In case 2, only foo is requested to be unlocked, but bar is also al-
- lowed to move because it's not a declared dependency in the Gemfile.
+ In case 2, only foo is requested to be unlocked, but bar is also
+ allowed to move because it's not a declared dependency in the Gemfile.
In case 3, bar goes up a whole major release, because a minor increase
is preferred now for foo, and when it goes to 1.5.1, it requires 3.0.0
@@ -343,7 +342,7 @@ BUNDLE-UPDATE(1) BUNDLE-UPDATE(1)
from consideration because of the --strict flag, so the most they can
move is up to 1.4.4 and 2.0.4.
-1mRECOMMENDED WORKFLOW0m
+RECOMMENDED WORKFLOW
In general, when working with an application managed with bundler, you
should use the following workflow:
@@ -351,7 +350,7 @@ BUNDLE-UPDATE(1) BUNDLE-UPDATE(1)
$ bundle install
- o Check the resulting 1mGemfile.lock 22minto version control
+ o Check the resulting Gemfile.lock into version control
$ git add Gemfile.lock
@@ -369,11 +368,11 @@ BUNDLE-UPDATE(1) BUNDLE-UPDATE(1)
$ bundle install
- o Make sure to check the updated 1mGemfile.lock 22minto version control
+ o Make sure to check the updated Gemfile.lock into version control
$ git add Gemfile.lock
- o If bundle install(1) 4mbundle-install.1.html24m reports a conflict, man-
+ 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)
$ bundle update rails thin
@@ -388,4 +387,4 @@ BUNDLE-UPDATE(1) BUNDLE-UPDATE(1)
- January 2019 BUNDLE-UPDATE(1)
+ April 2019 BUNDLE-UPDATE(1)
diff --git a/man/bundle-update.ronn b/man/bundle-update.ronn
index 481bb5b14e..397fecadcb 100644
--- a/man/bundle-update.ronn
+++ b/man/bundle-update.ronn
@@ -12,8 +12,8 @@ bundle-update(1) -- Update your gems to the latest available versions
[--full-index]
[--jobs=JOBS]
[--quiet]
- [--force]
[--patch|--minor|--major]
+ [--redownload]
[--strict]
[--conservative]
@@ -64,8 +64,8 @@ gem.
* `--quiet`:
Only output warnings and errors.
-* `--force`:
- Force downloading every gem. `--redownload` is an alias of this option.
+* `--redownload`:
+ Force downloading every gem.
* `--patch`:
Prefer updating only to next patch version.
diff --git a/man/bundle-viz.1 b/man/bundle-viz.1
index 70ad6835ee..3f4441f29f 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" "November 2018" "" ""
+.TH "BUNDLE\-VIZ" "1" "March 2019" "" ""
.
.SH "NAME"
\fBbundle\-viz\fR \- Generates a visual dependency graph for your Gemfile
diff --git a/man/bundle-viz.1.txt b/man/bundle-viz.1.txt
index ada88d89c6..045e837362 100644
--- a/man/bundle-viz.1.txt
+++ b/man/bundle-viz.1.txt
@@ -2,38 +2,38 @@ BUNDLE-VIZ(1) BUNDLE-VIZ(1)
-1mNAME0m
- 1mbundle-viz 22m- Generates a visual dependency graph for your Gemfile
+NAME
+ bundle-viz - Generates a visual dependency graph for your Gemfile
-1mSYNOPSIS0m
- 1mbundle viz 22m[--file=FILE] [--format=FORMAT] [--requirements] [--version]
+SYNOPSIS
+ bundle viz [--file=FILE] [--format=FORMAT] [--requirements] [--version]
[--without=GROUP GROUP]
-1mDESCRIPTION0m
- 1mviz 22mgenerates a PNG file of the current 1mGemfile(5) 22mas a dependency
- graph. 1mviz 22mrequires the ruby-graphviz gem (and its dependencies).
+DESCRIPTION
+ 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 1mbundle install(1) 4m22mbun-0m
- 4mdle-install.1.html24m.
+ The associated gems must also be installed via bundle install(1) bun-
+ dle-install.1.html.
-1mOPTIONS0m
- 1m--file22m, 1m-f0m
- The name to use for the generated file. See 1m--format 22moption
+OPTIONS
+ --file, -f
+ The name to use for the generated file. See --format option
- 1m--format22m, 1m-F0m
+ --format, -F
This is output format option. Supported format is png, jpg, svg,
dot ...
- 1m--requirements22m, 1m-R0m
+ --requirements, -R
Set to show the version of each required dependency.
- 1m--version22m, 1m-v0m
+ --version, -v
Set to show each gem version.
- 1m--without22m, 1m-W0m
+ --without, -W
Exclude gems that are part of the specified named group.
- November 2018 BUNDLE-VIZ(1)
+ March 2019 BUNDLE-VIZ(1)
diff --git a/man/bundle.1 b/man/bundle.1
index cc777c9aab..81226d9339 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 2019" "" ""
+.TH "BUNDLE" "1" "April 2019" "" ""
.
.SH "NAME"
\fBbundle\fR \- Ruby Dependency Management
@@ -13,7 +13,7 @@
Bundler manages an \fBapplication\'s dependencies\fR through its entire life across many machines systematically and repeatably\.
.
.P
-See the bundler website \fIhttp://bundler\.io\fR for information on getting started, and Gemfile(5) for more information on the \fBGemfile\fR format\.
+See the bundler website \fIhttps://bundler\.io\fR for information on getting started, and Gemfile(5) for more information on the \fBGemfile\fR format\.
.
.SH "OPTIONS"
.
diff --git a/man/bundle.1.txt b/man/bundle.1.txt
index 751411846f..bbf869d4c5 100644
--- a/man/bundle.1.txt
+++ b/man/bundle.1.txt
@@ -2,115 +2,115 @@ BUNDLE(1) BUNDLE(1)
-1mNAME0m
- 1mbundle 22m- Ruby Dependency Management
+NAME
+ bundle - Ruby Dependency Management
-1mSYNOPSIS0m
- 1mbundle 22mCOMMAND [--no-color] [--verbose] [ARGS]
+SYNOPSIS
+ bundle COMMAND [--no-color] [--verbose] [ARGS]
-1mDESCRIPTION0m
- Bundler manages an 1mapplication's dependencies 22mthrough its entire life
+DESCRIPTION
+ Bundler manages an application's dependencies through its entire life
across many machines systematically and repeatably.
- See the bundler website 4mhttp://bundler.io24m for information on getting
- started, and Gemfile(5) for more information on the 1mGemfile 22mformat.
+ See the bundler website https://bundler.io for information on getting
+ started, and Gemfile(5) for more information on the Gemfile format.
-1mOPTIONS0m
- 1m--no-color0m
+OPTIONS
+ --no-color
Print all output without color
- 1m--retry22m, 1m-r0m
+ --retry, -r
Specify the number of times you wish to attempt network commands
- 1m--verbose22m, 1m-V0m
+ --verbose, -V
Print out additional logging information
-1mBUNDLE COMMANDS0m
- We divide 1mbundle 22msubcommands into primary commands and utilities:
+BUNDLE COMMANDS
+ We divide bundle subcommands into primary commands and utilities:
-1mPRIMARY COMMANDS0m
- 1mbundle install(1) 4m22mbundle-install.1.html0m
- Install the gems specified by the 1mGemfile 22mor 1mGemfile.lock0m
+PRIMARY COMMANDS
+ bundle install(1) bundle-install.1.html
+ Install the gems specified by the Gemfile or Gemfile.lock
- 1mbundle update(1) 4m22mbundle-update.1.html0m
+ bundle update(1) bundle-update.1.html
Update dependencies to their latest versions
- 1mbundle package(1) 4m22mbundle-package.1.html0m
- Package the .gem files required by your application into the
- 1mvendor/cache 22mdirectory
+ bundle package(1) bundle-package.1.html
+ Package the .gem files required by your application into the
+ vendor/cache directory
- 1mbundle exec(1) 4m22mbundle-exec.1.html0m
+ bundle exec(1) bundle-exec.1.html
Execute a script in the current bundle
- 1mbundle config(1) 4m22mbundle-config.1.html0m
+ bundle config(1) bundle-config.1.html
Specify and read configuration options for Bundler
- 1mbundle help(1)0m
+ bundle help(1)
Display detailed help for each subcommand
-1mUTILITIES0m
- 1mbundle add(1) 4m22mbundle-add.1.html0m
- Add the named gem to the Gemfile and run 1mbundle install0m
+UTILITIES
+ bundle add(1) bundle-add.1.html
+ Add the named gem to the Gemfile and run bundle install
- 1mbundle binstubs(1) 4m22mbundle-binstubs.1.html0m
+ bundle binstubs(1) bundle-binstubs.1.html
Generate binstubs for executables in a gem
- 1mbundle check(1) 4m22mbundle-check.1.html0m
- Determine whether the requirements for your application are in-
- stalled and available to Bundler
+ bundle check(1) bundle-check.1.html
+ Determine whether the requirements for your application are
+ installed and available to Bundler
- 1mbundle show(1) 4m22mbundle-show.1.html0m
+ bundle show(1) bundle-show.1.html
Show the source location of a particular gem in the bundle
- 1mbundle outdated(1) 4m22mbundle-outdated.1.html0m
+ bundle outdated(1) bundle-outdated.1.html
Show all of the outdated gems in the current bundle
- 1mbundle console(1)0m
+ bundle console(1)
Start an IRB session in the current bundle
- 1mbundle open(1) 4m22mbundle-open.1.html0m
+ bundle open(1) bundle-open.1.html
Open an installed gem in the editor
- 1mbundle lock(1) 4m22mbundle-lock.1.hmtl0m
+ bundle lock(1) bundle-lock.1.hmtl
Generate a lockfile for your dependencies
- 1mbundle viz(1) 4m22mbundle-viz.1.html0m
+ bundle viz(1) bundle-viz.1.html
Generate a visual representation of your dependencies
- 1mbundle init(1) 4m22mbundle-init.1.html0m
- Generate a simple 1mGemfile22m, placed in the current directory
+ bundle init(1) bundle-init.1.html
+ Generate a simple Gemfile, placed in the current directory
- 1mbundle gem(1) 4m22mbundle-gem.1.html0m
+ bundle gem(1) bundle-gem.1.html
Create a simple gem, suitable for development with Bundler
- 1mbundle platform(1) 4m22mbundle-platform.1.html0m
+ bundle platform(1) bundle-platform.1.html
Display platform compatibility information
- 1mbundle clean(1) 4m22mbundle-clean.1.html0m
+ bundle clean(1) bundle-clean.1.html
Clean up unused gems in your Bundler directory
- 1mbundle doctor(1) 4m22mbundle-doctor.1.html0m
+ bundle doctor(1) bundle-doctor.1.html
Display warnings about common problems
- 1mbundle remove(1) 4m22mbundle-remove.1.html0m
+ bundle remove(1) bundle-remove.1.html
Removes gems from the Gemfile
-1mPLUGINS0m
- 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
- 1mbundler-<command> 22mand execute it, passing down any extra arguments to
+PLUGINS
+ When running a command that isn't listed in PRIMARY COMMANDS or UTILI-
+ TIES, Bundler will try to find an executable on your path named
+ bundler-<command> and execute it, passing down any extra arguments to
it.
-1mOBSOLETE0m
+OBSOLETE
These commands are obsolete and should no longer be used:
- o 1mbundle cache(1)0m
+ o bundle cache(1)
- o 1mbundle show(1)0m
+ o bundle show(1)
- January 2019 BUNDLE(1)
+ April 2019 BUNDLE(1)
diff --git a/man/bundle.ronn b/man/bundle.ronn
index 0005692abd..b8ee4566b4 100644
--- a/man/bundle.ronn
+++ b/man/bundle.ronn
@@ -10,7 +10,7 @@ bundle(1) -- Ruby Dependency Management
Bundler manages an `application's dependencies` through its entire life
across many machines systematically and repeatably.
-See [the bundler website](http://bundler.io) for information on getting
+See [the bundler website](https://bundler.io) for information on getting
started, and Gemfile(5) for more information on the `Gemfile` format.
## OPTIONS
diff --git a/man/gemfile.5 b/man/gemfile.5
index c40ad9c71b..13fa60ee3d 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 2019" "" ""
+.TH "GEMFILE" "5" "April 2019" "" ""
.
.SH "NAME"
\fBGemfile\fR \- A format for describing gem dependencies for Ruby programs
@@ -238,7 +238,7 @@ After running \fBbundle install \-\-without test\fR, bundler will remember that
Also, calling \fBBundler\.setup\fR with no parameters, or calling \fBrequire "bundler/setup"\fR will setup all groups except for the ones you excluded via \fB\-\-without\fR (since they are not available)\.
.
.P
-Note that on \fBbundle install\fR, 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 versions of the same gems in different groups\. For more details, see Understanding Bundler \fIhttp://bundler\.io/rationale\.html\fR\.
+Note that on \fBbundle install\fR, 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 versions of the same gems in different groups\. For more details, see Understanding Bundler \fIhttps://bundler\.io/rationale\.html\fR\.
.
.SS "PLATFORMS"
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 \fB\-\-without\fR install\-time flag to exclude groups of gems for other platforms\.
diff --git a/man/gemfile.5.ronn b/man/gemfile.5.ronn
index c941463edc..9fe4176a30 100644
--- a/man/gemfile.5.ronn
+++ b/man/gemfile.5.ronn
@@ -176,7 +176,7 @@ 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 versions of the same gems in different
-groups. For more details, see [Understanding Bundler](http://bundler.io/rationale.html).
+groups. For more details, see [Understanding Bundler](https://bundler.io/rationale.html).
### PLATFORMS
diff --git a/man/gemfile.5.txt b/man/gemfile.5.txt
index 0a01c045d7..4036072861 100644
--- a/man/gemfile.5.txt
+++ b/man/gemfile.5.txt
@@ -2,24 +2,24 @@ GEMFILE(5) GEMFILE(5)
-1mNAME0m
- 1mGemfile 22m- A format for describing gem dependencies for Ruby programs
+NAME
+ Gemfile - A format for describing gem dependencies for Ruby programs
-1mSYNOPSIS0m
- A 1mGemfile 22mdescribes the gem dependencies required to execute associated
+SYNOPSIS
+ A Gemfile describes the gem dependencies required to execute associated
Ruby code.
- Place the 1mGemfile 22min the root of the directory containing the associ-
- ated code. For instance, in a Rails application, place the 1mGemfile 22min
- the same directory as the 1mRakefile22m.
+ 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.
-1mSYNTAX0m
- A 1mGemfile 22mis evaluated as Ruby code, in a context which makes available
+SYNTAX
+ A Gemfile is evaluated as Ruby code, in a context which makes available
a number of methods used to describe the gem requirements.
-1mGLOBAL SOURCES0m
- At the top of the 1mGemfile22m, add a line for the 1mRubygems 22msource that con-
- tains the gems listed in the 1mGemfile22m.
+GLOBAL SOURCES
+ At the top of the Gemfile, add a line for the Rubygems source that con-
+ tains the gems listed in the Gemfile.
@@ -28,23 +28,23 @@ GEMFILE(5) GEMFILE(5)
It is possible, but not recommended as of Bundler 1.7, to add multiple
- global 1msource 22mlines. Each of these 1msource22ms 1mMUST 22mbe a valid Rubygems
+ global source lines. Each of these sources MUST be a valid Rubygems
repository.
Sources are checked for gems following the heuristics described in
- 4mSOURCE24m 4mPRIORITY24m. If a gem is found in more than one global source,
+ 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 1m:source0m
- option or a 1msource 22mblock.
+ non-standard repository, suppressing this warning, by using the :source
+ option or a source block.
- 1mCREDENTIALS0m
+ CREDENTIALS
Some gem sources require a username and password. Use bundle config(1)
- 4mbundle-config.1.html24m to set the username and password for any of the
+ 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
- that will install the Gemfile, but this keeps the credentials from be-
- ing stored in plain text in version control.
+ that will install the Gemfile, but this keeps the credentials from
+ being stored in plain text in version control.
@@ -62,14 +62,14 @@ GEMFILE(5) GEMFILE(5)
Credentials in the source URL will take precedence over credentials set
- using 1mconfig22m.
+ using config.
-1mRUBY0m
+RUBY
If your application requires a specific Ruby version or engine, specify
- your requirements using the 1mruby 22mmethod, with the following arguments.
- All parameters are 1mOPTIONAL 22munless otherwise specified.
+ your requirements using the ruby method, with the following arguments.
+ All parameters are OPTIONAL unless otherwise specified.
- 1mVERSION (required)0m
+ 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
@@ -81,32 +81,32 @@ GEMFILE(5) GEMFILE(5)
- 1mENGINE0m
- Each application 4mmay24m specify a Ruby engine. If an engine is specified,
- an engine version 4mmust24m also be specified.
+ ENGINE
+ Each application may specify a Ruby engine. If an engine is specified,
+ an engine version must also be specified.
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
- 4mhttps://en.wikipedia.org/wiki/Ruby_MRI24m, or MRI for short. This is
+ 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 4mhttps://www.ruby-lang.org/en/about/24m of Ruby
+ o Other implementations https://www.ruby-lang.org/en/about/ of Ruby
exist. Some of the more well-known implementations include Rubinius
- 4mhttps://rubinius.com/24m, and JRuby 4mhttp://jruby.org/24m. Rubinius is an
- alternative implementation of Ruby written in Ruby. JRuby is an im-
- plementation of Ruby on the JVM, short for Java Virtual Machine.
+ 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.
- 1mENGINE VERSION0m
- Each application 4mmay24m specify a Ruby engine version. If an engine ver-
- sion is specified, an engine 4mmust24m also be specified. If the engine is
- "ruby" the engine version specified 4mmust24m match the Ruby version.
+ 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.
@@ -114,8 +114,8 @@ GEMFILE(5) GEMFILE(5)
- 1mPATCHLEVEL0m
- Each application 4mmay24m specify a Ruby patchlevel.
+ PATCHLEVEL
+ Each application may specify a Ruby patchlevel.
@@ -123,12 +123,12 @@ GEMFILE(5) GEMFILE(5)
-1mGEMS0m
- Specify gem requirements using the 1mgem 22mmethod, with the following argu-
- ments. All parameters are 1mOPTIONAL 22munless otherwise specified.
+GEMS
+ Specify gem requirements using the gem method, with the following argu-
+ ments. All parameters are OPTIONAL unless otherwise specified.
- 1mNAME (required)0m
- For each gem requirement, list a single 4mgem24m line.
+ NAME (required)
+ For each gem requirement, list a single gem line.
@@ -136,8 +136,8 @@ GEMFILE(5) GEMFILE(5)
- 1mVERSION0m
- Each 4mgem24m 1mMAY 22mhave one or more version specifiers.
+ VERSION
+ Each gem MAY have one or more version specifiers.
@@ -146,10 +146,10 @@ GEMFILE(5) GEMFILE(5)
- 1mREQUIRE AS0m
- Each 4mgem24m 1mMAY 22mspecify files that should be used when autorequiring via
- 1mBundler.require22m. You may pass an array with multiple files or 1mtrue 22mif
- file you want 1mrequired 22mhas same name as 4mgem24m or 1mfalse 22mto prevent any
+ 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 from being autorequired.
@@ -160,7 +160,7 @@ GEMFILE(5) GEMFILE(5)
- The argument defaults to the name of the gem. For example, these are
+ The argument defaults to the name of the gem. For example, these are
identical:
@@ -171,9 +171,9 @@ GEMFILE(5) GEMFILE(5)
- 1mGROUPS0m
- Each 4mgem24m 1mMAY 22mspecify membership in one or more groups. Any 4mgem24m that
- does not specify membership in any group is placed in the 1mdefault0m
+ GROUPS
+ Each gem MAY specify membership in one or more groups. Any gem that
+ does not specify membership in any group is placed in the default
group.
@@ -183,8 +183,8 @@ GEMFILE(5) GEMFILE(5)
- The Bundler runtime allows its two main methods, 1mBundler.setup 22mand
- 1mBundler.require22m, to limit their impact to particular groups.
+ The Bundler runtime allows its two main methods, Bundler.setup and
+ Bundler.require, to limit their impact to particular groups.
@@ -203,9 +203,9 @@ GEMFILE(5) GEMFILE(5)
- The Bundler CLI allows you to specify a list of groups whose gems 1mbun-0m
- 1mdle install 22mshould not install with the 1m--without 22moption. To specify
- multiple groups to ignore, specify a list of groups separated by spa-
+ The Bundler CLI allows you to specify a list of groups whose gems bun-
+ dle install should not install with the --without option. To specify
+ multiple groups to ignore, specify a list of groups separated by spa-
ces.
@@ -215,49 +215,49 @@ GEMFILE(5) GEMFILE(5)
- After running 1mbundle install --without test22m, bundler will remember that
+ After running bundle install --without test, bundler will remember that
you excluded the test group in the last installation. The next time you
- run 1mbundle install22m, without any 1m--without option22m, bundler will recall
+ run bundle install, without any --without option, bundler will recall
it.
- Also, calling 1mBundler.setup 22mwith no parameters, or calling 1mrequire0m
- 1m"bundler/setup" 22mwill setup all groups except for the ones you excluded
- via 1m--without 22m(since they are not available).
+ Also, calling Bundler.setup with no parameters, or calling require
+ "bundler/setup" will setup all groups except for the ones you excluded
+ via --without (since they are not available).
- Note that on 1mbundle install22m, 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 Un-
- derstanding Bundler 4mhttp://bundler.io/rationale.html24m.
+ Note that on bundle install, bundler downloads and evaluates all gems,
+ in order to create a single canonical list of all of the required gems
+ and their dependencies. This means that you cannot list different ver-
+ sions of the same gems in different groups. For more details, see
+ Understanding Bundler https://bundler.io/rationale.html.
- 1mPLATFORMS0m
- If a gem should only be used in a particular platform or set of plat-
- forms, you can specify them. Platforms are essentially identical to
- groups, except that you do not need to use the 1m--without 22minstall-time
+ PLATFORMS
+ If a gem should only be used in a particular platform or set of plat-
+ forms, you can specify them. Platforms are essentially identical to
+ groups, except that you do not need to use the --without install-time
flag to exclude groups of gems for other platforms.
- There are a number of 1mGemfile 22mplatforms:
+ There are a number of Gemfile platforms:
- 1mruby 22mC Ruby (MRI), Rubinius or TruffleRuby, but 1mNOT 22mWindows
+ ruby C Ruby (MRI), Rubinius or TruffleRuby, but NOT Windows
- 1mmri 22mSame as 4mruby24m, but only C Ruby (MRI)
+ mri Same as ruby, but only C Ruby (MRI)
- 1mmingw 22mWindows 32 bit 'mingw32' platform (aka RubyInstaller)
+ mingw Windows 32 bit 'mingw32' platform (aka RubyInstaller)
- 1mx64_mingw0m
+ x64_mingw
Windows 64 bit 'mingw32' platform (aka RubyInstaller x64)
- 1mrbx 22mRubinius
+ rbx Rubinius
- 1mjruby 22mJRuby
+ jruby JRuby
- 1mtruffleruby0m
+ truffleruby
TruffleRuby
- 1mmswin 22mWindows
+ mswin Windows
- You can restrict further by platform and version for all platforms 4mex-0m
- 4mcept24m for 1mrbx22m, 1mjruby22m, 1mtruffleruby 22mand 1mmswin22m.
+ 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
@@ -271,13 +271,13 @@ GEMFILE(5) GEMFILE(5)
The full list of platforms and supported versions includes:
- 1mruby 22m1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
+ ruby 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
- 1mmri 22m1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
+ mri 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
- 1mmingw 22m1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
+ mingw 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
- 1mx64_mingw0m
+ x64_mingw
2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
As with groups, you can specify one or more platforms:
@@ -290,12 +290,12 @@ GEMFILE(5) GEMFILE(5)
- All operations involving groups (1mbundle install 4m22mbundle-install.1.html24m,
- 1mBundler.setup22m, 1mBundler.require22m) behave exactly the same as if any
+ All operations involving groups (bundle install bundle-install.1.html,
+ Bundler.setup, Bundler.require) behave exactly the same as if any
groups not matching the current platform were explicitly excluded.
- 1mSOURCE0m
- You can select an alternate Rubygems repository for a gem using the
+ SOURCE
+ You can select an alternate Rubygems repository for a gem using the
':source' option.
@@ -304,60 +304,60 @@ GEMFILE(5) GEMFILE(5)
- This forces the gem to be loaded from this source and ignores any
- global sources declared at the top level of the file. If the gem does
+ This forces the gem to be loaded from this source and ignores any
+ global sources declared at the top level of the file. If the gem does
not exist in this source, it will not be installed.
Bundler will search for child dependencies of this gem by first looking
in the source selected for the parent, but if they are not found there,
- it will fall back on global sources using the ordering described in
- 4mSOURCE24m 4mPRIORITY24m.
+ it will fall back on global sources using the ordering described in
+ SOURCE PRIORITY.
- Selecting a specific source repository this way also suppresses the am-
- biguous gem warning described above in 4mGLOBAL24m 4mSOURCES24m 4m(#source)24m.
+ Selecting a specific source repository this way also suppresses the
+ ambiguous gem warning described above in GLOBAL SOURCES (#source).
- Using the 1m:source 22moption for an individual gem will also make that
- source available as a possible global source for any other gems which
- do not specify explicit sources. Thus, when adding gems with explicit
- sources, it is recommended that you also ensure all other gems in the
+ Using the :source option for an individual gem will also make that
+ source available as a possible global source for any other gems which
+ do not specify explicit sources. Thus, when adding gems with explicit
+ sources, it is recommended that you also ensure all other gems in the
Gemfile are using explicit sources.
- 1mGIT0m
+ GIT
If necessary, you can specify that a gem is located at a particular git
- repository using the 1m:git 22mparameter. The repository can be accessed via
+ repository using the :git parameter. The repository can be accessed via
several protocols:
- 1mHTTP(S)0m
+ HTTP(S)
gem "rails", :git => "https://github.com/rails/rails.git"
- 1mSSH 22mgem "rails", :git => "git@github.com:rails/rails.git"
+ SSH gem "rails", :git => "git@github.com:rails/rails.git"
- 1mgit 22mgem "rails", :git => "git://github.com/rails/rails.git"
+ git gem "rails", :git => "git://github.com/rails/rails.git"
- If using SSH, the user that you use to run 1mbundle install MUST 22mhave the
- appropriate keys available in their 1m$HOME/.ssh22m.
+ If using SSH, the user that you use to run bundle install MUST have the
+ appropriate keys available in their $HOME/.ssh.
- 1mNOTE22m: 1mhttp:// 22mand 1mgit:// 22mURLs should be avoided if at all possible.
- These protocols are unauthenticated, so a man-in-the-middle attacker
- can deliver malicious code and compromise your system. HTTPS and SSH
+ NOTE: http:// and git:// URLs should be avoided if at all possible.
+ These protocols are unauthenticated, so a man-in-the-middle attacker
+ can deliver malicious code and compromise your system. HTTPS and SSH
are strongly preferred.
- The 1mgroup22m, 1mplatforms22m, and 1mrequire 22moptions are available and behave ex-
- actly the same as they would for a normal gem.
+ The group, platforms, and require options are available and behave
+ exactly the same as they would for a normal gem.
- A git repository 1mSHOULD 22mhave at least one file, at the root of the di-
- rectory containing the gem, with the extension 1m.gemspec22m. This file 1mMUST0m
- contain a valid gem specification, as expected by the 1mgem build 22mcom-
- mand.
+ 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 1m.gemspec22m, bundler will attempt to
+ If a git repository does not have a .gemspec, bundler will attempt to
create one, but it will not contain any dependencies, executables, or C
- extension compilation instructions. As a result, it may fail to prop-
+ extension compilation instructions. As a result, it may fail to prop-
erly integrate into your application.
- If a git repository does have a 1m.gemspec 22mfor the gem you attached it
- to, a version specifier, if provided, means that the git repository is
- only valid if the 1m.gemspec 22mspecifies a version matching the version
+ If a git repository does have a .gemspec for the gem you attached it
+ to, a version specifier, if provided, means that the git repository is
+ only valid if the .gemspec specifies a version matching the version
specifier. If not, bundler will print a warning.
@@ -368,35 +368,35 @@ GEMFILE(5) GEMFILE(5)
- If a git repository does 1mnot 22mhave a 1m.gemspec 22mfor the gem you attached
- it to, a version specifier 1mMUST 22mbe provided. Bundler will use this ver-
- sion in the simple 1m.gemspec 22mit creates.
+ If a git repository does not have a .gemspec for the gem you attached
+ it to, a version specifier MUST be provided. Bundler will use this ver-
+ sion in the simple .gemspec it creates.
Git repositories support a number of additional options.
- 1mbranch22m, 1mtag22m, and 1mref0m
- You 1mMUST 22monly specify at most one of these options. The default
- is 1m:branch => "master"0m
+ branch, tag, and ref
+ You MUST only specify at most one of these options. The default
+ is :branch => "master"
For example:
- git "https://github.com/rails/rails.git", :branch => "5-0-sta-
+ git "https://github.com/rails/rails.git", :branch => "5-0-sta-
ble" do
git "https://github.com/rails/rails.git", :tag => "v5.0.0" do
git "https://github.com/rails/rails.git", :ref => "4aded" do
- 1msubmodules0m
- For reference, a git submodule
- 4mhttps://git-scm.com/book/en/v2/Git-Tools-Submodules24m lets you
- have another git repository within a subfolder of your reposi-
- tory. Specify 1m:submodules => true 22mto cause bundler to expand any
+ 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
- If a git repository contains multiple 1m.gemspecs22m, each 1m.gemspec 22mrepre-
- sents a gem located at the same place in the file system as the 1m.gem-0m
- 1mspec22m.
+ 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.
@@ -410,17 +410,17 @@ GEMFILE(5) GEMFILE(5)
- To install a gem located in a git repository, bundler changes to the
- directory containing the gemspec, runs 1mgem build name.gemspec 22mand then
- installs the resulting gem. The 1mgem build 22mcommand, which comes standard
- with Rubygems, evaluates the 1m.gemspec 22min the context of the directory
+ 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
in which it is located.
- 1mGIT SOURCE0m
- A custom git source can be defined via the 1mgit_source 22mmethod. 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 ad-
- dress:
+ 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
+ address:
@@ -437,15 +437,15 @@ GEMFILE(5) GEMFILE(5)
- 1mGITHUB0m
- 1mNOTE22m: This shorthand should be avoided until Bundler 2.0, since it cur-
- rently expands to an insecure 1mgit:// 22mURL. This allows a man-in-the-mid-
+ 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.
- If the git repository you want to use is hosted on GitHub and is pub-
- lic, you can use the :github shorthand to specify the github username
- and repository name (without the trailing ".git"), separated by a
- slash. If both the username and repository name are the same, you can
+ If the git repository you want to use is hosted on GitHub and is pub-
+ lic, you can use the :github shorthand to specify the github username
+ and repository name (without the trailing ".git"), separated by a
+ slash. If both the username and repository name are the same, you can
omit one.
@@ -463,12 +463,12 @@ GEMFILE(5) GEMFILE(5)
- Since the 1mgithub 22mmethod is a specialization of 1mgit_source22m, it accepts a
- 1m:branch 22mnamed argument.
+ Since the github method is a specialization of git_source, it accepts a
+ :branch named argument.
- 1mGIST0m
+ GIST
If the git repository you want to use is hosted as a Github Gist and is
- public, you can use the :gist shorthand to specify the gist identifier
+ public, you can use the :gist shorthand to specify the gist identifier
(without the trailing ".git").
@@ -485,14 +485,14 @@ GEMFILE(5) GEMFILE(5)
- Since the 1mgist 22mmethod is a specialization of 1mgit_source22m, it accepts a
- 1m:branch 22mnamed argument.
+ Since the gist method is a specialization of git_source, it accepts a
+ :branch named argument.
- 1mBITBUCKET0m
- 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
+ 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.
@@ -510,19 +510,19 @@ GEMFILE(5) GEMFILE(5)
- Since the 1mbitbucket 22mmethod is a specialization of 1mgit_source22m, it ac-
- cepts a 1m:branch 22mnamed argument.
+ Since the bitbucket method is a specialization of git_source, it
+ accepts a :branch named argument.
- 1mPATH0m
- You can specify that a gem is located in a particular location on the
+ 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 1mGemfile22m.
+ taining the Gemfile.
- Similar to the semantics of the 1m:git 22moption, the 1m:path 22moption requires
- that the directory in question either contains a 1m.gemspec 22mfor the gem,
+ Similar to the semantics of the :git option, the :path option requires
+ that the directory in question either contains a .gemspec for the gem,
or that you specify an explicit version that bundler should use.
- Unlike 1m:git22m, bundler does not compile C extensions for gems specified
+ Unlike :git, bundler does not compile C extensions for gems specified
as paths.
@@ -532,8 +532,8 @@ GEMFILE(5) GEMFILE(5)
If you would like to use multiple local gems directly from the filesys-
- tem, you can set a global 1mpath 22moption to the path containing the gem's
- files. This will automatically load gemspec files from subdirectories.
+ tem, you can set a global path option to the path containing the gem's
+ files. This will automatically load gemspec files from subdirectories.
@@ -544,8 +544,8 @@ GEMFILE(5) GEMFILE(5)
-1mBLOCK FORM OF SOURCE, GIT, PATH, GROUP and PLATFORMS0m
- The 1m:source22m, 1m:git22m, 1m:path22m, 1m:group22m, and 1m:platforms 22moptions may be applied
+BLOCK FORM OF SOURCE, GIT, PATH, GROUP and PLATFORMS
+ The :source, :git, :path, :group, and :platforms options may be applied
to a group of gems by using block form.
@@ -573,22 +573,22 @@ GEMFILE(5) GEMFILE(5)
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 1m--with 22mop-
- tion given to the 1mbundle install 22mcommand.
+ to prevent a group from being installed unless listed in the --with
+ option given to the bundle install command.
- In the case of the 1mgit 22mblock form, the 1m:ref22m, 1m:branch22m, 1m:tag22m, and 1m:sub-0m
- 1mmodules 22moptions may be passed to the 1mgit 22mmethod, and all gems in the
+ 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.
- The presence of a 1msource 22mblock in a Gemfile also makes that source
+ 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 1m:source 22mdirectives on in-
- dividual gems.
+ explicit sources, either via source blocks or :source directives on
+ individual gems.
-1mINSTALL_IF0m
- The 1minstall_if 22mmethod allows gems to be installed based on a proc or
+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
used if certain software is installed or some other conditions are met.
@@ -600,54 +600,54 @@ GEMFILE(5) GEMFILE(5)
-1mGEMSPEC0m
- The 1m.gemspec 4m22mhttp://guides.rubygems.org/specification-reference/24m file
+GEMSPEC
+ 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 1mgemspec 22mmethod to pull in the dependen-
- cies listed in the 1m.gemspec 22mfile.
-
- The 1mgemspec 22mmethod adds any runtime dependencies as gem requirements in
- the default group. It also adds development dependencies as gem re-
- quirements in the 1mdevelopment 22mgroup. Finally, it adds a gem requirement
- on your project (1m:path => '.'22m). In conjunction with 1mBundler.setup22m, 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 1mgemspec 22mmethod supports optional 1m:path22m, 1m:glob22m, 1m:name22m, and 1m:develop-0m
- 1mment_group 22moptions, which control where bundler looks for the 1m.gemspec22m,
- the glob it uses to look for the gemspec (defaults to: "{,4m,24m/*}.gem-
- spec"), what named 1m.gemspec 22mit uses (if more than one is present), and
+ it is being developed, use the gemspec method to pull in the dependen-
+ cies listed in the .gemspec file.
+
+ The gemspec method adds any runtime dependencies as gem requirements in
+ the default group. It also adds development dependencies as gem
+ requirements in the development group. Finally, it adds a gem require-
+ 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 1mgemspec 22mdependency 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 1mgemspec 22mgem.
+ 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.
-1mSOURCE PRIORITY0m
- When attempting to locate a gem to satisfy a gem requirement, bundler
+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 1m:source22m, 1m:path22m, or
- 1m:git22m)
+ 1. The source explicitly attached to the gem (using :source, :path, or
+ :git)
2. For implicit gems (dependencies of explicit gems), any source, git,
- or path repository declared on the parent. This results in bundler
- prioritizing the ActiveSupport gem from the Rails git repository
- over ones from 1mrubygems.org0m
+ 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 1msource 22mlines, searching each
- source in your 1mGemfile 22mfrom last added to first added.
+ 3. The sources specified via global source lines, searching each
+ source in your Gemfile from last added to first added.
- January 2019 GEMFILE(5)
+ April 2019 GEMFILE(5)
diff --git a/spec/bundler/bundler/bundler_spec.rb b/spec/bundler/bundler/bundler_spec.rb
index 194d6752b2..e33c8dc606 100644
--- a/spec/bundler/bundler/bundler_spec.rb
+++ b/spec/bundler/bundler/bundler_spec.rb
@@ -1,4 +1,3 @@
-# encoding: utf-8
# frozen_string_literal: true
require "bundler"
@@ -313,10 +312,9 @@ EOF
let(:bundle_path) { Pathname("#{tmpdir}/bundle") }
def clear_cached_requires_sudo
- # Private in ruby 1.8.7
return unless Bundler.instance_variable_defined?(:@requires_sudo_ran)
- Bundler.send(:remove_instance_variable, :@requires_sudo_ran)
- Bundler.send(:remove_instance_variable, :@requires_sudo)
+ Bundler.remove_instance_variable(:@requires_sudo_ran)
+ Bundler.remove_instance_variable(:@requires_sudo)
end
before do
@@ -383,14 +381,8 @@ EOF
after do
FileUtils.rm_rf("tmp/vendor/bundle")
FileUtils.rm_rf("tmp/vendor/bin_dir")
- if Bundler.respond_to?(:remove_instance_variable)
- Bundler.remove_instance_variable(:@requires_sudo_ran)
- Bundler.remove_instance_variable(:@requires_sudo)
- else
- # TODO: Remove these code when Bundler drops Ruby 1.8.7 support
- Bundler.send(:remove_instance_variable, :@requires_sudo_ran)
- Bundler.send(:remove_instance_variable, :@requires_sudo)
- end
+ Bundler.remove_instance_variable(:@requires_sudo_ran)
+ Bundler.remove_instance_variable(:@requires_sudo)
end
context "writable paths" do
it "should return false and display nothing" do
diff --git a/spec/bundler/bundler/cli_spec.rb b/spec/bundler/bundler/cli_spec.rb
index 9a2591ac96..6a505358d1 100644
--- a/spec/bundler/bundler/cli_spec.rb
+++ b/spec/bundler/bundler/cli_spec.rb
@@ -60,11 +60,11 @@ RSpec.describe "bundle executable" do
G
bundle :install, :env => { "RUBYGEMS_GEMDEPS" => "foo" }
- expect(out).to include("RUBYGEMS_GEMDEPS")
- expect(out).to include("conflict with Bundler")
+ expect(err).to include("RUBYGEMS_GEMDEPS")
+ expect(err).to include("conflict with Bundler")
bundle :install, :env => { "RUBYGEMS_GEMDEPS" => "" }
- expect(out).not_to include("RUBYGEMS_GEMDEPS")
+ expect(err).not_to include("RUBYGEMS_GEMDEPS")
end
end
@@ -97,7 +97,7 @@ RSpec.describe "bundle executable" do
let(:bundler_version) { "1.1" }
let(:latest_version) { nil }
before do
- bundle! "config --global disable_version_check false"
+ bundle! "config set --global disable_version_check false"
simulate_bundler_version(bundler_version)
if latest_version
@@ -132,13 +132,13 @@ To install the latest version, run `gem install bundler`
end
context "and disable_version_check is set" do
- before { bundle! "config disable_version_check true" }
+ before { bundle! "config set disable_version_check true" }
include_examples "no warning"
end
context "running a parseable command" do
it "prints no warning" do
- bundle! "config --parseable foo"
+ bundle! "config get --parseable foo"
expect(last_command.stdboth).to eq ""
bundle "platform --ruby"
diff --git a/spec/bundler/bundler/definition_spec.rb b/spec/bundler/bundler/definition_spec.rb
index a27c5b0a54..f048728a9f 100644
--- a/spec/bundler/bundler/definition_spec.rb
+++ b/spec/bundler/bundler/definition_spec.rb
@@ -88,17 +88,17 @@ RSpec.describe Bundler::Definition do
expect(out).to match(/re-resolving dependencies/)
lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
PATH
remote: #{lib_path("foo")}
specs:
foo (1.0)
rack (= 1.0)
+ GEM
+ remote: file://localhost#{gem_repo1}/
+ specs:
+ rack (1.0.0)
+
PLATFORMS
#{lockfile_platforms}
@@ -110,7 +110,7 @@ RSpec.describe Bundler::Definition do
G
end
- it "for a path gem with deps and no changes", :bundler => "< 3" do
+ it "for a path gem with deps and no changes" do
build_lib "foo", "1.0", :path => lib_path("foo") do |s|
s.add_dependency "rack", "1.0"
s.add_development_dependency "net-ssh", "1.0"
@@ -137,43 +137,6 @@ RSpec.describe Bundler::Definition do
rack (1.0.0)
PLATFORMS
- ruby
-
- DEPENDENCIES
- foo!
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "for a path gem with deps and no changes", :bundler => "3" do
- build_lib "foo", "1.0", :path => lib_path("foo") do |s|
- s.add_dependency "rack", "1.0"
- s.add_development_dependency "net-ssh", "1.0"
- end
-
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
- gem "foo", :path => "#{lib_path("foo")}"
- G
-
- bundle :check, :env => { "DEBUG" => 1 }
-
- expect(out).to match(/using resolution from the lockfile/)
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PATH
- remote: #{lib_path("foo")}
- specs:
- foo (1.0)
- rack (= 1.0)
-
- PLATFORMS
#{lockfile_platforms}
DEPENDENCIES
diff --git a/spec/bundler/bundler/dsl_spec.rb b/spec/bundler/bundler/dsl_spec.rb
index d6bd9ad0a0..a17bfd4938 100644
--- a/spec/bundler/bundler/dsl_spec.rb
+++ b/spec/bundler/bundler/dsl_spec.rb
@@ -27,25 +27,58 @@ RSpec.describe Bundler::Dsl do
context "github_https feature flag" do
it "is true when github.https is true" do
- bundle "config github.https true"
- expect(Bundler.feature_flag.github_https?).to eq "true"
+ bundle "config set github.https true"
+ expect(Bundler.feature_flag.github_https?).to eq true
end
end
- context "default hosts (git, gist)", :bundler => "< 3" do
- context "when github.https config is true" do
- before { bundle "config github.https true" }
- it "converts :github to :git using https" do
- subject.gem("sparks", :github => "indirect/sparks")
- github_uri = "https://github.com/indirect/sparks.git"
+ shared_examples_for "the github DSL" do |protocol|
+ context "when full repo is used" do
+ let(:repo) { "indirect/sparks" }
+
+ it "converts :github to URI using #{protocol}" do
+ subject.gem("sparks", :github => repo)
+ github_uri = "#{protocol}://github.com/#{repo}.git"
expect(subject.dependencies.first.source.uri).to eq(github_uri)
end
end
- it "converts :github to :git" do
- subject.gem("sparks", :github => "indirect/sparks")
- github_uri = "git://github.com/indirect/sparks.git"
- expect(subject.dependencies.first.source.uri).to eq(github_uri)
+ context "when shortcut repo is used" do
+ let(:repo) { "rails" }
+
+ it "converts :github to URI using #{protocol}" do
+ subject.gem("sparks", :github => repo)
+ github_uri = "#{protocol}://github.com/#{repo}/#{repo}.git"
+ expect(subject.dependencies.first.source.uri).to eq(github_uri)
+ end
+ end
+ end
+
+ context "default hosts (git, gist)" do
+ context "when github.https config is true" do
+ before { bundle "config set github.https true" }
+
+ it_behaves_like "the github DSL", "https"
+ end
+
+ context "when github.https config is false", :bundler => "2" do
+ before { bundle "config set github.https false" }
+
+ it_behaves_like "the github DSL", "git"
+ end
+
+ context "when github.https config is false", :bundler => "3" do
+ before { bundle "config set github.https false" }
+
+ pending "should show a proper message about the removed setting"
+ end
+
+ context "by default", :bundler => "2" do
+ it_behaves_like "the github DSL", "https"
+ end
+
+ context "by default", :bundler => "3" do
+ it_behaves_like "the github DSL", "https"
end
it "converts numeric :gist to :git" do
@@ -60,12 +93,6 @@ RSpec.describe Bundler::Dsl do
expect(subject.dependencies.first.source.uri).to eq(github_uri)
end
- it "converts 'rails' to 'rails/rails'" do
- subject.gem("rails", :github => "rails")
- github_uri = "git://github.com/rails/rails.git"
- expect(subject.dependencies.first.source.uri).to eq(github_uri)
- end
-
it "converts :bitbucket to :git" do
subject.gem("not-really-a-gem", :bitbucket => "mcorp/flatlab-rails")
bitbucket_uri = "https://mcorp@bitbucket.org/mcorp/flatlab-rails.git"
@@ -79,7 +106,7 @@ RSpec.describe Bundler::Dsl do
end
end
- context "default git sources", :bundler => "3" do
+ context "default git sources", :bundler => "4" do
it "has none" do
expect(subject.instance_variable_get(:@git_sources)).to eq({})
end
@@ -253,13 +280,39 @@ RSpec.describe Bundler::Dsl do
end
subject.dependencies.each do |d|
- expect(d.source.uri).to eq("git://github.com/spree/spree.git")
+ expect(d.source.uri).to eq("https://github.com/spree/spree.git")
end
end
end
describe "#github", :bundler => "3" do
it "from github" do
+ spree_gems = %w[spree_core spree_api spree_backend]
+ subject.github "spree" do
+ spree_gems.each {|spree_gem| subject.send :gem, spree_gem }
+ end
+
+ subject.dependencies.each do |d|
+ expect(d.source.uri).to eq("https://github.com/spree/spree.git")
+ end
+ end
+ end
+
+ describe "#github", :bundler => "3" do
+ it "from github" do
+ spree_gems = %w[spree_core spree_api spree_backend]
+ subject.github "spree" do
+ spree_gems.each {|spree_gem| subject.send :gem, spree_gem }
+ end
+
+ subject.dependencies.each do |d|
+ expect(d.source.uri).to eq("https://github.com/spree/spree.git")
+ end
+ end
+ end
+
+ describe "#github", :bundler => "4" do
+ it "from github" do
expect do
spree_gems = %w[spree_core spree_api spree_backend]
subject.github "spree" do
@@ -272,7 +325,6 @@ RSpec.describe Bundler::Dsl do
describe "syntax errors" do
it "will raise a Bundler::GemfileError" do
- skip "this is failing with ruby 2.7 after r67226. consider merging https://github.com/bundler/bundler/pull/7038 or fixing this test."
gemfile "gem 'foo', :path => /unquoted/string/syntax/error"
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./)
diff --git a/spec/bundler/bundler/fetcher/compact_index_spec.rb b/spec/bundler/bundler/fetcher/compact_index_spec.rb
index e0f58766ea..5a2d22193a 100644
--- a/spec/bundler/bundler/fetcher/compact_index_spec.rb
+++ b/spec/bundler/bundler/fetcher/compact_index_spec.rb
@@ -44,7 +44,7 @@ RSpec.describe Bundler::Fetcher::CompactIndex do
end
end
- context "when OpenSSL is FIPS-enabled", :ruby => ">= 2.0.0" do
+ context "when OpenSSL is FIPS-enabled" do
def remove_cached_md5_availability
return unless Bundler::SharedHelpers.instance_variable_defined?(:@md5_available)
Bundler::SharedHelpers.remove_instance_variable(:@md5_available)
diff --git a/spec/bundler/bundler/fetcher/downloader_spec.rb b/spec/bundler/bundler/fetcher/downloader_spec.rb
index c9b4fa662a..07b507266b 100644
--- a/spec/bundler/bundler/fetcher/downloader_spec.rb
+++ b/spec/bundler/bundler/fetcher/downloader_spec.rb
@@ -88,7 +88,17 @@ RSpec.describe Bundler::Fetcher::Downloader do
let(:http_response) { Net::HTTPNotFound.new("1.1", 404, "Not Found") }
it "should raise a Bundler::Fetcher::FallbackError with Net::HTTPNotFound" do
- expect { subject.fetch(uri, options, counter) }.to raise_error(Bundler::Fetcher::FallbackError, "Net::HTTPNotFound")
+ expect { subject.fetch(uri, options, counter) }.
+ to raise_error(Bundler::Fetcher::FallbackError, "Net::HTTPNotFound: http://www.uri-to-fetch.com/api/v2/endpoint")
+ end
+
+ context "when the there are credentials provided in the request" do
+ let(:uri) { URI("http://username:password@www.uri-to-fetch.com/api/v2/endpoint") }
+
+ it "should raise a Bundler::Fetcher::FallbackError that doesn't contain the password" do
+ expect { subject.fetch(uri, options, counter) }.
+ to raise_error(Bundler::Fetcher::FallbackError, "Net::HTTPNotFound: http://username@www.uri-to-fetch.com/api/v2/endpoint")
+ end
end
end
diff --git a/spec/bundler/bundler/friendly_errors_spec.rb b/spec/bundler/bundler/friendly_errors_spec.rb
index 2a1be491ef..4ca1e543c1 100644
--- a/spec/bundler/bundler/friendly_errors_spec.rb
+++ b/spec/bundler/bundler/friendly_errors_spec.rb
@@ -16,22 +16,7 @@ RSpec.describe Bundler, "friendly errors" do
FileUtils.rm(Gem.configuration.config_file_name)
end
- it "reports a relevant friendly error message", :ruby => ">= 1.9", :rubygems => "< 2.5.0" do
- gemfile <<-G
- source "file://#{gem_repo1}"
- gem "rack"
- G
-
- bundle :install, :env => { "DEBUG" => true }
-
- expect(out).to include("Your RubyGems configuration")
- expect(out).to include("invalid YAML syntax")
- expect(out).to include("Psych::SyntaxError")
- expect(out).not_to include("ERROR REPORT TEMPLATE")
- expect(exitstatus).to eq(25) if exitstatus
- end
-
- it "reports a relevant friendly error message", :ruby => ">= 1.9", :rubygems => ">= 2.5.0" do
+ it "reports a relevant friendly error message" do
gemfile <<-G
source "file://#{gem_repo1}"
gem "rack"
diff --git a/spec/bundler/bundler/gem_helper_spec.rb b/spec/bundler/bundler/gem_helper_spec.rb
index a627129fe3..dc982c6ee7 100644
--- a/spec/bundler/bundler/gem_helper_spec.rb
+++ b/spec/bundler/bundler/gem_helper_spec.rb
@@ -29,15 +29,6 @@ RSpec.describe Bundler::GemHelper do
end
context "interpolates the name" do
- before do
- # Remove exception that prevents public pushes on older RubyGems versions
- if Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.0")
- content = File.read(app_gemspec_path)
- content.sub!(/raise "RubyGems 2\.0 or newer.*/, "")
- File.open(app_gemspec_path, "w") {|f| f.write(content) }
- end
- end
-
it "when there is only one gemspec" do
expect(subject.gemspec.name).to eq(app_name)
end
@@ -72,7 +63,7 @@ RSpec.describe Bundler::GemHelper do
let(:app_version) { "0.1.0" }
let(:app_gem_dir) { app_path.join("pkg") }
let(:app_gem_path) { app_gem_dir.join("#{app_name}-#{app_version}.gem") }
- let(:app_gemspec_content) { remove_push_guard(File.read(app_gemspec_path)) }
+ let(:app_gemspec_content) { File.read(app_gemspec_path) }
before(:each) do
content = app_gemspec_content.gsub("TODO: ", "")
@@ -81,14 +72,6 @@ RSpec.describe Bundler::GemHelper do
File.open(app_gemspec_path, "w") {|file| file << content }
end
- def remove_push_guard(gemspec_content)
- # Remove exception that prevents public pushes on older RubyGems versions
- if Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.0")
- gemspec_content.sub!(/raise "RubyGems 2\.0 or newer.*/, "")
- end
- gemspec_content
- end
-
it "uses a shell UI for output" do
expect(Bundler.ui).to be_a(Bundler::UI::Shell)
end
@@ -198,6 +181,7 @@ RSpec.describe Bundler::GemHelper 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
@@ -225,11 +209,12 @@ RSpec.describe Bundler::GemHelper do
end
context "succeeds" do
+ let(:repo) { build_git("foo", :bare => true) }
+
before do
- Dir.chdir(gem_repo1) { `git init --bare` }
Dir.chdir(app_path) do
- `git remote add origin file://#{gem_repo1}`
- `git commit -a -m "initial commit"`
+ sys_exec("git remote add origin file://#{repo.path}")
+ sys_exec('git commit -a -m "initial commit"')
end
end
diff --git a/spec/bundler/bundler/installer/gem_installer_spec.rb b/spec/bundler/bundler/installer/gem_installer_spec.rb
index 7340a3acc0..8f8d1c6d15 100644
--- a/spec/bundler/bundler/installer/gem_installer_spec.rb
+++ b/spec/bundler/bundler/installer/gem_installer_spec.rb
@@ -10,14 +10,14 @@ RSpec.describe Bundler::GemInstaller do
subject { described_class.new(spec, installer) }
context "spec_settings is nil" do
- it "invokes install method with empty build_args", :rubygems => ">= 2" do
+ it "invokes install method with empty build_args" do
allow(spec_source).to receive(:install).with(spec, :force => false, :ensure_builtin_gems_cached => false, :build_args => [])
subject.install_from_spec
end
end
context "spec_settings is build option" do
- it "invokes install method with build_args", :rubygems => ">= 2" do
+ it "invokes install method with build_args" do
allow(Bundler.settings).to receive(:[]).with(:bin)
allow(Bundler.settings).to receive(:[]).with(:inline)
allow(Bundler.settings).to receive(:[]).with(:forget_cli_options)
@@ -26,4 +26,15 @@ RSpec.describe Bundler::GemInstaller do
subject.install_from_spec
end
end
+
+ context "spec_settings is build option with spaces" do
+ it "invokes install method with build_args" do
+ allow(Bundler.settings).to receive(:[]).with(:bin)
+ allow(Bundler.settings).to receive(:[]).with(:inline)
+ allow(Bundler.settings).to receive(:[]).with(:forget_cli_options)
+ allow(Bundler.settings).to receive(:[]).with("build.dummy").and_return("--with-dummy-config=dummy --with-another-dummy-config")
+ expect(spec_source).to receive(:install).with(spec, :force => false, :ensure_builtin_gems_cached => false, :build_args => ["--with-dummy-config=dummy", "--with-another-dummy-config"])
+ subject.install_from_spec
+ end
+ end
end
diff --git a/spec/bundler/bundler/mirror_spec.rb b/spec/bundler/bundler/mirror_spec.rb
index acd0895f2f..fb476b8465 100644
--- a/spec/bundler/bundler/mirror_spec.rb
+++ b/spec/bundler/bundler/mirror_spec.rb
@@ -298,8 +298,8 @@ RSpec.describe Bundler::Settings::TCPSocketProbe do
context "with a listening TCP Server" do
def with_server_and_mirror
- server = TCPServer.new("127.0.0.1", 0)
- mirror = Bundler::Settings::Mirror.new("http://localhost:#{server.addr[1]}", 1)
+ server = TCPServer.new("0.0.0.0", 0)
+ mirror = Bundler::Settings::Mirror.new("http://0.0.0.0:#{server.addr[1]}", 1)
yield server, mirror
server.close unless server.closed?
end
diff --git a/spec/bundler/bundler/plugin/index_spec.rb b/spec/bundler/bundler/plugin/index_spec.rb
index ca3476ea2a..e18e960fb8 100644
--- a/spec/bundler/bundler/plugin/index_spec.rb
+++ b/spec/bundler/bundler/plugin/index_spec.rb
@@ -86,6 +86,17 @@ RSpec.describe Bundler::Plugin::Index do
expect(new_index.hook_plugins("after-bar")).to eq([plugin_name])
end
+ it "only registers a gem once for an event" do
+ path = lib_path(plugin_name)
+ index.register_plugin(plugin_name,
+ path.to_s,
+ [path.join("lib").to_s],
+ commands,
+ sources,
+ hooks + hooks)
+ expect(index.hook_plugins("after-bar")).to eq([plugin_name])
+ end
+
context "that are not registered", :focused do
let(:file) { double("index-file") }
diff --git a/spec/bundler/bundler/plugin/installer_spec.rb b/spec/bundler/bundler/plugin/installer_spec.rb
index f8bf8450c9..71fef76042 100644
--- a/spec/bundler/bundler/plugin/installer_spec.rb
+++ b/spec/bundler/bundler/plugin/installer_spec.rb
@@ -3,10 +3,6 @@
RSpec.describe Bundler::Plugin::Installer do
subject(:installer) { Bundler::Plugin::Installer.new }
- before do
- # allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(Pathname.new("/Gemfile"))
- end
-
describe "cli install" do
it "uses Gem.sources when non of the source is provided" do
sources = double(:sources)
@@ -29,6 +25,14 @@ RSpec.describe Bundler::Plugin::Installer do
to eq("new-plugin" => spec)
end
+ it "returns the installed spec after installing local git plugins" do
+ allow(installer).to receive(:install_local_git).
+ and_return("new-plugin" => spec)
+
+ expect(installer.install(["new-plugin"], :local_git => "/phony/path/repo")).
+ to eq("new-plugin" => spec)
+ end
+
it "returns the installed spec after installing rubygems plugins" do
allow(installer).to receive(:install_rubygems).
and_return("new-plugin" => spec)
@@ -69,6 +73,29 @@ RSpec.describe Bundler::Plugin::Installer do
end
end
+ context "local git plugins" do
+ before do
+ build_git "ga-plugin", :path => lib_path("ga-plugin") do |s|
+ s.write "plugins.rb"
+ end
+ end
+
+ let(:result) do
+ installer.install(["ga-plugin"], :local_git => lib_path("ga-plugin").to_s)
+ end
+
+ it "returns the installed spec after installing" do
+ spec = result["ga-plugin"]
+ expect(spec.full_name).to eq "ga-plugin-1.0"
+ end
+
+ it "has expected full gem path" do
+ rev = revision_for(lib_path("ga-plugin"))
+ expect(result["ga-plugin"].full_gem_path).
+ to eq(Bundler::Plugin.root.join("bundler", "gems", "ga-plugin-#{rev[0..11]}").to_s)
+ end
+ end
+
context "rubygems plugins" do
let(:result) do
installer.install(["re-plugin"], :source => "file://#{gem_repo2}")
diff --git a/spec/bundler/bundler/plugin_spec.rb b/spec/bundler/bundler/plugin_spec.rb
index 9266fad1eb..eaa0b80905 100644
--- a/spec/bundler/bundler/plugin_spec.rb
+++ b/spec/bundler/bundler/plugin_spec.rb
@@ -32,6 +32,29 @@ RSpec.describe Bundler::Plugin do
allow(index).to receive(:register_plugin)
end
+ describe "list command" do
+ context "when no plugins are installed" do
+ before { allow(index).to receive(:installed_plugins) { [] } }
+ it "outputs no plugins installed" do
+ expect(Bundler.ui).to receive(:info).with("No plugins installed")
+ subject.list
+ end
+ end
+
+ context "with installed plugins" do
+ before do
+ allow(index).to receive(:installed_plugins) { %w[plug1 plug2] }
+ allow(index).to receive(:plugin_commands).with("plug1") { %w[c11 c12] }
+ allow(index).to receive(:plugin_commands).with("plug2") { %w[c21 c22] }
+ end
+ it "list plugins followed by commands" do
+ expected_output = "plug1\n-----\n c11\n c12\n\nplug2\n-----\n c21\n c22\n\n"
+ expect(Bundler.ui).to receive(:info).with(expected_output)
+ subject.list
+ end
+ end
+ end
+
describe "install command" do
let(:opts) { { "version" => "~> 1.0", "source" => "foo" } }
diff --git a/spec/bundler/bundler/rubygems_integration_spec.rb b/spec/bundler/bundler/rubygems_integration_spec.rb
index b1b15d9e5d..26cbaa630b 100644
--- a/spec/bundler/bundler/rubygems_integration_spec.rb
+++ b/spec/bundler/bundler/rubygems_integration_spec.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
RSpec.describe Bundler::RubygemsIntegration do
- it "uses the same chdir lock as rubygems", :rubygems => "2.1" do
+ it "uses the same chdir lock as rubygems" do
expect(Bundler.rubygems.ext_lock).to eq(Gem::Ext::Builder::CHDIR_MONITOR)
end
@@ -15,30 +15,18 @@ RSpec.describe Bundler::RubygemsIntegration do
end
subject { Bundler.rubygems.validate(spec) }
- it "skips overly-strict gemspec validation", :rubygems => "< 1.7" do
- expect(spec).to_not receive(:validate)
- subject
- end
-
- it "validates with packaging mode disabled", :rubygems => "1.7" do
+ it "validates with packaging mode disabled" do
expect(spec).to receive(:validate).with(false)
subject
end
- it "should set a summary to avoid an overly-strict error", :rubygems => "~> 1.7.0" do
- spec.summary = nil
- expect { subject }.not_to raise_error
- expect(spec.summary).to eq("")
- end
-
context "with an invalid spec" do
before do
expect(spec).to receive(:validate).with(false).
and_raise(Gem::InvalidSpecificationException.new("TODO is not an author"))
end
- it "should raise a Gem::InvalidSpecificationException and produce a helpful warning message",
- :rubygems => "1.7" do
+ it "should raise a Gem::InvalidSpecificationException and produce a helpful warning message" do
expect { subject }.to raise_error(Gem::InvalidSpecificationException,
"The gemspec at #{__FILE__} is not valid. "\
"Please fix this gemspec.\nThe validation error was 'TODO is not an author'\n")
@@ -53,7 +41,7 @@ RSpec.describe Bundler::RubygemsIntegration do
end
end
- describe "#download_gem", :rubygems => ">= 2.0" do
+ describe "#download_gem" do
let(:bundler_retry) { double(Bundler::Retry) }
let(:retry) { double("Bundler::Retry") }
let(:uri) { URI.parse("https://foo.bar") }
@@ -78,7 +66,7 @@ RSpec.describe Bundler::RubygemsIntegration do
end
end
- describe "#fetch_all_remote_specs", :rubygems => ">= 2.0" do
+ describe "#fetch_all_remote_specs" do
let(:uri) { URI("https://example.com") }
let(:fetcher) { double("gem_remote_fetcher") }
let(:specs_response) { Marshal.dump(["specs"]) }
diff --git a/spec/bundler/bundler/settings_spec.rb b/spec/bundler/bundler/settings_spec.rb
index 1a31493e20..339428eb48 100644
--- a/spec/bundler/bundler/settings_spec.rb
+++ b/spec/bundler/bundler/settings_spec.rb
@@ -130,13 +130,15 @@ that would suck --ehhh=oh geez it looks like i might have broken bundler somehow
describe "#temporary" do
it "reset after used" do
- Bundler.settings.set_local :no_install, true
+ Bundler.settings.set_command_option :no_install, true
Bundler.settings.temporary(:no_install => false) do
expect(Bundler.settings[:no_install]).to eq false
end
expect(Bundler.settings[:no_install]).to eq true
+
+ Bundler.settings.set_command_option :no_install, nil
end
it "returns the return value of the block" do
diff --git a/spec/bundler/bundler/shared_helpers_spec.rb b/spec/bundler/bundler/shared_helpers_spec.rb
index fcac37b398..f42d9ed485 100644
--- a/spec/bundler/bundler/shared_helpers_spec.rb
+++ b/spec/bundler/bundler/shared_helpers_spec.rb
@@ -14,7 +14,7 @@ RSpec.describe Bundler::SharedHelpers do
before { ENV["BUNDLE_GEMFILE"] = "/path/Gemfile" }
context "Gemfile is present" do
- let(:expected_gemfile_path) { Pathname.new("/path/Gemfile") }
+ let(:expected_gemfile_path) { Pathname.new("/path/Gemfile").expand_path }
it "returns the Gemfile path" do
expect(subject.default_gemfile).to eq(expected_gemfile_path)
@@ -288,7 +288,7 @@ RSpec.describe Bundler::SharedHelpers do
)
end
- context "with a jruby path_separator regex", :ruby => "1.9" do
+ context "with a jruby path_separator regex" do
# In versions of jruby that supported ruby 1.8, the path separator was the standard File::PATH_SEPARATOR
let(:regex) { Regexp.new("(?<!jar:file|jar|file|classpath|uri:classloader|uri|http|https):") }
it "does not exit if bundle path is the standard uri path" do
@@ -389,7 +389,7 @@ RSpec.describe Bundler::SharedHelpers do
context "bundle executable in ENV['BUNDLE_BIN_PATH'] does not exist" do
before { ENV["BUNDLE_BIN_PATH"] = "/does/not/exist" }
- before { Bundler.rubygems.replace_bin_path [], [] }
+ before { Bundler.rubygems.replace_bin_path [] }
it "sets BUNDLE_BIN_PATH to the bundle executable file" do
subject.set_bundle_environment
@@ -455,7 +455,7 @@ RSpec.describe Bundler::SharedHelpers do
end
end
- context "system throws Errno::ENOTSUP", :ruby => "1.9" do
+ context "system throws Errno::ENOTSUP" do
let(:file_op_block) { proc {|_path| raise Errno::ENOTSUP } }
it "raises a OperationNotSupportedError" do
diff --git a/spec/bundler/bundler/source/git/git_proxy_spec.rb b/spec/bundler/bundler/source/git/git_proxy_spec.rb
index 3a29c97461..016105ccde 100644
--- a/spec/bundler/bundler/source/git/git_proxy_spec.rb
+++ b/spec/bundler/bundler/source/git/git_proxy_spec.rb
@@ -10,29 +10,33 @@ RSpec.describe Bundler::Source::Git::GitProxy do
context "with configured credentials" do
it "adds username and password to URI" do
- Bundler.settings.temporary(uri => "u:p")
- expect(subject).to receive(:git_retry).with(match("https://u:p@github.com/bundler/bundler.git"))
- subject.checkout
+ Bundler.settings.temporary(uri => "u:p") do
+ expect(subject).to receive(:git_retry).with(match("https://u:p@github.com/bundler/bundler.git"))
+ subject.checkout
+ end
end
it "adds username and password to URI for host" do
- Bundler.settings.temporary("github.com" => "u:p")
- expect(subject).to receive(:git_retry).with(match("https://u:p@github.com/bundler/bundler.git"))
- subject.checkout
+ Bundler.settings.temporary("github.com" => "u:p") do
+ expect(subject).to receive(:git_retry).with(match("https://u:p@github.com/bundler/bundler.git"))
+ subject.checkout
+ end
end
it "does not add username and password to mismatched URI" do
- Bundler.settings.temporary("https://u:p@github.com/bundler/bundler-mismatch.git" => "u:p")
- expect(subject).to receive(:git_retry).with(match(uri))
- subject.checkout
+ Bundler.settings.temporary("https://u:p@github.com/bundler/bundler-mismatch.git" => "u:p") do
+ expect(subject).to receive(:git_retry).with(match(uri))
+ subject.checkout
+ end
end
it "keeps original userinfo" do
- Bundler.settings.temporary("github.com" => "u:p")
- original = "https://orig:info@github.com/bundler/bundler.git"
- subject = described_class.new(Pathname("path"), original, "HEAD")
- expect(subject).to receive(:git_retry).with(match(original))
- subject.checkout
+ Bundler.settings.temporary("github.com" => "u:p") do
+ original = "https://orig:info@github.com/bundler/bundler.git"
+ subject = described_class.new(Pathname("path"), original, "HEAD")
+ expect(subject).to receive(:git_retry).with(match(original))
+ subject.checkout
+ end
end
end
diff --git a/spec/bundler/bundler/source/rubygems/remote_spec.rb b/spec/bundler/bundler/source/rubygems/remote_spec.rb
index 9a7ab42128..52fb4e7f1c 100644
--- a/spec/bundler/bundler/source/rubygems/remote_spec.rb
+++ b/spec/bundler/bundler/source/rubygems/remote_spec.rb
@@ -22,8 +22,9 @@ RSpec.describe Bundler::Source::Rubygems::Remote do
end
it "applies configured credentials" do
- Bundler.settings.temporary(uri_no_auth.to_s => credentials)
- expect(remote(uri_no_auth).uri).to eq(uri_with_auth)
+ Bundler.settings.temporary(uri_no_auth.to_s => credentials) do
+ expect(remote(uri_no_auth).uri).to eq(uri_with_auth)
+ end
end
end
@@ -33,8 +34,9 @@ RSpec.describe Bundler::Source::Rubygems::Remote do
end
it "does not apply given credentials" do
- Bundler.settings.temporary(uri_no_auth.to_s => credentials)
- expect(remote(uri_no_auth).anonymized_uri).to eq(uri_no_auth)
+ Bundler.settings.temporary(uri_no_auth.to_s => credentials) do
+ expect(remote(uri_no_auth).anonymized_uri).to eq(uri_no_auth)
+ end
end
end
@@ -44,8 +46,9 @@ RSpec.describe Bundler::Source::Rubygems::Remote do
end
it "only applies the given user" do
- Bundler.settings.temporary(uri_no_auth.to_s => credentials)
- expect(remote(uri_no_auth).cache_slug).to eq("gems.example.com.username.443.MD5HEX(gems.example.com.username.443./)")
+ Bundler.settings.temporary(uri_no_auth.to_s => credentials) do
+ expect(remote(uri_no_auth).cache_slug).to eq("gems.example.com.username.443.MD5HEX(gems.example.com.username.443./)")
+ end
end
end
end
@@ -106,7 +109,9 @@ RSpec.describe Bundler::Source::Rubygems::Remote do
let(:mirror_uri_with_auth) { URI("https://username:password@rubygems-mirror.org/") }
let(:mirror_uri_no_auth) { URI("https://rubygems-mirror.org/") }
- before { Bundler.settings.set_local("mirror.https://rubygems.org/", mirror_uri_with_auth.to_s) }
+ before { Bundler.settings.temporary("mirror.https://rubygems.org/" => mirror_uri_with_auth.to_s) }
+
+ after { Bundler.settings.temporary("mirror.https://rubygems.org/" => nil) }
specify "#uri returns the mirror URI with credentials" do
expect(remote(uri).uri).to eq(mirror_uri_with_auth)
@@ -135,6 +140,11 @@ RSpec.describe Bundler::Source::Rubygems::Remote do
Bundler.settings.temporary(mirror_uri_no_auth.to_s => credentials)
end
+ after do
+ Bundler.settings.temporary("mirror.https://rubygems.org/" => nil)
+ Bundler.settings.temporary(mirror_uri_no_auth.to_s => nil)
+ end
+
specify "#uri returns the mirror URI with credentials" do
expect(remote(uri).uri).to eq(mirror_uri_with_auth)
end
diff --git a/spec/bundler/bundler/source_list_spec.rb b/spec/bundler/bundler/source_list_spec.rb
index 541a46c6d0..a78b80ec3b 100644
--- a/spec/bundler/bundler/source_list_spec.rb
+++ b/spec/bundler/bundler/source_list_spec.rb
@@ -75,7 +75,7 @@ RSpec.describe Bundler::SourceList do
let(:msg) do
"The git source `git://existing-git.org/path.git` " \
"uses the `git` protocol, which transmits data without encryption. " \
- "Disable this warning with `bundle config git.allow_insecure true`, " \
+ "Disable this warning with `bundle config set git.allow_insecure true`, " \
"or switch to the `https` protocol to keep your data secure."
end
@@ -393,19 +393,19 @@ RSpec.describe Bundler::SourceList do
it "returns all sources, without combining rubygems sources", :bundler => "3" do
expect(source_list.lock_sources).to eq [
- Bundler::Source::Rubygems.new,
- Bundler::Source::Rubygems.new("remotes" => ["https://duplicate-rubygems.org"]),
- Bundler::Source::Rubygems.new("remotes" => ["https://first-rubygems.org"]),
- Bundler::Source::Rubygems.new("remotes" => ["https://second-rubygems.org"]),
- Bundler::Source::Rubygems.new("remotes" => ["https://third-rubygems.org"]),
Bundler::Source::Git.new("uri" => "git://first-git.org/path.git"),
Bundler::Source::Git.new("uri" => "git://second-git.org/path.git"),
Bundler::Source::Git.new("uri" => "git://third-git.org/path.git"),
+ ASourcePlugin.new("uri" => "https://second-plugin.org/random"),
+ ASourcePlugin.new("uri" => "https://third-bar.org/foo"),
Bundler::Source::Path.new("path" => "/first/path/to/gem"),
Bundler::Source::Path.new("path" => "/second/path/to/gem"),
Bundler::Source::Path.new("path" => "/third/path/to/gem"),
- ASourcePlugin.new("uri" => "https://second-plugin.org/random"),
- ASourcePlugin.new("uri" => "https://third-bar.org/foo"),
+ Bundler::Source::Rubygems.new,
+ Bundler::Source::Rubygems.new("remotes" => ["https://duplicate-rubygems.org"]),
+ Bundler::Source::Rubygems.new("remotes" => ["https://first-rubygems.org"]),
+ Bundler::Source::Rubygems.new("remotes" => ["https://second-rubygems.org"]),
+ Bundler::Source::Rubygems.new("remotes" => ["https://third-rubygems.org"]),
]
end
end
diff --git a/spec/bundler/bundler/ssl_certs/certificate_manager_spec.rb b/spec/bundler/bundler/ssl_certs/certificate_manager_spec.rb
deleted file mode 100644
index 56606a830f..0000000000
--- a/spec/bundler/bundler/ssl_certs/certificate_manager_spec.rb
+++ /dev/null
@@ -1,140 +0,0 @@
-# frozen_string_literal: true
-
-require "bundler/ssl_certs/certificate_manager"
-
-RSpec.describe Bundler::SSLCerts::CertificateManager do
- let(:rubygems_path) { root }
- let(:stub_cert) { File.join(root.to_s, "lib", "rubygems", "ssl_certs", "rubygems.org", "ssl-cert.pem") }
- let(:rubygems_certs_dir) { File.join(root.to_s, "lib", "rubygems", "ssl_certs", "rubygems.org") }
-
- subject { described_class.new(rubygems_path) }
-
- # Pretend bundler root is rubygems root
- before do
- # Backing up rubygems ceriticates
- FileUtils.mv(rubygems_certs_dir, rubygems_certs_dir + ".back") if ruby_core?
-
- FileUtils.mkdir_p(rubygems_certs_dir)
- FileUtils.touch(stub_cert)
- end
-
- after do
- FileUtils.rm_rf(rubygems_certs_dir)
-
- # Restore rubygems certificates
- FileUtils.mv(rubygems_certs_dir + ".back", rubygems_certs_dir) if ruby_core?
- end
-
- describe "#update_from" do
- let(:cert_manager) { double(:cert_manager) }
-
- before { allow(described_class).to receive(:new).with(rubygems_path).and_return(cert_manager) }
-
- it "should update the certs through a new certificate manager" do
- allow(cert_manager).to receive(:update!)
- expect(described_class.update_from!(rubygems_path)).to be_nil
- end
- end
-
- describe "#initialize" do
- it "should set bundler_cert_path as path of the subdir with bundler ssl certs" do
- expect(subject.bundler_cert_path).to eq(File.join(root, "lib/bundler/ssl_certs"))
- end
-
- it "should set bundler_certs as the paths of the bundler ssl certs" do
- expect(subject.bundler_certs).to include(File.join(root, "lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem"))
- expect(subject.bundler_certs).to include(File.join(root, "lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem"))
- end
-
- context "when rubygems_path is not nil" do
- it "should set rubygems_certs" do
- expect(subject.rubygems_certs).to include(File.join(root, "lib", "rubygems", "ssl_certs", "rubygems.org", "ssl-cert.pem"))
- end
- end
- end
-
- describe "#up_to_date?" do
- context "when bundler certs and rubygems certs are the same" do
- before do
- bundler_certs = Dir[File.join(root.to_s, "lib", "bundler", "ssl_certs", "**", "*.pem")]
- FileUtils.rm(stub_cert)
- FileUtils.cp(bundler_certs, rubygems_certs_dir)
- end
-
- it "should return true" do
- expect(subject).to be_up_to_date
- end
- end
-
- context "when bundler certs and rubygems certs are not the same" do
- it "should return false" do
- expect(subject).to_not be_up_to_date
- end
- end
- end
-
- describe "#update!" do
- context "when certificate manager is not up to date" do
- before do
- allow(subject).to receive(:up_to_date?).and_return(false)
- allow(bundler_fileutils).to receive(:rm)
- allow(bundler_fileutils).to receive(:cp)
- end
-
- it "should remove the current bundler certs" do
- expect(bundler_fileutils).to receive(:rm).with(subject.bundler_certs)
- subject.update!
- end
-
- it "should copy the rubygems certs into bundler certs" do
- expect(bundler_fileutils).to receive(:cp).with(subject.rubygems_certs, subject.bundler_cert_path)
- subject.update!
- end
-
- it "should return nil" do
- expect(subject.update!).to be_nil
- end
- end
-
- context "when certificate manager is up to date" do
- before { allow(subject).to receive(:up_to_date?).and_return(true) }
-
- it "should return nil" do
- expect(subject.update!).to be_nil
- end
- end
- end
-
- describe "#connect_to" do
- let(:host) { "http://www.host.com" }
- let(:http) { Net::HTTP.new(host, 443) }
- let(:cert_store) { OpenSSL::X509::Store.new }
- let(:http_header_response) { double(:http_header_response) }
-
- before do
- allow(Net::HTTP).to receive(:new).with(host, 443).and_return(http)
- allow(OpenSSL::X509::Store).to receive(:new).and_return(cert_store)
- allow(http).to receive(:head).with("/").and_return(http_header_response)
- end
-
- it "should use ssl for the http request" do
- expect(http).to receive(:use_ssl=).with(true)
- subject.connect_to(host)
- end
-
- it "use verify peer mode" do
- expect(http).to receive(:verify_mode=).with(OpenSSL::SSL::VERIFY_PEER)
- subject.connect_to(host)
- end
-
- it "set its cert store as a OpenSSL::X509::Store populated with bundler certs" do
- expect(cert_store).to receive(:add_file).at_least(:once)
- expect(http).to receive(:cert_store=).with(cert_store)
- subject.connect_to(host)
- end
-
- it "return the headers of the request response" do
- expect(subject.connect_to(host)).to eq(http_header_response)
- end
- end
-end
diff --git a/spec/bundler/bundler/stub_specification_spec.rb b/spec/bundler/bundler/stub_specification_spec.rb
index 5521d83769..7495b5d661 100644
--- a/spec/bundler/bundler/stub_specification_spec.rb
+++ b/spec/bundler/bundler/stub_specification_spec.rb
@@ -13,12 +13,10 @@ RSpec.describe Bundler::StubSpecification do
described_class.from_stub(gemspec)
end
- if Bundler.rubygems.provides?(">= 2.1")
- describe "#from_stub" do
- it "returns the same stub if already a Bundler::StubSpecification" do
- stub = described_class.from_stub(with_bundler_stub_spec)
- expect(stub).to be(with_bundler_stub_spec)
- end
+ describe "#from_stub" do
+ it "returns the same stub if already a Bundler::StubSpecification" do
+ stub = described_class.from_stub(with_bundler_stub_spec)
+ expect(stub).to be(with_bundler_stub_spec)
end
end
end
diff --git a/spec/bundler/bundler/ui/shell_spec.rb b/spec/bundler/bundler/ui/shell_spec.rb
index 951a446aff..23a7670dd1 100644
--- a/spec/bundler/bundler/ui/shell_spec.rb
+++ b/spec/bundler/bundler/ui/shell_spec.rb
@@ -21,11 +21,7 @@ RSpec.describe Bundler::UI::Shell do
describe "#warn" do
before { subject.level = "warn" }
- it "prints to stdout", :bundler => "< 2" do
- expect { subject.warn("warning") }.to output("warning\n").to_stdout
- end
-
- it "prints to stderr", :bundler => "2" do
+ it "prints to stderr" do
expect { subject.warn("warning") }.to output("warning\n").to_stderr
end
@@ -46,11 +42,7 @@ RSpec.describe Bundler::UI::Shell do
describe "#error" do
before { subject.level = "error" }
- it "prints to stdout", :bundler => "< 2" do
- expect { subject.error("error!!!") }.to output("error!!!\n").to_stdout
- end
-
- it "prints to stderr", :bundler => "2" do
+ it "prints to stderr" do
expect { subject.error("error!!!") }.to output("error!!!\n").to_stderr
end
diff --git a/spec/bundler/bundler/ui_spec.rb b/spec/bundler/bundler/ui_spec.rb
index 6ef8729277..6df0d2e290 100644
--- a/spec/bundler/bundler/ui_spec.rb
+++ b/spec/bundler/bundler/ui_spec.rb
@@ -2,7 +2,7 @@
RSpec.describe Bundler::UI do
describe Bundler::UI::Silent do
- it "has the same instance methods as Shell", :ruby => ">= 1.9" do
+ it "has the same instance methods as Shell" do
shell = Bundler::UI::Shell
methods = proc do |cls|
cls.instance_methods.map do |i|
@@ -13,7 +13,7 @@ RSpec.describe Bundler::UI do
expect(methods.call(described_class)).to eq(methods.call(shell))
end
- it "has the same instance class as Shell", :ruby => ">= 1.9" do
+ it "has the same instance class as Shell" do
shell = Bundler::UI::Shell
methods = proc do |cls|
cls.methods.map do |i|
diff --git a/spec/bundler/bundler/vendored_persistent_spec.rb b/spec/bundler/bundler/vendored_persistent_spec.rb
index 338431c4a6..c760c067e0 100644
--- a/spec/bundler/bundler/vendored_persistent_spec.rb
+++ b/spec/bundler/bundler/vendored_persistent_spec.rb
@@ -1,6 +1,5 @@
# frozen_string_literal: true
-require "spec_helper"
require "bundler/vendored_persistent"
RSpec.describe Bundler::PersistentHTTP do
@@ -13,7 +12,7 @@ RSpec.describe Bundler::PersistentHTTP do
before do
allow(connection).to receive(:use_ssl?).and_return(!tls_version.nil?)
- allow(socket).to receive(:io).and_return(socket_io)
+ allow(socket).to receive(:io).and_return(socket_io) if socket
connection.instance_variable_set(:@socket, socket)
if tls_version
diff --git a/spec/bundler/bundler/version_ranges_spec.rb b/spec/bundler/bundler/version_ranges_spec.rb
index ccbb9285d5..bca044b0c0 100644
--- a/spec/bundler/bundler/version_ranges_spec.rb
+++ b/spec/bundler/bundler/version_ranges_spec.rb
@@ -25,9 +25,12 @@ RSpec.describe Bundler::VersionRanges do
include_examples "empty?", false, ">= 1.0.0", "< 2.0.0"
include_examples "empty?", false, "~> 1"
include_examples "empty?", false, "~> 2.0", "~> 2.1"
+ include_examples "empty?", true, ">= 4.1.0", "< 5.0", "= 5.2.1"
+ include_examples "empty?", true, "< 5.0", "< 5.3", "< 6.0", "< 6", "= 5.2.0", "> 2", ">= 3.0", ">= 3.1", ">= 3.2", ">= 4.0.0", ">= 4.1.0", ">= 4.2.0", ">= 4.2", ">= 4"
include_examples "empty?", true, "!= 1", "< 2", "> 2"
include_examples "empty?", true, "!= 1", "<= 1", ">= 1"
include_examples "empty?", true, "< 2", "> 2"
+ include_examples "empty?", true, "< 2", "> 2", "= 2"
include_examples "empty?", true, "= 1", "!= 1"
include_examples "empty?", true, "= 1", "= 2"
include_examples "empty?", true, "= 1", "~> 2"
diff --git a/spec/bundler/cache/cache_path_spec.rb b/spec/bundler/cache/cache_path_spec.rb
index 69d3809964..a4572af11e 100644
--- a/spec/bundler/cache/cache_path_spec.rb
+++ b/spec/bundler/cache/cache_path_spec.rb
@@ -17,7 +17,7 @@ RSpec.describe "bundle package" do
context "with config cache_path" do
it "caches gems at given path" do
- bundle "config cache_path vendor/cache-foo"
+ bundle "config set cache_path vendor/cache-foo"
bundle :package
expect(bundled_app("vendor/cache-foo/rack-1.0.0.gem")).to exist
end
diff --git a/spec/bundler/cache/gems_spec.rb b/spec/bundler/cache/gems_spec.rb
index 4a0b953830..4fc43a50a0 100644
--- a/spec/bundler/cache/gems_spec.rb
+++ b/spec/bundler/cache/gems_spec.rb
@@ -74,16 +74,16 @@ RSpec.describe "bundle cache" do
end
context "using system gems" do
- before { bundle! "config path.system true" }
+ before { bundle! "config set path.system true" }
it_behaves_like "when there are only gemsources"
end
context "installing into a local path" do
- before { bundle! "config path ./.bundle" }
+ before { bundle! "config set path ./.bundle" }
it_behaves_like "when there are only gemsources"
end
- describe "when there is a built-in gem", :ruby => "2.0" do
+ describe "when there is a built-in gem" do
before :each do
build_repo2 do
build_gem "builtin_gem", "1.0.2"
@@ -97,7 +97,7 @@ RSpec.describe "bundle cache" do
end
it "uses builtin gems when installing to system gems" do
- bundle! "config path.system true"
+ bundle! "config set path.system true"
install_gemfile %(gem 'builtin_gem', '1.0.2')
expect(the_bundle).to include_gems("builtin_gem 1.0.2")
end
@@ -129,7 +129,7 @@ RSpec.describe "bundle cache" do
end
it "errors if the builtin gem isn't available to cache" do
- bundle! "config path.system true"
+ bundle! "config set path.system true"
install_gemfile <<-G
gem 'builtin_gem', '1.0.2'
@@ -137,7 +137,7 @@ RSpec.describe "bundle cache" do
bundle :cache
expect(exitstatus).to_not eq(0) if exitstatus
- expect(out).to include("builtin_gem-1.0.2 is built in to Ruby, and can't be cached")
+ expect(err).to include("builtin_gem-1.0.2 is built in to Ruby, and can't be cached")
end
end
@@ -196,7 +196,7 @@ RSpec.describe "bundle cache" do
it "adds and removes when gems are updated" do
update_repo2
- bundle "update", :all => bundle_update_requires_all?
+ bundle "update", :all => true
expect(cached_gem("rack-1.2")).to exist
expect(cached_gem("rack-1.0.0")).not_to exist
end
diff --git a/spec/bundler/cache/git_spec.rb b/spec/bundler/cache/git_spec.rb
index 33387dbbb2..55a24ff118 100644
--- a/spec/bundler/cache/git_spec.rb
+++ b/spec/bundler/cache/git_spec.rb
@@ -81,7 +81,7 @@ end
ref = git.ref_for("master", 11)
expect(ref).not_to eq(old_ref)
- bundle! "update", :all => bundle_update_requires_all?
+ bundle! "update", :all => true
bundle! "#{cmd}", forgotten_command_line_options([:all, :cache_all] => true)
expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).to exist
@@ -127,7 +127,7 @@ end
gem "foo", :git => '#{lib_path("foo-invalid")}', :branch => :master
G
- bundle %(config local.foo #{lib_path("foo-1.0")})
+ bundle %(config set local.foo #{lib_path("foo-1.0")})
bundle "install"
bundle "#{cmd}", forgotten_command_line_options([:all, :cache_all] => true)
@@ -168,7 +168,7 @@ end
expect(the_bundle).to include_gems "has_submodule 1.0"
end
- it "displays warning message when detecting git repo in Gemfile", :bundler => "< 2" do
+ it "displays warning message when detecting git repo in Gemfile", :bundler => "< 3" do
build_git "foo"
install_gemfile <<-G
@@ -177,7 +177,7 @@ end
bundle "#{cmd}"
- expect(out).to include("Your Gemfile contains path and git dependencies.")
+ expect(err).to include("Your Gemfile contains path and git dependencies.")
end
it "does not display warning message if cache_all is set in bundle config" do
@@ -190,7 +190,7 @@ end
bundle cmd, forgotten_command_line_options([:all, :cache_all] => true)
bundle cmd
- expect(out).not_to include("Your Gemfile contains path and git dependencies.")
+ expect(err).not_to include("Your Gemfile contains path and git dependencies.")
end
it "caches pre-evaluated gemspecs" do
diff --git a/spec/bundler/cache/path_spec.rb b/spec/bundler/cache/path_spec.rb
index 12be2dbcf8..0d7b154a37 100644
--- a/spec/bundler/cache/path_spec.rb
+++ b/spec/bundler/cache/path_spec.rb
@@ -94,7 +94,7 @@
G
bundle cmd
- expect(out).to match(/please pass the \-\-all flag/)
+ expect(err).to match(/please pass the \-\-all flag/)
expect(bundled_app("vendor/cache/foo-1.0")).not_to exist
end
diff --git a/spec/bundler/cache/platform_spec.rb b/spec/bundler/cache/platform_spec.rb
index c0622a3c94..b3c4643ef5 100644
--- a/spec/bundler/cache/platform_spec.rb
+++ b/spec/bundler/cache/platform_spec.rb
@@ -41,7 +41,7 @@ RSpec.describe "bundle cache with multiple platforms" do
end
it "ensures that a successful bundle update does not delete gems for other platforms" do
- bundle! "update", :all => bundle_update_requires_all?
+ bundle! "update", :all => true
expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
expect(bundled_app("vendor/cache/activesupport-2.3.5.gem")).to exist
diff --git a/spec/bundler/commands/add_spec.rb b/spec/bundler/commands/add_spec.rb
index 9f11adbcf8..dac1d0f6b9 100644
--- a/spec/bundler/commands/add_spec.rb
+++ b/spec/bundler/commands/add_spec.rb
@@ -106,23 +106,23 @@ RSpec.describe "bundle add" do
it "shows error message when version is not formatted correctly" do
bundle "add 'foo' -v='~>1 . 0'"
- expect(out).to match("Invalid gem requirement pattern '~>1 . 0'")
+ expect(err).to match("Invalid gem requirement pattern '~>1 . 0'")
end
it "shows error message when gem cannot be found" do
bundle "add 'werk_it'"
- expect(out).to match("Could not find gem 'werk_it' in")
+ expect(err).to match("Could not find gem 'werk_it' in")
bundle "add 'werk_it' -s='file://#{gem_repo2}'"
- expect(out).to match("Could not find gem 'werk_it' in rubygems repository")
+ expect(err).to match("Could not find gem 'werk_it' in rubygems repository")
end
it "shows error message when source cannot be reached" do
bundle "add 'baz' --source='http://badhostasdf'"
- expect(out).to include("Could not reach host badhostasdf. Check your network connection and try again.")
+ expect(err).to include("Could not reach host badhostasdf. Check your network connection and try again.")
bundle "add 'baz' --source='file://does/not/exist'"
- expect(out).to include("Could not fetch specs from file://does/not/exist/")
+ expect(err).to include("Could not fetch specs from file://does/not/exist/")
end
describe "with --optimistic" do
@@ -153,7 +153,7 @@ RSpec.describe "bundle add" do
it "throws error" do
bundle "add 'foo' --strict --optimistic"
- expect(out).to include("You can not specify `--strict` and `--optimistic` at the same time")
+ expect(err).to include("You can not specify `--strict` and `--optimistic` at the same time")
end
end
@@ -168,8 +168,8 @@ RSpec.describe "bundle add" do
it "throws error if any of the specified gems are present in the gemfile with different version" do
bundle "add weakling bar"
- expect(out).to include("You cannot specify the same gem twice with different version requirements")
- expect(out).to include("You specified: weakling (~> 0.0.1) and weakling (>= 0).")
+ expect(err).to include("You cannot specify the same gem twice with different version requirements")
+ expect(err).to include("You specified: weakling (~> 0.0.1) and weakling (>= 0).")
end
end
@@ -182,8 +182,8 @@ RSpec.describe "bundle add" do
bundle "add 'rack' --version=1.1"
- expect(out).to include("You cannot specify the same gem twice with different version requirements")
- expect(out).to include("If you want to update the gem version, run `bundle update rack`. You may also need to change the version requirement specified in the Gemfile if it's too restrictive")
+ expect(err).to include("You cannot specify the same gem twice with different version requirements")
+ expect(err).to include("If you want to update the gem version, run `bundle update rack`. You may also need to change the version requirement specified in the Gemfile if it's too restrictive")
end
it "shows error when added without version requirements" do
@@ -194,9 +194,9 @@ RSpec.describe "bundle add" do
bundle "add 'rack'"
- expect(out).to include("Gem already added.")
- expect(out).to include("You cannot specify the same gem twice with different version requirements")
- expect(out).not_to include("If you want to update the gem version, run `bundle update rack`. You may also need to change the version requirement specified in the Gemfile if it's too restrictive")
+ expect(err).to include("Gem already added.")
+ expect(err).to include("You cannot specify the same gem twice with different version requirements")
+ expect(err).not_to include("If you want to update the gem version, run `bundle update rack`. You may also need to change the version requirement specified in the Gemfile if it's too restrictive")
end
end
@@ -209,9 +209,9 @@ RSpec.describe "bundle add" do
bundle "add 'rack' --version=1.1"
- expect(out).to include("You cannot specify the same gem twice with different version requirements")
- expect(out).to include("If you want to update the gem version, run `bundle update rack`.")
- expect(out).not_to include("You may also need to change the version requirement specified in the Gemfile if it's too restrictive")
+ expect(err).to include("You cannot specify the same gem twice with different version requirements")
+ expect(err).to include("If you want to update the gem version, run `bundle update rack`.")
+ expect(err).not_to include("You may also need to change the version requirement specified in the Gemfile if it's too restrictive")
end
end
end
diff --git a/spec/bundler/commands/binstubs_spec.rb b/spec/bundler/commands/binstubs_spec.rb
index 7f2e81c099..3f62f17b45 100644
--- a/spec/bundler/commands/binstubs_spec.rb
+++ b/spec/bundler/commands/binstubs_spec.rb
@@ -59,7 +59,7 @@ RSpec.describe "bundle binstubs <gem>" do
bundle "binstubs"
expect(exitstatus).to eq(1) if exitstatus
- expect(out).to include("`bundle binstubs` needs at least one gem to run.")
+ expect(err).to include("`bundle binstubs` needs at least one gem to run.")
end
it "displays an error when used with --all and gems" do
@@ -124,54 +124,16 @@ RSpec.describe "bundle binstubs <gem>" do
bundle! "binstubs bundler rack prints_loaded_gems"
end
- # When environment has a same version of bundler as default gems.
- # `system_gems "bundler-x.y.z"` will detect system binstub.
- # We need to avoid it by virtual version of bundler.
- let(:system_bundler_version) { Gem::Version.new(Bundler::VERSION).bump.to_s }
+ let(:system_bundler_version) { Bundler::VERSION }
- context "when system bundler was used" do
- # Support master branch of bundler
- if ENV["BUNDLER_SPEC_SUB_VERSION"]
- let(:system_bundler_version) { Bundler::VERSION }
- end
-
- before do
- gemfile <<-G
- source "file:///Users/colby/Projects/bundler/tmp/gems/remote2"
- gem "rack"
- gem "prints_loaded_gems"
- G
-
- lockfile <<-G
- GEM
- remote: file:///Users/colby/Projects/bundler/tmp/gems/remote2/
- specs:
- prints_loaded_gems (1.0)
- rack (1.2)
-
- PLATFORMS
- ruby
-
- DEPENDENCIES
- prints_loaded_gems
- rack
-
- BUNDLED WITH
- #{system_bundler_version}
- G
- end
-
- it "runs bundler" do
- sys_exec! "#{bundled_app("bin/bundle")} install"
- expect(out).to eq %(system bundler #{system_bundler_version}\n["install"])
- end
+ it "runs bundler" do
+ sys_exec! "#{bundled_app("bin/bundle")} install"
+ expect(out).to eq %(system bundler #{system_bundler_version}\n["install"])
end
context "when BUNDLER_VERSION is set" do
- let(:system_bundler_version) { Bundler::VERSION }
-
it "runs the correct version of bundler" do
- sys_exec "BUNDLER_VERSION='999.999.999' #{bundled_app("bin/bundle")} install"
+ sys_exec "#{bundled_app("bin/bundle")} install", "BUNDLER_VERSION" => "999.999.999"
expect(exitstatus).to eq(42) if exitstatus
expect(last_command.stderr).to include("Activating bundler (999.999.999) failed:").
and include("To install the version of bundler this project requires, run `gem install bundler -v '999.999.999'`")
@@ -179,8 +141,6 @@ RSpec.describe "bundle binstubs <gem>" do
end
context "when a lockfile exists with a locked bundler version" do
- let(:system_bundler_version) { Bundler::VERSION }
-
it "runs the correct version of bundler when the version is newer" do
lockfile lockfile.gsub(system_bundler_version, "999.999.999")
sys_exec "#{bundled_app("bin/bundle")} install"
@@ -236,13 +196,7 @@ RSpec.describe "bundle binstubs <gem>" do
let(:system_bundler_version) { :bundler }
it "loads all gems" do
sys_exec! bundled_app("bin/print_loaded_gems").to_s
- # RG < 2.0.14 didn't have a `Gem::Specification#default_gem?`
- # This is dirty detection for old RG versions.
- if File.dirname(Bundler.load.specs["bundler"][0].loaded_from) =~ %r{specifications/default}
- expect(out).to eq %(["prints_loaded_gems-1.0", "rack-1.2"])
- else
- expect(out).to eq %(["bundler-#{Bundler::VERSION}", "prints_loaded_gems-1.0", "rack-1.2"])
- end
+ expect(out).to eq %(["bundler-#{Bundler::VERSION}", "prints_loaded_gems-1.0", "rack-1.2"])
end
context "when requesting a different bundler version" do
@@ -324,7 +278,7 @@ RSpec.describe "bundle binstubs <gem>" do
bundle "binstubs doesnt_exist"
expect(exitstatus).to eq(7) if exitstatus
- expect(out).to include("Could not find gem 'doesnt_exist'.")
+ expect(err).to include("Could not find gem 'doesnt_exist'.")
end
end
@@ -396,8 +350,8 @@ RSpec.describe "bundle binstubs <gem>" do
expect(bundled_app("bin/rackup")).to exist
expect(File.read(bundled_app("bin/rackup"))).to eq("OMG")
- expect(out).to include("Skipped rackup")
- expect(out).to include("overwrite skipped stubs, use --force")
+ expect(err).to include("Skipped rackup")
+ expect(err).to include("overwrite skipped stubs, use --force")
end
context "when using --force" do
@@ -428,8 +382,8 @@ RSpec.describe "bundle binstubs <gem>" do
G
bundle "binstubs rack-obama"
- expect(out).to include("rack-obama has no executables")
- expect(out).to include("rack has: rackup")
+ expect(err).to include("rack-obama has no executables")
+ expect(err).to include("rack has: rackup")
end
it "works if child gems don't have bins" do
@@ -439,7 +393,7 @@ RSpec.describe "bundle binstubs <gem>" do
G
bundle "binstubs actionpack"
- expect(out).to include("no executables for the gem actionpack")
+ expect(err).to include("no executables for the gem actionpack")
end
it "works if the gem has development dependencies" do
@@ -449,7 +403,7 @@ RSpec.describe "bundle binstubs <gem>" do
G
bundle "binstubs with_development_dependency"
- expect(out).to include("no executables for the gem with_development_dependency")
+ expect(err).to include("no executables for the gem with_development_dependency")
end
end
@@ -460,7 +414,7 @@ RSpec.describe "bundle binstubs <gem>" do
gem "rack"
G
- bundle "config auto_install 1"
+ bundle "config set auto_install 1"
bundle "binstubs rack"
expect(out).to include("Installing rack 1.0.0")
expect(the_bundle).to include_gems "rack 1.0.0"
@@ -472,7 +426,7 @@ RSpec.describe "bundle binstubs <gem>" do
gem "rack"
G
- bundle "config auto_install 1"
+ bundle "config set auto_install 1"
bundle "binstubs rack", :env => { "BUNDLE_INSTALL" => 1 }
expect(out).not_to include("Installing rack 1.0.0")
end
diff --git a/spec/bundler/commands/check_spec.rb b/spec/bundler/commands/check_spec.rb
index 890f4b1356..7114610644 100644
--- a/spec/bundler/commands/check_spec.rb
+++ b/spec/bundler/commands/check_spec.rb
@@ -58,7 +58,7 @@ RSpec.describe "bundle check" do
G
bundle :check
- expect(out).to include("Bundler can't satisfy your Gemfile's dependencies.")
+ expect(err).to include("Bundler can't satisfy your Gemfile's dependencies.")
end
it "prints a generic error if a Gemfile.lock does not exist and a toplevel dependency does not exist" do
@@ -69,7 +69,7 @@ RSpec.describe "bundle check" do
bundle :check
expect(exitstatus).to be > 0 if exitstatus
- expect(out).to include("Bundler can't satisfy your Gemfile's dependencies.")
+ expect(err).to include("Bundler can't satisfy your Gemfile's dependencies.")
end
it "prints a generic message if you changed your lockfile" do
@@ -89,7 +89,7 @@ RSpec.describe "bundle check" do
G
bundle :check
- expect(out).to include("Bundler can't satisfy your Gemfile's dependencies.")
+ expect(err).to include("Bundler can't satisfy your Gemfile's dependencies.")
end
it "remembers --without option from install", :bundler => "< 3" do
@@ -106,7 +106,7 @@ RSpec.describe "bundle check" do
end
it "uses the without setting" do
- bundle! "config without foo"
+ bundle! "config set without foo"
install_gemfile! <<-G
source "file://#{gem_repo1}"
group :foo do
@@ -132,7 +132,7 @@ RSpec.describe "bundle check" do
G
bundle "check"
- expect(out).to include("* rack (1.0.0)")
+ expect(err).to include("* rack (1.0.0)")
expect(exitstatus).to eq(1) if exitstatus
end
@@ -201,13 +201,13 @@ RSpec.describe "bundle check" do
it "outputs an error when the default Gemfile is not found" do
bundle :check
expect(exitstatus).to eq(10) if exitstatus
- expect(out).to include("Could not locate Gemfile")
+ expect(err).to include("Could not locate Gemfile")
end
it "does not output fatal error message" do
bundle :check
expect(exitstatus).to eq(10) if exitstatus
- expect(out).not_to include("Unfortunately, a fatal error has occurred. ")
+ expect(err).not_to include("Unfortunately, a fatal error has occurred. ")
end
it "should not crash when called multiple times on a new machine" do
@@ -269,7 +269,7 @@ RSpec.describe "bundle check" do
bundle "check --path vendor/bundle"
expect(exitstatus).to eq(1) if exitstatus
- expect(out).to match(/The following gems are missing/)
+ expect(err).to match(/The following gems are missing/)
end
end
@@ -292,8 +292,8 @@ RSpec.describe "bundle check" do
it "shows what is missing with the current Gemfile if it is not satisfied" do
simulate_new_machine
bundle :check
- expect(out).to match(/The following gems are missing/)
- expect(out).to include("* rack (1.0")
+ expect(err).to match(/The following gems are missing/)
+ expect(err).to include("* rack (1.0")
end
end
diff --git a/spec/bundler/commands/clean_spec.rb b/spec/bundler/commands/clean_spec.rb
index e1f007fc35..0053947c85 100644
--- a/spec/bundler/commands/clean_spec.rb
+++ b/spec/bundler/commands/clean_spec.rb
@@ -142,7 +142,7 @@ RSpec.describe "bundle clean" do
bundle :clean
digest = Digest(:SHA1).hexdigest(git_path.to_s)
- cache_path = Bundler.bundler_major_version < 3 ? vendored_gems("cache/bundler/git/foo-1.0-#{digest}") : home(".bundle/cache/git/foo-1.0-#{digest}")
+ cache_path = Bundler::VERSION.start_with?("2.") ? vendored_gems("cache/bundler/git/foo-1.0-#{digest}") : home(".bundle/cache/git/foo-1.0-#{digest}")
expect(cache_path).to exist
end
@@ -201,7 +201,7 @@ RSpec.describe "bundle clean" do
update_git "foo", :path => lib_path("foo-bar")
revision2 = revision_for(lib_path("foo-bar"))
- bundle! "update", :all => bundle_update_requires_all?
+ bundle! "update", :all => true
bundle! :clean
expect(out).to include("Removing foo-bar (#{revision[0..11]})")
@@ -276,7 +276,7 @@ RSpec.describe "bundle clean" do
end
it "displays an error when used without --path" do
- bundle! "config path.system true"
+ bundle! "config set path.system true"
install_gemfile <<-G
source "file://#{gem_repo1}"
@@ -286,7 +286,7 @@ RSpec.describe "bundle clean" do
bundle :clean
expect(exitstatus).to eq(15) if exitstatus
- expect(out).to include("--force")
+ expect(err).to include("--force")
end
# handling bundle clean upgrade path from the pre's
@@ -320,9 +320,7 @@ RSpec.describe "bundle clean" do
end
it "does not call clean automatically when using system gems" do
- bundle! "config path.system true"
-
- bundle! :config
+ bundle! "config set path.system true"
install_gemfile! <<-G
source "file://#{gem_repo1}"
@@ -331,8 +329,6 @@ RSpec.describe "bundle clean" do
gem "rack"
G
- bundle! "info thin"
-
install_gemfile! <<-G
source "file://#{gem_repo1}"
@@ -378,7 +374,7 @@ RSpec.describe "bundle clean" do
build_gem "foo", "1.0.1"
end
- bundle! "update", :all => bundle_update_requires_all?
+ bundle! "update", :all => true
should_have_gems "foo-1.0.1"
should_not_have_gems "foo-1.0"
@@ -441,12 +437,12 @@ RSpec.describe "bundle clean" do
build_gem "foo", "1.0.1"
end
- bundle! :update, :all => bundle_update_requires_all?
+ bundle! :update, :all => true
should_have_gems "foo-1.0", "foo-1.0.1"
end
it "does not clean on bundle update when using --system" do
- bundle! "config path.system true"
+ bundle! "config set path.system true"
build_repo2
@@ -460,7 +456,7 @@ RSpec.describe "bundle clean" do
update_repo2 do
build_gem "foo", "1.0.1"
end
- bundle! :update, :all => bundle_update_requires_all?
+ bundle! :update, :all => true
gem = ruby_core? ? ENV["BUNDLE_GEM"] : "gem"
sys_exec! "#{gem} list"
@@ -468,7 +464,7 @@ RSpec.describe "bundle clean" do
end
it "cleans system gems when --force is used" do
- bundle! "config path.system true"
+ bundle! "config set path.system true"
gemfile <<-G
source "file://#{gem_repo1}"
@@ -519,8 +515,8 @@ RSpec.describe "bundle clean" do
bundle :clean, :force => true
- expect(out).to include(system_gem_path.to_s)
- expect(out).to include("grant write permissions")
+ expect(err).to include(system_gem_path.to_s)
+ expect(err).to include("grant write permissions")
gem = ruby_core? ? ENV["BUNDLE_GEM"] : "gem"
sys_exec "#{gem} list"
@@ -560,7 +556,7 @@ RSpec.describe "bundle clean" do
end
it "when using --force on system gems, it doesn't remove binaries" do
- bundle! "config path.system true"
+ bundle! "config set path.system true"
build_repo2
update_repo2 do
@@ -650,8 +646,6 @@ RSpec.describe "bundle clean" do
bundle :install
- bundle "configuration --delete path"
-
bundle "clean --dry-run"
expect(out).not_to include("Removing foo (1.0)")
@@ -671,7 +665,7 @@ RSpec.describe "bundle clean" do
G
bundle "install", forgotten_command_line_options(:path => "vendor/bundle", :clean => false)
- bundle "config dry_run false"
+ bundle "config set dry_run false"
gemfile <<-G
source "file://#{gem_repo1}"
@@ -709,14 +703,14 @@ RSpec.describe "bundle clean" do
gem "weakling"
G
- bundle! "config auto_install 1"
+ bundle! "config set auto_install 1"
bundle! :clean
expect(out).to include("Installing weakling 0.0.3")
should_have_gems "thin-1.0", "rack-1.0.0", "weakling-0.0.3"
should_not_have_gems "foo-1.0"
end
- it "doesn't remove extensions artifacts from bundled git gems after clean", :ruby_repo, :rubygems => "2.2" do
+ it "doesn't remove extensions artifacts from bundled git gems after clean", :ruby_repo do
build_git "very_simple_git_binary", &:add_c_extension
revision = revision_for(lib_path("very_simple_git_binary-1.0"))
@@ -738,7 +732,7 @@ RSpec.describe "bundle clean" do
expect(vendored_gems("bundler/gems/very_simple_git_binary-1.0-#{revision[0..11]}")).to exist
end
- it "removes extension directories", :ruby_repo, :rubygems => "2.2" do
+ it "removes extension directories", :ruby_repo do
gemfile <<-G
source "file://#{gem_repo1}"
@@ -772,4 +766,43 @@ RSpec.describe "bundle clean" do
expect(very_simple_binary_extensions_dir).not_to exist
expect(simple_binary_extensions_dir).to exist
end
+
+ it "removes git extension directories", :ruby_repo do
+ build_git "very_simple_git_binary", &:add_c_extension
+
+ revision = revision_for(lib_path("very_simple_git_binary-1.0"))
+ short_revision = revision[0..11]
+
+ gemfile <<-G
+ source "file://#{gem_repo1}"
+
+ gem "thin"
+ gem "very_simple_git_binary", :git => "#{lib_path("very_simple_git_binary-1.0")}", :ref => "#{revision}"
+ G
+
+ bundle! "install", forgotten_command_line_options(:path => "vendor/bundle")
+
+ very_simple_binary_extensions_dir =
+ Pathname.glob("#{vendored_gems}/bundler/gems/extensions/*/*/very_simple_git_binary-1.0-#{short_revision}").first
+
+ expect(very_simple_binary_extensions_dir).to exist
+
+ gemfile <<-G
+ gem "very_simple_git_binary", :git => "#{lib_path("very_simple_git_binary-1.0")}", :ref => "#{revision}"
+ G
+
+ bundle! "install"
+ bundle! :clean
+ expect(out).to include("Removing thin (1.0)")
+ expect(very_simple_binary_extensions_dir).to exist
+
+ gemfile <<-G
+ G
+
+ bundle! "install"
+ bundle! :clean
+ expect(out).to eq("Removing very_simple_git_binary-1.0 (#{short_revision})")
+
+ expect(very_simple_binary_extensions_dir).not_to exist
+ end
end
diff --git a/spec/bundler/commands/config_spec.rb b/spec/bundler/commands/config_spec.rb
index 9e49357465..84f882b410 100644
--- a/spec/bundler/commands/config_spec.rb
+++ b/spec/bundler/commands/config_spec.rb
@@ -1,18 +1,11 @@
# frozen_string_literal: true
RSpec.describe ".bundle/config" do
- before :each do
- gemfile <<-G
- source "file://#{gem_repo1}"
- gem "rack", "1.0.0"
- G
- end
-
describe "config" do
- before { bundle "config foo bar" }
+ before { bundle "config set foo bar" }
it "prints a detailed report of local and user configuration" do
- bundle "config"
+ bundle "config list"
expect(out).to include("Settings are listed in order of priority. The top value will be used")
expect(out).to include("foo\nSet for the current user")
@@ -21,28 +14,35 @@ RSpec.describe ".bundle/config" do
context "given --parseable flag" do
it "prints a minimal report of local and user configuration" do
- bundle "config --parseable"
+ bundle "config list --parseable"
expect(out).to include("foo=bar")
end
context "with global config" do
it "prints config assigned to local scope" do
- bundle "config --local foo bar2"
- bundle "config --parseable"
+ bundle "config set --local foo bar2"
+ bundle "config list --parseable"
expect(out).to include("foo=bar2")
end
end
context "with env overwrite" do
it "prints config with env" do
- bundle "config --parseable", :env => { "BUNDLE_FOO" => "bar3" }
+ bundle "config list --parseable", :env => { "BUNDLE_FOO" => "bar3" }
expect(out).to include("foo=bar3")
end
end
end
end
- describe "BUNDLE_APP_CONFIG" do
+ describe "location" do
+ before :each do
+ gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack", "1.0.0"
+ G
+ end
+
it "can be moved with an environment variable" do
ENV["BUNDLE_APP_CONFIG"] = tmp("foo/bar").to_s
bundle "install", forgotten_command_line_options(:path => "vendor/bundle")
@@ -66,24 +66,29 @@ RSpec.describe ".bundle/config" do
end
describe "global" do
- before(:each) { bundle :install }
+ before(:each) do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack", "1.0.0"
+ G
+ end
it "is the default" do
- bundle "config foo global"
+ bundle "config set foo global"
run "puts Bundler.settings[:foo]"
expect(out).to eq("global")
end
it "can also be set explicitly" do
- bundle! "config --global foo global"
+ bundle! "config set --global foo global"
run! "puts Bundler.settings[:foo]"
expect(out).to eq("global")
end
it "has lower precedence than local" do
- bundle "config --local foo local"
+ bundle "config set --local foo local"
- bundle "config --global foo global"
+ bundle "config set --global foo global"
expect(out).to match(/Your application has set foo to "local"/)
run "puts Bundler.settings[:foo]"
@@ -94,7 +99,7 @@ RSpec.describe ".bundle/config" do
begin
ENV["BUNDLE_FOO"] = "env"
- bundle "config --global foo global"
+ bundle "config set --global foo global"
expect(out).to match(/You have a bundler environment variable for foo set to "env"/)
run "puts Bundler.settings[:foo]"
@@ -105,16 +110,16 @@ RSpec.describe ".bundle/config" do
end
it "can be deleted" do
- bundle "config --global foo global"
- bundle "config --delete foo"
+ bundle "config set --global foo global"
+ bundle "config unset foo"
run "puts Bundler.settings[:foo] == nil"
expect(out).to eq("true")
end
it "warns when overriding" do
- bundle "config --global foo previous"
- bundle "config --global foo global"
+ bundle "config set --global foo previous"
+ bundle "config set --global foo global"
expect(out).to match(/You are replacing the current global value of foo/)
run "puts Bundler.settings[:foo]"
@@ -122,8 +127,8 @@ RSpec.describe ".bundle/config" do
end
it "does not warn when using the same value twice" do
- bundle "config --global foo value"
- bundle "config --global foo value"
+ bundle "config set --global foo value"
+ bundle "config set --global foo value"
expect(out).not_to match(/You are replacing the current global value of foo/)
run "puts Bundler.settings[:foo]"
@@ -131,22 +136,22 @@ RSpec.describe ".bundle/config" do
end
it "expands the path at time of setting" do
- bundle "config --global local.foo .."
+ bundle "config set --global local.foo .."
run "puts Bundler.settings['local.foo']"
expect(out).to eq(File.expand_path(Dir.pwd + "/.."))
end
it "saves with parseable option" do
- bundle "config --global --parseable foo value"
+ bundle "config set --global --parseable foo value"
expect(out).to eq("foo=value")
run "puts Bundler.settings['foo']"
expect(out).to eq("value")
end
context "when replacing a current value with the parseable flag" do
- before { bundle "config --global foo value" }
+ before { bundle "config set --global foo value" }
it "prints the current value in a parseable format" do
- bundle "config --global --parseable foo value2"
+ bundle "config set --global --parseable foo value2"
expect(out).to eq "foo=value2"
run "puts Bundler.settings['foo']"
expect(out).to eq("value2")
@@ -155,10 +160,15 @@ RSpec.describe ".bundle/config" do
end
describe "local" do
- before(:each) { bundle :install }
+ before(:each) do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack", "1.0.0"
+ G
+ end
it "can also be set explicitly" do
- bundle "config --local foo local"
+ bundle "config set --local foo local"
run "puts Bundler.settings[:foo]"
expect(out).to eq("local")
end
@@ -166,7 +176,7 @@ RSpec.describe ".bundle/config" do
it "has higher precedence than env" do
begin
ENV["BUNDLE_FOO"] = "env"
- bundle "config --local foo local"
+ bundle "config set --local foo local"
run "puts Bundler.settings[:foo]"
expect(out).to eq("local")
@@ -176,16 +186,16 @@ RSpec.describe ".bundle/config" do
end
it "can be deleted" do
- bundle "config --local foo local"
- bundle "config --delete foo"
+ bundle "config set --local foo local"
+ bundle "config unset foo"
run "puts Bundler.settings[:foo] == nil"
expect(out).to eq("true")
end
it "warns when overriding" do
- bundle "config --local foo previous"
- bundle "config --local foo local"
+ bundle "config set --local foo previous"
+ bundle "config set --local foo local"
expect(out).to match(/You are replacing the current local value of foo/)
run "puts Bundler.settings[:foo]"
@@ -193,14 +203,14 @@ RSpec.describe ".bundle/config" do
end
it "expands the path at time of setting" do
- bundle "config --local local.foo .."
+ bundle "config set --local local.foo .."
run "puts Bundler.settings['local.foo']"
expect(out).to eq(File.expand_path(Dir.pwd + "/.."))
end
it "can be deleted with parseable option" do
- bundle "config --local foo value"
- bundle "config --delete --parseable foo"
+ bundle "config set --local foo value"
+ bundle "config unset --parseable foo"
expect(out).to eq ""
run "puts Bundler.settings['foo'] == nil"
expect(out).to eq("true")
@@ -208,7 +218,12 @@ RSpec.describe ".bundle/config" do
end
describe "env" do
- before(:each) { bundle :install }
+ before(:each) do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack", "1.0.0"
+ G
+ end
it "can set boolean properties via the environment" do
ENV["BUNDLE_FROZEN"] = "true"
@@ -247,39 +262,44 @@ RSpec.describe ".bundle/config" do
describe "parseable option" do
it "prints an empty string" do
- bundle "config foo --parseable"
+ bundle "config get foo --parseable"
expect(out).to eq ""
end
it "only prints the value of the config" do
- bundle "config foo local"
- bundle "config foo --parseable"
+ bundle "config set foo local"
+ bundle "config get foo --parseable"
expect(out).to eq "foo=local"
end
it "can print global config" do
- bundle "config --global bar value"
- bundle "config bar --parseable"
+ bundle "config set --global bar value"
+ bundle "config get bar --parseable"
expect(out).to eq "bar=value"
end
it "prefers local config over global" do
- bundle "config --local bar value2"
- bundle "config --global bar value"
- bundle "config bar --parseable"
+ bundle "config set --local bar value2"
+ bundle "config set --global bar value"
+ bundle "config get bar --parseable"
expect(out).to eq "bar=value2"
end
end
describe "gem mirrors" do
- before(:each) { bundle :install }
+ before(:each) do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack", "1.0.0"
+ G
+ end
it "configures mirrors using keys with `mirror.`" do
- bundle "config --local mirror.http://gems.example.org http://gem-mirror.example.org"
+ bundle "config set --local mirror.http://gems.example.org http://gem-mirror.example.org"
run(<<-E)
Bundler.settings.gem_mirrors.each do |k, v|
puts "\#{k} => \#{v}"
@@ -297,26 +317,26 @@ E
end
it "saves quotes" do
- bundle "config foo something\\'"
+ bundle "config set foo something\\'"
run "puts Bundler.settings[:foo]"
expect(out).to eq("something'")
end
- it "doesn't return quotes around values", :ruby => "1.9" do
- bundle "config foo '1'"
+ it "doesn't return quotes around values" do
+ bundle "config set foo '1'"
run "puts Bundler.settings.send(:global_config_file).read"
expect(out).to include('"1"')
run "puts Bundler.settings[:foo]"
expect(out).to eq("1")
end
- it "doesn't duplicate quotes around values", :if => (RUBY_VERSION >= "2.1") do
+ it "doesn't duplicate quotes around values" do
bundled_app(".bundle").mkpath
File.open(bundled_app(".bundle/config"), "w") do |f|
f.write 'BUNDLE_FOO: "$BUILD_DIR"'
end
- bundle "config bar baz"
+ bundle "config set bar baz"
run "puts Bundler.settings.send(:local_config_file).read"
# Starting in Ruby 2.1, YAML automatically adds double quotes
@@ -325,12 +345,12 @@ E
end
it "doesn't duplicate quotes around long wrapped values" do
- bundle "config foo #{long_string}"
+ bundle "config set foo #{long_string}"
run "puts Bundler.settings[:foo]"
expect(out).to eq(long_string)
- bundle "config bar baz"
+ bundle "config set bar baz"
run "puts Bundler.settings[:foo]"
expect(out).to eq(long_string)
@@ -338,7 +358,12 @@ E
end
describe "very long lines" do
- before(:each) { bundle :install }
+ before(:each) do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack", "1.0.0"
+ G
+ end
let(:long_string) do
"--with-xml2-include=/usr/pkg/include/libxml2 --with-xml2-lib=/usr/pkg/lib " \
@@ -351,17 +376,103 @@ E
end
it "doesn't wrap values" do
- bundle "config foo #{long_string}"
+ bundle "config set foo #{long_string}"
run "puts Bundler.settings[:foo]"
expect(out).to match(long_string)
end
it "can read wrapped unquoted values" do
- bundle "config foo #{long_string_without_special_characters}"
+ bundle "config set foo #{long_string_without_special_characters}"
run "puts Bundler.settings[:foo]"
expect(out).to match(long_string_without_special_characters)
end
end
+
+ describe "subcommands" do
+ it "list" do
+ bundle! "config list"
+ expect(last_command.stdout).to eq "Settings are listed in order of priority. The top value will be used.\nspec_run\nSet via BUNDLE_SPEC_RUN: \"true\""
+
+ bundle! "config list", :parseable => true
+ expect(last_command.stdout).to eq "spec_run=true"
+ end
+
+ it "get" do
+ ENV["BUNDLE_BAR"] = "bar_val"
+
+ bundle! "config get foo"
+ expect(last_command.stdout).to eq "Settings for `foo` in order of priority. The top value will be used\nYou have not configured a value for `foo`"
+
+ ENV["BUNDLE_FOO"] = "foo_val"
+
+ bundle! "config get foo --parseable"
+ expect(last_command.stdout).to eq "foo=foo_val"
+
+ bundle! "config get foo"
+ expect(last_command.stdout).to eq "Settings for `foo` in order of priority. The top value will be used\nSet via BUNDLE_FOO: \"foo_val\""
+ end
+
+ it "set" do
+ bundle! "config set foo 1"
+ expect(last_command.stdout).to eq ""
+
+ bundle! "config set --local foo 2"
+ expect(last_command.stdout).to eq ""
+
+ bundle! "config set --global foo 3"
+ expect(last_command.stdout).to eq "Your application has set foo to \"2\". This will override the global value you are currently setting"
+
+ bundle! "config set --parseable --local foo 4"
+ expect(last_command.stdout).to eq "foo=4"
+
+ bundle! "config set --local foo 4.1"
+ expect(last_command.stdout).to eq "You are replacing the current local value of foo, which is currently \"4\""
+
+ bundle "config set --global --local foo 5"
+ expect(last_command).to be_failure
+ expect(last_command.bundler_err).to eq "The options global and local were specified. Please only use one of the switches at a time."
+ end
+
+ it "unset" do
+ bundle! "config unset foo"
+ expect(last_command.stdout).to eq ""
+
+ bundle! "config set foo 1"
+ bundle! "config unset foo --parseable"
+ expect(last_command.stdout).to eq ""
+
+ bundle! "config set --local foo 1"
+ bundle! "config set --global foo 2"
+
+ bundle! "config unset foo"
+ expect(last_command.stdout).to eq ""
+ expect(bundle!("config get foo")).to eq "Settings for `foo` in order of priority. The top value will be used\nYou have not configured a value for `foo`"
+
+ bundle! "config set --local foo 1"
+ bundle! "config set --global foo 2"
+
+ bundle! "config unset foo --local"
+ expect(last_command.stdout).to eq ""
+ expect(bundle!("config get foo")).to eq "Settings for `foo` in order of priority. The top value will be used\nSet for the current user (#{home(".bundle/config")}): \"2\""
+ bundle! "config unset foo --global"
+ expect(last_command.stdout).to eq ""
+ expect(bundle!("config get foo")).to eq "Settings for `foo` in order of priority. The top value will be used\nYou have not configured a value for `foo`"
+
+ bundle! "config set --local foo 1"
+ bundle! "config set --global foo 2"
+
+ bundle! "config unset foo --global"
+ expect(last_command.stdout).to eq ""
+ expect(bundle!("config get foo")).to eq "Settings for `foo` in order of priority. The top value will be used\nSet for your local app (#{bundled_app(".bundle/config")}): \"1\""
+ bundle! "config unset foo --local"
+ expect(last_command.stdout).to eq ""
+ expect(bundle!("config get foo")).to eq "Settings for `foo` in order of priority. The top value will be used\nYou have not configured a value for `foo`"
+
+ bundle "config unset foo --local --global"
+ expect(last_command).to be_failure
+ expect(last_command.bundler_err).to eq "The options global and local were specified. Please only use one of the switches at a time."
+ end
+ end
end
RSpec.describe "setting gemfile via config" do
@@ -374,10 +485,10 @@ RSpec.describe "setting gemfile via config" do
G
end
- bundle "config --local gemfile #{bundled_app("NotGemfile")}"
+ bundle "config set --local gemfile #{bundled_app("NotGemfile")}"
expect(File.exist?(".bundle/config")).to eq(true)
- bundle "config"
+ bundle "config list"
expect(out).to include("NotGemfile")
end
end
diff --git a/spec/bundler/commands/console_spec.rb b/spec/bundler/commands/console_spec.rb
index 05b0a6c1e4..cba618db80 100644
--- a/spec/bundler/commands/console_spec.rb
+++ b/spec/bundler/commands/console_spec.rb
@@ -31,7 +31,7 @@ RSpec.describe "bundle console", :bundler => "< 3" do
source "file://#{gem_repo1}"
gem "pry"
G
- bundle "config console pry"
+ bundle "config set console pry"
bundle "console" do |input, _, _|
input.puts("__method__")
@@ -41,7 +41,7 @@ RSpec.describe "bundle console", :bundler => "< 3" do
end
it "falls back to IRB if the other REPL isn't available" do
- bundle "config console pry"
+ bundle "config set console pry"
# make sure pry isn't there
bundle "console" do |input, _, _|
@@ -94,7 +94,7 @@ RSpec.describe "bundle console", :bundler => "< 3" do
gem "foo"
G
- bundle "config auto_install 1"
+ bundle "config set auto_install 1"
bundle :console do |input, _, _|
input.puts("puts 'hello'")
input.puts("exit")
diff --git a/spec/bundler/commands/exec_spec.rb b/spec/bundler/commands/exec_spec.rb
index 2e3cb6621e..a95383ee97 100644
--- a/spec/bundler/commands/exec_spec.rb
+++ b/spec/bundler/commands/exec_spec.rb
@@ -38,7 +38,7 @@ RSpec.describe "bundle exec" do
gem "rack"
G
- bundle "exec 'cd #{tmp("gems")} && rackup'", :env => { :RUBYOPT => "-r#{spec_dir.join("support/hax")}" }
+ bundle "exec 'cd #{tmp("gems")} && rackup'"
expect(out).to include("1.0.0")
end
@@ -51,7 +51,7 @@ RSpec.describe "bundle exec" do
it "works when exec'ing to ruby" do
install_gemfile 'gem "rack"'
- bundle "exec ruby -e 'puts %{hi}'", :env => { :RUBYOPT => "-r#{spec_dir.join("support/hax")}" }
+ bundle "exec ruby -e 'puts %{hi}'"
expect(out).to eq("hi")
end
@@ -79,30 +79,23 @@ RSpec.describe "bundle exec" do
require 'tempfile'
io = Tempfile.new("io-test-fd")
args = %W[#{Gem.ruby} -I#{lib} #{bindir.join("bundle")} exec --keep-file-descriptors #{Gem.ruby} #{command.path} \#{io.to_i}]
- args << { io.to_i => io } if RUBY_VERSION >= "2.0"
+ args << { io.to_i => io }
exec(*args)
end
G
install_gemfile ""
- with_env_vars "RUBYOPT" => "-r#{spec_dir.join("support/hax")}" do
- sys_exec "#{Gem.ruby} #{command.path}"
- end
-
- if Bundler.current_ruby.ruby_2?
- expect(out).to eq("")
- else
- expect(out).to eq("Ruby version #{RUBY_VERSION} defaults to keeping non-standard file descriptors on Kernel#exec.")
- end
+ sys_exec "#{Gem.ruby} #{command.path}"
- expect(err).to lack_errors
+ expect(out).to eq("")
+ expect(last_command.stderr).to be_empty
end
it "accepts --keep-file-descriptors" do
install_gemfile ""
bundle "exec --keep-file-descriptors echo foobar"
- expect(err).to lack_errors
+ expect(last_command.stderr).to be_empty
end
it "can run a command named --verbose" do
@@ -147,6 +140,112 @@ RSpec.describe "bundle exec" do
end
end
+ context "with default gems" do
+ let(:system_gems_to_install) { [] }
+
+ let(:default_irb_version) { ruby "gem 'irb', '< 999999'; require 'irb'; puts IRB::VERSION" }
+
+ context "when not specified in Gemfile" do
+ before do
+ skip "irb isn't a default gem" if default_irb_version.empty?
+
+ install_gemfile ""
+ end
+
+ it "uses version provided by ruby" do
+ bundle! "exec irb --version"
+
+ expect(out).to include(default_irb_version)
+ expect(last_command.stderr).to be_empty
+ end
+ end
+
+ context "when specified in Gemfile directly" do
+ let(:specified_irb_version) { "0.9.6" }
+
+ before do
+ skip "irb isn't a default gem" if default_irb_version.empty?
+
+ build_repo2 do
+ build_gem "irb", specified_irb_version do |s|
+ s.executables = "irb"
+ end
+ end
+
+ install_gemfile <<-G
+ source "file://#{gem_repo2}"
+ gem "irb", "#{specified_irb_version}"
+ G
+ end
+
+ it "uses version specified" do
+ bundle! "exec irb --version"
+
+ expect(out).to include(specified_irb_version)
+ expect(last_command.stderr).to be_empty
+ end
+ end
+
+ context "when specified in Gemfile indirectly" do
+ let(:indirect_irb_version) { "0.9.6" }
+
+ before do
+ skip "irb isn't a default gem" if default_irb_version.empty?
+
+ build_repo2 do
+ build_gem "irb", indirect_irb_version do |s|
+ s.executables = "irb"
+ end
+
+ build_gem "gem_depending_on_old_irb" do |s|
+ s.add_dependency "irb", indirect_irb_version
+ end
+ end
+
+ install_gemfile <<-G
+ source "file://#{gem_repo2}"
+ gem "gem_depending_on_old_irb"
+ G
+
+ bundle! "exec irb --version"
+ end
+
+ it "uses resolved version" do
+ expect(out).to include(indirect_irb_version)
+ expect(last_command.stderr).to be_empty
+ end
+ end
+ end
+
+ it "warns about executable conflicts" do
+ build_repo2 do
+ build_gem "rack_two", "1.0.0" do |s|
+ s.executables = "rackup"
+ end
+ end
+
+ bundle "config set path.system true"
+
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack", "0.9.1"
+ G
+
+ Dir.chdir bundled_app2 do
+ install_gemfile bundled_app2("Gemfile"), <<-G
+ source "file://#{gem_repo2}"
+ gem "rack_two", "1.0.0"
+ G
+ end
+
+ bundle! "exec rackup"
+
+ expect(last_command.stderr).to eq(
+ "Bundler is using a binstub that was created for a different gem (rack).\n" \
+ "You should run `bundle binstub rack_two` to work around a system/bundle conflict."
+ )
+ end
+
it "handles gems installed with --without" do
install_gemfile <<-G, forgotten_command_line_options(:without => "middleware")
source "file://#{gem_repo1}"
@@ -201,8 +300,8 @@ RSpec.describe "bundle exec" do
bundle "exec foobarbaz"
expect(exitstatus).to eq(127) if exitstatus
- expect(out).to include("bundler: command not found: foobarbaz")
- expect(out).to include("Install missing gem executables with `bundle install`")
+ expect(err).to include("bundler: command not found: foobarbaz")
+ expect(err).to include("Install missing gem executables with `bundle install`")
end
it "errors nicely when the argument is not executable" do
@@ -213,7 +312,7 @@ RSpec.describe "bundle exec" do
bundle "exec touch foo"
bundle "exec ./foo"
expect(exitstatus).to eq(126) if exitstatus
- expect(out).to include("bundler: not executable: ./foo")
+ expect(err).to include("bundler: not executable: ./foo")
end
it "errors nicely when no arguments are passed" do
@@ -223,36 +322,22 @@ RSpec.describe "bundle exec" do
bundle "exec"
expect(exitstatus).to eq(128) if exitstatus
- expect(out).to include("bundler: exec needs a command to run")
+ expect(err).to include("bundler: exec needs a command to run")
end
- it "raises a helpful error when exec'ing to something outside of the bundle", :ruby_repo, :rubygems => ">= 2.5.2" do
- bundle! "config clean false" # want to keep the rackup binstub
+ it "raises a helpful error when exec'ing to something outside of the bundle", :ruby_repo do
+ bundle! "config set clean false" # want to keep the rackup binstub
install_gemfile! <<-G
source "file://#{gem_repo1}"
gem "with_license"
G
[true, false].each do |l|
- bundle! "config disable_exec_load #{l}"
+ bundle! "config set disable_exec_load #{l}"
bundle "exec rackup"
expect(last_command.stderr).to include "can't find executable rackup for gem rack. rack is not currently included in the bundle, perhaps you meant to add it to your Gemfile?"
end
end
- # Different error message on old RG versions (before activate_bin_path) because they
- # called `Kernel#gem` directly
- it "raises a helpful error when exec'ing to something outside of the bundle", :rubygems => "< 2.5.2" do
- install_gemfile! <<-G
- source "file://#{gem_repo1}"
- gem "with_license"
- G
- [true, false].each do |l|
- bundle! "config disable_exec_load #{l}"
- bundle "exec rackup", :env => { :RUBYOPT => "-r#{spec_dir.join("support/hax")}" }
- expect(last_command.stderr).to include "rack is not part of the bundle. Add it to your Gemfile."
- end
- end
-
describe "with help flags" do
each_prefix = proc do |string, &blk|
1.upto(string.length) {|l| blk.call(string[0, l]) }
@@ -350,14 +435,14 @@ RSpec.describe "bundle exec" do
end
it "works when unlocked" do
- bundle "exec 'cd #{tmp("gems")} && rackup'", :env => { :RUBYOPT => "-r#{spec_dir.join("support/hax")}" }
+ bundle "exec 'cd #{tmp("gems")} && rackup'"
expect(out).to eq("1.0.0")
expect(out).to include("1.0.0")
end
it "works when locked" do
expect(the_bundle).to be_locked
- bundle "exec 'cd #{tmp("gems")} && rackup'", :env => { :RUBYOPT => "-r#{spec_dir.join("support/hax")}" }
+ bundle "exec 'cd #{tmp("gems")} && rackup'"
expect(out).to include("1.0.0")
end
end
@@ -440,13 +525,13 @@ RSpec.describe "bundle exec" do
gem "foo"
G
- bundle "config auto_install 1"
+ bundle "config set auto_install 1"
bundle "exec rackup"
expect(out).to include("Installing foo 1.0")
end
describe "with gems bundled via :path with invalid gemspecs", :ruby_repo do
- it "outputs the gemspec validation errors", :rubygems => ">= 1.7.2" do
+ it "outputs the gemspec validation errors" do
build_lib "foo"
gemspec = lib_path("foo-1.0").join("foo.gemspec").to_s
@@ -467,8 +552,8 @@ RSpec.describe "bundle exec" do
bundle "exec irb"
- expect(err).to match("The gemspec at #{lib_path("foo-1.0").join("foo.gemspec")} is not valid")
- expect(err).to match('"TODO" is not a summary')
+ expect(last_command.stderr).to match("The gemspec at #{lib_path("foo-1.0").join("foo.gemspec")} is not valid")
+ expect(last_command.stderr).to match('"TODO" is not a summary')
end
end
@@ -483,7 +568,7 @@ RSpec.describe "bundle exec" do
Bundler.rubygems.extend(Monkey)
G
bundle "install --deployment"
- bundle "exec ruby -e '`#{bindir.join("bundler")} -v`; puts $?.success?'", :env => { :RUBYOPT => "-r#{spec_dir.join("support/hax")}" }
+ bundle "exec ruby -e '`#{bindir.join("bundler")} -v`; puts $?.success?'"
expect(out).to match("true")
end
end
@@ -516,14 +601,14 @@ RSpec.describe "bundle exec" do
let(:rack) { "RACK: 1.0.0" }
let(:process) do
title = "PROCESS: #{path}"
- title += " arg1 arg2" if RUBY_VERSION >= "2.1"
+ title += " arg1 arg2"
title
end
let(:exit_code) { 0 }
let(:expected) { [exec, args, rack, process].join("\n") }
let(:expected_err) { "" }
- subject { bundle "exec #{path} arg1 arg2", :env => { :RUBYOPT => "-r#{spec_dir.join("support/hax")}" } }
+ subject { bundle "exec #{path} arg1 arg2" }
shared_examples_for "it runs" do
it "like a normally executed executable" do
@@ -553,15 +638,10 @@ RSpec.describe "bundle exec" do
let(:executable) do
ex = super()
ex << "\n"
- if LessThanProc.with(RUBY_VERSION).call("1.9")
- # Ruby < 1.9 needs a flush for a exit by signal, later
- # rubies do not
- ex << "STDOUT.flush\n"
- end
ex << "raise SignalException, 'SIGTERM'\n"
ex
end
- let(:expected_err) { ENV["TRAVIS"] ? "Terminated" : "" }
+ let(:expected_err) { "" }
let(:exit_code) do
# signal mask 128 + plus signal 15 -> TERM
# this is specified by C99
@@ -612,7 +692,8 @@ RSpec.describe "bundle exec" do
end
let(:exit_code) { Bundler::GemNotFound.new.status_code }
- let(:expected) { <<-EOS.strip }
+ let(:expected) { "" }
+ let(:expected_err) { <<-EOS.strip }
\e[31mCould not find gem 'rack (= 2)' in any of the gem sources listed in your Gemfile.\e[0m
\e[33mRun `bundle install` to install missing gems.\e[0m
EOS
@@ -629,7 +710,8 @@ RSpec.describe "bundle exec" do
end
let(:exit_code) { Bundler::GemNotFound.new.status_code }
- let(:expected) { <<-EOS.strip }
+ let(:expected) { "" }
+ let(:expected_err) { <<-EOS.strip }
\e[31mCould not find gem 'rack (= 2)' in locally installed gems.
The source contains 'rack' at: 1.0.0\e[0m
\e[33mRun `bundle install` to install missing gems.\e[0m
@@ -650,7 +732,7 @@ The source contains 'rack' at: 1.0.0\e[0m
let(:process) { "PROCESS: ruby #{path} arg1 arg2" }
before do
- bundle "config disable_exec_load true"
+ bundle "config set disable_exec_load true"
end
it_behaves_like "it runs"
@@ -674,21 +756,13 @@ __FILE__: #{path.to_s.inspect}
context "when the path is relative" do
let(:path) { super().relative_path_from(bundled_app) }
- if LessThanProc.with(RUBY_VERSION).call("1.9")
- pending "relative paths have ./ __FILE__"
- else
- it_behaves_like "it runs"
- end
+ it_behaves_like "it runs"
end
context "when the path is relative with a leading ./" do
let(:path) { Pathname.new("./#{super().relative_path_from(Pathname.pwd)}") }
- if LessThanProc.with(RUBY_VERSION).call("< 1.9")
- pending "relative paths with ./ have absolute __FILE__"
- else
- it_behaves_like "it runs"
- end
+ pending "relative paths with ./ have absolute __FILE__"
end
end
@@ -716,7 +790,7 @@ __FILE__: #{path.to_s.inspect}
end
RUBY
- it "receives the signal", :ruby => ">= 1.9.3" do
+ it "receives the signal" do
bundle!("exec #{path}") do |_, o, thr|
o.gets # Consumes 'Started' and ensures that thread has started
Process.kill("INT", thr.pid)
@@ -762,9 +836,7 @@ __FILE__: #{path.to_s.inspect}
bundle :install, :system_bundler => true, :path => "vendor/bundler"
end
- it "overrides disable_shared_gems so bundler can be found" do
- skip "bundler 1.16.x is not support with Ruby 2.6 on Travis CI" if RUBY_VERSION >= "2.6"
-
+ it "overrides disable_shared_gems so bundler can be found", :rubygems => ">= 2.6.2" do
system_gems :bundler
file = bundled_app("file_that_bundle_execs.rb")
create_file(file, <<-RB)
@@ -809,10 +881,7 @@ __FILE__: #{path.to_s.inspect}
expect(bundle!("exec #{file}", :artifice => nil)).to eq(expected)
expect(bundle!("exec bundle exec #{file}", :artifice => nil)).to eq(expected)
expect(bundle!("exec ruby #{file}", :artifice => nil)).to eq(expected)
- # Ignore expectaion for default bundler gem conflict.
- unless ENV["BUNDLER_SPEC_SUB_VERSION"]
- expect(run!(file.read, :artifice => nil)).to eq(expected)
- end
+ expect(run!(file.read, :artifice => nil)).to eq(expected)
end
# sanity check that we get the newer, custom version without bundler
diff --git a/spec/bundler/commands/help_spec.rb b/spec/bundler/commands/help_spec.rb
index 56b1b6f722..f4f90b9347 100644
--- a/spec/bundler/commands/help_spec.rb
+++ b/spec/bundler/commands/help_spec.rb
@@ -1,15 +1,6 @@
# frozen_string_literal: true
RSpec.describe "bundle help" do
- # RubyGems 1.4+ no longer load gem plugins so this test is no longer needed
- it "complains if older versions of bundler are installed", :rubygems => "< 1.4" do
- system_gems "bundler-0.8.1"
-
- bundle "help"
- expect(err).to include("older than 0.9")
- expect(err).to include("running `gem cleanup bundler`.")
- end
-
it "uses mann when available" do
with_fake_man do
bundle "help gemfile"
@@ -81,7 +72,7 @@ RSpec.describe "bundle help" do
with_fake_man do
bundle "instill -h"
end
- expect(out).to include('Could not find command "instill".')
+ expect(err).to include('Could not find command "instill".')
end
it "is called when only using the --help flag" do
diff --git a/spec/bundler/commands/info_spec.rb b/spec/bundler/commands/info_spec.rb
index a9ab8fc210..fc1d97b1da 100644
--- a/spec/bundler/commands/info_spec.rb
+++ b/spec/bundler/commands/info_spec.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
RSpec.describe "bundle info" do
- context "info from specific gem in gemfile" do
+ context "with a standard Gemfile" do
before do
install_gemfile <<-G
source "file://#{gem_repo1}"
@@ -9,23 +9,39 @@ RSpec.describe "bundle info" do
G
end
- it "prints information about the current gem" do
+ it "creates a Gemfile.lock when invoked with a gem name" do
+ FileUtils.rm("Gemfile.lock")
+
+ bundle "info rails"
+
+ expect(bundled_app("Gemfile.lock")).to exist
+ end
+
+ it "prints information if gem exists in bundle" do
bundle "info rails"
expect(out).to include "* rails (2.3.2)
\tSummary: This is just a fake gem for testing
-\tHomepage: http://example.com"
- expect(out).to match(%r{Path\: .*\/rails\-2\.3\.2})
+\tHomepage: http://example.com
+\tPath: #{default_bundle_path("gems", "rails-2.3.2")}"
end
- context "given a gem that is not installed" do
- it "prints missing gem error" do
- bundle "info foo"
- expect(out).to eq "Could not find gem 'foo'."
- end
+ it "prints path if gem exists in bundle" do
+ 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"
+ expect(out).to eq(root.to_s)
+ end
+
+ it "complains if gem not in bundle" do
+ bundle "info missing"
+ expect(err).to eq("Could not find gem 'missing'.")
end
context "given a default gem shippped in ruby", :ruby_repo do
- it "prints information about the default gem", :if => (RUBY_VERSION >= "2.0") do
+ it "prints information about the default gem" do
bundle "info rdoc"
expect(out).to include("* rdoc")
expect(out).to include("Default Gem: yes")
@@ -34,7 +50,7 @@ RSpec.describe "bundle info" do
context "when gem does not have homepage" do
before do
- build_repo1 do
+ build_repo2 do
build_gem "rails", "2.3.2" do |s|
s.executables = "rails"
s.summary = "Just another test gem"
@@ -46,12 +62,84 @@ RSpec.describe "bundle info" do
expect(out).to_not include("Homepage:")
end
end
+ end
+
+ context "with a git repo in the Gemfile" do
+ before :each do
+ @git = build_git "foo", "1.0"
+ end
+
+ it "prints out git info" do
+ install_gemfile <<-G
+ gem "foo", :git => "#{lib_path("foo-1.0")}"
+ G
+ expect(the_bundle).to include_gems "foo 1.0"
+
+ bundle "info foo"
+ expect(out).to include("foo (1.0 #{@git.ref_for("master", 6)}")
+ end
- context "given --path option" do
- it "prints the path to the gem" do
- bundle "info rails"
- expect(out).to match(%r{.*\/rails\-2\.3\.2})
+ it "prints out branch names other than master" do
+ update_git "foo", :branch => "omg" do |s|
+ s.write "lib/foo.rb", "FOO = '1.0.omg'"
end
+ @revision = revision_for(lib_path("foo-1.0"))[0...6]
+
+ 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"
+ 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
+ gem "foo", :git => "#{lib_path("foo-1.0")}", :ref => "#{sha}"
+ G
+
+ bundle "info foo"
+ expect(out).to include("foo (1.0 #{sha[0..6]})")
+ end
+
+ it "handles when a version is a '-' prerelease", :rubygems => "2.1" do
+ @git = build_git("foo", "1.0.0-beta.1", :path => lib_path("foo"))
+ 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"
+
+ bundle! "info foo"
+ expect(out).to include("foo (1.0.0.pre.beta.1")
+ end
+ end
+
+ context "with a valid regexp for gem name" do
+ it "presents alternatives" do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack"
+ gem "rack-obama"
+ G
+
+ 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
+ source "file://#{gem_repo1}"
+ gem "rails"
+ G
+
+ invalid_regexp = "[]"
+
+ bundle "info #{invalid_regexp}"
+ expect(err).to include("Could not find gem '#{invalid_regexp}'.")
end
end
end
diff --git a/spec/bundler/commands/init_spec.rb b/spec/bundler/commands/init_spec.rb
index 8a8f0effa0..64849beeb9 100644
--- a/spec/bundler/commands/init_spec.rb
+++ b/spec/bundler/commands/init_spec.rb
@@ -1,19 +1,13 @@
# frozen_string_literal: true
RSpec.describe "bundle init" do
- it "generates a Gemfile", :bundler => "< 3" do
+ it "generates a Gemfile" do
bundle! :init
expect(out).to include("Writing new Gemfile")
expect(bundled_app("Gemfile")).to be_file
end
- it "generates a gems.rb", :bundler => "3" do
- bundle! :init
- expect(out).to include("Writing new gems.rb")
- expect(bundled_app("gems.rb")).to be_file
- end
-
- context "when a Gemfile already exists", :bundler => "< 3" do
+ context "when a Gemfile already exists" do
before do
create_file "Gemfile", <<-G
gem "rails"
@@ -26,28 +20,11 @@ RSpec.describe "bundle init" do
it "notifies the user that an existing Gemfile already exists" do
bundle :init
- expect(out).to include("Gemfile already exists")
+ expect(err).to include("Gemfile already exists")
end
end
- context "when gems.rb already exists", :bundler => ">= 3" do
- before do
- create_file("gems.rb", <<-G)
- gem "rails"
- G
- end
-
- it "does not change existing Gemfiles" do
- expect { bundle :init }.not_to change { File.read(bundled_app("gems.rb")) }
- end
-
- it "notifies the user that an existing gems.rb already exists" do
- bundle :init
- expect(out).to include("gems.rb already exists")
- end
- end
-
- context "when a Gemfile exists in a parent directory", :bundler => "< 3" do
+ context "when a Gemfile exists in a parent directory" do
let(:subdir) { "child_dir" }
it "lets users generate a Gemfile in a child directory" do
@@ -77,29 +54,12 @@ RSpec.describe "bundle init" do
bundle :init
end
- expect(out).to include("directory is not writable")
+ expect(err).to include("directory is not writable")
expect(Dir[bundled_app("#{subdir}/*")]).to be_empty
end
end
- context "when a gems.rb file exists in a parent directory", :bundler => ">= 3" do
- let(:subdir) { "child_dir" }
-
- it "lets users generate a Gemfile in a child directory" do
- bundle! :init
-
- FileUtils.mkdir bundled_app(subdir)
-
- Dir.chdir bundled_app(subdir) do
- bundle! :init
- end
-
- expect(out).to include("Writing new gems.rb")
- expect(bundled_app("#{subdir}/gems.rb")).to be_file
- end
- end
-
- context "given --gemspec option", :bundler => "< 3" do
+ context "given --gemspec option" do
let(:spec_file) { tmp.join("test.gemspec") }
it "should generate from an existing gemspec" do
@@ -115,11 +75,7 @@ RSpec.describe "bundle init" do
bundle :init, :gemspec => spec_file
- gemfile = if Bundler::VERSION[0, 2].to_i < 3
- bundled_app("Gemfile").read
- else
- bundled_app("gems.rb").read
- end
+ 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)
@@ -144,9 +100,49 @@ RSpec.describe "bundle init" do
end
context "when init_gems_rb setting is enabled" do
- before { bundle "config init_gems_rb true" }
+ before { bundle "config set init_gems_rb true" }
+
+ it "generates a gems.rb" do
+ bundle! :init
+ expect(out).to include("Writing new gems.rb")
+ expect(bundled_app("gems.rb")).to be_file
+ end
+
+ context "when gems.rb already exists" do
+ before do
+ create_file("gems.rb", <<-G)
+ gem "rails"
+ G
+ end
+
+ it "does not change existing Gemfiles" do
+ expect { bundle :init }.not_to change { File.read(bundled_app("gems.rb")) }
+ end
+
+ it "notifies the user that an existing gems.rb already exists" do
+ bundle :init
+ expect(err).to include("gems.rb already exists")
+ end
+ end
+
+ context "when a gems.rb file exists in a parent directory" do
+ let(:subdir) { "child_dir" }
+
+ it "lets users generate a Gemfile in a child directory" do
+ bundle! :init
+
+ FileUtils.mkdir bundled_app(subdir)
+
+ Dir.chdir bundled_app(subdir) do
+ bundle! :init
+ end
+
+ expect(out).to include("Writing new gems.rb")
+ expect(bundled_app("#{subdir}/gems.rb")).to be_file
+ end
+ end
- context "given --gemspec option", :bundler => "< 3" do
+ context "given --gemspec option" do
let(:spec_file) { tmp.join("test.gemspec") }
before do
diff --git a/spec/bundler/commands/inject_spec.rb b/spec/bundler/commands/inject_spec.rb
index d091e01380..da31849be7 100644
--- a/spec/bundler/commands/inject_spec.rb
+++ b/spec/bundler/commands/inject_spec.rb
@@ -37,14 +37,14 @@ RSpec.describe "bundle inject", :bundler => "< 3" do
context "with injected gems already in the Gemfile" do
it "doesn't add existing gems" do
bundle "inject 'rack' '> 0'"
- expect(out).to match(/cannot specify the same gem twice/i)
+ expect(err).to match(/cannot specify the same gem twice/i)
end
end
context "incorrect arguments" do
it "fails when more than 2 arguments are passed" do
bundle "inject gem_name 1 v"
- expect(out).to eq(<<-E.strip)
+ expect(err).to eq(<<-E.strip)
ERROR: "bundle inject" was called with arguments ["gem_name", "1", "v"]
Usage: "bundle inject GEM VERSION"
E
@@ -80,9 +80,9 @@ Usage: "bundle inject GEM VERSION"
before do
bundle "install"
if Bundler.feature_flag.bundler_3_mode?
- bundle! "config --local deployment true"
+ bundle! "config set --local deployment true"
else
- bundle! "config --local frozen true"
+ bundle! "config set --local frozen true"
end
end
@@ -109,7 +109,7 @@ Usage: "bundle inject GEM VERSION"
gem "rack-obama"
G
bundle "inject 'rack' '> 0'"
- expect(out).to match(/trying to install in deployment mode after changing/)
+ expect(err).to match(/trying to install in deployment mode after changing/)
expect(bundled_app("Gemfile.lock").read).not_to match(/rack-obama/)
end
diff --git a/spec/bundler/commands/install_spec.rb b/spec/bundler/commands/install_spec.rb
index 326f98161e..21157dd309 100644
--- a/spec/bundler/commands/install_spec.rb
+++ b/spec/bundler/commands/install_spec.rb
@@ -8,7 +8,7 @@ RSpec.describe "bundle install with gem sources" do
G
bundle :install
- expect(out).to match(/no dependencies/)
+ expect(err).to match(/no dependencies/)
end
it "does not make a lockfile if the install fails" do
@@ -311,7 +311,7 @@ RSpec.describe "bundle install with gem sources" do
G
bundle :install
- expect(out).to include("Your Gemfile has no gem server sources")
+ expect(err).to include("Your Gemfile has no gem server sources")
end
it "creates a Gemfile.lock on a blank Gemfile" do
@@ -329,9 +329,9 @@ RSpec.describe "bundle install with gem sources" do
gem "rack"
G
- expect(out).to include("Your Gemfile lists the gem rack (>= 0) more than once.")
- expect(out).to include("Remove any duplicate entries and specify the gem only once (per group).")
- expect(out).to include("While it's not a problem now, it could cause errors if you change the version of one of them later.")
+ expect(err).to include("Your Gemfile lists the gem rack (>= 0) more than once.")
+ expect(err).to include("Remove any duplicate entries and specify the gem only once (per group).")
+ expect(err).to include("While it's not a problem now, it could cause errors if you change the version of one of them later.")
end
it "with same versions" do
@@ -341,9 +341,9 @@ RSpec.describe "bundle install with gem sources" do
gem "rack", "1.0"
G
- expect(out).to include("Your Gemfile lists the gem rack (= 1.0) more than once.")
- expect(out).to include("Remove any duplicate entries and specify the gem only once (per group).")
- expect(out).to include("While it's not a problem now, it could cause errors if you change the version of one of them later.")
+ expect(err).to include("Your Gemfile lists the gem rack (= 1.0) more than once.")
+ expect(err).to include("Remove any duplicate entries and specify the gem only once (per group).")
+ expect(err).to include("While it's not a problem now, it could cause errors if you change the version of one of them later.")
end
end
@@ -355,8 +355,8 @@ RSpec.describe "bundle install with gem sources" do
gem "rack", "1.0"
G
- expect(out).to include("You cannot specify the same gem twice with different version requirements")
- expect(out).to include("You specified: rack (>= 0) and rack (= 1.0).")
+ expect(err).to include("You cannot specify the same gem twice with different version requirements")
+ expect(err).to include("You specified: rack (>= 0) and rack (= 1.0).")
end
it "when different versions of both dependencies are specified" do
@@ -366,25 +366,25 @@ RSpec.describe "bundle install with gem sources" do
gem "rack", "1.1"
G
- expect(out).to include("You cannot specify the same gem twice with different version requirements")
- expect(out).to include("You specified: rack (= 1.0) and rack (= 1.1).")
+ expect(err).to include("You cannot specify the same gem twice with different version requirements")
+ expect(err).to include("You specified: rack (= 1.0) and rack (= 1.1).")
end
end
it "gracefully handles error when rubygems server is unavailable" do
install_gemfile <<-G, :artifice => nil
source "file://#{gem_repo1}"
- source "http://localhost:9384" do
+ source "http://0.0.0.0:9384" do
gem 'foo'
end
G
bundle :install, :artifice => nil
- expect(out).to include("Could not fetch specs from http://localhost:9384/")
- expect(out).not_to include("file://")
+ expect(err).to include("Could not fetch specs from http://0.0.0.0:9384/")
+ expect(err).not_to include("file://")
end
- it "fails gracefully when downloading an invalid specification from the full index", :rubygems => "2.5" do
+ it "fails gracefully when downloading an invalid specification from the full index" do
build_repo2 do
build_gem "ajp-rails", "0.0.0", :gemspec => false, :skip_validation => true do |s|
bad_deps = [["ruby-ajp", ">= 0.2.0"], ["rails", ">= 0.14"]]
@@ -442,7 +442,7 @@ RSpec.describe "bundle install with gem sources" do
::RUBY_VERSION = '2.0.1'
ruby '~> 2.2'
G
- expect(out).to include("Your Ruby version is 2.0.1, but your Gemfile specified ~> 2.2")
+ expect(err).to include("Your Ruby version is 2.0.1, but your Gemfile specified ~> 2.2")
end
end
@@ -529,8 +529,8 @@ RSpec.describe "bundle install with gem sources" do
G
bundle :install, :quiet => true
- expect(out).to include("Could not find gem 'rack'")
- expect(out).to_not include("Your Gemfile has no gem server sources")
+ expect(err).to include("Could not find gem 'rack'")
+ expect(err).to_not include("Your Gemfile has no gem server sources")
end
end
@@ -547,8 +547,8 @@ RSpec.describe "bundle install with gem sources" do
FileUtils.chmod(0o500, bundled_app("vendor"))
bundle :install, forgotten_command_line_options(:path => "vendor")
- expect(out).to include(bundled_app("vendor").to_s)
- expect(out).to include("grant write permissions")
+ expect(err).to include(bundled_app("vendor").to_s)
+ expect(err).to include("grant write permissions")
end
end
@@ -577,10 +577,10 @@ RSpec.describe "bundle install with gem sources" do
G
end
- it "should display a helpful messag explaining how to fix it" do
+ it "should display a helpful message explaining how to fix it" do
bundle :install, :env => { "BUNDLE_RUBYGEMS__ORG" => "user:pass{word" }
expect(exitstatus).to eq(17) if exitstatus
- expect(out).to eq("Please CGI escape your usernames and passwords before " \
+ expect(err).to eq("Please CGI escape your usernames and passwords before " \
"setting them for authentication.")
end
end
diff --git a/spec/bundler/commands/licenses_spec.rb b/spec/bundler/commands/licenses_spec.rb
index d61d3492f3..21fd8eaf2f 100644
--- a/spec/bundler/commands/licenses_spec.rb
+++ b/spec/bundler/commands/licenses_spec.rb
@@ -12,14 +12,7 @@ RSpec.describe "bundle licenses" do
it "prints license information for all gems in the bundle" do
bundle "licenses"
- loaded_bundler_spec = Bundler.load.specs["bundler"]
- expected = if !loaded_bundler_spec.empty?
- loaded_bundler_spec[0].license
- else
- "Unknown"
- end
-
- expect(out).to include("bundler: #{expected}")
+ expect(err).to include("bundler: Unknown")
expect(out).to include("with_license: MIT")
end
@@ -31,7 +24,7 @@ RSpec.describe "bundle licenses" do
gem "foo"
G
- bundle "config auto_install 1"
+ bundle "config set auto_install 1"
bundle :licenses
expect(out).to include("Installing foo 1.0")
end
diff --git a/spec/bundler/commands/list_spec.rb b/spec/bundler/commands/list_spec.rb
index ba4bb9b040..346b47517e 100644
--- a/spec/bundler/commands/list_spec.rb
+++ b/spec/bundler/commands/list_spec.rb
@@ -1,20 +1,11 @@
# frozen_string_literal: true
-RSpec.describe "bundle list", :bundler => "3" do
- before do
- install_gemfile <<-G
- source "file://#{gem_repo1}"
-
- gem "rack"
- gem "rspec", :group => [:test]
- G
- end
-
+RSpec.describe "bundle list" do
context "with name-only and paths option" do
it "raises an error" do
bundle "list --name-only --paths"
- expect(out).to eq "The `--name-only` and `--paths` options cannot be used together"
+ expect(err).to eq "The `--name-only` and `--paths` options cannot be used together"
end
end
@@ -22,11 +13,20 @@ RSpec.describe "bundle list", :bundler => "3" do
it "raises an error" do
bundle "list --without-group dev --only-group test"
- expect(out).to eq "The `--only-group` and `--without-group` options cannot be used together"
+ expect(err).to eq "The `--only-group` and `--without-group` options cannot be used together"
end
end
describe "with without-group option" do
+ before do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+
+ gem "rack"
+ gem "rspec", :group => [:test]
+ G
+ end
+
context "when group is present" do
it "prints the gems not in the specified group" do
bundle! "list --without-group test"
@@ -40,12 +40,21 @@ RSpec.describe "bundle list", :bundler => "3" do
it "raises an error" do
bundle "list --without-group random"
- expect(out).to eq "`random` group could not be found."
+ expect(err).to eq "`random` group could not be found."
end
end
end
describe "with only-group option" do
+ before do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+
+ gem "rack"
+ gem "rspec", :group => [:test]
+ G
+ end
+
context "when group is present" do
it "prints the gems in the specified group" do
bundle! "list --only-group default"
@@ -59,12 +68,21 @@ RSpec.describe "bundle list", :bundler => "3" do
it "raises an error" do
bundle "list --only-group random"
- expect(out).to eq "`random` group could not be found."
+ expect(err).to eq "`random` group could not be found."
end
end
end
context "with name-only option" do
+ before do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+
+ gem "rack"
+ gem "rspec", :group => [:test]
+ G
+ end
+
it "prints only the name of the gems in the bundle" do
bundle "list --name-only"
@@ -82,7 +100,6 @@ RSpec.describe "bundle list", :bundler => "3" do
build_git "git_test", "1.0.0", :path => lib_path("git_test")
build_lib("gemspec_test", :path => tmp.join("gemspec_test")) do |s|
- s.write("Gemfile", "source :rubygems\ngemspec")
s.add_dependency "bar", "=1.0.0"
end
@@ -93,8 +110,6 @@ RSpec.describe "bundle list", :bundler => "3" do
gem "git_test", :git => "#{lib_path("git_test")}"
gemspec :path => "#{tmp.join("gemspec_test")}"
G
-
- bundle! "install"
end
it "prints the path of each gem in the bundle" do
@@ -119,13 +134,35 @@ RSpec.describe "bundle list", :bundler => "3" do
end
end
- it "lists gems installed in the bundle" do
- bundle "list"
- expect(out).to include(" * rack (1.0.0)")
+ context "without options" do
+ before do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+
+ gem "rack"
+ gem "rspec", :group => [:test]
+ G
+ end
+
+ it "lists gems installed in the bundle" do
+ bundle "list"
+ expect(out).to include(" * rack (1.0.0)")
+ end
end
- it "aliases the ls command to list" do
- bundle "ls"
- expect(out).to include("Gems included by the bundle")
+ context "when using the ls alias" do
+ before do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+
+ gem "rack"
+ gem "rspec", :group => [:test]
+ G
+ end
+
+ it "runs the list command" do
+ bundle "ls"
+ expect(out).to include("Gems included by the bundle")
+ end
end
end
diff --git a/spec/bundler/commands/lock_spec.rb b/spec/bundler/commands/lock_spec.rb
index 0b77605f01..f876d719cc 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 (= 10.0.2)
- rake (10.0.2)
+ rake (= 12.3.2)
+ rake (12.3.2)
with_license (1.0)
PLATFORMS
@@ -86,14 +86,41 @@ RSpec.describe "bundle lock" do
it "does not fetch remote specs when using the --local option" do
bundle "lock --update --local"
- expect(out).to match(/sources listed in your Gemfile|installed locally/)
+ expect(err).to match(/sources listed in your Gemfile|installed locally/)
+ end
+
+ it "works with --gemfile flag" do
+ create_file "CustomGemfile", <<-G
+ source "file://localhost#{repo}"
+ gem "foo"
+ G
+ lockfile = strip_lockfile(normalize_uri_file(<<-L))
+ GEM
+ remote: file://localhost#{repo}/
+ specs:
+ foo (1.0)
+
+ PLATFORMS
+ #{lockfile_platforms}
+
+ DEPENDENCIES
+ foo
+
+ BUNDLED WITH
+ #{Bundler::VERSION}
+ L
+ bundle "lock --gemfile CustomGemfile"
+
+ expect(out).to match(/Writing lockfile to.+CustomGemfile\.lock/)
+ expect(read_lockfile("CustomGemfile.lock")).to eq(lockfile)
+ expect { read_lockfile }.to raise_error(Errno::ENOENT)
end
it "writes to a custom location using --lockfile" do
bundle "lock --lockfile=lock"
expect(out).to match(/Writing lockfile to.+lock/)
- expect(read_lockfile "lock").to eq(@lockfile)
+ expect(read_lockfile("lock")).to eq(@lockfile)
expect { read_lockfile }.to raise_error(Errno::ENOENT)
end
@@ -106,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("10.0.2", "10.0.1")
+ lockfile @lockfile.gsub("2.3.2", "2.3.1").gsub("12.3.2", "10.0.1")
bundle "lock --update rails rake"
@@ -117,11 +144,24 @@ RSpec.describe "bundle lock" do
lockfile @lockfile
bundle "lock --update blahblah"
- expect(out).to eq("Could not find gem 'blahblah'.")
+ expect(err).to eq("Could not find gem 'blahblah'.")
expect(read_lockfile).to eq(@lockfile)
end
+ it "can lock without downloading gems" do
+ gemfile <<-G
+ source "file://#{gem_repo1}"
+
+ gem "thin"
+ gem "rack_middleware", :group => "test"
+ G
+ bundle! "config set without test"
+ bundle! "config set path .bundle"
+ bundle! "lock"
+ expect(bundled_app(".bundle")).not_to exist
+ end
+
# see update_spec for more coverage on same options. logic is shared so it's not necessary
# to repeat coverage here.
context "conservative updates" do
@@ -185,7 +225,7 @@ RSpec.describe "bundle lock" do
it "warns when adding an unknown platform" do
bundle "lock --add-platform foobarbaz"
- expect(out).to include("The platform `foobarbaz` is unknown to RubyGems and adding it will likely lead to resolution errors")
+ expect(err).to include("The platform `foobarbaz` is unknown to RubyGems and adding it will likely lead to resolution errors")
end
it "allows removing platforms" do
diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb
index e6d6e19122..0d1058ad11 100644
--- a/spec/bundler/commands/newgem_spec.rb
+++ b/spec/bundler/commands/newgem_spec.rb
@@ -6,18 +6,8 @@ RSpec.describe "bundle gem" do
global_config "BUNDLE_GEM__MIT" => "false", "BUNDLE_GEM__TEST" => "false", "BUNDLE_GEM__COC" => "false"
end
- def remove_push_guard(gem_name)
- # Remove exception that prevents public pushes on older RubyGems versions
- if Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.0")
- path = "#{gem_name}/#{gem_name}.gemspec"
- content = File.read(path).sub(/raise "RubyGems 2\.0 or newer.*/, "")
- File.open(path, "w") {|f| f.write(content) }
- end
- end
-
- def execute_bundle_gem(gem_name, flag = "", to_remove_push_guard = true)
+ def execute_bundle_gem(gem_name, flag = "")
bundle! "gem #{gem_name} #{flag}"
- remove_push_guard(gem_name) if to_remove_push_guard
# reset gemspec cache for each test because of commit 3d4163a
Bundler.clear_gemspec_cache
end
@@ -96,7 +86,7 @@ RSpec.describe "bundle gem" do
shared_examples_for "--coc flag" do
before do
- execute_bundle_gem(gem_name, "--coc", false)
+ execute_bundle_gem(gem_name, "--coc")
end
it "generates a gem skeleton with MIT license" do
gem_skeleton_assertions(gem_name)
@@ -113,7 +103,7 @@ RSpec.describe "bundle gem" do
shared_examples_for "--no-coc flag" do
before do
- execute_bundle_gem(gem_name, "--no-coc", false)
+ execute_bundle_gem(gem_name, "--no-coc")
end
it "generates a gem skeleton without Code of Conduct" do
gem_skeleton_assertions(gem_name)
@@ -149,7 +139,6 @@ RSpec.describe "bundle gem" do
reset!
in_app_root
bundle "gem #{gem_name}"
- remove_push_guard(gem_name)
end
it "contribute URL set to [USERNAME]" do
@@ -173,7 +162,7 @@ RSpec.describe "bundle gem" do
load_paths = [lib, spec]
load_path_str = "-I#{load_paths.join(File::PATH_SEPARATOR)}"
- sys_exec "PATH=\"\" #{Gem.ruby} #{load_path_str} #{bindir.join("bundle")} gem #{gem_name}"
+ sys_exec "#{Gem.ruby} #{load_path_str} #{bindir.join("bundle")} gem #{gem_name}", "PATH" => ""
end
it "creates the gem without the need for git" do
@@ -202,16 +191,13 @@ RSpec.describe "bundle gem" do
line.gsub(/\=.*$/, "= %q{A short summary of my new gem.}")
when /spec\.description/
line.gsub(/\=.*$/, "= %q{A longer description of my new gem.}")
- # Remove exception that prevents public pushes on older RubyGems versions
- when /raise "RubyGems 2.0 or newer/
- line.gsub(/.*/, "") if Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.0")
else
line
end
end
Dir.chdir(bundled_app("newgem")) do
- gems = ["rake-10.0.2", :bundler]
+ gems = ["rake-12.3.2", :bundler]
# for Ruby core repository, Ruby 2.6+ has bundler as standard library.
gems.delete(:bundler) if ruby_core?
system_gems gems, :path => :bundle_path
@@ -298,13 +284,12 @@ RSpec.describe "bundle gem" do
reset!
in_app_root
bundle "gem #{gem_name}"
- remove_push_guard(gem_name)
end
it_should_behave_like "git config is absent"
end
- it "sets gemspec metadata['allowed_push_host']", :rubygems => "2.0" do
+ it "sets gemspec metadata['allowed_push_host']" do
expect(generated_gem.gemspec.metadata["allowed_push_host"]).
to match(/mygemserver\.com/)
end
@@ -318,7 +303,7 @@ RSpec.describe "bundle gem" do
end
it "runs rake without problems" do
- system_gems ["rake-10.0.2"]
+ system_gems ["rake-12.3.2"]
rakefile = strip_whitespace <<-RAKEFILE
task :default do
@@ -396,8 +381,7 @@ RSpec.describe "bundle gem" do
expect(bundled_app("test_gem/spec/spec_helper.rb")).to exist
end
- it "depends on a specific version of rspec", :rubygems => ">= 1.8.1" do
- remove_push_guard(gem_name)
+ it "depends on a specific version of rspec" do
rspec_dep = generated_gem.gemspec.development_dependencies.find {|d| d.name == "rspec" }
expect(rspec_dep).to be_specific
end
@@ -415,7 +399,7 @@ RSpec.describe "bundle gem" do
before do
reset!
in_app_root
- bundle "config gem.test rspec"
+ bundle "config set gem.test rspec"
bundle "gem #{gem_name}"
end
@@ -430,7 +414,7 @@ RSpec.describe "bundle gem" do
before do
reset!
in_app_root
- bundle "config gem.test rspec"
+ bundle "config set gem.test rspec"
bundle "gem #{gem_name} --test=minitest"
end
@@ -447,8 +431,7 @@ RSpec.describe "bundle gem" do
bundle "gem #{gem_name} --test=minitest"
end
- it "depends on a specific version of minitest", :rubygems => ">= 1.8.1" do
- remove_push_guard(gem_name)
+ it "depends on a specific version of minitest" do
rspec_dep = generated_gem.gemspec.development_dependencies.find {|d| d.name == "minitest" }
expect(rspec_dep).to be_specific
end
@@ -475,7 +458,7 @@ RSpec.describe "bundle gem" do
before do
reset!
in_app_root
- bundle "config gem.test minitest"
+ bundle "config set gem.test minitest"
bundle "gem #{gem_name}"
end
@@ -592,7 +575,6 @@ RSpec.describe "bundle gem" do
reset!
in_app_root
bundle "gem #{gem_name}"
- remove_push_guard(gem_name)
end
it_should_behave_like "git config is absent"
@@ -603,7 +585,7 @@ RSpec.describe "bundle gem" do
end
it "runs rake without problems" do
- system_gems ["rake-10.0.2"]
+ system_gems ["rake-12.3.2"]
rakefile = strip_whitespace <<-RAKEFILE
task :default do
@@ -820,22 +802,22 @@ Usage: "bundle gem NAME [OPTIONS]"
context "with an existing const name" do
subject { "gem" }
- it { expect(out).to include("Invalid gem name #{subject}") }
+ it { expect(err).to include("Invalid gem name #{subject}") }
end
context "with an existing hyphenated const name" do
subject { "gem-specification" }
- it { expect(out).to include("Invalid gem name #{subject}") }
+ it { expect(err).to include("Invalid gem name #{subject}") }
end
context "starting with an existing const name" do
subject { "gem-somenewconstantname" }
- it { expect(out).not_to include("Invalid gem name #{subject}") }
+ it { expect(err).not_to include("Invalid gem name #{subject}") }
end
context "ending with an existing const name" do
subject { "somenewconstantname-gem" }
- it { expect(out).not_to include("Invalid gem name #{subject}") }
+ it { expect(err).not_to include("Invalid gem name #{subject}") }
end
end
@@ -868,7 +850,7 @@ Usage: "bundle gem NAME [OPTIONS]"
it "asks about MIT license" do
global_config "BUNDLE_GEM__TEST" => "false", "BUNDLE_GEM__COC" => "false"
- bundle :config
+ bundle "config list"
bundle "gem foobar" do |input, _, _|
input.puts "yes"
diff --git a/spec/bundler/commands/open_spec.rb b/spec/bundler/commands/open_spec.rb
index 5cab846fb5..659445da33 100644
--- a/spec/bundler/commands/open_spec.rb
+++ b/spec/bundler/commands/open_spec.rb
@@ -30,7 +30,7 @@ RSpec.describe "bundle open" do
it "complains if gem not in bundle" do
bundle "open missing", :env => { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" }
- expect(out).to match(/could not find gem 'missing'/i)
+ expect(err).to match(/could not find gem 'missing'/i)
end
it "does not blow up if the gem to open does not have a Gemfile" do
@@ -48,7 +48,7 @@ RSpec.describe "bundle open" do
it "suggests alternatives for similar-sounding gems" do
bundle "open Rails", :env => { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" }
- expect(out).to match(/did you mean rails\?/i)
+ expect(err).to match(/did you mean rails\?/i)
end
it "opens the gem with short words" do
@@ -80,7 +80,7 @@ RSpec.describe "bundle open" do
gem "foo"
G
- bundle "config auto_install 1"
+ bundle "config set auto_install 1"
bundle "open rails", :env => { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" }
expect(out).to include("Installing foo 1.0")
end
diff --git a/spec/bundler/commands/outdated_spec.rb b/spec/bundler/commands/outdated_spec.rb
index c9d3ac1de4..843bebf6e0 100644
--- a/spec/bundler/commands/outdated_spec.rb
+++ b/spec/bundler/commands/outdated_spec.rb
@@ -135,6 +135,17 @@ RSpec.describe "bundle outdated" do
expect(out).to include("activesupport")
expect(out).to include("duradura")
end
+
+ it "returns a sorted list of outdated gems from one group => 'test'" do
+ test_group_option("test", 2)
+
+ expect(out).not_to include("===== Group default =====")
+ expect(out).not_to include("terranova (")
+
+ expect(out).to include("===== Group development, test =====")
+ expect(out).to include("activesupport")
+ expect(out).to include("duradura")
+ end
end
describe "with --groups option" do
@@ -191,7 +202,7 @@ RSpec.describe "bundle outdated" do
build_gem "activesupport", "2.3.4"
end
- bundle! "config clean false"
+ bundle! "config set clean false"
install_gemfile <<-G
source "file://#{gem_repo2}"
@@ -302,14 +313,15 @@ RSpec.describe "bundle outdated" do
end
end
- describe "with --strict option" do
+ filter_strict_option = Bundler.feature_flag.bundler_2_mode? ? :"filter-strict" : :strict
+ describe "with --#{filter_strict_option} option" do
it "only reports gems that have a newer version that matches the specified dependency version requirements" do
update_repo2 do
build_gem "activesupport", "3.0"
build_gem "weakling", "0.0.5"
end
- bundle "outdated --strict"
+ 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)")
@@ -321,7 +333,7 @@ RSpec.describe "bundle outdated" do
gem "rack_middleware", "1.0"
G
- bundle "outdated --strict"
+ bundle :outdated, filter_strict_option => true
expect(out).to_not include("rack (1.2")
end
@@ -339,7 +351,7 @@ RSpec.describe "bundle outdated" do
build_gem "weakling", "0.0.5"
end
- bundle "outdated --strict --filter-patch"
+ 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")
@@ -357,7 +369,7 @@ RSpec.describe "bundle outdated" do
build_gem "weakling", "0.1.5"
end
- bundle "outdated --strict --filter-minor"
+ 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")
@@ -375,7 +387,7 @@ RSpec.describe "bundle outdated" do
build_gem "weakling", "1.1.5"
end
- bundle "outdated --strict --filter-major"
+ 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")
@@ -386,7 +398,7 @@ RSpec.describe "bundle outdated" do
describe "with invalid gem name" do
it "returns could not find gem name" do
bundle "outdated invalid_gem_name"
- expect(out).to include("Could not find gem 'invalid_gem_name'.")
+ expect(err).to include("Could not find gem 'invalid_gem_name'.")
end
it "returns non-zero exit code" do
@@ -402,7 +414,7 @@ RSpec.describe "bundle outdated" do
gem "foo"
G
- bundle "config auto_install 1"
+ bundle "config set auto_install 1"
bundle :outdated
expect(out).to include("Installing foo 1.0")
end
@@ -422,14 +434,14 @@ RSpec.describe "bundle outdated" do
bundle "outdated"
expect(last_command).to be_failure
- expect(out).to include("You are trying to check outdated gems in deployment mode.")
- expect(out).to include("Run `bundle outdated` elsewhere.")
- expect(out).to include("If this is a development machine, remove the ")
- expect(out).to include("Gemfile freeze\nby running `bundle install --no-deployment`.")
+ expect(err).to include("You are trying to check outdated gems in deployment mode.")
+ expect(err).to include("Run `bundle outdated` elsewhere.")
+ expect(err).to include("If this is a development machine, remove the ")
+ expect(err).to include("Gemfile freeze\nby running `bundle install --no-deployment`.")
end
end
- context "after bundle config deployment true" do
+ context "after bundle config set deployment true" do
before do
install_gemfile <<-G
source "file://#{gem_repo2}"
@@ -437,7 +449,7 @@ RSpec.describe "bundle outdated" do
gem "rack"
gem "foo"
G
- bundle! "config deployment true"
+ bundle! "config set deployment true"
end
it "outputs a helpful message about being in deployment mode" do
@@ -445,10 +457,10 @@ RSpec.describe "bundle outdated" do
bundle "outdated"
expect(last_command).to be_failure
- expect(out).to include("You are trying to check outdated gems in deployment mode.")
- expect(out).to include("Run `bundle outdated` elsewhere.")
- expect(out).to include("If this is a development machine, remove the ")
- expect(out).to include("Gemfile freeze\nby running `bundle config --delete deployment`.")
+ expect(err).to include("You are trying to check outdated gems in deployment mode.")
+ expect(err).to include("Run `bundle outdated` elsewhere.")
+ expect(err).to include("If this is a development machine, remove the ")
+ expect(err).to include("Gemfile freeze\nby running `bundle config unset deployment`.")
end
end
diff --git a/spec/bundler/commands/package_spec.rb b/spec/bundler/commands/package_spec.rb
index a8426e6322..6cd8e3f85a 100644
--- a/spec/bundler/commands/package_spec.rb
+++ b/spec/bundler/commands/package_spec.rb
@@ -179,10 +179,22 @@ RSpec.describe "bundle package" do
expect(the_bundle).to include_gems "rack 1.0.0"
end
+
+ it "does not prevent installing gems with bundle update" do
+ gemfile <<-D
+ source "file://#{gem_repo1}"
+ gem "rack", "1.0.0"
+ D
+
+ bundle! "package --no-install"
+ bundle! "update --all"
+
+ expect(the_bundle).to include_gems "rack 1.0.0"
+ end
end
context "with --all-platforms" do
- it "puts the gems in vendor/cache even for other rubies", :ruby => "2.1" do
+ it "puts the gems in vendor/cache even for other rubies" do
gemfile <<-D
source "file://#{gem_repo1}"
gem 'rack', :platforms => :ruby_19
@@ -205,7 +217,7 @@ RSpec.describe "bundle package" do
subject { bundle :package, forgotten_command_line_options(:frozen => true) }
it "tries to install with frozen" do
- bundle! "config deployment true"
+ bundle! "config set deployment true"
gemfile <<-G
source "file://#{gem_repo1}"
gem "rack"
@@ -213,9 +225,9 @@ RSpec.describe "bundle package" do
G
subject
expect(exitstatus).to eq(16) if exitstatus
- expect(out).to include("deployment mode")
- expect(out).to include("You have added to the Gemfile")
- expect(out).to include("* rack-obama")
+ expect(err).to include("deployment mode")
+ expect(err).to include("You have added to the Gemfile")
+ expect(err).to include("* rack-obama")
bundle "env"
expect(out).to include("frozen").or include("deployment")
end
@@ -266,7 +278,7 @@ RSpec.describe "bundle install with gem sources" do
end
bundle :install
- expect(err).to lack_errors
+ expect(last_command.stderr).to be_empty
expect(the_bundle).to include_gems "rack 1.0"
end
diff --git a/spec/bundler/commands/pristine_spec.rb b/spec/bundler/commands/pristine_spec.rb
index d8761bba26..93eb81f2af 100644
--- a/spec/bundler/commands/pristine_spec.rb
+++ b/spec/bundler/commands/pristine_spec.rb
@@ -42,7 +42,7 @@ RSpec.describe "bundle pristine", :ruby_repo do
expect(changes_txt).to_not be_file
end
- it "does not delete the bundler gem" do
+ it "does not delete the bundler gem", :rubygems => ">= 2.6.2" do
ENV["BUNDLER_SPEC_KEEP_DEFAULT_BUNDLER_GEM"] = "true"
system_gems :bundler
bundle! "install"
@@ -95,7 +95,7 @@ RSpec.describe "bundle pristine", :ruby_repo do
bundle "pristine"
expect(File.read(changed_file)).to include(diff)
- expect(out).to include("Cannot pristine #{spec.name} (#{spec.version}#{spec.git_version}). Gem is sourced from local path.")
+ expect(err).to include("Cannot pristine #{spec.name} (#{spec.version}#{spec.git_version}). Gem is sourced from local path.")
end
it "reinstall gemspec dependency" do
@@ -118,7 +118,7 @@ RSpec.describe "bundle pristine", :ruby_repo do
FileUtils.touch(changes_txt)
expect(changes_txt).to be_file
bundle "pristine"
- expect(out).to include("Cannot pristine #{spec.name} (#{spec.version}#{spec.git_version}). Gem is sourced from local path.")
+ expect(err).to include("Cannot pristine #{spec.name} (#{spec.version}#{spec.git_version}). Gem is sourced from local path.")
expect(changes_txt).to be_file
end
end
@@ -142,8 +142,8 @@ RSpec.describe "bundle pristine", :ruby_repo do
bundle! "pristine foo bar weakling"
- expect(out).to include("Cannot pristine bar (1.0). Gem is sourced from local path.").
- and include("Installing weakling 1.0")
+ expect(err).to include("Cannot pristine bar (1.0). Gem is sourced from local path.")
+ expect(out).to include("Installing weakling 1.0")
expect(weakling_changes_txt).not_to be_file
expect(foo_changes_txt).not_to be_file
@@ -152,7 +152,7 @@ RSpec.describe "bundle pristine", :ruby_repo do
it "raises when one of them is not in the lockfile" do
bundle "pristine abcabcabc"
- expect(out).to include("Could not find gem 'abcabcabc'.")
+ expect(err).to include("Could not find gem 'abcabcabc'.")
end
end
@@ -160,7 +160,7 @@ RSpec.describe "bundle pristine", :ruby_repo do
let(:very_simple_binary) { Bundler.definition.specs["very_simple_binary"].first }
let(:c_ext_dir) { Pathname.new(very_simple_binary.full_gem_path).join("ext") }
let(:build_opt) { "--with-ext-lib=#{c_ext_dir}" }
- before { bundle "config build.very_simple_binary -- #{build_opt}" }
+ before { bundle "config set build.very_simple_binary -- #{build_opt}" }
# This just verifies that the generated Makefile from the c_ext gem makes
# use of the build_args from the bundle config
@@ -177,7 +177,7 @@ RSpec.describe "bundle pristine", :ruby_repo do
let(:git_with_ext) { Bundler.definition.specs["git_with_ext"].first }
let(:c_ext_dir) { Pathname.new(git_with_ext.full_gem_path).join("ext") }
let(:build_opt) { "--with-ext-lib=#{c_ext_dir}" }
- before { bundle "config build.git_with_ext -- #{build_opt}" }
+ before { bundle "config set build.git_with_ext -- #{build_opt}" }
# This just verifies that the generated Makefile from the c_ext gem makes
# use of the build_args from the bundle config
diff --git a/spec/bundler/commands/remove_spec.rb b/spec/bundler/commands/remove_spec.rb
index faeb654b14..7695d2a881 100644
--- a/spec/bundler/commands/remove_spec.rb
+++ b/spec/bundler/commands/remove_spec.rb
@@ -9,7 +9,7 @@ RSpec.describe "bundle remove" do
bundle "remove"
- expect(out).to include("Please specify gems to remove.")
+ expect(err).to include("Please specify gems to remove.")
end
end
@@ -54,7 +54,7 @@ RSpec.describe "bundle remove" do
bundle "remove rack"
- expect(out).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(out).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://#{gem_repo1}"
@@ -140,6 +140,30 @@ RSpec.describe "bundle remove" do
end
end
+ context "when gem to be removed is outside block" do
+ it "does not modify group" do
+ gemfile <<-G
+ source "file://#{gem_repo1}"
+
+ gem "rack"
+ group :test do
+ gem "coffee-script-source"
+ end
+ G
+
+ bundle! "remove rack"
+
+ expect(out).to include("rack was removed.")
+ gemfile_should_be <<-G
+ source "file://#{gem_repo1}"
+
+ group :test do
+ gem "coffee-script-source"
+ end
+ G
+ end
+ end
+
context "when an empty block is also present" do
it "removes all empty blocks" do
gemfile <<-G
@@ -294,11 +318,7 @@ RSpec.describe "bundle remove" do
bundle "remove rails"
- if Gem::VERSION >= "1.6.0"
- expect(out).to include("Gems could not be removed. rack (>= 0) would also have been removed.")
- else
- expect(out).to include("Gems could not be removed. rack (>= 0, runtime) would also have been removed.")
- end
+ expect(err).to include("Gems could not be removed. rack (>= 0) would also have been removed.")
gemfile_should_be <<-G
source "file://#{gem_repo1}"
gem "rack"; gem "rails"
@@ -416,7 +436,7 @@ RSpec.describe "bundle remove" do
bundle "remove rack"
- expect(out).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
@@ -436,7 +456,7 @@ RSpec.describe "bundle remove" do
bundle "remove rack"
expect(out).to include("rack was removed.")
- expect(out).to include("`rack` is not specified in #{bundled_app("Gemfile-other")} so it could not be removed.")
+ expect(err).to include("`rack` is not specified in #{bundled_app("Gemfile-other")} so it could not be removed.")
gemfile_should_be <<-G
source "file://#{gem_repo1}"
@@ -461,11 +481,7 @@ RSpec.describe "bundle remove" do
bundle "remove rack"
expect(out).to include("rack was removed.")
- if Gem::VERSION >= "1.6.0"
- expect(out).to include("Gems could not be removed. rails (>= 0) would also have been removed.")
- else
- expect(out).to include("Gems could not be removed. rails (>= 0, runtime) would also have been removed.")
- end
+ expect(err).to include("Gems could not be removed. rails (>= 0) would also have been removed.")
gemfile_should_be <<-G
source "file://#{gem_repo1}"
@@ -489,11 +505,7 @@ RSpec.describe "bundle remove" do
bundle "remove rack"
- if Gem::VERSION >= "1.6.0"
- expect(out).to include("Gems could not be removed. rails (>= 0) would also have been removed.")
- else
- expect(out).to include("Gems could not be removed. rails (>= 0, runtime) would also have been removed.")
- end
+ expect(err).to include("Gems could not be removed. rails (>= 0) would also have been removed.")
expect(bundled_app("Gemfile-other").read).to include("gem \"rack\"")
gemfile_should_be <<-G
source "file://#{gem_repo1}"
diff --git a/spec/bundler/commands/show_spec.rb b/spec/bundler/commands/show_spec.rb
index a5c6beec1a..8fb6631f82 100644
--- a/spec/bundler/commands/show_spec.rb
+++ b/spec/bundler/commands/show_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe "bundle show", :bundler => "< 3", :ruby => ">= 2.0" do
+RSpec.describe "bundle show", :bundler => "< 3" do
context "with a standard Gemfile" do
before :each do
install_gemfile <<-G
@@ -30,46 +30,9 @@ RSpec.describe "bundle show", :bundler => "< 3", :ruby => ">= 2.0" do
expect(out).to eq(default_bundle_path("gems", "rails-2.3.2").to_s)
end
- context "when show command deprecation is enabled" do
- before { bundle "config major_deprecations yes" }
-
- it "prints path if gem exists in bundle" do
- bundle "show rails"
- expect(out).to eq(
- "[DEPRECATED FOR 3.0] use `bundle info rails` instead of `bundle show rails`\n" +
- default_bundle_path("gems", "rails-2.3.2").to_s
- )
- end
-
- it "prints the path to the running bundler" do
- bundle "show bundler"
- expect(out).to eq(
- "[DEPRECATED FOR 3.0] use `bundle info bundler` instead of `bundle show bundler`\n" +
- root.to_s
- )
- end
-
- it "prints path if gem exists in bundle (with --paths option)" do
- bundle "show rails --paths"
- expect(out).to eq(
- "[DEPRECATED FOR 3.0] use `bundle info rails --path` instead of `bundle show rails --paths`\n" +
- default_bundle_path("gems", "rails-2.3.2").to_s
- )
- end
-
- it "prints path of all gems in bundle sorted by name" do
- bundle "show --paths"
-
- expect(out).to include(default_bundle_path("gems", "rake-10.0.2").to_s)
- expect(out).to include(default_bundle_path("gems", "rails-2.3.2").to_s)
-
- out_lines = out.split("\n")
- expect(out_lines[0]).to eq("[DEPRECATED FOR 3.0] use `bundle list` instead of `bundle show --paths`")
-
- # Gem names are the last component of their path.
- gem_list = out_lines[1..-1].map {|p| p.split("/").last }
- expect(gem_list).to eq(gem_list.sort)
- end
+ it "prints deprecation" do
+ bundle "show rails"
+ expect(err).to eq("[DEPRECATED] use `bundle info rails` instead of `bundle show rails`")
end
it "prints path if gem exists in bundle (with --paths option)" do
@@ -77,13 +40,18 @@ RSpec.describe "bundle show", :bundler => "< 3", :ruby => ">= 2.0" do
expect(out).to eq(default_bundle_path("gems", "rails-2.3.2").to_s)
end
+ it "prints deprecation when called with a gem and the --paths option" do
+ bundle "show rails --paths"
+ expect(err).to eq("[DEPRECATED] use `bundle info rails --path` instead of `bundle show rails --paths`")
+ end
+
it "warns if path no longer exists on disk" do
FileUtils.rm_rf(default_bundle_path("gems", "rails-2.3.2"))
bundle "show rails"
- expect(out).to match(/has been deleted/i).
- and include(default_bundle_path("gems", "rails-2.3.2").to_s)
+ expect(err).to match(/has been deleted/i)
+ expect(err).to match(default_bundle_path("gems", "rails-2.3.2").to_s)
end
it "prints the path to the running bundler" do
@@ -91,15 +59,19 @@ RSpec.describe "bundle show", :bundler => "< 3", :ruby => ">= 2.0" do
expect(out).to eq(root.to_s)
end
+ it "prints deprecation when called with bundler" do
+ bundle "show bundler"
+ expect(err).to eq("[DEPRECATED] use `bundle info bundler` instead of `bundle show bundler`")
+ end
it "complains if gem not in bundle" do
bundle "show missing"
- expect(out).to match(/could not find gem 'missing'/i)
+ expect(err).to match(/could not find gem 'missing'/i)
end
it "prints path of all gems in bundle sorted by name" do
bundle "show --paths"
- expect(out).to include(default_bundle_path("gems", "rake-10.0.2").to_s)
+ expect(out).to include(default_bundle_path("gems", "rake-12.3.2").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.
@@ -107,19 +79,18 @@ RSpec.describe "bundle show", :bundler => "< 3", :ruby => ">= 2.0" do
expect(gem_list).to eq(gem_list.sort)
end
+ it "prints a deprecation when called with the --paths option" do
+ bundle "show --paths"
+
+ expect(err).to eq("[DEPRECATED] use `bundle list` instead of `bundle show --paths`")
+ end
+
it "prints summary of gems" do
bundle "show --verbose"
- loaded_bundler_spec = Bundler.load.specs["bundler"]
- expected = if !loaded_bundler_spec.empty?
- loaded_bundler_spec[0].homepage
- else
- "No website available."
- end
-
expect(out).to include("* actionmailer (2.3.2)")
expect(out).to include("\tSummary: This is just a fake gem for testing")
- expect(out).to include("\tHomepage: #{expected}")
+ expect(out).to include("\tHomepage: No website available.")
expect(out).to include("\tStatus: Up to date")
end
end
@@ -164,7 +135,7 @@ RSpec.describe "bundle show", :bundler => "< 3", :ruby => ">= 2.0" do
expect(out).to include("foo (1.0 #{sha[0..6]})")
end
- it "handles when a version is a '-' prerelease", :rubygems => "2.1" do
+ 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
gem "foo", "1.0.0-beta.1", :git => "#{lib_path("foo")}"
@@ -186,7 +157,7 @@ RSpec.describe "bundle show", :bundler => "< 3", :ruby => ">= 2.0" do
it "does not output git errors" do
bundle :show
- expect(err).to lack_errors
+ expect(err_without_deprecations).to be_empty
end
end
@@ -196,11 +167,24 @@ RSpec.describe "bundle show", :bundler => "< 3", :ruby => ">= 2.0" do
gem "foo"
G
- bundle "config auto_install 1"
+ bundle "config set auto_install 1"
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
+ source "file://#{gem_repo1}"
+ gem "rack"
+ gem "rack-obama"
+ G
+
+ 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
@@ -211,7 +195,7 @@ RSpec.describe "bundle show", :bundler => "< 3", :ruby => ">= 2.0" do
invalid_regexp = "[]"
bundle "show #{invalid_regexp}"
- expect(out).to include("Could not find gem '#{invalid_regexp}'.")
+ expect(err).to include("Could not find gem '#{invalid_regexp}'.")
end
end
@@ -242,3 +226,7 @@ RSpec.describe "bundle show", :bundler => "< 3", :ruby => ">= 2.0" do
end
end
end
+
+RSpec.describe "bundle show", :bundler => "3" do
+ pending "shows a friendly error about the command removal"
+end
diff --git a/spec/bundler/commands/update_spec.rb b/spec/bundler/commands/update_spec.rb
index 1effba6526..46c208db6c 100644
--- a/spec/bundler/commands/update_spec.rb
+++ b/spec/bundler/commands/update_spec.rb
@@ -8,6 +8,7 @@ RSpec.describe "bundle update" do
source "file://#{gem_repo2}"
gem "activesupport"
gem "rack-obama"
+ gem "platform_specific"
G
end
@@ -64,25 +65,25 @@ RSpec.describe "bundle update" do
gem "rack", "1.0"
G
- bundle! "update --gemfile OmgFile", :all => bundle_update_requires_all?
+ bundle! "update --gemfile OmgFile", :all => true
expect(bundled_app("OmgFile.lock")).to exist
end
end
context "when update_requires_all_flag is set" do
- before { bundle! "config update_requires_all_flag true" }
+ before { bundle! "config set update_requires_all_flag true" }
it "errors when passed nothing" do
install_gemfile! ""
bundle :update
- expect(out).to eq("To update everything, pass the `--all` flag.")
+ expect(err).to eq("To update everything, pass the `--all` flag.")
end
it "errors when passed --all and another option" do
install_gemfile! ""
bundle "update --all foo"
- expect(out).to eq("Cannot specify --all along with specific options.")
+ expect(err).to eq("Cannot specify --all along with specific options.")
end
it "updates everything when passed --all" do
@@ -113,11 +114,11 @@ RSpec.describe "bundle update" do
describe "with an unknown dependency" do
it "should inform the user" do
bundle "update halting-problem-solver"
- expect(out).to include "Could not find gem 'halting-problem-solver'"
+ expect(err).to include "Could not find gem 'halting-problem-solver'"
end
it "should suggest alternatives" do
- bundle "update active-support"
- expect(out).to include "Did you mean activesupport?"
+ bundle "update platformspecific"
+ expect(err).to include "Did you mean platform_specific?"
end
end
@@ -132,7 +133,7 @@ RSpec.describe "bundle update" do
describe "when a possible resolve requires an older version of a locked gem" do
context "and only_update_to_newer_versions is set" do
before do
- bundle! "config only_update_to_newer_versions true"
+ bundle! "config set only_update_to_newer_versions true"
end
it "does not go to an older version" do
@@ -166,7 +167,7 @@ RSpec.describe "bundle update" do
end
end
- bundle! "update", :all => bundle_update_requires_all?
+ bundle! "update", :all => true
expect(the_bundle).to include_gems("slim 3.0.9", "slim-rails 3.1.3", "slim_lint 0.16.1")
end
@@ -281,25 +282,25 @@ RSpec.describe "bundle update" do
describe "in a frozen bundle" do
it "should fail loudly", :bundler => "< 3" do
bundle! "install --deployment"
- bundle "update", :all => bundle_update_requires_all?
+ bundle "update", :all => true
expect(last_command).to be_failure
- expect(out).to match(/You are trying to install in deployment mode after changing.your Gemfile/m)
- expect(out).to match(/freeze \nby running `bundle install --no-deployment`./m)
+ expect(err).to match(/You are trying to install in deployment mode after changing.your Gemfile/m)
+ expect(err).to match(/freeze \nby running `bundle install --no-deployment`./m)
end
it "should suggest different command when frozen is set globally", :bundler => "< 3" do
- bundle! "config --global frozen 1"
- bundle "update", :all => bundle_update_requires_all?
- expect(out).to match(/You are trying to install in deployment mode after changing.your Gemfile/m).
- and match(/freeze \nby running `bundle config --delete frozen`./m)
+ bundle! "config set --global frozen 1"
+ bundle "update", :all => true
+ expect(err).to match(/You are trying to install in deployment mode after changing.your Gemfile/m).
+ and match(/freeze \nby running `bundle config unset frozen`./m)
end
it "should suggest different command when frozen is set globally", :bundler => "3" do
- bundle! "config --global deployment true"
- bundle "update", :all => bundle_update_requires_all?
- expect(out).to match(/You are trying to install in deployment mode after changing.your Gemfile/m).
- and match(/freeze \nby running `bundle config --delete deployment`./m)
+ bundle! "config set --global deployment true"
+ bundle "update", :all => true
+ expect(err).to match(/You are trying to install in deployment mode after changing.your Gemfile/m).
+ and match(/freeze \nby running `bundle config unset deployment`./m)
end
end
@@ -327,7 +328,7 @@ RSpec.describe "bundle update" do
end
context "with unlock_source_unlocks_spec set to false" do
- before { bundle! "config unlock_source_unlocks_spec false" }
+ before { bundle! "config set unlock_source_unlocks_spec false" }
it "should not update gems not included in the source that happen to have the same name" do
install_gemfile <<-G
@@ -541,7 +542,7 @@ RSpec.describe "bundle update without a Gemfile.lock" do
gem "rack", "1.0"
G
- bundle "update", :all => bundle_update_requires_all?
+ bundle "update", :all => true
expect(the_bundle).to include_gems "rack 1.0.0"
end
@@ -562,7 +563,7 @@ RSpec.describe "bundle update when a gem depends on a newer version of bundler"
end
it "should explain that bundler conflicted", :bundler => "< 3" do
- bundle "update", :all => bundle_update_requires_all?
+ bundle "update", :all => true
expect(last_command.stdboth).not_to match(/in snapshot/i)
expect(last_command.bundler_err).to match(/current Bundler version/i).
and match(/perhaps you need to update bundler/i)
@@ -585,19 +586,19 @@ RSpec.describe "bundle update" do
gem "activesupport"
G
- bundle "update", :all => bundle_update_requires_all?
+ bundle "update", :all => true
expect(out).to include("Using activesupport 2.3.5")
update_repo2 do
build_gem "activesupport", "3.0"
end
- bundle "update", :all => bundle_update_requires_all?
+ bundle "update", :all => true
expect(out).to include("Installing activesupport 3.0 (was 2.3.5)")
end
context "with suppress_install_using_messages set" do
- before { bundle! "config suppress_install_using_messages true" }
+ before { bundle! "config set suppress_install_using_messages true" }
it "only prints `Using` for versions that have changed" do
build_repo4 do
@@ -611,7 +612,7 @@ RSpec.describe "bundle update" do
gem "foo"
G
- bundle! "update", :all => bundle_update_requires_all?
+ bundle! "update", :all => true
out.gsub!(/RubyGems [\d\.]+ is not threadsafe.*\n?/, "")
expect(out).to include "Resolving dependencies...\nBundle updated!"
@@ -619,7 +620,7 @@ RSpec.describe "bundle update" do
build_gem "foo", "2.0"
end
- bundle! "update", :all => bundle_update_requires_all?
+ 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
@@ -638,7 +639,7 @@ RSpec.describe "bundle update" do
G
bundle "update nonexisting"
- expect(out).to include("This Bundle hasn't been installed yet. Run `bundle install` to update and install the bundled gems.")
+ expect(err).to include("This Bundle hasn't been installed yet. Run `bundle install` to update and install the bundled gems.")
expect(exitstatus).to eq(22) if exitstatus
end
end
@@ -718,7 +719,7 @@ RSpec.describe "bundle update --ruby" do
it "shows a helpful error message" do
bundle "update --ruby"
- expect(out).to include("Your Ruby version is 2.2.2, but your Gemfile specified ~> 2.1.0")
+ expect(err).to include("Your Ruby version is 2.2.2, but your Gemfile specified ~> 2.1.0")
end
end
@@ -808,6 +809,15 @@ RSpec.describe "bundle update conservative" do
G
end
+ context "with patch set as default update level in config" do
+ it "should do a patch level update" do
+ bundle! "config set --local prefer_patch true"
+ bundle! "update foo"
+
+ expect(the_bundle).to include_gems "foo 1.4.5", "bar 2.1.1", "qux 1.0.0"
+ end
+ end
+
context "patch preferred" do
it "single gem updates dependent gem to minor" do
bundle! "update --patch foo"
@@ -816,7 +826,7 @@ RSpec.describe "bundle update conservative" do
end
it "update all" do
- bundle! "update --patch", :all => bundle_update_requires_all?
+ bundle! "update --patch", :all => true
expect(the_bundle).to include_gems "foo 1.4.5", "bar 2.1.1", "qux 1.0.1"
end
@@ -838,7 +848,7 @@ RSpec.describe "bundle update conservative" do
end
it "minor preferred" do
- bundle! "update --minor --strict", :all => bundle_update_requires_all?
+ bundle! "update --minor --strict", :all => true
expect(the_bundle).to include_gems "foo 1.5.0", "bar 2.1.1", "qux 1.1.0"
end
@@ -935,7 +945,7 @@ RSpec.describe "bundle update conservative" do
end
it "raises if too many flags are provided" do
- bundle "update --patch --minor", :all => bundle_update_requires_all?
+ bundle "update --patch --minor", :all => true
expect(last_command.bundler_err).to eq "Provide only one of the following options: minor, patch"
end
diff --git a/spec/bundler/commands/viz_spec.rb b/spec/bundler/commands/viz_spec.rb
index 61414956a9..96cc21b5f7 100644
--- a/spec/bundler/commands/viz_spec.rb
+++ b/spec/bundler/commands/viz_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe "bundle viz", :ruby => "1.9.3", :bundler => "< 3", :if => Bundler.which("dot") do
+RSpec.describe "bundle viz", :bundler => "< 3", :if => Bundler.which("dot") do
let(:ruby_graphviz) do
graphviz_glob = base_system_gems.join("cache/ruby-graphviz*")
Pathname.glob(graphviz_glob).first
diff --git a/spec/bundler/install/allow_offline_install_spec.rb b/spec/bundler/install/allow_offline_install_spec.rb
index d4bb595771..8af88b7efe 100644
--- a/spec/bundler/install/allow_offline_install_spec.rb
+++ b/spec/bundler/install/allow_offline_install_spec.rb
@@ -2,7 +2,7 @@
RSpec.describe "bundle install with :allow_offline_install" do
before do
- bundle "config allow_offline_install true"
+ bundle "config set allow_offline_install true"
end
context "with no cached data locally" do
@@ -19,7 +19,7 @@ RSpec.describe "bundle install with :allow_offline_install" do
source "http://testgemserver.local"
gem "rack-obama"
G
- expect(out).to include("Could not reach host testgemserver.local.")
+ expect(err).to include("Could not reach host testgemserver.local.")
expect(the_bundle).to_not be_locked
end
end
@@ -28,7 +28,7 @@ RSpec.describe "bundle install with :allow_offline_install" do
it "will install from the compact index" do
system_gems ["rack-1.0.0"], :path => :bundle_path
- bundle! "config clean false"
+ bundle! "config set clean false"
install_gemfile! <<-G, :artifice => "compact_index"
source "http://testgemserver.local"
gem "rack-obama"
@@ -77,7 +77,7 @@ RSpec.describe "bundle install with :allow_offline_install" do
G
break_git_remote_ops! { bundle! :update, :all => true }
- expect(out).to include("Using cached git data because of network errors")
+ expect(err).to include("Using cached git data because of network errors")
expect(the_bundle).to be_locked
break_git_remote_ops! do
@@ -85,7 +85,7 @@ RSpec.describe "bundle install with :allow_offline_install" do
gem "a", :git => #{git.path.to_s.dump}, :branch => "new_branch"
G
end
- expect(out).to include("Using cached git data because of network errors")
+ expect(err).to include("Using cached git data because of network errors")
expect(the_bundle).to be_locked
end
end
diff --git a/spec/bundler/install/binstubs_spec.rb b/spec/bundler/install/binstubs_spec.rb
index f04d3fe654..daa20693c7 100644
--- a/spec/bundler/install/binstubs_spec.rb
+++ b/spec/bundler/install/binstubs_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe "bundle install", :bundler => "< 3" do
+RSpec.describe "bundle install" do
describe "when system_bindir is set" do
# On OS X, Gem.bindir defaults to /usr/bin, so system_bindir is useful if
# you want to avoid sudo installs for system gems with OS X's default ruby
@@ -20,7 +20,7 @@ RSpec.describe "bundle install", :bundler => "< 3" do
end
end
- describe "when multiple gems contain the same exe", :bundler => "< 3" do
+ describe "when multiple gems contain the same exe" do
before do
build_repo2 do
build_gem "fake", "14" do |s|
@@ -28,16 +28,25 @@ RSpec.describe "bundle install", :bundler => "< 3" do
end
end
- install_gemfile <<-G, :binstubs => true
+ install_gemfile <<-G
source "file://#{gem_repo2}"
gem "fake"
gem "rack"
G
end
- it "loads the correct spec's executable" do
- gembin("rackup")
- expect(out).to eq("1.2")
+ it "warns about the situation" do
+ bundle! "exec rackup"
+
+ expect(last_command.stderr).to include(
+ "The `rackup` executable in the `fake` gem is being loaded, but it's also present in other gems (rack).\n" \
+ "If you meant to run the executable for another gem, make sure you use a project specific binstub (`bundle binstub <gem_name>`).\n" \
+ "If you plan to use multiple conflicting executables, generate binstubs for them and disambiguate their names."
+ ).or include(
+ "The `rackup` executable in the `rack` gem is being loaded, but it's also present in other gems (fake).\n" \
+ "If you meant to run the executable for another gem, make sure you use a project specific binstub (`bundle binstub <gem_name>`).\n" \
+ "If you plan to use multiple conflicting executables, generate binstubs for them and disambiguate their names."
+ )
end
end
end
diff --git a/spec/bundler/install/bundler_spec.rb b/spec/bundler/install/bundler_spec.rb
index 42863ed89b..3347988cdd 100644
--- a/spec/bundler/install/bundler_spec.rb
+++ b/spec/bundler/install/bundler_spec.rb
@@ -125,8 +125,8 @@ RSpec.describe "bundle install" do
expect(last_command.bundler_err).to include(nice_error)
end
- it "can install dependencies with newer bundler version with system gems", :ruby => "> 2" do
- bundle! "config path.system true"
+ it "can install dependencies with newer bundler version with system gems" do
+ bundle! "config set path.system true"
install_gemfile! <<-G
source "file://#{gem_repo2}"
gem "rails", "3.0"
@@ -138,9 +138,9 @@ RSpec.describe "bundle install" do
expect(out).to include("The Gemfile's dependencies are satisfied")
end
- it "can install dependencies with newer bundler version with a local path", :ruby => "> 2" do
- bundle! "config path .bundle"
- bundle! "config global_path_appends_ruby_scope true"
+ it "can install dependencies with newer bundler version with a local path" do
+ bundle! "config set path .bundle"
+ bundle! "config set global_path_appends_ruby_scope true"
install_gemfile! <<-G
source "file://#{gem_repo2}"
gem "rails", "3.0"
@@ -153,7 +153,7 @@ RSpec.describe "bundle install" do
end
context "with allow_bundler_dependency_conflicts set" do
- before { bundle! "config allow_bundler_dependency_conflicts true" }
+ before { bundle! "config set allow_bundler_dependency_conflicts true" }
it "are forced to the current bundler version with warnings when no compatible version is found" do
build_repo4 do
@@ -167,7 +167,7 @@ RSpec.describe "bundle install" do
gem "requires_nonexistant_bundler"
G
- expect(out).to include "requires_nonexistant_bundler (1.0) has dependency bundler (= 99.99.99.99), " \
+ expect(err).to include "requires_nonexistant_bundler (1.0) has dependency bundler (= 99.99.99.99), " \
"which is unsatisfied by the current bundler version #{Bundler::VERSION}, so the dependency is being ignored"
expect(the_bundle).to include_gems "bundler #{Bundler::VERSION}", "requires_nonexistant_bundler 1.0"
diff --git a/spec/bundler/install/deploy_spec.rb b/spec/bundler/install/deploy_spec.rb
index ec72ff69fc..918dbabfbe 100644
--- a/spec/bundler/install/deploy_spec.rb
+++ b/spec/bundler/install/deploy_spec.rb
@@ -11,26 +11,26 @@ RSpec.describe "install with --deployment or --frozen" do
context "with CLI flags", :bundler => "< 3" do
it "fails without a lockfile and says that --deployment requires a lock" do
bundle "install --deployment"
- expect(out).to include("The --deployment flag requires a Gemfile.lock")
+ expect(err).to include("The --deployment flag requires a Gemfile.lock")
end
it "fails without a lockfile and says that --frozen requires a lock" do
bundle "install --frozen"
- expect(out).to include("The --frozen flag requires a Gemfile.lock")
+ expect(err).to include("The --frozen flag requires a Gemfile.lock")
end
it "disallows --deployment --system" do
bundle "install --deployment --system"
- expect(out).to include("You have specified both --deployment")
- expect(out).to include("Please choose only one option")
+ expect(err).to include("You have specified both --deployment")
+ expect(err).to include("Please choose only one option")
expect(exitstatus).to eq(15) if exitstatus
end
it "disallows --deployment --path --system" do
bundle "install --deployment --path . --system"
- expect(out).to include("You have specified both --path")
- expect(out).to include("as well as --system")
- expect(out).to include("Please choose only one option")
+ expect(err).to include("You have specified both --path")
+ expect(err).to include("as well as --system")
+ expect(err).to include("Please choose only one option")
expect(exitstatus).to eq(15) if exitstatus
end
@@ -129,11 +129,11 @@ RSpec.describe "install with --deployment or --frozen" do
G
bundle :install, forgotten_command_line_options(:deployment => true)
- expect(out).to include("deployment mode")
- expect(out).to include("You have added to the Gemfile")
- expect(out).to include("* rack-obama")
- expect(out).not_to include("You have deleted from the Gemfile")
- expect(out).not_to include("You have changed in the Gemfile")
+ expect(err).to include("deployment mode")
+ expect(err).to include("You have added to the Gemfile")
+ expect(err).to include("* rack-obama")
+ expect(err).not_to include("You have deleted from the Gemfile")
+ expect(err).not_to include("You have changed in the Gemfile")
end
it "works if a path gem is missing but is in a without group" do
@@ -162,7 +162,7 @@ RSpec.describe "install with --deployment or --frozen" do
FileUtils.rm_r lib_path("path_gem-1.0")
bundle :install, forgotten_command_line_options(:path => ".bundle", :deployment => true)
- expect(out).to include("The path `#{lib_path("path_gem-1.0")}` does not exist.")
+ expect(err).to include("The path `#{lib_path("path_gem-1.0")}` does not exist.")
end
it "can have --frozen set via an environment variable", :bundler => "< 3" do
@@ -174,11 +174,11 @@ RSpec.describe "install with --deployment or --frozen" do
ENV["BUNDLE_FROZEN"] = "1"
bundle "install"
- expect(out).to include("deployment mode")
- expect(out).to include("You have added to the Gemfile")
- expect(out).to include("* rack-obama")
- expect(out).not_to include("You have deleted from the Gemfile")
- expect(out).not_to include("You have changed in the Gemfile")
+ expect(err).to include("deployment mode")
+ expect(err).to include("You have added to the Gemfile")
+ expect(err).to include("* rack-obama")
+ expect(err).not_to include("You have deleted from the Gemfile")
+ expect(err).not_to include("You have changed in the Gemfile")
end
it "can have --deployment set via an environment variable" do
@@ -190,11 +190,11 @@ RSpec.describe "install with --deployment or --frozen" do
ENV["BUNDLE_DEPLOYMENT"] = "true"
bundle "install"
- expect(out).to include("deployment mode")
- expect(out).to include("You have added to the Gemfile")
- expect(out).to include("* rack-obama")
- expect(out).not_to include("You have deleted from the Gemfile")
- expect(out).not_to include("You have changed in the Gemfile")
+ expect(err).to include("deployment mode")
+ expect(err).to include("You have added to the Gemfile")
+ expect(err).to include("* rack-obama")
+ expect(err).not_to include("You have deleted from the Gemfile")
+ expect(err).not_to include("You have changed in the Gemfile")
end
it "can have --frozen set to false via an environment variable" do
@@ -212,21 +212,6 @@ RSpec.describe "install with --deployment or --frozen" do
expect(out).not_to include("* rack-obama")
end
- it "explodes with the --frozen flag if you make a change and don't check in the lockfile", :bundler => "< 2" do
- gemfile <<-G
- source "file://#{gem_repo1}"
- gem "rack"
- gem "rack-obama", "1.1"
- G
-
- bundle :install, forgotten_command_line_options(:frozen => true)
- expect(out).to include("deployment mode")
- expect(out).to include("You have added to the Gemfile")
- expect(out).to include("* rack-obama (= 1.1)")
- expect(out).not_to include("You have deleted from the Gemfile")
- expect(out).not_to include("You have changed in the Gemfile")
- end
-
it "explodes if you remove a gem and don't check in the lockfile" do
gemfile <<-G
source "file://#{gem_repo1}"
@@ -234,10 +219,10 @@ RSpec.describe "install with --deployment or --frozen" do
G
bundle :install, forgotten_command_line_options(:deployment => true)
- expect(out).to include("deployment mode")
- expect(out).to include("You have added to the Gemfile:\n* activesupport\n\n")
- expect(out).to include("You have deleted from the Gemfile:\n* rack")
- expect(out).not_to include("You have changed in the Gemfile")
+ expect(err).to include("deployment mode")
+ expect(err).to include("You have added to the Gemfile:\n* activesupport\n\n")
+ expect(err).to include("You have deleted from the Gemfile:\n* rack")
+ expect(err).not_to include("You have changed in the Gemfile")
end
it "explodes if you add a source" do
@@ -247,9 +232,9 @@ RSpec.describe "install with --deployment or --frozen" do
G
bundle :install, forgotten_command_line_options(:deployment => true)
- expect(out).to include("deployment mode")
- expect(out).to include("You have added to the Gemfile:\n* source: git://hubz.com (at master)")
- expect(out).not_to include("You have changed in the Gemfile")
+ expect(err).to include("deployment mode")
+ expect(err).to include("You have added to the Gemfile:\n* source: git://hubz.com (at master)")
+ expect(err).not_to include("You have changed in the Gemfile")
end
it "explodes if you unpin a source" do
@@ -266,10 +251,10 @@ RSpec.describe "install with --deployment or --frozen" do
G
bundle :install, forgotten_command_line_options(:deployment => true)
- expect(out).to include("deployment mode")
- expect(out).to include("You have deleted from the Gemfile:\n* source: #{lib_path("rack-1.0")} (at master@#{revision_for(lib_path("rack-1.0"))[0..6]}")
- expect(out).not_to include("You have added to the Gemfile")
- expect(out).not_to include("You have changed in the Gemfile")
+ expect(err).to include("deployment mode")
+ expect(err).to include("You have deleted from the Gemfile:\n* source: #{lib_path("rack-1.0")} (at master@#{revision_for(lib_path("rack-1.0"))[0..6]}")
+ expect(err).not_to include("You have added to the Gemfile")
+ expect(err).not_to include("You have changed in the Gemfile")
end
it "explodes if you unpin a source, leaving it pinned somewhere else" do
@@ -289,19 +274,15 @@ RSpec.describe "install with --deployment or --frozen" do
G
bundle :install, forgotten_command_line_options(:deployment => true)
- expect(out).to include("deployment mode")
- expect(out).to include("You have changed in the Gemfile:\n* rack from `no specified source` to `#{lib_path("rack")} (at master@#{revision_for(lib_path("rack"))[0..6]})`")
- expect(out).not_to include("You have added to the Gemfile")
- expect(out).not_to include("You have deleted from the Gemfile")
+ expect(err).to include("deployment mode")
+ expect(err).to include("You have changed in the Gemfile:\n* rack from `no specified source` to `#{lib_path("rack")} (at master@#{revision_for(lib_path("rack"))[0..6]})`")
+ expect(err).not_to include("You have added to the Gemfile")
+ expect(err).not_to include("You have deleted from the Gemfile")
end
context "when replacing a host with the same host with credentials" do
let(:success_message) do
- if Bundler.bundler_major_version < 3
- "Could not reach host localgemserver.test"
- else
- "Bundle complete!"
- end
+ "Bundle complete!"
end
before do
@@ -322,31 +303,33 @@ RSpec.describe "install with --deployment or --frozen" do
DEPENDENCIES
rack
G
+
+ bundle! "config set --local deployment true"
end
it "prevents the replace by default" do
- bundle :install, forgotten_command_line_options(:deployment => true)
+ bundle :install
- expect(out).to match(/The list of sources changed/)
+ expect(err).to match(/The list of sources changed/)
end
context "when allow_deployment_source_credential_changes is true" do
- before { bundle! "config allow_deployment_source_credential_changes true" }
+ before { bundle! "config set allow_deployment_source_credential_changes true" }
it "allows the replace" do
- bundle :install, forgotten_command_line_options(:deployment => true)
+ bundle :install
expect(out).to match(/#{success_message}/)
end
end
context "when allow_deployment_source_credential_changes is false" do
- before { bundle! "config allow_deployment_source_credential_changes false" }
+ before { bundle! "config set allow_deployment_source_credential_changes false" }
it "prevents the replace" do
- bundle :install, forgotten_command_line_options(:deployment => true)
+ bundle :install
- expect(out).to match(/The list of sources changed/)
+ expect(err).to match(/The list of sources changed/)
end
end
@@ -354,7 +337,7 @@ RSpec.describe "install with --deployment or --frozen" do
before { ENV["BUNDLE_ALLOW_DEPLOYMENT_SOURCE_CREDENTIAL_CHANGES"] = "true" }
it "allows the replace" do
- bundle :install, forgotten_command_line_options(:deployment => true)
+ bundle :install
expect(out).to match(/#{success_message}/)
end
@@ -364,9 +347,9 @@ RSpec.describe "install with --deployment or --frozen" do
before { ENV["BUNDLE_ALLOW_DEPLOYMENT_SOURCE_CREDENTIAL_CHANGES"] = "false" }
it "prevents the replace" do
- bundle :install, forgotten_command_line_options(:deployment => true)
+ bundle :install
- expect(out).to match(/The list of sources changed/)
+ expect(err).to match(/The list of sources changed/)
end
end
end
@@ -374,7 +357,7 @@ RSpec.describe "install with --deployment or --frozen" do
it "remembers that the bundle is frozen at runtime" do
bundle! :lock
- bundle! "config deployment true"
+ bundle! "config set --local deployment true"
gemfile <<-G
source "file://#{gem_repo1}"
@@ -383,7 +366,7 @@ RSpec.describe "install with --deployment or --frozen" do
G
expect(the_bundle).not_to include_gems "rack 1.0.0"
- expect(err).to include strip_whitespace(<<-E).strip
+ expect(last_command.stderr).to include strip_whitespace(<<-E).strip
The dependencies in your gemfile changed
You have added to the Gemfile:
@@ -412,7 +395,8 @@ You have deleted from the Gemfile:
expect(out).to include("Updating files in vendor/cache")
simulate_new_machine
- bundle! "install --verbose", forgotten_command_line_options(:deployment => true)
+ bundle! "config set --local deployment true"
+ bundle! "install --verbose"
expect(out).not_to include("You are trying to install in deployment mode after changing your Gemfile")
expect(out).not_to include("You have added to the Gemfile")
expect(out).not_to include("You have deleted from the Gemfile")
diff --git a/spec/bundler/install/failure_spec.rb b/spec/bundler/install/failure_spec.rb
index b4cdf13857..49e2771dca 100644
--- a/spec/bundler/install/failure_spec.rb
+++ b/spec/bundler/install/failure_spec.rb
@@ -121,5 +121,24 @@ In Gemfile:
activesupport
M
end
+
+ context "because the downloaded .gem was invalid" do
+ before do
+ build_repo4 do
+ build_gem "a"
+ end
+
+ gem_repo4("gems", "a-1.0.gem").open("w") {|f| f << "<html></html>" }
+ end
+
+ it "removes the downloaded .gem" do
+ install_gemfile <<-G
+ source "file:#{gem_repo4}"
+ gem "a"
+ G
+
+ expect(default_bundle_path("cache", "a-1.0.gem")).not_to exist
+ end
+ end
end
end
diff --git a/spec/bundler/install/gemfile/gemspec_spec.rb b/spec/bundler/install/gemfile/gemspec_spec.rb
index bbb56da5a4..0bec2e9d96 100644
--- a/spec/bundler/install/gemfile/gemspec_spec.rb
+++ b/spec/bundler/install/gemfile/gemspec_spec.rb
@@ -117,7 +117,7 @@ RSpec.describe "bundle install from an existing gemspec" do
build_lib("foo", :path => tmp.join("foo")) do |s|
s.write("Gemfile", "source 'file://#{gem_repo1}'\ngemspec")
s.add_dependency "actionpack", "=2.3.2"
- s.add_development_dependency "rake", "=10.0.2"
+ s.add_development_dependency "rake", "=12.3.2"
end
Dir.chdir(tmp.join("foo")) do
@@ -239,7 +239,7 @@ RSpec.describe "bundle install from an existing gemspec" do
expect(the_bundle).to include_gems "foo 1.0.0"
end
- it "does not break Gem.finish_resolve with conflicts", :rubygems => ">= 2" do
+ it "does not break Gem.finish_resolve with conflicts" do
build_lib("foo", :path => tmp.join("foo")) do |s|
s.version = "1.0.0"
s.add_dependency "bar", "= 1.0.0"
@@ -263,6 +263,20 @@ RSpec.describe "bundle install from an existing gemspec" do
expect(out).to eq("WIN")
end
+ it "works with only_update_to_newer_versions" do
+ build_lib "omg", "2.0", :path => lib_path("omg")
+
+ install_gemfile <<-G
+ gemspec :path => "#{lib_path("omg")}"
+ G
+
+ build_lib "omg", "1.0", :path => lib_path("omg")
+
+ bundle! :install, :env => { "BUNDLE_BUNDLE_ONLY_UPDATE_TO_NEWER_VERSIONS" => "true" }
+
+ expect(the_bundle).to include_gems "omg 1.0"
+ end
+
context "in deployment mode" do
context "when the lockfile was not updated after a change to the gemspec's dependencies" do
it "reports that installation failed" do
@@ -283,7 +297,7 @@ RSpec.describe "bundle install from an existing gemspec" do
bundle :install, forgotten_command_line_options(:deployment => true)
- expect(out).to include("changed")
+ expect(err).to include("changed")
end
end
end
@@ -433,7 +447,7 @@ RSpec.describe "bundle install from an existing gemspec" do
end
end
- context "on ruby", :bundler => "< 3" do
+ context "on ruby" do
before do
simulate_platform("ruby")
bundle :install
@@ -533,107 +547,6 @@ RSpec.describe "bundle install from an existing gemspec" do
end
end
end
-
- context "on ruby", :bundler => "3" do
- before do
- simulate_platform("ruby")
- bundle :install
- end
-
- context "as a runtime dependency" do
- it "keeps java dependencies in the lockfile" do
- expect(the_bundle).to include_gems "foo 1.0", "platform_specific 1.0 RUBY"
- expect(lockfile).to eq normalize_uri_file(strip_whitespace(<<-L))
- GEM
- remote: file://localhost#{gem_repo2}/
- specs:
- platform_specific (1.0)
- platform_specific (1.0-java)
-
- PATH
- remote: .
- specs:
- foo (1.0)
- platform_specific
-
- PLATFORMS
- java
- ruby
-
- DEPENDENCIES
- foo!
-
- BUNDLED WITH
- #{Bundler::VERSION}
- L
- end
- end
-
- context "as a development dependency" do
- let(:platform_specific_type) { :development }
-
- it "keeps java dependencies in the lockfile" do
- expect(the_bundle).to include_gems "foo 1.0", "platform_specific 1.0 RUBY"
- expect(lockfile).to eq normalize_uri_file(strip_whitespace(<<-L))
- GEM
- remote: file://localhost#{gem_repo2}/
- specs:
- platform_specific (1.0)
- platform_specific (1.0-java)
-
- PATH
- remote: .
- specs:
- foo (1.0)
-
- PLATFORMS
- java
- ruby
-
- DEPENDENCIES
- foo!
- platform_specific
-
- BUNDLED WITH
- #{Bundler::VERSION}
- L
- end
- end
-
- context "with an indirect platform-specific development dependency" do
- let(:platform_specific_type) { :development }
- let(:dependency) { "indirect_platform_specific" }
-
- it "keeps java dependencies in the lockfile" do
- expect(the_bundle).to include_gems "foo 1.0", "indirect_platform_specific 1.0", "platform_specific 1.0 RUBY"
- expect(lockfile).to eq normalize_uri_file(strip_whitespace(<<-L))
- GEM
- remote: file://localhost#{gem_repo2}/
- specs:
- indirect_platform_specific (1.0)
- platform_specific
- platform_specific (1.0)
- platform_specific (1.0-java)
-
- PATH
- remote: .
- specs:
- foo (1.0)
-
- PLATFORMS
- java
- ruby
-
- DEPENDENCIES
- foo!
- indirect_platform_specific
-
- BUNDLED WITH
- #{Bundler::VERSION}
- L
- end
- end
- end
end
end
diff --git a/spec/bundler/install/gemfile/git_spec.rb b/spec/bundler/install/gemfile/git_spec.rb
index fe396c7a0f..f208853041 100644
--- a/spec/bundler/install/gemfile/git_spec.rb
+++ b/spec/bundler/install/gemfile/git_spec.rb
@@ -32,7 +32,7 @@ RSpec.describe "bundle install with git sources" do
it "caches the git repo globally" do
simulate_new_machine
- bundle! "config global_gem_cache true"
+ bundle! "config set global_gem_cache true"
bundle! :install
expect(Dir["#{home}/.bundle/cache/git/foo-1.0-*"]).to have_attributes :size => 1
end
@@ -87,7 +87,7 @@ RSpec.describe "bundle install with git sources" do
gem "foo", "1.1", :git => "#{lib_path("foo-1.0")}"
G
- expect(out).to include("The source contains 'foo' at: 1.0")
+ expect(err).to include("The source contains 'foo' at: 1.0")
end
it "complains with version and platform if pinned specs don't exist in the git repo" do
@@ -103,7 +103,7 @@ RSpec.describe "bundle install with git sources" do
end
G
- expect(out).to include("The source contains 'only_java' at: 1.0 java")
+ expect(err).to include("The source contains 'only_java' at: 1.0 java")
end
it "complains with multiple versions and platforms if pinned specs don't exist in the git repo" do
@@ -124,7 +124,7 @@ RSpec.describe "bundle install with git sources" do
end
G
- expect(out).to include("The source contains 'only_java' at: 1.0 java, 1.1 java")
+ expect(err).to include("The source contains 'only_java' at: 1.0 java, 1.1 java")
end
it "still works after moving the application directory" do
@@ -204,7 +204,7 @@ RSpec.describe "bundle install with git sources" do
gem "foo"
end
G
- expect(err).to lack_errors
+ expect(last_command.stderr).to be_empty
run <<-RUBY
require 'foo'
@@ -221,7 +221,7 @@ RSpec.describe "bundle install with git sources" do
end
Dir.chdir(lib_path("foo-1.0")) do
- `git update-ref -m 'Bundler Spec!' refs/bundler/1 master~1`
+ `git update-ref -m "Bundler Spec!" refs/bundler/1 master~1`
end
# want to ensure we don't fallback to HEAD
@@ -234,7 +234,7 @@ RSpec.describe "bundle install with git sources" do
gem "foo"
end
G
- expect(err).to lack_errors
+ expect(last_command.stderr).to be_empty
run! <<-RUBY
require 'foo'
@@ -257,7 +257,7 @@ RSpec.describe "bundle install with git sources" do
end
Dir.chdir(lib_path("foo-1.0")) do
- `git update-ref -m 'Bundler Spec!' refs/bundler/1 master~1`
+ `git update-ref -m "Bundler Spec!" refs/bundler/1 master~1`
end
# want to ensure we don't fallback to HEAD
@@ -270,7 +270,7 @@ RSpec.describe "bundle install with git sources" do
gem "foo"
end
G
- expect(err).to lack_errors
+ expect(last_command.stderr).to be_empty
run! <<-RUBY
require 'foo'
@@ -282,10 +282,10 @@ RSpec.describe "bundle install with git sources" do
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")
+ sys_exec!('git update-ref -m "Bundler Spec!" refs/bundler/1 master~1')
end
- bundle! "config global_gem_cache true"
+ bundle! "config set global_gem_cache true"
install_gemfile! <<-G
git "#{lib_path("foo-1.0")}" do
@@ -294,7 +294,7 @@ RSpec.describe "bundle install with git sources" do
G
# ensure we also git fetch after cloning
- bundle! :update, :all => bundle_update_requires_all?
+ bundle! :update, :all => true
Dir.chdir(Dir[home(".bundle/cache/git/foo-*")].first) do
sys_exec("git ls-remote .")
@@ -406,7 +406,7 @@ RSpec.describe "bundle install with git sources" do
gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
G
- bundle! %(config local.rack #{lib_path("local-rack")})
+ bundle! %(config set local.rack #{lib_path("local-rack")})
bundle! :install
run "require 'rack'"
@@ -427,7 +427,7 @@ RSpec.describe "bundle install with git sources" do
gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
G
- bundle %(config local.rack #{lib_path("local-rack")})
+ bundle %(config set local.rack #{lib_path("local-rack")})
run "require 'rack'"
expect(out).to eq("LOCAL")
end
@@ -447,7 +447,7 @@ RSpec.describe "bundle install with git sources" do
gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
G
- bundle! %(config local.rack #{lib_path("local-rack")})
+ bundle! %(config set local.rack #{lib_path("local-rack")})
bundle! :install
run! "require 'rack'"
expect(out).to eq("LOCAL")
@@ -470,7 +470,7 @@ RSpec.describe "bundle install with git sources" do
s.add_dependency "nokogiri", "1.4.2"
end
- bundle %(config local.rack #{lib_path("local-rack")})
+ bundle %(config set local.rack #{lib_path("local-rack")})
run "require 'rack'"
lockfile1 = File.read(bundled_app("Gemfile.lock"))
@@ -490,14 +490,14 @@ RSpec.describe "bundle install with git sources" do
FileUtils.cp_r("#{lib_path("rack-0.8")}/.", lib_path("local-rack"))
update_git "rack", "0.8", :path => lib_path("local-rack")
- bundle %(config local.rack #{lib_path("local-rack")})
+ bundle %(config set local.rack #{lib_path("local-rack")})
bundle :install
lockfile1 = File.read(bundled_app("Gemfile.lock"))
expect(lockfile1).not_to eq(lockfile0)
end
- it "explodes if given path does not exist on install" do
+ it "explodes and gives correct solution if given path does not exist on install" do
build_git "rack", "0.8"
install_gemfile <<-G
@@ -505,12 +505,20 @@ RSpec.describe "bundle install with git sources" do
gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
G
- bundle %(config local.rack #{lib_path("local-rack")})
+ bundle %(config set local.rack #{lib_path("local-rack")})
bundle :install
- expect(out).to match(/Cannot use local override for rack-0.8 because #{Regexp.escape(lib_path('local-rack').to_s)} does not exist/)
+ expect(err).to match(/Cannot use local override for rack-0.8 because #{Regexp.escape(lib_path('local-rack').to_s)} does not exist/)
+
+ solution = "config unset local.rack"
+ expect(err).to match(/Run `bundle #{solution}` to remove the local override/)
+
+ bundle solution
+ bundle :install
+
+ expect(last_command.stderr).to be_empty
end
- it "explodes if branch is not given on install" do
+ it "explodes and gives correct solution if branch is not given on install" do
build_git "rack", "0.8"
FileUtils.cp_r("#{lib_path("rack-0.8")}/.", lib_path("local-rack"))
@@ -519,9 +527,17 @@ RSpec.describe "bundle install with git sources" do
gem "rack", :git => "#{lib_path("rack-0.8")}"
G
- bundle %(config local.rack #{lib_path("local-rack")})
+ bundle %(config set local.rack #{lib_path("local-rack")})
+ bundle :install
+ expect(err).to match(/Cannot use local override for rack-0.8 at #{Regexp.escape(lib_path('local-rack').to_s)} because :branch is not specified in Gemfile/)
+
+ solution = "config unset local.rack"
+ expect(err).to match(/Specify a branch or run `bundle #{solution}` to remove the local override/)
+
+ bundle solution
bundle :install
- expect(out).to match(/cannot use local override/i)
+
+ expect(last_command.stderr).to be_empty
end
it "does not explode if disable_local_branch_check is given" do
@@ -533,8 +549,8 @@ RSpec.describe "bundle install with git sources" do
gem "rack", :git => "#{lib_path("rack-0.8")}"
G
- bundle %(config local.rack #{lib_path("local-rack")})
- bundle %(config disable_local_branch_check true)
+ bundle %(config set local.rack #{lib_path("local-rack")})
+ bundle %(config set disable_local_branch_check true)
bundle :install
expect(out).to match(/Bundle complete!/)
end
@@ -553,9 +569,9 @@ RSpec.describe "bundle install with git sources" do
gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
G
- bundle %(config local.rack #{lib_path("local-rack")})
+ bundle %(config set local.rack #{lib_path("local-rack")})
bundle :install
- expect(out).to match(/is using branch another but Gemfile specifies master/)
+ expect(err).to match(/is using branch another but Gemfile specifies master/)
end
it "explodes on invalid revision on install" do
@@ -570,9 +586,9 @@ RSpec.describe "bundle install with git sources" do
gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
G
- bundle %(config local.rack #{lib_path("local-rack")})
+ bundle %(config set local.rack #{lib_path("local-rack")})
bundle :install
- expect(out).to match(/The Gemfile lock is pointing to revision \w+/)
+ expect(err).to match(/The Gemfile lock is pointing to revision \w+/)
end
end
@@ -709,7 +725,7 @@ RSpec.describe "bundle install with git sources" do
build_lib "bar", :path => lib_path("foo/bar"), :gemspec => false do |s|
s.write lib_path("foo/bar/lib/version.rb"), %(BAR_VERSION = '1.0')
s.write "bar.gemspec", <<-G
- $:.unshift Dir.pwd # For 1.9
+ $:.unshift Dir.pwd
require 'lib/version'
Gem::Specification.new do |s|
s.name = 'bar'
@@ -769,7 +785,7 @@ RSpec.describe "bundle install with git sources" do
bundle :install
- expect(out).to include("Git error:")
+ expect(err).to include("Git error:")
expect(err).to include("fatal")
expect(err).to include("omgomg")
end
@@ -798,14 +814,14 @@ RSpec.describe "bundle install with git sources" do
s.write "lib/forced.rb", "FORCED = '1.1'"
end
- bundle "update", :all => bundle_update_requires_all?
+ 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
- bundle "update", :all => bundle_update_requires_all?
+ bundle "update", :all => true
expect(the_bundle).to include_gems "forced 1.0"
end
@@ -824,7 +840,7 @@ RSpec.describe "bundle install with git sources" do
gem "has_submodule"
end
G
- expect(out).to match(/could not find gem 'submodule/i)
+ expect(err).to match(/could not find gem 'submodule/i)
expect(the_bundle).not_to include_gems "has_submodule 1.0"
end
@@ -910,7 +926,7 @@ RSpec.describe "bundle install with git sources" do
G
expect(exitstatus).to_not eq(0) if exitstatus
- expect(out).to include("Bundler could not install a gem because it " \
+ expect(err).to include("Bundler could not install a gem because it " \
"needs to create a directory, but a file exists " \
"- #{default_bundle_path("bundler")}")
end
@@ -922,12 +938,11 @@ RSpec.describe "bundle install with git sources" do
build_git "foo", :path => lib_path("nested")
build_git "bar", :path => lib_path("nested")
- gemfile <<-G
+ install_gemfile <<-G
gem "foo", :git => "#{lib_path("nested")}"
gem "bar", :git => "#{lib_path("nested")}"
G
- bundle "install"
expect(File.read(bundled_app("Gemfile.lock")).scan("GIT").size).to eq(1)
end
@@ -1010,14 +1025,12 @@ RSpec.describe "bundle install with git sources" do
install_gemfile <<-G
gem "foo", :git => "file://#{lib_path("foo-1.0")}", :ref => "#{revision}"
G
- bundle "install"
expect(out).to_not match(/Revision.*does not exist/)
install_gemfile <<-G
gem "foo", :git => "file://#{lib_path("foo-1.0")}", :ref => "deadbeef"
G
- bundle "install"
- expect(out).to include("Revision deadbeef does not exist in the repository")
+ expect(err).to include("Revision deadbeef does not exist in the repository")
end
end
@@ -1054,7 +1067,7 @@ RSpec.describe "bundle install with git sources" do
bundle :install,
:requires => [lib_path("install_hooks.rb")]
- expect(err).to eq_err("Ran pre-install hook: foo-1.0")
+ expect(err_without_deprecations).to eq("Ran pre-install hook: foo-1.0")
end
it "runs post-install hooks" do
@@ -1074,7 +1087,7 @@ RSpec.describe "bundle install with git sources" do
bundle :install,
:requires => [lib_path("install_hooks.rb")]
- expect(err).to eq_err("Ran post-install hook: foo-1.0")
+ expect(err_without_deprecations).to eq("Ran post-install hook: foo-1.0")
end
it "complains if the install hook fails" do
@@ -1094,7 +1107,7 @@ RSpec.describe "bundle install with git sources" do
bundle :install,
:requires => [lib_path("install_hooks.rb")]
- expect(out).to include("failed for foo-1.0")
+ expect(err).to include("failed for foo-1.0")
end
end
@@ -1150,7 +1163,7 @@ RSpec.describe "bundle install with git sources" do
void Init_foo() { rb_define_global_function("foo", &foo, 0); }
C
end
- `git commit -m 'commit for iteration #{i}' ext/foo.c`
+ `git commit -m "commit for iteration #{i}" ext/foo.c`
end
git_commit_sha = git_reader.ref_for("HEAD")
@@ -1193,7 +1206,48 @@ In Gemfile:
expect(out).not_to include("gem install foo")
end
- it "does not reinstall the extension", :ruby_repo, :rubygems => ">= 2.3.0" do
+ it "does not reinstall the extension", :ruby_repo do
+ build_git "foo" do |s|
+ s.add_dependency "rake"
+ s.extensions << "Rakefile"
+ s.write "Rakefile", <<-RUBY
+ task :default do
+ path = File.expand_path("../lib", __FILE__)
+ FileUtils.mkdir_p(path)
+ cur_time = Time.now.to_f.to_s
+ File.open("\#{path}/foo.rb", "w") do |f|
+ f.puts "FOO = \#{cur_time}"
+ end
+ end
+ RUBY
+ end
+
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "foo", :git => "#{lib_path("foo-1.0")}"
+ G
+
+ run! <<-R
+ require 'foo'
+ puts FOO
+ R
+
+ installed_time = out
+ expect(installed_time).to match(/\A\d+\.\d+\z/)
+
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "foo", :git => "#{lib_path("foo-1.0")}"
+ G
+
+ run! <<-R
+ require 'foo'
+ puts FOO
+ R
+ expect(out).to eq(installed_time)
+ end
+
+ it "does not reinstall the extension when changing another gem" do
build_git "foo" do |s|
s.add_dependency "rake"
s.extensions << "Rakefile"
@@ -1211,6 +1265,7 @@ In Gemfile:
install_gemfile <<-G
source "file://#{gem_repo1}"
+ gem "rack", "0.9.1"
gem "foo", :git => "#{lib_path("foo-1.0")}"
G
@@ -1224,6 +1279,7 @@ In Gemfile:
install_gemfile <<-G
source "file://#{gem_repo1}"
+ gem "rack", "1.0.0"
gem "foo", :git => "#{lib_path("foo-1.0")}"
G
@@ -1233,6 +1289,60 @@ In Gemfile:
R
expect(out).to eq(installed_time)
end
+
+ it "does reinstall the extension when changing refs" do
+ build_git "foo" do |s|
+ s.add_dependency "rake"
+ s.extensions << "Rakefile"
+ s.write "Rakefile", <<-RUBY
+ task :default do
+ path = File.expand_path("../lib", __FILE__)
+ FileUtils.mkdir_p(path)
+ cur_time = Time.now.to_f.to_s
+ File.open("\#{path}/foo.rb", "w") do |f|
+ f.puts "FOO = \#{cur_time}"
+ end
+ end
+ RUBY
+ end
+
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "foo", :git => "#{lib_path("foo-1.0")}"
+ G
+
+ run! <<-R
+ require 'foo'
+ puts FOO
+ R
+
+ update_git("foo", :branch => "branch2")
+
+ installed_time = out
+ expect(installed_time).to match(/\A\d+\.\d+\z/)
+
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "foo", :git => "#{lib_path("foo-1.0")}", :branch => "branch2"
+ G
+
+ run! <<-R
+ require 'foo'
+ puts FOO
+ R
+ expect(out).not_to eq(installed_time)
+
+ installed_time = out
+
+ update_git("foo")
+ bundle! "update foo"
+
+ run! <<-R
+ require 'foo'
+ puts FOO
+ R
+ expect(out).not_to eq(installed_time)
+ end
end
it "ignores git environment variables" do
@@ -1268,7 +1378,7 @@ In Gemfile:
G
with_path_as("") do
- bundle "update", :all => bundle_update_requires_all?
+ bundle "update", :all => true
end
expect(last_command.bundler_err).
to include("You need to install git to be able to use gems from git repositories. For help installing git, please refer to GitHub's tutorial at https://help.github.com/articles/set-up-git")
@@ -1292,7 +1402,7 @@ In Gemfile:
describe "when the git source is overridden with a local git repo" do
before do
- bundle! "config --global local.foo #{lib_path("foo")}"
+ bundle! "config set --global local.foo #{lib_path("foo")}"
end
describe "and git output is colorized" do
@@ -1326,7 +1436,6 @@ In Gemfile:
end
G
- bundle :install
expect(last_command.stdboth).to_not include("password1")
expect(last_command.stdout).to include("Fetching https://user1@github.com/company/private-repo")
end
@@ -1342,7 +1451,6 @@ In Gemfile:
end
G
- bundle :install
expect(last_command.stdboth).to_not include("oauth_token")
expect(last_command.stdout).to include("Fetching https://x-oauth-basic@github.com/company/private-repo")
end
diff --git a/spec/bundler/install/gemfile/groups_spec.rb b/spec/bundler/install/gemfile/groups_spec.rb
index 45395e606f..f836499148 100644
--- a/spec/bundler/install/gemfile/groups_spec.rb
+++ b/spec/bundler/install/gemfile/groups_spec.rb
@@ -25,7 +25,7 @@ RSpec.describe "bundle install with groups" do
puts ACTIVESUPPORT
R
- expect(err).to eq_err("ZOMG LOAD ERROR")
+ expect(err_without_deprecations).to eq("ZOMG LOAD ERROR")
end
it "installs gems with inline :groups into those groups" do
@@ -36,7 +36,7 @@ RSpec.describe "bundle install with groups" do
puts THIN
R
- expect(err).to eq_err("ZOMG LOAD ERROR")
+ expect(err_without_deprecations).to eq("ZOMG LOAD ERROR")
end
it "sets up everything if Bundler.setup is used with no groups" do
@@ -57,7 +57,7 @@ RSpec.describe "bundle install with groups" do
puts THIN
RUBY
- expect(err).to eq_err("ZOMG LOAD ERROR")
+ expect(err_without_deprecations).to eq("ZOMG LOAD ERROR")
end
it "sets up old groups when they have previously been removed" do
@@ -207,7 +207,7 @@ RSpec.describe "bundle install with groups" do
it "errors out when passing a group to with and without via CLI flags", :bundler => "< 3" do
bundle :install, forgotten_command_line_options(:with => "emo debugging", :without => "emo")
expect(last_command).to be_failure
- expect(out).to include("The offending groups are: emo")
+ expect(err).to include("The offending groups are: emo")
end
it "allows the BUNDLE_WITH setting to override BUNDLE_WITHOUT" do
diff --git a/spec/bundler/install/gemfile/lockfile_spec.rb b/spec/bundler/install/gemfile/lockfile_spec.rb
index dc1baca6ea..96cd5067be 100644
--- a/spec/bundler/install/gemfile/lockfile_spec.rb
+++ b/spec/bundler/install/gemfile/lockfile_spec.rb
@@ -16,7 +16,7 @@ RSpec.describe "bundle install with a lockfile present" do
context "with plugins disabled" do
before do
- bundle! "config plugins false"
+ bundle! "config set plugins false"
subject
end
diff --git a/spec/bundler/install/gemfile/path_spec.rb b/spec/bundler/install/gemfile/path_spec.rb
index a508c971ad..54a41b576f 100644
--- a/spec/bundler/install/gemfile/path_spec.rb
+++ b/spec/bundler/install/gemfile/path_spec.rb
@@ -66,8 +66,8 @@ RSpec.describe "bundle install with explicit source paths" do
install_gemfile <<-G
gem 'foo', :path => "~#{username}/#{relative_path}"
G
- expect(out).to match("There was an error while trying to use the path `~#{username}/#{relative_path}`.")
- expect(out).to match("user #{username} doesn't exist")
+ expect(err).to match("There was an error while trying to use the path `~#{username}/#{relative_path}`.")
+ expect(err).to match("user #{username} doesn't exist")
end
it "expands paths relative to Bundler.root" do
@@ -132,6 +132,20 @@ RSpec.describe "bundle install with explicit source paths" do
expect(the_bundle).to include_gems "foo 1.0"
end
+ it "works with only_update_to_newer_versions" do
+ build_lib "omg", "2.0", :path => lib_path("omg")
+
+ install_gemfile <<-G
+ gem "omg", :path => "#{lib_path("omg")}"
+ G
+
+ build_lib "omg", "1.0", :path => lib_path("omg")
+
+ bundle! :install, :env => { "BUNDLE_BUNDLE_ONLY_UPDATE_TO_NEWER_VERSIONS" => "true" }
+
+ expect(the_bundle).to include_gems "omg 1.0"
+ end
+
it "prefers gemspecs closer to the path root" do
build_lib "premailer", "1.0.0", :path => lib_path("premailer") do |s|
s.write "gemfiles/ruby187.gemspec", <<-G
@@ -153,7 +167,7 @@ RSpec.describe "bundle install with explicit source paths" do
expect(the_bundle).to include_gems "premailer 1.0.0"
end
- it "warns on invalid specs", :rubygems => "1.7" do
+ it "warns on invalid specs" do
build_lib "foo"
gemspec = lib_path("foo-1.0").join("foo.gemspec").to_s
@@ -169,11 +183,11 @@ RSpec.describe "bundle install with explicit source paths" do
gem "foo", :path => "#{lib_path("foo-1.0")}"
G
- expect(out).to_not include("ERROR REPORT")
- expect(out).to_not include("Your Gemfile has no gem server sources.")
- expect(out).to match(/is not valid. Please fix this gemspec./)
- expect(out).to match(/The validation error was 'missing value for attribute version'/)
- expect(out).to match(/You have one or more invalid gemspecs that need to be fixed/)
+ 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'/)
+ expect(err).to match(/You have one or more invalid gemspecs that need to be fixed/)
end
it "supports gemspec syntax" do
@@ -260,7 +274,7 @@ RSpec.describe "bundle install with explicit source paths" do
G
expect(exitstatus).to eq(15) if exitstatus
- expect(out).to match(/There are multiple gemspecs/)
+ expect(err).to match(/There are multiple gemspecs/)
end
it "allows :name to be specified to resolve ambiguity" do
@@ -299,7 +313,7 @@ RSpec.describe "bundle install with explicit source paths" do
install_gemfile <<-G
gem 'foo', '1.0', :path => "#{lib_path("foo-1.0")}"
G
- expect(err).to lack_errors
+ expect(last_command.stderr).to be_empty
end
it "removes the .gem file after installing" do
@@ -561,7 +575,7 @@ RSpec.describe "bundle install with explicit source paths" do
bundle :install,
:requires => [lib_path("install_hooks.rb")]
- expect(err).to eq_err("Ran pre-install hook: foo-1.0")
+ expect(err_without_deprecations).to eq("Ran pre-install hook: foo-1.0")
end
it "runs post-install hooks" do
@@ -581,7 +595,7 @@ RSpec.describe "bundle install with explicit source paths" do
bundle :install,
:requires => [lib_path("install_hooks.rb")]
- expect(err).to eq_err("Ran post-install hook: foo-1.0")
+ expect(err_without_deprecations).to eq("Ran post-install hook: foo-1.0")
end
it "complains if the install hook fails" do
@@ -601,7 +615,7 @@ RSpec.describe "bundle install with explicit source paths" do
bundle :install,
:requires => [lib_path("install_hooks.rb")]
- expect(out).to include("failed for foo-1.0")
+ expect(err).to include("failed for foo-1.0")
end
it "loads plugins from the path gem" do
diff --git a/spec/bundler/install/gemfile/platform_spec.rb b/spec/bundler/install/gemfile/platform_spec.rb
index b5dbc41a33..891f766cc0 100644
--- a/spec/bundler/install/gemfile/platform_spec.rb
+++ b/spec/bundler/install/gemfile/platform_spec.rb
@@ -248,9 +248,9 @@ RSpec.describe "bundle install across platforms" do
gem "facter"
G
- expect(out).to include "Unable to use the platform-specific (universal-darwin) version of facter (2.4.6) " \
+ expect(err).to include "Unable to use the platform-specific (universal-darwin) version of facter (2.4.6) " \
"because it has different dependencies from the ruby version. " \
- "To use the platform-specific version of the gem, run `bundle config specific_platform true` and install again."
+ "To use the platform-specific version of the gem, run `bundle config set specific_platform true` and install again."
expect(the_bundle).to include_gem "facter 2.4.6"
expect(the_bundle).not_to include_gem "CFPropertyList"
@@ -265,8 +265,7 @@ RSpec.describe "bundle install across platforms" do
bundle! :install, forgotten_command_line_options(:path => "vendor/bundle")
- new_version = Gem::ConfigMap[:ruby_version] == "1.8" ? "1.9.1" : "1.8"
- FileUtils.mv(vendored_gems, bundled_app("vendor/bundle", Gem.ruby_engine, new_version))
+ FileUtils.mv(vendored_gems, bundled_app("vendor/bundle", Gem.ruby_engine, "1.8"))
bundle! :install
expect(vendored_gems("gems/rack-1.0.0")).to exist
@@ -385,13 +384,13 @@ RSpec.describe "bundle install with platform conditionals" do
bundle! "install"
- expect(out).to include <<-O.strip
+ 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 disable_platform_warnings true" }
+ before { bundle! "config set disable_platform_warnings true" }
it "does not print the warning when a dependency is unused on any platform" do
simulate_platform "ruby"
diff --git a/spec/bundler/install/gemfile/ruby_spec.rb b/spec/bundler/install/gemfile/ruby_spec.rb
index 24fe021fa3..3373c9bd3e 100644
--- a/spec/bundler/install/gemfile/ruby_spec.rb
+++ b/spec/bundler/install/gemfile/ruby_spec.rb
@@ -103,6 +103,6 @@ RSpec.describe "ruby requirement" do
gem "rack"
G
- expect(out).to include("There was an error parsing") # i.e. DSL error, not error template
+ expect(err).to include("There was an error parsing") # i.e. DSL error, not error template
end
end
diff --git a/spec/bundler/install/gemfile/sources_spec.rb b/spec/bundler/install/gemfile/sources_spec.rb
index efe6ccce7f..8e1205dfa3 100644
--- a/spec/bundler/install/gemfile/sources_spec.rb
+++ b/spec/bundler/install/gemfile/sources_spec.rb
@@ -15,7 +15,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
end
end
- context "with multiple toplevel sources" do
+ context "with multiple toplevel sources", :bundler => "< 3" do
let(:repo3_rack_version) { "1.0.0" }
before do
@@ -25,27 +25,24 @@ RSpec.describe "bundle install with gems on multiple sources" do
gem "rack-obama"
gem "rack"
G
- bundle "config major_deprecations true"
end
- it "warns about ambiguous gems, but installs anyway, prioritizing sources last to first", :bundler => "< 3" do
+ it "warns about ambiguous gems, but installs anyway, prioritizing sources last to first", :bundler => "2" do
bundle :install
- expect(out).to have_major_deprecation a_string_including("Your Gemfile contains multiple primary sources.")
- expect(out).to include("Warning: the gem 'rack' was found in multiple sources.")
- expect(out).to include(normalize_uri_file("Installed from: file://localhost#{gem_repo1}"))
+ expect(err).to include("Warning: the gem 'rack' was found in multiple sources.")
+ expect(err).to include(normalize_uri_file("Installed from: file://localhost#{gem_repo1}"))
expect(the_bundle).to include_gems("rack-obama 1.0.0", "rack 1.0.0", :source => "remote1")
end
- it "errors when disable_multisource is set" do
- bundle "config disable_multisource true"
+ it "fails", :bundler => "3" do
bundle :install
- expect(out).to include("Each source after the first must include a block")
+ expect(err).to include("Each source after the first must include a block")
expect(exitstatus).to eq(4) if exitstatus
end
end
- context "when different versions of the same gem are in multiple sources" do
+ context "when different versions of the same gem are in multiple sources", :bundler => "< 3" do
let(:repo3_rack_version) { "1.2" }
before do
@@ -55,17 +52,20 @@ RSpec.describe "bundle install with gems on multiple sources" do
gem "rack-obama"
gem "rack", "1.0.0" # force it to install the working version in repo1
G
- bundle "config major_deprecations true"
- end
- it "warns about ambiguous gems, but installs anyway", :bundler => "< 3" do
bundle :install
+ end
- expect(out).to have_major_deprecation a_string_including("Your Gemfile contains multiple primary sources.")
- expect(out).to include("Warning: the gem 'rack' was found in multiple sources.")
- expect(out).to include(normalize_uri_file("Installed from: file://localhost#{gem_repo1}"))
+ it "warns about ambiguous gems, but installs anyway", :bundler => "2" do
+ expect(err).to include("Warning: the gem 'rack' was found in multiple sources.")
+ expect(err).to include(normalize_uri_file("Installed from: file://localhost#{gem_repo1}"))
expect(the_bundle).to include_gems("rack-obama 1.0.0", "rack 1.0.0", :source => "remote1")
end
+
+ it "fails", :bundler => "3" do
+ expect(err).to include("Each source after the first must include a block")
+ expect(exitstatus).to eq(4) if exitstatus
+ end
end
end
@@ -187,10 +187,9 @@ RSpec.describe "bundle install with gems on multiple sources" do
end
end
- context "when lockfile_uses_separate_rubygems_sources is set" do
+ context "when disable_multisource is set" do
before do
- bundle! "config lockfile_uses_separate_rubygems_sources true"
- bundle! "config disable_multisource true"
+ bundle! "config set disable_multisource true"
end
it "installs from the same source without any warning" do
@@ -237,7 +236,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
end
end
- context "and in yet another source" do
+ context "and in yet another source", :bundler => "< 3" do
before do
gemfile <<-G
source "file://localhost#{gem_repo1}"
@@ -246,19 +245,23 @@ RSpec.describe "bundle install with gems on multiple sources" do
gem "depends_on_rack"
end
G
- end
- it "installs from the other source and warns about ambiguous gems", :bundler => "< 3" do
- bundle "config major_deprecations true"
bundle :install
- expect(out).to have_major_deprecation a_string_including("Your Gemfile contains multiple primary sources.")
- expect(out).to include("Warning: the gem 'rack' was found in multiple sources.")
- expect(out).to include(normalize_uri_file("Installed from: file://localhost#{gem_repo2}"))
+ end
+
+ it "installs from the other source and warns about ambiguous gems", :bundler => "2" do
+ expect(err).to include("Warning: the gem 'rack' was found in multiple sources.")
+ expect(err).to include(normalize_uri_file("Installed from: file://localhost#{gem_repo2}"))
expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0")
end
+
+ it "fails", :bundler => "3" do
+ expect(err).to include("Each source after the first must include a block")
+ expect(exitstatus).to eq(4) if exitstatus
+ end
end
- context "and only the dependency is pinned" do
+ context "and only the dependency is pinned", :bundler => "< 3" do
before do
# need this to be broken to check for correct source ordering
build_repo gem_repo2 do
@@ -276,10 +279,10 @@ RSpec.describe "bundle install with gems on multiple sources" do
G
end
- it "installs the dependency from the pinned source without warning", :bundler => "< 3" do
+ it "installs the dependency from the pinned source without warning", :bundler => "2" do
bundle :install
- expect(out).not_to include("Warning: the gem 'rack' was found in multiple sources.")
+ 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
@@ -287,18 +290,23 @@ RSpec.describe "bundle install with gems on multiple sources" do
system_gems []
bundle :install
- expect(out).not_to include("Warning: the gem 'rack' was found in multiple sources.")
+ 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")
end
+
+ it "fails", :bundler => "3" do
+ bundle :install
+ expect(err).to include("Each source after the first must include a block")
+ expect(exitstatus).to eq(4) if exitstatus
+ end
end
end
end
context "when a top-level gem has an indirect dependency" do
- context "when lockfile_uses_separate_rubygems_sources is set" do
+ context "when disable_multisource is set" do
before do
- bundle! "config lockfile_uses_separate_rubygems_sources true"
- bundle! "config disable_multisource true"
+ bundle! "config set disable_multisource true"
end
before do
@@ -332,7 +340,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
it "installs all gems without warning" do
bundle :install
- expect(out).not_to include("Warning")
+ expect(err).not_to include("Warning")
expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", "unrelated_gem 1.0.0")
end
end
@@ -348,7 +356,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
it "does not find the dependency" do
bundle :install
- expect(out).to include("Could not find gem 'rack', which is required by gem 'depends_on_rack', in any of the relevant sources")
+ expect(err).to include("Could not find gem 'rack', which is required by gem 'depends_on_rack', in any of the relevant sources")
end
end
@@ -367,7 +375,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
it "installs the dependency from the top-level source without warning" do
bundle :install
- expect(out).not_to include("Warning")
+ expect(err).not_to include("Warning")
expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", "unrelated_gem 1.0.0")
end
end
@@ -388,7 +396,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
it "does not install the gem" do
bundle :install
- expect(out).to include("Could not find gem 'not_in_repo1'")
+ expect(err).to include("Could not find gem 'not_in_repo1'")
end
end
@@ -437,7 +445,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
it "does not unlock the non-path gem after install" do
bundle! :install
- bundle! %(exec ruby -e 'puts "OK"'), :env => { :RUBYOPT => "-r#{spec_dir.join("support/hax")}" }
+ bundle! %(exec ruby -e 'puts "OK"')
expect(out).to include("OK")
end
@@ -456,7 +464,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
it "installs the gems without any warning" do
bundle :install
- expect(out).not_to include("Warning")
+ expect(err).not_to include("Warning")
expect(the_bundle).to include_gems("rack 1.0.0")
end
end
@@ -544,7 +552,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
end
it "does not re-resolve" do
- bundle :install, :verbose => true
+ bundle! :install, :verbose => true
expect(out).to include("using resolution from the lockfile")
expect(out).not_to include("re-resolving dependencies")
end
@@ -616,4 +624,63 @@ RSpec.describe "bundle install with gems on multiple sources" do
end
end
end
+
+ describe "source changed to one containing a higher version of a dependency" do
+ before do
+ install_gemfile! <<-G
+ source "file://#{gem_repo1}"
+
+ gem "rack"
+ G
+
+ build_repo2 do
+ build_gem "bar"
+ end
+
+ build_lib("gemspec_test", :path => tmp.join("gemspec_test")) do |s|
+ s.add_dependency "bar", "=1.0.0"
+ end
+
+ install_gemfile <<-G
+ source "file://#{gem_repo2}"
+ gem "rack"
+ gemspec :path => "#{tmp.join("gemspec_test")}"
+ G
+ end
+
+ it "keeps the old version", :bundler => "2" do
+ expect(the_bundle).to include_gems("rack 1.0.0")
+ end
+
+ it "installs the higher version in the new repo", :bundler => "3" do
+ expect(the_bundle).to include_gems("rack 1.2")
+ end
+ end
+
+ context "when a gem is available from multiple ambiguous sources", :bundler => "3" do
+ it "raises, suggesting a source block" do
+ build_repo4 do
+ build_gem "depends_on_rack" do |s|
+ s.add_dependency "rack"
+ end
+ build_gem "rack"
+ end
+
+ install_gemfile <<-G
+ source "file://localhost#{gem_repo4}"
+ source "file://localhost#{gem_repo1}" do
+ gem "thin"
+ end
+ gem "depends_on_rack"
+ G
+ expect(last_command).to be_failure
+ expect(err).to eq normalize_uri_file(strip_whitespace(<<-EOS).strip)
+ The gem 'rack' was found in multiple relevant sources.
+ * rubygems repository file://localhost#{gem_repo1}/ or installed locally
+ * rubygems repository file://localhost#{gem_repo4}/ or installed locally
+ You must add this gem to the source block for the source you wish it to be installed from.
+ EOS
+ expect(the_bundle).not_to be_locked
+ end
+ end
end
diff --git a/spec/bundler/install/gemfile/specific_platform_spec.rb b/spec/bundler/install/gemfile/specific_platform_spec.rb
index 9c725416d5..2c482b7ad4 100644
--- a/spec/bundler/install/gemfile/specific_platform_spec.rb
+++ b/spec/bundler/install/gemfile/specific_platform_spec.rb
@@ -2,7 +2,7 @@
RSpec.describe "bundle install with specific_platform enabled" do
before do
- bundle "config specific_platform true"
+ bundle "config set specific_platform true"
build_repo2 do
build_gem("google-protobuf", "3.0.0.alpha.5.0.5.1")
diff --git a/spec/bundler/install/gemfile_spec.rb b/spec/bundler/install/gemfile_spec.rb
index e74c5ffe59..c26fbd74e7 100644
--- a/spec/bundler/install/gemfile_spec.rb
+++ b/spec/bundler/install/gemfile_spec.rb
@@ -1,4 +1,3 @@
-# encoding: utf-8
# frozen_string_literal: true
RSpec.describe "bundle install" do
@@ -8,7 +7,7 @@ RSpec.describe "bundle install" do
gem 'rails', '~> 4.0.0'
gem 'rails', '~> 4.0.0'
G
- expect(out).to include("more than once")
+ expect(err).to include("more than once")
end
end
@@ -35,7 +34,7 @@ RSpec.describe "bundle install" do
gem 'rack'
G
- bundle "config --local gemfile #{bundled_app("NotGemfile")}"
+ bundle "config set --local gemfile #{bundled_app("NotGemfile")}"
end
it "uses the gemfile to install" do
bundle "install"
@@ -65,23 +64,7 @@ RSpec.describe "bundle install" do
G
bundle :install
- expect(out).to match(/You passed :lib as an option for gem 'rack', but it is invalid/)
- end
- end
-
- context "with prefer_gems_rb set" do
- before { bundle! "config prefer_gems_rb true" }
-
- it "prefers gems.rb to Gemfile" do
- create_file("gems.rb", "gem 'bundler'")
- create_file("Gemfile", "raise 'wrong Gemfile!'")
-
- bundle! :install
-
- expect(bundled_app("gems.rb")).to be_file
- expect(bundled_app("Gemfile.lock")).not_to be_file
-
- expect(the_bundle).to include_gem "bundler #{Bundler::VERSION}"
+ expect(err).to match(/You passed :lib as an option for gem 'rack', but it is invalid/)
end
end
@@ -116,8 +99,6 @@ RSpec.describe "bundle install" do
context "with a Gemfile containing non-US-ASCII characters" do
it "reads the Gemfile with the UTF-8 encoding by default" do
- skip "Ruby 1.8 has no encodings" if RUBY_VERSION < "1.9"
-
install_gemfile <<-G
str = "Il était une fois ..."
puts "The source encoding is: " + str.encoding.name
@@ -129,8 +110,6 @@ RSpec.describe "bundle install" do
end
it "respects the magic encoding comment" do
- skip "Ruby 1.8 has no encodings" if RUBY_VERSION < "1.9"
-
# NOTE: This works thanks to #eval interpreting the magic encoding comment
install_gemfile <<-G
# encoding: iso-8859-1
diff --git a/spec/bundler/install/gems/compact_index_spec.rb b/spec/bundler/install/gems/compact_index_spec.rb
index 2acade1166..b94b68dbd9 100644
--- a/spec/bundler/install/gems/compact_index_spec.rb
+++ b/spec/bundler/install/gems/compact_index_spec.rb
@@ -22,7 +22,7 @@ RSpec.describe "compact index api" do
G
bundle :install, :artifice => "compact_index"
- expect(out).to include("' sinatra' is not a valid gem name because it contains whitespace.")
+ expect(err).to include("' sinatra' is not a valid gem name because it contains whitespace.")
end
it "should handle nested dependencies" do
@@ -226,7 +226,7 @@ The checksum of /versions does not match the checksum provided by the server! So
G
bundle :install, :artifice => "compact_index_redirects"
- expect(out).to match(/Too many redirects/)
+ expect(err).to match(/Too many redirects/)
end
context "when --full-index is specified" do
@@ -247,7 +247,7 @@ The checksum of /versions does not match the checksum provided by the server! So
gem "rack"
G
- bundle! "update --full-index", :artifice => "compact_index", :all => bundle_update_requires_all?
+ bundle! "update --full-index", :artifice => "compact_index", :all => true
expect(out).to include("Fetching source index from #{source_uri}")
expect(the_bundle).to include_gems "rack 1.0.0"
end
@@ -255,7 +255,7 @@ The checksum of /versions does not match the checksum provided by the server! So
it "does not double check for gems that are only installed locally" do
system_gems %w[rack-1.0.0 thin-1.0 net_a-1.0]
- bundle! "config --local path.system true"
+ bundle! "config set --local path.system true"
ENV["BUNDLER_SPEC_ALL_REQUESTS"] = strip_whitespace(<<-EOS).strip
#{source_uri}/versions
#{source_uri}/info/rack
@@ -628,8 +628,8 @@ The checksum of /versions does not match the checksum provided by the server! So
G
bundle! :install, :artifice => "compact_index_basic_authentication"
- expect(out).to include("Warning: the gem 'rack' was found in multiple sources.")
- expect(out).not_to include("#{user}:#{password}")
+ expect(err).to include("Warning: the gem 'rack' was found in multiple sources.")
+ expect(err).not_to include("#{user}:#{password}")
expect(the_bundle).to include_gems "rack 1.0.0"
end
@@ -652,7 +652,7 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "reads authentication details by host name from bundle config" do
- bundle "config #{source_hostname} #{user}:#{password}"
+ bundle "config set #{source_hostname} #{user}:#{password}"
bundle! :install, :artifice => "compact_index_strict_basic_authentication"
@@ -662,7 +662,7 @@ The checksum of /versions does not match the checksum provided by the server! So
it "reads authentication details by full url from bundle config" do
# The trailing slash is necessary here; Fetcher canonicalizes the URI.
- bundle "config #{source_uri}/ #{user}:#{password}"
+ bundle "config set #{source_uri}/ #{user}:#{password}"
bundle! :install, :artifice => "compact_index_strict_basic_authentication"
@@ -671,7 +671,7 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "should use the API" do
- bundle "config #{source_hostname} #{user}:#{password}"
+ bundle "config set #{source_hostname} #{user}:#{password}"
bundle! :install, :artifice => "compact_index_strict_basic_authentication"
expect(out).to include("Fetching gem metadata from #{source_uri}")
expect(the_bundle).to include_gems "rack 1.0.0"
@@ -683,7 +683,7 @@ The checksum of /versions does not match the checksum provided by the server! So
gem "rack"
G
- bundle "config #{source_hostname} otheruser:wrong"
+ bundle "config set #{source_hostname} otheruser:wrong"
bundle! :install, :artifice => "compact_index_strict_basic_authentication"
expect(the_bundle).to include_gems "rack 1.0.0"
@@ -691,14 +691,14 @@ The checksum of /versions does not match the checksum provided by the server! So
it "shows instructions if auth is not provided for the source" do
bundle :install, :artifice => "compact_index_strict_basic_authentication"
- expect(out).to include("bundle config #{source_hostname} username:password")
+ expect(err).to include("bundle config set #{source_hostname} username:password")
end
it "fails if authentication has already been provided, but failed" do
- bundle "config #{source_hostname} #{user}:wrong"
+ bundle "config set #{source_hostname} #{user}:wrong"
bundle :install, :artifice => "compact_index_strict_basic_authentication"
- expect(out).to include("Bad username or password")
+ expect(err).to include("Bad username or password")
end
end
@@ -737,7 +737,7 @@ The checksum of /versions does not match the checksum provided by the server! So
G
bundle :install, :env => { "RUBYOPT" => "-I#{bundled_app("broken_ssl")}" }
- expect(out).to include("OpenSSL")
+ expect(err).to include("OpenSSL")
end
end
@@ -757,7 +757,7 @@ The checksum of /versions does not match the checksum provided by the server! So
G
bundle :install
- expect(out).to match(/could not verify the SSL certificate/i)
+ expect(err).to match(/could not verify the SSL certificate/i)
end
end
@@ -858,12 +858,12 @@ The checksum of /versions does not match the checksum provided by the server! So
gem "rack"
G
expect(exitstatus).to eq(15) if exitstatus
- expect(out).to end_with(<<-E.strip)
+ expect(err).to end_with(<<-E.strip)
The request uri `htps://index.rubygems.org/versions` has an invalid scheme (`htps`). Did you mean `http` or `https`?
E
end
- describe "checksum validation", :rubygems => ">= 2.3.0" do
+ describe "checksum validation" do
it "raises when the checksum does not match" do
install_gemfile <<-G, :artifice => "compact_index_wrong_gem_checksum"
source "#{source_uri}"
@@ -871,7 +871,7 @@ The checksum of /versions does not match the checksum provided by the server! So
G
expect(exitstatus).to eq(19) if exitstatus
- expect(out).
+ expect(err).
to include("Bundler cannot continue installing rack (1.0.0).").
and include("The checksum for the downloaded `rack-1.0.0.gem` does not match the checksum given by the server.").
and include("This means the contents of the downloaded gem is different from what was uploaded to the server, and could be a potential security issue.").
@@ -879,7 +879,7 @@ The checksum of /versions does not match the checksum provided by the server! So
and include("1. delete the downloaded gem located at: `#{default_bundle_path}/gems/rack-1.0.0/rack-1.0.0.gem`").
and include("2. run `bundle install`").
and include("If you wish to continue installing the downloaded gem, and are certain it does not pose a security issue despite the mismatching checksum, do the following:").
- and include("1. run `bundle config disable_checksum_validation true` to turn off checksum verification").
+ and include("1. run `bundle config set disable_checksum_validation true` to turn off checksum verification").
and include("2. run `bundle install`").
and match(/\(More info: The expected SHA256 checksum was "#{"ab" * 22}", but the checksum for the downloaded gem was ".+?"\.\)/)
end
@@ -890,11 +890,11 @@ The checksum of /versions does not match the checksum provided by the server! So
gem "rack"
G
expect(exitstatus).to eq(5) if exitstatus
- expect(out).to include("The given checksum for rack-1.0.0 (\"checksum!\") is not a valid SHA256 hexdigest nor base64digest")
+ expect(err).to include("The given checksum for rack-1.0.0 (\"checksum!\") is not a valid SHA256 hexdigest nor base64digest")
end
it "does not raise when disable_checksum_validation is set" do
- bundle! "config disable_checksum_validation true"
+ bundle! "config set disable_checksum_validation true"
install_gemfile! <<-G, :artifice => "compact_index_wrong_gem_checksum"
source "#{source_uri}"
gem "rack"
@@ -915,7 +915,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", "= 10.0.2"),
+ deps = [Gem::Dependency.new("rake", "= 12.3.2"),
Gem::Dependency.new("actionpack", "= 2.3.2"),
Gem::Dependency.new("activerecord", "= 2.3.2"),
Gem::Dependency.new("actionmailer", "= 2.3.2"),
diff --git a/spec/bundler/install/gems/dependency_api_spec.rb b/spec/bundler/install/gems/dependency_api_spec.rb
index 3cb98db1eb..0dc1ee87f2 100644
--- a/spec/bundler/install/gems/dependency_api_spec.rb
+++ b/spec/bundler/install/gems/dependency_api_spec.rb
@@ -22,7 +22,7 @@ RSpec.describe "gemcutter's dependency API" do
G
bundle :install, :artifice => "endpoint"
- expect(out).to include("' sinatra' is not a valid gem name because it contains whitespace.")
+ expect(err).to include("' sinatra' is not a valid gem name because it contains whitespace.")
end
it "should handle nested dependencies" do
@@ -216,7 +216,7 @@ RSpec.describe "gemcutter's dependency API" do
G
bundle :install, :artifice => "endpoint_redirect"
- expect(out).to match(/Too many redirects/)
+ expect(err).to match(/Too many redirects/)
end
context "when --full-index is specified" do
@@ -237,7 +237,7 @@ RSpec.describe "gemcutter's dependency API" do
gem "rack"
G
- bundle! "update --full-index", :artifice => "endpoint", :all => bundle_update_requires_all?
+ bundle! "update --full-index", :artifice => "endpoint", :all => true
expect(out).to include("Fetching source index from #{source_uri}")
expect(the_bundle).to include_gems "rack 1.0.0"
end
@@ -602,8 +602,8 @@ RSpec.describe "gemcutter's dependency API" do
G
bundle :install, :artifice => "endpoint_basic_authentication"
- expect(out).to include("Warning: the gem 'rack' was found in multiple sources.")
- expect(out).not_to include("#{user}:#{password}")
+ expect(err).to include("Warning: the gem 'rack' was found in multiple sources.")
+ expect(err).not_to include("#{user}:#{password}")
expect(the_bundle).to include_gems "rack 1.0.0"
end
@@ -626,7 +626,7 @@ RSpec.describe "gemcutter's dependency API" do
end
it "reads authentication details by host name from bundle config" do
- bundle "config #{source_hostname} #{user}:#{password}"
+ bundle "config set #{source_hostname} #{user}:#{password}"
bundle :install, :artifice => "endpoint_strict_basic_authentication"
@@ -636,7 +636,7 @@ RSpec.describe "gemcutter's dependency API" do
it "reads authentication details by full url from bundle config" do
# The trailing slash is necessary here; Fetcher canonicalizes the URI.
- bundle "config #{source_uri}/ #{user}:#{password}"
+ bundle "config set #{source_uri}/ #{user}:#{password}"
bundle :install, :artifice => "endpoint_strict_basic_authentication"
@@ -645,7 +645,7 @@ RSpec.describe "gemcutter's dependency API" do
end
it "should use the API" do
- bundle "config #{source_hostname} #{user}:#{password}"
+ bundle "config set #{source_hostname} #{user}:#{password}"
bundle :install, :artifice => "endpoint_strict_basic_authentication"
expect(out).to include("Fetching gem metadata from #{source_uri}")
expect(the_bundle).to include_gems "rack 1.0.0"
@@ -657,7 +657,7 @@ RSpec.describe "gemcutter's dependency API" do
gem "rack"
G
- bundle "config #{source_hostname} otheruser:wrong"
+ bundle "config set #{source_hostname} otheruser:wrong"
bundle :install, :artifice => "endpoint_strict_basic_authentication"
expect(the_bundle).to include_gems "rack 1.0.0"
@@ -665,14 +665,14 @@ RSpec.describe "gemcutter's dependency API" do
it "shows instructions if auth is not provided for the source" do
bundle :install, :artifice => "endpoint_strict_basic_authentication"
- expect(out).to include("bundle config #{source_hostname} username:password")
+ expect(err).to include("bundle config set #{source_hostname} username:password")
end
it "fails if authentication has already been provided, but failed" do
- bundle "config #{source_hostname} #{user}:wrong"
+ bundle "config set #{source_hostname} #{user}:wrong"
bundle :install, :artifice => "endpoint_strict_basic_authentication"
- expect(out).to include("Bad username or password")
+ expect(err).to include("Bad username or password")
end
end
@@ -711,7 +711,7 @@ RSpec.describe "gemcutter's dependency API" do
G
bundle :install, :env => { "RUBYOPT" => "-I#{bundled_app("broken_ssl")}" }
- expect(out).to include("OpenSSL")
+ expect(err).to include("OpenSSL")
end
end
@@ -731,7 +731,7 @@ RSpec.describe "gemcutter's dependency API" do
G
bundle :install
- expect(out).to match(/could not verify the SSL certificate/i)
+ expect(err).to match(/could not verify the SSL certificate/i)
end
end
diff --git a/spec/bundler/install/gems/flex_spec.rb b/spec/bundler/install/gems/flex_spec.rb
index 736f418ec7..aeb83d6573 100644
--- a/spec/bundler/install/gems/flex_spec.rb
+++ b/spec/bundler/install/gems/flex_spec.rb
@@ -188,7 +188,7 @@ RSpec.describe "bundle flex_install" do
ruby <<-RUBY
require 'bundler/setup'
RUBY
- expect(err).to match(/could not find gem 'rack-obama/i)
+ expect(last_command.stderr).to match(/could not find gem 'rack-obama/i)
end
it "suggests bundle update when the Gemfile requires different versions than the lock" do
@@ -233,9 +233,9 @@ RSpec.describe "bundle flex_install" do
bundle "install"
end.not_to change { File.read(bundled_app("Gemfile.lock")) }
- expect(out).to include("rack = 0.9.1")
- expect(out).to include("locked at 1.0.0")
- expect(out).to include("bundle update rack")
+ expect(err).to include("rack = 0.9.1")
+ expect(err).to include("locked at 1.0.0")
+ expect(err).to include("bundle update rack")
end
it "should work when you update" do
@@ -264,7 +264,7 @@ RSpec.describe "bundle flex_install" do
rack (1.0.0)
PLATFORMS
- ruby
+ #{lockfile_platforms}
DEPENDENCIES
rack
@@ -345,7 +345,7 @@ RSpec.describe "bundle flex_install" do
gem "capybara", "0.3.9"
G
- expect(out).to include("Gemfile.lock")
+ expect(err).to include("Gemfile.lock")
end
end
end
diff --git a/spec/bundler/install/gems/mirror_spec.rb b/spec/bundler/install/gems/mirror_spec.rb
index 4c35b8f206..ffa6116127 100644
--- a/spec/bundler/install/gems/mirror_spec.rb
+++ b/spec/bundler/install/gems/mirror_spec.rb
@@ -8,7 +8,7 @@ RSpec.describe "bundle install with a mirror configured" do
gem "rack"
G
- bundle "config --local mirror.http://gems.example.org http://gem-mirror.example.org"
+ bundle "config set --local mirror.http://gems.example.org http://gem-mirror.example.org"
end
it "installs from the normal location" do
@@ -26,7 +26,7 @@ RSpec.describe "bundle install with a mirror configured" do
gem "rack"
G
- bundle "config --local mirror.file://localhost#{gem_repo2} file://localhost#{gem_repo1}"
+ bundle "config set --local mirror.file://localhost#{gem_repo2} file://localhost#{gem_repo1}"
end
it "installs the gem from the mirror" do
diff --git a/spec/bundler/install/gems/native_extensions_spec.rb b/spec/bundler/install/gems/native_extensions_spec.rb
index ea616f60d3..9176a07084 100644
--- a/spec/bundler/install/gems/native_extensions_spec.rb
+++ b/spec/bundler/install/gems/native_extensions_spec.rb
@@ -37,7 +37,7 @@ RSpec.describe "installing a gem with native extensions", :ruby_repo do
gem "c_extension"
G
- bundle "config build.c_extension --with-c_extension=hello"
+ bundle "config set build.c_extension --with-c_extension=hello"
bundle "install"
expect(out).not_to include("extconf.rb failed")
@@ -76,7 +76,48 @@ RSpec.describe "installing a gem with native extensions", :ruby_repo do
C
end
- bundle! "config build.c_extension --with-c_extension=hello"
+ bundle! "config set build.c_extension --with-c_extension=hello"
+
+ install_gemfile! <<-G
+ 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
+
+ it "install with multiple build flags" do
+ build_git "c_extension" do |s|
+ s.extensions = ["ext/extconf.rb"]
+ s.write "ext/extconf.rb", <<-E
+ require "mkmf"
+ name = "c_extension_bundle"
+ dir_config(name)
+ raise "OMG" unless with_config("c_extension") == "hello" && with_config("c_extension_bundle-dir") == "hola"
+ create_makefile(name)
+ E
+
+ s.write "ext/c_extension.c", <<-C
+ #include "ruby.h"
+
+ VALUE c_extension_true(VALUE self) {
+ return Qtrue;
+ }
+
+ void Init_c_extension_bundle() {
+ VALUE c_Extension = rb_define_class("CExtension", rb_cObject);
+ rb_define_method(c_Extension, "its_true", c_extension_true, 0);
+ }
+ C
+
+ s.write "lib/c_extension.rb", <<-C
+ require "c_extension_bundle"
+ C
+ end
+
+ bundle! "config set build.c_extension --with-c_extension=hello --with-c_extension_bundle-dir=hola"
install_gemfile! <<-G
gem "c_extension", :git => #{lib_path("c_extension-1.0").to_s.dump}
diff --git a/spec/bundler/install/gems/post_install_spec.rb b/spec/bundler/install/gems/post_install_spec.rb
index c6e348fb65..a6894fbc14 100644
--- a/spec/bundler/install/gems/post_install_spec.rb
+++ b/spec/bundler/install/gems/post_install_spec.rb
@@ -127,7 +127,7 @@ RSpec.describe "bundle install" do
gem "rack"
G
- bundle "config ignore_messages.rack true"
+ bundle "config set ignore_messages.rack true"
bundle :install
expect(out).not_to include("Post-install message")
@@ -141,7 +141,7 @@ RSpec.describe "bundle install" do
gem "rack"
G
- bundle "config ignore_messages true"
+ bundle "config set ignore_messages true"
bundle :install
expect(out).not_to include("Post-install message")
diff --git a/spec/bundler/install/gems/resolving_spec.rb b/spec/bundler/install/gems/resolving_spec.rb
index 01c03ac793..cf3aaa719e 100644
--- a/spec/bundler/install/gems/resolving_spec.rb
+++ b/spec/bundler/install/gems/resolving_spec.rb
@@ -77,7 +77,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(last_command.stderr).to include("Creating possibility state for net_c")
end
end
@@ -91,7 +91,7 @@ RSpec.describe "bundle install with install-time dependencies" do
bundle :install, :env => { "DEBUG_RESOLVER_TREE" => "1" }
- expect(err).to include(" net_b").
+ expect(last_command.stderr).to include(" net_b").
and include("Starting resolution").
and include("Finished resolution").
and include("Attempting to activate")
@@ -117,6 +117,26 @@ 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 version under rate limiting conditions" do
+ build_repo4 do
+ build_gem "rack", "9001.0.0" do |s|
+ s.required_ruby_version = "> 9000"
+ end
+ build_gem "rack", "1.2"
+ build_gem "foo1", "1.0"
+ end
+
+ install_gemfile <<-G, :artifice => "compact_index_rate_limited", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4 }
+ ruby "#{RUBY_VERSION}"
+ source "http://localgemserver.test/"
+ gem 'rack'
+ gem 'foo1'
+ G
+
+ expect(out).to_not include("rack-9001.0.0 requires ruby version > 9000")
+ expect(the_bundle).to include_gems("rack 1.2")
+ end
end
context "allows no gems" do
@@ -142,15 +162,14 @@ RSpec.describe "bundle install with install-time dependencies" do
expect(out).to_not include("Gem::InstallError: require_ruby requires Ruby version > 9000")
nice_error = strip_whitespace(<<-E).strip
- Bundler could not find compatible versions for gem "ruby\0":
+ Bundler found conflicting requirements for the Ruby\0 version:
In Gemfile:
- ruby\0 (#{error_message_requirement})
+ Ruby\0 (#{error_message_requirement})
require_ruby was resolved to 1.0, which depends on
- ruby\0 (> 9000)
+ Ruby\0 (> 9000)
- Could not find gem 'ruby\0 (> 9000)', which is required by gem 'require_ruby', in any of the relevant sources:
- the local ruby installation
+ Ruby\0 (> 9000), which is required by gem 'require_ruby', is not available in the local ruby installation
E
expect(last_command.bundler_err).to end_with(nice_error)
end
@@ -188,8 +207,8 @@ RSpec.describe "bundle install with install-time dependencies" do
gem 'require_rubygems'
G
- expect(out).to_not include("Gem::InstallError: require_rubygems requires RubyGems version > 9000")
- expect(out).to include("require_rubygems-1.0 requires rubygems version > 9000, which is incompatible with the current version, #{Gem::VERSION}")
+ expect(err).to_not include("Gem::InstallError: require_rubygems requires RubyGems version > 9000")
+ expect(err).to include("require_rubygems-1.0 requires rubygems version > 9000, which is incompatible with the current version, #{Gem::VERSION}")
end
end
end
diff --git a/spec/bundler/install/gems/standalone_spec.rb b/spec/bundler/install/gems/standalone_spec.rb
index fa7a3bdc27..e2cfe5ec4c 100644
--- a/spec/bundler/install/gems/standalone_spec.rb
+++ b/spec/bundler/install/gems/standalone_spec.rb
@@ -75,7 +75,7 @@ RSpec.shared_examples "bundle install --standalone" do
G
end
- it "generates a bundle/bundler/setup.rb with the proper paths", :rubygems => "2.4" do
+ it "generates a bundle/bundler/setup.rb with the proper paths" do
expected_path = bundled_app("bundle/bundler/setup.rb")
extension_line = File.read(expected_path).each_line.find {|line| line.include? "/extensions/" }.strip
expect(extension_line).to start_with '$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/'
@@ -108,8 +108,8 @@ RSpec.shared_examples "bundle install --standalone" do
end
it "outputs a helpful error message" do
- expect(out).to include("You have one or more invalid gemspecs that need to be fixed.")
- expect(out).to include("bar 1.0 has an invalid gemspec")
+ expect(err).to include("You have one or more invalid gemspecs that need to be fixed.")
+ expect(err).to include("bar 1.0 has an invalid gemspec")
end
end
diff --git a/spec/bundler/install/gems/sudo_spec.rb b/spec/bundler/install/gems/sudo_spec.rb
index 1781451c98..fb41f63a07 100644
--- a/spec/bundler/install/gems/sudo_spec.rb
+++ b/spec/bundler/install/gems/sudo_spec.rb
@@ -4,7 +4,7 @@ RSpec.describe "when using sudo", :sudo => true do
describe "and BUNDLE_PATH is writable" do
context "but BUNDLE_PATH/build_info is not writable" do
before do
- bundle! "config path.system true"
+ bundle! "config set path.system true"
subdir = system_gem_path("cache")
subdir.mkpath
sudo "chmod u-w #{subdir}"
@@ -25,7 +25,7 @@ RSpec.describe "when using sudo", :sudo => true do
describe "and GEM_HOME is owned by root" do
before :each do
- bundle! "config path.system true"
+ bundle! "config set path.system true"
chown_system_gems_to_root
end
@@ -52,7 +52,7 @@ RSpec.describe "when using sudo", :sudo => true do
end
it "installs when BUNDLE_PATH is owned by root" do
- bundle! "config global_path_appends_ruby_scope false" # consistency in tests between 1.x and 2.x modes
+ bundle! "config set global_path_appends_ruby_scope false" # consistency in tests between 1.x and 2.x modes
bundle_path = tmp("owned_by_root")
FileUtils.mkdir_p bundle_path
@@ -70,7 +70,7 @@ RSpec.describe "when using sudo", :sudo => true do
end
it "installs when BUNDLE_PATH does not exist" do
- bundle! "config global_path_appends_ruby_scope false" # consistency in tests between 1.x and 2.x modes
+ bundle! "config set global_path_appends_ruby_scope false" # consistency in tests between 1.x and 2.x modes
root_path = tmp("owned_by_root")
FileUtils.mkdir_p root_path
@@ -88,7 +88,7 @@ RSpec.describe "when using sudo", :sudo => true do
expect(the_bundle).to include_gems "rack 1.0"
end
- it "installs extensions/ compiled by RubyGems 2.2", :rubygems => "2.2" do
+ it "installs extensions/" do
install_gemfile <<-G
source "file://#{gem_repo1}"
gem "very_simple_binary"
@@ -133,7 +133,7 @@ RSpec.describe "when using sudo", :sudo => true do
describe "and GEM_HOME is not writable" do
it "installs" do
- bundle! "config path.system true"
+ bundle! "config set path.system true"
gem_home = tmp("sudo_gem_home")
sudo "mkdir -p #{gem_home}"
sudo "chmod ugo-w #{gem_home}"
@@ -158,20 +158,20 @@ RSpec.describe "when using sudo", :sudo => true do
it "warns against that" do
bundle :install, :sudo => true
- expect(out).to include(warning)
+ expect(err).to include(warning)
end
context "when ENV['BUNDLE_SILENCE_ROOT_WARNING'] is set" do
it "skips the warning" do
bundle :install, :sudo => :preserve_env, :env => { "BUNDLE_SILENCE_ROOT_WARNING" => true }
- expect(out).to_not include(warning)
+ expect(err).to_not include(warning)
end
end
context "when silence_root_warning = false" do
it "warns against that" do
bundle :install, :sudo => true, :env => { "BUNDLE_SILENCE_ROOT_WARNING" => "false" }
- expect(out).to include(warning)
+ expect(err).to include(warning)
end
end
end
diff --git a/spec/bundler/install/gemspecs_spec.rb b/spec/bundler/install/gemspecs_spec.rb
index 666707b295..c9878ccae8 100644
--- a/spec/bundler/install/gemspecs_spec.rb
+++ b/spec/bundler/install/gemspecs_spec.rb
@@ -1,4 +1,3 @@
-# encoding: utf-8
# frozen_string_literal: true
RSpec.describe "bundle install" do
@@ -15,7 +14,7 @@ RSpec.describe "bundle install" do
gem "yaml_spec"
G
bundle :install
- expect(err).to lack_errors
+ expect(last_command.stderr).to be_empty
end
it "still installs correctly when using path" do
@@ -24,7 +23,7 @@ RSpec.describe "bundle install" do
install_gemfile <<-G
gem 'yaml_spec', :path => "#{lib_path("yaml_spec-1.0")}"
G
- expect(err).to lack_errors
+ expect(last_command.stderr).to be_empty
end
end
@@ -48,11 +47,11 @@ RSpec.describe "bundle install" do
end
it "does not hang when gemspec has incompatible encoding" do
- create_file "foo.gemspec", <<-G
+ create_file("foo.gemspec", <<-G)
Gem::Specification.new do |gem|
gem.name = "pry-byebug"
gem.version = "3.4.2"
- gem.author = "David Rodriguez"
+ gem.author = "David Rodríguez"
gem.summary = "Good stuff"
end
G
@@ -65,8 +64,6 @@ RSpec.describe "bundle install" do
end
it "reads gemspecs respecting their encoding" do
- skip "Unicode is not supported on Ruby 1.x without extra work" if RUBY_VERSION < "2.0"
-
create_file "version.rb", <<-RUBY
module Persistent💎
VERSION = "0.0.1"
@@ -129,8 +126,8 @@ RSpec.describe "bundle install" do
gemspec
G
- expect(out).to include("Ruby patchlevel")
- expect(out).to include("but your Gemfile specified")
+ expect(err).to include("Ruby patchlevel")
+ expect(err).to include("but your Gemfile specified")
expect(exitstatus).to eq(18) if exitstatus
end
@@ -146,8 +143,8 @@ RSpec.describe "bundle install" do
gemspec
G
- expect(out).to include("Ruby version")
- expect(out).to include("but your Gemfile specified")
+ expect(err).to include("Ruby version")
+ expect(err).to include("but your Gemfile specified")
expect(exitstatus).to eq(18) if exitstatus
end
end
diff --git a/spec/bundler/install/git_spec.rb b/spec/bundler/install/git_spec.rb
index 48086a86c7..68b2f47c10 100644
--- a/spec/bundler/install/git_spec.rb
+++ b/spec/bundler/install/git_spec.rb
@@ -31,7 +31,7 @@ RSpec.describe "bundle install" do
update_git "foo", "4.0", :path => lib_path("foo"), :gemspec => true
- bundle! :update, :all => bundle_update_requires_all?
+ bundle! :update, :all => true
expect(out).to include("Using foo 2.0 (was 1.0) from #{lib_path("foo")} (at master~2@#{rev2})")
expect(the_bundle).to include_gems "foo 2.0", :source => "git@#{lib_path("foo")}"
end
diff --git a/spec/bundler/install/global_cache_spec.rb b/spec/bundler/install/global_cache_spec.rb
index e41e7e0157..345ad86db8 100644
--- a/spec/bundler/install/global_cache_spec.rb
+++ b/spec/bundler/install/global_cache_spec.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
RSpec.describe "global gem caching" do
- before { bundle! "config global_gem_cache true" }
+ before { bundle! "config set global_gem_cache true" }
describe "using the cross-application user cache" do
let(:source) { "http://localgemserver.test" }
@@ -112,7 +112,7 @@ RSpec.describe "global gem caching" do
expect(source_global_cache("rack-1.0.0.gem")).to exist
expect(source2_global_cache("rack-0.9.1.gem")).to exist
bundle :install, :artifice => "compact_index_no_gem"
- expect(out).to include("Internal Server Error 500")
+ expect(err).to include("Internal Server Error 500")
# rack 1.0.0 is not installed and rack 0.9.1 is not
expect(the_bundle).not_to include_gems "rack 1.0.0"
expect(the_bundle).not_to include_gems "rack 0.9.1"
@@ -125,7 +125,7 @@ RSpec.describe "global gem caching" do
expect(source_global_cache("rack-1.0.0.gem")).to exist
expect(source2_global_cache("rack-0.9.1.gem")).to exist
bundle :install, :artifice => "compact_index_no_gem"
- expect(out).to include("Internal Server Error 500")
+ expect(err).to include("Internal Server Error 500")
# rack 0.9.1 is not installed and rack 1.0.0 is not
expect(the_bundle).not_to include_gems "rack 0.9.1"
expect(the_bundle).not_to include_gems "rack 1.0.0"
@@ -187,7 +187,7 @@ RSpec.describe "global gem caching" do
end
end
- describe "extension caching", :ruby_repo, :rubygems => "2.2" do
+ describe "extension caching", :ruby_repo do
it "works" do
build_git "very_simple_git_binary", &:add_c_extension
build_lib "very_simple_path_binary", &:add_c_extension
@@ -220,7 +220,7 @@ RSpec.describe "global gem caching" do
gem_binary_cache.join("very_simple_binary_c.rb").open("w") {|f| f << "puts File.basename(__FILE__)" }
git_binary_cache.join("very_simple_git_binary_c.rb").open("w") {|f| f << "puts File.basename(__FILE__)" }
- bundle! "config --local path different_path"
+ bundle! "config set --local path different_path"
bundle! :install
expect(Dir[home(".bundle", "cache", "extensions", "**", "*binary_c*")]).to all(end_with(".rb"))
diff --git a/spec/bundler/install/path_spec.rb b/spec/bundler/install/path_spec.rb
index 94f38c9290..0947ed9539 100644
--- a/spec/bundler/install/path_spec.rb
+++ b/spec/bundler/install/path_spec.rb
@@ -37,7 +37,7 @@ RSpec.describe "bundle install" do
it "disallows --path vendor/bundle --system", :bundler => "< 3" do
bundle "install --path vendor/bundle --system"
- expect(out).to include("Please choose only one option.")
+ expect(err).to include("Please choose only one option.")
expect(exitstatus).to eq(15) if exitstatus
end
@@ -51,7 +51,7 @@ RSpec.describe "bundle install" do
end
context "with path_relative_to_cwd set to true" do
- before { bundle! "config path_relative_to_cwd true" }
+ 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
@@ -98,7 +98,7 @@ RSpec.describe "bundle install" do
if type == :env
ENV["BUNDLE_PATH"] = location
elsif type == :global
- bundle! "config path #{location}", "no-color" => nil
+ bundle! "config set path #{location}", "no-color" => nil
end
end
@@ -116,7 +116,7 @@ RSpec.describe "bundle install" do
context "with global_path_appends_ruby_scope set", :bundler => "3" do
it "installs gems to ." do
set_bundle_path(type, ".")
- bundle! "config --global disable_shared_gems true"
+ bundle! "config set --global disable_shared_gems true"
bundle! :install
@@ -150,7 +150,7 @@ RSpec.describe "bundle install" do
context "with global_path_appends_ruby_scope unset", :bundler => "< 3" do
it "installs gems to ." do
set_bundle_path(type, ".")
- bundle! "config --global disable_shared_gems true"
+ bundle! "config set --global disable_shared_gems true"
bundle! :install
@@ -207,7 +207,7 @@ RSpec.describe "bundle install" do
expect(the_bundle).to include_gems "rack 1.0.0"
end
- it "re-installs gems whose extensions have been deleted", :ruby_repo, :rubygems => ">= 2.3" do
+ it "re-installs gems whose extensions have been deleted", :ruby_repo do
build_lib "very_simple_binary", "1.0.0", :to_system => true do |s|
s.write "lib/very_simple_binary.rb", "raise 'FAIL'"
end
@@ -226,7 +226,7 @@ RSpec.describe "bundle install" do
vendored_gems("extensions").rmtree
run "require 'very_simple_binary_c'"
- expect(err).to include("Bundler::GemNotFound")
+ expect(last_command.stderr).to include("Bundler::GemNotFound")
bundle :install, forgotten_command_line_options(:path => "./vendor/bundle")
@@ -250,7 +250,7 @@ RSpec.describe "bundle install" do
G
bundle :install, forgotten_command_line_options(:path => "bundle")
- expect(out).to include("file already exists")
+ expect(err).to include("file already exists")
end
end
end
diff --git a/spec/bundler/install/post_bundle_message_spec.rb b/spec/bundler/install/post_bundle_message_spec.rb
index 394134f523..1efd0b8146 100644
--- a/spec/bundler/install/post_bundle_message_spec.rb
+++ b/spec/bundler/install/post_bundle_message_spec.rb
@@ -107,7 +107,7 @@ RSpec.describe "post bundle message" do
gem "rack"
gem "not-a-gem", :group => :development
G
- expect(out).to include("Could not find gem 'not-a-gem' in any of the gem sources listed in your Gemfile.")
+ expect(err).to include("Could not find gem 'not-a-gem' in any of the gem sources listed in your Gemfile.")
end
it "should report a helpful error message", :bundler => "3" do
@@ -116,7 +116,7 @@ RSpec.describe "post bundle message" do
gem "rack"
gem "not-a-gem", :group => :development
G
- expect(out).to include normalize_uri_file(<<-EOS.strip)
+ expect(err).to include normalize_uri_file(<<-EOS.strip)
Could not find gem 'not-a-gem' in rubygems repository file://localhost#{gem_repo1}/ or installed locally.
The source does not contain any versions of 'not-a-gem'
EOS
@@ -134,7 +134,7 @@ The source does not contain any versions of 'not-a-gem'
gem "rack"
gem "not-a-gem", :group => :development
G
- expect(out).to include("Could not find gem 'not-a-gem' in").
+ expect(err).to include("Could not find gem 'not-a-gem' in").
and include("or in gems cached in vendor/cache.")
end
end
@@ -177,28 +177,28 @@ The source does not contain any versions of 'not-a-gem'
describe "for bundle update" do
it "without any options" do
- bundle! :update, :all => bundle_update_requires_all?
+ bundle! :update, :all => true
expect(out).not_to include("Gems in the groups")
expect(out).to include(bundle_updated_message)
end
it "with --without one group" do
bundle! :install, forgotten_command_line_options(:without => "emo")
- bundle! :update, :all => bundle_update_requires_all?
+ bundle! :update, :all => true
expect(out).to include("Gems in the group emo were not installed")
expect(out).to include(bundle_updated_message)
end
it "with --without two groups" do
bundle! :install, forgotten_command_line_options(:without => "emo test")
- bundle! :update, :all => bundle_update_requires_all?
+ bundle! :update, :all => true
expect(out).to include("Gems in the groups emo and test were not installed")
expect(out).to include(bundle_updated_message)
end
it "with --without more groups" do
bundle! :install, forgotten_command_line_options(:without => "emo obama test")
- bundle! :update, :all => bundle_update_requires_all?
+ bundle! :update, :all => true
expect(out).to include("Gems in the groups emo, obama and test were not installed")
expect(out).to include(bundle_updated_message)
end
diff --git a/spec/bundler/install/process_lock_spec.rb b/spec/bundler/install/process_lock_spec.rb
index be8fd04fdd..df1e9c6350 100644
--- a/spec/bundler/install/process_lock_spec.rb
+++ b/spec/bundler/install/process_lock_spec.rb
@@ -21,7 +21,7 @@ RSpec.describe "process lock spec" do
expect(the_bundle).to include_gems "rack 1.0"
end
- context "when creating a lock raises Errno::ENOTSUP", :ruby => ">= 1.9" do
+ context "when creating a lock raises Errno::ENOTSUP" do
before { allow(File).to receive(:open).and_raise(Errno::ENOTSUP) }
it "skips creating the lock file and yields" do
diff --git a/spec/bundler/install/redownload_spec.rb b/spec/bundler/install/redownload_spec.rb
index f9caeed58a..2a0cdc9473 100644
--- a/spec/bundler/install/redownload_spec.rb
+++ b/spec/bundler/install/redownload_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe "bundle install", :bundler => "< 3", :ruby => ">= 2.0" do
+RSpec.describe "bundle install" do
before :each do
gemfile <<-G
source "file://#{gem_repo1}"
@@ -8,8 +8,6 @@ RSpec.describe "bundle install", :bundler => "< 3", :ruby => ">= 2.0" do
G
end
- before { bundle "config major_deprecations yes" }
-
shared_examples_for "an option to force redownloading gems" do
it "re-installs installed gems" do
rack_lib = default_bundle_path("gems/rack-1.0.0/lib/rack.rb")
@@ -58,19 +56,19 @@ RSpec.describe "bundle install", :bundler => "< 3", :ruby => ">= 2.0" do
end
end
- describe "with --force" do
+ describe "with --force", :bundler => 2 do
it_behaves_like "an option to force redownloading gems" do
let(:flag) { "force" }
end
it "shows a deprecation when single flag passed" do
bundle! "install --force"
- expect(out).to include "[DEPRECATED FOR 3.0] The `--force` option has been renamed to `--redownload`"
+ expect(err).to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`"
end
it "shows a deprecation when multiple flags passed" do
bundle! "install --no-color --force"
- expect(out).to include "[DEPRECATED FOR 3.0] The `--force` option has been renamed to `--redownload`"
+ expect(err).to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`"
end
end
@@ -81,12 +79,12 @@ RSpec.describe "bundle install", :bundler => "< 3", :ruby => ">= 2.0" do
it "does not show a deprecation when single flag passed" do
bundle! "install --redownload"
- expect(out).not_to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`"
+ expect(err).not_to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`"
end
it "does not show a deprecation when single multiple flags passed" do
bundle! "install --no-color --redownload"
- expect(out).not_to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`"
+ expect(err).not_to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`"
end
end
end
diff --git a/spec/bundler/install/security_policy_spec.rb b/spec/bundler/install/security_policy_spec.rb
index 7be09d6bd4..ad76162aac 100644
--- a/spec/bundler/install/security_policy_spec.rb
+++ b/spec/bundler/install/security_policy_spec.rb
@@ -24,18 +24,17 @@ RSpec.describe "policies with unsigned gems" do
it "will fail when given invalid security policy" do
bundle "install --trust-policy=InvalidPolicyName"
- expect(out).to include("RubyGems doesn't know about trust policy")
+ expect(err).to include("RubyGems doesn't know about trust policy")
end
it "will fail with High Security setting due to presence of unsigned gem" do
bundle "install --trust-policy=HighSecurity"
- expect(out).to include("security policy didn't allow")
+ expect(err).to include("security policy didn't allow")
end
- # This spec will fail on RubyGems 2 rc1 due to a bug in policy.rb. the bug is fixed in rc3.
- it "will fail with Medium Security setting due to presence of unsigned gem", :unless => ENV["RGV"] == "v2.0.0.rc.1" do
+ it "will fail with Medium Security setting due to presence of unsigned gem" do
bundle "install --trust-policy=MediumSecurity"
- expect(out).to include("security policy didn't allow")
+ expect(err).to include("security policy didn't allow")
end
it "will succeed with no policy" do
@@ -55,12 +54,12 @@ RSpec.describe "policies with signed gems and no CA" do
it "will fail with High Security setting, gem is self-signed" do
bundle "install --trust-policy=HighSecurity"
- expect(out).to include("security policy didn't allow")
+ expect(err).to include("security policy didn't allow")
end
it "will fail with Medium Security setting, gem is self-signed" do
bundle "install --trust-policy=MediumSecurity"
- expect(out).to include("security policy didn't allow")
+ expect(err).to include("security policy didn't allow")
end
it "will succeed with Low Security setting, low security accepts self signed gem" do
diff --git a/spec/bundler/install/yanked_spec.rb b/spec/bundler/install/yanked_spec.rb
index 7c4b98bfdf..3e6f6a3bcd 100644
--- a/spec/bundler/install/yanked_spec.rb
+++ b/spec/bundler/install/yanked_spec.rb
@@ -27,7 +27,7 @@ RSpec.context "when installing a bundle that includes yanked gems" do
gem "foo", "10.0.0"
G
- expect(out).to include("Your bundle is locked to foo (10.0.0)")
+ expect(err).to include("Your bundle is locked to foo (10.0.0)")
end
it "throws the original error when only the Gemfile specifies a gem version that doesn't exist" do
@@ -36,8 +36,8 @@ RSpec.context "when installing a bundle that includes yanked gems" do
gem "foo", "10.0.0"
G
- expect(out).not_to include("Your bundle is locked to foo (10.0.0)")
- expect(out).to include("Could not find gem 'foo (= 10.0.0)' in")
+ expect(err).not_to include("Your bundle is locked to foo (10.0.0)")
+ expect(err).to include("Could not find gem 'foo (= 10.0.0)' in")
end
end
@@ -63,9 +63,9 @@ RSpec.context "when using gem before installing" do
bundle :list
- expect(out).to include("Could not find rack-0.9.1 in any of the sources")
- expect(out).to_not include("Your bundle is locked to rack (0.9.1), but that version could not be found in any of the sources listed in your Gemfile.")
- expect(out).to_not include("If you haven't changed sources, that means the author of rack (0.9.1) has removed it.")
- expect(out).to_not include("You'll need to update your bundle to a different version of rack (0.9.1) that hasn't been removed in order to install.")
+ expect(err).to include("Could not find rack-0.9.1 in any of the sources")
+ expect(err).to_not include("Your bundle is locked to rack (0.9.1), but that version could not be found in any of the sources listed in your Gemfile.")
+ expect(err).to_not include("If you haven't changed sources, that means the author of rack (0.9.1) has removed it.")
+ expect(err).to_not include("You'll need to update your bundle to a different version of rack (0.9.1) that hasn't been removed in order to install.")
end
end
diff --git a/spec/bundler/lock/lockfile_bundler_1_spec.rb b/spec/bundler/lock/lockfile_bundler_1_spec.rb
deleted file mode 100644
index e89c5078d9..0000000000
--- a/spec/bundler/lock/lockfile_bundler_1_spec.rb
+++ /dev/null
@@ -1,1386 +0,0 @@
-# frozen_string_literal: true
-
-RSpec.describe "the lockfile format", :bundler => "< 3" do
- include Bundler::GemHelpers
-
- before { ENV["BUNDLER_SPEC_IGNORE_COMPATIBILITY_GUARD"] = "TRUE" }
-
- it "generates a simple lockfile for a single source, gem" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
-
- gem "rack"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- rack
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "updates the lockfile's bundler version if current ver. is newer" do
- lockfile <<-L
- GIT
- remote: git://github.com/nex3/haml.git
- revision: 8a2271f
- specs:
-
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- omg!
- rack
-
- BUNDLED WITH
- 1.8.2
- L
-
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
-
- gem "rack"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- rack
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "does not update the lockfile's bundler version if nothing changed during bundle install", :ruby_repo do
- version = "#{Bundler::VERSION.split(".").first}.0.0.0.a"
-
- lockfile normalize_uri_file(<<-L)
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- rack
-
- BUNDLED WITH
- #{version}
- L
-
- install_gemfile normalize_uri_file(<<-G)
- source "file://localhost#{gem_repo1}"
-
- gem "rack"
- G
-
- lockfile_should_be normalize_uri_file(<<-G)
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- rack
-
- BUNDLED WITH
- #{version}
- G
- end
-
- it "updates the lockfile's bundler version if not present" do
- lockfile <<-L
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- rack
- L
-
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
-
- gem "rack", "> 0"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- rack (> 0)
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "outputs a warning if the current is older than lockfile's bundler version" do
- lockfile <<-L
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- rack
-
- BUNDLED WITH
- 9999999.1.0
- L
-
- simulate_bundler_version "9999999.0.0" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
-
- gem "rack"
- G
- end
-
- warning_message = "the running version of Bundler (9999999.0.0) is older " \
- "than the version that created the lockfile (9999999.1.0)"
- expect(out.scan(warning_message).size).to eq(1)
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- #{generic_local_platform}
- #{specific_local_platform}
-
- DEPENDENCIES
- rack
-
- BUNDLED WITH
- 9999999.1.0
- G
- end
-
- it "errors if the current is a major version older than lockfile's bundler version" do
- lockfile <<-L
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- rack
-
- BUNDLED WITH
- 9999999.0.0
- L
-
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
-
- gem "rack"
- G
-
- expect(exitstatus > 0) if exitstatus
- expect(out).to include("You must use Bundler 9999999 or greater with this lockfile.")
- end
-
- it "shows a friendly error when running with a new bundler 2 lockfile" do
- lockfile <<-L
- GEM
- remote: https://rails-assets.org/
- specs:
- rails-assets-bootstrap (3.3.4)
- rails-assets-jquery (>= 1.9.1)
- rails-assets-jquery (2.1.4)
-
- GEM
- remote: https://rubygems.org/
- specs:
- rake (10.4.2)
-
- PLATFORMS
- ruby
-
- DEPENDENCIES
- rails-assets-bootstrap!
- rake
-
- BUNDLED WITH
- 9999999.0.0
- L
-
- install_gemfile <<-G
- source 'https://rubygems.org'
- gem 'rake'
-
- source 'https://rails-assets.org' do
- gem 'rails-assets-bootstrap'
- end
- G
-
- expect(exitstatus > 0) if exitstatus
- expect(out).to include("You must use Bundler 9999999 or greater with this lockfile.")
- end
-
- it "warns when updating bundler major version" do
- lockfile <<-L
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- rack
-
- BUNDLED WITH
- 1.10.0
- L
-
- simulate_bundler_version "9999999.0.0" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
-
- gem "rack"
- G
- end
-
- expect(out).to include("Warning: the lockfile is being updated to Bundler " \
- "9999999, after which you will be unable to return to Bundler 1.")
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- #{generic_local_platform}
- #{specific_local_platform}
-
- DEPENDENCIES
- rack
-
- BUNDLED WITH
- 9999999.0.0
- G
- end
-
- it "generates a simple lockfile for a single source, gem with dependencies" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
-
- gem "rack-obama"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
- rack-obama (1.0)
- rack
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- rack-obama
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "generates a simple lockfile for a single source, gem with a version requirement" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
-
- gem "rack-obama", ">= 1.0"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
- rack-obama (1.0)
- rack
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- rack-obama (>= 1.0)
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "generates a lockfile wihout credentials for a configured source" do
- bundle "config http://localgemserver.test/ user:pass"
-
- install_gemfile(<<-G, :artifice => "endpoint_strict_basic_authentication", :quiet => true)
- source "http://localgemserver.test/"
- source "http://user:pass@othergemserver.test/"
-
- gem "rack-obama", ">= 1.0"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: http://localgemserver.test/
- remote: http://user:pass@othergemserver.test/
- specs:
- rack (1.0.0)
- rack-obama (1.0)
- rack
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- rack-obama (>= 1.0)
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "generates lockfiles with multiple requirements" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
- gem "net-sftp"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- net-sftp (1.1.1)
- net-ssh (>= 1.0.0, < 1.99.0)
- net-ssh (1.0)
-
- PLATFORMS
- ruby
-
- DEPENDENCIES
- net-sftp
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
-
- expect(the_bundle).to include_gems "net-sftp 1.1.1", "net-ssh 1.0.0"
- end
-
- it "generates a simple lockfile for a single pinned source, gem with a version requirement" do
- git = build_git "foo"
-
- install_gemfile <<-G
- gem "foo", :git => "#{lib_path("foo-1.0")}"
- G
-
- lockfile_should_be <<-G
- GIT
- remote: #{lib_path("foo-1.0")}
- revision: #{git.ref_for("master")}
- specs:
- foo (1.0)
-
- GEM
- specs:
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- foo!
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "does not asplode when a platform specific dependency is present and the Gemfile has not been resolved on that platform" do
- build_lib "omg", :path => lib_path("omg")
-
- gemfile <<-G
- source "file://localhost#{gem_repo1}"
-
- platforms :#{not_local_tag} do
- gem "omg", :path => "#{lib_path("omg")}"
- end
-
- gem "rack"
- G
-
- lockfile <<-L
- GIT
- remote: git://github.com/nex3/haml.git
- revision: 8a2271f
- specs:
-
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- #{not_local}
-
- DEPENDENCIES
- omg!
- rack
-
- BUNDLED WITH
- #{Bundler::VERSION}
- L
-
- bundle "install"
- expect(the_bundle).to include_gems "rack 1.0.0"
- end
-
- it "serializes global git sources" do
- git = build_git "foo"
-
- install_gemfile <<-G
- git "#{lib_path("foo-1.0")}" do
- gem "foo"
- end
- G
-
- lockfile_should_be <<-G
- GIT
- remote: #{lib_path("foo-1.0")}
- revision: #{git.ref_for("master")}
- specs:
- foo (1.0)
-
- GEM
- specs:
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- foo!
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "generates a lockfile with a ref for a single pinned source, git gem with a branch requirement" do
- git = build_git "foo"
- update_git "foo", :branch => "omg"
-
- install_gemfile <<-G
- gem "foo", :git => "#{lib_path("foo-1.0")}", :branch => "omg"
- G
-
- lockfile_should_be <<-G
- GIT
- remote: #{lib_path("foo-1.0")}
- revision: #{git.ref_for("omg")}
- branch: omg
- specs:
- foo (1.0)
-
- GEM
- specs:
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- foo!
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "generates a lockfile with a ref for a single pinned source, git gem with a tag requirement" do
- git = build_git "foo"
- update_git "foo", :tag => "omg"
-
- install_gemfile <<-G
- gem "foo", :git => "#{lib_path("foo-1.0")}", :tag => "omg"
- G
-
- lockfile_should_be <<-G
- GIT
- remote: #{lib_path("foo-1.0")}
- revision: #{git.ref_for("omg")}
- tag: omg
- specs:
- foo (1.0)
-
- GEM
- specs:
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- foo!
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "serializes pinned path sources to the lockfile" do
- build_lib "foo"
-
- install_gemfile <<-G
- gem "foo", :path => "#{lib_path("foo-1.0")}"
- G
-
- lockfile_should_be <<-G
- PATH
- remote: #{lib_path("foo-1.0")}
- specs:
- foo (1.0)
-
- GEM
- specs:
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- foo!
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "serializes pinned path sources to the lockfile even when packaging" do
- build_lib "foo"
-
- install_gemfile! <<-G
- gem "foo", :path => "#{lib_path("foo-1.0")}"
- G
-
- bundle! :package, forgotten_command_line_options([:all, :cache_all] => true)
- bundle! :install, :local => true
-
- lockfile_should_be <<-G
- PATH
- remote: #{lib_path("foo-1.0")}
- specs:
- foo (1.0)
-
- GEM
- specs:
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- foo!
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "sorts serialized sources by type" do
- build_lib "foo"
- bar = build_git "bar"
-
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
-
- gem "rack"
- gem "foo", :path => "#{lib_path("foo-1.0")}"
- gem "bar", :git => "#{lib_path("bar-1.0")}"
- G
-
- lockfile_should_be <<-G
- GIT
- remote: #{lib_path("bar-1.0")}
- revision: #{bar.ref_for("master")}
- specs:
- bar (1.0)
-
- PATH
- remote: #{lib_path("foo-1.0")}
- specs:
- foo (1.0)
-
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- bar!
- foo!
- rack
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "lists gems alphabetically" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
-
- gem "thin"
- gem "actionpack"
- gem "rack-obama"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- actionpack (2.3.2)
- activesupport (= 2.3.2)
- activesupport (2.3.2)
- rack (1.0.0)
- rack-obama (1.0)
- rack
- thin (1.0)
- rack
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- actionpack
- rack-obama
- thin
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "orders dependencies' dependencies in alphabetical order" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
-
- gem "rails"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- actionmailer (2.3.2)
- activesupport (= 2.3.2)
- actionpack (2.3.2)
- activesupport (= 2.3.2)
- activerecord (2.3.2)
- activesupport (= 2.3.2)
- activeresource (2.3.2)
- activesupport (= 2.3.2)
- activesupport (2.3.2)
- rails (2.3.2)
- actionmailer (= 2.3.2)
- actionpack (= 2.3.2)
- activerecord (= 2.3.2)
- activeresource (= 2.3.2)
- rake (= 10.0.2)
- rake (10.0.2)
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- rails
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "orders dependencies by version" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
- gem 'double_deps'
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- double_deps (1.0)
- net-ssh
- net-ssh (>= 1.0.0)
- net-ssh (1.0)
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- double_deps
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "does not add the :require option to the lockfile" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
-
- gem "rack-obama", ">= 1.0", :require => "rack/obama"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
- rack-obama (1.0)
- rack
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- rack-obama (>= 1.0)
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "does not add the :group option to the lockfile" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
-
- gem "rack-obama", ">= 1.0", :group => :test
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
- rack-obama (1.0)
- rack
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- rack-obama (>= 1.0)
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "stores relative paths when the path is provided in a relative fashion and in Gemfile dir" do
- build_lib "foo", :path => bundled_app("foo")
-
- install_gemfile <<-G
- path "foo"
- gem "foo"
- G
-
- lockfile_should_be <<-G
- PATH
- remote: foo
- specs:
- foo (1.0)
-
- GEM
- specs:
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- foo
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "stores relative paths when the path is provided in a relative fashion and is above Gemfile dir" do
- build_lib "foo", :path => bundled_app(File.join("..", "foo"))
-
- install_gemfile <<-G
- path "../foo"
- gem "foo"
- G
-
- lockfile_should_be <<-G
- PATH
- remote: ../foo
- specs:
- foo (1.0)
-
- GEM
- specs:
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- foo
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "stores relative paths when the path is provided in an absolute fashion but is relative" do
- build_lib "foo", :path => bundled_app("foo")
-
- install_gemfile <<-G
- path File.expand_path("../foo", __FILE__)
- gem "foo"
- G
-
- lockfile_should_be <<-G
- PATH
- remote: foo
- specs:
- foo (1.0)
-
- GEM
- specs:
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- foo
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "stores relative paths when the path is provided for gemspec" do
- build_lib("foo", :path => tmp.join("foo"))
-
- install_gemfile <<-G
- gemspec :path => "../foo"
- G
-
- lockfile_should_be <<-G
- PATH
- remote: ../foo
- specs:
- foo (1.0)
-
- GEM
- specs:
-
- PLATFORMS
- #{generic_local_platform}
-
- DEPENDENCIES
- foo!
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "keeps existing platforms in the lockfile" do
- lockfile <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- java
-
- DEPENDENCIES
- rack
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
-
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
-
- gem "rack"
- G
-
- platforms = ["java", generic_local_platform.to_s].sort
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- #{platforms[0]}
- #{platforms[1]}
-
- DEPENDENCIES
- rack
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "persists the spec's platform to the lockfile" do
- build_gem "platform_specific", "1.0.0", :to_system => true do |s|
- s.platform = Gem::Platform.new("universal-java-16")
- end
-
- simulate_platform "universal-java-16"
-
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
- gem "platform_specific"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- platform_specific (1.0-java)
-
- PLATFORMS
- java
-
- DEPENDENCIES
- platform_specific
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "does not add duplicate gems" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
- gem "rack"
- G
-
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
- gem "rack"
- gem "activesupport"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- activesupport (2.3.5)
- rack (1.0.0)
-
- PLATFORMS
- ruby
-
- DEPENDENCIES
- activesupport
- rack
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "does not add duplicate dependencies" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
- gem "rack"
- gem "rack"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- ruby
-
- DEPENDENCIES
- rack
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "does not add duplicate dependencies with versions" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
- gem "rack", "1.0"
- gem "rack", "1.0"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- ruby
-
- DEPENDENCIES
- rack (= 1.0)
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "does not add duplicate dependencies in different groups" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
- gem "rack", "1.0", :group => :one
- gem "rack", "1.0", :group => :two
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
- PLATFORMS
- ruby
-
- DEPENDENCIES
- rack (= 1.0)
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "raises if two different versions are used" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
- gem "rack", "1.0"
- gem "rack", "1.1"
- G
-
- expect(bundled_app("Gemfile.lock")).not_to exist
- expect(out).to include "rack (= 1.0) and rack (= 1.1)"
- end
-
- it "raises if two different sources are used" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
- gem "rack"
- gem "rack", :git => "git://hubz.com"
- G
-
- expect(bundled_app("Gemfile.lock")).not_to exist
- expect(out).to include "rack (>= 0) should come from an unspecified source and git://hubz.com (at master)"
- end
-
- it "works correctly with multiple version dependencies" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
- gem "rack", "> 0.9", "< 1.0"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (0.9.1)
-
- PLATFORMS
- ruby
-
- DEPENDENCIES
- rack (> 0.9, < 1.0)
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- it "captures the Ruby version in the lockfile" do
- install_gemfile <<-G
- source "file://localhost#{gem_repo1}"
- ruby '#{RUBY_VERSION}'
- gem "rack", "> 0.9", "< 1.0"
- G
-
- lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (0.9.1)
-
- PLATFORMS
- ruby
-
- DEPENDENCIES
- rack (> 0.9, < 1.0)
-
- RUBY VERSION
- ruby #{RUBY_VERSION}p#{RUBY_PATCHLEVEL}
-
- BUNDLED WITH
- #{Bundler::VERSION}
- G
- end
-
- # Some versions of the Bundler 1.1 RC series introduced corrupted
- # lockfiles. There were two major problems:
- #
- # * multiple copies of the same GIT section appeared in the lockfile
- # * when this happened, those sections got multiple copies of gems
- # in those sections.
- it "fixes corrupted lockfiles" do
- build_git "omg", :path => lib_path("omg")
- revision = revision_for(lib_path("omg"))
-
- gemfile <<-G
- source "file://localhost#{gem_repo1}"
- gem "omg", :git => "#{lib_path("omg")}", :branch => 'master'
- G
-
- bundle "install --path vendor"
- expect(the_bundle).to include_gems "omg 1.0"
-
- # Create a Gemfile.lock that has duplicate GIT sections
- lockfile <<-L
- GIT
- remote: #{lib_path("omg")}
- revision: #{revision}
- branch: master
- specs:
- omg (1.0)
-
- GIT
- remote: #{lib_path("omg")}
- revision: #{revision}
- branch: master
- specs:
- omg (1.0)
-
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
-
- PLATFORMS
- #{local}
-
- DEPENDENCIES
- omg!
-
- BUNDLED WITH
- #{Bundler::VERSION}
- L
-
- FileUtils.rm_rf(bundled_app("vendor"))
- bundle "install"
- expect(the_bundle).to include_gems "omg 1.0"
-
- # Confirm that duplicate specs do not appear
- lockfile_should_be(<<-L)
- GIT
- remote: #{lib_path("omg")}
- revision: #{revision}
- branch: master
- specs:
- omg (1.0)
-
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
-
- PLATFORMS
- #{local}
-
- DEPENDENCIES
- omg!
-
- BUNDLED WITH
- #{Bundler::VERSION}
- L
- end
-
- it "raises a helpful error message when the lockfile is missing deps" do
- lockfile <<-L
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack_middleware (1.0)
-
- PLATFORMS
- #{local}
-
- DEPENDENCIES
- rack_middleware
- L
-
- install_gemfile <<-G
- source "file:#{gem_repo1}"
- gem "rack_middleware"
- G
-
- expect(out).to include("Downloading rack_middleware-1.0 revealed dependencies not in the API or the lockfile (#{Gem::Dependency.new("rack", "= 0.9.1")}).").
- and include("Either installing with `--full-index` or running `bundle update rack_middleware` should fix the problem.")
- end
-
- 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"))
- end
- before(:each) do
- build_repo2
-
- install_gemfile <<-G
- source "file://localhost#{gem_repo2}"
- gem "rack"
- G
- set_lockfile_mtime_to_known_value
- end
-
- it "generates Gemfile.lock with \\n line endings" do
- expect(File.read(bundled_app("Gemfile.lock"))).not_to match("\r\n")
- expect(the_bundle).to include_gems "rack 1.0"
- end
-
- context "during updates" 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(the_bundle).to include_gems "rack 1.2"
- end
-
- it "preserves Gemfile.lock \\n\\r line endings" do
- 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) }
- 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(the_bundle).to include_gems "rack 1.2"
- end
- end
-
- context "when nothing changes" do
- it "preserves Gemfile.lock \\n line endings" do
- expect do
- ruby <<-RUBY
- require 'rubygems'
- require 'bundler'
- Bundler.setup
- RUBY
- end.not_to change { File.mtime(bundled_app("Gemfile.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) }
- set_lockfile_mtime_to_known_value
-
- expect do
- ruby <<-RUBY
- require 'rubygems'
- require 'bundler'
- Bundler.setup
- RUBY
- end.not_to change { File.mtime(bundled_app("Gemfile.lock")) }
- end
- end
- end
-
- it "refuses to install if Gemfile.lock contains conflict markers" do
- lockfile <<-L
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- <<<<<<<
- rack (1.0.0)
- =======
- rack (1.0.1)
- >>>>>>>
-
- PLATFORMS
- ruby
-
- DEPENDENCIES
- rack
-
- BUNDLED WITH
- #{Bundler::VERSION}
- L
-
- install_gemfile(<<-G)
- source "file://localhost#{gem_repo1}"
- gem "rack"
- G
-
- expect(last_command.bundler_err).to match(/your Gemfile.lock contains merge conflicts/i)
- expect(last_command.bundler_err).to match(/git checkout HEAD -- Gemfile.lock/i)
- end
-end
diff --git a/spec/bundler/lock/lockfile_spec.rb b/spec/bundler/lock/lockfile_spec.rb
index 9e2fb3b2dd..5ee44bf779 100644
--- a/spec/bundler/lock/lockfile_spec.rb
+++ b/spec/bundler/lock/lockfile_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe "the lockfile format", :bundler => "3" do
+RSpec.describe "the lockfile format" do
include Bundler::GemHelpers
before { ENV["BUNDLER_SPEC_IGNORE_COMPATIBILITY_GUARD"] = "TRUE" }
@@ -76,7 +76,7 @@ RSpec.describe "the lockfile format", :bundler => "3" do
end
it "does not update the lockfile's bundler version if nothing changed during bundle install" do
- version = "#{Bundler::VERSION.split(".").first}.0.0.0.a"
+ version = "#{Bundler::VERSION.split(".").first}.0.0.a"
lockfile <<-L
GEM
@@ -180,8 +180,10 @@ RSpec.describe "the lockfile format", :bundler => "3" do
end
warning_message = "the running version of Bundler (9999999.0.0) is older " \
- "than the version that created the lockfile (9999999.1.0)"
- expect(last_command.bundler_err).to include warning_message
+ "than the version that created the lockfile (9999999.1.0). " \
+ "We suggest you to upgrade to the version that created the " \
+ "lockfile by running `gem install bundler:9999999.1.0`."
+ expect(last_command.stderr).to include warning_message
lockfile_should_be <<-G
GEM
@@ -190,7 +192,8 @@ RSpec.describe "the lockfile format", :bundler => "3" do
rack (1.0.0)
PLATFORMS
- #{lockfile_platforms}
+ #{generic_local_platform}
+ #{specific_local_platform}
DEPENDENCIES
rack
@@ -200,7 +203,7 @@ RSpec.describe "the lockfile format", :bundler => "3" do
G
end
- it "errors if the current is a major version older than lockfile's bundler version" do
+ it "errors if the current is a major version older than lockfile's bundler version", :bundler => "3" do
lockfile <<-L
GEM
remote: file://localhost#{gem_repo1}/
@@ -262,10 +265,10 @@ RSpec.describe "the lockfile format", :bundler => "3" do
G
expect(last_command).to be_failure
- expect(out).to include("You must use Bundler 9999999 or greater with this lockfile.")
+ expect(err).to include("You must use Bundler 9999999 or greater with this lockfile.")
end
- it "warns when updating bundler major version" do
+ it "warns when updating bundler major version", :bundler => "< 3" do
lockfile <<-L
GEM
remote: file://localhost#{gem_repo1}/
@@ -290,8 +293,10 @@ RSpec.describe "the lockfile format", :bundler => "3" do
G
end
- expect(out).to include("Warning: the lockfile is being updated to Bundler " \
- "9999999, after which you will be unable to return to Bundler 1.")
+ expect(last_command.stderr).to include(
+ "Warning: the lockfile is being updated to Bundler " \
+ "9999999, after which you will be unable to return to Bundler 1."
+ )
lockfile_should_be <<-G
GEM
@@ -300,7 +305,8 @@ RSpec.describe "the lockfile format", :bundler => "3" do
rack (1.0.0)
PLATFORMS
- #{lockfile_platforms}
+ #{generic_local_platform}
+ #{specific_local_platform}
DEPENDENCIES
rack
@@ -310,6 +316,53 @@ RSpec.describe "the lockfile format", :bundler => "3" do
G
end
+ it "warns when updating bundler major version", :bundler => "3" do
+ lockfile <<-L
+ GEM
+ remote: file://localhost#{gem_repo1}/
+ specs:
+ rack (1.0.0)
+
+ PLATFORMS
+ #{lockfile_platforms}
+
+ DEPENDENCIES
+ rack
+
+ BUNDLED WITH
+ 1.10.0
+ L
+
+ simulate_bundler_version "9999999.0.0" do
+ install_gemfile <<-G
+ source "file://localhost#{gem_repo1}/"
+
+ gem "rack"
+ G
+
+ expect(last_command.stderr).to include(
+ "Warning: the lockfile is being updated to Bundler " \
+ "9999999, after which you will be unable to return to Bundler 1."
+ )
+
+ lockfile_should_be <<-G
+ GEM
+ remote: file://localhost#{gem_repo1}/
+ specs:
+ rack (1.0.0)
+
+ PLATFORMS
+ #{lockfile_platforms}
+
+ DEPENDENCIES
+ rack
+
+ BUNDLED WITH
+ 9999999.0.0
+ G
+ end
+ end
+
it "generates a simple lockfile for a single source, gem with dependencies" do
install_gemfile <<-G
source "file://localhost#{gem_repo1}/"
@@ -362,8 +415,41 @@ RSpec.describe "the lockfile format", :bundler => "3" do
G
end
- it "generates a lockfile without credentials for a configured source" do
- bundle "config http://localgemserver.test/ user:pass"
+ it "generates a lockfile without credentials for a configured source", :bundler => "< 3" do
+ bundle "config set http://localgemserver.test/ user:pass"
+
+ install_gemfile(<<-G, :artifice => "endpoint_strict_basic_authentication", :quiet => true)
+ source "http://localgemserver.test/" do
+
+ end
+
+ source "http://user:pass@othergemserver.test/" do
+ gem "rack-obama", ">= 1.0"
+ end
+ G
+
+ lockfile_should_be <<-G
+ GEM
+ remote: http://localgemserver.test/
+ remote: http://user:pass@othergemserver.test/
+ specs:
+ rack (1.0.0)
+ rack-obama (1.0)
+ rack
+
+ PLATFORMS
+ #{lockfile_platforms}
+
+ DEPENDENCIES
+ rack-obama (>= 1.0)!
+
+ BUNDLED WITH
+ #{Bundler::VERSION}
+ G
+ end
+
+ it "generates a lockfile without credentials for a configured source", :bundler => "3" do
+ bundle "config set http://localgemserver.test/ user:pass"
install_gemfile(<<-G, :artifice => "endpoint_strict_basic_authentication", :quiet => true)
source "http://localgemserver.test/" do
@@ -464,15 +550,15 @@ RSpec.describe "the lockfile format", :bundler => "3" do
G
lockfile_should_be <<-G
- GEM
- specs:
-
GIT
remote: #{lib_path("foo-1.0")}
revision: #{git.ref_for("master")}
specs:
foo (1.0)
+ GEM
+ specs:
+
PLATFORMS
#{lockfile_platforms}
@@ -533,15 +619,15 @@ RSpec.describe "the lockfile format", :bundler => "3" do
G
lockfile_should_be <<-G
- GEM
- specs:
-
GIT
remote: #{lib_path("foo-1.0")}
revision: #{git.ref_for("master")}
specs:
foo (1.0)
+ GEM
+ specs:
+
PLATFORMS
#{lockfile_platforms}
@@ -562,9 +648,6 @@ RSpec.describe "the lockfile format", :bundler => "3" do
G
lockfile_should_be <<-G
- GEM
- specs:
-
GIT
remote: #{lib_path("foo-1.0")}
revision: #{git.ref_for("omg")}
@@ -572,6 +655,9 @@ RSpec.describe "the lockfile format", :bundler => "3" do
specs:
foo (1.0)
+ GEM
+ specs:
+
PLATFORMS
#{lockfile_platforms}
@@ -592,9 +678,6 @@ RSpec.describe "the lockfile format", :bundler => "3" do
G
lockfile_should_be <<-G
- GEM
- specs:
-
GIT
remote: #{lib_path("foo-1.0")}
revision: #{git.ref_for("omg")}
@@ -602,6 +685,9 @@ RSpec.describe "the lockfile format", :bundler => "3" do
specs:
foo (1.0)
+ GEM
+ specs:
+
PLATFORMS
#{lockfile_platforms}
@@ -621,14 +707,14 @@ RSpec.describe "the lockfile format", :bundler => "3" do
G
lockfile_should_be <<-G
- GEM
- specs:
-
PATH
remote: #{lib_path("foo-1.0")}
specs:
foo (1.0)
+ GEM
+ specs:
+
PLATFORMS
#{lockfile_platforms}
@@ -651,14 +737,14 @@ RSpec.describe "the lockfile format", :bundler => "3" do
bundle! :install, :local => true
lockfile_should_be <<-G
- GEM
- specs:
-
PATH
remote: #{lib_path("foo-1.0")}
specs:
foo (1.0)
+ GEM
+ specs:
+
PLATFORMS
#{lockfile_platforms}
@@ -683,11 +769,6 @@ RSpec.describe "the lockfile format", :bundler => "3" do
G
lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
- rack (1.0.0)
-
GIT
remote: #{lib_path("bar-1.0")}
revision: #{bar.ref_for("master")}
@@ -699,6 +780,11 @@ RSpec.describe "the lockfile format", :bundler => "3" do
specs:
foo (1.0)
+ GEM
+ remote: file://localhost#{gem_repo1}/
+ specs:
+ rack (1.0.0)
+
PLATFORMS
#{lockfile_platforms}
@@ -772,8 +858,8 @@ RSpec.describe "the lockfile format", :bundler => "3" do
actionpack (= 2.3.2)
activerecord (= 2.3.2)
activeresource (= 2.3.2)
- rake (= 10.0.2)
- rake (10.0.2)
+ rake (= 12.3.2)
+ rake (12.3.2)
PLATFORMS
#{lockfile_platforms}
@@ -874,14 +960,14 @@ RSpec.describe "the lockfile format", :bundler => "3" do
G
lockfile_should_be <<-G
- GEM
- specs:
-
PATH
remote: foo
specs:
foo (1.0)
+ GEM
+ specs:
+
PLATFORMS
#{lockfile_platforms}
@@ -903,14 +989,14 @@ RSpec.describe "the lockfile format", :bundler => "3" do
G
lockfile_should_be <<-G
- GEM
- specs:
-
PATH
remote: ../foo
specs:
foo (1.0)
+ GEM
+ specs:
+
PLATFORMS
#{lockfile_platforms}
@@ -932,14 +1018,14 @@ RSpec.describe "the lockfile format", :bundler => "3" do
G
lockfile_should_be <<-G
- GEM
- specs:
-
PATH
remote: foo
specs:
foo (1.0)
+ GEM
+ specs:
+
PLATFORMS
#{lockfile_platforms}
@@ -959,14 +1045,14 @@ RSpec.describe "the lockfile format", :bundler => "3" do
G
lockfile_should_be <<-G
- GEM
- specs:
-
PATH
remote: ../foo
specs:
foo (1.0)
+ GEM
+ specs:
+
PLATFORMS
#{lockfile_platforms}
@@ -978,7 +1064,48 @@ RSpec.describe "the lockfile format", :bundler => "3" do
G
end
- it "keeps existing platforms in the lockfile" do
+ it "keeps existing platforms in the lockfile", :bundler => "< 3" do
+ lockfile <<-G
+ GEM
+ remote: file://localhost#{gem_repo1}/
+ specs:
+ rack (1.0.0)
+
+ PLATFORMS
+ java
+
+ DEPENDENCIES
+ rack
+
+ BUNDLED WITH
+ #{Bundler::VERSION}
+ G
+
+ install_gemfile <<-G
+ source "file://localhost#{gem_repo1}/"
+
+ gem "rack"
+ G
+
+ lockfile_should_be <<-G
+ GEM
+ remote: file://localhost#{gem_repo1}/
+ specs:
+ rack (1.0.0)
+
+ PLATFORMS
+ java
+ #{generic_local_platform}
+
+ DEPENDENCIES
+ rack
+
+ BUNDLED WITH
+ #{Bundler::VERSION}
+ G
+ end
+
+ it "keeps existing platforms in the lockfile", :bundler => "3" do
lockfile <<-G
GEM
remote: file://localhost#{gem_repo1}/
@@ -1008,7 +1135,9 @@ RSpec.describe "the lockfile format", :bundler => "3" do
rack (1.0.0)
PLATFORMS
- #{lockfile_platforms "java", generic_local_platform, specific_local_platform}
+ java
+ #{generic_local_platform}
+ #{specific_local_platform}
DEPENDENCIES
rack
@@ -1018,7 +1147,38 @@ RSpec.describe "the lockfile format", :bundler => "3" do
G
end
- it "persists the spec's platform to the lockfile" do
+ it "persists the spec's platform to the lockfile", :bundler => "< 3" do
+ build_repo2 do
+ build_gem "platform_specific", "1.0" do |s|
+ s.platform = Gem::Platform.new("universal-java-16")
+ end
+ end
+
+ simulate_platform "universal-java-16"
+
+ install_gemfile! <<-G
+ source "file://localhost#{gem_repo2}"
+ gem "platform_specific"
+ G
+
+ lockfile_should_be <<-G
+ GEM
+ remote: file://localhost#{gem_repo2}/
+ specs:
+ platform_specific (1.0-java)
+
+ PLATFORMS
+ java
+
+ DEPENDENCIES
+ platform_specific
+
+ BUNDLED WITH
+ #{Bundler::VERSION}
+ G
+ end
+
+ it "persists the spec's platform and specific platform to the lockfile", :bundler => "3" do
build_repo2 do
build_gem "platform_specific", "1.0" do |s|
s.platform = Gem::Platform.new("universal-java-16")
@@ -1162,7 +1322,7 @@ RSpec.describe "the lockfile format", :bundler => "3" do
G
expect(bundled_app("Gemfile.lock")).not_to exist
- expect(out).to include "rack (= 1.0) and rack (= 1.1)"
+ expect(err).to include "rack (= 1.0) and rack (= 1.1)"
end
it "raises if two different sources are used" do
@@ -1173,7 +1333,7 @@ RSpec.describe "the lockfile format", :bundler => "3" do
G
expect(bundled_app("Gemfile.lock")).not_to exist
- expect(out).to include "rack (>= 0) should come from an unspecified source and git://hubz.com (at master)"
+ expect(err).to include "rack (>= 0) should come from an unspecified source and git://hubz.com (at master)"
end
it "works correctly with multiple version dependencies" do
@@ -1246,10 +1406,6 @@ RSpec.describe "the lockfile format", :bundler => "3" do
# Create a Gemfile.lock that has duplicate GIT sections
lockfile <<-L
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
-
GIT
remote: #{lib_path("omg")}
revision: #{revision}
@@ -1264,6 +1420,10 @@ RSpec.describe "the lockfile format", :bundler => "3" do
specs:
omg (1.0)
+ GEM
+ remote: file://localhost#{gem_repo1}/
+ specs:
+
PLATFORMS
#{lockfile_platforms}
@@ -1280,10 +1440,6 @@ RSpec.describe "the lockfile format", :bundler => "3" do
# Confirm that duplicate specs do not appear
lockfile_should_be(<<-L)
- GEM
- remote: file://localhost#{gem_repo1}/
- specs:
-
GIT
remote: #{lib_path("omg")}
revision: #{revision}
@@ -1291,6 +1447,10 @@ RSpec.describe "the lockfile format", :bundler => "3" do
specs:
omg (1.0)
+ GEM
+ remote: file://localhost#{gem_repo1}/
+ specs:
+
PLATFORMS
#{lockfile_platforms}
@@ -1321,7 +1481,7 @@ RSpec.describe "the lockfile format", :bundler => "3" do
gem "rack_middleware"
G
- expect(out).to include("Downloading rack_middleware-1.0 revealed dependencies not in the API or the lockfile (#{Gem::Dependency.new("rack", "= 0.9.1")}).").
+ expect(err).to include("Downloading rack_middleware-1.0 revealed dependencies not in the API or the lockfile (#{Gem::Dependency.new("rack", "= 0.9.1")}).").
and include("Either installing with `--full-index` or running `bundle update rack_middleware` should fix the problem.")
end
diff --git a/spec/bundler/other/bundle_ruby_spec.rb b/spec/bundler/other/bundle_ruby_spec.rb
deleted file mode 100644
index fbca31d0a0..0000000000
--- a/spec/bundler/other/bundle_ruby_spec.rb
+++ /dev/null
@@ -1,155 +0,0 @@
-# frozen_string_literal: true
-
-RSpec.describe "bundle_ruby", :bundler => "< 3" do
- context "without patchlevel" do
- it "returns the ruby version" do
- gemfile <<-G
- source "file://#{gem_repo1}"
- ruby "1.9.3", :engine => 'ruby', :engine_version => '1.9.3'
-
- gem "foo"
- G
-
- bundle_ruby
-
- expect(out).to include("ruby 1.9.3")
- end
-
- it "engine defaults to MRI" do
- gemfile <<-G
- source "file://#{gem_repo1}"
- ruby "1.9.3"
-
- gem "foo"
- G
-
- bundle_ruby
-
- expect(out).to include("ruby 1.9.3")
- end
-
- it "handles jruby" do
- gemfile <<-G
- source "file://#{gem_repo1}"
- ruby "1.8.7", :engine => 'jruby', :engine_version => '1.6.5'
-
- gem "foo"
- G
-
- bundle_ruby
-
- expect(out).to include("ruby 1.8.7 (jruby 1.6.5)")
- end
-
- it "handles rbx" do
- gemfile <<-G
- source "file://#{gem_repo1}"
- ruby "1.8.7", :engine => 'rbx', :engine_version => '1.2.4'
-
- gem "foo"
- G
-
- bundle_ruby
-
- expect(out).to include("ruby 1.8.7 (rbx 1.2.4)")
- end
-
- it "handles truffleruby", :rubygems => ">= 2.1.0" do
- gemfile <<-G
- source "file://#{gem_repo1}"
- ruby "2.5.1", :engine => 'truffleruby', :engine_version => '1.0.0-rc6'
-
- gem "foo"
- G
-
- bundle_ruby
-
- expect(out).to include("ruby 2.5.1 (truffleruby 1.0.0-rc6)")
- end
-
- it "raises an error if engine is used but engine version is not" do
- gemfile <<-G
- source "file://#{gem_repo1}"
- ruby "1.8.7", :engine => 'rbx'
-
- gem "foo"
- G
-
- bundle_ruby
- expect(exitstatus).not_to eq(0) if exitstatus
-
- bundle_ruby
- expect(out).to include("Please define :engine_version")
- end
-
- it "raises an error if engine_version is used but engine is not" do
- gemfile <<-G
- source "file://#{gem_repo1}"
- ruby "1.8.7", :engine_version => '1.2.4'
-
- gem "foo"
- G
-
- bundle_ruby
- expect(exitstatus).not_to eq(0) if exitstatus
-
- bundle_ruby
- expect(out).to include("Please define :engine")
- end
-
- it "raises an error if engine version doesn't match ruby version for MRI" do
- gemfile <<-G
- source "file://#{gem_repo1}"
- ruby "1.8.7", :engine => 'ruby', :engine_version => '1.2.4'
-
- gem "foo"
- G
-
- bundle_ruby
- expect(exitstatus).not_to eq(0) if exitstatus
-
- bundle_ruby
- expect(out).to include("ruby_version must match the :engine_version for MRI")
- end
-
- it "should print if no ruby version is specified" do
- gemfile <<-G
- source "file://#{gem_repo1}"
-
- gem "foo"
- G
-
- bundle_ruby
-
- expect(out).to include("No ruby version specified")
- end
- end
-
- context "when using patchlevel" do
- it "returns the ruby version" do
- gemfile <<-G
- source "file://#{gem_repo1}"
- ruby "1.9.3", :patchlevel => '429', :engine => 'ruby', :engine_version => '1.9.3'
-
- gem "foo"
- G
-
- bundle_ruby
-
- expect(out).to include("ruby 1.9.3p429")
- end
-
- it "handles an engine" do
- gemfile <<-G
- source "file://#{gem_repo1}"
- ruby "1.9.3", :patchlevel => '392', :engine => 'jruby', :engine_version => '1.7.4'
-
- gem "foo"
- G
-
- bundle_ruby
-
- expect(out).to include("ruby 1.9.3p392 (jruby 1.7.4)")
- end
- end
-end
diff --git a/spec/bundler/other/cli_dispatch_spec.rb b/spec/bundler/other/cli_dispatch_spec.rb
index d17819b394..67127fc6e0 100644
--- a/spec/bundler/other/cli_dispatch_spec.rb
+++ b/spec/bundler/other/cli_dispatch_spec.rb
@@ -19,7 +19,7 @@ RSpec.describe "bundle command names" do
end
context "when cache_command_is_package is set" do
- before { bundle! "config cache_command_is_package true" }
+ before { bundle! "config set cache_command_is_package true" }
it "dispatches `bundle cache` to the package command" do
bundle "cache --verbose"
diff --git a/spec/bundler/other/compatibility_guard_spec.rb b/spec/bundler/other/compatibility_guard_spec.rb
index ac05ebd918..c72842eab5 100644
--- a/spec/bundler/other/compatibility_guard_spec.rb
+++ b/spec/bundler/other/compatibility_guard_spec.rb
@@ -12,14 +12,5 @@ RSpec.describe "bundler compatibility guard" do
expect(err).to eq("Bundler 2 requires Ruby 2.3 or later. Either install bundler 1 or update to a supported Ruby version.")
end
end
-
- context "when running on RubyGems < 2.5", :ruby => ">= 2.5" do
- before { simulate_rubygems_version "1.3.6" }
-
- it "raises a friendly error" do
- bundle :version
- expect(err).to eq("Bundler 2 requires RubyGems 2.5 or later. Either install bundler 1 or update to a supported RubyGems version.")
- end
- end
end
end
diff --git a/spec/bundler/other/ext_spec.rb b/spec/bundler/other/ext_spec.rb
index 3f6f8b4928..bc8c781c5d 100644
--- a/spec/bundler/other/ext_spec.rb
+++ b/spec/bundler/other/ext_spec.rb
@@ -54,13 +54,8 @@ RSpec.describe "Gem::SourceIndex#refresh!" do
G
end
- it "does not explode when called", :rubygems => "1.7" do
+ it "does not explode when called" do
run "Gem.source_index.refresh!"
run "Gem::SourceIndex.new([]).refresh!"
end
-
- it "does not explode when called", :rubygems => "< 1.7" do
- run "Gem.source_index.refresh!"
- run "Gem::SourceIndex.from_gems_in([]).refresh!"
- end
end
diff --git a/spec/bundler/other/major_deprecation_spec.rb b/spec/bundler/other/major_deprecation_spec.rb
index 50800dbb0c..83944e4075 100644
--- a/spec/bundler/other/major_deprecation_spec.rb
+++ b/spec/bundler/other/major_deprecation_spec.rb
@@ -1,126 +1,235 @@
# frozen_string_literal: true
-RSpec.describe "major deprecations", :bundler => "< 3" do
- let(:warnings) { last_command.bundler_err } # change to err in 2.0
- let(:warnings_without_version_messages) { warnings.gsub(/#{Spec::Matchers::MAJOR_DEPRECATION}Bundler will only support ruby(gems)? >= .*/, "") }
+RSpec.describe "major deprecations" do
+ let(:warnings) { err }
- context "in a .99 version" do
+ describe "Bundler" do
before do
- simulate_bundler_version "1.99.1"
- bundle "config --delete major_deprecations"
+ install_gemfile! <<-G
+ source "file:#{gem_repo1}"
+ gem "rack"
+ G
end
- it "prints major deprecations without being configured" do
- ruby <<-R
- require "bundler"
- Bundler::SharedHelpers.major_deprecation(Bundler::VERSION)
- R
+ describe ".clean_env" do
+ before do
+ source = "Bundler.clean_env"
+ bundle "exec ruby -e #{source.dump}"
+ end
+
+ it "is deprecated in favor of .unbundled_env", :bundler => "2" do
+ expect(deprecations).to include \
+ "`Bundler.clean_env` has been deprecated in favor of `Bundler.unbundled_env`. " \
+ "If you instead want the environment before bundler was originally loaded, use `Bundler.original_env`"
+ end
- expect(warnings).to have_major_deprecation("1.99.1")
+ pending "is removed and shows a helpful error message about it", :bundler => "3"
end
- end
- before do
- bundle "config major_deprecations true"
+ describe ".with_clean_env" do
+ before do
+ source = "Bundler.with_clean_env {}"
+ bundle "exec ruby -e #{source.dump}"
+ end
- create_file "gems.rb", <<-G
- source "file:#{gem_repo1}"
- ruby #{RUBY_VERSION.dump}
- gem "rack"
- G
- bundle! "install"
- end
+ it "is deprecated in favor of .unbundled_env", :bundler => "2" do
+ expect(deprecations).to include(
+ "`Bundler.with_clean_env` has been deprecated in favor of `Bundler.with_unbundled_env`. " \
+ "If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env`"
+ )
+ end
- describe "bundle_ruby" do
- it "prints a deprecation" do
- bundle_ruby
- warnings.gsub! "\nruby #{RUBY_VERSION}", ""
- expect(warnings).to have_major_deprecation "the bundle_ruby executable has been removed in favor of `bundle platform --ruby`"
+ pending "is removed and shows a helpful error message about it", :bundler => "3"
end
- end
- describe "Bundler" do
- describe ".clean_env" do
- it "is deprecated in favor of .original_env" do
- source = "Bundler.clean_env"
+ describe ".clean_system" do
+ before do
+ source = "Bundler.clean_system('ls')"
bundle "exec ruby -e #{source.dump}"
- expect(warnings).to have_major_deprecation "`Bundler.clean_env` has weird edge cases, use `.original_env` instead"
end
+
+ it "is deprecated in favor of .unbundled_system", :bundler => "2" do
+ expect(deprecations).to include(
+ "`Bundler.clean_system` has been deprecated in favor of `Bundler.unbundled_system`. " \
+ "If you instead want to run the command in the environment before bundler was originally loaded, use `Bundler.original_system`"
+ )
+ end
+
+ pending "is removed and shows a helpful error message about it", :bundler => "3"
+ end
+
+ describe ".clean_exec" do
+ before do
+ source = "Bundler.clean_exec('ls')"
+ bundle "exec ruby -e #{source.dump}"
+ end
+
+ it "is deprecated in favor of .unbundled_exec", :bundler => "2" do
+ expect(deprecations).to include(
+ "`Bundler.clean_exec` has been deprecated in favor of `Bundler.unbundled_exec`. " \
+ "If you instead want to exec to a command in the environment before bundler was originally loaded, use `Bundler.original_exec`"
+ )
+ end
+
+ pending "is removed and shows a helpful error message about it", :bundler => "3"
end
describe ".environment" do
- it "is deprecated in favor of .load" do
+ before do
source = "Bundler.environment"
bundle "exec ruby -e #{source.dump}"
- expect(warnings).to have_major_deprecation "Bundler.environment has been removed in favor of Bundler.load"
end
+
+ it "is deprecated in favor of .load", :bundler => "2" do
+ expect(deprecations).to include "Bundler.environment has been removed in favor of Bundler.load"
+ end
+
+ pending "is removed and shows a helpful error message about it", :bundler => "3"
end
+ end
- shared_examples_for "environmental deprecations" do |trigger|
- describe "ruby version", :ruby => "< 2.0" do
- it "requires a newer ruby version" do
- instance_eval(&trigger)
- expect(warnings).to have_major_deprecation "Bundler will only support ruby >= 2.0, you are running #{RUBY_VERSION}"
- end
+ describe "bundle update --quiet" do
+ it "does not print any deprecations" do
+ bundle :update, :quiet => true
+ expect(deprecations).to be_empty
+ end
+ end
+
+ describe "bundle config" do
+ describe "old list interface" do
+ before do
+ bundle! "config"
end
- describe "rubygems version", :rubygems => "< 2.0" do
- it "requires a newer rubygems version" do
- instance_eval(&trigger)
- expect(warnings).to have_major_deprecation "Bundler will only support rubygems >= 2.0, you are running #{Gem::VERSION}"
- end
+ it "warns", :bundler => "2" do
+ expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config list` instead.")
end
+
+ pending "fails with a helpful error", :bundler => "3"
end
- describe "-rbundler/setup" do
- it_behaves_like "environmental deprecations", proc { ruby "require 'bundler/setup'" }
+ describe "old get interface" do
+ before do
+ bundle! "config waka"
+ end
+
+ it "warns", :bundler => "2" do
+ expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config get waka` instead.")
+ end
+
+ pending "fails with a helpful error", :bundler => "3"
end
- describe "Bundler.setup" do
- it_behaves_like "environmental deprecations", proc { ruby "require 'bundler'; Bundler.setup" }
+ describe "old set interface" do
+ before do
+ bundle! "config waka wakapun"
+ end
+
+ it "warns", :bundler => "2" do
+ expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config set waka wakapun` instead.")
+ end
+
+ pending "fails with a helpful error", :bundler => "3"
end
- describe "bundle check" do
- it_behaves_like "environmental deprecations", proc { bundle :check }
+ describe "old set interface with --local" do
+ before do
+ bundle! "config --local waka wakapun"
+ end
+
+ it "warns", :bundler => "2" do
+ expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config set --local waka wakapun` instead.")
+ end
+
+ pending "fails with a helpful error", :bundler => "3"
end
- describe "bundle update --quiet" do
- it "does not print any deprecations" do
- bundle :update, :quiet => true
- expect(warnings_without_version_messages).not_to have_major_deprecation
+ describe "old set interface with --global" do
+ before do
+ bundle! "config --global waka wakapun"
end
+
+ it "warns", :bundler => "2" do
+ expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config set --global waka wakapun` instead.")
+ end
+
+ pending "fails with a helpful error", :bundler => "3"
end
- describe "bundle update" do
+ describe "old unset interface" do
before do
- create_file("gems.rb", "")
- bundle! "install"
+ bundle! "config --delete waka"
end
- it "warns when no options are given" do
- bundle! "update"
- expect(warnings).to have_major_deprecation a_string_including("Pass --all to `bundle update` to update everything")
+ it "warns", :bundler => "2" do
+ expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config unset waka` instead.")
end
- it "does not warn when --all is passed" do
- bundle! "update --all"
- expect(warnings_without_version_messages).not_to have_major_deprecation
+ pending "fails with a helpful error", :bundler => "3"
+ end
+
+ describe "old unset interface with --local" do
+ before do
+ bundle! "config --delete --local waka"
+ end
+
+ it "warns", :bundler => "2" do
+ expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config unset --local waka` instead.")
end
+
+ pending "fails with a helpful error", :bundler => "3"
end
- describe "bundle install --binstubs" do
- it "should output a deprecation warning" do
- gemfile <<-G
- gem 'rack'
- G
+ describe "old unset interface with --global" do
+ before do
+ bundle! "config --delete --global waka"
+ end
- bundle :install, :binstubs => true
- expect(warnings).to have_major_deprecation a_string_including("The --binstubs option will be removed")
+ it "warns", :bundler => "2" do
+ expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config unset --global waka` instead.")
end
+
+ pending "fails with a helpful error", :bundler => "3"
+ end
+ end
+
+ describe "bundle update" do
+ before do
+ install_gemfile <<-G
+ source "file:#{gem_repo1}"
+ gem "rack"
+ G
+ end
+
+ it "warns when no options are given", :bundler => "2" do
+ bundle! "update"
+ expect(deprecations).to include("Pass --all to `bundle update` to update everything")
+ end
+
+ pending "fails with a helpful error when no options are given", :bundler => "3"
+
+ it "does not warn when --all is passed" do
+ bundle! "update --all"
+ expect(deprecations).to be_empty
+ end
+ end
+
+ describe "bundle install --binstubs" do
+ before do
+ install_gemfile <<-G, :binstubs => true
+ source "file:#{gem_repo1}"
+ gem "rack"
+ G
+ end
+
+ it "should output a deprecation warning", :bundler => "2" do
+ expect(deprecations).to include("The --binstubs option will be removed in favor of `bundle binstubs`")
end
+
+ pending "fails with a helpful error", :bundler => "3"
end
- context "when bundle is run" do
+ context "bundle install with both gems.rb and Gemfile present" do
it "should not warn about gems.rb" do
create_file "gems.rb", <<-G
source "file://#{gem_repo1}"
@@ -128,36 +237,92 @@ RSpec.describe "major deprecations", :bundler => "< 3" do
G
bundle :install
- expect(warnings_without_version_messages).not_to have_major_deprecation
+ expect(deprecations).to be_empty
end
- it "should print a Gemfile deprecation warning" do
+ it "should print a proper warning, and use gems.rb" do
create_file "gems.rb"
install_gemfile! <<-G
source "file://#{gem_repo1}"
gem "rack"
G
- expect(the_bundle).to include_gem "rack 1.0"
- expect(warnings).to have_major_deprecation a_string_including("gems.rb and gems.locked will be preferred to Gemfile and Gemfile.lock.")
+ expect(warnings).to include(
+ "Multiple gemfiles (gems.rb and Gemfile) detected. Make sure you remove Gemfile and Gemfile.lock since bundler is ignoring them in favor of gems.rb and gems.rb.locked."
+ )
+
+ expect(the_bundle).not_to include_gem "rack 1.0"
end
+ end
- context "with flags" do
- it "should print a deprecation warning about autoremembering flags" do
- install_gemfile <<-G, :path => "vendor/bundle"
- source "file://#{gem_repo1}"
- gem "rack"
- G
+ context "bundle install with flags" do
+ before do
+ bundle "config set --local path vendor/bundle"
- expect(warnings).to have_major_deprecation a_string_including(
- "flags passed to commands will no longer be automatically remembered."
- )
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack"
+ G
+ end
+
+ {
+ :clean => true,
+ :deployment => true,
+ :frozen => true,
+ :"no-cache" => true,
+ :"no-prune" => true,
+ :path => "vendor/bundle",
+ :shebang => "ruby27",
+ :system => true,
+ :without => "development",
+ :with => "development",
+ }.each do |name, value|
+ flag_name = "--#{name}"
+
+ context "with the #{flag_name} flag" do
+ before do
+ bundle "install" # to create a lockfile, which deployment or frozen need
+ bundle "install #{flag_name} #{value}"
+ end
+
+ it "should print a deprecation warning", :bundler => "2" do
+ expect(deprecations).to include(
+ "The `#{flag_name}` flag is deprecated because it relies on " \
+ "being remembered accross bundler invokations, which bundler " \
+ "will no longer do in future versions. Instead please use " \
+ "`bundle config #{name} '#{value}'`, and stop using this flag"
+ )
+ end
+
+ pending "should fail with a helpful error", :bundler => "3"
end
end
end
+ context "bundle install with multiple sources" do
+ before do
+ install_gemfile <<-G
+ source "file://localhost#{gem_repo3}"
+ source "file://localhost#{gem_repo1}"
+ G
+ end
+
+ it "shows a deprecation", :bundler => "2" do
+ expect(deprecations).to include(
+ "Your Gemfile contains multiple primary sources. " \
+ "Using `source` more than once without a block is a security risk, and " \
+ "may result in installing unexpected gems. To resolve this warning, use " \
+ "a block to indicate which gems should come from the secondary source. " \
+ "To upgrade this warning to an error, run `bundle config set " \
+ "disable_multisource true`."
+ )
+ end
+
+ pending "should fail with a helpful error", :bundler => "3"
+ end
+
context "when Bundler.setup is run in a ruby script" do
- it "should print a single deprecation warning" do
+ before do
create_file "gems.rb"
install_gemfile! <<-G
source "file://#{gem_repo1}"
@@ -173,52 +338,57 @@ RSpec.describe "major deprecations", :bundler => "< 3" do
Bundler.setup
Bundler.setup
RUBY
+ end
- expect(warnings_without_version_messages).to have_major_deprecation("gems.rb and gems.locked will be preferred to Gemfile and Gemfile.lock.")
+ it "should print a single deprecation warning" do
+ expect(warnings).to include(
+ "Multiple gemfiles (gems.rb and Gemfile) detected. Make sure you remove Gemfile and Gemfile.lock since bundler is ignoring them in favor of gems.rb and gems.rb.locked."
+ )
end
end
context "when `bundler/deployment` is required in a ruby script" do
- it "should print a capistrano deprecation warning" do
+ before do
ruby(<<-RUBY)
require 'bundler/deployment'
RUBY
+ end
- expect(warnings).to have_major_deprecation("Bundler no longer integrates " \
+ it "should print a capistrano deprecation warning", :bundler => "2" do
+ expect(deprecations).to include("Bundler no longer integrates " \
"with Capistrano, but Capistrano provides " \
"its own integration with Bundler via the " \
"capistrano-bundler gem. Use it instead.")
end
+
+ pending "should fail with a helpful error", :bundler => "3"
end
describe Bundler::Dsl do
+ let(:msg) do
+ <<-EOS
+The :github git source is deprecated, and will be removed in the future. Change any "reponame" :github sources to "username/reponame". Add this code to the top of your Gemfile to ensure it continues to work:
+
+ git_source(:github) {|repo_name| "https://github.com/\#{repo_name}.git" }
+
+ EOS
+ end
+
before do
@rubygems = double("rubygems")
allow(Bundler::Source::Rubygems).to receive(:new) { @rubygems }
end
context "with github gems" do
- it "warns about the https change" do
- msg = <<-EOS
-The :github git source is deprecated, and will be removed in Bundler 3.0. Change any "reponame" :github sources to "username/reponame". Add this code to the top of your Gemfile to ensure it continues to work:
-
- git_source(:github) {|repo_name| "https://github.com/\#{repo_name}.git" }
-
- EOS
+ it "warns about the https change if people are opting out" do
+ Bundler.settings.temporary "github.https" => false
expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, msg)
+ expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, "Setting `github.https` to false is deprecated and won't be supported in the future.")
subject.gem("sparks", :github => "indirect/sparks")
end
- it "upgrades to https on request" do
- Bundler.settings.temporary "github.https" => true
- msg = <<-EOS
-The :github git source is deprecated, and will be removed in Bundler 3.0. Change any "reponame" :github sources to "username/reponame". Add this code to the top of your Gemfile to ensure it continues to work:
-
- git_source(:github) {|repo_name| "https://github.com/\#{repo_name}.git" }
-
- EOS
+ it "upgrades to https by default", :bundler => "2" do
expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, msg)
- expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, "The `github.https` setting will be removed")
subject.gem("sparks", :github => "indirect/sparks")
github_uri = "https://github.com/indirect/sparks.git"
expect(subject.dependencies.first.source.uri).to eq(github_uri)
@@ -229,7 +399,7 @@ The :github git source is deprecated, and will be removed in Bundler 3.0. Change
it "warns about removal" do
allow(Bundler.ui).to receive(:deprecate)
msg = <<-EOS
-The :bitbucket git source is deprecated, and will be removed in Bundler 3.0. Add this code to the top of your Gemfile to ensure it continues to work:
+The :bitbucket git source is deprecated, and will be removed in the future. Add this code to the top of your Gemfile to ensure it continues to work:
git_source(:bitbucket) do |repo_name|
user_name, repo_name = repo_name.split("/")
@@ -246,10 +416,12 @@ The :bitbucket git source is deprecated, and will be removed in Bundler 3.0. Add
context "with gist gems" do
it "warns about removal" do
allow(Bundler.ui).to receive(:deprecate)
- msg = "The :gist git source is deprecated, and will be removed " \
- "in Bundler 3.0. Add this code to the top of your Gemfile to ensure it " \
- "continues to work:\n\n git_source(:gist) {|repo_name| " \
- "\"https://gist.github.com/\#{repo_name}.git\" }\n\n"
+ msg = <<-EOS
+The :gist git source is deprecated, and will be removed in the future. Add this code to the top of your Gemfile to ensure it continues to work:
+
+ git_source(:gist) {|repo_name| "https://gist.github.com/\#{repo_name}.git" }
+
+ EOS
expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, msg)
subject.gem("not-really-a-gem", :gist => "1234")
end
@@ -257,26 +429,91 @@ The :bitbucket git source is deprecated, and will be removed in Bundler 3.0. Add
end
context "bundle show" do
- it "prints a deprecation warning" do
+ before do
install_gemfile! <<-G
source "file://#{gem_repo1}"
gem "rack"
G
+ end
- bundle! :show
+ context "without flags" do
+ before do
+ bundle! :show
+ end
- warnings.gsub!(/gems included.*?\[DEPRECATED/im, "[DEPRECATED")
+ it "prints a deprecation warning recommending `bundle list`", :bundler => "2" do
+ expect(deprecations).to include("use `bundle list` instead of `bundle show`")
+ end
- expect(warnings).to have_major_deprecation a_string_including("use `bundle list` instead of `bundle show`")
+ pending "fails with a helpful message", :bundler => "3"
end
+
+ context "with --outdated flag" do
+ before do
+ bundle! "show --outdated"
+ end
+
+ it "prints a deprecation warning informing about its removal", :bundler => "2" do
+ expect(deprecations).to include("the `--outdated` flag to `bundle show` was undocumented and will be removed without replacement")
+ end
+
+ pending "fails with a helpful message", :bundler => "3"
+ end
+
+ context "with --verbose flag" do
+ before do
+ bundle! "show --verbose"
+ end
+
+ it "prints a deprecation warning informing about its removal", :bundler => "2" do
+ expect(deprecations).to include("the `--verbose` flag to `bundle show` was undocumented and will be removed without replacement")
+ end
+
+ pending "fails with a helpful message", :bundler => "3"
+ end
+
+ context "with a gem argument" do
+ before do
+ bundle! "show rack"
+ end
+
+ it "prints a deprecation warning recommending `bundle info`", :bundler => "2" do
+ expect(deprecations).to include("use `bundle info rack` instead of `bundle show rack`")
+ end
+ end
+
+ pending "fails with a helpful message", :bundler => "3"
end
context "bundle console" do
- it "prints a deprecation warning" do
+ before do
bundle "console"
+ end
- expect(warnings).to have_major_deprecation \
- a_string_including("bundle console will be replaced by `bin/console` generated by `bundle gem <name>`")
+ it "prints a deprecation warning", :bundler => "2" do
+ expect(deprecations).to include \
+ "bundle console will be replaced by `bin/console` generated by `bundle gem <name>`"
end
+
+ pending "fails with a helpful message", :bundler => "3"
+ end
+
+ context "bundle viz" do
+ let(:ruby_graphviz) do
+ graphviz_glob = base_system_gems.join("cache/ruby-graphviz*")
+ Pathname.glob(graphviz_glob).first
+ end
+
+ before do
+ system_gems ruby_graphviz
+ create_file "gems.rb"
+ bundle "viz"
+ end
+
+ it "prints a deprecation warning", :bundler => "2" do
+ expect(deprecations).to include "The `viz` command has been moved to the `bundle-viz` gem, see https://github.com/bundler/bundler-viz"
+ end
+
+ pending "fails with a helpful message", :bundler => "3"
end
end
diff --git a/spec/bundler/other/platform_spec.rb b/spec/bundler/other/platform_spec.rb
index 6c59fd893c..9c62904286 100644
--- a/spec/bundler/other/platform_spec.rb
+++ b/spec/bundler/other/platform_spec.rb
@@ -149,7 +149,7 @@ G
expect(out).to eq("ruby 1.8.7 (rbx 1.2.4)")
end
- it "handles truffleruby", :rubygems => ">= 2.1.0" do
+ it "handles truffleruby" do
gemfile <<-G
source "file://#{gem_repo1}"
ruby "2.5.1", :engine => 'truffleruby', :engine_version => '1.0.0-rc6'
@@ -268,27 +268,27 @@ G
def should_be_ruby_version_incorrect
expect(exitstatus).to eq(18) if exitstatus
- expect(out).to be_include("Your Ruby version is #{RUBY_VERSION}, but your Gemfile specified #{not_local_ruby_version}")
+ expect(err).to be_include("Your Ruby version is #{RUBY_VERSION}, but your Gemfile specified #{not_local_ruby_version}")
end
def should_be_engine_incorrect
expect(exitstatus).to eq(18) if exitstatus
- expect(out).to be_include("Your Ruby engine is #{local_ruby_engine}, but your Gemfile specified #{not_local_tag}")
+ expect(err).to be_include("Your Ruby engine is #{local_ruby_engine}, but your Gemfile specified #{not_local_tag}")
end
def should_be_engine_version_incorrect
expect(exitstatus).to eq(18) if exitstatus
- expect(out).to be_include("Your #{local_ruby_engine} version is #{local_engine_version}, but your Gemfile specified #{local_ruby_engine} #{not_local_engine_version}")
+ expect(err).to be_include("Your #{local_ruby_engine} version is #{local_engine_version}, but your Gemfile specified #{local_ruby_engine} #{not_local_engine_version}")
end
def should_be_patchlevel_incorrect
expect(exitstatus).to eq(18) if exitstatus
- expect(out).to be_include("Your Ruby patchlevel is #{RUBY_PATCHLEVEL}, but your Gemfile specified #{not_local_patchlevel}")
+ expect(err).to be_include("Your Ruby patchlevel is #{RUBY_PATCHLEVEL}, but your Gemfile specified #{not_local_patchlevel}")
end
def should_be_patchlevel_fixnum
expect(exitstatus).to eq(18) if exitstatus
- expect(out).to be_include("The Ruby patchlevel in your Gemfile must be a string")
+ expect(err).to be_include("The Ruby patchlevel in your Gemfile must be a string")
end
context "bundle install" do
@@ -511,7 +511,7 @@ G
build_gem "activesupport", "3.0"
end
- bundle "update", :all => bundle_update_requires_all?
+ bundle "update", :all => true
expect(the_bundle).to include_gems "rack 1.2", "rack-obama 1.0", "activesupport 3.0"
end
@@ -528,7 +528,7 @@ G
build_gem "activesupport", "3.0"
end
- bundle "update", :all => bundle_update_requires_all?
+ bundle "update", :all => true
expect(the_bundle).to include_gems "rack 1.2", "rack-obama 1.0", "activesupport 3.0"
end
end
@@ -545,7 +545,7 @@ G
build_gem "activesupport", "3.0"
end
- bundle :update, :all => bundle_update_requires_all?
+ bundle :update, :all => true
should_be_ruby_version_incorrect
end
@@ -561,7 +561,7 @@ G
build_gem "activesupport", "3.0"
end
- bundle :update, :all => bundle_update_requires_all?
+ bundle :update, :all => true
should_be_engine_incorrect
end
@@ -578,7 +578,7 @@ G
build_gem "activesupport", "3.0"
end
- bundle :update, :all => bundle_update_requires_all?
+ bundle :update, :all => true
should_be_engine_version_incorrect
end
end
@@ -594,7 +594,7 @@ G
build_gem "activesupport", "3.0"
end
- bundle :update, :all => bundle_update_requires_all?
+ bundle :update, :all => true
should_be_patchlevel_incorrect
end
end
@@ -863,7 +863,7 @@ G
G
bundle "exec rackup"
- expect(out).to eq("0.9.1")
+ expect(out).to include("0.9.1")
end
it "activates the correct gem when ruby version matches any engine" do
@@ -876,7 +876,7 @@ G
G
bundle "exec rackup"
- expect(out).to eq("0.9.1")
+ expect(out).to include("0.9.1")
end
end
diff --git a/spec/bundler/other/ssl_cert_spec.rb b/spec/bundler/other/ssl_cert_spec.rb
deleted file mode 100644
index 6d957276fc..0000000000
--- a/spec/bundler/other/ssl_cert_spec.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-require "bundler/ssl_certs/certificate_manager"
-
-RSpec.describe "SSL Certificates", :rubygems_master do
- hosts = %w[
- rubygems.org
- index.rubygems.org
- rubygems.global.ssl.fastly.net
- staging.rubygems.org
- ]
-
- hosts.each do |host|
- it "can securely connect to #{host}", :realworld do
- Bundler::SSLCerts::CertificateManager.new.connect_to(host)
- end
- end
-end
diff --git a/spec/bundler/plugins/command_spec.rb b/spec/bundler/plugins/command_spec.rb
index 999d8b722b..53d34f7acc 100644
--- a/spec/bundler/plugins/command_spec.rb
+++ b/spec/bundler/plugins/command_spec.rb
@@ -73,8 +73,8 @@ RSpec.describe "command plugins" do
expect(out).not_to include("Installed plugin copycat")
- expect(out).to include("Failed to install plugin")
+ expect(err).to include("Failed to install plugin")
- expect(out).to include("Command(s) `mahcommand` declared by copycat are already registered.")
+ expect(err).to include("Command(s) `mahcommand` declared by copycat are already registered.")
end
end
diff --git a/spec/bundler/plugins/install_spec.rb b/spec/bundler/plugins/install_spec.rb
index 9304d78062..afc6087c1b 100644
--- a/spec/bundler/plugins/install_spec.rb
+++ b/spec/bundler/plugins/install_spec.rb
@@ -11,7 +11,7 @@ RSpec.describe "bundler plugin install" do
it "shows proper message when gem in not found in the source" do
bundle "plugin install no-foo --source file://#{gem_repo1}"
- expect(out).to include("Could not find")
+ expect(err).to include("Could not find")
plugin_should_not_be_installed("no-foo")
end
@@ -22,6 +22,18 @@ RSpec.describe "bundler plugin install" do
plugin_should_be_installed("foo")
end
+ context "plugin is already installed" do
+ before do
+ bundle "plugin install foo --source file://#{gem_repo2}"
+ end
+
+ it "doesn't install plugin again" do
+ bundle "plugin install foo --source file://#{gem_repo2}"
+ expect(out).not_to include("Installing plugin foo")
+ expect(out).not_to include("Installed plugin foo")
+ end
+ end
+
it "installs multiple plugins" do
bundle "plugin install foo kung-foo --source file://#{gem_repo2}"
@@ -86,7 +98,7 @@ RSpec.describe "bundler plugin install" do
bundle "plugin install charlie --source file://#{gem_repo2}"
- expect(out).to include("plugins.rb was not found")
+ expect(err).to include("plugins.rb was not found")
expect(global_plugin_gem("charlie-1.0")).not_to be_directory
@@ -122,6 +134,24 @@ RSpec.describe "bundler plugin install" do
expect(out).to include("Installed plugin foo")
plugin_should_be_installed("foo")
end
+
+ it "installs form a local git source" do
+ build_git "foo" do |s|
+ s.write "plugins.rb"
+ end
+
+ bundle "plugin install foo --local_git #{lib_path("foo-1.0")}"
+
+ expect(out).to include("Installed plugin foo")
+ plugin_should_be_installed("foo")
+ end
+
+ it "raises an error when both git and local git sources are specified" do
+ bundle "plugin install foo --local_git /phony/path/project --git git@gitphony.com:/repo/project"
+
+ expect(exitstatus).not_to eq(0) if exitstatus
+ expect(err).to eq("Remote and local plugin git sources can't be both specified")
+ end
end
context "Gemfile eval" do
@@ -147,7 +177,7 @@ RSpec.describe "bundler plugin install" do
build_plugin "foo", "1.1.0"
end
- install_gemfile <<-G
+ gemfile <<-G
source 'file://#{gem_repo2}'
plugin 'foo', "1.0"
G
@@ -173,6 +203,28 @@ RSpec.describe "bundler plugin install" do
expect(out).to include("Installed plugin ga-plugin")
plugin_should_be_installed("ga-plugin")
end
+
+ context "in deployment mode" do
+ it "installs plugins" do
+ install_gemfile! <<-G
+ source 'file://#{gem_repo2}'
+ gem 'rack', "1.0.0"
+ G
+
+ install_gemfile! <<-G, forgotten_command_line_options(:deployment => true)
+ source 'file://#{gem_repo2}'
+ plugin 'foo'
+ gem 'rack', "1.0.0"
+ G
+
+ expect(out).to include("Installed plugin foo")
+
+ expect(out).to include("Bundle complete!")
+
+ expect(the_bundle).to include_gems("rack 1.0.0")
+ plugin_should_be_installed("foo")
+ end
+ end
end
context "inline gemfiles" do
diff --git a/spec/bundler/plugins/list_spec.rb b/spec/bundler/plugins/list_spec.rb
new file mode 100644
index 0000000000..7dc9d10c4b
--- /dev/null
+++ b/spec/bundler/plugins/list_spec.rb
@@ -0,0 +1,60 @@
+# frozen_string_literal: true
+
+RSpec.describe "bundler plugin list" do
+ before do
+ build_repo2 do
+ build_plugin "foo" do |s|
+ s.write "plugins.rb", <<-RUBY
+ class Foo < Bundler::Plugin::API
+ command "shout"
+
+ def exec(command, args)
+ puts "Foo shout"
+ end
+ end
+ RUBY
+ end
+ build_plugin "bar" do |s|
+ s.write "plugins.rb", <<-RUBY
+ class Bar < Bundler::Plugin::API
+ command "scream"
+
+ def exec(command, args)
+ puts "Bar scream"
+ end
+ end
+ RUBY
+ end
+ end
+ end
+
+ context "no plugins installed" do
+ it "shows proper no plugins installed message" do
+ bundle "plugin list"
+
+ expect(out).to include("No plugins installed")
+ end
+ end
+
+ context "single plugin installed" do
+ it "shows plugin name with commands list" do
+ bundle "plugin install foo --source file://#{gem_repo2}"
+ plugin_should_be_installed("foo")
+ bundle "plugin list"
+
+ expected_output = "foo\n-----\n shout"
+ expect(out).to include(expected_output)
+ end
+ end
+
+ context "multiple plugins installed" do
+ it "shows plugin names with commands list" do
+ bundle "plugin install foo bar --source file://#{gem_repo2}"
+ plugin_should_be_installed("foo", "bar")
+ bundle "plugin list"
+
+ expected_output = "foo\n-----\n shout\n\nbar\n-----\n scream"
+ expect(out).to include(expected_output)
+ end
+ end
+end
diff --git a/spec/bundler/plugins/source/example_spec.rb b/spec/bundler/plugins/source/example_spec.rb
index d9a3cd2b92..bc076c06bf 100644
--- a/spec/bundler/plugins/source/example_spec.rb
+++ b/spec/bundler/plugins/source/example_spec.rb
@@ -96,16 +96,16 @@ RSpec.describe "real source plugins" do
bundle "install"
lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo2}/
- specs:
-
PLUGIN SOURCE
remote: #{lib_path("a-path-gem-1.0")}
type: mpath
specs:
a-path-gem (1.0)
+ GEM
+ remote: file://localhost#{gem_repo2}/
+ specs:
+
PLATFORMS
#{lockfile_platforms}
@@ -391,10 +391,6 @@ RSpec.describe "real source plugins" do
bundle "install"
lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo2}/
- specs:
-
PLUGIN SOURCE
remote: file://#{lib_path("ma-gitp-gem-1.0")}
type: gitp
@@ -402,6 +398,10 @@ RSpec.describe "real source plugins" do
specs:
ma-gitp-gem (1.0)
+ GEM
+ remote: file://localhost#{gem_repo2}/
+ specs:
+
PLATFORMS
#{lockfile_platforms}
diff --git a/spec/bundler/quality_es_spec.rb b/spec/bundler/quality_es_spec.rb
new file mode 100644
index 0000000000..8fc653c45a
--- /dev/null
+++ b/spec/bundler/quality_es_spec.rb
@@ -0,0 +1,70 @@
+# frozen_string_literal: true
+
+if defined?(Encoding) && Encoding.default_external.name != "UTF-8"
+ # An approximation of ruby -E UTF-8, since it works on 1.8.7
+ Encoding.default_external = Encoding.find("UTF-8")
+end
+
+RSpec.describe "La biblioteca si misma" do
+ def check_for_expendable_words(filename)
+ failing_line_message = []
+ useless_words = %w[
+ básicamente
+ claramente
+ sólo
+ solamente
+ obvio
+ obviamente
+ fácil
+ fácilmente
+ sencillamente
+ simplemente
+ ]
+ pattern = /\b#{Regexp.union(useless_words)}\b/i
+
+ File.readlines(filename).each_with_index do |line, number|
+ next unless word_found = pattern.match(line)
+ failing_line_message << "#{filename}:#{number.succ} contiene '#{word_found}'. Esta palabra tiene un significado subjetivo y es mejor obviarla en textos técnicos."
+ end
+
+ failing_line_message unless failing_line_message.empty?
+ end
+
+ def check_for_specific_pronouns(filename)
+ failing_line_message = []
+ specific_pronouns = /\b(él|ella|ellos|ellas)\b/i
+
+ File.readlines(filename).each_with_index do |line, number|
+ next unless word_found = specific_pronouns.match(line)
+ failing_line_message << "#{filename}:#{number.succ} contiene '#{word_found}'. Use pronombres más genéricos en la documentación."
+ end
+
+ failing_line_message unless failing_line_message.empty?
+ end
+
+ 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
+ end
+ expect(error_messages.compact).to be_well_formed
+ end
+
+ it "mantiene la calidad de lenguaje de oraciones usadas en el código fuente" do
+ error_messages = []
+ exempt = /vendor/
+ Dir.chdir(root) do
+ `git ls-files -z -- lib`.split("\x0").each do |filename|
+ next if filename =~ exempt
+ error_messages << check_for_expendable_words(filename)
+ error_messages << check_for_specific_pronouns(filename)
+ end
+ end
+ expect(error_messages.compact).to be_well_formed
+ end
+end
diff --git a/spec/bundler/quality_spec.rb b/spec/bundler/quality_spec.rb
index b24b42c542..f9c815aee1 100644
--- a/spec/bundler/quality_spec.rb
+++ b/spec/bundler/quality_spec.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
if defined?(Encoding) && Encoding.default_external.name != "UTF-8"
- # Poor man's ruby -E UTF-8, since it works on 1.8.7
+ # An approximation of ruby -E UTF-8, since it works on 1.8.7
Encoding.default_external = Encoding.find("UTF-8")
end
@@ -96,16 +96,8 @@ RSpec.describe "The library itself" do
failing_line_message unless failing_line_message.empty?
end
- RSpec::Matchers.define :be_well_formed do
- match(&:empty?)
-
- failure_message do |actual|
- actual.join("\n")
- end
- end
-
it "has no malformed whitespace" do
- exempt = /\.gitmodules|\.marshal|fixtures|vendor|ssl_certs|LICENSE|vcr_cassettes/
+ exempt = /\.gitmodules|\.marshal|fixtures|vendor|LICENSE|vcr_cassettes/
error_messages = []
Dir.chdir(root) do
lib_files = ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb spec/bundler` : `git ls-files -z -- lib`
@@ -175,16 +167,13 @@ RSpec.describe "The library itself" do
exemptions = %w[
auto_config_jobs
cache_command_is_package
- console_command
deployment_means_frozen
forget_cli_options
gem.coc
gem.mit
+ github.https
inline
- lockfile_upgrade_warning
- lockfile_uses_separate_rubygems_sources
use_gem_version_promoter_for_major_updates
- viz_command
]
all_settings = Hash.new {|h, k| h[k] = [] }
@@ -235,14 +224,10 @@ RSpec.describe "The library itself" do
gem_command! :build, gemspec
end
- if Bundler.rubygems.provides?(">= 2.4")
- # there's no way aroudn this warning
- last_command.stderr.sub!(/^YAML safe loading.*/, "")
+ # there's no way around this warning
+ last_command.stderr.sub!(/^YAML safe loading.*/, "")
- # older rubygems have weird warnings, and we won't actually be using them
- # to build the gem for releases anyways
- expect(last_command.stderr).to be_empty, "bundler should build as a gem without warnings, but\n#{err}"
- end
+ expect(last_command.stderr).to be_empty, "bundler should build as a gem without warnings, but\n#{err}"
ensure
# clean up the .gem generated
FileUtils.rm("bundler-#{Bundler::VERSION}.gem")
@@ -250,6 +235,18 @@ RSpec.describe "The library itself" do
end
end
+ it "ships the correct set of files" do
+ Dir.chdir(root) do
+ git_list = IO.popen("git ls-files -z", &:read).split("\x0").select {|f| f.match(%r{^(lib|exe)/}) }
+ git_list += %w[CHANGELOG.md LICENSE.md README.md bundler.gemspec]
+ git_list += Dir.glob("man/**/*")
+
+ gem_list = Gem::Specification.load(gemspec.to_s).files
+
+ expect(git_list.to_set).to eq(gem_list.to_set)
+ end
+ end
+
it "does not contain any warnings" do
Dir.chdir(root) do
exclusions = %w[
diff --git a/spec/bundler/realworld/dependency_api_spec.rb b/spec/bundler/realworld/dependency_api_spec.rb
index 13527ce5d1..e7d11419cd 100644
--- a/spec/bundler/realworld/dependency_api_spec.rb
+++ b/spec/bundler/realworld/dependency_api_spec.rb
@@ -9,7 +9,7 @@ RSpec.describe "gemcutter's dependency API", :realworld => true do
@server_uri = "http://127.0.0.1:#{port}"
require File.expand_path("../../support/artifice/endpoint_timeout", __FILE__)
- require "thread"
+
@t = Thread.new do
server = Rack::Server.start(:app => EndpointTimeout,
:Host => "0.0.0.0",
@@ -22,7 +22,7 @@ RSpec.describe "gemcutter's dependency API", :realworld => true do
@t.run
wait_for_server("127.0.0.1", port)
- bundle! "config timeout 1"
+ bundle! "config set timeout 1"
end
after do
diff --git a/spec/bundler/realworld/double_check_spec.rb b/spec/bundler/realworld/double_check_spec.rb
index 94ab49ba2a..6fee578a71 100644
--- a/spec/bundler/realworld/double_check_spec.rb
+++ b/spec/bundler/realworld/double_check_spec.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
RSpec.describe "double checking sources", :realworld => true do
- it "finds already-installed gems", :ruby => ">= 2.2" do
+ it "finds already-installed gems" do
create_file("rails.gemspec", <<-RUBY)
Gem::Specification.new do |s|
s.name = "rails"
diff --git a/spec/bundler/realworld/edgecases_spec.rb b/spec/bundler/realworld/edgecases_spec.rb
index 1db5c0f9d6..a3662c91e7 100644
--- a/spec/bundler/realworld/edgecases_spec.rb
+++ b/spec/bundler/realworld/edgecases_spec.rb
@@ -19,63 +19,25 @@ RSpec.describe "real world edgecases", :realworld => true, :sometimes => true do
RUBY
end
- # there is no rbx-relative-require gem that will install on 1.9
- it "ignores extra gems with bad platforms", :ruby => "~> 1.8.7" do
- gemfile <<-G
- source "https://rubygems.org"
- gem "linecache", "0.46"
- G
- bundle :lock
- expect(err).to lack_errors
- expect(exitstatus).to eq(0) if exitstatus
- end
-
- # https://github.com/bundler/bundler/issues/1202
- it "bundle cache works with rubygems 1.3.7 and pre gems",
- :ruby => "~> 1.8.7", :rubygems => "~> 1.3.7" do
- install_gemfile <<-G
- source "https://rubygems.org"
- gem "rack", "1.3.0.beta2"
- gem "will_paginate", "3.0.pre2"
- G
- bundle :cache
- expect(out).not_to include("Removing outdated .gem files from vendor/cache")
- end
-
- # https://github.com/bundler/bundler/issues/1486
- # this is a hash collision that only manifests on 1.8.7
- it "finds the correct child versions", :ruby => "~> 1.8.7" do
- gemfile <<-G
- source "https://rubygems.org"
-
- gem 'i18n', '~> 0.6.0'
- gem 'activesupport', '~> 3.0.5'
- gem 'activerecord', '~> 3.0.5'
- gem 'builder', '~> 2.1.2'
- G
- bundle :lock
- expect(lockfile).to include("activemodel (3.0.5)")
- end
-
- it "resolves dependencies correctly", :ruby => "<= 1.9.3" do
+ it "resolves dependencies correctly" do
gemfile <<-G
source "https://rubygems.org"
- gem 'rails', '~> 3.0'
+ gem 'rails', '~> 5.0'
gem 'capybara', '~> 2.2.0'
gem 'rack-cache', '1.2.0' # last version that works on Ruby 1.9
G
bundle! :lock
- expect(lockfile).to include(rubygems_version("rails", "~> 3.0"))
+ expect(lockfile).to include(rubygems_version("rails", "~> 5.0"))
expect(lockfile).to include("capybara (2.2.1)")
end
- it "installs the latest version of gxapi_rails", :ruby => "<= 1.9.3" do
+ it "installs the latest version of gxapi_rails" do
gemfile <<-G
source "https://rubygems.org"
gem "sass-rails"
- gem "rails", "~> 3"
+ gem "rails", "~> 5"
gem "gxapi_rails", "< 0.1.0" # 0.1.0 was released way after the test was written
gem 'rack-cache', '1.2.0' # last version that works on Ruby 1.9
G
@@ -97,7 +59,7 @@ RSpec.describe "real world edgecases", :realworld => true, :sometimes => true do
expect(lockfile).to include(rubygems_version("activesupport", "~> 3.0"))
end
- it "is able to update a top-level dependency when there is a conflict on a shared transitive child", :ruby => "2.1" do
+ 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
gemfile <<-G
@@ -239,9 +201,10 @@ RSpec.describe "real world edgecases", :realworld => true, :sometimes => true do
gem 'rack', '1.0.1'
G
- bundle! :install, forgotten_command_line_options(:path => "vendor/bundle")
+ bundle "config set --local path vendor/bundle"
+ bundle! :install
expect(err).not_to include("Could not find rake")
- expect(err).to lack_errors
+ expect(last_command.stderr).to be_empty
end
it "checks out git repos when the lockfile is corrupted" do
@@ -368,7 +331,7 @@ RSpec.describe "real world edgecases", :realworld => true, :sometimes => true do
L
bundle! :lock
- expect(last_command.stderr).to lack_errors
+ expect(last_command.stderr).to be_empty
end
it "outputs a helpful error message when gems have invalid gemspecs" do
@@ -376,7 +339,7 @@ RSpec.describe "real world edgecases", :realworld => true, :sometimes => true do
source 'https://rubygems.org'
gem "resque-scheduler", "2.2.0"
G
- expect(out).to include("You have one or more invalid gemspecs that need to be fixed.")
- expect(out).to include("resque-scheduler 2.2.0 has an invalid gemspec")
+ expect(err).to include("You have one or more invalid gemspecs that need to be fixed.")
+ expect(err).to include("resque-scheduler 2.2.0 has an invalid gemspec")
end
end
diff --git a/spec/bundler/realworld/gemfile_source_header_spec.rb b/spec/bundler/realworld/gemfile_source_header_spec.rb
index 59c1916874..eaefd0f03e 100644
--- a/spec/bundler/realworld/gemfile_source_header_spec.rb
+++ b/spec/bundler/realworld/gemfile_source_header_spec.rb
@@ -1,14 +1,12 @@
# frozen_string_literal: true
-require "thread"
-
-RSpec.describe "fetching dependencies with a mirrored source", :realworld => true, :rubygems => ">= 2.0" do
+RSpec.describe "fetching dependencies with a mirrored source", :realworld => true do
let(:mirror) { "https://server.example.org" }
let(:original) { "http://127.0.0.1:#{@port}" }
before do
setup_server
- bundle "config --local mirror.#{mirror} #{original}"
+ bundle "config set --local mirror.#{mirror} #{original}"
end
after do
diff --git a/spec/bundler/realworld/mirror_probe_spec.rb b/spec/bundler/realworld/mirror_probe_spec.rb
index ab74886329..c5e95f3059 100644
--- a/spec/bundler/realworld/mirror_probe_spec.rb
+++ b/spec/bundler/realworld/mirror_probe_spec.rb
@@ -1,7 +1,5 @@
# frozen_string_literal: true
-require "thread"
-
RSpec.describe "fetching dependencies with a not available mirror", :realworld => true do
let(:mirror) { @mirror_uri }
let(:original) { @server_uri }
@@ -74,10 +72,10 @@ RSpec.describe "fetching dependencies with a not available mirror", :realworld =
bundle :install, :artifice => nil
expect(out).to include("Fetching source index from #{mirror}")
- expect(out).to include("Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from #{mirror}")
- expect(out).to include("Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from #{mirror}")
- expect(out).to include("Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from #{mirror}")
- expect(out).to include("Could not fetch specs from #{mirror}")
+ expect(err).to include("Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from #{mirror}")
+ expect(err).to include("Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from #{mirror}")
+ expect(err).to include("Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from #{mirror}")
+ expect(err).to include("Could not fetch specs from #{mirror}")
end
it "prints each error and warning on a new line" do
@@ -112,10 +110,10 @@ Could not fetch specs from #{mirror}/
bundle :install, :artifice => nil
expect(out).to include("Fetching source index from #{mirror}")
- expect(out).to include("Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from #{mirror}")
- expect(out).to include("Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from #{mirror}")
- expect(out).to include("Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from #{mirror}")
- expect(out).to include("Could not fetch specs from #{mirror}")
+ expect(err).to include("Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from #{mirror}")
+ expect(err).to include("Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from #{mirror}")
+ expect(err).to include("Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from #{mirror}")
+ expect(err).to include("Could not fetch specs from #{mirror}")
end
end
diff --git a/spec/bundler/realworld/parallel_spec.rb b/spec/bundler/realworld/parallel_spec.rb
index ed4430c68b..7738b46aac 100644
--- a/spec/bundler/realworld/parallel_spec.rb
+++ b/spec/bundler/realworld/parallel_spec.rb
@@ -11,11 +11,7 @@ RSpec.describe "parallel", :realworld => true, :sometimes => true do
bundle :install, :jobs => 4, :env => { "DEBUG" => "1" }
- if Bundler.rubygems.provides?(">= 2.1.0")
- expect(out).to match(/[1-3]: /)
- else
- expect(out).to include("is not threadsafe")
- end
+ expect(out).to match(/[1-3]: /)
bundle "info activesupport --path"
expect(out).to match(/activesupport/)
@@ -38,13 +34,9 @@ RSpec.describe "parallel", :realworld => true, :sometimes => true do
gem 'i18n', '~> 0.6.0' # Because 0.7+ requires Ruby 1.9.3+
G
- bundle :update, :jobs => 4, :env => { "DEBUG" => "1" }, :all => bundle_update_requires_all?
+ bundle :update, :jobs => 4, :env => { "DEBUG" => "1" }, :all => true
- if Bundler.rubygems.provides?(">= 2.1.0")
- expect(out).to match(/[1-3]: /)
- else
- expect(out).to include("is not threadsafe")
- end
+ expect(out).to match(/[1-3]: /)
bundle "info activesupport --path"
expect(out).to match(/activesupport-3\.2\.\d+/)
diff --git a/spec/bundler/resolver/basic_spec.rb b/spec/bundler/resolver/basic_spec.rb
index c023f5d7aa..57897f89b4 100644
--- a/spec/bundler/resolver/basic_spec.rb
+++ b/spec/bundler/resolver/basic_spec.rb
@@ -35,7 +35,7 @@ RSpec.describe "Resolving" do
should_resolve_as %w[berkshelf-2.0.7 chef-10.26 chef_app-1.0.0 json-1.7.7]
end
- it "prefers expicitly requested dependencies when resolving an index which would otherwise be ambiguous" do
+ it "prefers explicitly requested dependencies when resolving an index which would otherwise be ambiguous" do
@index = an_ambiguous_index
dep "a"
dep "b"
@@ -169,10 +169,10 @@ Bundler could not find compatible versions for gem "a":
s.required_ruby_version = "~> 2.0.0"
end
- gem "ruby\0", "1.8.7"
+ gem "Ruby\0", "1.8.7"
end
dep "foo"
- dep "ruby\0", "1.8.7"
+ dep "Ruby\0", "1.8.7"
deps = []
@deps.each do |d|
@@ -226,7 +226,7 @@ Bundler could not find compatible versions for gem "a":
# dependencies and since the dependency of the selected foo gem changes, the latest matching
# dependency of "bar", "~> 2.1" -- bar-2.1.1 -- is selected. This is not a bug and follows
# the long-standing documented Conservative Updating behavior of bundle install.
- # http://bundler.io/v1.12/man/bundle-install.1.html#CONSERVATIVE-UPDATING
+ # https://bundler.io/v1.12/man/bundle-install.1.html#CONSERVATIVE-UPDATING
should_conservative_resolve_and_include :patch, ["foo"], %w[foo-1.4.5 bar-2.1.1]
end
diff --git a/spec/bundler/runtime/executable_spec.rb b/spec/bundler/runtime/executable_spec.rb
index 7ba510a509..b2d5b6c03f 100644
--- a/spec/bundler/runtime/executable_spec.rb
+++ b/spec/bundler/runtime/executable_spec.rb
@@ -129,23 +129,6 @@ RSpec.describe "Running bin/* commands" do
expect(bundled_app("bin/rackup")).to exist
end
- it "rewrites bins on --binstubs (to maintain backwards compatibility)", :bundler => "< 2" do
- gemfile <<-G
- source "file://#{gem_repo1}"
- gem "rack"
- G
-
- bundle! :install, forgotten_command_line_options([:binstubs, :bin] => "bin")
-
- File.open(bundled_app("bin/rackup"), "wb") do |file|
- file.print "OMG"
- end
-
- bundle "install"
-
- expect(bundled_app("bin/rackup").read).to_not eq("OMG")
- end
-
it "rewrites bins on binstubs (to maintain backwards compatibility)" do
install_gemfile! <<-G
source "file://#{gem_repo1}"
diff --git a/spec/bundler/runtime/gem_tasks_spec.rb b/spec/bundler/runtime/gem_tasks_spec.rb
index de72869dc3..3c69f8a800 100644
--- a/spec/bundler/runtime/gem_tasks_spec.rb
+++ b/spec/bundler/runtime/gem_tasks_spec.rb
@@ -22,7 +22,7 @@ RSpec.describe "require 'bundler/gem_tasks'", :ruby_repo do
sys_exec "#{rake} -T"
end
- expect(err).to eq("")
+ expect(last_command.stderr).to eq("")
expected_tasks = [
"rake build",
"rake clean",
diff --git a/spec/bundler/runtime/inline_spec.rb b/spec/bundler/runtime/inline_spec.rb
index 18ca246199..96a3fa09ae 100644
--- a/spec/bundler/runtime/inline_spec.rb
+++ b/spec/bundler/runtime/inline_spec.rb
@@ -67,7 +67,7 @@ RSpec.describe "bundler/inline#gemfile" do
puts "success"
RUBY
- expect(err).to include "Could not find gem 'eleven'"
+ expect(last_command.stderr).to include "Could not find gem 'eleven'"
expect(out).not_to include "success"
script <<-RUBY
@@ -90,7 +90,7 @@ RSpec.describe "bundler/inline#gemfile" do
expect(out).to include("Installing activesupport")
err.gsub! %r{.*lib/sinatra/base\.rb:\d+: warning: constant ::Fixnum is deprecated$}, ""
err.strip!
- expect(err).to lack_errors
+ expect(last_command.stderr).to be_empty
expect(exitstatus).to be_zero if exitstatus
end
@@ -112,6 +112,19 @@ RSpec.describe "bundler/inline#gemfile" do
expect(exitstatus).to be_zero if exitstatus
end
+ it "has an option for quiet installation" do
+ script <<-RUBY, :artifice => "endpoint"
+ require 'bundler'
+
+ gemfile(true, :quiet => true) do
+ source "https://notaserver.com"
+ gem "activesupport", :require => true
+ end
+ RUBY
+
+ expect(out).to be_empty
+ end
+
it "raises an exception if passed unknown arguments" do
script <<-RUBY
gemfile(true, :arglebargle => true) do
@@ -121,7 +134,7 @@ RSpec.describe "bundler/inline#gemfile" do
puts "success"
RUBY
- expect(err).to include "Unknown options: arglebargle"
+ expect(last_command.stderr).to include "Unknown options: arglebargle"
expect(out).not_to include "success"
end
@@ -152,7 +165,7 @@ RSpec.describe "bundler/inline#gemfile" do
RUBY
expect(out).to eq("1.0.0")
- expect(err).to be_empty
+ expect(last_command.stderr).to be_empty
expect(exitstatus).to be_zero if exitstatus
end
@@ -170,7 +183,7 @@ RSpec.describe "bundler/inline#gemfile" do
RUBY
expect(out).to eq("1.0.0\n2.0.0")
- expect(err).to be_empty
+ expect(last_command.stderr).to be_empty
expect(exitstatus).to be_zero if exitstatus
end
@@ -190,7 +203,7 @@ RSpec.describe "bundler/inline#gemfile" do
RUBY
expect(out).to eq("two\nfour")
- expect(err).to be_empty
+ expect(last_command.stderr).to be_empty
expect(exitstatus).to be_zero if exitstatus
end
@@ -227,7 +240,7 @@ RSpec.describe "bundler/inline#gemfile" do
RUBY
end
- expect(err).to be_empty
+ expect(last_command.stderr).to be_empty
expect(exitstatus).to be_zero if exitstatus
end
@@ -245,7 +258,7 @@ RSpec.describe "bundler/inline#gemfile" do
RUBY
end
- expect(err).to be_empty
+ expect(last_command.stderr).to be_empty
expect(exitstatus).to be_zero if exitstatus
end
diff --git a/spec/bundler/runtime/platform_spec.rb b/spec/bundler/runtime/platform_spec.rb
index eecf162427..11fe16f499 100644
--- a/spec/bundler/runtime/platform_spec.rb
+++ b/spec/bundler/runtime/platform_spec.rb
@@ -93,7 +93,7 @@ RSpec.describe "Bundler.setup with multi platform stuff" do
gem "platform_specific"
G
- bundle! "config force_ruby_platform true"
+ bundle! "config set force_ruby_platform true"
bundle! "install"
@@ -108,7 +108,7 @@ RSpec.describe "Bundler.setup with multi platform stuff" do
gem "platform_specific"
G
- bundle! "config force_ruby_platform true"
+ bundle! "config set force_ruby_platform true"
bundle! "install"
diff --git a/spec/bundler/runtime/require_spec.rb b/spec/bundler/runtime/require_spec.rb
index 0484e38845..c9cfa199d3 100644
--- a/spec/bundler/runtime/require_spec.rb
+++ b/spec/bundler/runtime/require_spec.rb
@@ -121,7 +121,7 @@ RSpec.describe "Bundler.require" do
Bundler.require
R
- expect(err).to eq_err("ZOMG LOAD ERROR")
+ expect(err_without_deprecations).to eq("ZOMG LOAD ERROR")
end
it "displays a helpful message if the required gem throws an error" do
@@ -136,8 +136,8 @@ RSpec.describe "Bundler.require" do
G
run "Bundler.require"
- expect(err).to match("error while trying to load the gem 'faulty'")
- expect(err).to match("Gem Internal Error Message")
+ expect(last_command.stderr).to match("error while trying to load the gem 'faulty'")
+ expect(last_command.stderr).to match("Gem Internal Error Message")
end
it "doesn't swallow the error when the library has an unrelated error" do
@@ -160,7 +160,7 @@ RSpec.describe "Bundler.require" do
RUBY
run(cmd)
- expect(err).to eq_err("ZOMG LOAD ERROR: cannot load such file -- load-bar")
+ expect(err_without_deprecations).to eq("ZOMG LOAD ERROR: cannot load such file -- load-bar")
end
describe "with namespaced gems" do
@@ -198,7 +198,7 @@ RSpec.describe "Bundler.require" do
RUBY
ruby(cmd)
- expect(err).to lack_errors
+ expect(last_command.stderr).to be_empty
end
it "does not mangle explicitly given requires" do
@@ -211,7 +211,7 @@ RSpec.describe "Bundler.require" do
load_error_run <<-R, "jquery-rails"
Bundler.require
R
- expect(err).to eq_err("ZOMG LOAD ERROR")
+ expect(err_without_deprecations).to eq("ZOMG LOAD ERROR")
end
it "handles the case where regex fails" do
@@ -234,7 +234,7 @@ RSpec.describe "Bundler.require" do
RUBY
run(cmd)
- expect(err).to eq_err("ZOMG LOAD ERROR")
+ expect(err_without_deprecations).to eq("ZOMG LOAD ERROR")
end
it "doesn't swallow the error when the library has an unrelated error" do
@@ -258,19 +258,19 @@ RSpec.describe "Bundler.require" do
RUBY
run(cmd)
- expect(err).to eq_err("ZOMG LOAD ERROR: cannot load such file -- load-bar")
+ expect(err_without_deprecations).to eq("ZOMG LOAD ERROR: cannot load such file -- load-bar")
end
end
describe "using bundle exec" do
it "requires the locked gems" do
- bundle "exec ruby -e 'Bundler.require'", :env => { :RUBYOPT => "-r#{spec_dir.join("support/hax")}" }
+ bundle "exec ruby -e 'Bundler.require'"
expect(out).to eq("two")
- bundle "exec ruby -e 'Bundler.require(:bar)'", :env => { :RUBYOPT => "-r#{spec_dir.join("support/hax")}" }
+ bundle "exec ruby -e 'Bundler.require(:bar)'"
expect(out).to eq("baz\nqux")
- bundle "exec ruby -e 'Bundler.require(:default, :bar)'", :env => { :RUBYOPT => "-r#{spec_dir.join("support/hax")}" }
+ bundle "exec ruby -e 'Bundler.require(:default, :bar)'"
expect(out).to eq("baz\nqux\ntwo")
end
end
@@ -366,12 +366,12 @@ RSpec.describe "Bundler.require" do
load_error_run <<-R, "no_such_file_omg"
Bundler.require
R
- expect(err).to eq_err("ZOMG LOAD ERROR")
+ expect(err_without_deprecations).to eq("ZOMG LOAD ERROR")
end
end
end
- it "does not load rubygems gemspecs that are used", :rubygems => ">= 2.5.2" do
+ it "does not load rubygems gemspecs that are used" do
install_gemfile! <<-G
source "file://#{gem_repo1}"
gem "rack"
@@ -394,7 +394,7 @@ RSpec.describe "Bundler.require" do
expect(out).to eq("WIN")
end
- it "does not load git gemspecs that are used", :rubygems => ">= 2.5.2" do
+ it "does not load git gemspecs that are used" do
build_git "foo"
install_gemfile! <<-G
@@ -432,7 +432,7 @@ RSpec.describe "Bundler.require with platform specific dependencies" do
G
run "Bundler.require"
- expect(err).to lack_errors
+ expect(last_command.stderr).to be_empty
end
it "requires gems pinned to multiple platforms, including the current one" do
@@ -447,6 +447,6 @@ RSpec.describe "Bundler.require with platform specific dependencies" do
run "Bundler.require; puts RACK"
expect(out).to eq("1.0.0")
- expect(err).to lack_errors
+ expect(last_command.stderr).to be_empty
end
end
diff --git a/spec/bundler/runtime/setup_spec.rb b/spec/bundler/runtime/setup_spec.rb
index f2f750a9ca..c81baa34ea 100644
--- a/spec/bundler/runtime/setup_spec.rb
+++ b/spec/bundler/runtime/setup_spec.rb
@@ -1,5 +1,8 @@
# frozen_string_literal: true
+require "tmpdir"
+require "tempfile"
+
RSpec.describe "Bundler.setup" do
describe "with no arguments" do
it "makes all groups available" do
@@ -16,7 +19,7 @@ RSpec.describe "Bundler.setup" do
require 'rack'
puts RACK
RUBY
- expect(err).to lack_errors
+ expect(last_command.stderr).to be_empty
expect(out).to eq("1.0.0")
end
end
@@ -42,7 +45,7 @@ RSpec.describe "Bundler.setup" do
puts "WIN"
end
RUBY
- expect(err).to lack_errors
+ expect(last_command.stderr).to be_empty
expect(out).to eq("WIN")
end
@@ -55,7 +58,7 @@ RSpec.describe "Bundler.setup" do
require 'rack'
puts RACK
RUBY
- expect(err).to lack_errors
+ expect(last_command.stderr).to be_empty
expect(out).to eq("1.0.0")
end
@@ -69,7 +72,7 @@ RSpec.describe "Bundler.setup" do
require 'rack'
puts RACK
RUBY
- expect(err).to lack_errors
+ expect(last_command.stderr).to be_empty
expect(out).to eq("1.0.0")
end
@@ -87,7 +90,7 @@ RSpec.describe "Bundler.setup" do
puts "FAIL"
end
RUBY
- expect(err).to lack_errors
+ expect(last_command.stderr).to be_empty
expect(out).to match("WIN")
end
@@ -101,8 +104,8 @@ RSpec.describe "Bundler.setup" do
puts "FAIL"
RUBY
- expect(err).to match("rack")
- expect(err).to match("LoadError")
+ expect(last_command.stderr).to match("rack")
+ expect(last_command.stderr).to match("LoadError")
expect(out).not_to match("FAIL")
end
end
@@ -125,7 +128,7 @@ RSpec.describe "Bundler.setup" do
gem "rack"
G
- ENV["RUBYOPT"] = "-Idash_i_dir"
+ ENV["RUBYOPT"] = "#{ENV["RUBYOPT"]} -Idash_i_dir"
ENV["RUBYLIB"] = "rubylib_dir"
ruby <<-RUBY
@@ -138,9 +141,8 @@ RSpec.describe "Bundler.setup" do
load_path = out.split("\n")
rack_load_order = load_path.index {|path| path.include?("rack") }
- expect(err).to eq("")
- expect(load_path[1]).to include "dash_i_dir"
- expect(load_path[2]).to include "rubylib_dir"
+ expect(last_command.stderr).to eq("")
+ expect(load_path).to include(a_string_ending_with("dash_i_dir"), "rubylib_dir")
expect(rack_load_order).to be > 0
end
@@ -159,10 +161,6 @@ RSpec.describe "Bundler.setup" do
load_path = clean_load_path(out.split("\n"))
- unless Bundler.load.specs["bundler"].empty?
- load_path.delete_if {|path| path =~ /bundler/ }
- end
-
expect(load_path).to start_with(
"/gems/rails-2.3.2/lib",
"/gems/activeresource-2.3.2/lib",
@@ -170,7 +168,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-10.0.2/lib"
+ "/gems/rake-12.3.2/lib"
)
end
@@ -366,7 +364,7 @@ RSpec.describe "Bundler.setup" do
end
R
- expect(err).to lack_errors
+ expect(last_command.stderr).to be_empty
end
it "replaces #gem but raises when the version is wrong" do
@@ -392,7 +390,7 @@ RSpec.describe "Bundler.setup" do
end
R
- expect(err).to lack_errors
+ expect(last_command.stderr).to be_empty
end
end
@@ -451,7 +449,7 @@ RSpec.describe "Bundler.setup" do
it "provides a useful exception when the git repo is not checked out yet" do
run "1"
- expect(err).to match(/the git source #{lib_path('rack-1.0.0')} is not yet checked out. Please run `bundle install`/i)
+ expect(last_command.stderr).to match(/the git source #{lib_path('rack-1.0.0')} is not yet checked out. Please run `bundle install`/i)
end
it "does not hit the git binary if the lockfile is available and up to date" do
@@ -532,12 +530,12 @@ RSpec.describe "Bundler.setup" do
gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
G
- bundle %(config local.rack #{lib_path("local-rack")})
+ bundle %(config set local.rack #{lib_path("local-rack")})
bundle! :install
FileUtils.rm_rf(lib_path("local-rack"))
run "require 'rack'"
- expect(err).to match(/Cannot use local override for rack-0.8 because #{Regexp.escape(lib_path('local-rack').to_s)} does not exist/)
+ expect(last_command.stderr).to match(/Cannot use local override for rack-0.8 because #{Regexp.escape(lib_path('local-rack').to_s)} does not exist/)
end
it "explodes if branch is not given on runtime" do
@@ -550,7 +548,7 @@ RSpec.describe "Bundler.setup" do
gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
G
- bundle %(config local.rack #{lib_path("local-rack")})
+ bundle %(config set local.rack #{lib_path("local-rack")})
bundle! :install
gemfile <<-G
@@ -559,7 +557,7 @@ RSpec.describe "Bundler.setup" do
G
run "require 'rack'"
- expect(err).to match(/because :branch is not specified in Gemfile/)
+ expect(last_command.stderr).to match(/because :branch is not specified in Gemfile/)
end
it "explodes on different branches on runtime" do
@@ -572,7 +570,7 @@ RSpec.describe "Bundler.setup" do
gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
G
- bundle %(config local.rack #{lib_path("local-rack")})
+ bundle %(config set local.rack #{lib_path("local-rack")})
bundle! :install
gemfile <<-G
@@ -581,7 +579,7 @@ RSpec.describe "Bundler.setup" do
G
run "require 'rack'"
- expect(err).to match(/is using branch master but Gemfile specifies changed/)
+ expect(last_command.stderr).to match(/is using branch master but Gemfile specifies changed/)
end
it "explodes on refs with different branches on runtime" do
@@ -599,9 +597,9 @@ RSpec.describe "Bundler.setup" do
gem "rack", :git => "#{lib_path("rack-0.8")}", :ref => "master", :branch => "nonexistant"
G
- bundle %(config local.rack #{lib_path("local-rack")})
+ bundle %(config set local.rack #{lib_path("local-rack")})
run "require 'rack'"
- expect(err).to match(/is using branch master but Gemfile specifies nonexistant/)
+ expect(last_command.stderr).to match(/is using branch master but Gemfile specifies nonexistant/)
end
end
@@ -655,62 +653,6 @@ RSpec.describe "Bundler.setup" do
end
end
- # Unfortunately, gem_prelude does not record the information about
- # activated gems, so this test cannot work on 1.9 :(
- if RUBY_VERSION < "1.9"
- describe "preactivated gems" do
- it "raises an exception if a pre activated gem conflicts with the bundle" do
- system_gems "thin-1.0", "rack-1.0.0"
- build_gem "thin", "1.1", :to_system => true do |s|
- s.add_dependency "rack"
- end
-
- gemfile <<-G
- gem "thin", "1.0"
- G
-
- ruby <<-R
- require 'rubygems'
- gem "thin"
- require 'bundler'
- begin
- Bundler.setup
- puts "FAIL"
- rescue Gem::LoadError => e
- puts e.message
- end
- R
-
- expect(out).to eq("You have already activated thin 1.1, but your Gemfile requires thin 1.0. Prepending `bundle exec` to your command may solve this.")
- end
-
- it "version_requirement is now deprecated in rubygems 1.4.0+" do
- system_gems "thin-1.0", "rack-1.0.0"
- build_gem "thin", "1.1", :to_system => true do |s|
- s.add_dependency "rack"
- end
-
- gemfile <<-G
- gem "thin", "1.0"
- G
-
- ruby <<-R
- require 'rubygems'
- gem "thin"
- require 'bundler'
- begin
- Bundler.setup
- puts "FAIL"
- rescue Gem::LoadError => e
- puts e.message
- end
- R
-
- expect(err).to lack_errors
- end
- end
- end
-
# RubyGems returns loaded_from as a string
it "has loaded_from as a string on all specs" do
build_git "foo"
@@ -732,7 +674,7 @@ RSpec.describe "Bundler.setup" do
expect(out).to be_empty
end
- it "does not load all gemspecs", :rubygems => ">= 2.3" do
+ it "does not load all gemspecs" do
install_gemfile! <<-G
source "file://#{gem_repo1}"
gem "rack"
@@ -767,9 +709,9 @@ end
G
ENV["GEM_HOME"] = ""
- bundle %(exec ruby -e "require 'set'"), :env => { :RUBYOPT => "-r#{spec_dir.join("support/hax")}" }
+ bundle %(exec ruby -e "require 'set'")
- expect(err).to lack_errors
+ expect(last_command.stderr).to be_empty
end
describe "$MANPATH" do
@@ -831,7 +773,7 @@ end
it "should clean $LOAD_PATH properly", :ruby_repo do
gem_name = "very_simple_binary"
full_gem_name = gem_name + "-1.0"
- ext_dir = File.join(tmp "extenstions", full_gem_name)
+ ext_dir = File.join(tmp("extensions", full_gem_name))
install_gem full_gem_name
@@ -863,48 +805,41 @@ end
context "with bundler is located in symlinked GEM_HOME" do
let(:gem_home) { Dir.mktmpdir }
- let(:symlinked_gem_home) { Tempfile.new("gem_home") }
+ let(:symlinked_gem_home) { Tempfile.new("gem_home").path }
let(:bundler_dir) { ruby_core? ? File.expand_path("../../../..", __FILE__) : File.expand_path("../../..", __FILE__) }
- let(:bundler_lib) { File.join(bundler_dir, "lib") }
+ let(:full_name) { "bundler-#{Bundler::VERSION}" }
before do
- FileUtils.ln_sf(gem_home, symlinked_gem_home.path)
+ FileUtils.ln_sf(gem_home, symlinked_gem_home)
gems_dir = File.join(gem_home, "gems")
specifications_dir = File.join(gem_home, "specifications")
Dir.mkdir(gems_dir)
Dir.mkdir(specifications_dir)
- FileUtils.ln_s(bundler_dir, File.join(gems_dir, "bundler-#{Bundler::VERSION}"))
+ FileUtils.ln_s(bundler_dir, File.join(gems_dir, full_name))
gemspec_file = ruby_core? ? "#{bundler_dir}/lib/bundler/bundler.gemspec" : "#{bundler_dir}/bundler.gemspec"
- gemspec = File.read(gemspec_file).
+ gemspec = File.binread(gemspec_file).
sub("Bundler::VERSION", %("#{Bundler::VERSION}"))
gemspec = gemspec.lines.reject {|line| line =~ %r{lib/bundler/version} }.join
- File.open(File.join(specifications_dir, "bundler.gemspec"), "wb") do |f|
+ File.open(File.join(specifications_dir, "#{full_name}.gemspec"), "wb") do |f|
f.write(gemspec)
end
end
- # Can't make this pass on 2.6 since the ruby standard library has the same $LOAD_PATH
- # entry as bundler (since it's a default gem)
- it "should successfully require 'bundler/setup'", :ruby_repo, :ruby => "< 2.6" do
+ it "should not remove itself from the LOAD_PATH and require a different copy of 'bundler/setup'", :ruby_repo do
install_gemfile ""
- ENV["GEM_PATH"] = symlinked_gem_home.path
-
- ruby <<-R
- if $LOAD_PATH.include?("#{bundler_lib}")
- # We should use bundler from GEM_PATH for this test, so we should
- # remove path to the bundler source tree
- $LOAD_PATH.delete("#{bundler_lib}")
- else
- raise "We don't have #{bundler_lib} in $LOAD_PATH"
+ ruby <<-R, :env => { "GEM_PATH" => symlinked_gem_home }, :no_lib => true
+ TracePoint.trace(:class) do |tp|
+ puts "OMG" if tp.path.include?("bundler") && !tp.path.start_with?("#{File.expand_path("../..", __dir__)}")
end
- puts (require 'bundler/setup')
+ gem 'bundler', '#{Bundler::VERSION}'
+ require 'bundler/setup'
R
- expect(out).to eql("true")
+ expect(out).to be_empty
end
end
@@ -943,7 +878,7 @@ end
require 'foo'
R
end
- expect(err).to lack_errors
+ expect(last_command.stderr).to be_empty
end
it "should make sure the Bundler.root is really included in the path relative to the Gemfile" do
@@ -968,7 +903,7 @@ end
R
end
- expect(err).to lack_errors
+ expect(last_command.stderr).to be_empty
end
end
@@ -1046,7 +981,7 @@ end
describe "with system gems in the bundle" do
before :each do
- bundle! "config path.system true"
+ bundle! "config set path.system true"
system_gems "rack-1.0.0"
install_gemfile <<-G
@@ -1099,9 +1034,9 @@ end
end.ref_for("HEAD")
bundle :install
- expect(out.lines.map(&:chomp)).to include(
+ expect(err.lines.map(&:chomp)).to include(
a_string_starting_with("[!] There was an error while loading `bar.gemspec`:"),
- RUBY_VERSION >= "1.9" ? a_string_starting_with("Does it try to require a relative path? That's been removed in Ruby 1.9.") : "",
+ a_string_starting_with("Does it try to require a relative path? That's been removed in Ruby 1.9."),
" # from #{default_bundle_path "bundler", "gems", "bar-1.0-#{ref[0, 12]}", "bar.gemspec"}:1",
" > require 'foobarbaz'"
)
@@ -1118,7 +1053,7 @@ end
Bundler.load
RUBY
- expect(err).to lack_errors
+ expect(last_command.stderr).to be_empty
expect(out).to eq("")
end
end
@@ -1129,8 +1064,8 @@ end
gem "bundler", :path => "#{File.expand_path("..", lib)}"
G
- bundle %(exec ruby -e "require 'bundler'; Bundler.setup"), :env => { :RUBYOPT => "-r#{spec_dir.join("support/hax")}" }
- expect(err).to lack_errors
+ bundle %(exec ruby -e "require 'bundler'; Bundler.setup")
+ expect(last_command.stderr).to be_empty
end
end
@@ -1253,7 +1188,7 @@ end
end
describe "with gemified standard libraries" do
- it "does not load Psych", :ruby => "~> 2.2" do
+ it "does not load Psych" do
gemfile ""
ruby <<-RUBY
require 'bundler/setup'
@@ -1279,7 +1214,7 @@ end
describe "default gem activation" do
let(:exemptions) do
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new("2.7") || ENV["RGV"] == "master"
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new("2.7")
[]
else
%w[io-console openssl]
@@ -1310,7 +1245,6 @@ end
end
let(:code) { strip_whitespace(<<-RUBY) }
- require "bundler/setup"
require "pp"
loaded_specs = Gem.loaded_specs.dup
#{exemptions.inspect}.each {|s| loaded_specs.delete(s) }
@@ -1325,22 +1259,18 @@ end
it "activates no gems with -rbundler/setup" do
install_gemfile! ""
- ruby! code, :env => { :RUBYOPT => activation_warning_hack_rubyopt }
+ ruby! code, :env => { :RUBYOPT => activation_warning_hack_rubyopt + " -rbundler/setup" }
expect(last_command.stdout).to eq("{}")
end
it "activates no gems with bundle exec" do
install_gemfile! ""
- # ensure we clean out the default gems, bceause bundler's allowed to be activated
create_file("script.rb", code)
- bundle! "exec ruby ./script.rb", :env => { :RUBYOPT => activation_warning_hack_rubyopt + " -rbundler/setup" }
+ bundle! "exec ruby ./script.rb", :env => { :RUBYOPT => activation_warning_hack_rubyopt }
expect(last_command.stdout).to eq("{}")
end
it "activates no gems with bundle exec that is loaded" do
- # TODO: remove once https://github.com/erikhuda/thor/pull/539 is released
- exemptions << "io-console"
-
install_gemfile! ""
create_file("script.rb", "#!/usr/bin/env ruby\n\n#{code}")
FileUtils.chmod(0o777, bundled_app("script.rb"))
diff --git a/spec/bundler/runtime/with_clean_env_spec.rb b/spec/bundler/runtime/with_clean_env_spec.rb
deleted file mode 100644
index da8e37b45d..0000000000
--- a/spec/bundler/runtime/with_clean_env_spec.rb
+++ /dev/null
@@ -1,151 +0,0 @@
-# frozen_string_literal: true
-
-RSpec.describe "Bundler.with_env helpers" do
- def bundle_exec_ruby!(code, *args)
- opts = args.last.is_a?(Hash) ? args.pop : {}
- env = opts[:env] ||= {}
- env[:RUBYOPT] ||= "-r#{spec_dir.join("support/hax")}"
- args.push opts
- bundle! "exec '#{Gem.ruby}' -e #{code}", *args
- end
-
- describe "Bundler.original_env" do
- before do
- bundle "config path vendor/bundle"
- gemfile ""
- bundle "install"
- end
-
- it "should return the PATH present before bundle was activated" do
- code = "print Bundler.original_env['PATH']"
- path = `getconf PATH`.strip + "#{File::PATH_SEPARATOR}/foo"
- with_path_as(path) do
- bundle_exec_ruby!(code.dump)
- 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"
- with_gem_path_as(gem_path) do
- bundle_exec_ruby!(code.dump)
- expect(last_command.stdboth).to eq(gem_path)
- end
- end
-
- it "works with nested bundle exec invocations", :ruby_repo do
- create_file("exe.rb", <<-'RB')
- count = ARGV.first.to_i
- exit if count < 0
- STDERR.puts "#{count} #{ENV["PATH"].end_with?(":/foo")}"
- if count == 2
- ENV["PATH"] = "#{ENV["PATH"]}:/foo"
- end
- exec(Gem.ruby, __FILE__, (count - 1).to_s)
- RB
- path = `getconf PATH`.strip + File::PATH_SEPARATOR + File.dirname(Gem.ruby)
- with_path_as(path) do
- bundle! "exec '#{Gem.ruby}' #{bundled_app("exe.rb")} 2", :env => { :RUBYOPT => "-r#{spec_dir.join("support/hax")}" }
- end
- expect(err).to eq <<-EOS.strip
-2 false
-1 true
-0 true
- EOS
- end
-
- it "removes variables that bundler added", :ruby_repo do
- original = ruby!('puts ENV.to_a.map {|e| e.join("=") }.sort.join("\n")', :env => { :RUBYOPT => "-r#{spec_dir.join("support/hax")}" })
- code = 'puts Bundler.original_env.to_a.map {|e| e.join("=") }.sort.join("\n")'
- bundle! "exec '#{Gem.ruby}' -e #{code.dump}", :env => { :RUBYOPT => "-r#{spec_dir.join("support/hax")}" }
- expect(out).to eq original
- end
- end
-
- describe "Bundler.clean_env", :bundler => "< 3" do
- before do
- bundle "config path vendor/bundle"
- gemfile ""
- bundle "install"
- end
-
- it "should delete BUNDLE_PATH" do
- code = "print Bundler.clean_env.has_key?('BUNDLE_PATH')"
- ENV["BUNDLE_PATH"] = "./foo"
- bundle_exec_ruby! code.dump
- expect(last_command.stdboth).to eq "false"
- end
-
- it "should remove '-rbundler/setup' from RUBYOPT" do
- code = "print Bundler.clean_env['RUBYOPT']"
- ENV["RUBYOPT"] = "-W2 -rbundler/setup"
- bundle_exec_ruby! code.dump
- expect(last_command.stdboth).not_to include("-rbundler/setup")
- end
-
- it "should clean up RUBYLIB", :ruby_repo do
- code = "print Bundler.clean_env['RUBYLIB']"
- ENV["RUBYLIB"] = root.join("lib").to_s + File::PATH_SEPARATOR + "/foo"
- bundle_exec_ruby! code.dump
- expect(last_command.stdboth).to eq("/foo")
- end
-
- it "should restore the original MANPATH" do
- code = "print Bundler.clean_env['MANPATH']"
- ENV["MANPATH"] = "/foo"
- ENV["BUNDLER_ORIG_MANPATH"] = "/foo-original"
- bundle_exec_ruby! code.dump
- expect(last_command.stdboth).to eq("/foo-original")
- end
- end
-
- 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 }
- expect(actual).to eq(expected)
- end
-
- it "should restore the environment after execution" do
- Bundler.with_original_env do
- ENV["FOO"] = "hello"
- end
-
- expect(ENV).not_to have_key("FOO")
- end
- end
-
- describe "Bundler.with_clean_env", :bundler => "< 3" do
- it "should set ENV to clean_env in the block" do
- expected = Bundler.clean_env
- actual = Bundler.with_clean_env { ENV.to_hash }
- expect(actual).to eq(expected)
- end
-
- it "should restore the environment after execution" do
- Bundler.with_clean_env do
- ENV["FOO"] = "hello"
- end
-
- expect(ENV).not_to have_key("FOO")
- end
- end
-
- describe "Bundler.clean_system", :ruby => ">= 1.9", :bundler => "< 3" do
- it "runs system inside with_clean_env" do
- Bundler.clean_system(%(echo 'if [ "$BUNDLE_PATH" = "" ]; then exit 42; else exit 1; fi' | /bin/sh))
- expect($?.exitstatus).to eq(42)
- end
- end
-
- describe "Bundler.clean_exec", :ruby => ">= 1.9", :bundler => "< 3" do
- it "runs exec inside with_clean_env" do
- pid = Kernel.fork do
- Bundler.clean_exec(%(echo 'if [ "$BUNDLE_PATH" = "" ]; then exit 42; else exit 1; fi' | /bin/sh))
- end
- Process.wait(pid)
- expect($?.exitstatus).to eq(42)
- end
- end
-end
diff --git a/spec/bundler/runtime/with_unbundled_env_spec.rb b/spec/bundler/runtime/with_unbundled_env_spec.rb
new file mode 100644
index 0000000000..b4503cba32
--- /dev/null
+++ b/spec/bundler/runtime/with_unbundled_env_spec.rb
@@ -0,0 +1,241 @@
+# frozen_string_literal: true
+
+RSpec.describe "Bundler.with_env helpers" do
+ def bundle_exec_ruby!(code)
+ build_bundler_context
+ bundle! "exec '#{Gem.ruby}' -e #{code}"
+ end
+
+ def build_bundler_context
+ bundle "config set path vendor/bundle"
+ gemfile ""
+ bundle "install"
+ end
+
+ describe "Bundler.original_env" do
+ it "should return the PATH present before bundle was activated" do
+ code = "print Bundler.original_env['PATH']"
+ path = `getconf PATH`.strip + "#{File::PATH_SEPARATOR}/foo"
+ with_path_as(path) do
+ bundle_exec_ruby!(code.dump)
+ 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"
+ with_gem_path_as(gem_path) do
+ bundle_exec_ruby!(code.dump)
+ expect(last_command.stdboth).to eq(gem_path)
+ end
+ end
+
+ it "works with nested bundle exec invocations", :ruby_repo do
+ create_file("exe.rb", <<-'RB')
+ count = ARGV.first.to_i
+ exit if count < 0
+ STDERR.puts "#{count} #{ENV["PATH"].end_with?(":/foo")}"
+ if count == 2
+ ENV["PATH"] = "#{ENV["PATH"]}:/foo"
+ end
+ exec(Gem.ruby, __FILE__, (count - 1).to_s)
+ RB
+ 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"
+ end
+ expect(last_command.stderr).to eq <<-EOS.strip
+2 false
+1 true
+0 true
+ EOS
+ end
+
+ it "removes variables that bundler added", :ruby_repo do
+ 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
+ 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')"
+ ENV["BUNDLE_PATH"] = "./foo"
+ bundle_exec_ruby! code.dump
+ expect(last_command.stdboth).to include "false"
+ end
+
+ it "should remove '-rbundler/setup' from RUBYOPT" do
+ code = "print #{modified_env}['RUBYOPT']"
+ ENV["RUBYOPT"] = "-W2 -rbundler/setup #{ENV["RUBYOPT"]}"
+ bundle_exec_ruby! code.dump
+ expect(last_command.stdboth).not_to include("-rbundler/setup")
+ end
+
+ it "should clean up RUBYLIB", :ruby_repo do
+ code = "print #{modified_env}['RUBYLIB']"
+ ENV["RUBYLIB"] = root.join("lib").to_s + File::PATH_SEPARATOR + "/foo"
+ bundle_exec_ruby! code.dump
+ expect(last_command.stdboth).to include("/foo")
+ end
+
+ it "should restore the original MANPATH" do
+ code = "print #{modified_env}['MANPATH']"
+ ENV["MANPATH"] = "/foo"
+ ENV["BUNDLER_ORIG_MANPATH"] = "/foo-original"
+ bundle_exec_ruby! code.dump
+ expect(last_command.stdboth).to include("/foo-original")
+ end
+ end
+
+ describe "Bundler.unbundled_env" do
+ let(:modified_env) { "Bundler.unbundled_env" }
+
+ it_behaves_like "an unbundling helper"
+ end
+
+ describe "Bundler.clean_env", :bundler => 2 do
+ let(:modified_env) { "Bundler.clean_env" }
+
+ it_behaves_like "an unbundling helper"
+ end
+
+ 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 }
+ expect(actual).to eq(expected)
+ end
+
+ it "should restore the environment after execution" do
+ Bundler.with_original_env do
+ ENV["FOO"] = "hello"
+ end
+
+ expect(ENV).not_to have_key("FOO")
+ end
+ end
+
+ describe "Bundler.with_clean_env", :bundler => 2 do
+ it "should set ENV to unbundled_env in the block" do
+ expected = Bundler.unbundled_env
+ actual = Bundler.with_clean_env { ENV.to_hash }
+ expect(actual).to eq(expected)
+ end
+
+ it "should restore the environment after execution" do
+ Bundler.with_clean_env do
+ ENV["FOO"] = "hello"
+ end
+
+ expect(ENV).not_to have_key("FOO")
+ end
+ end
+
+ 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 }
+ expect(actual).to eq(expected)
+ end
+
+ it "should restore the environment after execution" do
+ Bundler.with_unbundled_env do
+ ENV["FOO"] = "hello"
+ end
+
+ expect(ENV).not_to have_key("FOO")
+ end
+ end
+
+ describe "Bundler.original_system" do
+ it "runs system inside with_original_env" do
+ code = 'exit Bundler.original_system(%(test "\$BUNDLE_FOO" = "bar"))'
+ lib = File.expand_path("../../lib", __dir__)
+ system({ "BUNDLE_FOO" => "bar" }, "ruby -I#{lib} -rbundler -e '#{code}'")
+ expect($?.exitstatus).to eq(0)
+ end
+ end
+
+ describe "Bundler.clean_system", :bundler => 2 do
+ it "runs system inside with_clean_env" do
+ code = 'exit Bundler.clean_system(%(test "\$BUNDLE_FOO" = "bar"))'
+ lib = File.expand_path("../../lib", __dir__)
+ system({ "BUNDLE_FOO" => "bar" }, "ruby -I#{lib} -rbundler -e '#{code}'")
+ expect($?.exitstatus).to eq(1)
+ end
+ end
+
+ describe "Bundler.unbundled_system" do
+ it "runs system inside with_unbundled_env" do
+ code = 'exit Bundler.clean_system(%(test "\$BUNDLE_FOO" = "bar"))'
+ lib = File.expand_path("../../lib", __dir__)
+ system({ "BUNDLE_FOO" => "bar" }, "ruby -I#{lib} -rbundler -e '#{code}'")
+ expect($?.exitstatus).to eq(1)
+ end
+ end
+
+ describe "Bundler.original_exec" do
+ let(:code) do
+ <<~RUBY
+ Process.fork do
+ exit Bundler.original_exec(%(test "\$BUNDLE_FOO" = "bar"))
+ end
+
+ _, status = Process.wait2
+
+ exit(status.exitstatus)
+ RUBY
+ end
+
+ it "runs exec inside with_original_env" do
+ lib = File.expand_path("../../lib", __dir__)
+ system({ "BUNDLE_FOO" => "bar" }, "ruby -I#{lib} -rbundler -e '#{code}'")
+ expect($?.exitstatus).to eq(0)
+ end
+ end
+
+ describe "Bundler.clean_exec", :bundler => 2 do
+ let(:code) do
+ <<~RUBY
+ Process.fork do
+ exit Bundler.clean_exec(%(test "\$BUNDLE_FOO" = "bar"))
+ end
+
+ _, status = Process.wait2
+
+ exit(status.exitstatus)
+ RUBY
+ end
+
+ it "runs exec inside with_clean_env" do
+ lib = File.expand_path("../../lib", __dir__)
+ system({ "BUNDLE_FOO" => "bar" }, "ruby -I#{lib} -rbundler -e '#{code}'")
+ expect($?.exitstatus).to eq(1)
+ end
+ end
+
+ describe "Bundler.unbundled_exec" do
+ let(:code) do
+ <<~RUBY
+ Process.fork do
+ exit Bundler.unbundled_exec(%(test "\$BUNDLE_FOO" = "bar"))
+ end
+
+ _, status = Process.wait2
+
+ exit(status.exitstatus)
+ RUBY
+ end
+
+ it "runs exec inside with_clean_env" do
+ lib = File.expand_path("../../lib", __dir__)
+ system({ "BUNDLE_FOO" => "bar" }, "ruby -I#{lib} -rbundler -e '#{code}'")
+ expect($?.exitstatus).to eq(1)
+ end
+ end
+end
diff --git a/spec/bundler/spec_helper.rb b/spec/bundler/spec_helper.rb
index c7614e1c43..81c222ea6f 100644
--- a/spec/bundler/spec_helper.rb
+++ b/spec/bundler/spec_helper.rb
@@ -3,43 +3,11 @@
$:.unshift File.expand_path("..", __FILE__)
$:.unshift File.expand_path("../../lib", __FILE__)
-require "rubygems"
-module Gem
- if defined?(@path_to_default_spec_map)
- @path_to_default_spec_map.delete_if do |_path, spec|
- spec.name == "bundler"
- end
- end
-end
-
-begin
- require File.expand_path("../support/path.rb", __FILE__)
- spec = Gem::Specification.load(Spec::Path.gemspec.to_s)
- rspec = spec.dependencies.find {|d| d.name == "rspec" }
- gem "rspec", rspec.requirement.to_s
- require "rspec"
- require "diff/lcs"
-rescue LoadError
- abort "Run rake spec:deps to install development dependencies"
-end
-
require "bundler/psyched_yaml"
require "bundler/vendored_fileutils"
require "uri"
require "digest"
-# Delete the default copy of Bundler that RVM installs for us when running in CI
-require "fileutils"
-if ENV.select {|k, _v| k =~ /TRAVIS/ }.any? && Gem::Version.new(Gem::VERSION) > Gem::Version.new("2.0")
- Dir.glob(File.join(Gem::Specification.default_specifications_dir, "bundler*.gemspec")).each do |file|
- FileUtils.rm_rf(file)
- end
-
- Dir.glob(File.join(RbConfig::CONFIG["sitelibdir"], "bundler*")).each do |file|
- FileUtils.rm_rf(file)
- end
-end
-
if File.expand_path(__FILE__) =~ %r{([^\w/\.:\-])}
abort "The bundler specs cannot be run from a path that contains special characters (particularly #{$1.inspect})"
end
@@ -53,9 +21,8 @@ end
$debug = false
-Spec::Manpages.setup
+Spec::Manpages.setup unless Gem.win_platform?
Spec::Rubygems.setup
-FileUtils.rm_rf(Spec::Path.gem_repo1)
ENV["RUBYOPT"] = "#{ENV["RUBYOPT"]} -r#{Spec::Path.spec_dir}/support/hax.rb"
ENV["BUNDLE_SPEC_RUN"] = "true"
@@ -104,13 +71,10 @@ RSpec.configure do |config|
config.filter_run_excluding :realworld => true
end
- git_version = Bundler::Source::Git::GitProxy.new(nil, nil, nil).version
-
- config.filter_run_excluding :ruby => LessThanProc.with(RUBY_VERSION)
- config.filter_run_excluding :rubygems => LessThanProc.with(Gem::VERSION)
- config.filter_run_excluding :git => LessThanProc.with(git_version)
+ config.filter_run_excluding :ruby => RequirementChecker.against(RUBY_VERSION)
+ config.filter_run_excluding :rubygems => RequirementChecker.against(Gem::VERSION)
config.filter_run_excluding :rubygems_master => (ENV["RGV"] != "master")
- config.filter_run_excluding :bundler => LessThanProc.with(Bundler::VERSION.split(".")[0, 2].join("."))
+ config.filter_run_excluding :bundler => RequirementChecker.against(Bundler::VERSION.split(".")[0])
config.filter_run_excluding :ruby_repo => !(ENV["BUNDLE_RUBY"] && ENV["BUNDLE_GEM"]).nil?
config.filter_run_when_matching :focus unless ENV["CI"]
@@ -122,6 +86,10 @@ RSpec.configure do |config|
c.syntax = :expect
end
+ config.mock_with :rspec do |mocks|
+ mocks.allow_message_expectations_on_nil = false
+ end
+
config.around :each do |example|
if ENV["BUNDLE_RUBY"]
orig_ruby = Gem.ruby
diff --git a/spec/bundler/support/artifice/compact_index.rb b/spec/bundler/support/artifice/compact_index.rb
index 01e8eb7837..4f01690ae4 100644
--- a/spec/bundler/support/artifice/compact_index.rb
+++ b/spec/bundler/support/artifice/compact_index.rb
@@ -21,7 +21,7 @@ class CompactIndexAPI < Endpoint
headers "Surrogate-Control" => "max-age=2592000, stale-while-revalidate=60"
content_type "text/plain"
requested_range_for(response_body)
- rescue => e
+ rescue StandardError => e
puts e
puts e.backtrace
raise
@@ -57,11 +57,7 @@ class CompactIndexAPI < Endpoint
end
def slice_body(body, range)
- if body.respond_to?(:byteslice)
- body.byteslice(range)
- else # pre-1.9.3
- body.unpack("@#{range.first}a#{range.end + 1}").first
- end
+ body.byteslice(range)
end
def gems(gem_repo = GEM_REPO)
@@ -82,8 +78,8 @@ class CompactIndexAPI < Endpoint
CompactIndex::Dependency.new(d.name, reqs)
end
checksum = begin
- Digest::SHA256.file("#{GEM_REPO}/gems/#{spec.original_name}.gem").base64digest
- rescue
+ Digest(:SHA256).file("#{GEM_REPO}/gems/#{spec.original_name}.gem").base64digest
+ rescue StandardError
nil
end
CompactIndex::GemVersion.new(spec.version.version, spec.platform.to_s, checksum, nil,
diff --git a/spec/bundler/support/artifice/compact_index_api_missing.rb b/spec/bundler/support/artifice/compact_index_api_missing.rb
index d4e68c38e8..94e6b73000 100644
--- a/spec/bundler/support/artifice/compact_index_api_missing.rb
+++ b/spec/bundler/support/artifice/compact_index_api_missing.rb
@@ -6,7 +6,7 @@ Artifice.deactivate
class CompactIndexApiMissing < CompactIndexAPI
get "/fetch/actual/gem/:id" do
- $stderr.puts params[:id]
+ warn params[:id]
if params[:id] == "rack-1.0.gemspec.rz"
halt 404
else
diff --git a/spec/bundler/support/artifice/compact_index_rate_limited.rb b/spec/bundler/support/artifice/compact_index_rate_limited.rb
new file mode 100644
index 0000000000..d8f4fc941c
--- /dev/null
+++ b/spec/bundler/support/artifice/compact_index_rate_limited.rb
@@ -0,0 +1,48 @@
+# frozen_string_literal: true
+
+require File.expand_path("../compact_index", __FILE__)
+
+Artifice.deactivate
+
+class CompactIndexRateLimited < CompactIndexAPI
+ class RequestCounter
+ def self.queue
+ @queue ||= Queue.new
+ end
+
+ def self.size
+ @queue.size
+ end
+
+ def self.enq(name)
+ @queue.enq(name)
+ end
+
+ def self.deq
+ @queue.deq
+ end
+ end
+
+ configure do
+ RequestCounter.queue
+ end
+
+ get "/info/:name" do
+ RequestCounter.enq(params[:name])
+
+ begin
+ if RequestCounter.size == 1
+ etag_response do
+ gem = gems.find {|g| g.name == params[:name] }
+ CompactIndex.info(gem ? gem.versions : [])
+ end
+ else
+ status 429
+ end
+ ensure
+ RequestCounter.deq
+ end
+ end
+end
+
+Artifice.activate_with(CompactIndexRateLimited)
diff --git a/spec/bundler/support/artifice/endpoint.rb b/spec/bundler/support/artifice/endpoint.rb
index 9a0cfae8a2..fcced6ea35 100644
--- a/spec/bundler/support/artifice/endpoint.rb
+++ b/spec/bundler/support/artifice/endpoint.rb
@@ -59,7 +59,7 @@ class Endpoint < Sinatra::Base
:platform => spec.platform.to_s,
:dependencies => spec.dependencies.select {|dep| dep.type == :runtime }.map do |dep|
[dep.name, dep.requirement.requirements.map {|a| a.join(" ") }.join(", ")]
- end
+ end,
}
end.compact
end
diff --git a/spec/bundler/support/artifice/endpoint_api_missing.rb b/spec/bundler/support/artifice/endpoint_api_missing.rb
index 95db8e2a7e..2ada0dc553 100644
--- a/spec/bundler/support/artifice/endpoint_api_missing.rb
+++ b/spec/bundler/support/artifice/endpoint_api_missing.rb
@@ -6,7 +6,7 @@ Artifice.deactivate
class EndpointApiMissing < Endpoint
get "/fetch/actual/gem/:id" do
- $stderr.puts params[:id]
+ warn params[:id]
if params[:id] == "rack-1.0.gemspec.rz"
halt 404
else
diff --git a/spec/bundler/support/artifice/vcr.rb b/spec/bundler/support/artifice/vcr.rb
index edd2f49a91..1e3809ff62 100644
--- a/spec/bundler/support/artifice/vcr.rb
+++ b/spec/bundler/support/artifice/vcr.rb
@@ -1,13 +1,6 @@
# frozen_string_literal: true
require "net/http"
-if RUBY_VERSION < "1.9"
- begin
- require "net/https"
- rescue LoadError
- nil # net/https or openssl
- end
-end # but only for 1.8
CASSETTE_PATH = File.expand_path("../vcr_cassettes", __FILE__)
CASSETTE_NAME = ENV.fetch("BUNDLER_SPEC_VCR_CASSETTE_NAME") { "realworld" }
diff --git a/spec/bundler/support/builders.rb b/spec/bundler/support/builders.rb
index 97134a045a..33a81f6f65 100644
--- a/spec/bundler/support/builders.rb
+++ b/spec/bundler/support/builders.rb
@@ -40,7 +40,7 @@ module Spec
build_gem "rails", "2.3.2" do |s|
s.executables = "rails"
- s.add_dependency "rake", "10.0.2"
+ s.add_dependency "rake", "12.3.2"
s.add_dependency "actionpack", "2.3.2"
s.add_dependency "activerecord", "2.3.2"
s.add_dependency "actionmailer", "2.3.2"
@@ -210,12 +210,7 @@ module Spec
# The yard gem iterates over Gem.source_index looking for plugins
build_gem "yard" do |s|
s.write "lib/yard.rb", <<-Y
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new("1.8.10")
- specs = Gem::Specification
- else
- specs = Gem.source_index.find_name('')
- end
- specs.sort_by(&:name).each do |gem|
+ Gem::Specification.sort_by(&:name).each do |gem|
puts gem.full_name
end
Y
@@ -653,7 +648,8 @@ module Spec
`git add *`
`git config user.email "lol@wut.com"`
`git config user.name "lolwut"`
- `git commit -m 'OMG INITIAL COMMIT'`
+ `git config commit.gpgsign false`
+ `git commit -m "OMG INITIAL COMMIT"`
end
end
end
diff --git a/spec/bundler/support/helpers.rb b/spec/bundler/support/helpers.rb
index 89c67c45b7..09e7419a98 100644
--- a/spec/bundler/support/helpers.rb
+++ b/spec/bundler/support/helpers.rb
@@ -41,19 +41,25 @@ module Spec
end
def out
- last_command.stdboth
+ last_command.stdout
end
def err
- last_command.stderr
+ Bundler.feature_flag.error_on_stderr? ? last_command.stderr : last_command.stdout
end
- def exitstatus
- last_command.exitstatus
+ MAJOR_DEPRECATION = /^\[DEPRECATED\]\s*/.freeze
+
+ def err_without_deprecations
+ last_command.stderr.gsub(/#{MAJOR_DEPRECATION}.+[\n]?/, "")
end
- def bundle_update_requires_all?
- Bundler::VERSION.start_with?("2.") ? nil : true
+ def deprecations
+ err.split("\n").select {|l| l =~ MAJOR_DEPRECATION }.join("\n").split(MAJOR_DEPRECATION)
+ end
+
+ def exitstatus
+ last_command.exitstatus
end
def in_app_root(&blk)
@@ -71,7 +77,7 @@ module Spec
def run(cmd, *args)
opts = args.last.is_a?(Hash) ? args.pop : {}
groups = args.map(&:inspect).join(", ")
- setup = "require 'rubygems' ; require 'bundler' ; Bundler.setup(#{groups})\n"
+ setup = "require 'bundler' ; Bundler.setup(#{groups})\n"
ruby(setup + cmd, opts)
end
bang :run
@@ -131,8 +137,6 @@ module Spec
load_path << spec
load_path_str = "-I#{load_path.join(File::PATH_SEPARATOR)}"
- env = env.map {|k, v| "#{k}='#{v}'" }.join(" ")
-
args = options.map do |k, v|
case v
when nil
@@ -146,13 +150,13 @@ module Spec
end
end.join
- cmd = "#{env} #{sudo} #{Gem.ruby} #{load_path_str} #{requires_str} #{bundle_bin} #{cmd}#{args}"
- sys_exec(cmd) {|i, o, thr| yield i, o, thr if block_given? }
+ 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? }
end
bang :bundle
def forgotten_command_line_options(options)
- remembered = Bundler.bundler_major_version < 3
+ remembered = Bundler::VERSION.split(".", 2).first == "2"
options = options.map do |k, v|
k = Array(k)[remembered ? 0 : -1]
v = '""' if v && v.to_s.empty?
@@ -161,9 +165,9 @@ module Spec
return Hash[options] if remembered
options.each do |k, v|
if v.nil?
- bundle! "config --delete #{k}"
+ bundle! "config unset #{k}"
else
- bundle! "config --local #{k} #{v}"
+ bundle! "config set --local #{k} #{v}"
end
end
{}
@@ -174,11 +178,6 @@ module Spec
bundle(cmd, options)
end
- def bundle_ruby(options = {})
- options["bundle_bin"] = bindir.join("bundle_ruby")
- bundle("", options)
- end
-
def ruby(ruby, options = {})
env = (options.delete(:env) || {}).map {|k, v| "#{k}='#{v}' " }.join
ruby = ruby.gsub(/["`\$]/) {|m| "\\#{m}" }
@@ -221,16 +220,18 @@ module Spec
"#{Gem.ruby} -S #{ENV["GEM_PATH"]}/bin/rake"
end
- def sys_exec(cmd)
+ def sys_exec(cmd, env = {})
command_execution = CommandExecution.new(cmd.to_s, Dir.pwd)
- Open3.popen3(cmd.to_s) do |stdin, stdout, stderr, wait_thr|
+ env = env.map {|k, v| [k.to_s, v.to_s] }.to_h # convert env keys and values to string
+
+ Open3.popen3(env, cmd.to_s) do |stdin, stdout, stderr, wait_thr|
yield stdin, stdout, wait_thr if block_given?
stdin.close
- command_execution.exitstatus = wait_thr && wait_thr.value.exitstatus
command_execution.stdout = Thread.new { stdout.read }.value.strip
command_execution.stderr = Thread.new { stderr.read }.value.strip
+ command_execution.exitstatus = wait_thr && wait_thr.value.exitstatus
end
(@command_executions ||= []) << command_execution
@@ -263,18 +264,22 @@ module Spec
end
def gemfile(*args)
- if args.empty?
+ contents = args.shift
+
+ if contents.nil?
File.open("Gemfile", "r", &:read)
else
- create_file("Gemfile", *args)
+ create_file("Gemfile", contents, *args)
end
end
def lockfile(*args)
- if args.empty?
+ contents = args.shift
+
+ if contents.nil?
File.open("Gemfile.lock", "r", &:read)
else
- create_file("Gemfile.lock", *args)
+ create_file("Gemfile.lock", normalize_uri_file(contents), *args)
end
end
@@ -323,7 +328,7 @@ module Spec
Dir.chdir(root) { gem_command! :build, gemspec.to_s }
end
bundler_path = root + "bundler-#{Bundler::VERSION}.gem"
- elsif g.to_s =~ %r{\A/.*\.gem\z}
+ elsif g.to_s =~ %r{\A(?:[A-Z]:)?/.*\.gem\z}
g
else
"#{gem_repo}/gems/#{g}.gem"
@@ -331,11 +336,8 @@ module Spec
raise "OMG `#{path}` does not exist!" unless File.exist?(path)
- if Gem::VERSION < "2.0.0"
- gem_command! :install, "--no-rdoc --no-ri --ignore-dependencies '#{path}'"
- else
- gem_command! :install, "--no-document --ignore-dependencies '#{path}'"
- end
+ gem_command! :install, "--no-document --ignore-dependencies '#{path}'"
+
bundler_path && bundler_path.rmtree
end
end
@@ -437,7 +439,7 @@ module Spec
ENV["GEM_PATH"] = system_gem_path.to_s
gems.each do |gem|
- gem_command :install, "--no-rdoc --no-ri #{gem}"
+ gem_command! :install, "--no-document #{gem}"
end
return unless block_given?
begin
@@ -577,7 +579,7 @@ module Spec
tries = 0
sleep 0.5
TCPSocket.new(host, port)
- rescue => e
+ rescue StandardError => e
raise(e) if tries > (seconds * 2)
tries += 1
retry
@@ -587,7 +589,7 @@ module Spec
port = 21_453
begin
port += 1 while TCPSocket.new("127.0.0.1", port)
- rescue
+ rescue StandardError
false
end
port
diff --git a/spec/bundler/support/indexes.rb b/spec/bundler/support/indexes.rb
index 69f8d9f679..b76f493d01 100644
--- a/spec/bundler/support/indexes.rb
+++ b/spec/bundler/support/indexes.rb
@@ -77,7 +77,7 @@ module Spec
gem "rack-mount", %w[0.4 0.5 0.5.1 0.5.2 0.6]
# --- Pre-release support
- gem "rubygems\0", ["1.3.2"]
+ gem "RubyGems\0", ["1.3.2"]
# --- Rails
versions "1.2.3 2.2.3 2.3.5 3.0.0.beta 3.0.0.beta1" do |version|
@@ -414,7 +414,7 @@ module Spec
gem("b", %w[0.9.0 1.5.0 2.0.0.pre])
# --- Pre-release support
- gem "rubygems\0", ["1.3.2"]
+ gem "RubyGems\0", ["1.3.2"]
end
end
end
diff --git a/spec/bundler/support/less_than_proc.rb b/spec/bundler/support/less_than_proc.rb
deleted file mode 100644
index ddac5458b7..0000000000
--- a/spec/bundler/support/less_than_proc.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-class LessThanProc < Proc
- attr_accessor :present
-
- def self.with(present)
- provided = Gem::Version.new(present.dup)
- new do |required|
- if required =~ /[=><~]/
- !Gem::Requirement.new(required).satisfied_by?(provided)
- else
- provided < Gem::Version.new(required)
- end
- end.tap {|l| l.present = present }
- end
-
- def inspect
- "\"=< #{present}\""
- end
-end
diff --git a/spec/bundler/support/matchers.rb b/spec/bundler/support/matchers.rb
index 8e17be3a02..f9efe32a38 100644
--- a/spec/bundler/support/matchers.rb
+++ b/spec/bundler/support/matchers.rb
@@ -60,36 +60,6 @@ module Spec
end
end
- MAJOR_DEPRECATION = /^\[DEPRECATED FOR 2\.0\]\s*/
-
- RSpec::Matchers.define :lack_errors do
- diffable
- match do |actual|
- actual.gsub(/#{MAJOR_DEPRECATION}.+[\n]?/, "") == ""
- end
- end
-
- RSpec::Matchers.define :eq_err do |expected|
- diffable
- match do |actual|
- actual.gsub(/#{MAJOR_DEPRECATION}.+[\n]?/, "") == expected
- end
- end
-
- RSpec::Matchers.define :have_major_deprecation do |expected|
- diffable
- match do |actual|
- deprecations = actual.split(MAJOR_DEPRECATION)
-
- return !expected.nil? if deprecations.size <= 1
- return true if expected.nil?
-
- deprecations.any? do |d|
- !d.empty? && values_match?(expected, d.strip)
- end
- end
- end
-
RSpec::Matchers.define :have_dep do |*args|
dep = Bundler::Dependency.new(*args)
@@ -128,6 +98,14 @@ module Spec
end
end
+ RSpec::Matchers.define :be_well_formed do
+ match(&:empty?)
+
+ failure_message do |actual|
+ actual.join("\n")
+ end
+ end
+
define_compound_matcher :read_as, [exist] do |file_contents|
diffable
@@ -152,10 +130,9 @@ module Spec
version_const = name == "bundler" ? "Bundler::VERSION" : Spec::Builders.constantize(name)
begin
run! "require '#{name}.rb'; puts #{version_const}", *groups
- rescue => e
+ rescue StandardError => e
next "#{name} is not installed:\n#{indent(e)}"
end
- last_command.stdout.gsub!(/#{MAJOR_DEPRECATION}.*$/, "")
actual_version, actual_platform = last_command.stdout.strip.split(/\s+/, 2)
unless Gem::Version.new(actual_version) == Gem::Version.new(version)
next "#{name} was expected to be at version #{version} but was #{actual_version}"
@@ -167,10 +144,9 @@ module Spec
begin
source_const = "#{Spec::Builders.constantize(name)}_SOURCE"
run! "require '#{name}/source'; puts #{source_const}", *groups
- rescue
+ rescue StandardError
next "#{name} does not have a source defined:\n#{indent(e)}"
end
- last_command.stdout.gsub!(/#{MAJOR_DEPRECATION}.*$/, "")
unless last_command.stdout.strip == source
next "Expected #{name} (#{version}) to be installed from `#{source}`, was actually from `#{out}`"
end
@@ -193,7 +169,7 @@ module Spec
puts "WIN"
end
R
- rescue => e
+ rescue StandardError => e
next "checking for #{name} failed:\n#{e}"
end
next if last_command.stdout == "WIN"
@@ -218,7 +194,7 @@ module Spec
RSpec::Matchers.alias_matcher :include_gem, :include_gems
def have_lockfile(expected)
- read_as(strip_whitespace(expected))
+ read_as(normalize_uri_file(strip_whitespace(expected)))
end
def plugin_should_be_installed(*names)
@@ -236,7 +212,7 @@ module Spec
end
def lockfile_should_be(expected)
- expect(bundled_app("Gemfile.lock")).to read_as(normalize_uri_file(strip_whitespace(expected)))
+ expect(bundled_app("Gemfile.lock")).to have_lockfile(expected)
end
def gemfile_should_be(expected)
diff --git a/spec/bundler/support/path.rb b/spec/bundler/support/path.rb
index 69efcba051..dc4b3bb6eb 100644
--- a/spec/bundler/support/path.rb
+++ b/spec/bundler/support/path.rb
@@ -99,7 +99,7 @@ module Spec
end
def bundler_path
- Pathname.new(File.expand_path(root.join("lib"), __FILE__))
+ root.join("lib")
end
def global_plugin_gem(*args)
diff --git a/spec/bundler/support/platforms.rb b/spec/bundler/support/platforms.rb
index 950311d20e..0a9e4a8cb6 100644
--- a/spec/bundler/support/platforms.rb
+++ b/spec/bundler/support/platforms.rb
@@ -100,9 +100,8 @@ module Spec
9999
end
- def lockfile_platforms(*platforms)
- platforms = local_platforms if platforms.empty?
- platforms.map(&:to_s).sort.join("\n ")
+ def lockfile_platforms
+ local_platforms.map(&:to_s).sort.join("\n ")
end
def local_platforms
diff --git a/spec/bundler/support/requirement_checker.rb b/spec/bundler/support/requirement_checker.rb
new file mode 100644
index 0000000000..d8f5fd5e5f
--- /dev/null
+++ b/spec/bundler/support/requirement_checker.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class RequirementChecker < Proc
+ def self.against(present)
+ provided = Gem::Version.new(present)
+
+ new do |required|
+ !Gem::Requirement.new(required).satisfied_by?(provided)
+ end
+ end
+end
diff --git a/spec/bundler/support/rubygems_ext.rb b/spec/bundler/support/rubygems_ext.rb
index 42f887f268..2f3d252865 100644
--- a/spec/bundler/support/rubygems_ext.rb
+++ b/spec/bundler/support/rubygems_ext.rb
@@ -1,31 +1,25 @@
# frozen_string_literal: true
require "rubygems/user_interaction"
-require "support/path" unless defined?(Spec::Path)
+require "support/path"
+require "fileutils"
module Spec
module Rubygems
DEPS = begin
- deps = {
- # rack 2.x requires Ruby version >= 2.2.2.
+ {
# artifice doesn't support rack 2.x now.
- # TODO: revert to `< 2` once https://github.com/rack/rack/issues/1168 is
- # addressed
- "rack" => "1.6.6",
- # rack-test 0.7.0 dropped 1.8.7 support
- # https://github.com/rack-test/rack-test/issues/193#issuecomment-314230318
- "rack-test" => "< 0.7.0",
+ "rack" => "< 2.0",
+ "rack-test" => "~> 1.1",
"artifice" => "~> 0.6.0",
"compact_index" => "~> 0.11.0",
"sinatra" => "~> 1.4.7",
# Rake version has to be consistent for tests to pass
- "rake" => "10.0.2",
- # 3.0.0 breaks 1.9.2 specs
- "builder" => "2.1.2",
+ "rake" => "12.3.2",
+ "builder" => "~> 3.2",
+ # ruby-graphviz is used by the viz tests
+ "ruby-graphviz" => nil,
}
- # ruby-graphviz is used by the viz tests
- deps["ruby-graphviz"] = nil if RUBY_VERSION >= "1.9.3"
- deps
end
def self.setup
@@ -33,17 +27,17 @@ module Spec
ENV["BUNDLE_PATH"] = nil
ENV["GEM_HOME"] = ENV["GEM_PATH"] = Path.base_system_gems.to_s
- ENV["PATH"] = [Path.bindir, "#{Path.system_gem_path}/bin", ENV["PATH"]].join(File::PATH_SEPARATOR)
+ ENV["PATH"] = [Path.bindir, Path.system_gem_path.join("bin"), ENV["PATH"]].join(File::PATH_SEPARATOR)
manifest = DEPS.to_a.sort_by(&:first).map {|k, v| "#{k} => #{v}\n" }
- manifest_path = "#{Path.base_system_gems}/manifest.txt"
+ manifest_path = Path.base_system_gems.join("manifest.txt")
# it's OK if there are extra gems
- if !File.exist?(manifest_path) || !(manifest - File.readlines(manifest_path)).empty?
+ 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)
- File.open(manifest_path, "w") {|f| f << manifest.join }
+ manifest_path.open("w") {|f| f << manifest.join }
end
ENV["HOME"] = Path.home.to_s
@@ -54,17 +48,11 @@ module Spec
def self.install_gems(gems)
reqs, no_reqs = gems.partition {|_, req| !req.nil? && !req.split(" ").empty? }
- # TODO: remove when we drop ruby 1.8.7-2.2.2 support
- reqs = reqs.sort_by {|name, _| name == "rack" ? 0 : 1 }.sort_by {|name, _| name =~ /rack/ ? 0 : 1 }
no_reqs.map!(&:first)
reqs.map! {|name, req| "'#{name}:#{req}'" }
deps = reqs.concat(no_reqs).join(" ")
- gem = Spec::Path.ruby_core? ? ENV["BUNDLE_GEM"] : "gem"
- cmd = if Gem::VERSION < "2.0.0"
- "#{gem} install #{deps} --no-rdoc --no-ri --conservative"
- else
- "#{gem} install #{deps} --no-document --conservative"
- end
+ gem = Spec::Path.ruby_core? ? ENV["BUNDLE_GEM"] : "#{Gem.ruby} -S gem"
+ cmd = "#{gem} install #{deps} --no-document --conservative"
puts cmd
system(cmd) || raise("Installing gems #{deps} for the tests to use failed!")
end
diff --git a/spec/bundler/update/gemfile_spec.rb b/spec/bundler/update/gemfile_spec.rb
index f59f3a2d32..6c47c254cd 100644
--- a/spec/bundler/update/gemfile_spec.rb
+++ b/spec/bundler/update/gemfile_spec.rb
@@ -9,7 +9,7 @@ RSpec.describe "bundle update" do
G
bundle! :install, :gemfile => bundled_app("NotGemfile")
- bundle! :update, :gemfile => bundled_app("NotGemfile"), :all => bundle_update_requires_all?
+ bundle! :update, :gemfile => bundled_app("NotGemfile"), :all => true
# Specify BUNDLE_GEMFILE for `the_bundle`
# to retrieve the proper Gemfile
@@ -25,12 +25,12 @@ RSpec.describe "bundle update" do
gem 'rack'
G
- bundle "config --local gemfile #{bundled_app("NotGemfile")}"
+ bundle "config set --local gemfile #{bundled_app("NotGemfile")}"
bundle! :install
end
it "uses the gemfile to update" do
- bundle! "update", :all => bundle_update_requires_all?
+ bundle! "update", :all => true
bundle "list"
expect(out).to include("rack (1.0.0)")
@@ -39,28 +39,11 @@ 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 => bundle_update_requires_all?
+ bundle! "update", :all => true
bundle "list"
expect(out).to include("rack (1.0.0)")
end
end
end
-
- context "with prefer_gems_rb set" do
- before { bundle! "config prefer_gems_rb true" }
-
- it "prefers gems.rb to Gemfile" do
- create_file("gems.rb", "gem 'bundler'")
- create_file("Gemfile", "raise 'wrong Gemfile!'")
-
- bundle! :install
- bundle! :update, :all => bundle_update_requires_all?
-
- expect(bundled_app("gems.rb")).to be_file
- expect(bundled_app("Gemfile.lock")).not_to be_file
-
- expect(the_bundle).to include_gem "bundler #{Bundler::VERSION}"
- end
- end
end
diff --git a/spec/bundler/update/gems/post_install_spec.rb b/spec/bundler/update/gems/post_install_spec.rb
index 2fb3547806..f6b7f39d0b 100644
--- a/spec/bundler/update/gems/post_install_spec.rb
+++ b/spec/bundler/update/gems/post_install_spec.rb
@@ -10,7 +10,7 @@ RSpec.describe "bundle update" do
gem 'thin'
G
- bundle! "config #{config}" if config
+ bundle! "config set #{config}" if config
bundle! :install
end
@@ -52,7 +52,7 @@ RSpec.describe "bundle update" do
gem 'thin'
G
- bundle! :update, :all => bundle_update_requires_all?
+ bundle! :update, :all => true
end
it_behaves_like "a post-install message outputter"
@@ -67,7 +67,7 @@ RSpec.describe "bundle update" do
gem 'thin'
G
- bundle! :update, :all => bundle_update_requires_all?
+ bundle! :update, :all => true
end
it_behaves_like "a post-install message outputter"
diff --git a/spec/bundler/update/git_spec.rb b/spec/bundler/update/git_spec.rb
index d97760e84b..4fe22269e2 100644
--- a/spec/bundler/update/git_spec.rb
+++ b/spec/bundler/update/git_spec.rb
@@ -16,7 +16,7 @@ RSpec.describe "bundle update" do
s.write "lib/foo.rb", "FOO = '1.1'"
end
- bundle "update", :all => bundle_update_requires_all?
+ bundle "update", :all => true
expect(the_bundle).to include_gems "foo 1.1"
end
@@ -88,7 +88,7 @@ RSpec.describe "bundle update" do
gem "foo", "1.0", :git => "#{lib_path("foo_two")}"
G
- expect(err).to lack_errors
+ expect(last_command.stderr).to be_empty
expect(out).to include("Fetching #{lib_path}/foo_two")
expect(out).to include("Bundle complete!")
end
@@ -111,7 +111,7 @@ RSpec.describe "bundle update" do
gem 'foo', :git => "#{@remote.path}", :tag => "fubar"
G
- bundle "update", :all => bundle_update_requires_all?
+ bundle "update", :all => true
expect(exitstatus).to eq(0) if exitstatus
end
@@ -191,7 +191,7 @@ RSpec.describe "bundle update" do
lib_path("foo-1.0").join(".git").rmtree
- bundle :update, :all => bundle_update_requires_all?
+ bundle :update, :all => true
expect(last_command.bundler_err).to include(lib_path("foo-1.0").to_s).
and match(/Git error: command `git fetch.+has failed/)
end
@@ -208,7 +208,7 @@ RSpec.describe "bundle update" do
gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
G
- bundle %(config local.rack #{lib_path("local-rack")})
+ bundle %(config set local.rack #{lib_path("local-rack")})
bundle "update rack"
expect(out).to include("Bundle updated!")
end
@@ -233,7 +233,7 @@ RSpec.describe "bundle update" do
rails!
G
- bundle "update", :all => bundle_update_requires_all?
+ 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]})")
end
end
@@ -299,7 +299,7 @@ RSpec.describe "bundle update" do
G
end
- it "the --source flag updates version of gems that were originally pulled in by the source", :bundler => "> 3" do
+ it "the --source flag updates version of gems that were originally pulled in by the source", :bundler => "< 3" do
spec_lines = lib_path("bar/foo.gemspec").read.split("\n")
spec_lines[5] = "s.version = '2.0'"
@@ -348,17 +348,17 @@ RSpec.describe "bundle update" do
bundle "update --source bar"
lockfile_should_be <<-G
- GEM
- remote: file://localhost#{gem_repo2}/
- specs:
- rack (1.0.0)
-
GIT
remote: #{@git.path}
revision: #{ref}
specs:
foo (2.0)
+ GEM
+ remote: file://localhost#{gem_repo2}/
+ specs:
+ rack (1.0.0)
+
PLATFORMS
#{lockfile_platforms}
diff --git a/spec/bundler/update/redownload_spec.rb b/spec/bundler/update/redownload_spec.rb
index 1bbc3a66fc..39edac0902 100644
--- a/spec/bundler/update/redownload_spec.rb
+++ b/spec/bundler/update/redownload_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe "bundle update", :bundler => "< 3", :ruby => ">= 2.0" do
+RSpec.describe "bundle update" do
before :each do
install_gemfile <<-G
source "file://#{gem_repo1}"
@@ -8,29 +8,27 @@ RSpec.describe "bundle update", :bundler => "< 3", :ruby => ">= 2.0" do
G
end
- before { bundle "config major_deprecations yes" }
-
describe "with --force" do
- it "shows a deprecation when single flag passed" do
+ it "shows a deprecation when single flag passed", :bundler => 2 do
bundle! "update rack --force"
- expect(out).to include "[DEPRECATED FOR 3.0] The `--force` option has been renamed to `--redownload`"
+ expect(err).to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`"
end
- it "shows a deprecation when multiple flags passed" do
+ it "shows a deprecation when multiple flags passed", :bundler => 2 do
bundle! "update rack --no-color --force"
- expect(out).to include "[DEPRECATED FOR 3.0] The `--force` option has been renamed to `--redownload`"
+ expect(err).to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`"
end
end
describe "with --redownload" do
it "does not show a deprecation when single flag passed" do
bundle! "update rack --redownload"
- expect(out).not_to include "[DEPRECATED FOR 3.0] The `--force` option has been renamed to `--redownload`"
+ expect(err).not_to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`"
end
it "does not show a deprecation when single multiple flags passed" do
bundle! "update rack --no-color --redownload"
- expect(out).not_to include "[DEPRECATED FOR 3.0] The `--force` option has been renamed to `--redownload`"
+ expect(err).not_to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`"
end
end
end