From b61a39143e8f3bc8e71553ae85a3d56bbc554dc0 Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Mon, 29 Oct 2018 22:22:14 +1100 Subject: bump all bundler 2 features (except stderr) to bundler 3 --- lib/bundler/feature_flag.rb | 58 ++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/lib/bundler/feature_flag.rb b/lib/bundler/feature_flag.rb index 83e7ff0389..15ba825c51 100644 --- a/lib/bundler/feature_flag.rb +++ b/lib/bundler/feature_flag.rb @@ -27,38 +27,38 @@ module Bundler (1..10).each {|v| define_method("bundler_#{v}_mode?") { major_version >= v } } - settings_flag(:allow_bundler_dependency_conflicts) { bundler_2_mode? } - settings_flag(:allow_offline_install) { bundler_2_mode? } - settings_flag(:auto_clean_without_path) { bundler_2_mode? } - settings_flag(:auto_config_jobs) { bundler_2_mode? } - settings_flag(:cache_all) { bundler_2_mode? } - settings_flag(:cache_command_is_package) { bundler_2_mode? } - settings_flag(:console_command) { !bundler_2_mode? } - settings_flag(:default_install_uses_path) { bundler_2_mode? } - settings_flag(:deployment_means_frozen) { bundler_2_mode? } - settings_flag(:disable_multisource) { bundler_2_mode? } + settings_flag(:allow_bundler_dependency_conflicts) { bundler_3_mode? } + settings_flag(:allow_offline_install) { bundler_3_mode? } + settings_flag(:auto_clean_without_path) { bundler_3_mode? } + settings_flag(:auto_config_jobs) { bundler_3_mode? } + settings_flag(:cache_all) { bundler_3_mode? } + settings_flag(: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? } settings_flag(:error_on_stderr) { bundler_2_mode? } - settings_flag(:forget_cli_options) { bundler_2_mode? } - settings_flag(:global_path_appends_ruby_scope) { bundler_2_mode? } - settings_flag(:global_gem_cache) { bundler_2_mode? } - settings_flag(:init_gems_rb) { bundler_2_mode? } - settings_flag(:list_command) { bundler_2_mode? } - settings_flag(:lockfile_uses_separate_rubygems_sources) { bundler_2_mode? } - settings_flag(:only_update_to_newer_versions) { bundler_2_mode? } - settings_flag(:path_relative_to_cwd) { bundler_2_mode? } + 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(: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_2_mode? } - settings_flag(:print_only_version_number) { bundler_2_mode? } - settings_flag(:setup_makes_kernel_gem_public) { !bundler_2_mode? } - settings_flag(:skip_default_git_sources) { bundler_2_mode? } - settings_flag(:specific_platform) { bundler_2_mode? } - settings_flag(:suppress_install_using_messages) { bundler_2_mode? } - settings_flag(:unlock_source_unlocks_spec) { !bundler_2_mode? } - settings_flag(:update_requires_all_flag) { bundler_2_mode? } - settings_flag(:use_gem_version_promoter_for_major_updates) { bundler_2_mode? } - settings_flag(:viz_command) { !bundler_2_mode? } + 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(: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_2_mode? ? :cli_help : :install } + settings_option(:default_cli_command) { bundler_3_mode? ? :cli_help : :install } def initialize(bundler_version) @bundler_version = Gem::Version.create(bundler_version) -- cgit v1.2.1 From 6e270f88113b68a8630aad1c23408a8d54b5e7ef Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Mon, 29 Oct 2018 22:57:11 +1100 Subject: run rubocop with --auto-gen-config --- .rubocop.yml | 2 +- .rubocop_todo.yml | 96 +++++++++++++++++++++++++++++++------------------------ 2 files changed, 56 insertions(+), 42 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index a6412ecb13..cbdb8f8d41 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -2,7 +2,7 @@ inherit_from: - .rubocop_todo.yml AllCops: - TargetRubyVersion: 1.9 + TargetRubyVersion: 2.3 Exclude: - tmp/**/* - lib/bundler/vendor/**/* diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index f411b8e11d..16080de7cd 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2017-05-30 06:35:02 +0900 using RuboCop version 0.49.1. +# on 2018-10-29 22:50:33 +1100 using RuboCop version 0.49.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -12,13 +12,6 @@ Layout/EmptyLinesAroundExceptionHandlingKeywords: Exclude: - 'Rakefile' -# Offense count: 2 -# Cop supports --auto-correct. -# Configuration parameters: AllowForAlignment, ForceEqualSignAlignment. -Layout/ExtraSpacing: - Exclude: - - 'lib/bundler/cli.rb' - # Offense count: 10 # Cop supports --auto-correct. # Configuration parameters: SupportedStyles, IndentationWidth. @@ -26,7 +19,7 @@ Layout/ExtraSpacing: Layout/IndentArray: EnforcedStyle: consistent -# Offense count: 35 +# Offense count: 48 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, SupportedStyles. # SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent @@ -58,7 +51,7 @@ Layout/SpaceInsideBlockBraces: Exclude: - 'lib/bundler/installer/parallel_installer.rb' -# Offense count: 25 +# Offense count: 30 Lint/AmbiguousBlockAssociation: Exclude: - 'lib/bundler/definition.rb' @@ -67,8 +60,8 @@ Lint/AmbiguousBlockAssociation: - 'spec/commands/init_spec.rb' - 'spec/commands/install_spec.rb' - 'spec/install/gems/flex_spec.rb' - - 'spec/lock/lockfile_spec.rb' - 'spec/lock/lockfile_bundler_1_spec.rb' + - 'spec/lock/lockfile_spec.rb' - 'spec/other/major_deprecation_spec.rb' - 'spec/runtime/setup_spec.rb' - 'spec/support/helpers.rb' @@ -83,7 +76,6 @@ Lint/EmptyWhen: # Offense count: 4 Lint/HandleExceptions: Exclude: - - 'lib/bundler/installer.rb' - 'lib/bundler/psyched_yaml.rb' - 'lib/bundler/vendored_persistent.rb' @@ -119,13 +111,12 @@ Lint/UselessAccessModifier: Exclude: - 'lib/bundler/fetcher.rb' -# Offense count: 6 +# Offense count: 1 Lint/UselessAssignment: Exclude: - 'lib/bundler/index.rb' - - 'lib/bundler/installer.rb' -# Offense count: 2085 +# Offense count: 2779 # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. # URISchemes: http, https Metrics/LineLength: @@ -175,13 +166,6 @@ Security/MarshalLoad: - 'spec/support/artifice/compact_index.rb' - 'spec/support/artifice/endpoint.rb' -# Offense count: 2 -# Cop supports --auto-correct. -Security/YAMLLoad: - Exclude: - - 'spec/bundler/yaml_serializer_spec.rb' - - 'spec/commands/inject_spec.rb' - # Offense count: 1 Style/AccessorMethodName: Exclude: @@ -193,7 +177,7 @@ Style/CaseEquality: - 'lib/bundler/match_platform.rb' - 'lib/bundler/rubygems_ext.rb' -# Offense count: 27 +# Offense count: 28 # Configuration parameters: EnforcedStyle, SupportedStyles. # SupportedStyles: nested, compact Style/ClassAndModuleChildren: @@ -215,7 +199,7 @@ Style/ConditionalAssignment: - 'lib/bundler/source/git.rb' - 'lib/bundler/source/rubygems.rb' -# Offense count: 160 +# Offense count: 168 Style/Documentation: Enabled: false @@ -238,19 +222,17 @@ Style/EmptyMethod: Style/FormatStringToken: EnforcedStyle: template -# Offense count: 2 +# Offense count: 1 # Configuration parameters: AllowedVariables. Style/GlobalVars: Exclude: - 'lib/bundler/cli.rb' - - 'spec/spec_helper.rb' -# Offense count: 16 +# Offense count: 12 # Configuration parameters: MinBodyLength. Style/GuardClause: Exclude: - 'lib/bundler/cli/cache.rb' - - 'lib/bundler/cli/clean.rb' - 'lib/bundler/cli/install.rb' - 'lib/bundler/cli/outdated.rb' - 'lib/bundler/cli/package.rb' @@ -263,20 +245,12 @@ Style/GuardClause: - 'spec/support/sometimes.rb' # Offense count: 1 -Style/IfInsideElse: - Exclude: - - 'lib/bundler/cli/install.rb' - -# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: MaxLineLength. Style/IfUnlessModifier: Exclude: - 'lib/bundler/dsl.rb' -# Offense count: 1 -Style/IfUnlessModifierOfIfUnless: - Exclude: - - 'spec/support/helpers.rb' - # Offense count: 9 # Cop supports --auto-correct. # Configuration parameters: InverseMethods, InverseBlocks. @@ -315,7 +289,7 @@ Style/ModuleFunction: - 'lib/bundler/shared_helpers.rb' - 'spec/support/path.rb' -# Offense count: 11 +# Offense count: 10 # Cop supports --auto-correct. Style/MultilineIfModifier: Exclude: @@ -334,13 +308,14 @@ Style/NestedParenthesizedCalls: - 'spec/commands/lock_spec.rb' - 'spec/runtime/setup_spec.rb' -# Offense count: 6 +# Offense count: 7 # Cop supports --auto-correct. # Configuration parameters: AutoCorrect, EnforcedStyle, SupportedStyles. # SupportedStyles: predicate, comparison Style/NumericPredicate: Exclude: - 'spec/**/*' + - 'lib/bundler/cli/common.rb' - 'lib/bundler/gem_helper.rb' - 'lib/bundler/mirror.rb' - 'lib/bundler/source/git/git_proxy.rb' @@ -383,12 +358,51 @@ Style/RaiseArgs: - 'spec/bundler/rubygems_integration_spec.rb' - 'spec/bundler/shared_helpers_spec.rb' +# Offense count: 24 +# Cop supports --auto-correct. +Style/RedundantFreeze: + Exclude: + - 'bin/bundle1' + - 'bin/bundle2' + - 'lib/bundler.rb' + - 'lib/bundler/endpoint_specification.rb' + - 'lib/bundler/environment_preserver.rb' + - 'lib/bundler/index.rb' + - 'lib/bundler/injector.rb' + - 'lib/bundler/installer.rb' + - 'lib/bundler/lockfile_generator.rb' + - 'lib/bundler/lockfile_parser.rb' + - 'lib/bundler/plugin.rb' + - 'lib/bundler/resolver/spec_group.rb' + - 'lib/bundler/source/path.rb' + - 'spec/bundler/shared_helpers_spec.rb' + # Offense count: 1 # Cop supports --auto-correct. Style/RedundantParentheses: Exclude: - 'lib/bundler/cli/console.rb' +# Offense count: 7 +# Cop supports --auto-correct. +# Configuration parameters: ConvertCodeThatCanStartToReturnNil. +Style/SafeNavigation: + Exclude: + - 'lib/bundler/cli/add.rb' + - 'lib/bundler/fetcher/compact_index.rb' + - 'lib/bundler/gem_helper.rb' + - 'lib/bundler/gem_remote_fetcher.rb' + - 'lib/bundler/rubygems_integration.rb' + - 'lib/bundler/source/rubygems.rb' + - 'spec/support/artifice/vcr.rb' + +# Offense count: 56 +# Cop supports --auto-correct. +# Configuration parameters: MinSize, SupportedStyles. +# SupportedStyles: percent, brackets +Style/SymbolArray: + EnforcedStyle: brackets + # Offense count: 2 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, SupportedStyles, AllowSafeAssignment. @@ -412,7 +426,7 @@ Style/TrailingCommaInLiteral: - 'lib/bundler/similarity_detector.rb' - 'spec/support/artifice/endpoint.rb' -# Offense count: 7 +# Offense count: 14 # Cop supports --auto-correct. Style/UnneededInterpolation: Exclude: -- cgit v1.2.1 From 9ecc86f3c8da39ce224afc3faf2646574ad49327 Mon Sep 17 00:00:00 2001 From: "bundlerbot[bot]" Date: Mon, 29 Oct 2018 11:39:28 +0000 Subject: Merge #6763 6763: Removed jobs with old ruby versions from Travis CI. r=colby-swandale a=hsbt I removed the ruby versions under the Ruby 2.2. We need to fix gemspec and other parameters of .travis.yml. But this is the first step of Bundler-2.0.0 reboot. Co-authored-by: SHIBATA Hiroshi (cherry picked from commit 67771c05de5d27dff4701b39707a78119cf2b55d) --- .travis.yml | 94 +++++++++---------------------------------------------------- 1 file changed, 13 insertions(+), 81 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9338cb9602..5086d8f1b3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,12 +29,9 @@ addons: secure: "TrzIv116JLGUxm6PAUskCYrv8KTDguncKROVwbnjVPKTGDAgoDderd8JUdDEXrKoZ9qGLD2TPYKExt9/QDl71E+qHdWnVqWv4HKCUk2P9z/VLKzHuggOUBkCXiJUhjywUieCJhI3N92bfq2EjSBbu2/OFHqWOjLQ+QCooTEBjv8=" rvm: - - 2.5.1 - - 2.4.3 - - 2.3.6 - - 2.2.7 - - 2.1.10 - - 2.0.0 + - 2.5.3 + - 2.4.5 + - 2.3.8 # Rubygems versions MUST be available as rake tasks # see Rakefile:125 for the list of possible RGV values @@ -46,86 +43,21 @@ env: matrix: include: - - rvm: 2.4.1 - env: RGV=v2.6.8 BUNDLER_SPEC_SUB_VERSION=2.0.0 - # Ruby 2.4, Rubygems 2.6.8 and up - # Ruby 2.3, Rubygems 2.5.1 and up - - rvm: 2.2.6 + # Ruby 2.4, Rubygems 2.6 and up + - rvm: 2.4.2 + env: RGV=v2.6.14 + # Ruby 2.3, Rubygems 2.5 and up + - rvm: 2.3.7 env: RGV=v2.5.2 - # Ruby 2.2, Rubygems 2.4.5 and up - - rvm: 2.2.6 - env: RGV=v2.4.8 - # Ruby 2.1, Rubygems 2.2.2 and up - - rvm: 2.1.10 - env: RGV=v2.2.5 - # Ruby 2.0.0, Rubygems 2.0.0 and up - - rvm: 2.0.0 - env: RGV=v2.2.5 - - rvm: 2.0.0 - env: RGV=v2.1.11 - - rvm: 2.0.0 - env: RGV=v2.0.14 - # Ruby 1.9.3, Rubygems 1.5.3 and up - - rvm: 1.9.3 - env: RGV=v2.7.7 - - rvm: 1.9.3 - env: RGV=v2.2.5 - - rvm: 1.9.3 - env: RGV=v2.1.11 - - rvm: 1.9.3 - env: RGV=v2.0.14 - - rvm: 1.9.3 - env: RGV=v1.8.29 - - rvm: 1.9.3 - env: RGV=v1.7.2 - - rvm: 1.9.3 - env: RGV=v1.6.2 - - rvm: 1.9.3 - env: RGV=v1.5.3 - - - rvm: 1.8.7 - env: RGV=v2.6.8 - # Ruby 1.8.7, Rubygems 1.3.6 and up - - rvm: 1.8.7 - env: RGV=v2.2.5 - # ALLOWED FAILURES - # since the great Travis image outage, frequent random segfaults :'( - - rvm: 1.8.7 - env: RGV=v2.0.14 - - rvm: 1.8.7 - env: RGV=v1.8.29 - - rvm: 1.8.7 - env: RGV=v1.7.2 - - rvm: 1.8.7 - env: RGV=v1.6.2 - - rvm: 1.8.7 - env: RGV=v1.5.3 - - rvm: 1.8.7 - env: RGV=v1.4.2 - - rvm: 1.8.7 - env: RGV=v1.3.7 - - rvm: 1.8.7 - env: RGV=v1.3.6 + - rvm: 2.3.7 + env: RGV=v2.6.14 # Ruby-head (we want to know how we're doing, but not fail the build) - rvm: ruby-head env: RGV=master + # 1.x mode (we want to keep stuff passing in 1.x mode for now) + - rvm: 2.5.1 + env: RGV=v2.7.7 BUNDLER_SPEC_SUB_VERSION=1.98 allow_failures: - - rvm: 1.8.7 - env: RGV=v2.0.14 - - rvm: 1.8.7 - env: RGV=v1.8.29 - - rvm: 1.8.7 - env: RGV=v1.7.2 - - rvm: 1.8.7 - env: RGV=v1.6.2 - - rvm: 1.8.7 - env: RGV=v1.5.3 - - rvm: 1.8.7 - env: RGV=v1.4.2 - - rvm: 1.8.7 - env: RGV=v1.3.7 - - rvm: 1.8.7 - env: RGV=v1.3.6 - rvm: ruby-head env: RGV=master -- cgit v1.2.1 From fbc4ea3029e2caa5a96c156a969c123ec8ff81cc Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Mon, 29 Oct 2018 23:03:37 +1100 Subject: resolve rubocop error --- .rubocop_todo.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 16080de7cd..7f97d0ecc4 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2018-10-29 22:50:33 +1100 using RuboCop version 0.49.1. +# on 2018-10-29 23:00:23 +1100 using RuboCop version 0.49.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -116,7 +116,7 @@ Lint/UselessAssignment: Exclude: - 'lib/bundler/index.rb' -# Offense count: 2779 +# Offense count: 2785 # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. # URISchemes: http, https Metrics/LineLength: @@ -222,11 +222,12 @@ Style/EmptyMethod: Style/FormatStringToken: EnforcedStyle: template -# Offense count: 1 +# Offense count: 2 # Configuration parameters: AllowedVariables. Style/GlobalVars: Exclude: - 'lib/bundler/cli.rb' + - 'spec/spec_helper.rb' # Offense count: 12 # Configuration parameters: MinBodyLength. -- cgit v1.2.1 From 7ecd3b4c7e5e2c7303311a3f1d9b966c6e40332c Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Tue, 30 Oct 2018 22:39:55 +1100 Subject: remove 1.X mode, add 3.X mode and update versions of ruby --- .travis.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5086d8f1b3..085e2028ff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,20 +43,20 @@ env: matrix: include: + # 3.x mode + - rvm: 2.5.3 + env: RGV=v2.7.7 BUNDLER_SPEC_SUB_VERSION=3.0.0 # Ruby 2.4, Rubygems 2.6 and up - - rvm: 2.4.2 + - rvm: 2.4.5 env: RGV=v2.6.14 # Ruby 2.3, Rubygems 2.5 and up - - rvm: 2.3.7 + - rvm: 2.3.8 env: RGV=v2.5.2 - - rvm: 2.3.7 + - rvm: 2.3.8 env: RGV=v2.6.14 # Ruby-head (we want to know how we're doing, but not fail the build) - rvm: ruby-head env: RGV=master - # 1.x mode (we want to keep stuff passing in 1.x mode for now) - - rvm: 2.5.1 - env: RGV=v2.7.7 BUNDLER_SPEC_SUB_VERSION=1.98 allow_failures: - rvm: ruby-head -- cgit v1.2.1 From 56a4bb86144db78cc8f50977e6cc2d03943e254f Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Tue, 30 Oct 2018 22:40:23 +1100 Subject: move all bundler 2, < 2 spec scopes to bundler 3, < 3 --- spec/bundler/cli_spec.rb | 6 +++--- spec/bundler/definition_spec.rb | 8 ++++---- spec/bundler/dsl_spec.rb | 8 ++++---- spec/bundler/source_list_spec.rb | 6 +++--- spec/bundler/ui/shell_spec.rb | 4 ++-- spec/cache/path_spec.rb | 2 +- spec/commands/binstubs_spec.rb | 2 +- spec/commands/check_spec.rb | 6 +++--- spec/commands/clean_spec.rb | 6 +++--- spec/commands/console_spec.rb | 2 +- spec/commands/exec_spec.rb | 16 ++++++++-------- spec/commands/init_spec.rb | 16 ++++++++-------- spec/commands/inject_spec.rb | 2 +- spec/commands/install_spec.rb | 8 ++++---- spec/commands/list_spec.rb | 2 +- spec/commands/outdated_spec.rb | 2 +- spec/commands/package_spec.rb | 2 +- spec/commands/show_spec.rb | 2 +- spec/commands/update_spec.rb | 28 ++++++++++++++-------------- spec/commands/version_spec.rb | 12 ++++++------ spec/commands/viz_spec.rb | 2 +- spec/install/binstubs_spec.rb | 4 ++-- spec/install/deploy_spec.rb | 8 ++++---- spec/install/gemfile/gemspec_spec.rb | 4 ++-- spec/install/gemfile/git_spec.rb | 2 +- spec/install/gemfile/groups_spec.rb | 6 +++--- spec/install/gemfile/path_spec.rb | 2 +- spec/install/gemfile/platform_spec.rb | 2 +- spec/install/gemfile/sources_spec.rb | 8 ++++---- spec/install/gems/compact_index_spec.rb | 16 ++++++++-------- spec/install/gems/dependency_api_spec.rb | 16 ++++++++-------- spec/install/gems/flex_spec.rb | 4 ++-- spec/install/gems/standalone_spec.rb | 6 +++--- spec/install/git_spec.rb | 4 ++-- spec/install/path_spec.rb | 12 ++++++------ spec/install/post_bundle_message_spec.rb | 4 ++-- spec/install/redownload_spec.rb | 2 +- spec/lock/lockfile_bundler_1_spec.rb | 2 +- spec/lock/lockfile_spec.rb | 4 ++-- spec/other/bundle_ruby_spec.rb | 2 +- spec/other/major_deprecation_spec.rb | 2 +- spec/other/platform_spec.rb | 10 +++++----- spec/plugins/source/example_spec.rb | 8 ++++---- spec/runtime/executable_spec.rb | 4 ++-- spec/runtime/setup_spec.rb | 4 ++-- spec/runtime/with_clean_env_spec.rb | 8 ++++---- spec/update/git_spec.rb | 4 ++-- spec/update/redownload_spec.rb | 2 +- 48 files changed, 146 insertions(+), 146 deletions(-) diff --git a/spec/bundler/cli_spec.rb b/spec/bundler/cli_spec.rb index 73868d10fb..28a3f1a9d9 100644 --- a/spec/bundler/cli_spec.rb +++ b/spec/bundler/cli_spec.rb @@ -27,7 +27,7 @@ RSpec.describe "bundle executable" do end context "with no arguments" do - it "prints a concise help message", :bundler => "2" do + it "prints a concise help message", :bundler => "3" do bundle! "" expect(last_command.stderr).to be_empty expect(last_command.stdout).to include("Bundler version #{Bundler::VERSION}"). @@ -160,12 +160,12 @@ To install the latest version, run `gem install bundler --pre` end RSpec.describe "bundler executable" do - it "shows the bundler version just as the `bundle` executable does", :bundler => "< 2" do + it "shows the bundler version just as the `bundle` executable does", :bundler => "< 3" do bundler "--version" expect(out).to eq("Bundler version #{Bundler::VERSION}") end - it "shows the bundler version just as the `bundle` executable does", :bundler => "2" do + it "shows the bundler version just as the `bundle` executable does", :bundler => "3" do bundler "--version" expect(out).to eq(Bundler::VERSION) end diff --git a/spec/bundler/definition_spec.rb b/spec/bundler/definition_spec.rb index 2ed87ec81d..a38c0b05b0 100644 --- a/spec/bundler/definition_spec.rb +++ b/spec/bundler/definition_spec.rb @@ -32,7 +32,7 @@ RSpec.describe Bundler::Definition do end describe "detects changes" do - it "for a path gem with changes", :bundler => "< 2" do + it "for a path gem with changes", :bundler => "< 3" do build_lib "foo", "1.0", :path => lib_path("foo") install_gemfile <<-G @@ -70,7 +70,7 @@ RSpec.describe Bundler::Definition do G end - it "for a path gem with changes", :bundler => "2" do + it "for a path gem with changes", :bundler => "3" do build_lib "foo", "1.0", :path => lib_path("foo") install_gemfile <<-G @@ -108,7 +108,7 @@ RSpec.describe Bundler::Definition do G end - it "for a path gem with deps and no changes", :bundler => "< 2" do + 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" @@ -145,7 +145,7 @@ RSpec.describe Bundler::Definition do G end - it "for a path gem with deps and no changes", :bundler => "2" do + 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" diff --git a/spec/bundler/dsl_spec.rb b/spec/bundler/dsl_spec.rb index bffe4f1608..dcc816eee2 100644 --- a/spec/bundler/dsl_spec.rb +++ b/spec/bundler/dsl_spec.rb @@ -25,7 +25,7 @@ RSpec.describe Bundler::Dsl do expect { subject.git_source(:example) }.to raise_error(Bundler::InvalidOption) end - context "default hosts (git, gist)", :bundler => "< 2" do + context "default hosts (git, gist)", :bundler => "< 3" do it "converts :github to :git" do subject.gem("sparks", :github => "indirect/sparks") github_uri = "git://github.com/indirect/sparks.git" @@ -63,7 +63,7 @@ RSpec.describe Bundler::Dsl do end end - context "default git sources", :bundler => "2" do + context "default git sources", :bundler => "3" do it "has none" do expect(subject.instance_variable_get(:@git_sources)).to eq({}) end @@ -229,7 +229,7 @@ RSpec.describe Bundler::Dsl do # gem 'spree_api' # gem 'spree_backend' # end - describe "#github", :bundler => "< 2" do + describe "#github", :bundler => "< 3" do it "from github" do spree_gems = %w[spree_core spree_api spree_backend] subject.github "spree" do @@ -242,7 +242,7 @@ RSpec.describe Bundler::Dsl do end end - describe "#github", :bundler => "2" do + describe "#github", :bundler => "3" do it "from github" do expect do spree_gems = %w[spree_core spree_api spree_backend] diff --git a/spec/bundler/source_list_spec.rb b/spec/bundler/source_list_spec.rb index ce3353012c..541a46c6d0 100644 --- a/spec/bundler/source_list_spec.rb +++ b/spec/bundler/source_list_spec.rb @@ -115,7 +115,7 @@ RSpec.describe Bundler::SourceList do end end - describe "#add_rubygems_remote", :bundler => "< 2" do + describe "#add_rubygems_remote", :bundler => "< 3" do let!(:returned_source) { source_list.add_rubygems_remote("https://rubygems.org/") } it "returns the aggregate rubygems source" do @@ -372,7 +372,7 @@ RSpec.describe Bundler::SourceList do source_list.add_git_source("uri" => "git://first-git.org/path.git") end - it "combines the rubygems sources into a single instance, removing duplicate remotes from the end", :bundler => "< 2" do + it "combines the rubygems sources into a single instance, removing duplicate remotes from the end", :bundler => "< 3" do expect(source_list.lock_sources).to eq [ Bundler::Source::Git.new("uri" => "git://first-git.org/path.git"), Bundler::Source::Git.new("uri" => "git://second-git.org/path.git"), @@ -391,7 +391,7 @@ RSpec.describe Bundler::SourceList do ] end - it "returns all sources, without combining rubygems sources", :bundler => "2" 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"]), diff --git a/spec/bundler/ui/shell_spec.rb b/spec/bundler/ui/shell_spec.rb index 951a446aff..6de2330687 100644 --- a/spec/bundler/ui/shell_spec.rb +++ b/spec/bundler/ui/shell_spec.rb @@ -21,7 +21,7 @@ RSpec.describe Bundler::UI::Shell do describe "#warn" do before { subject.level = "warn" } - it "prints to stdout", :bundler => "< 2" do + it "prints to stdout", :bundler => "< 3" do expect { subject.warn("warning") }.to output("warning\n").to_stdout end @@ -46,7 +46,7 @@ RSpec.describe Bundler::UI::Shell do describe "#error" do before { subject.level = "error" } - it "prints to stdout", :bundler => "< 2" do + it "prints to stdout", :bundler => "< 3" do expect { subject.error("error!!!") }.to output("error!!!\n").to_stdout end diff --git a/spec/cache/path_spec.rb b/spec/cache/path_spec.rb index 8c6a843476..12be2dbcf8 100644 --- a/spec/cache/path_spec.rb +++ b/spec/cache/path_spec.rb @@ -86,7 +86,7 @@ expect(bundled_app("vendor/cache/bar-1.0")).not_to exist end - it "raises a warning without --all", :bundler => "< 2" do + it "raises a warning without --all", :bundler => "< 3" do build_lib "foo" install_gemfile <<-G diff --git a/spec/commands/binstubs_spec.rb b/spec/commands/binstubs_spec.rb index ec73770c27..9334216a6c 100644 --- a/spec/commands/binstubs_spec.rb +++ b/spec/commands/binstubs_spec.rb @@ -313,7 +313,7 @@ RSpec.describe "bundle binstubs " do expect(bundled_app("exec/rackup")).to exist end - it "setting is saved for bundle install", :bundler => "< 2" do + it "setting is saved for bundle install", :bundler => "< 3" do install_gemfile <<-G source "file://#{gem_repo1}" gem "rack" diff --git a/spec/commands/check_spec.rb b/spec/commands/check_spec.rb index f2af446fbf..890f4b1356 100644 --- a/spec/commands/check_spec.rb +++ b/spec/commands/check_spec.rb @@ -92,7 +92,7 @@ RSpec.describe "bundle check" do expect(out).to include("Bundler can't satisfy your Gemfile's dependencies.") end - it "remembers --without option from install", :bundler => "< 2" do + it "remembers --without option from install", :bundler => "< 3" do gemfile <<-G source "file://#{gem_repo1}" group :foo do @@ -238,7 +238,7 @@ RSpec.describe "bundle check" do expect(last_command).to be_failure end - context "--path", :bundler => "< 2" do + context "--path", :bundler => "< 3" do before do gemfile <<-G source "file://#{gem_repo1}" @@ -254,7 +254,7 @@ RSpec.describe "bundle check" do expect(out).to include("The Gemfile's dependencies are satisfied") end - it "should write to .bundle/config", :bundler => "< 2" do + it "should write to .bundle/config", :bundler => "< 3" do bundle "check --path vendor/bundle" bundle! "check" end diff --git a/spec/commands/clean_spec.rb b/spec/commands/clean_spec.rb index ff3317bb1d..f53480f421 100644 --- a/spec/commands/clean_spec.rb +++ b/spec/commands/clean_spec.rb @@ -343,7 +343,7 @@ RSpec.describe "bundle clean" do expect(out).to include("rack (1.0.0)").and include("thin (1.0)") end - it "--clean should override the bundle setting on install", :bundler => "< 2" do + it "--clean should override the bundle setting on install", :bundler => "< 3" do gemfile <<-G source "file://#{gem_repo1}" @@ -363,7 +363,7 @@ RSpec.describe "bundle clean" do should_not_have_gems "thin-1.0" end - it "--clean should override the bundle setting on update", :bundler => "< 2" do + it "--clean should override the bundle setting on update", :bundler => "< 3" do build_repo2 gemfile <<-G @@ -383,7 +383,7 @@ RSpec.describe "bundle clean" do should_not_have_gems "foo-1.0" end - it "automatically cleans when path has not been set", :bundler => "2" do + it "automatically cleans when path has not been set", :bundler => "3" do build_repo2 install_gemfile! <<-G diff --git a/spec/commands/console_spec.rb b/spec/commands/console_spec.rb index 9bf66e8f5b..05b0a6c1e4 100644 --- a/spec/commands/console_spec.rb +++ b/spec/commands/console_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "bundle console", :bundler => "< 2" do +RSpec.describe "bundle console", :bundler => "< 3" do before :each do install_gemfile <<-G source "file://#{gem_repo1}" diff --git a/spec/commands/exec_spec.rb b/spec/commands/exec_spec.rb index 587d6cccdc..5ef02e0528 100644 --- a/spec/commands/exec_spec.rb +++ b/spec/commands/exec_spec.rb @@ -570,7 +570,7 @@ RSpec.describe "bundle exec" do it_behaves_like "it runs" end - context "the executable is empty", :bundler => "< 2" do + context "the executable is empty", :bundler => "< 3" do let(:executable) { "" } let(:exit_code) { 0 } @@ -585,7 +585,7 @@ RSpec.describe "bundle exec" do end end - context "the executable is empty", :bundler => "2" do + context "the executable is empty", :bundler => "3" do let(:executable) { "" } let(:exit_code) { 0 } @@ -594,7 +594,7 @@ RSpec.describe "bundle exec" do it_behaves_like "it runs" end - context "the executable raises", :bundler => "< 2" do + context "the executable raises", :bundler => "< 3" do let(:executable) { super() << "\nraise 'ERROR'" } let(:exit_code) { 1 } let(:expected) { super() << "\nbundler: failed to load command: #{path} (#{path})" } @@ -605,7 +605,7 @@ RSpec.describe "bundle exec" do it_behaves_like "it runs" end - context "the executable raises", :bundler => "2" do + context "the executable raises", :bundler => "3" do let(:executable) { super() << "\nraise 'ERROR'" } let(:exit_code) { 1 } let(:expected_err) do @@ -615,7 +615,7 @@ RSpec.describe "bundle exec" do it_behaves_like "it runs" end - context "the executable raises an error without a backtrace", :bundler => "< 2" do + context "the executable raises an error without a backtrace", :bundler => "< 3" do let(:executable) { super() << "\nclass Err < Exception\ndef backtrace; end;\nend\nraise Err" } let(:exit_code) { 1 } let(:expected) { super() << "\nbundler: failed to load command: #{path} (#{path})" } @@ -624,7 +624,7 @@ RSpec.describe "bundle exec" do it_behaves_like "it runs" end - context "the executable raises an error without a backtrace", :bundler => "2" do + context "the executable raises an error without a backtrace", :bundler => "3" do let(:executable) { super() << "\nclass Err < Exception\ndef backtrace; end;\nend\nraise Err" } let(:exit_code) { 1 } let(:expected_err) { "bundler: failed to load command: #{path} (#{path})\nErr: Err" } @@ -638,7 +638,7 @@ RSpec.describe "bundle exec" do it_behaves_like "it runs" end - context "when Bundler.setup fails", :bundler => "< 2" do + context "when Bundler.setup fails", :bundler => "< 3" do before do gemfile <<-G gem 'rack', '2' @@ -655,7 +655,7 @@ RSpec.describe "bundle exec" do it_behaves_like "it runs" end - context "when Bundler.setup fails", :bundler => "2" do + context "when Bundler.setup fails", :bundler => "3" do before do gemfile <<-G gem 'rack', '2' diff --git a/spec/commands/init_spec.rb b/spec/commands/init_spec.rb index 9b5bd95814..e0782f28f7 100644 --- a/spec/commands/init_spec.rb +++ b/spec/commands/init_spec.rb @@ -1,19 +1,19 @@ # frozen_string_literal: true RSpec.describe "bundle init" do - it "generates a Gemfile", :bundler => "< 2" do + it "generates a Gemfile", :bundler => "< 3" do bundle! :init expect(out).to include("Writing new Gemfile") expect(bundled_app("Gemfile")).to be_file end - it "generates a gems.rb", :bundler => "2" do + 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 => "< 2" do + context "when a Gemfile already exists", :bundler => "< 3" do before do create_file "Gemfile", <<-G gem "rails" @@ -30,7 +30,7 @@ RSpec.describe "bundle init" do end end - context "when gems.rb already exists", :bundler => ">= 2" do + context "when gems.rb already exists", :bundler => ">= 3" do before do create_file("gems.rb", <<-G) gem "rails" @@ -47,7 +47,7 @@ RSpec.describe "bundle init" do end end - context "when a Gemfile exists in a parent directory", :bundler => "< 2" do + context "when a Gemfile exists in a parent directory", :bundler => "< 3" do let(:subdir) { "child_dir" } it "lets users generate a Gemfile in a child directory" do @@ -82,7 +82,7 @@ RSpec.describe "bundle init" do end end - context "when a gems.rb file exists in a parent directory", :bundler => ">= 2" do + 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 @@ -99,7 +99,7 @@ RSpec.describe "bundle init" do end end - context "given --gemspec option", :bundler => "< 2" do + context "given --gemspec option", :bundler => "< 3" do let(:spec_file) { tmp.join("test.gemspec") } it "should generate from an existing gemspec" do @@ -146,7 +146,7 @@ RSpec.describe "bundle init" do context "when init_gems_rb setting is enabled" do before { bundle "config init_gems_rb true" } - context "given --gemspec option", :bundler => "< 2" do + context "given --gemspec option", :bundler => "< 3" do let(:spec_file) { tmp.join("test.gemspec") } before do diff --git a/spec/commands/inject_spec.rb b/spec/commands/inject_spec.rb index b7ffc89a34..822644f39a 100644 --- a/spec/commands/inject_spec.rb +++ b/spec/commands/inject_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "bundle inject", :bundler => "< 2" do +RSpec.describe "bundle inject", :bundler => "< 3" do before :each do gemfile <<-G source "file://#{gem_repo1}" diff --git a/spec/commands/install_spec.rb b/spec/commands/install_spec.rb index 394f672fef..326f98161e 100644 --- a/spec/commands/install_spec.rb +++ b/spec/commands/install_spec.rb @@ -29,7 +29,7 @@ RSpec.describe "bundle install with gem sources" do expect(bundled_app("Gemfile.lock")).to exist end - it "does not create ./.bundle by default", :bundler => "< 2" do + it "does not create ./.bundle by default", :bundler => "< 3" do gemfile <<-G source "file://#{gem_repo1}" gem "rack" @@ -275,14 +275,14 @@ RSpec.describe "bundle install with gem sources" do expect(the_bundle).to include_gems "rack 1.0" end - it "allows running bundle install --system without deleting foo", :bundler => "< 2" do + it "allows running bundle install --system without deleting foo", :bundler => "< 3" do bundle "install", forgotten_command_line_options(:path => "vendor") bundle "install", forgotten_command_line_options(:system => true) FileUtils.rm_rf(bundled_app("vendor")) expect(the_bundle).to include_gems "rack 1.0" end - it "allows running bundle install --system after deleting foo", :bundler => "< 2" do + it "allows running bundle install --system after deleting foo", :bundler => "< 3" do bundle "install", forgotten_command_line_options(:path => "vendor") FileUtils.rm_rf(bundled_app("vendor")) bundle "install", forgotten_command_line_options(:system => true) @@ -290,7 +290,7 @@ RSpec.describe "bundle install with gem sources" do end end - it "finds gems in multiple sources", :bundler => "< 2" do + it "finds gems in multiple sources", :bundler => "< 3" do build_repo2 update_repo2 diff --git a/spec/commands/list_spec.rb b/spec/commands/list_spec.rb index 5305176c65..ba4bb9b040 100644 --- a/spec/commands/list_spec.rb +++ b/spec/commands/list_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "bundle list", :bundler => "2" do +RSpec.describe "bundle list", :bundler => "3" do before do install_gemfile <<-G source "file://#{gem_repo1}" diff --git a/spec/commands/outdated_spec.rb b/spec/commands/outdated_spec.rb index fc1f1772e7..c9d3ac1de4 100644 --- a/spec/commands/outdated_spec.rb +++ b/spec/commands/outdated_spec.rb @@ -407,7 +407,7 @@ RSpec.describe "bundle outdated" do expect(out).to include("Installing foo 1.0") end - context "after bundle install --deployment", :bundler => "< 2" do + context "after bundle install --deployment", :bundler => "< 3" do before do install_gemfile <<-G, forgotten_command_line_options(:deployment => true) source "file://#{gem_repo2}" diff --git a/spec/commands/package_spec.rb b/spec/commands/package_spec.rb index 6351909bc7..a8426e6322 100644 --- a/spec/commands/package_spec.rb +++ b/spec/commands/package_spec.rb @@ -141,7 +141,7 @@ RSpec.describe "bundle package" do end end - context "with --path", :bundler => "< 2" do + context "with --path", :bundler => "< 3" do it "sets root directory for gems" do gemfile <<-D source "file://#{gem_repo1}" diff --git a/spec/commands/show_spec.rb b/spec/commands/show_spec.rb index efbe4b13fb..bf96ec489a 100644 --- a/spec/commands/show_spec.rb +++ b/spec/commands/show_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "bundle show", :bundler => "< 2", :ruby => ">= 2.0" do +RSpec.describe "bundle show", :bundler => "< 3", :ruby => ">= 2.0" do context "with a standard Gemfile" do before :each do install_gemfile <<-G diff --git a/spec/commands/update_spec.rb b/spec/commands/update_spec.rb index 6eb49d3acd..1effba6526 100644 --- a/spec/commands/update_spec.rb +++ b/spec/commands/update_spec.rb @@ -11,7 +11,7 @@ RSpec.describe "bundle update" do G end - describe "with no arguments", :bundler => "< 2" do + describe "with no arguments", :bundler => "< 3" do it "updates the entire bundle" do update_repo2 do build_gem "activesupport", "3.0" @@ -34,7 +34,7 @@ RSpec.describe "bundle update" do end end - describe "with --all", :bundler => "2" do + describe "with --all", :bundler => "3" do it "updates the entire bundle" do update_repo2 do build_gem "activesupport", "3.0" @@ -279,7 +279,7 @@ RSpec.describe "bundle update" do end describe "in a frozen bundle" do - it "should fail loudly", :bundler => "< 2" do + it "should fail loudly", :bundler => "< 3" do bundle! "install --deployment" bundle "update", :all => bundle_update_requires_all? @@ -288,14 +288,14 @@ RSpec.describe "bundle update" do expect(out).to match(/freeze \nby running `bundle install --no-deployment`./m) end - it "should suggest different command when frozen is set globally", :bundler => "< 2" do + 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) end - it "should suggest different command when frozen is set globally", :bundler => "2" do + 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). @@ -304,7 +304,7 @@ RSpec.describe "bundle update" do end describe "with --source option" do - it "should not update gems not included in the source that happen to have the same name", :bundler => "< 2" do + it "should not update gems not included in the source that happen to have the same name", :bundler => "< 3" do install_gemfile! <<-G source "file://#{gem_repo2}" gem "activesupport" @@ -315,7 +315,7 @@ RSpec.describe "bundle update" do expect(the_bundle).to include_gem "activesupport 3.0" end - it "should not update gems not included in the source that happen to have the same name", :bundler => "2" do + it "should not update gems not included in the source that happen to have the same name", :bundler => "3" do install_gemfile! <<-G source "file://#{gem_repo2}" gem "activesupport" @@ -358,7 +358,7 @@ RSpec.describe "bundle update" do G end - it "should not update the child dependencies of a gem that has the same name as the source", :bundler => "< 2" do + it "should not update the child dependencies of a gem that has the same name as the source", :bundler => "< 3" do update_repo2 do build_gem "fred", "2.0" build_gem "harry", "2.0" do |s| @@ -371,7 +371,7 @@ RSpec.describe "bundle update" do expect(the_bundle).to include_gems "fred 1.0" end - it "should not update the child dependencies of a gem that has the same name as the source", :bundler => "2" do + it "should not update the child dependencies of a gem that has the same name as the source", :bundler => "3" do update_repo2 do build_gem "fred", "2.0" build_gem "harry", "2.0" do |s| @@ -403,7 +403,7 @@ RSpec.describe "bundle update" do G end - it "should not update the child dependencies of a gem that has the same name as the source", :bundler => "< 2" do + it "should not update the child dependencies of a gem that has the same name as the source", :bundler => "< 3" do update_repo2 do build_gem "george", "2.0" build_gem "harry", "2.0" do |s| @@ -417,7 +417,7 @@ RSpec.describe "bundle update" do expect(the_bundle).to include_gems "george 1.0" end - it "should not update the child dependencies of a gem that has the same name as the source", :bundler => "2" do + it "should not update the child dependencies of a gem that has the same name as the source", :bundler => "3" do update_repo2 do build_gem "george", "2.0" build_gem "harry", "2.0" do |s| @@ -561,14 +561,14 @@ RSpec.describe "bundle update when a gem depends on a newer version of bundler" G end - it "should explain that bundler conflicted", :bundler => "< 2" do + it "should explain that bundler conflicted", :bundler => "< 3" do bundle "update", :all => bundle_update_requires_all? 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) end - it "should warn that the newer version of Bundler would conflict", :bundler => "2" do + it "should warn that the newer version of Bundler would conflict", :bundler => "3" do bundle! "update", :all => true expect(last_command.bundler_err).to include("rails (3.0.1) has dependency bundler"). and include("so the dependency is being ignored") @@ -577,7 +577,7 @@ RSpec.describe "bundle update when a gem depends on a newer version of bundler" end RSpec.describe "bundle update" do - it "shows the previous version of the gem when updated from rubygems source", :bundler => "< 2" do + it "shows the previous version of the gem when updated from rubygems source", :bundler => "< 3" do build_repo2 install_gemfile <<-G diff --git a/spec/commands/version_spec.rb b/spec/commands/version_spec.rb index b919c25e0f..66c7930397 100644 --- a/spec/commands/version_spec.rb +++ b/spec/commands/version_spec.rb @@ -2,36 +2,36 @@ RSpec.describe "bundle version" do context "with -v" do - it "outputs the version", :bundler => "< 2" do + it "outputs the version", :bundler => "< 3" do bundle! "-v" expect(out).to eq("Bundler version #{Bundler::VERSION}") end - it "outputs the version", :bundler => "2" do + it "outputs the version", :bundler => "3" do bundle! "-v" expect(out).to eq(Bundler::VERSION) end end context "with --version" do - it "outputs the version", :bundler => "< 2" do + it "outputs the version", :bundler => "< 3" do bundle! "--version" expect(out).to eq("Bundler version #{Bundler::VERSION}") end - it "outputs the version", :bundler => "2" do + it "outputs the version", :bundler => "3" do bundle! "--version" expect(out).to eq(Bundler::VERSION) end end context "with version" do - it "outputs the version with build metadata", :bundler => "< 2" do + it "outputs the version with build metadata", :bundler => "< 3" do bundle! "version" expect(out).to match(/\ABundler version #{Regexp.escape(Bundler::VERSION)} \(\d{4}-\d{2}-\d{2} commit [a-fA-F0-9]{7,}\)\z/) end - it "outputs the version with build metadata", :bundler => "2" do + it "outputs the version with build metadata", :bundler => "3" do bundle! "version" expect(out).to match(/\A#{Regexp.escape(Bundler::VERSION)} \(\d{4}-\d{2}-\d{2} commit [a-fA-F0-9]{7,}\)\z/) end diff --git a/spec/commands/viz_spec.rb b/spec/commands/viz_spec.rb index 3804d3561c..61414956a9 100644 --- a/spec/commands/viz_spec.rb +++ b/spec/commands/viz_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "bundle viz", :ruby => "1.9.3", :bundler => "< 2", :if => Bundler.which("dot") do +RSpec.describe "bundle viz", :ruby => "1.9.3", :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/install/binstubs_spec.rb b/spec/install/binstubs_spec.rb index 23eb691ab8..f04d3fe654 100644 --- a/spec/install/binstubs_spec.rb +++ b/spec/install/binstubs_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "bundle install", :bundler => "< 2" do +RSpec.describe "bundle install", :bundler => "< 3" 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 => "< 2" do end end - describe "when multiple gems contain the same exe", :bundler => "< 2" do + describe "when multiple gems contain the same exe", :bundler => "< 3" do before do build_repo2 do build_gem "fake", "14" do |s| diff --git a/spec/install/deploy_spec.rb b/spec/install/deploy_spec.rb index 491801e27a..26a062cf79 100644 --- a/spec/install/deploy_spec.rb +++ b/spec/install/deploy_spec.rb @@ -8,7 +8,7 @@ RSpec.describe "install with --deployment or --frozen" do G end - context "with CLI flags", :bundler => "< 2" 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") @@ -109,11 +109,11 @@ RSpec.describe "install with --deployment or --frozen" do bundle "install" end - it "works with the --deployment flag if you didn't change anything", :bundler => "< 2" do + it "works with the --deployment flag if you didn't change anything", :bundler => "< 3" do bundle! "install --deployment" end - it "works with the --frozen flag if you didn't change anything", :bundler => "< 2" do + it "works with the --frozen flag if you didn't change anything", :bundler => "< 3" do bundle! "install --frozen" end @@ -165,7 +165,7 @@ RSpec.describe "install with --deployment or --frozen" do expect(out).to include("The path `#{lib_path("path_gem-1.0")}` does not exist.") end - it "can have --frozen set via an environment variable", :bundler => "< 2" do + it "can have --frozen set via an environment variable", :bundler => "< 3" do gemfile <<-G source "file://#{gem_repo1}" gem "rack" diff --git a/spec/install/gemfile/gemspec_spec.rb b/spec/install/gemfile/gemspec_spec.rb index 7ce037730e..bbb56da5a4 100644 --- a/spec/install/gemfile/gemspec_spec.rb +++ b/spec/install/gemfile/gemspec_spec.rb @@ -433,7 +433,7 @@ RSpec.describe "bundle install from an existing gemspec" do end end - context "on ruby", :bundler => "< 2" do + context "on ruby", :bundler => "< 3" do before do simulate_platform("ruby") bundle :install @@ -534,7 +534,7 @@ RSpec.describe "bundle install from an existing gemspec" do end end - context "on ruby", :bundler => "2" do + context "on ruby", :bundler => "3" do before do simulate_platform("ruby") bundle :install diff --git a/spec/install/gemfile/git_spec.rb b/spec/install/gemfile/git_spec.rb index 7f7a1ae4c9..1d4c68decb 100644 --- a/spec/install/gemfile/git_spec.rb +++ b/spec/install/gemfile/git_spec.rb @@ -26,7 +26,7 @@ RSpec.describe "bundle install with git sources" do expect(out).to eq("WIN") end - it "caches the git repo", :bundler => "< 2" do + it "caches the git repo", :bundler => "< 3" do expect(Dir["#{default_bundle_path}/cache/bundler/git/foo-1.0-*"]).to have_attributes :size => 1 end diff --git a/spec/install/gemfile/groups_spec.rb b/spec/install/gemfile/groups_spec.rb index 19c379e188..45395e606f 100644 --- a/spec/install/gemfile/groups_spec.rb +++ b/spec/install/gemfile/groups_spec.rb @@ -192,19 +192,19 @@ RSpec.describe "bundle install with groups" do expect(the_bundle).not_to include_gems "thin 1.0" end - it "does remove groups from without when passed at --with", :bundler => "< 2" do + it "does remove groups from without when passed at --with", :bundler => "< 3" do bundle :install, forgotten_command_line_options(:without => "emo") bundle :install, forgotten_command_line_options(:with => "emo") expect(the_bundle).to include_gems "activesupport 2.3.5" end - it "does remove groups from with when passed at --without", :bundler => "< 2" do + it "does remove groups from with when passed at --without", :bundler => "< 3" do bundle :install, forgotten_command_line_options(:with => "debugging") bundle :install, forgotten_command_line_options(:without => "debugging") expect(the_bundle).not_to include_gem "thin 1.0" end - it "errors out when passing a group to with and without via CLI flags", :bundler => "< 2" 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") diff --git a/spec/install/gemfile/path_spec.rb b/spec/install/gemfile/path_spec.rb index f7789e7ea5..a508c971ad 100644 --- a/spec/install/gemfile/path_spec.rb +++ b/spec/install/gemfile/path_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.describe "bundle install with explicit source paths" do - it "fetches gems with a global path source", :bundler => "< 2" do + it "fetches gems with a global path source", :bundler => "< 3" do build_lib "foo" install_gemfile <<-G diff --git a/spec/install/gemfile/platform_spec.rb b/spec/install/gemfile/platform_spec.rb index 6c226eb29f..9a848b8396 100644 --- a/spec/install/gemfile/platform_spec.rb +++ b/spec/install/gemfile/platform_spec.rb @@ -230,7 +230,7 @@ RSpec.describe "bundle install across platforms" do expect(the_bundle).to include_gems "nokogiri 1.4.2 JAVA", "weakling 0.0.3" end - it "works with gems that have extra platform-specific runtime dependencies", :bundler => "< 2" do + it "works with gems that have extra platform-specific runtime dependencies", :bundler => "< 3" do simulate_platform x64_mac update_repo2 do diff --git a/spec/install/gemfile/sources_spec.rb b/spec/install/gemfile/sources_spec.rb index c814d0de76..efe6ccce7f 100644 --- a/spec/install/gemfile/sources_spec.rb +++ b/spec/install/gemfile/sources_spec.rb @@ -28,7 +28,7 @@ RSpec.describe "bundle install with gems on multiple sources" do bundle "config major_deprecations true" end - it "warns about ambiguous gems, but installs anyway, prioritizing sources last to first", :bundler => "< 2" do + it "warns about ambiguous gems, but installs anyway, prioritizing sources last to first", :bundler => "< 3" do bundle :install expect(out).to have_major_deprecation a_string_including("Your Gemfile contains multiple primary sources.") @@ -58,7 +58,7 @@ RSpec.describe "bundle install with gems on multiple sources" do bundle "config major_deprecations true" end - it "warns about ambiguous gems, but installs anyway", :bundler => "< 2" do + it "warns about ambiguous gems, but installs anyway", :bundler => "< 3" do bundle :install expect(out).to have_major_deprecation a_string_including("Your Gemfile contains multiple primary sources.") @@ -248,7 +248,7 @@ RSpec.describe "bundle install with gems on multiple sources" do G end - it "installs from the other source and warns about ambiguous gems", :bundler => "< 2" do + 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.") @@ -276,7 +276,7 @@ RSpec.describe "bundle install with gems on multiple sources" do G end - it "installs the dependency from the pinned source without warning", :bundler => "< 2" do + it "installs the dependency from the pinned source without warning", :bundler => "< 3" do bundle :install expect(out).not_to include("Warning: the gem 'rack' was found in multiple sources.") diff --git a/spec/install/gems/compact_index_spec.rb b/spec/install/gems/compact_index_spec.rb index 02a37a77d5..2acade1166 100644 --- a/spec/install/gems/compact_index_spec.rb +++ b/spec/install/gems/compact_index_spec.rb @@ -269,7 +269,7 @@ The checksum of /versions does not match the checksum provided by the server! So expect(last_command.stdboth).not_to include "Double checking" end - it "fetches again when more dependencies are found in subsequent sources", :bundler => "< 2" do + it "fetches again when more dependencies are found in subsequent sources", :bundler => "< 3" do build_repo2 do build_gem "back_deps" do |s| s.add_dependency "foo" @@ -328,7 +328,7 @@ The checksum of /versions does not match the checksum provided by the server! So expect(the_bundle).to include_gems "rack 1.2" end - it "considers all possible versions of dependencies from all api gem sources", :bundler => "< 2" do + it "considers all possible versions of dependencies from all api gem sources", :bundler => "< 3" do # In this scenario, the gem "somegem" only exists in repo4. It depends on specific version of activesupport that # exists only in repo1. There happens also be a version of activesupport in repo4, but not the one that version 1.0.0 # of somegem wants. This test makes sure that bundler actually finds version 1.2.3 of active support in the other @@ -352,7 +352,7 @@ The checksum of /versions does not match the checksum provided by the server! So expect(the_bundle).to include_gems "activesupport 1.2.3" end - it "considers all possible versions of dependencies from all api gem sources when using blocks", :bundler => "< 2" do + it "considers all possible versions of dependencies from all api gem sources when using blocks", :bundler => "< 3" do # In this scenario, the gem "somegem" only exists in repo4. It depends on specific version of activesupport that # exists only in repo1. There happens also be a version of activesupport in repo4, but not the one that version 1.0.0 # of somegem wants. This test makes sure that bundler actually finds version 1.2.3 of active support in the other @@ -458,7 +458,7 @@ The checksum of /versions does not match the checksum provided by the server! So expect(the_bundle).to include_gems "foo 1.0" end - it "fetches again when more dependencies are found in subsequent sources using --deployment", :bundler => "< 2" do + it "fetches again when more dependencies are found in subsequent sources using --deployment", :bundler => "< 3" do build_repo2 do build_gem "back_deps" do |s| s.add_dependency "foo" @@ -522,7 +522,7 @@ The checksum of /versions does not match the checksum provided by the server! So expect(the_bundle).to include_gems "rails 2.3.2" end - it "installs the binstubs", :bundler => "< 2" do + it "installs the binstubs", :bundler => "< 3" do gemfile <<-G source "#{source_uri}" gem "rack" @@ -534,7 +534,7 @@ The checksum of /versions does not match the checksum provided by the server! So expect(out).to eq("1.0.0") end - it "installs the bins when using --path and uses autoclean", :bundler => "< 2" do + it "installs the bins when using --path and uses autoclean", :bundler => "< 3" do gemfile <<-G source "#{source_uri}" gem "rack" @@ -545,7 +545,7 @@ The checksum of /versions does not match the checksum provided by the server! So expect(vendored_gems("bin/rackup")).to exist end - it "installs the bins when using --path and uses bundle clean", :bundler => "< 2" do + it "installs the bins when using --path and uses bundle clean", :bundler => "< 3" do gemfile <<-G source "#{source_uri}" gem "rack" @@ -620,7 +620,7 @@ The checksum of /versions does not match the checksum provided by the server! So expect(out).not_to include("#{user}:#{password}") end - it "strips http basic auth creds when warning about ambiguous sources", :bundler => "< 2" do + it "strips http basic auth creds when warning about ambiguous sources", :bundler => "< 3" do gemfile <<-G source "#{basic_auth_source_uri}" source "file://#{gem_repo1}" diff --git a/spec/install/gems/dependency_api_spec.rb b/spec/install/gems/dependency_api_spec.rb index 2ffe4b62d7..3cb98db1eb 100644 --- a/spec/install/gems/dependency_api_spec.rb +++ b/spec/install/gems/dependency_api_spec.rb @@ -243,7 +243,7 @@ RSpec.describe "gemcutter's dependency API" do end end - it "fetches again when more dependencies are found in subsequent sources", :bundler => "< 2" do + it "fetches again when more dependencies are found in subsequent sources", :bundler => "< 3" do build_repo2 do build_gem "back_deps" do |s| s.add_dependency "foo" @@ -302,7 +302,7 @@ RSpec.describe "gemcutter's dependency API" do expect(the_bundle).to include_gems "rack 1.2" end - it "considers all possible versions of dependencies from all api gem sources", :bundler => "< 2" do + it "considers all possible versions of dependencies from all api gem sources", :bundler => "< 3" do # In this scenario, the gem "somegem" only exists in repo4. It depends on specific version of activesupport that # exists only in repo1. There happens also be a version of activesupport in repo4, but not the one that version 1.0.0 # of somegem wants. This test makes sure that bundler actually finds version 1.2.3 of active support in the other @@ -372,7 +372,7 @@ RSpec.describe "gemcutter's dependency API" do expect(out).to include("Fetching source index from http://localgemserver.test/extra") end - it "does not fetch every spec if the index of gems is large when doing back deps", :bundler => "< 2" do + it "does not fetch every spec if the index of gems is large when doing back deps", :bundler => "< 3" do build_repo2 do build_gem "back_deps" do |s| s.add_dependency "foo" @@ -432,7 +432,7 @@ RSpec.describe "gemcutter's dependency API" do expect(the_bundle).to include_gems "foo 1.0" end - it "fetches again when more dependencies are found in subsequent sources using --deployment", :bundler => "< 2" do + it "fetches again when more dependencies are found in subsequent sources using --deployment", :bundler => "< 3" do build_repo2 do build_gem "back_deps" do |s| s.add_dependency "foo" @@ -496,7 +496,7 @@ RSpec.describe "gemcutter's dependency API" do expect(the_bundle).to include_gems "rails 2.3.2" end - it "installs the binstubs", :bundler => "< 2" do + it "installs the binstubs", :bundler => "< 3" do gemfile <<-G source "#{source_uri}" gem "rack" @@ -508,7 +508,7 @@ RSpec.describe "gemcutter's dependency API" do expect(out).to eq("1.0.0") end - it "installs the bins when using --path and uses autoclean", :bundler => "< 2" do + it "installs the bins when using --path and uses autoclean", :bundler => "< 3" do gemfile <<-G source "#{source_uri}" gem "rack" @@ -519,7 +519,7 @@ RSpec.describe "gemcutter's dependency API" do expect(vendored_gems("bin/rackup")).to exist end - it "installs the bins when using --path and uses bundle clean", :bundler => "< 2" do + it "installs the bins when using --path and uses bundle clean", :bundler => "< 3" do gemfile <<-G source "#{source_uri}" gem "rack" @@ -594,7 +594,7 @@ RSpec.describe "gemcutter's dependency API" do expect(out).not_to include("#{user}:#{password}") end - it "strips http basic auth creds when warning about ambiguous sources", :bundler => "< 2" do + it "strips http basic auth creds when warning about ambiguous sources", :bundler => "< 3" do gemfile <<-G source "#{basic_auth_source_uri}" source "file://#{gem_repo1}" diff --git a/spec/install/gems/flex_spec.rb b/spec/install/gems/flex_spec.rb index 37d2e4958a..736f418ec7 100644 --- a/spec/install/gems/flex_spec.rb +++ b/spec/install/gems/flex_spec.rb @@ -244,7 +244,7 @@ RSpec.describe "bundle flex_install" do end describe "when adding a new source" do - it "updates the lockfile", :bundler => "< 2" do + it "updates the lockfile", :bundler => "< 3" do build_repo2 install_gemfile! <<-G source "file://localhost#{gem_repo1}" @@ -274,7 +274,7 @@ RSpec.describe "bundle flex_install" do L end - it "updates the lockfile", :bundler => "2" do + it "updates the lockfile", :bundler => "3" do build_repo2 install_gemfile! <<-G source "file://localhost#{gem_repo1}" diff --git a/spec/install/gems/standalone_spec.rb b/spec/install/gems/standalone_spec.rb index b149d9d00b..eecf6f2e7e 100644 --- a/spec/install/gems/standalone_spec.rb +++ b/spec/install/gems/standalone_spec.rb @@ -197,7 +197,7 @@ RSpec.shared_examples "bundle install --standalone" do expect(last_command.stderr).to eq("ZOMG LOAD ERROR") end - it "allows --path to change the location of the standalone bundle", :bundler => "< 2" do + it "allows --path to change the location of the standalone bundle", :bundler => "< 3" do bundle! "install", forgotten_command_line_options(:path => "path/to/bundle").merge(:standalone => true) Dir.chdir(bundled_app) do @@ -213,7 +213,7 @@ RSpec.shared_examples "bundle install --standalone" do expect(last_command.stdout).to eq("2.3.2") end - it "allows --path to change the location of the standalone bundle", :bundler => "2" do + it "allows --path to change the location of the standalone bundle", :bundler => "3" do bundle! "install", forgotten_command_line_options(:path => "path/to/bundle").merge(:standalone => true) path = File.expand_path("path/to/bundle") @@ -273,7 +273,7 @@ RSpec.shared_examples "bundle install --standalone" do end end - describe "with --binstubs", :bundler => "< 2" do + describe "with --binstubs", :bundler => "< 3" do before do gemfile <<-G source "file://#{gem_repo1}" diff --git a/spec/install/git_spec.rb b/spec/install/git_spec.rb index 6ae718c2a4..48086a86c7 100644 --- a/spec/install/git_spec.rb +++ b/spec/install/git_spec.rb @@ -2,7 +2,7 @@ RSpec.describe "bundle install" do context "git sources" do - it "displays the revision hash of the gem repository", :bundler => "< 2" do + it "displays the revision hash of the gem repository", :bundler => "< 3" do build_git "foo", "1.0", :path => lib_path("foo") install_gemfile <<-G @@ -14,7 +14,7 @@ RSpec.describe "bundle install" do expect(the_bundle).to include_gems "foo 1.0", :source => "git@#{lib_path("foo")}" end - it "displays the ref of the gem repository when using branch~num as a ref", :bundler => "< 2" do + it "displays the ref of the gem repository when using branch~num as a ref", :bundler => "< 3" do build_git "foo", "1.0", :path => lib_path("foo") rev = revision_for(lib_path("foo"))[0..6] update_git "foo", "2.0", :path => lib_path("foo"), :gemspec => true diff --git a/spec/install/path_spec.rb b/spec/install/path_spec.rb index 5f3fedb862..8d0961daea 100644 --- a/spec/install/path_spec.rb +++ b/spec/install/path_spec.rb @@ -13,7 +13,7 @@ RSpec.describe "bundle install" do G end - it "does not use available system gems with bundle --path vendor/bundle", :bundler => "< 2" do + it "does not use available system gems with bundle --path vendor/bundle", :bundler => "< 3" do bundle! :install, forgotten_command_line_options(:path => "vendor/bundle") expect(the_bundle).to include_gems "rack 1.0.0" end @@ -35,13 +35,13 @@ RSpec.describe "bundle install" do expect(out).to include("gems are installed into `./vendor/bundle`") end - it "disallows --path vendor/bundle --system", :bundler => "< 2" 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(exitstatus).to eq(15) if exitstatus end - it "remembers to disable system gems after the first time with bundle --path vendor/bundle", :bundler => "< 2" do + it "remembers to disable system gems after the first time with bundle --path vendor/bundle", :bundler => "< 3" do bundle "install --path vendor/bundle" FileUtils.rm_rf bundled_app("vendor") bundle "install" @@ -53,7 +53,7 @@ RSpec.describe "bundle install" do context "with path_relative_to_cwd set to true" do before { bundle! "config path_relative_to_cwd true" } - it "installs the bundle relatively to current working directory", :bundler => "< 2" do + it "installs the bundle relatively to current working directory", :bundler => "< 3" do Dir.chdir(bundled_app.parent) do bundle! "install --gemfile='#{bundled_app}/Gemfile' --path vendor/bundle" expect(out).to include("installed into `./vendor/bundle`") @@ -113,7 +113,7 @@ RSpec.describe "bundle install" do expect(the_bundle).to include_gems "rack 1.0.0" end - context "with global_path_appends_ruby_scope set", :bundler => "2" 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" @@ -147,7 +147,7 @@ RSpec.describe "bundle install" do end end - context "with global_path_appends_ruby_scope unset", :bundler => "< 2" 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" diff --git a/spec/install/post_bundle_message_spec.rb b/spec/install/post_bundle_message_spec.rb index eadc8a4d85..c41dc67458 100644 --- a/spec/install/post_bundle_message_spec.rb +++ b/spec/install/post_bundle_message_spec.rb @@ -101,7 +101,7 @@ RSpec.describe "post bundle message" do end describe "with misspelled or non-existent gem name" do - it "should report a helpful error message", :bundler => "< 2" do + it "should report a helpful error message", :bundler => "< 3" do install_gemfile <<-G source "file://localhost#{gem_repo1}" gem "rack" @@ -110,7 +110,7 @@ RSpec.describe "post bundle message" do expect(out).to include("Could not find gem 'not-a-gem' in any of the gem sources listed in your Gemfile.") end - it "should report a helpful error message", :bundler => "2" do + it "should report a helpful error message", :bundler => "3" do install_gemfile <<-G source "file://localhost#{gem_repo1}" gem "rack" diff --git a/spec/install/redownload_spec.rb b/spec/install/redownload_spec.rb index 665c64d49a..25d49999fc 100644 --- a/spec/install/redownload_spec.rb +++ b/spec/install/redownload_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "bundle install", :bundler => "< 2", :ruby => ">= 2.0" do +RSpec.describe "bundle install", :bundler => "< 3", :ruby => ">= 2.0" do before :each do gemfile <<-G source "file://#{gem_repo1}" diff --git a/spec/lock/lockfile_bundler_1_spec.rb b/spec/lock/lockfile_bundler_1_spec.rb index a8615d4c89..4d969efcb1 100644 --- a/spec/lock/lockfile_bundler_1_spec.rb +++ b/spec/lock/lockfile_bundler_1_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "the lockfile format", :bundler => "< 2" do +RSpec.describe "the lockfile format", :bundler => "< 3" do include Bundler::GemHelpers before { ENV["BUNDLER_SPEC_IGNORE_COMPATIBILITY_GUARD"] = "TRUE" } diff --git a/spec/lock/lockfile_spec.rb b/spec/lock/lockfile_spec.rb index 53c832445f..9e2fb3b2dd 100644 --- a/spec/lock/lockfile_spec.rb +++ b/spec/lock/lockfile_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "the lockfile format", :bundler => "2" do +RSpec.describe "the lockfile format", :bundler => "3" do include Bundler::GemHelpers before { ENV["BUNDLER_SPEC_IGNORE_COMPATIBILITY_GUARD"] = "TRUE" } @@ -428,7 +428,7 @@ RSpec.describe "the lockfile format", :bundler => "2" do 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", :bundler => "< 2" do + it "generates a simple lockfile for a single pinned source, gem with a version requirement", :bundler => "< 3" do git = build_git "foo" install_gemfile <<-G diff --git a/spec/other/bundle_ruby_spec.rb b/spec/other/bundle_ruby_spec.rb index a7da9cbec9..fbca31d0a0 100644 --- a/spec/other/bundle_ruby_spec.rb +++ b/spec/other/bundle_ruby_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "bundle_ruby", :bundler => "< 2" do +RSpec.describe "bundle_ruby", :bundler => "< 3" do context "without patchlevel" do it "returns the ruby version" do gemfile <<-G diff --git a/spec/other/major_deprecation_spec.rb b/spec/other/major_deprecation_spec.rb index fba177b497..a147d053e1 100644 --- a/spec/other/major_deprecation_spec.rb +++ b/spec/other/major_deprecation_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "major deprecations", :bundler => "< 2" do +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)? >= .*/, "") } diff --git a/spec/other/platform_spec.rb b/spec/other/platform_spec.rb index ca74945563..96527e1641 100644 --- a/spec/other/platform_spec.rb +++ b/spec/other/platform_spec.rb @@ -633,7 +633,7 @@ G end end - it "fails if ruby version doesn't match", :bundler => "< 2" do + it "fails if ruby version doesn't match", :bundler => "< 3" do gemfile <<-G source "file://#{gem_repo1}" gem "rails" @@ -645,7 +645,7 @@ G should_be_ruby_version_incorrect end - it "fails if engine doesn't match", :bundler => "< 2" do + it "fails if engine doesn't match", :bundler => "< 3" do gemfile <<-G source "file://#{gem_repo1}" gem "rails" @@ -657,7 +657,7 @@ G should_be_engine_incorrect end - it "fails if engine version doesn't match", :bundler => "< 2" do + it "fails if engine version doesn't match", :bundler => "< 3" do simulate_ruby_engine "jruby" do gemfile <<-G source "file://#{gem_repo1}" @@ -671,7 +671,7 @@ G end end - it "fails when patchlevel doesn't match", :bundler => "< 2" do + it "fails when patchlevel doesn't match", :bundler => "< 3" do gemfile <<-G source "file://#{gem_repo1}" gem "rack" @@ -928,7 +928,7 @@ G end end - context "bundle console", :bundler => "< 2" do + context "bundle console", :bundler => "< 3" do before do install_gemfile <<-G source "file://#{gem_repo1}" diff --git a/spec/plugins/source/example_spec.rb b/spec/plugins/source/example_spec.rb index fd30892f63..d9a3cd2b92 100644 --- a/spec/plugins/source/example_spec.rb +++ b/spec/plugins/source/example_spec.rb @@ -67,7 +67,7 @@ RSpec.describe "real source plugins" do expect(the_bundle).to include_gems("a-path-gem 1.0") end - it "writes to lock file", :bundler => "< 2" do + it "writes to lock file", :bundler => "< 3" do bundle "install" lockfile_should_be <<-G @@ -92,7 +92,7 @@ RSpec.describe "real source plugins" do G end - it "writes to lock file", :bundler => "2" do + it "writes to lock file", :bundler => "3" do bundle "install" lockfile_should_be <<-G @@ -359,7 +359,7 @@ RSpec.describe "real source plugins" do expect(the_bundle).to include_gems("ma-gitp-gem 1.0") end - it "writes to lock file", :bundler => "< 2" do + it "writes to lock file", :bundler => "< 3" do revision = revision_for(lib_path("ma-gitp-gem-1.0")) bundle "install" @@ -386,7 +386,7 @@ RSpec.describe "real source plugins" do G end - it "writes to lock file", :bundler => "2" do + it "writes to lock file", :bundler => "3" do revision = revision_for(lib_path("ma-gitp-gem-1.0")) bundle "install" diff --git a/spec/runtime/executable_spec.rb b/spec/runtime/executable_spec.rb index dcee234e15..7ba510a509 100644 --- a/spec/runtime/executable_spec.rb +++ b/spec/runtime/executable_spec.rb @@ -99,7 +99,7 @@ RSpec.describe "Running bin/* commands" do expect(bundled_app("bin/rackup")).not_to exist end - it "allows you to stop installing binstubs", :bundler => "< 2" do + it "allows you to stop installing binstubs", :bundler => "< 3" do bundle! "install --binstubs bin/" bundled_app("bin/rackup").rmtree bundle! "install --binstubs \"\"" @@ -110,7 +110,7 @@ RSpec.describe "Running bin/* commands" do expect(out).to include("You have not configured a value for `bin`") end - it "remembers that the option was specified", :bundler => "< 2" do + it "remembers that the option was specified", :bundler => "< 3" do gemfile <<-G source "file://#{gem_repo1}" gem "activesupport" diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb index 1979ede829..9395f0e1e4 100644 --- a/spec/runtime/setup_spec.rb +++ b/spec/runtime/setup_spec.rb @@ -1394,7 +1394,7 @@ end end describe "after setup" do - it "allows calling #gem on random objects", :bundler => "< 2" do + it "allows calling #gem on random objects", :bundler => "< 3" do install_gemfile <<-G source "file:#{gem_repo1}" gem "rack" @@ -1409,7 +1409,7 @@ end expect(out).to eq("rack-1.0.0") end - it "keeps Kernel#gem private", :bundler => "2" do + it "keeps Kernel#gem private", :bundler => "3" do install_gemfile! <<-G source "file:#{gem_repo1}" gem "rack" diff --git a/spec/runtime/with_clean_env_spec.rb b/spec/runtime/with_clean_env_spec.rb index fd621071ad..ed5f7fe3b6 100644 --- a/spec/runtime/with_clean_env_spec.rb +++ b/spec/runtime/with_clean_env_spec.rb @@ -63,7 +63,7 @@ RSpec.describe "Bundler.with_env helpers" do end end - describe "Bundler.clean_env", :bundler => "< 2" do + describe "Bundler.clean_env", :bundler => "< 3" do before do bundle "config path vendor/bundle" gemfile "" @@ -116,7 +116,7 @@ RSpec.describe "Bundler.with_env helpers" do end end - describe "Bundler.with_clean_env", :bundler => "< 2" do + 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 } @@ -132,14 +132,14 @@ RSpec.describe "Bundler.with_env helpers" do end end - describe "Bundler.clean_system", :ruby => ">= 1.9", :bundler => "< 2" do + 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 => "< 2" do + 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)) diff --git a/spec/update/git_spec.rb b/spec/update/git_spec.rb index b4cbb79434..d97760e84b 100644 --- a/spec/update/git_spec.rb +++ b/spec/update/git_spec.rb @@ -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 => "< 2" 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'" @@ -335,7 +335,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 => "2" 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'" diff --git a/spec/update/redownload_spec.rb b/spec/update/redownload_spec.rb index 018d3ed2e9..2138af510c 100644 --- a/spec/update/redownload_spec.rb +++ b/spec/update/redownload_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "bundle update", :bundler => "< 2", :ruby => ">= 2.0" do +RSpec.describe "bundle update", :bundler => "< 3", :ruby => ">= 2.0" do before :each do install_gemfile <<-G source "file://#{gem_repo1}" -- cgit v1.2.1 From 11b34e0541eafa475f9ba8437938bb747d23fbe4 Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Sun, 4 Nov 2018 12:24:09 +1100 Subject: adjust major_deprecation version for relevent features --- exe/bundle_ruby | 2 +- lib/bundler.rb | 4 ++-- lib/bundler/capistrano.rb | 2 +- lib/bundler/cli.rb | 10 +++++----- lib/bundler/cli/console.rb | 2 +- lib/bundler/cli/install.rb | 2 +- lib/bundler/cli/update.rb | 2 +- lib/bundler/deployment.rb | 2 +- lib/bundler/dsl.rb | 10 +++++----- lib/bundler/rubygems_integration.rb | 2 +- lib/bundler/settings.rb | 2 +- lib/bundler/shared_helpers.rb | 4 ++-- lib/bundler/vlad.rb | 2 +- 13 files changed, 23 insertions(+), 23 deletions(-) diff --git a/exe/bundle_ruby b/exe/bundle_ruby index df6f8cc8a1..2209c6195f 100755 --- a/exe/bundle_ruby +++ b/exe/bundle_ruby @@ -3,7 +3,7 @@ require "bundler/shared_helpers" -Bundler::SharedHelpers.major_deprecation(2, "the bundle_ruby executable has been removed in favor of `bundle platform --ruby`") +Bundler::SharedHelpers.major_deprecation(3, "the bundle_ruby executable has been removed in favor of `bundle platform --ruby`") Signal.trap("INT") { exit 1 } diff --git a/lib/bundler.rb b/lib/bundler.rb index 1cb3b4fb21..cf3a289df2 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -119,7 +119,7 @@ module Bundler end def environment - SharedHelpers.major_deprecation 2, "Bundler.environment has been removed in favor of Bundler.load" + SharedHelpers.major_deprecation 3, "Bundler.environment has been removed in favor of Bundler.load" load end @@ -283,7 +283,7 @@ EOF # @deprecated Use `original_env` instead # @return [Hash] Environment with all bundler-related variables removed def clean_env - Bundler::SharedHelpers.major_deprecation(2, "`Bundler.clean_env` has weird edge cases, use `.original_env` instead") + Bundler::SharedHelpers.major_deprecation(3, "`Bundler.clean_env` has weird edge cases, use `.original_env` instead") env = original_env if env.key?("BUNDLER_ORIG_MANPATH") diff --git a/lib/bundler/capistrano.rb b/lib/bundler/capistrano.rb index 1b7145b72b..40e2e5dbe8 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 2, +Bundler::SharedHelpers.major_deprecation 3, "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 e658ffce72..3efe193613 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -229,7 +229,7 @@ module Bundler "Include gems that are part of the specified named group." map "i" => "install" def install - SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force") + SharedHelpers.major_deprecation(3, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force") require "bundler/cli/install" Bundler.settings.temporary(:no_install => false) do Install.new(options.dup).run @@ -275,7 +275,7 @@ module Bundler method_option "all", :type => :boolean, :banner => "Update everything." def update(*gems) - SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force") + SharedHelpers.major_deprecation(3, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force") require "bundler/cli/update" Update.new(options, gems).run end @@ -303,7 +303,7 @@ module Bundler 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}`") + 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 @@ -537,7 +537,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 2, "The `viz` command has been moved to the `bundle-viz` gem, see https://github.com/bundler/bundler-viz" + SharedHelpers.major_deprecation 3, "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 @@ -608,7 +608,7 @@ module Bundler method_option "group", :type => :string, :banner => "Install gem into a bundler group" def inject(name, version) - SharedHelpers.major_deprecation 2, "The `inject` command has been replaced by the `add` command" + SharedHelpers.major_deprecation 3, "The `inject` command has been replaced by the `add` command" require "bundler/cli/inject" Inject.new(options.dup, name, version).run end diff --git a/lib/bundler/cli/console.rb b/lib/bundler/cli/console.rb index 853eca8358..d45f30cdcf 100644 --- a/lib/bundler/cli/console.rb +++ b/lib/bundler/cli/console.rb @@ -9,7 +9,7 @@ module Bundler end def run - Bundler::SharedHelpers.major_deprecation 2, "bundle console will be replaced " \ + Bundler::SharedHelpers.major_deprecation 3, "bundle console will be replaced " \ "by `bin/console` generated by `bundle gem `" group ? Bundler.require(:default, *(group.split.map!(&:to_sym))) : Bundler.require diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb index b40e5f0e9e..55e90ead0e 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 2, + Bundler::SharedHelpers.major_deprecation 3, "The --binstubs option will be removed in favor of `bundle binstubs`" end diff --git a/lib/bundler/cli/update.rb b/lib/bundler/cli/update.rb index b088853768..bf300a8437 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 2, "Pass --all to `bundle update` to update everything" + SharedHelpers.major_deprecation 3, "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/deployment.rb b/lib/bundler/deployment.rb index 291e158ca0..4c8f48d405 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 2, "Bundler no longer integrates with " \ +Bundler::SharedHelpers.major_deprecation 3, "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 ab59477145..2cdfe338ea 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -194,7 +194,7 @@ module Bundler " end\n\n" raise DeprecatedError, msg if Bundler.feature_flag.disable_multisource? - SharedHelpers.major_deprecation(2, msg.strip) + SharedHelpers.major_deprecation(3, msg.strip) end source_options = normalize_hash(options).merge( @@ -306,7 +306,7 @@ module Bundler 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 2, "The `github.https` setting will be removed" + Bundler::SharedHelpers.major_deprecation 3, "The `github.https` setting will be removed" "https://github.com/#{repo_name}.git" else "git://github.com/#{repo_name}.git" @@ -456,7 +456,7 @@ repo_name ||= user_name def normalize_source(source) case source when :gemcutter, :rubygems, :rubyforge - Bundler::SharedHelpers.major_deprecation 2, "The source :#{source} is deprecated because HTTP " \ + Bundler::SharedHelpers.major_deprecation 3, "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" @@ -480,7 +480,7 @@ repo_name ||= user_name end raise GemfileEvalError, msg else - Bundler::SharedHelpers.major_deprecation 2, "Your Gemfile contains multiple primary sources. " \ + Bundler::SharedHelpers.major_deprecation 3, "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. " \ @@ -498,7 +498,7 @@ repo_name ||= user_name "do |repo_name|\n#{replacement.to_s.gsub(/^/, " ")}\n end" end - Bundler::SharedHelpers.major_deprecation 2, <<-EOS + Bundler::SharedHelpers.major_deprecation 3, <<-EOS The :#{name} git source is deprecated, and will be removed in Bundler 2.0.#{additional_message} Add this code to the top of your Gemfile to ensure it continues to work: git_source(:#{name}) #{replacement} diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index 783d106e7b..f088c2fdfb 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -465,7 +465,7 @@ module Bundler 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 2, + Bundler::SharedHelpers.major_deprecation 3, "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." diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb index fe68d510ff..f7077f71d4 100644 --- a/lib/bundler/settings.rb +++ b/lib/bundler/settings.rb @@ -112,7 +112,7 @@ module Bundler "bundle config #{key} #{Array(value).join(":")}" end - Bundler::SharedHelpers.major_deprecation 2,\ + 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 " \ diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb index 79883b5253..f0f576f931 100644 --- a/lib/bundler/shared_helpers.rb +++ b/lib/bundler/shared_helpers.rb @@ -157,8 +157,8 @@ module Bundler next if gemfiles.empty? break false if gemfiles.size == 1 end - if multiple_gemfiles && Bundler.bundler_major_version == 1 - Bundler::SharedHelpers.major_deprecation 2, \ + 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 diff --git a/lib/bundler/vlad.rb b/lib/bundler/vlad.rb index 68181e7db8..a6b13435c9 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 2, +Bundler::SharedHelpers.major_deprecation 3, "The Bundler task for Vlad" # Vlad task for Bundler. -- cgit v1.2.1 From 856da395b4920fcecb1375462e0fd899cb61f6bf Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Sun, 4 Nov 2018 21:38:20 +1100 Subject: puts major upgrade warning under a feature flag --- lib/bundler/definition.rb | 2 +- lib/bundler/feature_flag.rb | 1 + lib/bundler/settings.rb | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 8e56d4a9bc..c5e94c7123 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 + if @locked_bundler_version && Bundler.feature_flag.lockfile_upgrade_warning? locked_major = @locked_bundler_version.segments.first current_major = Gem::Version.create(Bundler::VERSION).segments.first diff --git a/lib/bundler/feature_flag.rb b/lib/bundler/feature_flag.rb index 15ba825c51..e3266da8ab 100644 --- a/lib/bundler/feature_flag.rb +++ b/lib/bundler/feature_flag.rb @@ -44,6 +44,7 @@ module Bundler 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") } diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb index f7077f71d4..66af31dab2 100644 --- a/lib/bundler/settings.rb +++ b/lib/bundler/settings.rb @@ -40,6 +40,7 @@ module Bundler ignore_messages init_gems_rb list_command + lockfile_upgrade_warning lockfile_uses_separate_rubygems_sources major_deprecations no_install -- cgit v1.2.1 From ed413c68c653827e7430ce3eac2140fd7d95edc1 Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Sun, 4 Nov 2018 21:38:35 +1100 Subject: bump features/flags in spec helpers to bundler 3 --- spec/bundler/ui/shell_spec.rb | 4 ++-- spec/support/helpers.rb | 2 +- spec/support/path.rb | 2 +- spec/support/platforms.rb | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/bundler/ui/shell_spec.rb b/spec/bundler/ui/shell_spec.rb index 6de2330687..951a446aff 100644 --- a/spec/bundler/ui/shell_spec.rb +++ b/spec/bundler/ui/shell_spec.rb @@ -21,7 +21,7 @@ RSpec.describe Bundler::UI::Shell do describe "#warn" do before { subject.level = "warn" } - it "prints to stdout", :bundler => "< 3" do + it "prints to stdout", :bundler => "< 2" do expect { subject.warn("warning") }.to output("warning\n").to_stdout end @@ -46,7 +46,7 @@ RSpec.describe Bundler::UI::Shell do describe "#error" do before { subject.level = "error" } - it "prints to stdout", :bundler => "< 3" do + it "prints to stdout", :bundler => "< 2" do expect { subject.error("error!!!") }.to output("error!!!\n").to_stdout end diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index d64b3923d5..dbe5c665e5 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -51,7 +51,7 @@ module Spec end def bundle_update_requires_all? - Bundler::VERSION.start_with?("1.") ? nil : true + Bundler::VERSION.start_with?("2.") ? nil : true end def in_app_root(&blk) diff --git a/spec/support/path.rb b/spec/support/path.rb index b24ac16d5b..a8bc50f5f4 100644 --- a/spec/support/path.rb +++ b/spec/support/path.rb @@ -29,7 +29,7 @@ module Spec end def default_bundle_path(*path) - if Bundler::VERSION.split(".").first.to_i < 2 + if Bundler::VERSION.split(".").first.to_i < 3 system_gem_path(*path) else bundled_app(*[".bundle", ENV.fetch("BUNDLER_SPEC_RUBY_ENGINE", Gem.ruby_engine), Gem::ConfigMap[:ruby_version], *path].compact) diff --git a/spec/support/platforms.rb b/spec/support/platforms.rb index 39040a61bd..950311d20e 100644 --- a/spec/support/platforms.rb +++ b/spec/support/platforms.rb @@ -106,7 +106,7 @@ module Spec end def local_platforms - if Bundler::VERSION.split(".").first.to_i > 1 + if Bundler::VERSION.split(".").first.to_i > 2 [local, specific_local_platform] else [local] -- cgit v1.2.1 From 36687280a7f0d8455ffbffb0339452291b5bc10e Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Mon, 5 Nov 2018 09:43:08 +1100 Subject: fix breaking specs --- spec/commands/binstubs_spec.rb | 27 +++++++++++++++++++++ spec/commands/clean_spec.rb | 2 +- spec/commands/exec_spec.rb | 41 +++----------------------------- spec/commands/init_spec.rb | 2 +- spec/commands/pristine_spec.rb | 2 +- spec/commands/show_spec.rb | 8 +++---- spec/install/deploy_spec.rb | 2 +- spec/install/post_bundle_message_spec.rb | 2 +- spec/install/redownload_spec.rb | 4 ++-- spec/other/major_deprecation_spec.rb | 10 ++++---- spec/other/platform_spec.rb | 2 +- spec/quality_spec.rb | 1 + spec/realworld/edgecases_spec.rb | 4 ++-- spec/support/helpers.rb | 2 +- spec/update/redownload_spec.rb | 8 +++---- 15 files changed, 55 insertions(+), 62 deletions(-) diff --git a/spec/commands/binstubs_spec.rb b/spec/commands/binstubs_spec.rb index 9334216a6c..82b40c887a 100644 --- a/spec/commands/binstubs_spec.rb +++ b/spec/commands/binstubs_spec.rb @@ -134,6 +134,33 @@ RSpec.describe "bundle binstubs " do 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"]) diff --git a/spec/commands/clean_spec.rb b/spec/commands/clean_spec.rb index f53480f421..99789f0257 100644 --- a/spec/commands/clean_spec.rb +++ b/spec/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::VERSION.start_with?("1.") ? vendored_gems("cache/bundler/git/foo-1.0-#{digest}") : home(".bundle/cache/git/foo-1.0-#{digest}") + cache_path = Bundler.bundler_major_version < 3 ? vendored_gems("cache/bundler/git/foo-1.0-#{digest}") : home(".bundle/cache/git/foo-1.0-#{digest}") expect(cache_path).to exist end diff --git a/spec/commands/exec_spec.rb b/spec/commands/exec_spec.rb index 5ef02e0528..904b54d52d 100644 --- a/spec/commands/exec_spec.rb +++ b/spec/commands/exec_spec.rb @@ -570,22 +570,7 @@ RSpec.describe "bundle exec" do it_behaves_like "it runs" end - context "the executable is empty", :bundler => "< 3" do - let(:executable) { "" } - - let(:exit_code) { 0 } - let(:expected) { "#{path} is empty" } - let(:expected_err) { "" } - if LessThanProc.with(RUBY_VERSION).call("1.9") - # Kernel#exec in ruby < 1.9 will raise Errno::ENOEXEC if the command content is empty, - # even if the command is set as an executable. - pending "Kernel#exec is different" - else - it_behaves_like "it runs" - end - end - - context "the executable is empty", :bundler => "3" do + context "the executable is empty" do let(:executable) { "" } let(:exit_code) { 0 } @@ -594,18 +579,7 @@ RSpec.describe "bundle exec" do it_behaves_like "it runs" end - context "the executable raises", :bundler => "< 3" do - let(:executable) { super() << "\nraise 'ERROR'" } - let(:exit_code) { 1 } - let(:expected) { super() << "\nbundler: failed to load command: #{path} (#{path})" } - let(:expected_err) do - "RuntimeError: ERROR\n #{path}:10" + - (Bundler.current_ruby.ruby_18? ? "" : ":in `'") - end - it_behaves_like "it runs" - end - - context "the executable raises", :bundler => "3" do + context "the executable raises" do let(:executable) { super() << "\nraise 'ERROR'" } let(:exit_code) { 1 } let(:expected_err) do @@ -615,16 +589,7 @@ RSpec.describe "bundle exec" do it_behaves_like "it runs" end - context "the executable raises an error without a backtrace", :bundler => "< 3" do - let(:executable) { super() << "\nclass Err < Exception\ndef backtrace; end;\nend\nraise Err" } - let(:exit_code) { 1 } - let(:expected) { super() << "\nbundler: failed to load command: #{path} (#{path})" } - let(:expected_err) { "Err: Err" } - - it_behaves_like "it runs" - end - - context "the executable raises an error without a backtrace", :bundler => "3" do + context "the executable raises an error without a backtrace" do let(:executable) { super() << "\nclass Err < Exception\ndef backtrace; end;\nend\nraise Err" } let(:exit_code) { 1 } let(:expected_err) { "bundler: failed to load command: #{path} (#{path})\nErr: Err" } diff --git a/spec/commands/init_spec.rb b/spec/commands/init_spec.rb index e0782f28f7..8a8f0effa0 100644 --- a/spec/commands/init_spec.rb +++ b/spec/commands/init_spec.rb @@ -115,7 +115,7 @@ RSpec.describe "bundle init" do bundle :init, :gemspec => spec_file - gemfile = if Bundler::VERSION[0, 2] == "1." + gemfile = if Bundler::VERSION[0, 2].to_i < 3 bundled_app("Gemfile").read else bundled_app("gems.rb").read diff --git a/spec/commands/pristine_spec.rb b/spec/commands/pristine_spec.rb index a780cbfb5b..20adb13a2c 100644 --- a/spec/commands/pristine_spec.rb +++ b/spec/commands/pristine_spec.rb @@ -49,7 +49,7 @@ RSpec.describe "bundle pristine" do bundle! "pristine", :system_bundler => true bundle! "-v", :system_bundler => true - expected = if Bundler::VERSION < "2.0" + expected = if Bundler::VERSION < "3.0" "Bundler version" else Bundler::VERSION diff --git a/spec/commands/show_spec.rb b/spec/commands/show_spec.rb index bf96ec489a..a5c6beec1a 100644 --- a/spec/commands/show_spec.rb +++ b/spec/commands/show_spec.rb @@ -36,7 +36,7 @@ RSpec.describe "bundle show", :bundler => "< 3", :ruby => ">= 2.0" do it "prints path if gem exists in bundle" do bundle "show rails" expect(out).to eq( - "[DEPRECATED FOR 2.0] use `bundle info rails` instead of `bundle show rails`\n" + + "[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 @@ -44,7 +44,7 @@ RSpec.describe "bundle show", :bundler => "< 3", :ruby => ">= 2.0" do it "prints the path to the running bundler" do bundle "show bundler" expect(out).to eq( - "[DEPRECATED FOR 2.0] use `bundle info bundler` instead of `bundle show bundler`\n" + + "[DEPRECATED FOR 3.0] use `bundle info bundler` instead of `bundle show bundler`\n" + root.to_s ) end @@ -52,7 +52,7 @@ RSpec.describe "bundle show", :bundler => "< 3", :ruby => ">= 2.0" do it "prints path if gem exists in bundle (with --paths option)" do bundle "show rails --paths" expect(out).to eq( - "[DEPRECATED FOR 2.0] use `bundle info rails --path` instead of `bundle show rails --paths`\n" + + "[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 @@ -64,7 +64,7 @@ RSpec.describe "bundle show", :bundler => "< 3", :ruby => ">= 2.0" do expect(out).to include(default_bundle_path("gems", "rails-2.3.2").to_s) out_lines = out.split("\n") - expect(out_lines[0]).to eq("[DEPRECATED FOR 2.0] use `bundle list` instead of `bundle show --paths`") + 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 } diff --git a/spec/install/deploy_spec.rb b/spec/install/deploy_spec.rb index 26a062cf79..f3c47d7aa9 100644 --- a/spec/install/deploy_spec.rb +++ b/spec/install/deploy_spec.rb @@ -297,7 +297,7 @@ RSpec.describe "install with --deployment or --frozen" do context "when replacing a host with the same host with credentials" do let(:success_message) do - if Bundler::VERSION.split(".", 2).first == "1" + if Bundler.bundler_major_version < 3 "Could not reach host localgemserver.test" else "Bundle complete!" diff --git a/spec/install/post_bundle_message_spec.rb b/spec/install/post_bundle_message_spec.rb index c41dc67458..394134f523 100644 --- a/spec/install/post_bundle_message_spec.rb +++ b/spec/install/post_bundle_message_spec.rb @@ -19,7 +19,7 @@ RSpec.describe "post bundle message" do let(:bundle_complete_message) { "Bundle complete!" } let(:bundle_updated_message) { "Bundle updated!" } let(:installed_gems_stats) { "4 Gemfile dependencies, 5 gems now installed." } - let(:bundle_show_message) { Bundler::VERSION.split(".").first.to_i < 2 ? bundle_show_system_message : bundle_show_path_message } + let(:bundle_show_message) { Bundler::VERSION.split(".").first.to_i < 3 ? bundle_show_system_message : bundle_show_path_message } describe "for fresh bundle install" do it "without any options" do diff --git a/spec/install/redownload_spec.rb b/spec/install/redownload_spec.rb index 25d49999fc..f9caeed58a 100644 --- a/spec/install/redownload_spec.rb +++ b/spec/install/redownload_spec.rb @@ -65,12 +65,12 @@ RSpec.describe "bundle install", :bundler => "< 3", :ruby => ">= 2.0" do it "shows a deprecation when single flag passed" do bundle! "install --force" - expect(out).to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`" + expect(out).to include "[DEPRECATED FOR 3.0] 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 2.0] The `--force` option has been renamed to `--redownload`" + expect(out).to include "[DEPRECATED FOR 3.0] The `--force` option has been renamed to `--redownload`" end end diff --git a/spec/other/major_deprecation_spec.rb b/spec/other/major_deprecation_spec.rb index a147d053e1..32827dbd54 100644 --- a/spec/other/major_deprecation_spec.rb +++ b/spec/other/major_deprecation_spec.rb @@ -205,7 +205,7 @@ The :github git source is deprecated, and will be removed in Bundler 2.0. Change git_source(:github) {|repo_name| "https://github.com/\#{repo_name}.git" } EOS - expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, msg) + expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, msg) subject.gem("sparks", :github => "indirect/sparks") end @@ -217,8 +217,8 @@ The :github git source is deprecated, and will be removed in Bundler 2.0. Change git_source(:github) {|repo_name| "https://github.com/\#{repo_name}.git" } EOS - expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, msg) - expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, "The `github.https` setting will be removed") + 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) @@ -238,7 +238,7 @@ The :bitbucket git source is deprecated, and will be removed in Bundler 2.0. Add end EOS - expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, msg) + expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, msg) subject.gem("not-really-a-gem", :bitbucket => "mcorp/flatlab-rails") end end @@ -250,7 +250,7 @@ The :bitbucket git source is deprecated, and will be removed in Bundler 2.0. Add "in Bundler 2.0. Add this code to the top of your Gemfile to ensure it " \ "continues to work:\n\n git_source(:gist) {|repo_name| " \ "\"https://gist.github.com/\#{repo_name}.git\" }\n\n" - expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, msg) + expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, msg) subject.gem("not-really-a-gem", :gist => "1234") end end diff --git a/spec/other/platform_spec.rb b/spec/other/platform_spec.rb index 96527e1641..6c59fd893c 100644 --- a/spec/other/platform_spec.rb +++ b/spec/other/platform_spec.rb @@ -4,7 +4,7 @@ RSpec.describe "bundle platform" do context "without flags" do let(:bundle_platform_platforms_string) do platforms = [rb] - platforms.unshift(specific_local_platform) if Bundler.feature_flag.bundler_2_mode? + platforms.unshift(specific_local_platform) if Bundler.feature_flag.bundler_3_mode? platforms.map {|pl| "* #{pl}" }.join("\n") end diff --git a/spec/quality_spec.rb b/spec/quality_spec.rb index 5ebe0baff4..317c799573 100644 --- a/spec/quality_spec.rb +++ b/spec/quality_spec.rb @@ -177,6 +177,7 @@ RSpec.describe "The library itself" do gem.coc gem.mit inline + lockfile_upgrade_warning lockfile_uses_separate_rubygems_sources use_gem_version_promoter_for_major_updates viz_command diff --git a/spec/realworld/edgecases_spec.rb b/spec/realworld/edgecases_spec.rb index aa60e20b8a..bbfd0f68fd 100644 --- a/spec/realworld/edgecases_spec.rb +++ b/spec/realworld/edgecases_spec.rb @@ -57,7 +57,7 @@ RSpec.describe "real world edgecases", :realworld => true, :sometimes => true do expect(lockfile).to include("activemodel (3.0.5)") end - it "resolves dependencies correctly", :ruby => "1.9.3" do + it "resolves dependencies correctly", :ruby => "<= 1.9.3" do gemfile <<-G source "https://rubygems.org" @@ -70,7 +70,7 @@ RSpec.describe "real world edgecases", :realworld => true, :sometimes => true do expect(lockfile).to include("capybara (2.2.1)") end - it "installs the latest version of gxapi_rails", :ruby => "1.9.3" do + it "installs the latest version of gxapi_rails", :ruby => "<= 1.9.3" do gemfile <<-G source "https://rubygems.org" diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index dbe5c665e5..4bc3cef0cf 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -150,7 +150,7 @@ module Spec bang :bundle def forgotten_command_line_options(options) - remembered = Bundler::VERSION.split(".", 2).first == "1" + remembered = Bundler.bundler_major_version < 3 options = options.map do |k, v| k = Array(k)[remembered ? 0 : -1] v = '""' if v && v.to_s.empty? diff --git a/spec/update/redownload_spec.rb b/spec/update/redownload_spec.rb index 2138af510c..1bbc3a66fc 100644 --- a/spec/update/redownload_spec.rb +++ b/spec/update/redownload_spec.rb @@ -13,24 +13,24 @@ RSpec.describe "bundle update", :bundler => "< 3", :ruby => ">= 2.0" do describe "with --force" do it "shows a deprecation when single flag passed" do bundle! "update rack --force" - expect(out).to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`" + expect(out).to include "[DEPRECATED FOR 3.0] The `--force` option has been renamed to `--redownload`" end it "shows a deprecation when multiple flags passed" do bundle! "update rack --no-color --force" - expect(out).to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`" + expect(out).to include "[DEPRECATED FOR 3.0] 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 2.0] The `--force` option has been renamed to `--redownload`" + expect(out).not_to include "[DEPRECATED FOR 3.0] 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 2.0] The `--force` option has been renamed to `--redownload`" + expect(out).not_to include "[DEPRECATED FOR 3.0] The `--force` option has been renamed to `--redownload`" end end end -- cgit v1.2.1 From 1ed33414488f358c946bcca44234641f8a4847d1 Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Sun, 4 Nov 2018 11:48:30 +1100 Subject: Version 2.0.0.pre.1 with changelog --- CHANGELOG.md | 10 ++++++++++ lib/bundler/version.rb | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 33b9528d31..9ad7e06612 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +## 2.0.0.pre.1 (2018-11-09) + +Breaking Changes: + + - Dropped support for versions of Ruby < 2.3 + - Dropped support for version of RubyGems < 2.5 + - Moved error messages from STDOUT to STDERR + +Note: To upgrade your Gemfile to Bundler 2 you will need to run `bundle update --bundler` + ## 1.17.1 (2018-10-25) - Convert `Pathname`s to `String`s before sorting them, fixing #6760 and #6758 ([#6761](https://github.com/bundler/bundler/pull/6761), @alexggordon) diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb index 02ec96adc9..25a72b272e 100644 --- a/lib/bundler/version.rb +++ b/lib/bundler/version.rb @@ -7,7 +7,7 @@ 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 = "1.17.1" unless defined?(::Bundler::VERSION) + VERSION = "2.0.0.pre.1" unless defined?(::Bundler::VERSION) def self.overwrite_loaded_gem_version begin -- cgit v1.2.1 From ca4837445a672ae002c4bc0f5dceed31750423f9 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Tue, 16 Oct 2018 03:08:58 +0000 Subject: Merge #6740 6740: Removed win32-open3 workaround. r=colby-swandale a=hsbt ### What was the end-user problem that led to this PR? `win32-open3` gem was required Ruby 1.8 with Windows environment. Because RubyInstaller2 only provides the version of Ruby 2.1+. ### What is your fix for the problem, implemented in this PR? Removed needless workaround. Co-authored-by: SHIBATA Hiroshi (cherry picked from commit 6063718bc6c77b6a16621741f94866d6555f4cee) --- spec/spec_helper.rb | 11 ----------- spec/support/helpers.rb | 2 ++ 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 90a88fac5b..21a9a5a050 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -46,17 +46,6 @@ end require "bundler" -# Require the correct version of popen for the current platform -if RbConfig::CONFIG["host_os"] =~ /mingw|mswin/ - begin - require "win32/open3" - rescue LoadError - abort "Run `gem install win32-open3` to be able to run specs" - end -else - require "open3" -end - Dir["#{File.expand_path("../support", __FILE__)}/*.rb"].each do |file| file = file.gsub(%r{\A#{Regexp.escape File.expand_path("..", __FILE__)}/}, "") require file unless file.end_with?("hax.rb") diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index 4bc3cef0cf..d523234f70 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require "open3" + module Spec module Helpers def reset! -- cgit v1.2.1 From 110f841537f96649983b24b3ad002989e7143f26 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Tue, 16 Oct 2018 22:59:35 +0000 Subject: Merge #6741 6741: Support Windows platform with ruby core repository. r=hsbt a=hsbt In Windows environment, ':' is always contained path variable. See our original commit and its message https://github.com/ruby/ruby/commit/f35fb6d36c3218988b17dbeb4412922c23745f0e Co-authored-by: SHIBATA Hiroshi (cherry picked from commit 3a69ee35ef3e536ca616770906a4099d40b73c70) --- spec/spec_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 21a9a5a050..63787168b5 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -40,7 +40,7 @@ if ENV.select {|k, _v| k =~ /TRAVIS/ }.any? && Gem::Version.new(Gem::VERSION) > end end -if File.expand_path(__FILE__) =~ %r{([^\w/\.-])} +if File.expand_path(__FILE__) =~ %r{([^\w/\.:\-])} abort "The bundler specs cannot be run from a path that contains special characters (particularly #{$1.inspect})" end -- cgit v1.2.1 From 2dd5d81402bbeb17f31fc371513033753daf4a10 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Wed, 17 Oct 2018 11:34:13 +0000 Subject: Merge #6742 6742: Use helper method instead of hard-code path. r=colby-swandale a=hsbt ### What was the end-user problem that led to this PR? In ruby core repository, We need to replace executable file like `ruby`, `rake`, `gem`. ### What is your fix for the problem, implemented in this PR? This pull request makes hard-coded executable file to the helper methods. Co-authored-by: SHIBATA Hiroshi (cherry picked from commit 3cc783b9495f85b8c3fea480d888c4f032942e89) --- spec/commands/newgem_spec.rb | 4 ++-- spec/runtime/gem_tasks_spec.rb | 4 ++-- spec/support/helpers.rb | 4 ++++ spec/support/rubygems_ext.rb | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/spec/commands/newgem_spec.rb b/spec/commands/newgem_spec.rb index 4b5db87b00..598d68ec3a 100644 --- a/spec/commands/newgem_spec.rb +++ b/spec/commands/newgem_spec.rb @@ -327,7 +327,7 @@ RSpec.describe "bundle gem" do end Dir.chdir(bundled_app(gem_name)) do - sys_exec("rake") + sys_exec(rake) expect(out).to include("SUCCESS") end end @@ -612,7 +612,7 @@ RSpec.describe "bundle gem" do end Dir.chdir(bundled_app(gem_name)) do - sys_exec("rake") + sys_exec(rake) expect(out).to include("SUCCESS") end end diff --git a/spec/runtime/gem_tasks_spec.rb b/spec/runtime/gem_tasks_spec.rb index 5fc87a6d46..1cf808f35b 100644 --- a/spec/runtime/gem_tasks_spec.rb +++ b/spec/runtime/gem_tasks_spec.rb @@ -19,7 +19,7 @@ RSpec.describe "require 'bundler/gem_tasks'" do it "includes the relevant tasks" do with_gem_path_as(Spec::Path.base_system_gems.to_s) do - sys_exec "ruby -S rake -T" + sys_exec "#{rake} -T" end expect(err).to eq("") @@ -37,7 +37,7 @@ RSpec.describe "require 'bundler/gem_tasks'" do it "adds 'pkg' to rake/clean's CLOBBER" do with_gem_path_as(Spec::Path.base_system_gems.to_s) do - sys_exec! %('#{Gem.ruby}' -S rake -e 'load "Rakefile"; puts CLOBBER.inspect') + sys_exec! %(#{rake} -e 'load "Rakefile"; puts CLOBBER.inspect') end expect(last_command.stdout).to eq '["pkg"]' end diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index d523234f70..b86f8e25c0 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -216,6 +216,10 @@ module Spec end bang :gem_command + def rake + "#{Gem.ruby} -S #{ENV["GEM_PATH"]}/bin/rake" + end + def sys_exec(cmd) command_execution = CommandExecution.new(cmd.to_s, Dir.pwd) diff --git a/spec/support/rubygems_ext.rb b/spec/support/rubygems_ext.rb index 806933fe2f..c18f7650fc 100644 --- a/spec/support/rubygems_ext.rb +++ b/spec/support/rubygems_ext.rb @@ -33,7 +33,7 @@ module Spec ENV["BUNDLE_PATH"] = nil ENV["GEM_HOME"] = ENV["GEM_PATH"] = Path.base_system_gems.to_s - ENV["PATH"] = ["#{Path.root}/exe", "#{Path.system_gem_path}/bin", ENV["PATH"]].join(File::PATH_SEPARATOR) + ENV["PATH"] = [Path.bindir, "#{Path.system_gem_path}/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" -- cgit v1.2.1 From 02cd16945342a5a74051c04d208337f170464f34 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Fri, 16 Nov 2018 02:44:32 +0000 Subject: Merge #6743 6743: Support file structure of ruby core repository. r=hsbt a=hsbt In the ruby core repository, I put bundler executable and bundler libraries under the `bin` and `lib` directories. It breaks the current behavior. Support the structure of ruby core repository. Co-authored-by: SHIBATA Hiroshi (cherry picked from commit 172ec59db53ec05a91c0d9eb72e2d715ae82f3c0) --- bundler.gemspec | 8 +++++++- lib/bundler/shared_helpers.rb | 16 ++++++++++++--- spec/bundler/cli_spec.rb | 3 ++- spec/bundler/env_spec.rb | 2 +- spec/bundler/mirror_spec.rb | 2 +- spec/bundler/shared_helpers_spec.rb | 3 ++- spec/bundler/ssl_certs/certificate_manager_spec.rb | 9 +++++++-- spec/commands/binstubs_spec.rb | 2 +- spec/commands/clean_spec.rb | 4 ++-- spec/commands/exec_spec.rb | 10 +++++----- spec/commands/info_spec.rb | 2 +- spec/commands/newgem_spec.rb | 5 ++++- spec/commands/pristine_spec.rb | 2 +- spec/commands/show_spec.rb | 2 +- spec/install/deploy_spec.rb | 2 +- spec/install/gemfile/git_spec.rb | 6 +++--- spec/install/gemfile/platform_spec.rb | 14 ++++++------- spec/install/gems/native_extensions_spec.rb | 2 +- spec/install/gems/resolving_spec.rb | 6 +++--- spec/install/gems/standalone_spec.rb | 2 +- spec/install/global_cache_spec.rb | 2 +- spec/install/path_spec.rb | 2 +- spec/lock/lockfile_bundler_1_spec.rb | 2 +- spec/quality_spec.rb | 23 ++++++++++++++-------- spec/runtime/gem_tasks_spec.rb | 2 +- spec/runtime/setup_spec.rb | 11 ++++++----- spec/runtime/with_clean_env_spec.rb | 6 +++--- spec/spec_helper.rb | 16 +++++++++++++++ spec/support/helpers.rb | 9 +++++++-- spec/support/path.rb | 19 ++++++++++++++---- 30 files changed, 130 insertions(+), 64 deletions(-) diff --git a/bundler.gemspec b/bundler.gemspec index a06e969a96..26fc32278a 100644 --- a/bundler.gemspec +++ b/bundler.gemspec @@ -1,7 +1,13 @@ # coding: utf-8 # frozen_string_literal: true -require File.expand_path("../lib/bundler/version", __FILE__) +begin + require File.expand_path("../lib/bundler/version", __FILE__) +rescue LoadError + # for Ruby core repository + require File.expand_path("../bundler/version", __FILE__) +end + require "shellwords" Gem::Specification.new do |s| diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb index f0f576f931..50214901c5 100644 --- a/lib/bundler/shared_helpers.rb +++ b/lib/bundler/shared_helpers.rb @@ -274,7 +274,15 @@ module Bundler until !File.directory?(current) || current == previous if ENV["BUNDLE_SPEC_RUN"] # avoid stepping above the tmp directory when testing - return nil if File.file?(File.join(current, "bundler.gemspec")) + gemspec = if ENV["BUNDLE_RUBY"] && ENV["BUNDLE_GEM"] + # for Ruby Core + "lib/bundler.gemspec" + else + "bundler.gemspec" + end + + # avoid stepping above the tmp directory when testing + return nil if File.file?(File.join(current, gemspec)) end names.each do |name| @@ -303,10 +311,12 @@ module Bundler unless File.exist?(exe_file) exe_file = File.expand_path("../../../exe/bundle", __FILE__) end - Bundler::SharedHelpers.set_env "BUNDLE_BIN_PATH", exe_file rescue Gem::GemNotFoundException - Bundler::SharedHelpers.set_env "BUNDLE_BIN_PATH", File.expand_path("../../../exe/bundle", __FILE__) + exe_file = File.expand_path("../../../exe/bundle", __FILE__) + # for Ruby core repository + exe_file = File.expand_path("../../../../bin/bundle", __FILE__) unless File.exist?(exe_file) + Bundler::SharedHelpers.set_env "BUNDLE_BIN_PATH", exe_file end # Set BUNDLE_GEMFILE diff --git a/spec/bundler/cli_spec.rb b/spec/bundler/cli_spec.rb index 28a3f1a9d9..9a2591ac96 100644 --- a/spec/bundler/cli_spec.rb +++ b/spec/bundler/cli_spec.rb @@ -15,7 +15,8 @@ RSpec.describe "bundle executable" do it "looks for a binary and executes it if it's named bundler-" do File.open(tmp("bundler-testtasks"), "w", 0o755) do |f| - f.puts "#!/usr/bin/env ruby\nputs 'Hello, world'\n" + ruby = ENV["BUNDLE_RUBY"] || "/usr/bin/env ruby" + f.puts "#!#{ruby}\nputs 'Hello, world'\n" end with_path_added(tmp) do diff --git a/spec/bundler/env_spec.rb b/spec/bundler/env_spec.rb index 10762b3cd2..20bd38b021 100644 --- a/spec/bundler/env_spec.rb +++ b/spec/bundler/env_spec.rb @@ -141,7 +141,7 @@ RSpec.describe Bundler::Env do end end - describe ".version_of" do + describe ".version_of", :ruby_repo do let(:parsed_version) { described_class.send(:version_of, "ruby") } it "strips version of new line characters" do diff --git a/spec/bundler/mirror_spec.rb b/spec/bundler/mirror_spec.rb index 0a8b9f8926..acd0895f2f 100644 --- a/spec/bundler/mirror_spec.rb +++ b/spec/bundler/mirror_spec.rb @@ -304,7 +304,7 @@ RSpec.describe Bundler::Settings::TCPSocketProbe do server.close unless server.closed? end - it "probes the server correctly" do + it "probes the server correctly", :ruby_repo do with_server_and_mirror do |server, mirror| expect(server.closed?).to be_falsey expect(probe.replies?(mirror)).to be_truthy diff --git a/spec/bundler/shared_helpers_spec.rb b/spec/bundler/shared_helpers_spec.rb index 72b1c2a51f..b66c43fd92 100644 --- a/spec/bundler/shared_helpers_spec.rb +++ b/spec/bundler/shared_helpers_spec.rb @@ -384,7 +384,8 @@ RSpec.describe Bundler::SharedHelpers do it "sets BUNDLE_BIN_PATH to the bundle executable file" do subject.set_bundle_environment - expect(ENV["BUNDLE_BIN_PATH"]).to eq(File.expand_path("../../../exe/bundle", __FILE__)) + bundle_exe = ruby_core? ? "../../../../exe/bundle" : "../../../exe/bundle" + expect(ENV["BUNDLE_BIN_PATH"]).to eq(File.expand_path(bundle_exe, __FILE__)) end end diff --git a/spec/bundler/ssl_certs/certificate_manager_spec.rb b/spec/bundler/ssl_certs/certificate_manager_spec.rb index 2e43193359..56606a830f 100644 --- a/spec/bundler/ssl_certs/certificate_manager_spec.rb +++ b/spec/bundler/ssl_certs/certificate_manager_spec.rb @@ -11,13 +11,18 @@ RSpec.describe Bundler::SSLCerts::CertificateManager do # 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 - rubygems_dir = File.join(root.to_s, "lib", "rubygems") - FileUtils.rm_rf(rubygems_dir) + 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 diff --git a/spec/commands/binstubs_spec.rb b/spec/commands/binstubs_spec.rb index 82b40c887a..7f2e81c099 100644 --- a/spec/commands/binstubs_spec.rb +++ b/spec/commands/binstubs_spec.rb @@ -248,7 +248,7 @@ RSpec.describe "bundle binstubs " do context "when requesting a different bundler version" do before { lockfile lockfile.gsub(Bundler::VERSION, "999.999.999") } - it "attempts to load that version" do + it "attempts to load that version", :ruby_repo do sys_exec bundled_app("bin/rackup").to_s expect(exitstatus).to eq(42) if exitstatus expect(last_command.stderr).to include("Activating bundler (999.999.999) failed:"). diff --git a/spec/commands/clean_spec.rb b/spec/commands/clean_spec.rb index 99789f0257..158d58d67c 100644 --- a/spec/commands/clean_spec.rb +++ b/spec/commands/clean_spec.rb @@ -712,7 +712,7 @@ RSpec.describe "bundle clean" do should_not_have_gems "foo-1.0" end - it "doesn't remove extensions artifacts from bundled git gems after clean", :rubygems => "2.2" do + it "doesn't remove extensions artifacts from bundled git gems after clean", :ruby_repo, :rubygems => "2.2" do build_git "very_simple_git_binary", &:add_c_extension revision = revision_for(lib_path("very_simple_git_binary-1.0")) @@ -734,7 +734,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", :rubygems => "2.2" do + it "removes extension directories", :ruby_repo, :rubygems => "2.2" do gemfile <<-G source "file://#{gem_repo1}" diff --git a/spec/commands/exec_spec.rb b/spec/commands/exec_spec.rb index 904b54d52d..76841dcff6 100644 --- a/spec/commands/exec_spec.rb +++ b/spec/commands/exec_spec.rb @@ -33,7 +33,7 @@ RSpec.describe "bundle exec" do expect(out).to eq("1.0.0") end - it "works when running from a random directory" do + it "works when running from a random directory", :ruby_repo do install_gemfile <<-G gem "rack" G @@ -226,7 +226,7 @@ RSpec.describe "bundle exec" do expect(out).to include("bundler: exec needs a command to run") end - it "raises a helpful error when exec'ing to something outside of the bundle", :rubygems => ">= 2.5.2" do + 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 install_gemfile! <<-G source "file://#{gem_repo1}" @@ -342,7 +342,7 @@ RSpec.describe "bundle exec" do end describe "with gem executables" do - describe "run from a random directory" do + describe "run from a random directory", :ruby_repo do before(:each) do install_gemfile <<-G gem "rack" @@ -445,7 +445,7 @@ RSpec.describe "bundle exec" do expect(out).to include("Installing foo 1.0") end - describe "with gems bundled via :path with invalid gemspecs" do + describe "with gems bundled via :path with invalid gemspecs", :ruby_repo do it "outputs the gemspec validation errors", :rubygems => ">= 1.7.2" do build_lib "foo" @@ -598,7 +598,7 @@ RSpec.describe "bundle exec" do it_behaves_like "it runs" end - context "when the file uses the current ruby shebang" do + context "when the file uses the current ruby shebang", :ruby_repo do let(:shebang) { "#!#{Gem.ruby}" } it_behaves_like "it runs" end diff --git a/spec/commands/info_spec.rb b/spec/commands/info_spec.rb index a08965ec0e..a9ab8fc210 100644 --- a/spec/commands/info_spec.rb +++ b/spec/commands/info_spec.rb @@ -24,7 +24,7 @@ RSpec.describe "bundle info" do end end - context "given a default gem shippped in ruby" do + context "given a default gem shippped in ruby", :ruby_repo do it "prints information about the default gem", :if => (RUBY_VERSION >= "2.0") do bundle "info rdoc" expect(out).to include("* rdoc") diff --git a/spec/commands/newgem_spec.rb b/spec/commands/newgem_spec.rb index 598d68ec3a..e6d6e19122 100644 --- a/spec/commands/newgem_spec.rb +++ b/spec/commands/newgem_spec.rb @@ -211,7 +211,10 @@ RSpec.describe "bundle gem" do end Dir.chdir(bundled_app("newgem")) do - system_gems ["rake-10.0.2", :bundler], :path => :bundle_path + gems = ["rake-10.0.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 bundle! "exec rake build" end diff --git a/spec/commands/pristine_spec.rb b/spec/commands/pristine_spec.rb index 20adb13a2c..d8761bba26 100644 --- a/spec/commands/pristine_spec.rb +++ b/spec/commands/pristine_spec.rb @@ -2,7 +2,7 @@ require "bundler/vendored_fileutils" -RSpec.describe "bundle pristine" do +RSpec.describe "bundle pristine", :ruby_repo do before :each do build_lib "baz", :path => bundled_app do |s| s.version = "1.0.0" diff --git a/spec/commands/show_spec.rb b/spec/commands/show_spec.rb index a5c6beec1a..55bdacac98 100644 --- a/spec/commands/show_spec.rb +++ b/spec/commands/show_spec.rb @@ -86,7 +86,7 @@ RSpec.describe "bundle show", :bundler => "< 3", :ruby => ">= 2.0" do and include(default_bundle_path("gems", "rails-2.3.2").to_s) end - it "prints the path to the running bundler" do + it "prints the path to the running bundler", :ruby_repo do bundle "show bundler" expect(out).to eq(root.to_s) end diff --git a/spec/install/deploy_spec.rb b/spec/install/deploy_spec.rb index f3c47d7aa9..ec72ff69fc 100644 --- a/spec/install/deploy_spec.rb +++ b/spec/install/deploy_spec.rb @@ -64,7 +64,7 @@ RSpec.describe "install with --deployment or --frozen" do bundle! :install, forgotten_command_line_options(:deployment => true, :without => "test") end - it "works when you bundle exec bundle" do + it "works when you bundle exec bundle", :ruby_repo do bundle :install bundle "install --deployment" bundle! "exec bundle check" diff --git a/spec/install/gemfile/git_spec.rb b/spec/install/gemfile/git_spec.rb index 1d4c68decb..fe396c7a0f 100644 --- a/spec/install/gemfile/git_spec.rb +++ b/spec/install/gemfile/git_spec.rb @@ -1099,7 +1099,7 @@ RSpec.describe "bundle install with git sources" do end context "with an extension" do - it "installs the extension" do + it "installs the extension", :ruby_repo do build_git "foo" do |s| s.add_dependency "rake" s.extensions << "Rakefile" @@ -1131,7 +1131,7 @@ RSpec.describe "bundle install with git sources" do expect(out).to eq(Pathname.glob(default_bundle_path("bundler/gems/extensions/**/foo-1.0-*")).first.to_s) end - it "does not use old extension after ref changes" do + it "does not use old extension after ref changes", :ruby_repo do git_reader = build_git "foo", :no_default => true do |s| s.extensions = ["ext/extconf.rb"] s.write "ext/extconf.rb", <<-RUBY @@ -1193,7 +1193,7 @@ In Gemfile: expect(out).not_to include("gem install foo") end - it "does not reinstall the extension", :rubygems => ">= 2.3.0" do + it "does not reinstall the extension", :ruby_repo, :rubygems => ">= 2.3.0" do build_git "foo" do |s| s.add_dependency "rake" s.extensions << "Rakefile" diff --git a/spec/install/gemfile/platform_spec.rb b/spec/install/gemfile/platform_spec.rb index 9a848b8396..b5dbc41a33 100644 --- a/spec/install/gemfile/platform_spec.rb +++ b/spec/install/gemfile/platform_spec.rb @@ -102,7 +102,7 @@ RSpec.describe "bundle install across platforms" do gem "pry" G - expect(the_bundle.lockfile).to read_as strip_whitespace(<<-L) + expect(the_bundle.lockfile).to read_as normalize_uri_file(strip_whitespace(<<-L)) GEM remote: file://localhost/#{gem_repo4}/ specs: @@ -160,7 +160,7 @@ RSpec.describe "bundle install across platforms" do #{Bundler::VERSION} L - expect(the_bundle.lockfile).to read_as good_lockfile + expect(the_bundle.lockfile).to read_as normalize_uri_file(good_lockfile) bad_lockfile = strip_whitespace <<-L GEM @@ -196,23 +196,23 @@ RSpec.describe "bundle install across platforms" do aggregate_failures do lockfile bad_lockfile bundle! :install - expect(the_bundle.lockfile).to read_as good_lockfile + expect(the_bundle.lockfile).to read_as normalize_uri_file(good_lockfile) lockfile bad_lockfile bundle! :update, :all => true - expect(the_bundle.lockfile).to read_as good_lockfile + expect(the_bundle.lockfile).to read_as normalize_uri_file(good_lockfile) lockfile bad_lockfile bundle! "update ffi" - expect(the_bundle.lockfile).to read_as good_lockfile + expect(the_bundle.lockfile).to read_as normalize_uri_file(good_lockfile) lockfile bad_lockfile bundle! "update empyrean" - expect(the_bundle.lockfile).to read_as good_lockfile + expect(the_bundle.lockfile).to read_as normalize_uri_file(good_lockfile) lockfile bad_lockfile bundle! :lock - expect(the_bundle.lockfile).to read_as good_lockfile + expect(the_bundle.lockfile).to read_as normalize_uri_file(good_lockfile) end end diff --git a/spec/install/gems/native_extensions_spec.rb b/spec/install/gems/native_extensions_spec.rb index c8252b81f1..ea616f60d3 100644 --- a/spec/install/gems/native_extensions_spec.rb +++ b/spec/install/gems/native_extensions_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "installing a gem with native extensions" do +RSpec.describe "installing a gem with native extensions", :ruby_repo do it "installs" do build_repo2 do build_gem "c_extension" do |s| diff --git a/spec/install/gems/resolving_spec.rb b/spec/install/gems/resolving_spec.rb index e58f32836c..01c03ac793 100644 --- a/spec/install/gems/resolving_spec.rb +++ b/spec/install/gems/resolving_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.describe "bundle install with install-time dependencies" do - it "installs gems with implicit rake dependencies" do + it "installs gems with implicit rake dependencies", :ruby_repo do install_gemfile <<-G source "file://#{gem_repo1}" gem "with_implicit_rake_dep" @@ -48,7 +48,7 @@ RSpec.describe "bundle install with install-time dependencies" do expect(the_bundle).to include_gems "net_b 1.0" end - it "installs plugins depended on by other plugins" do + it "installs plugins depended on by other plugins", :ruby_repo do install_gemfile <<-G source "file://#{gem_repo1}" gem "net_a" @@ -57,7 +57,7 @@ RSpec.describe "bundle install with install-time dependencies" do expect(the_bundle).to include_gems "net_a 1.0", "net_b 1.0" end - it "installs multiple levels of dependencies" do + it "installs multiple levels of dependencies", :ruby_repo do install_gemfile <<-G source "file://#{gem_repo1}" gem "net_c" diff --git a/spec/install/gems/standalone_spec.rb b/spec/install/gems/standalone_spec.rb index eecf6f2e7e..fa7a3bdc27 100644 --- a/spec/install/gems/standalone_spec.rb +++ b/spec/install/gems/standalone_spec.rb @@ -67,7 +67,7 @@ RSpec.shared_examples "bundle install --standalone" do include_examples "common functionality" end - describe "with gems with native extension" do + describe "with gems with native extension", :ruby_repo do before do install_gemfile <<-G, forgotten_command_line_options(:path => bundled_app("bundle")).merge(:standalone => true) source "file://#{gem_repo1}" diff --git a/spec/install/global_cache_spec.rb b/spec/install/global_cache_spec.rb index 3664d3963a..e41e7e0157 100644 --- a/spec/install/global_cache_spec.rb +++ b/spec/install/global_cache_spec.rb @@ -187,7 +187,7 @@ RSpec.describe "global gem caching" do end end - describe "extension caching", :rubygems => "2.2" do + describe "extension caching", :ruby_repo, :rubygems => "2.2" do it "works" do build_git "very_simple_git_binary", &:add_c_extension build_lib "very_simple_path_binary", &:add_c_extension diff --git a/spec/install/path_spec.rb b/spec/install/path_spec.rb index 8d0961daea..94f38c9290 100644 --- a/spec/install/path_spec.rb +++ b/spec/install/path_spec.rb @@ -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", :rubygems => ">= 2.3" do + it "re-installs gems whose extensions have been deleted", :ruby_repo, :rubygems => ">= 2.3" do build_lib "very_simple_binary", "1.0.0", :to_system => true do |s| s.write "lib/very_simple_binary.rb", "raise 'FAIL'" end diff --git a/spec/lock/lockfile_bundler_1_spec.rb b/spec/lock/lockfile_bundler_1_spec.rb index 4d969efcb1..851fbea99a 100644 --- a/spec/lock/lockfile_bundler_1_spec.rb +++ b/spec/lock/lockfile_bundler_1_spec.rb @@ -75,7 +75,7 @@ RSpec.describe "the lockfile format", :bundler => "< 3" do G end - it "does not update the lockfile's bundler version if nothing changed during bundle install" do + 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 <<-L diff --git a/spec/quality_spec.rb b/spec/quality_spec.rb index 317c799573..812acc344f 100644 --- a/spec/quality_spec.rb +++ b/spec/quality_spec.rb @@ -108,7 +108,8 @@ RSpec.describe "The library itself" do exempt = /\.gitmodules|\.marshal|fixtures|vendor|ssl_certs|LICENSE|vcr_cassettes/ error_messages = [] Dir.chdir(root) do - `git ls-files -z`.split("\x0").each do |filename| + lib_files = ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb spec/bundler` : `git ls-files -z -- lib` + lib_files.split("\x0").each do |filename| next if filename =~ exempt error_messages << check_for_tab_characters(filename) error_messages << check_for_extra_spaces(filename) @@ -121,7 +122,8 @@ RSpec.describe "The library itself" do exempt = %r{quality_spec.rb|support/helpers|vcr_cassettes|\.md|\.ronn} error_messages = [] Dir.chdir(root) do - `git ls-files -z`.split("\x0").each do |filename| + lib_files = ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb spec/bundler` : `git ls-files -z -- lib` + lib_files.split("\x0").each do |filename| next if filename =~ exempt error_messages << check_for_debugging_mechanisms(filename) end @@ -133,7 +135,8 @@ RSpec.describe "The library itself" do error_messages = [] exempt = %r{lock/lockfile_(bundler_1_)?spec|quality_spec|vcr_cassettes|\.ronn|lockfile_parser\.rb} Dir.chdir(root) do - `git ls-files -z`.split("\x0").each do |filename| + lib_files = ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb spec/bundler` : `git ls-files -z -- lib` + lib_files.split("\x0").each do |filename| next if filename =~ exempt error_messages << check_for_git_merge_conflicts(filename) end @@ -158,7 +161,8 @@ RSpec.describe "The library itself" do error_messages = [] exempt = /vendor/ Dir.chdir(root) do - `git ls-files -z -- lib`.split("\x0").each do |filename| + lib_files = ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb` : `git ls-files -z -- lib` + lib_files.split("\x0").each do |filename| next if filename =~ exempt error_messages << check_for_expendable_words(filename) error_messages << check_for_specific_pronouns(filename) @@ -192,7 +196,8 @@ RSpec.describe "The library itself" do Dir.chdir(root) do key_pattern = /([a-z\._-]+)/i - `git ls-files -z -- lib`.split("\x0").each do |filename| + lib_files = ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb` : `git ls-files -z -- lib` + lib_files.split("\x0").each do |filename| File.readlines(filename).each_with_index do |line, number| line.scan(/Bundler\.settings\[:#{key_pattern}\]/).flatten.each {|s| all_settings[s] << "referenced at `#{filename}:#{number.succ}`" } end @@ -220,7 +225,7 @@ RSpec.describe "The library itself" do it "can still be built" do Dir.chdir(root) do begin - gem_command! :build, "bundler.gemspec" + gem_command! :build, gemspec if Bundler.rubygems.provides?(">= 2.4") # there's no way aroudn this warning last_command.stderr.sub!(/^YAML safe loading.*/, "") @@ -231,7 +236,8 @@ RSpec.describe "The library itself" do end ensure # clean up the .gem generated - FileUtils.rm("bundler-#{Bundler::VERSION}.gem") + path_prefix = ruby_core? ? "lib/" : "./" + FileUtils.rm("#{path_prefix}bundler-#{Bundler::VERSION}.gem") end end end @@ -245,7 +251,8 @@ RSpec.describe "The library itself" do lib/bundler/vlad.rb lib/bundler/templates/gems.rb ] - lib_files = `git ls-files -z -- lib`.split("\x0").grep(/\.rb$/) - exclusions + lib_files = ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb` : `git ls-files -z -- lib` + lib_files = lib_files.split("\x0").grep(/\.rb$/) - exclusions lib_files.reject! {|f| f.start_with?("lib/bundler/vendor") } lib_files.map! {|f| f.chomp(".rb") } sys_exec!("ruby -w -Ilib") do |input, _, _| diff --git a/spec/runtime/gem_tasks_spec.rb b/spec/runtime/gem_tasks_spec.rb index 1cf808f35b..de72869dc3 100644 --- a/spec/runtime/gem_tasks_spec.rb +++ b/spec/runtime/gem_tasks_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "require 'bundler/gem_tasks'" do +RSpec.describe "require 'bundler/gem_tasks'", :ruby_repo do before :each do bundled_app("foo.gemspec").open("w") do |f| f.write <<-GEMSPEC diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb index 9395f0e1e4..15dd1fe190 100644 --- a/spec/runtime/setup_spec.rb +++ b/spec/runtime/setup_spec.rb @@ -119,7 +119,7 @@ RSpec.describe "Bundler.setup" do lp.map! {|p| p.sub(/^#{Regexp.union system_gem_path.to_s, default_bundle_path.to_s}/i, "") } end - it "puts loaded gems after -I and RUBYLIB" do + it "puts loaded gems after -I and RUBYLIB", :ruby_repo do install_gemfile <<-G source "file://#{gem_repo1}" gem "rack" @@ -828,7 +828,7 @@ end expect(out).to eq("yay") end - it "should clean $LOAD_PATH properly" do + 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) @@ -864,7 +864,7 @@ 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(:bundler_dir) { File.expand_path("../../..", __FILE__) } + let(:bundler_dir) { ruby_core? ? File.expand_path("../../../..", __FILE__) : File.expand_path("../../..", __FILE__) } let(:bundler_lib) { File.join(bundler_dir, "lib") } before do @@ -876,7 +876,8 @@ end FileUtils.ln_s(bundler_dir, File.join(gems_dir, "bundler-#{Bundler::VERSION}")) - gemspec = File.read("#{bundler_dir}/bundler.gemspec"). + gemspec_file = ruby_core? ? "#{bundler_dir}/lib/bundler.gemspec" : "#{bundler_dir}/bundler.gemspec" + gemspec = File.read(gemspec_file). sub("Bundler::VERSION", %("#{Bundler::VERSION}")) gemspec = gemspec.lines.reject {|line| line =~ %r{lib/bundler/version} }.join @@ -885,7 +886,7 @@ end end end - it "should succesfully require 'bundler/setup'" do + it "should succesfully require 'bundler/setup'", :ruby_repo do install_gemfile "" ENV["GEM_PATH"] = symlinked_gem_home.path diff --git a/spec/runtime/with_clean_env_spec.rb b/spec/runtime/with_clean_env_spec.rb index ed5f7fe3b6..da8e37b45d 100644 --- a/spec/runtime/with_clean_env_spec.rb +++ b/spec/runtime/with_clean_env_spec.rb @@ -34,7 +34,7 @@ RSpec.describe "Bundler.with_env helpers" do end end - it "works with nested bundle exec invocations" do + it "works with nested bundle exec invocations", :ruby_repo do create_file("exe.rb", <<-'RB') count = ARGV.first.to_i exit if count < 0 @@ -55,7 +55,7 @@ RSpec.describe "Bundler.with_env helpers" do EOS end - it "removes variables that bundler added" do + 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")}" } @@ -84,7 +84,7 @@ RSpec.describe "Bundler.with_env helpers" do expect(last_command.stdboth).not_to include("-rbundler/setup") end - it "should clean up RUBYLIB" do + 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 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 63787168b5..8d8272e573 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -64,6 +64,12 @@ ENV["THOR_COLUMNS"] = "10000" Spec::CodeClimate.setup +module Gem + def self.ruby=(ruby) + @ruby = ruby + end +end + RSpec.configure do |config| config.include Spec::Builders config.include Spec::Helpers @@ -105,6 +111,7 @@ RSpec.configure do |config| config.filter_run_excluding :git => LessThanProc.with(git_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 :ruby_repo => !(ENV["BUNDLE_RUBY"] && ENV["BUNDLE_GEM"]).nil? config.filter_run_when_matching :focus unless ENV["CI"] @@ -115,6 +122,15 @@ RSpec.configure do |config| c.syntax = :expect end + config.around :suite do |example| + if ENV["BUNDLE_RUBY"] + @orig_ruby = Gem.ruby + Gem.ruby = ENV["BUNDLE_RUBY"] + end + example.run + Gem.ruby = @orig_ruby if ENV["BUNDLE_RUBY"] + end + config.before :all do build_repo1 end diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index b86f8e25c0..181dac3220 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -212,7 +212,8 @@ module Spec args = args.gsub(/(?=")/, "\\") args = %("#{args}") end - sys_exec("#{Gem.ruby} -rrubygems -S gem --backtrace #{command} #{args}") + gem = ENV["BUNDLE_GEM"] || "#{Gem.ruby} -rrubygems -S gem --backtrace" + sys_exec("#{gem} #{command} #{args}") end bang :gem_command @@ -313,7 +314,11 @@ module Spec gems.each do |g| path = if g == :bundler Dir.chdir(root) { gem_command! :build, gemspec.to_s } - bundler_path = root + "bundler-#{Bundler::VERSION}.gem" + bundler_path = if ruby_core? + root + "lib/bundler-#{Bundler::VERSION}.gem" + else + root + "bundler-#{Bundler::VERSION}.gem" + end elsif g.to_s =~ %r{\A/.*\.gem\z} g else diff --git a/spec/support/path.rb b/spec/support/path.rb index a8bc50f5f4..97153226bd 100644 --- a/spec/support/path.rb +++ b/spec/support/path.rb @@ -5,19 +5,19 @@ require "pathname" module Spec module Path def root - @root ||= Pathname.new(File.expand_path("../../..", __FILE__)) + @root ||= Pathname.new(ruby_core? ? "../../../.." : "../../..").expand_path(__FILE__) end def gemspec - @gemspec ||= Pathname.new(File.expand_path(root.join("bundler.gemspec"), __FILE__)) + @gemspec ||= root.join(ruby_core? ? "lib/bundler.gemspec" : "bundler.gemspec") end def bindir - @bindir ||= Pathname.new(File.expand_path(root.join("exe"), __FILE__)) + @bindir ||= root.join(ruby_core? ? "bin" : "exe") end def spec_dir - @spec_dir ||= Pathname.new(File.expand_path(root.join("spec"), __FILE__)) + @spec_dir ||= root.join(ruby_core? ? "spec/bundler" : "spec") end def tmp(*path) @@ -110,6 +110,17 @@ module Spec tmp "tmpdir", *args end + def ruby_core? + # avoid to wornings + @ruby_core ||= nil + + if @ruby_core.nil? + @ruby_core = true & (ENV["BUNDLE_RUBY"] && ENV["BUNDLE_GEM"]) + else + @ruby_core + end + end + extend self end end -- cgit v1.2.1 From a7207e171d1e651fe7bf8361d745829a47a272a3 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Fri, 16 Nov 2018 14:10:22 +0000 Subject: Merge #6786 6786: Followed up #6743 r=hsbt a=hsbt I fixed them. Co-authored-by: SHIBATA Hiroshi (cherry picked from commit 9cfe9bd9be4b44bde1fd71e6faab494509ceb7b6) --- spec/commands/show_spec.rb | 2 +- spec/spec_helper.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/commands/show_spec.rb b/spec/commands/show_spec.rb index 55bdacac98..a5c6beec1a 100644 --- a/spec/commands/show_spec.rb +++ b/spec/commands/show_spec.rb @@ -86,7 +86,7 @@ RSpec.describe "bundle show", :bundler => "< 3", :ruby => ">= 2.0" do and include(default_bundle_path("gems", "rails-2.3.2").to_s) end - it "prints the path to the running bundler", :ruby_repo do + it "prints the path to the running bundler" do bundle "show bundler" expect(out).to eq(root.to_s) end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 8d8272e573..ff009e773f 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -122,13 +122,13 @@ RSpec.configure do |config| c.syntax = :expect end - config.around :suite do |example| + config.around :each do |example| if ENV["BUNDLE_RUBY"] - @orig_ruby = Gem.ruby + orig_ruby = Gem.ruby Gem.ruby = ENV["BUNDLE_RUBY"] end example.run - Gem.ruby = @orig_ruby if ENV["BUNDLE_RUBY"] + Gem.ruby = orig_ruby if ENV["BUNDLE_RUBY"] end config.before :all do -- cgit v1.2.1 From fd2ae038bf0a6ce8cbf5ef38134db9fb71e9b632 Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Fri, 16 Nov 2018 20:51:11 +1100 Subject: set warning message flag to show in bundler 3 --- lib/bundler/dsl.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index 2cdfe338ea..90ac073c36 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -474,7 +474,7 @@ 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_2_mode? + unless Bundler.feature_flag.bundler_3_mode? msg += ". To downgrade this error to a warning, run " \ "`bundle config --delete disable_multisource`" end @@ -499,7 +499,7 @@ repo_name ||= user_name end Bundler::SharedHelpers.major_deprecation 3, <<-EOS -The :#{name} git source is deprecated, and will be removed in Bundler 2.0.#{additional_message} Add this code to the top of your Gemfile to ensure it continues to work: +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: git_source(:#{name}) #{replacement} -- cgit v1.2.1 From 7e2ac2853bf88224fed9bff44d51356112bb1c06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Arko?= Date: Sat, 20 Oct 2018 22:56:35 -0700 Subject: Merge pull request #6752 from bundler/indirect/backport-6737 backport #6737 to 1-16-stable (cherry picked from commit 8a789f00bf5ce93928f0d03ac324387c7d58db46) --- lib/bundler/build_metadata.rb | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/bundler/build_metadata.rb b/lib/bundler/build_metadata.rb index a0428f0319..33f91e9162 100644 --- a/lib/bundler/build_metadata.rb +++ b/lib/bundler/build_metadata.rb @@ -28,12 +28,19 @@ module Bundler # If Bundler has been installed without its .git directory and without a # commit instance variable then we can't determine its commits SHA. git_dir = File.join(File.expand_path("../../..", __FILE__), ".git") - return "unknown" unless File.directory?(git_dir) + if File.directory?(git_dir) + return @git_commit_sha = Dir.chdir(git_dir) { `git rev-parse --short HEAD`.strip.freeze } + end - # Otherwise shell out to git. - @git_commit_sha = Dir.chdir(File.expand_path("..", __FILE__)) do - `git rev-parse --short HEAD`.strip.freeze + # If Bundler is a submodule in RubyGems, get the submodule commit + git_sub_dir = File.join(File.expand_path("../../../..", __FILE__), ".git") + if File.directory?(git_sub_dir) + return @git_commit_sha = Dir.chdir(git_sub_dir) do + `git ls-tree --abbrev=8 HEAD bundler`.split(/\s/).fetch(2, "").strip.freeze + end end + + @git_commit_sha ||= "unknown" end # Whether this is an official release build of Bundler. -- cgit v1.2.1 From d9844e8d0f8d365c8750cf214a678602f29e4926 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Mon, 26 Nov 2018 23:09:40 +0000 Subject: Merge #6798 6798: Use https in the Github shortcut by default in Bundler 2 r=colby-swandale a=colby-swandale This PR is setting Git gems to be fetched over https by default. Note: This PR is successing #6791 Closes #6785 Co-authored-by: Colby Swandale (cherry picked from commit cf45792213fadf97f7aa6464de8ebd79f09725d2) --- lib/bundler/feature_flag.rb | 2 ++ spec/bundler/dsl_spec.rb | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/lib/bundler/feature_flag.rb b/lib/bundler/feature_flag.rb index e3266da8ab..e5b4e84063 100644 --- a/lib/bundler/feature_flag.rb +++ b/lib/bundler/feature_flag.rb @@ -61,6 +61,8 @@ module Bundler settings_option(:default_cli_command) { bundler_3_mode? ? :cli_help : :install } + settings_method(:github_https?, "github.https") { bundler_2_mode? } + def initialize(bundler_version) @bundler_version = Gem::Version.create(bundler_version) end diff --git a/spec/bundler/dsl_spec.rb b/spec/bundler/dsl_spec.rb index dcc816eee2..94d54ad877 100644 --- a/spec/bundler/dsl_spec.rb +++ b/spec/bundler/dsl_spec.rb @@ -25,7 +25,23 @@ RSpec.describe Bundler::Dsl do expect { subject.git_source(:example) }.to raise_error(Bundler::InvalidOption) end + 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" + end + end + context "default hosts (git, gist)", :bundler => "< 3" do + context "when github.https config is true" do + before { bundle "config github.https true" } + it "converts :github to :git using https" do + subject.gem("sparks", :github => "indirect/sparks") + github_uri = "https://github.com/indirect/sparks.git" + expect(subject.dependencies.first.source.uri).to eq(github_uri) + end + end + it "converts :github to :git" do subject.gem("sparks", :github => "indirect/sparks") github_uri = "git://github.com/indirect/sparks.git" -- cgit v1.2.1 From e7b7c8c433cecd5f1cffffea42ec116503630aca Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Tue, 27 Nov 2018 21:31:35 +1100 Subject: remove :github source declaration from new gem template --- lib/bundler/templates/newgem/Gemfile.tt | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/bundler/templates/newgem/Gemfile.tt b/lib/bundler/templates/newgem/Gemfile.tt index c114bd6665..4cd2e40f4f 100644 --- a/lib/bundler/templates/newgem/Gemfile.tt +++ b/lib/bundler/templates/newgem/Gemfile.tt @@ -1,6 +1,4 @@ source "https://rubygems.org" -git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } - # Specify your gem's dependencies in <%= config[:name] %>.gemspec gemspec -- cgit v1.2.1 From ec83222326709a12d29908a4f8e92b1327984ef5 Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Tue, 27 Nov 2018 22:05:29 +1100 Subject: fix failing major deprecation error spec --- spec/other/major_deprecation_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/other/major_deprecation_spec.rb b/spec/other/major_deprecation_spec.rb index 32827dbd54..50800dbb0c 100644 --- a/spec/other/major_deprecation_spec.rb +++ b/spec/other/major_deprecation_spec.rb @@ -200,7 +200,7 @@ RSpec.describe "major deprecations", :bundler => "< 3" do 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 2.0. Change any "reponame" :github sources to "username/reponame". Add this code to the top of your Gemfile to ensure it continues to work: +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" } @@ -212,7 +212,7 @@ The :github git source is deprecated, and will be removed in Bundler 2.0. Change 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 2.0. Change any "reponame" :github sources to "username/reponame". Add this code to the top of your Gemfile to ensure it continues to work: +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" } @@ -229,7 +229,7 @@ The :github git source is deprecated, and will be removed in Bundler 2.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 2.0. Add this code to the top of your Gemfile to ensure it continues to work: +The :bitbucket git source is deprecated, and will be removed in Bundler 3.0. 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("/") @@ -247,7 +247,7 @@ The :bitbucket git source is deprecated, and will be removed in Bundler 2.0. Add it "warns about removal" do allow(Bundler.ui).to receive(:deprecate) msg = "The :gist git source is deprecated, and will be removed " \ - "in Bundler 2.0. Add this code to the top of your Gemfile to ensure it " \ + "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" expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, msg) -- cgit v1.2.1 From d784c103a1624b76b375989c58671543232ed319 Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Tue, 27 Nov 2018 21:37:36 +1100 Subject: Version 2.0.0.pre.2 with Changelog --- CHANGELOG.md | 12 ++++++++++++ lib/bundler/version.rb | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ad7e06612..6f9f6569fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +## 2.0.0.pre.2 (2018-11-27) + +Breaking Changes: + + - `:github` source in the Gemfile now defaults to using HTTPS + +Changes + + - Add compatibility for Bundler merge into ruby-src + +Note: To upgrade your Gemfile to Bundler 2 you will need to run `bundle update --bundler` + ## 2.0.0.pre.1 (2018-11-09) Breaking Changes: diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb index 25a72b272e..bf6c477c92 100644 --- a/lib/bundler/version.rb +++ b/lib/bundler/version.rb @@ -7,7 +7,7 @@ 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.0.pre.1" unless defined?(::Bundler::VERSION) + VERSION = "2.0.0.pre.2" unless defined?(::Bundler::VERSION) def self.overwrite_loaded_gem_version begin -- cgit v1.2.1 From f8e367605205e455d98b3a0c6e9e08cb74f47793 Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Tue, 4 Dec 2018 22:33:59 +1100 Subject: bump bundler_2_mode in inject spec --- spec/commands/inject_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/commands/inject_spec.rb b/spec/commands/inject_spec.rb index 822644f39a..d091e01380 100644 --- a/spec/commands/inject_spec.rb +++ b/spec/commands/inject_spec.rb @@ -79,7 +79,7 @@ Usage: "bundle inject GEM VERSION" context "when frozen" do before do bundle "install" - if Bundler.feature_flag.bundler_2_mode? + if Bundler.feature_flag.bundler_3_mode? bundle! "config --local deployment true" else bundle! "config --local frozen true" -- cgit v1.2.1 From 1871506eeccee2b0b83b0ec0a6eb8f6638f44845 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Sat, 1 Dec 2018 00:51:33 +0000 Subject: Merge #6818 6818: Following up ruby core changes. r=hsbt a=hsbt ### What is your fix for the problem, implemented in this PR? These changes enabled to use the same configuration of executables in ruby core repository. * To use libexec instead of bin directory. * Restore exe direcotry for bundler.gemspec while running test suite. ### Why did you choose this fix out of the possible options? The ruby core repository uses `exe` directory for other usage. I chose `libexec` instead of `exe` in ruby core. And, The location of `bundler.gemspec` is not the root of the repository on ruby core. We should restore `libexec` to `exe` under the `lib` dir. see. https://github.com/ruby/ruby/blob/trunk/lib/bundler.gemspec Co-authored-by: SHIBATA Hiroshi (cherry picked from commit a578c4ee390fadb746252b4bd496f8ee6d90add4) --- spec/spec_helper.rb | 12 ++++++++++++ spec/support/path.rb | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ff009e773f..c7614e1c43 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -131,6 +131,12 @@ RSpec.configure do |config| Gem.ruby = orig_ruby if ENV["BUNDLE_RUBY"] end + config.before :suite do + if ENV["BUNDLE_RUBY"] + FileUtils.cp_r Spec::Path.bindir, File.join(Spec::Path.root, "lib", "exe") + end + end + config.before :all do build_repo1 end @@ -155,4 +161,10 @@ RSpec.configure do |config| Dir.chdir(original_wd) ENV.replace(original_env) end + + config.after :suite do + if ENV["BUNDLE_RUBY"] + FileUtils.rm_rf File.join(Spec::Path.root, "lib", "exe") + end + end end diff --git a/spec/support/path.rb b/spec/support/path.rb index 97153226bd..03a96893f3 100644 --- a/spec/support/path.rb +++ b/spec/support/path.rb @@ -13,7 +13,7 @@ module Spec end def bindir - @bindir ||= root.join(ruby_core? ? "bin" : "exe") + @bindir ||= root.join(ruby_core? ? "libexec" : "exe") end def spec_dir -- cgit v1.2.1 From ba47a7687c6ba9a31b9f29403ea507d324207da2 Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Wed, 5 Dec 2018 06:44:01 +1100 Subject: fix breaking edge case spec --- spec/realworld/edgecases_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/realworld/edgecases_spec.rb b/spec/realworld/edgecases_spec.rb index bbfd0f68fd..1db5c0f9d6 100644 --- a/spec/realworld/edgecases_spec.rb +++ b/spec/realworld/edgecases_spec.rb @@ -188,7 +188,7 @@ RSpec.describe "real world edgecases", :realworld => true, :sometimes => true do activemodel (= 4.2.7.1) activerecord (= 4.2.7.1) activesupport (= 4.2.7.1) - bundler (>= 1.3.0, < 2.0) + bundler (>= 1.3.0, < 3.0) railties (= 4.2.7.1) sprockets-rails rails-deprecated_sanitizer (1.0.3) -- cgit v1.2.1 From 04e16585e63aefeac56b026563db228a57bb2871 Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Tue, 4 Dec 2018 22:34:51 +1100 Subject: Version 2.0.0 with changelog --- CHANGELOG.md | 4 ++++ lib/bundler/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f9f6569fb..6705e41e11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.0 (2018-12-04) + +No changes + ## 2.0.0.pre.2 (2018-11-27) Breaking Changes: diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb index bf6c477c92..da356fe50e 100644 --- a/lib/bundler/version.rb +++ b/lib/bundler/version.rb @@ -7,7 +7,7 @@ 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.0.pre.2" unless defined?(::Bundler::VERSION) + VERSION = "2.0.0" unless defined?(::Bundler::VERSION) def self.overwrite_loaded_gem_version begin -- cgit v1.2.1 From 7f878bfdc3052886637f883776d9d6aee182f860 Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Fri, 28 Dec 2018 12:49:24 +1100 Subject: Revert "Version 2.0.0 with changelog" This reverts commit 04e16585e63aefeac56b026563db228a57bb2871. --- CHANGELOG.md | 4 ---- lib/bundler/version.rb | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6705e41e11..6f9f6569fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,3 @@ -## 2.0.0 (2018-12-04) - -No changes - ## 2.0.0.pre.2 (2018-11-27) Breaking Changes: diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb index da356fe50e..bf6c477c92 100644 --- a/lib/bundler/version.rb +++ b/lib/bundler/version.rb @@ -7,7 +7,7 @@ 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.0" unless defined?(::Bundler::VERSION) + VERSION = "2.0.0.pre.2" unless defined?(::Bundler::VERSION) def self.overwrite_loaded_gem_version begin -- cgit v1.2.1 From 58b3d906f5a54a4463718f299aec2071ddb75dd8 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Wed, 26 Dec 2018 23:05:04 +0000 Subject: Merge #6853 6853: add bundle-remove entry to bundler man page r=colby-swandale a=colby-swandale ### What was the end-user problem that led to this PR? The manual entry for `bundle remove` was missing in `bundle.ronn` ### What was your diagnosis of the problem? See #6846 Fixes #6846 Co-authored-by: Colby Swandale (cherry picked from commit 02cde1cd331615d09d96e0078982a820d5e6771e) --- man/bundle.ronn | 3 +++ 1 file changed, 3 insertions(+) diff --git a/man/bundle.ronn b/man/bundle.ronn index c03201a30c..0005692abd 100644 --- a/man/bundle.ronn +++ b/man/bundle.ronn @@ -94,6 +94,9 @@ We divide `bundle` subcommands into primary commands and utilities: * [`bundle doctor(1)`](bundle-doctor.1.html): Display warnings about common problems +* [`bundle remove(1)`](bundle-remove.1.html): + Removes gems from the Gemfile + ## PLUGINS When running a command that isn't listed in PRIMARY COMMANDS or UTILITIES, -- cgit v1.2.1 From 55772e134bd4894dd52487f18d8e78165df42a2f Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Thu, 27 Dec 2018 00:58:13 +0000 Subject: Merge #6849 6849: revert commit b490e73 r=colby-swandale a=colby-swandale ### What was the end-user problem that led to this PR? There is a *really* obscure bug in Bundler that is causing deploys in Heroku to fail for certain environments. The environment in this case being Ruby 1.9.3 and RubyGems 1.8 I also think that this is the same bug causing https://github.com/bundler/bundler/issues/6829 ### What was your diagnosis of the problem? See https://gist.github.com/schneems/0247e3d5c3e079ecffd7cd10887c3cc9 ### What is your fix for the problem, implemented in this PR? Revert the commit that was causing this bug. The original PR can be found at https://github.com/bundler/bundler/pull/6687 I can confirm the fix by being able to deploy to Heroku succesfully using Bundler 1.17.2 + the commit to revert the change being applied on top. ``` $ git push heroku master Enumerating objects: 87, done. Counting objects: 100% (87/87), done. Delta compression using up to 4 threads Compressing objects: 100% (72/72), done. Writing objects: 100% (87/87), 28.14 KiB | 1.48 MiB/s, done. Total 87 (delta 13), reused 0 (delta 0) remote: Compressing source files... done. remote: Building source: remote: remote: -----> Ruby app detected remote: -----> Compiling Ruby/Rails remote: -----> Using Ruby version: ruby-1.9.3 remote: -----> Installing dependencies using bundler 1.17.2 remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment remote: Fetching gem metadata from https://rubygems.org/.......... remote: RubyGems 1.8.23.2 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. remote: Fetching rake 10.0.3 remote: Installing rake 10.0.3 remote: Fetching i18n 0.6.1 remote: Installing i18n 0.6.1 remote: Fetching multi_json 1.5.0 remote: Installing multi_json 1.5.0 remote: Fetching activesupport 3.2.11 remote: Installing activesupport 3.2.11 remote: Fetching builder 3.0.4 remote: Installing builder 3.0.4 remote: Fetching activemodel 3.2.11 remote: Installing activemodel 3.2.11 remote: Fetching erubis 2.7.0 remote: Installing erubis 2.7.0 remote: Fetching journey 1.0.4 remote: Installing journey 1.0.4 remote: Fetching rack 1.4.4 remote: Installing rack 1.4.4 remote: Fetching rack-cache 1.2 remote: Installing rack-cache 1.2 remote: Fetching rack-test 0.6.2 remote: Installing rack-test 0.6.2 remote: Fetching hike 1.2.1 remote: Installing hike 1.2.1 remote: Fetching tilt 1.3.3 remote: Installing tilt 1.3.3 remote: Fetching sprockets 2.2.2 remote: Installing sprockets 2.2.2 remote: Fetching actionpack 3.2.11 remote: Installing actionpack 3.2.11 remote: Fetching mime-types 1.19 remote: Installing mime-types 1.19 remote: Fetching polyglot 0.3.3 remote: Installing polyglot 0.3.3 remote: Fetching treetop 1.4.12 remote: Installing treetop 1.4.12 remote: Fetching mail 2.4.4 remote: Installing mail 2.4.4 remote: Fetching actionmailer 3.2.11 remote: Installing actionmailer 3.2.11 remote: Fetching arel 3.0.2 remote: Installing arel 3.0.2 remote: Fetching tzinfo 0.3.35 remote: Installing tzinfo 0.3.35 remote: Fetching activerecord 3.2.11 remote: Installing activerecord 3.2.11 remote: Fetching activeresource 3.2.11 remote: Installing activeresource 3.2.11 remote: Using bundler 1.17.2 remote: Fetching coffee-script-source 1.4.0 remote: Installing coffee-script-source 1.4.0 remote: Fetching execjs 1.4.0 remote: Installing execjs 1.4.0 remote: Fetching coffee-script 2.2.0 remote: Installing coffee-script 2.2.0 remote: Fetching rack-ssl 1.3.2 remote: Installing rack-ssl 1.3.2 remote: Fetching json 1.7.6 remote: Installing json 1.7.6 with native extensions remote: Fetching rdoc 3.12 remote: Installing rdoc 3.12 remote: Fetching thor 0.16.0 remote: Installing thor 0.16.0 remote: Fetching railties 3.2.11 remote: Installing railties 3.2.11 remote: Fetching coffee-rails 3.2.2 remote: Installing coffee-rails 3.2.2 remote: Fetching jquery-rails 2.2.0 remote: Installing jquery-rails 2.2.0 remote: Fetching pg 0.14.1 remote: Installing pg 0.14.1 with native extensions remote: Fetching rails 3.2.11 remote: Installing rails 3.2.11 remote: Fetching sass 3.2.5 remote: Installing sass 3.2.5 remote: Fetching sass-rails 3.2.6 remote: Installing sass-rails 3.2.6 remote: Fetching uglifier 1.3.0 remote: Installing uglifier 1.3.0 remote: Bundle complete! 6 Gemfile dependencies, 40 gems now installed. remote: Gems in the groups development and test were not installed. remote: Bundled gems are installed into `./vendor/bundle` remote: Post-install message from rdoc: remote: Depending on your version of ruby, you may need to install ruby rdoc/ri data: remote: remote: <= 1.8.6 : unsupported remote: = 1.8.7 : gem install rdoc-data; rdoc-data --install remote: = 1.9.1 : gem install rdoc-data; rdoc-data --install remote: >= 1.9.2 : nothing to do! Yay! remote: Bundle completed (14.08s) remote: Cleaning up the bundler cache. remote: -----> Writing config/database.yml to read from DATABASE_URL remote: -----> Installing node-v8.10.0-linux-x64 remote: -----> Detecting rake tasks remote: -----> Preparing app for Rails asset pipeline remote: Running: rake assets:precompile remote: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from at /tmp/build_d734e3b0c78f48698e0d4217410bcdd9/Rakefile:7) remote: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from at /tmp/build_d734e3b0c78f48698e0d4217410bcdd9/Rakefile:7) remote: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from at /tmp/build_d734e3b0c78f48698e0d4217410bcdd9/Rakefile:7) remote: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from at /tmp/build_d734e3b0c78f48698e0d4217410bcdd9/Rakefile:7) remote: Asset precompilation completed (6.29s) remote: -----> Detecting rails configuration remote: remote: ###### WARNING: remote: remote: Injecting plugin 'rails_log_stdout' remote: remote: ###### WARNING: remote: remote: Injecting plugin 'rails3_serve_static_assets' remote: remote: ###### WARNING: remote: remote: Add 'rails_12factor' gem to your Gemfile to skip plugin injection remote: remote: ###### WARNING: remote: remote: No Procfile detected, using the default web server. remote: We recommend explicitly declaring how to boot your server process via a Procfile. remote: https://devcenter.heroku.com/articles/ruby-default-web-server remote: remote: remote: -----> Discovering process types remote: Procfile declares types -> (none) remote: Default types for buildpack -> console, rake, web remote: remote: -----> Compressing... remote: Done: 31.9M remote: -----> Launching... remote: Released v6 remote: https://glacial-ravine-68630.herokuapp.com/ deployed to Heroku remote: remote: ! Warning: You are running on a deprecated stack. remote: ! Please upgrade to the latest stack by following the instructions on: remote: ! https://devcenter.heroku.com/articles/upgrading-to-the-latest-stack remote: remote: Verifying deploy... done. To https://git.heroku.com/glacial-ravine-68630.git * [new branch] master -> master ``` Co-authored-by: Colby Swandale (cherry picked from commit c3ba633b749484490a38c661b79fbbfa7a62d633) --- lib/bundler/source/metadata.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/bundler/source/metadata.rb b/lib/bundler/source/metadata.rb index 9c5657eef6..d9c93bfb67 100644 --- a/lib/bundler/source/metadata.rb +++ b/lib/bundler/source/metadata.rb @@ -19,9 +19,8 @@ module Bundler # can't point to the actual gemspec or else the require paths will be wrong s.loaded_from = File.expand_path("..", __FILE__) end - if loaded_spec = Bundler.rubygems.loaded_specs("bundler") - idx << loaded_spec # this has to come after the fake gemspec, to override it - elsif local_spec = Bundler.rubygems.find_name("bundler").find {|s| s.version.to_s == VERSION } + + if local_spec = Bundler.rubygems.find_name("bundler").find {|s| s.version.to_s == VERSION } idx << local_spec end -- cgit v1.2.1 From d29ecebe8ab1a72d79010cdfe37f75d2667b6d11 Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Fri, 28 Dec 2018 12:55:32 +1100 Subject: update gemspec to require RubyGems 3.0.0 --- bundler.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundler.gemspec b/bundler.gemspec index 26fc32278a..60ead665e3 100644 --- a/bundler.gemspec +++ b/bundler.gemspec @@ -36,7 +36,7 @@ Gem::Specification.new do |s| if s.version >= Gem::Version.new("2.a".dup) s.required_ruby_version = ">= 2.3.0" - s.required_rubygems_version = ">= 2.5.0" + s.required_rubygems_version = ">= 3.0.0" else s.required_ruby_version = ">= 1.8.7" s.required_rubygems_version = ">= 1.3.6" -- cgit v1.2.1 From 13ca0004db174440741294db27d41e8adb4adfb9 Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Fri, 28 Dec 2018 12:56:58 +1100 Subject: update tested versions of RubyGems in travis --- .travis.yml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 085e2028ff..8b3d8b25bf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,6 +32,7 @@ rvm: - 2.5.3 - 2.4.5 - 2.3.8 + - 2.6.0 # Rubygems versions MUST be available as rake tasks # see Rakefile:125 for the list of possible RGV values @@ -39,21 +40,13 @@ env: # We need to know if changes to rubygems will break bundler on release - RGV=master # Test the latest rubygems release with all of our supported rubies - - RGV=v2.7.7 + - RGV=v3.0.1 matrix: include: # 3.x mode - rvm: 2.5.3 - env: RGV=v2.7.7 BUNDLER_SPEC_SUB_VERSION=3.0.0 - # Ruby 2.4, Rubygems 2.6 and up - - rvm: 2.4.5 - env: RGV=v2.6.14 - # Ruby 2.3, Rubygems 2.5 and up - - rvm: 2.3.8 - env: RGV=v2.5.2 - - rvm: 2.3.8 - env: RGV=v2.6.14 + env: RGV=v3.0.1 BUNDLER_SPEC_SUB_VERSION=3.0.0 # Ruby-head (we want to know how we're doing, but not fail the build) - rvm: ruby-head env: RGV=master -- cgit v1.2.1 From 00caa91d13319f55c152aa6df3534b7b3ef1fd17 Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Fri, 28 Dec 2018 12:57:26 +1100 Subject: Version 2.0.0.pre.3 wih changelog --- CHANGELOG.md | 10 ++++++++++ lib/bundler/version.rb | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f9f6569fb..0c4d69a3db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +## 2.0.0.pre.3 (2018-12-28) + +Breaking Changes: + + - Bundler 2 now requires RubyGems 3.0.0 at minimum + +Changes: + + - Import changes from Bundler 1.17.3 release + ## 2.0.0.pre.2 (2018-11-27) Breaking Changes: diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb index bf6c477c92..92411d0cab 100644 --- a/lib/bundler/version.rb +++ b/lib/bundler/version.rb @@ -7,7 +7,7 @@ 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.0.pre.2" unless defined?(::Bundler::VERSION) + VERSION = "2.0.0.pre.3" unless defined?(::Bundler::VERSION) def self.overwrite_loaded_gem_version begin -- cgit v1.2.1 From a0ee4cd11d99414d1ef9e9a49c825279fad3aad0 Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Fri, 28 Dec 2018 13:02:27 +1100 Subject: add RubyGems v3.0.1 to rg clone task --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index b328fb06a2..5276fc75b8 100644 --- a/Rakefile +++ b/Rakefile @@ -144,7 +144,7 @@ begin rubyopt = ENV["RUBYOPT"] # When editing this list, also edit .travis.yml! branches = %w[master] - releases = %w[v1.3.6 v1.3.7 v1.4.2 v1.5.3 v1.6.2 v1.7.2 v1.8.29 v2.0.14 v2.1.11 v2.2.5 v2.4.8 v2.5.2 v2.6.8 v2.6.14 v2.7.7] + releases = %w[v1.3.6 v1.3.7 v1.4.2 v1.5.3 v1.6.2 v1.7.2 v1.8.29 v2.0.14 v2.1.11 v2.2.5 v2.4.8 v2.5.2 v2.6.8 v2.6.14 v2.7.7 v3.0.1] (branches + releases).each do |rg| desc "Run specs with RubyGems #{rg}" RSpec::Core::RakeTask.new(rg) do |t| -- cgit v1.2.1 From 53e4ffa93c0685357ad7dbe7ab34ad471d742cda Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Sun, 30 Dec 2018 03:20:18 +0000 Subject: Merge #6856 6856: Test against Ruby 2.6 and RubyGems 3 r=colby-swandale a=segiddins The problem was we weren't testing our compatibility with the latest and greatest. Co-authored-by: Samuel Giddins Co-authored-by: Colby Swandale (cherry picked from commit a63a39d738865665f714f179fe42dd10006da26d) --- .travis.yml | 2 +- bundler.gemspec | 6 +++--- lib/bundler/current_ruby.rb | 1 + lib/bundler/spec_set.rb | 28 ++++++++++++++++++++++------ man/gemfile.5.ronn | 8 ++++---- spec/commands/exec_spec.rb | 3 ++- spec/lock/lockfile_bundler_1_spec.rb | 6 +++--- spec/quality_spec.rb | 6 +++++- spec/runtime/setup_spec.rb | 4 +++- spec/support/helpers.rb | 2 +- spec/support/path.rb | 4 ++++ 11 files changed, 49 insertions(+), 21 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8b3d8b25bf..57dec9ae49 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,10 +29,10 @@ addons: secure: "TrzIv116JLGUxm6PAUskCYrv8KTDguncKROVwbnjVPKTGDAgoDderd8JUdDEXrKoZ9qGLD2TPYKExt9/QDl71E+qHdWnVqWv4HKCUk2P9z/VLKzHuggOUBkCXiJUhjywUieCJhI3N92bfq2EjSBbu2/OFHqWOjLQ+QCooTEBjv8=" rvm: + - 2.6.0 - 2.5.3 - 2.4.5 - 2.3.8 - - 2.6.0 # Rubygems versions MUST be available as rake tasks # see Rakefile:125 for the list of possible RGV values diff --git a/bundler.gemspec b/bundler.gemspec index 60ead665e3..af65811f23 100644 --- a/bundler.gemspec +++ b/bundler.gemspec @@ -8,8 +8,6 @@ rescue LoadError require File.expand_path("../bundler/version", __FILE__) end -require "shellwords" - Gem::Specification.new do |s| s.name = "bundler" s.version = Bundler::VERSION @@ -49,7 +47,9 @@ Gem::Specification.new do |s| s.add_development_dependency "ronn", "~> 0.7.3" s.add_development_dependency "rspec", "~> 3.6" - s.files = `git ls-files -z`.split("\x0").select {|f| f.match(%r{^(lib|exe)/}) } + 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)/}) } + # 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. s.files += Dir.glob("man/**/*") diff --git a/lib/bundler/current_ruby.rb b/lib/bundler/current_ruby.rb index d5efaad6c5..ae5fae841e 100644 --- a/lib/bundler/current_ruby.rb +++ b/lib/bundler/current_ruby.rb @@ -19,6 +19,7 @@ module Bundler 2.4 2.5 2.6 + 2.7 ].freeze KNOWN_MAJOR_VERSIONS = KNOWN_MINOR_VERSIONS.map {|v| v.split(".", 2).first }.uniq.freeze diff --git a/lib/bundler/spec_set.rb b/lib/bundler/spec_set.rb index 5003b2cbec..bbdf04a7d6 100644 --- a/lib/bundler/spec_set.rb +++ b/lib/bundler/spec_set.rb @@ -1,16 +1,12 @@ # frozen_string_literal: true require "tsort" -require "forwardable" require "set" module Bundler class SpecSet - extend Forwardable - include TSort, Enumerable - - def_delegators :@specs, :<<, :length, :add, :remove, :size, :empty? - def_delegators :sorted, :each + include Enumerable + include TSort def initialize(specs) @specs = specs @@ -132,6 +128,26 @@ module Bundler what_required(req) << spec end + def <<(spec) + @specs << spec + end + + def length + @specs.length + end + + def size + @specs.size + end + + def empty? + @specs.empty? + end + + def each(&b) + sorted.each(&b) + end + private def sorted diff --git a/man/gemfile.5.ronn b/man/gemfile.5.ronn index f4772f6d8d..c941463edc 100644 --- a/man/gemfile.5.ronn +++ b/man/gemfile.5.ronn @@ -216,13 +216,13 @@ used on platforms with Ruby 2.3, use: The full list of platforms and supported versions includes: * `ruby`: - 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5 + 1.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 + 1.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 + 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6 * `x64_mingw`: - 2.0, 2.1, 2.2, 2.3, 2.4, 2.5 + 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6 As with groups, you can specify one or more platforms: diff --git a/spec/commands/exec_spec.rb b/spec/commands/exec_spec.rb index 76841dcff6..2e3cb6621e 100644 --- a/spec/commands/exec_spec.rb +++ b/spec/commands/exec_spec.rb @@ -765,10 +765,11 @@ __FILE__: #{path.to_s.inspect} 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" + system_gems :bundler file = bundled_app("file_that_bundle_execs.rb") create_file(file, <<-RB) #!#{Gem.ruby} - puts `bundle exec echo foo` + puts `#{system_bundle_bin_path} exec echo foo` RB file.chmod(0o777) bundle! "exec #{file}", :system_bundler => true diff --git a/spec/lock/lockfile_bundler_1_spec.rb b/spec/lock/lockfile_bundler_1_spec.rb index 851fbea99a..e89c5078d9 100644 --- a/spec/lock/lockfile_bundler_1_spec.rb +++ b/spec/lock/lockfile_bundler_1_spec.rb @@ -78,7 +78,7 @@ RSpec.describe "the lockfile format", :bundler => "< 3" do 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 <<-L + lockfile normalize_uri_file(<<-L) GEM remote: file://localhost#{gem_repo1}/ specs: @@ -94,13 +94,13 @@ RSpec.describe "the lockfile format", :bundler => "< 3" do #{version} L - install_gemfile <<-G + install_gemfile normalize_uri_file(<<-G) source "file://localhost#{gem_repo1}" gem "rack" G - lockfile_should_be <<-G + lockfile_should_be normalize_uri_file(<<-G) GEM remote: file://localhost#{gem_repo1}/ specs: diff --git a/spec/quality_spec.rb b/spec/quality_spec.rb index 812acc344f..ce7058afc0 100644 --- a/spec/quality_spec.rb +++ b/spec/quality_spec.rb @@ -261,7 +261,11 @@ RSpec.describe "The library itself" do end end - expect(last_command.stdboth.split("\n")).to be_well_formed + warnings = last_command.stdboth.split("\n") + # ignore warnings around deprecated Object#=~ method in RubyGems + warnings.reject! {|w| w =~ %r{rubygems\/version.rb.*deprecated\ Object#=~} } + + expect(warnings).to be_well_formed end end end diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb index 15dd1fe190..c41738a598 100644 --- a/spec/runtime/setup_spec.rb +++ b/spec/runtime/setup_spec.rb @@ -886,7 +886,9 @@ end end end - it "should succesfully require 'bundler/setup'", :ruby_repo do + # 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 install_gemfile "" ENV["GEM_PATH"] = symlinked_gem_home.path diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index 181dac3220..43bf6af229 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -104,7 +104,7 @@ module Spec bundle_bin = options.delete("bundle_bin") || bindir.join("bundle") if system_bundler = options.delete(:system_bundler) - bundle_bin = "-S bundle" + bundle_bin = system_bundle_bin_path end env = options.delete(:env) || {} diff --git a/spec/support/path.rb b/spec/support/path.rb index 03a96893f3..38f7145dc7 100644 --- a/spec/support/path.rb +++ b/spec/support/path.rb @@ -90,6 +90,10 @@ module Spec tmp("gems/system", *path) end + def system_bundle_bin_path + system_gem_path("bin/bundle") + end + def lib_path(*args) tmp("libs", *args) end -- cgit v1.2.1 From 526bb665e5c45c77928da18a5f9b16dbc8281ce3 Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Sun, 30 Dec 2018 15:51:50 +1100 Subject: update CHANGELOG with new changes and release --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c4d69a3db..a114f3c1eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 2.0.0.pre.3 (2018-12-28) +## 2.0.0.pre.3 (2018-12-30) Breaking Changes: @@ -6,8 +6,11 @@ Breaking Changes: Changes: + - Ruby 2.6 compatibility fixes (@segiddins) - Import changes from Bundler 1.17.3 release +Note: To upgrade your Gemfile to Bundler 2 you will need to run `bundle update --bundler` + ## 2.0.0.pre.2 (2018-11-27) Breaking Changes: -- cgit v1.2.1 From d715ae9e612ad002dbe1b62db59d2abdd0f2dd77 Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Thu, 3 Jan 2019 11:33:51 +1100 Subject: Bundler 2.0 with changelog --- CHANGELOG.md | 4 ++++ lib/bundler/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a114f3c1eb..77b69b421a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.0 (2019-01-03) + +No new changes + ## 2.0.0.pre.3 (2018-12-30) Breaking Changes: diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb index 92411d0cab..da356fe50e 100644 --- a/lib/bundler/version.rb +++ b/lib/bundler/version.rb @@ -7,7 +7,7 @@ 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.0.pre.3" unless defined?(::Bundler::VERSION) + VERSION = "2.0.0" unless defined?(::Bundler::VERSION) def self.overwrite_loaded_gem_version begin -- cgit v1.2.1 From 81d3ecf766802f2aab7bb5b6627cd9d597a4eab8 Mon Sep 17 00:00:00 2001 From: Andre Arko Date: Thu, 3 Jan 2019 14:20:23 -0800 Subject: Lower required RubyGems to 2.5 or greater It turns out that every existing version of RubyGems will ignore the required RubyGems version and try to install the newest version of Bundler... until the middle of the install, when it will raise an exception and fail. There are some bugfixes in RubyGems 3 that improve the quality of life for Bundler 2 users, but they are less bad than RubyGems simply exploding anytime you try to run `gem install bundler`. --- bundler.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundler.gemspec b/bundler.gemspec index af65811f23..fff5d0dfd5 100644 --- a/bundler.gemspec +++ b/bundler.gemspec @@ -34,7 +34,7 @@ Gem::Specification.new do |s| if s.version >= Gem::Version.new("2.a".dup) s.required_ruby_version = ">= 2.3.0" - s.required_rubygems_version = ">= 3.0.0" + s.required_rubygems_version = ">= 2.5.0" else s.required_ruby_version = ">= 1.8.7" s.required_rubygems_version = ">= 1.3.6" -- cgit v1.2.1 From 31678a323f42b48c29cc7c1208205afd3c137087 Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Fri, 4 Jan 2019 09:58:11 +1100 Subject: update tested rubygems in travis --- .travis.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.travis.yml b/.travis.yml index 57dec9ae49..f34ea4ca81 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,6 +47,21 @@ matrix: # 3.x mode - rvm: 2.5.3 env: RGV=v3.0.1 BUNDLER_SPEC_SUB_VERSION=3.0.0 + # Ruby 2.5, Rubygems 2.7 and up + - rvm: 2.5.3 + env: RGV=v2.7.7 + # Ruby 2.4, Rubygems 2.6 and up + - rvm: 2.4.5 + env: RGV=v2.6.14 + - rvm: 2.4.5 + env: RGV=v2.7.7 + # Ruby 2.3, Rubygems 2.5 and up + - rvm: 2.3.7 + env: RGV=v2.5.2 + - rvm: 2.3.7 + env: RGV=v2.6.14 + - rvm: 2.3.7 + env: RGV=v2.7.7 # Ruby-head (we want to know how we're doing, but not fail the build) - rvm: ruby-head env: RGV=master -- cgit v1.2.1 From d7ad2192ff5da41ba70ae9c21ca3e62559081df4 Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Fri, 4 Jan 2019 11:20:04 +1100 Subject: Version 2.0.1 with changelog --- CHANGELOG.md | 6 ++++++ lib/bundler/version.rb | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77b69b421a..f0ca151f49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 2.0.1 (2019-01-04) + +Changes: + + - Relaxed RubyGems requirement to `>= 2.5.0` ([#6867](https://github.com/bundler/bundler/pull/6867)) + ## 2.0.0 (2019-01-03) No new changes diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb index da356fe50e..401f62447c 100644 --- a/lib/bundler/version.rb +++ b/lib/bundler/version.rb @@ -7,7 +7,7 @@ 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.0" unless defined?(::Bundler::VERSION) + VERSION = "2.0.1" unless defined?(::Bundler::VERSION) def self.overwrite_loaded_gem_version begin -- cgit v1.2.1 From 28e346e4f95551697229104ace51f4a7417b5ed3 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Sun, 9 Dec 2018 22:40:36 +0000 Subject: Merge #6834 6834: Allow files other than Gemfile.lock to be opened in definition specs r=hsbt a=segiddins ### What was the end-user problem that led to this PR? The problem was the specs are brittle. ### What was your diagnosis of the problem? My diagnosis was we should assume code can open other files. ### What is your fix for the problem, implemented in this PR? My fix allows other files to be opened, and only raises when opening the file under test. Co-authored-by: Samuel Giddins (cherry picked from commit cca1f63bffc47c7b016810d24e13e2dd4fdced12) --- spec/bundler/definition_spec.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/bundler/definition_spec.rb b/spec/bundler/definition_spec.rb index a38c0b05b0..a27c5b0a54 100644 --- a/spec/bundler/definition_spec.rb +++ b/spec/bundler/definition_spec.rb @@ -13,6 +13,7 @@ RSpec.describe Bundler::Definition do subject { Bundler::Definition.new(nil, [], Bundler::SourceList.new, []) } it "raises an PermissionError with explanation" do + allow(File).to receive(:open).and_call_original expect(File).to receive(:open).with("Gemfile.lock", "wb"). and_raise(Errno::EACCES) expect { subject.lock("Gemfile.lock") }. @@ -23,6 +24,7 @@ RSpec.describe Bundler::Definition do subject { Bundler::Definition.new(nil, [], Bundler::SourceList.new, []) } it "raises a TemporaryResourceError with explanation" do + allow(File).to receive(:open).and_call_original expect(File).to receive(:open).with("Gemfile.lock", "wb"). and_raise(Errno::EAGAIN) expect { subject.lock("Gemfile.lock") }. -- cgit v1.2.1 From 1abe61578c59f8ff13ca61ef5adce8c133860b34 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Tue, 5 Feb 2019 01:39:04 +0000 Subject: Merge #6941 6941: Ignore to add bundler lib direcotry if it is same as rubylibdir r=hsbt a=hsbt ### What was the end-user problem that led to this PR? In ruby core, the bundled bundler was located same as rubylibdir. When user used the specific version of default gems like json, Bundler uses default gems under the rubylibdir, not a specific version. Fixed https://bugs.ruby-lang.org/issues/15469 ### What was your diagnosis of the problem? See the details: https://bugs.ruby-lang.org/issues/15469#note-4 ### What is your fix for the problem, implemented in this PR? I avoid adding bundler directory from RUBYLIB environmental variable Because its directory was already added $LOAD_PATH. Co-authored-by: SHIBATA Hiroshi (cherry picked from commit 9cbc7dd8f77bcc12fd7e4265ebbd948f0e19b7f7) --- lib/bundler/shared_helpers.rb | 3 ++- spec/bundler/shared_helpers_spec.rb | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb index 50214901c5..8d7c8763ed 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" @@ -340,7 +341,7 @@ module Bundler def set_rubylib rubylib = (ENV["RUBYLIB"] || "").split(File::PATH_SEPARATOR) - rubylib.unshift bundler_ruby_lib + rubylib.unshift bundler_ruby_lib unless RbConfig::CONFIG["rubylibdir"] == bundler_ruby_lib Bundler::SharedHelpers.set_env "RUBYLIB", rubylib.uniq.join(File::PATH_SEPARATOR) end diff --git a/spec/bundler/shared_helpers_spec.rb b/spec/bundler/shared_helpers_spec.rb index b66c43fd92..fcac37b398 100644 --- a/spec/bundler/shared_helpers_spec.rb +++ b/spec/bundler/shared_helpers_spec.rb @@ -261,6 +261,15 @@ RSpec.describe Bundler::SharedHelpers do subject.set_bundle_environment end + it "ignores if bundler_ruby_lib is same as rubylibdir" do + allow(Bundler::SharedHelpers).to receive(:bundler_ruby_lib).and_return(RbConfig::CONFIG["rubylibdir"]) + + subject.set_bundle_environment + + paths = (ENV["RUBYLIB"]).split(File::PATH_SEPARATOR) + expect(paths.count(RbConfig::CONFIG["rubylibdir"])).to eq(0) + end + it "exits if bundle path contains the unix-like path separator" do if Gem.respond_to?(:path_separator) allow(Gem).to receive(:path_separator).and_return(":") -- cgit v1.2.1 From d43b4fb3de4e4ce752d7389f688be913e0e97854 Mon Sep 17 00:00:00 2001 From: The Bundler Bot Date: Thu, 21 Jun 2018 01:31:57 +0000 Subject: Auto merge of #6586 - bundler:segiddins/softer-major-deprecations, r=indirect [SharedHelpers] Only hard-error on major deprecations in the following version ### What was the end-user problem that led to this PR? The problem was, actually I'm not sure. @indirect ? Addresses the first bullet point in https://github.com/bundler/bundler/issues/6582. ### What was your diagnosis of the problem? My diagnosis was we should only hard error on deprecations in the major version _after_ we stop supporting them. (cherry picked from commit d44d803357506895555ff97f73e60d593820a0de) --- lib/bundler/shared_helpers.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb index 8d7c8763ed..3c0901ed67 100644 --- a/lib/bundler/shared_helpers.rb +++ b/lib/bundler/shared_helpers.rb @@ -141,12 +141,13 @@ 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 FROM #{major_version.succ}.0] #{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}") -- cgit v1.2.1 From 115df2642722dcdb2cf9e4ddb3a51aec9e6f4afa Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Sat, 9 Feb 2019 00:23:58 +1100 Subject: remove path that i copied from my personal computer --- spec/commands/binstubs_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/commands/binstubs_spec.rb b/spec/commands/binstubs_spec.rb index 7f2e81c099..6eedc5b854 100644 --- a/spec/commands/binstubs_spec.rb +++ b/spec/commands/binstubs_spec.rb @@ -137,14 +137,14 @@ RSpec.describe "bundle binstubs " do before do gemfile <<-G - source "file:///Users/colby/Projects/bundler/tmp/gems/remote2" + source "https://rubygems.org" gem "rack" gem "prints_loaded_gems" G lockfile <<-G GEM - remote: file:///Users/colby/Projects/bundler/tmp/gems/remote2/ + remote: https://rubygems.org specs: prints_loaded_gems (1.0) rack (1.2) -- cgit v1.2.1 From 87c8dd3a08d5c873c53dedb2c7f43074d252f255 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Wed, 20 Feb 2019 07:14:53 +0000 Subject: Merge #6973 6973: Backport the latest commits on ruby core repository. r=hsbt a=hsbt ### What was the end-user problem that led to this PR? RSpec example of the bundled bundler was failed on Ruby 2.7 from ruby core repository. I fixed some of the issues on ruby core repository. ### What was your diagnosis of the problem? 1. I fixed the location of `lib/bundler.gemspec` to `lib/bundler/bundler.gemspec` for fixing gemspec issue of Ruby 2.6.1: https://github.com/ruby/ruby/commit/7c9771be02ddc707fea8ec96089c8a100c59f806 2. The current Bundler examples relied on the same versions of Ruby that are the first binary of PATH and rspec invocation binary. But the ruby core repository uses the different versions for them. ### What is your fix for the problem, implemented in this PR? I fixed the location path of bundler.gemspec and uses `ENV['BUNDLE_GEM']` instead of hard-coded `gem` command. ### Why did you choose this fix out of the possible options? There is no options on ruby core repository. I welcome to another options. Co-authored-by: SHIBATA Hiroshi (cherry picked from commit 98a0a2dfdd42d9f624682915ab27fe1d4319def8) --- lib/bundler/gem_helper.rb | 6 ++++-- lib/bundler/shared_helpers.rb | 2 +- spec/commands/clean_spec.rb | 12 ++++++++---- spec/quality_spec.rb | 14 +++++++++++--- spec/runtime/setup_spec.rb | 2 +- spec/support/helpers.rb | 12 ++++++++---- spec/support/rubygems_ext.rb | 5 +++-- 7 files changed, 36 insertions(+), 17 deletions(-) diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb index e7673cba88..55f484f723 100644 --- a/lib/bundler/gem_helper.rb +++ b/lib/bundler/gem_helper.rb @@ -74,7 +74,8 @@ module Bundler def build_gem file_name = nil - sh("gem build -V '#{spec_path}'") do + gem = ENV["BUNDLE_GEM"] ? ENV["BUNDLE_GEM"] : "gem" + sh("#{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") @@ -85,7 +86,8 @@ module Bundler def install_gem(built_gem_path = nil, local = false) built_gem_path ||= build_gem - out, _ = sh_with_code("gem install '#{built_gem_path}'#{" --local" if local}") + 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/] Bundler.ui.confirm "#{name} (#{version}) installed." end diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb index 3c0901ed67..ac29179d4d 100644 --- a/lib/bundler/shared_helpers.rb +++ b/lib/bundler/shared_helpers.rb @@ -278,7 +278,7 @@ module Bundler # avoid stepping above the tmp directory when testing gemspec = if ENV["BUNDLE_RUBY"] && ENV["BUNDLE_GEM"] # for Ruby Core - "lib/bundler.gemspec" + "lib/bundler/bundler.gemspec" else "bundler.gemspec" end diff --git a/spec/commands/clean_spec.rb b/spec/commands/clean_spec.rb index 158d58d67c..e1f007fc35 100644 --- a/spec/commands/clean_spec.rb +++ b/spec/commands/clean_spec.rb @@ -339,7 +339,8 @@ RSpec.describe "bundle clean" do gem "rack" G - sys_exec! "gem list" + gem = ruby_core? ? ENV["BUNDLE_GEM"] : "gem" + sys_exec! "#{gem} list" expect(out).to include("rack (1.0.0)").and include("thin (1.0)") end @@ -461,7 +462,8 @@ RSpec.describe "bundle clean" do end bundle! :update, :all => bundle_update_requires_all? - sys_exec! "gem list" + gem = ruby_core? ? ENV["BUNDLE_GEM"] : "gem" + sys_exec! "#{gem} list" expect(out).to include("foo (1.0.1, 1.0)") end @@ -485,7 +487,8 @@ RSpec.describe "bundle clean" do bundle "clean --force" expect(out).to include("Removing foo (1.0)") - sys_exec "gem list" + gem = ruby_core? ? ENV["BUNDLE_GEM"] : "gem" + sys_exec "#{gem} list" expect(out).not_to include("foo (1.0)") expect(out).to include("rack (1.0.0)") end @@ -519,7 +522,8 @@ RSpec.describe "bundle clean" do expect(out).to include(system_gem_path.to_s) expect(out).to include("grant write permissions") - sys_exec "gem list" + gem = ruby_core? ? ENV["BUNDLE_GEM"] : "gem" + sys_exec "#{gem} list" expect(out).to include("foo (1.0)") expect(out).to include("rack (1.0.0)") end diff --git a/spec/quality_spec.rb b/spec/quality_spec.rb index ce7058afc0..b24b42c542 100644 --- a/spec/quality_spec.rb +++ b/spec/quality_spec.rb @@ -225,7 +225,16 @@ RSpec.describe "The library itself" do it "can still be built" do Dir.chdir(root) do begin - gem_command! :build, gemspec + if ruby_core? + spec = Gem::Specification.load(gemspec.to_s) + spec.bindir = "libexec" + File.open(root.join("bundler.gemspec").to_s, "w") {|f| f.write spec.to_ruby } + gem_command! :build, root.join("bundler.gemspec").to_s + FileUtils.rm(root.join("bundler.gemspec").to_s) + else + 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.*/, "") @@ -236,8 +245,7 @@ RSpec.describe "The library itself" do end ensure # clean up the .gem generated - path_prefix = ruby_core? ? "lib/" : "./" - FileUtils.rm("#{path_prefix}bundler-#{Bundler::VERSION}.gem") + FileUtils.rm("bundler-#{Bundler::VERSION}.gem") end end end diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb index c41738a598..f2f750a9ca 100644 --- a/spec/runtime/setup_spec.rb +++ b/spec/runtime/setup_spec.rb @@ -876,7 +876,7 @@ end FileUtils.ln_s(bundler_dir, File.join(gems_dir, "bundler-#{Bundler::VERSION}")) - gemspec_file = ruby_core? ? "#{bundler_dir}/lib/bundler.gemspec" : "#{bundler_dir}/bundler.gemspec" + gemspec_file = ruby_core? ? "#{bundler_dir}/lib/bundler/bundler.gemspec" : "#{bundler_dir}/bundler.gemspec" gemspec = File.read(gemspec_file). sub("Bundler::VERSION", %("#{Bundler::VERSION}")) gemspec = gemspec.lines.reject {|line| line =~ %r{lib/bundler/version} }.join diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index 43bf6af229..89c67c45b7 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -313,12 +313,16 @@ module Spec gem_repo = options.fetch(:gem_repo) { gem_repo1 } gems.each do |g| path = if g == :bundler - Dir.chdir(root) { gem_command! :build, gemspec.to_s } - bundler_path = if ruby_core? - root + "lib/bundler-#{Bundler::VERSION}.gem" + if ruby_core? + spec = Gem::Specification.load(gemspec.to_s) + spec.bindir = "libexec" + File.open(root.join("bundler.gemspec").to_s, "w") {|f| f.write spec.to_ruby } + Dir.chdir(root) { gem_command! :build, root.join("bundler.gemspec").to_s } + FileUtils.rm(root.join("bundler.gemspec")) else - root + "bundler-#{Bundler::VERSION}.gem" + 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} g else diff --git a/spec/support/rubygems_ext.rb b/spec/support/rubygems_ext.rb index c18f7650fc..063738c798 100644 --- a/spec/support/rubygems_ext.rb +++ b/spec/support/rubygems_ext.rb @@ -59,10 +59,11 @@ module Spec 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.ruby} -S gem" cmd = if Gem::VERSION < "2.0.0" - "gem install #{deps} --no-rdoc --no-ri --conservative" + "#{gem} install #{deps} --no-rdoc --no-ri --conservative" else - "gem install #{deps} --no-document --conservative" + "#{gem} install #{deps} --no-document --conservative" end puts cmd system(cmd) || raise("Installing gems #{deps} for the tests to use failed!") -- cgit v1.2.1 From fa150290b851d2bbf47bfef6fb1637a96098fa31 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Wed, 20 Feb 2019 12:02:36 +0000 Subject: Merge #6977 6977: Update the location of bundler gemspec. r=deivid-rodriguez a=hsbt ### What was the end-user problem that led to this PR? On the ruby core repository has the original patch for the test suite. The current bundler repository was inconsistency status with it. ### What was your diagnosis of the problem? This pull-request was the missing commit of https://github.com/bundler/bundler/pull/6973 ### What is your fix for the problem, implemented in this PR? The test suite of bundler break the inconsistency gemspec location, Co-authored-by: SHIBATA Hiroshi (cherry picked from commit 7199b124d4b6d217fc1dff2f1e93dda151ad9664) --- bundler.gemspec | 2 +- spec/support/path.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bundler.gemspec b/bundler.gemspec index fff5d0dfd5..0ce9fe7125 100644 --- a/bundler.gemspec +++ b/bundler.gemspec @@ -5,7 +5,7 @@ begin require File.expand_path("../lib/bundler/version", __FILE__) rescue LoadError # for Ruby core repository - require File.expand_path("../bundler/version", __FILE__) + require File.expand_path("../version", __FILE__) end Gem::Specification.new do |s| diff --git a/spec/support/path.rb b/spec/support/path.rb index 38f7145dc7..69efcba051 100644 --- a/spec/support/path.rb +++ b/spec/support/path.rb @@ -9,7 +9,7 @@ module Spec end def gemspec - @gemspec ||= root.join(ruby_core? ? "lib/bundler.gemspec" : "bundler.gemspec") + @gemspec ||= root.join(ruby_core? ? "lib/bundler/bundler.gemspec" : "bundler.gemspec") end def bindir -- cgit v1.2.1 From 42192fa8b5c252803589bfeb57b6de36fc372306 Mon Sep 17 00:00:00 2001 From: The Bundler Bot Date: Sat, 28 Apr 2018 06:37:55 +0000 Subject: Auto merge of #6503 - koic:use_dir_instead_of_file_in_newgem_template, r=hsbt Use `__dir__` instead of `__FILE__` in newgem.gemspec template Since Ruby 2.0 we've had `__dir__` as well as `__FILE__`. The initial gem codes written with `bundle gem` using Ruby 2.0 or higher is an old description using `__FILE__`. Ruby 1.9 is EOL, so I think that there is not much Gem to start developed using it. This PR uses `__dir__` when starting Gem development (i.e. `bundle gem`) using Ruby 2.0 or higher version. (cherry picked from commit 0c5d3b8c1f391aa5175321675ecd91ee6a1f231b) --- lib/bundler/templates/newgem/newgem.gemspec.tt | 4 +++- lib/bundler/templates/newgem/test/test_helper.rb.tt | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/bundler/templates/newgem/newgem.gemspec.tt b/lib/bundler/templates/newgem/newgem.gemspec.tt index faf6f7bbc5..113bf82eb2 100644 --- a/lib/bundler/templates/newgem/newgem.gemspec.tt +++ b/lib/bundler/templates/newgem/newgem.gemspec.tt @@ -1,8 +1,10 @@ <%- if RUBY_VERSION < "2.0.0" -%> # coding: utf-8 -<%- end -%> lib = File.expand_path("../lib", __FILE__) +<%- else -%> +lib = File.expand_path("lib", __dir__) +<%- end -%> $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "<%= config[:namespaced_path] %>/version" diff --git a/lib/bundler/templates/newgem/test/test_helper.rb.tt b/lib/bundler/templates/newgem/test/test_helper.rb.tt index 725e3e4647..335c4704ec 100644 --- a/lib/bundler/templates/newgem/test/test_helper.rb.tt +++ b/lib/bundler/templates/newgem/test/test_helper.rb.tt @@ -1,4 +1,8 @@ +<%- if RUBY_VERSION < "2.0.0" -%> $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__) +<%- else -%> +$LOAD_PATH.unshift File.expand_path("../lib", __dir__) +<%- end -%> require "<%= config[:namespaced_path] %>" require "minitest/autorun" -- cgit v1.2.1 From 01b898cd41e9a2f3eca924c2321611f8ce8c9770 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Wed, 3 Oct 2018 11:48:21 +0000 Subject: Merge #6721 6721: http:// URLs in the gemspec r=colby-swandale a=amatsuda ### What was the end-user problem that led to this PR? When the users visit https://rubygems.org/gems/bundler and click the links, or access the gem metadata from scripts e.g. gem-src, we're seeing unneeded redirection from http://... to https://... because both github.com and bundler.io redirects http requests to https. ### What is your fix for the problem, implemented in this PR? Rewrote all http:// URLs in the gemspec to https://. Co-authored-by: Akira Matsuda (cherry picked from commit e115a839123a21365904fd86980452d2b2b0283e) --- bundler.gemspec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bundler.gemspec b/bundler.gemspec index 0ce9fe7125..7b31506536 100644 --- a/bundler.gemspec +++ b/bundler.gemspec @@ -19,16 +19,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 -- cgit v1.2.1 From 560e922d2221136a933f318d543489ec54d8e550 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Wed, 17 Oct 2018 12:00:52 +0000 Subject: Merge #6739 6739: Remove the duplicate gems from suggestions r=colby-swandale a=y-yagi ### What was the end-user problem that led to this PR? If the lock file has the same gems for different platforms, the suggestion includes all those gems. For example, using the [Rails's lock file](https://github.com/rails/rails/blob/4a51cbba58435bbba65ca50670bd6ae4887942bd/Gemfile.lock), it shows like this: ``` $ bundle update mai Could not find gem 'mai'. Did you mean ffi, ffi, ffi, ffi, mail, ast, jwt, que or wdm? ``` ### What was your diagnosis of the problem? Missing consideration when lock file contains the same gem. ### What is your fix for the problem, implemented in this PR? I removed the same name using `uniq`. Co-authored-by: yuuji.yaginuma (cherry picked from commit a144e72484ee16fb57a13fb1ba1a54ebefaf5b2e) --- lib/bundler/cli/common.rb | 2 +- spec/commands/update_spec.rb | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/bundler/cli/common.rb b/lib/bundler/cli/common.rb index 9d40ee9dfd..0490453538 100644 --- a/lib/bundler/cli/common.rb +++ b/lib/bundler/cli/common.rb @@ -72,7 +72,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 diff --git a/spec/commands/update_spec.rb b/spec/commands/update_spec.rb index 1effba6526..786719f50d 100644 --- a/spec/commands/update_spec.rb +++ b/spec/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 @@ -116,8 +117,8 @@ RSpec.describe "bundle update" do expect(out).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(out).to include "Did you mean platform_specific?" end end -- cgit v1.2.1 From 6d1555023e1dd5afa18e55c5c0efef1662717e36 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Tue, 23 Oct 2018 20:54:54 +0000 Subject: Merge #6751 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6751: Fix BUNDLE_PATH_RELATIVE_TO_CWD env variable name r=greysteil a=deivid-rodriguez ### What was the end-user problem that led to this PR? The problem was that an environment variable in the docs does not work. ### What was your diagnosis of the problem? My diagnosis was that its name is incorrect. ### What is your fix for the problem, implemented in this PR? My fix is to fix the typo. ### Why did you choose this fix out of the possible options? I chose this fix because it's the only non absurd fix. Co-authored-by: David Rodríguez (cherry picked from commit c24e8f5d341842b1124a94edefc7c339bf45c56f) --- man/bundle-config.ronn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/bundle-config.ronn b/man/bundle-config.ronn index b5c97ae82d..379b778348 100644 --- a/man/bundle-config.ronn +++ b/man/bundle-config.ronn @@ -227,7 +227,7 @@ 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. -- cgit v1.2.1 From c793d160b6accd94738caa1245f3edbe2c29d6bc Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Mon, 29 Oct 2018 13:38:16 +0000 Subject: Merge #6764 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6764: Remove unnecessary stuff from specs r=colby-swandale a=deivid-rodriguez I wrote this patch a while ago but I didn't propose it because I didn't think it would be accepted. Now I think we're ready. The problem was that the specs have a lot of conditional behavior on `Gem::VERSION`. My diagnosis was that this was necessary because of testing against a big range of rubygems versions on the latest stable branch. My fix is to remove all the conditionals since we'll no longer test against rubygems versions that old on the latest stable, once #6763 lands. I chose this fix because it makes test code simpler. Co-authored-by: David Rodríguez (cherry picked from commit 27ab011a686cfbd99fdee56362f68b961458f976) --- Rakefile | 15 ++++----------- lib/bundler/templates/newgem/newgem.gemspec.tt | 15 ++++----------- spec/bundler/gem_helper_spec.rb | 19 +------------------ spec/commands/newgem_spec.rb | 24 +++--------------------- spec/support/builders.rb | 7 +------ spec/support/helpers.rb | 7 ++----- spec/support/rubygems_ext.rb | 7 +------ 7 files changed, 16 insertions(+), 78 deletions(-) diff --git a/Rakefile b/Rakefile index 5276fc75b8..4710ffbdc5 100644 --- a/Rakefile +++ b/Rakefile @@ -48,17 +48,10 @@ namespace :spec do deps.delete("rdiscount") end - if Gem::VERSION < "2.0.0" - deps.sort_by {|name, _| name }.map do |name, version| - gem_install_command = "install --no-ri --no-rdoc --conservative #{name} -v '#{version}'" - sh %(#{Gem.ruby} -S gem #{gem_install_command}) - end - else - gem_install_command = "install --no-document --conservative " + deps.sort_by {|name, _| name }.map do |name, version| - "'#{name}:#{version}'" - end.join(" ") - sh %(#{Gem.ruby} -S gem #{gem_install_command}) - end + gem_install_command = "install --no-document --conservative " + deps.sort_by {|name, _| name }.map do |name, version| + "'#{name}:#{version}'" + end.join(" ") + sh %(#{Gem.ruby} -S gem #{gem_install_command}) # Download and install gems used inside tests $LOAD_PATH.unshift("./spec") diff --git a/lib/bundler/templates/newgem/newgem.gemspec.tt b/lib/bundler/templates/newgem/newgem.gemspec.tt index 113bf82eb2..c1a50fe912 100644 --- a/lib/bundler/templates/newgem/newgem.gemspec.tt +++ b/lib/bundler/templates/newgem/newgem.gemspec.tt @@ -21,18 +21,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. diff --git a/spec/bundler/gem_helper_spec.rb b/spec/bundler/gem_helper_spec.rb index a627129fe3..774da9d45b 100644 --- a/spec/bundler/gem_helper_spec.rb +++ b/spec/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 diff --git a/spec/commands/newgem_spec.rb b/spec/commands/newgem_spec.rb index e6d6e19122..2914ba66c5 100644 --- a/spec/commands/newgem_spec.rb +++ b/spec/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 @@ -202,9 +191,6 @@ 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 @@ -298,7 +284,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" @@ -397,7 +382,6 @@ RSpec.describe "bundle gem" do end it "depends on a specific version of rspec", :rubygems => ">= 1.8.1" do - remove_push_guard(gem_name) rspec_dep = generated_gem.gemspec.development_dependencies.find {|d| d.name == "rspec" } expect(rspec_dep).to be_specific end @@ -448,7 +432,6 @@ RSpec.describe "bundle gem" do end it "depends on a specific version of minitest", :rubygems => ">= 1.8.1" do - remove_push_guard(gem_name) rspec_dep = generated_gem.gemspec.development_dependencies.find {|d| d.name == "minitest" } expect(rspec_dep).to be_specific 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" diff --git a/spec/support/builders.rb b/spec/support/builders.rb index 97134a045a..458f6e9e69 100644 --- a/spec/support/builders.rb +++ b/spec/support/builders.rb @@ -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 diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index 89c67c45b7..ff1f5c39b3 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -331,11 +331,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 diff --git a/spec/support/rubygems_ext.rb b/spec/support/rubygems_ext.rb index 063738c798..fb734b3983 100644 --- a/spec/support/rubygems_ext.rb +++ b/spec/support/rubygems_ext.rb @@ -59,12 +59,7 @@ module Spec 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.ruby} -S gem" - cmd = if Gem::VERSION < "2.0.0" - "#{gem} install #{deps} --no-rdoc --no-ri --conservative" - else - "#{gem} install #{deps} --no-document --conservative" - end + cmd = "#{Gem.ruby} -S gem install #{deps} --no-document --conservative" puts cmd system(cmd) || raise("Installing gems #{deps} for the tests to use failed!") end -- cgit v1.2.1 From c1f9761ee7de5be24f7a2cdf3f8a56845acd5d16 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Tue, 30 Oct 2018 01:44:34 +0000 Subject: Merge #6769 6769: Fix `remove` when block method appears in gem name r=segiddins a=dduugg Thanks so much for the contribution! To make reviewing this PR a bit easier, please fill out answers to the following questions. ### What was the end-user problem that led to this PR? https://github.com/bundler/bundler/issues/6768 ### What was your diagnosis of the problem? `remove_nested_blocks` considers any appearance of text matching a block method (`group source env install_if`) to be an occurrence of a nested block. ### What is your fix for the problem, implemented in this PR? `remove_nested_blocks` should only reduce the scope of where a nested block method can occur. ### Why did you choose this fix out of the possible options? Another approach would use word delimiters rather than `starts_with?` to find nested block methods, but this is probably fine. Co-authored-by: Douglas Eichelberger (cherry picked from commit 70f2afe1cfadfe888d6bd1100fac6672dd7baab6) --- lib/bundler/injector.rb | 14 +++++++------- spec/commands/remove_spec.rb | 24 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 7 deletions(-) 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/spec/commands/remove_spec.rb b/spec/commands/remove_spec.rb index faeb654b14..0eb86f96ff 100644 --- a/spec/commands/remove_spec.rb +++ b/spec/commands/remove_spec.rb @@ -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 -- cgit v1.2.1 From 8f2548bbb50e1efa2f622727665e2038a1856cb3 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Tue, 6 Nov 2018 07:31:19 +0000 Subject: Merge #6773 6773: Fix indentation of bundler executable r=segiddins a=meganemura Thanks so much for the contribution! To make reviewing this PR a bit easier, please fill out answers to the following questions. ### What was the end-user problem that led to this PR? `bundle binstubs bundler` generates the file like followings. ```ruby require "rubygems" m = Module.new do module_function def invoked_as_script? File.expand_path($0) == File.expand_path(__FILE__) end (snip) end ``` ### What was your diagnosis of the problem? My diagnosis was... the template's `module_function` line is not match to other lines. ### What is your fix for the problem, implemented in this PR? I fix the template. ### Why did you choose this fix out of the possible options? no other options. Co-authored-by: meganemura (cherry picked from commit 905dce42705d0e92fa5c74ce4b9133c7d77a6fb1) --- lib/bundler/templates/Executable.bundler | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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__) -- cgit v1.2.1 From 1d2853fb93068ad6dd9b5bc1776c19cb46af7f72 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Fri, 16 Nov 2018 10:37:20 +0000 Subject: Merge #6775 6775: [Plugin::Index] Only register each plugin once for a given hook r=colby-swandale a=segiddins ### What was the end-user problem that led to this PR? The problem was running `plugin install` twice for a plugin withs hooks would cause that hook to be registered twice. Closes #6771. ### What was your diagnosis of the problem? My diagnosis was a plugin's hooks should only be run once per event. ### What is your fix for the problem, implemented in this PR? My fix is to `uniq` the list of plugins registered for each event. Co-authored-by: Samuel Giddins Co-authored-by: Olle Jonsson Co-authored-by: Colby Swandale (cherry picked from commit 05b552ccafb6fc6492e498edaeddd0979657c517) --- lib/bundler/plugin/index.rb | 5 ++++- spec/bundler/plugin/index_spec.rb | 11 +++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/bundler/plugin/index.rb b/lib/bundler/plugin/index.rb index f09587dfda..cac3b81d51 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 diff --git a/spec/bundler/plugin/index_spec.rb b/spec/bundler/plugin/index_spec.rb index ca3476ea2a..e18e960fb8 100644 --- a/spec/bundler/plugin/index_spec.rb +++ b/spec/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") } -- cgit v1.2.1 From 1ec2f75bbdc9e511ddd77b3b344a0796e6b3c5ed Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Sat, 17 Nov 2018 15:25:58 +0000 Subject: Merge #6790 6790: Fix multiple source warning messages from `error` to `warn` r=greysteil a=jlw I've been working on a few repos for most of this year that use a privately-hosted gem with the same name (but completely different purpose) as a gem hosted at rubygems.org - whenever I start with a clean copy and `bundle install` for the first time, I am presented with a warning in red that the gem was found in multiple sources. The red text makes me think that something went wrong, even though bundler did exactly what I wanted it to do. The user experience is wrong - a warning should not be red. When I looked at the source, I saw immediately that the warning was using `Bundler.ui.error` instead of `Bundler.ui.warn`. This is a bug fix with a limited lifespan - after setting up a local copy of bundler I see that 2.0's handling of multiple sources A) is smarter and bypasses the error in most of the repos where I saw it with bundler 1.x; and B) fails early with a different error message in the remaining repos. The fix is simply switching to `Bundler.ui.warn` in this case. _I didn't see any other possible options._ Co-authored-by: Jeremy Weathers (cherry picked from commit f160d15fe4e1cb25fad6a34ed9abd10b21f587f8) --- lib/bundler/cli/install.rb | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb index 55e90ead0e..2e6a777409 100644 --- a/lib/bundler/cli/install.rb +++ b/lib/bundler/cli/install.rb @@ -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 -- cgit v1.2.1 From 893e8ae07254c780dec016803259946ce76f806e Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Wed, 21 Nov 2018 13:54:13 +0000 Subject: Merge #6774 6774: [Definition] Dont pin path deps to newer versions r=segiddins a=segiddins ### What was the end-user problem that led to this PR? The problem was setting `only_update_to_newer_versions` would break using path gems. Closes #6750 ### What was your diagnosis of the problem? My diagnosis was path gems should _always_ get their version used, since there's 0 alternative versions from a path source. ### What is your fix for the problem, implemented in this PR? My fix should circuits the list of additional requirements when the dependency's source is a path source. ### Why did you choose this fix out of the possible options? I chose this fix because it solves the problem in the same place that has the feature flag conditional Co-authored-by: Samuel Giddins Co-authored-by: Grey Baker (cherry picked from commit 60672b40a473d746826c9940763e4597b05d701f) --- lib/bundler/definition.rb | 4 +++- spec/install/gemfile/gemspec_spec.rb | 14 ++++++++++++++ spec/install/gemfile/path_spec.rb | 14 ++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index c5e94c7123..8ef9381ce7 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -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/spec/install/gemfile/gemspec_spec.rb b/spec/install/gemfile/gemspec_spec.rb index bbb56da5a4..b2503eaba7 100644 --- a/spec/install/gemfile/gemspec_spec.rb +++ b/spec/install/gemfile/gemspec_spec.rb @@ -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 diff --git a/spec/install/gemfile/path_spec.rb b/spec/install/gemfile/path_spec.rb index a508c971ad..449327d344 100644 --- a/spec/install/gemfile/path_spec.rb +++ b/spec/install/gemfile/path_spec.rb @@ -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 -- cgit v1.2.1 From 65df5e64e4eb67961c179b52a7bb1cc8e7398a0a Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Sat, 24 Nov 2018 21:59:43 +0000 Subject: Merge #6806 6806: Todo remove require for Bundler 2.0 r=colby-swandale a=gavrieltal Co-authored-by: Gavriel Loria (cherry picked from commit c9dca0d6c6fafc9569caa2b42830f5a2368df368) --- lib/bundler/installer/parallel_installer.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/bundler/installer/parallel_installer.rb b/lib/bundler/installer/parallel_installer.rb index f8a849ccfc..6f9f177fba 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 -- cgit v1.2.1 From fbab11810635b6c0843446320e7902186c7c715c Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Sat, 24 Nov 2018 22:34:25 +0000 Subject: Merge #6805 6805: [Plugin] Ignore the deployment setting r=colby-swandale a=segiddins ### What was the end-user problem that led to this PR? The problem was installing a new plugin in deployment mode would fail with a suggestion the lock file was corrupted, when it installed fine without deployment mode. Fixes #6795. ### What was your diagnosis of the problem? My diagnosis was deployment mode was interfering with installing a new plugin. ### What is your fix for the problem, implemented in this PR? My fix overrides the deployment and frozen settings when creating the plugin Definition. ### Why did you choose this fix out of the possible options? I chose this fix because having a "frozen" plugin bundle makes no sense, since plugins aren't written to the lockfile. Co-authored-by: Samuel Giddins (cherry picked from commit 07d22aebd892b1b0ee8e3829bec57abb13864981) --- lib/bundler/plugin.rb | 24 +++++++++++++----------- spec/plugins/install_spec.rb | 22 ++++++++++++++++++++++ 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/lib/bundler/plugin.rb b/lib/bundler/plugin.rb index 53f9806b73..2b783e16f6 100644 --- a/lib/bundler/plugin.rb +++ b/lib/bundler/plugin.rb @@ -53,20 +53,22 @@ module Bundler # @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/spec/plugins/install_spec.rb b/spec/plugins/install_spec.rb index 9304d78062..e70503fb18 100644 --- a/spec/plugins/install_spec.rb +++ b/spec/plugins/install_spec.rb @@ -173,6 +173,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 -- cgit v1.2.1 From 9bca235729444a35c8759dc6be5446d089272fa2 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Wed, 23 Jan 2019 10:30:51 +0000 Subject: Merge #6884 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6884: Remove unnecessary condition r=hsbt a=deivid-rodriguez ### What was the end-user problem that led to this PR? The problem was that some code in the feature flags implementation seemed uncovered. ### What was your diagnosis of the problem? My diagnosis was that the code should be either covered or removed. ### What is your fix for the problem, implemented in this PR? My fix was to remove the code. ### Why did you choose this fix out of the possible options? I chose this fix because the scenario where that code would get covered is more likely to be unintentional and risk introducing a bug. Defining a feature flag without a default block is the same as don't defining a feature flag and just relying on the default value for the setting. In these circumstances, it's more likely that the developer forgot to include a default block, so letting that case crash would be better, I think. Co-authored-by: David Rodríguez (cherry picked from commit ab06ed2e865cb40c75c83bc76bb7161277d6a185) --- lib/bundler/feature_flag.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bundler/feature_flag.rb b/lib/bundler/feature_flag.rb index e5b4e84063..7ee1e0d431 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 -- cgit v1.2.1 From 0bddeb6ecc87842d2876c103c7b7b61e892b5ba5 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Wed, 23 Jan 2019 11:31:32 +0000 Subject: Merge #6315 6315: Removed compatibility hack for old rubies. r=hsbt a=hsbt Nothing. Bundler will never use them in version 2. Co-authored-by: SHIBATA Hiroshi (cherry picked from commit 1b2559ab57da944e92f93db61a0a322642cd0b31) --- lib/bundler/env.rb | 10 ++-------- lib/bundler/gem_helper.rb | 10 ++++------ 2 files changed, 6 insertions(+), 14 deletions(-) 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/gem_helper.rb b/lib/bundler/gem_helper.rb index 55f484f723..27243a9821 100644 --- a/lib/bundler/gem_helper.rb +++ b/lib/bundler/gem_helper.rb @@ -181,14 +181,12 @@ module Bundler 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 -- cgit v1.2.1 From d92c08cde859b270b903ff3b329426b7e38da2d1 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Wed, 23 Jan 2019 15:54:12 +0000 Subject: Merge #6923 6923: Ignore `Object =~` warnings. r=segiddins a=hsbt ### What was the end-user problem that led to this PR? We faced a lot of warnings with `rake spec` of bundler repository. ### What was your diagnosis of the problem? Ruby 2.7.0-dev added the warnings for `Object =~` comparison. ### What is your fix for the problem, implemented in this PR? I added the additional condition and bump a version of the development dependency. Co-authored-by: SHIBATA Hiroshi (cherry picked from commit e66e6f2fb7d595151bd77a342a07c9cd15e3cac0) --- bundler.gemspec | 2 +- spec/support/less_than_proc.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bundler.gemspec b/bundler.gemspec index 7b31506536..2886042bbf 100644 --- a/bundler.gemspec +++ b/bundler.gemspec @@ -42,7 +42,7 @@ Gem::Specification.new do |s| 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 "rake", "~> 12.0" s.add_development_dependency "rdiscount", "~> 2.2" s.add_development_dependency "ronn", "~> 0.7.3" s.add_development_dependency "rspec", "~> 3.6" diff --git a/spec/support/less_than_proc.rb b/spec/support/less_than_proc.rb index ddac5458b7..68d37b44c9 100644 --- a/spec/support/less_than_proc.rb +++ b/spec/support/less_than_proc.rb @@ -6,7 +6,7 @@ class LessThanProc < Proc def self.with(present) provided = Gem::Version.new(present.dup) new do |required| - if required =~ /[=><~]/ + if required.is_a?(String) && required =~ /[=><~]/ !Gem::Requirement.new(required).satisfied_by?(provided) else provided < Gem::Version.new(required) -- cgit v1.2.1 From 74ed4a8d79f45170db07799aa44831b947e2d3d6 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Thu, 24 Jan 2019 00:18:27 +0000 Subject: Merge #6926 6926: Move Rubocop development dependency into gemspec r=hsbt a=alyssais The problem was that tools like RubyGems.org or Bundix that use the gemspec as the source of truth for dependencies didn't pick up on the development dependency on Rubocop. My diagnosis was that the reason for this, which was that Rubocop had a minimum Ruby version of 2.0.0, was no longer an issue, since Bundler 2 doesn't support Rubies that old anyway. My fix was to move the Rubocop requirement into the gemspec. I chose this fix because it addresses the problem I was having, feels right, and the old workaround doesn't look like it's necessary any more. Co-authored-by: Alyssa Ross (cherry picked from commit e58436ef762ef1120024bbcda2620637f0484547) --- Rakefile | 10 +++------- bundler.gemspec | 1 + 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Rakefile b/Rakefile index 4710ffbdc5..1254bf2149 100644 --- a/Rakefile +++ b/Rakefile @@ -40,7 +40,6 @@ namespace :spec do deps = Hash[BUNDLER_SPEC.development_dependencies.map do |d| [d.name, d.requirement.to_s] end] - deps["rubocop"] ||= "= 0.49.1" if RUBY_VERSION >= "2.0.0" # can't go in the gemspec because of the ruby version requirement # JRuby can't build ronn or rdiscount, so we skip that if defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby" @@ -92,12 +91,9 @@ begin RSpec::Core::RakeTask.new task :spec => "man:build" - if RUBY_VERSION >= "2.0.0" - # can't go in the gemspec because of the ruby version requirement - gem "rubocop", "= 0.49.1" - require "rubocop/rake_task" - RuboCop::RakeTask.new - end + require "rubocop/rake_task" + rubocop = RuboCop::RakeTask.new + rubocop.options = ["--parallel"] namespace :spec do task :clean do diff --git a/bundler.gemspec b/bundler.gemspec index 2886042bbf..bf0d532c01 100644 --- a/bundler.gemspec +++ b/bundler.gemspec @@ -46,6 +46,7 @@ Gem::Specification.new do |s| s.add_development_dependency "rdiscount", "~> 2.2" s.add_development_dependency "ronn", "~> 0.7.3" s.add_development_dependency "rspec", "~> 3.6" + s.add_development_dependency "rubocop", "= 0.50.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)/}) } -- cgit v1.2.1 From a97a20ef5952280c7c3a69173a7da5a4724b8fe6 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Mon, 28 Jan 2019 09:36:10 +0000 Subject: Merge #6935 6935: Make URLs in document consistent and secure r=greysteil a=aeroastro There are 3 documentation problems * End-users experience 301 redirect when visiting http://www.bundler.io and http://bundler.io * End-users might accidentally send email addresses via http version of https://slack.bundler.io, which is not redirected automatically. * Partially fixing this is O.K., but consistent URLs throughout the documentation are easy to use. I have manually visited the Slack invitation URL on https://bundler.io/ and noticed the problem. Following are the simple curl command to explain this problem. ``` $ curl -I http://slack.bundler.io HTTP/1.1 200 OK Server: Cowboy Connection: keep-alive X-Powered-By: Express Content-Type: text/html; charset=utf-8 Content-Length: 3726 Etag: W/"QPm3qygnJrqeFm+KK+VifA==" Date: Mon, 28 Jan 2019 07:32:02 GMT Via: 1.1 vegur ``` ``` $ curl -I http://www.bundler.io HTTP/1.1 301 Moved Permanently Content-Type: text/html; charset=utf-8 Location: https://bundler.io X-Redirector-Version: 84a0a5c Date: Mon, 28 Jan 2019 07:32:28 GMT ``` ``` $ curl -I http://bundler.io HTTP/1.1 301 Moved Permanently Server: GitHub.com Content-Type: text/html Location: https://bundler.io/ X-GitHub-Request-Id: FF7E:37F3:4DD47F:595032:5C4EB012 Content-Length: 178 Accept-Ranges: bytes Date: Mon, 28 Jan 2019 07:32:35 GMT Via: 1.1 varnish Age: 0 Connection: keep-alive X-Served-By: cache-nrt6127-NRT X-Cache: MISS X-Cache-Hits: 0 X-Timer: S1548660755.461639,VS0,VE91 Vary: Accept-Encoding X-Fastly-Request-ID: 8c832766ee3154dc26abd3e1adcd1258a243e4ce ``` My fix is to replace old URLs with new URLs. * Replace Slack invitation URLs with safe https ones * Replace http://www.bundler.io with https://bundler.io * Replace http://bundler.io with https://bundler.io Because rewriting URLs on document is easy and simple. Optionally, if someone could implement 301 redirect on Slack invitation URL, it would further help the issue. Co-authored-by: Takumasa Ochi (cherry picked from commit 2b8015c2aa696209526f5747d09ee41f48553d46) --- CODE_OF_CONDUCT.md | 140 +++++++++++++++++++++++++++++------ README.md | 2 +- doc/README.md | 4 +- doc/TROUBLESHOOTING.md | 4 +- doc/contributing/COMMUNITY.md | 4 +- doc/contributing/GETTING_HELP.md | 2 +- doc/contributing/HOW_YOU_CAN_HELP.md | 4 +- doc/contributing/ISSUES.md | 4 +- doc/contributing/README.md | 2 +- doc/documentation/README.md | 4 +- doc/documentation/VISION.md | 2 +- doc/documentation/WRITING.md | 6 +- lib/bundler/cli/issue.rb | 4 +- man/bundle-init.ronn | 2 +- man/bundle.ronn | 2 +- man/gemfile.5.ronn | 2 +- spec/resolver/basic_spec.rb | 2 +- 17 files changed, 142 insertions(+), 48 deletions(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 9d9cc4343a..cca34071bf 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,42 +1,136 @@ # Bundler Code of Conduct -The Bundler project strongly values contributors from anywhere, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, physical appearance, body size, race, ethnicity, age, religion, or nationality. As a result, the Bundler team has agreed to and enforces this code of conduct in order to provide a harassment-free experience for everyone who participates in the development of Bundler. +## When Something Happens -### Summary +If you see a Code of Conduct violation, follow these steps: -Harassment in code and discussion or violation of physical boundaries is completely unacceptable anywhere in the Bundler project’s codebases, issue trackers, chat rooms, mailing lists, meetups, and any other events. Violators will be warned and then blocked or banned by the core team at or before the 3rd violation. +1. Let the person know that what they did is not appropriate and ask them to stop and/or edit their message(s). +2. That person should immediately stop the behavior and correct the issue. +3. If this doesn't happen, or if you're uncomfortable speaking up, [contact admins](#contacting-admins). +4. As soon as available, an admin will join, identify themselves, and take [further action (see below)](#further-enforcement), starting with a warning, then temporary deactivation, then long-term deactivation. -### In detail +When reporting, please include any relevant details, links, screenshots, context, or other information that may be used to better understand and resolve the situation. -Harassment includes offensive verbal comments related to level of experience, gender, gender identity and expression, sexual orientation, disability, physical appearance, body size, race, ethnicity, age, religion, nationality, the use of sexualized language or imagery, deliberate intimidation, stalking, sustained disruption, and unwelcome sexual attention. +**The admin team will prioritize the well-being and comfort of the recipients of the violation over the comfort of the violator.** See [some examples below](#enforcement-examples). -Individuals asked to stop any harassing behavior are expected to comply immediately. +## Our Pledge -Maintainers, including the core team, are also subject to the anti-harassment policy. +In the interest of fostering an open and welcoming environment, we as members of the Bundler community pledge to making participation in our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, technical preferences, nationality, personal appearance, race, religion, or sexual identity and orientation. -If anyone engages in abusive, harassing, or otherwise unacceptable behavior, including maintainers, we may take appropriate action, up to and including warning the offender, deletion of comments, removal from the project’s codebase and communication systems, and escalation to GitHub support. +## Our Standards -If you are being harassed, notice that someone else is being harassed, or have any other concerns, please contact a member of [the core team](http://bundler.io/contributors.html) or [email the core team](mailto:team@bundler.io) immediately. +Examples of behavior that contributes to creating a positive environment include: -We expect everyone to follow these rules anywhere in the Bundler project’s codebases, issue trackers, IRC channel, group chat, and mailing lists. +- Using welcoming and inclusive language. +- Being respectful of differing viewpoints and experiences. +- Gracefully accepting constructive feedback. +- Focusing on what is best for the community. +- Showing empathy and kindness towards other community members. -This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. +Examples of unacceptable behavior by participants include: -Finally, don't forget that it is human to make mistakes! We all do. Let’s work together to help each other, resolve issues, and learn from the mistakes that we will all inevitably make from time to time. +- The use of sexualized language or imagery and unwelcome sexual attention or advances, including when simulated online. The only exception to sexual topics is channels/spaces specifically for topics of sexual identity. +- Trolling, insulting/derogatory comments, and personal or political attacks. +- Casual mention of slavery or indentured servitude and/or false comparisons of one's occupation or situation to slavery. Please consider using or asking about alternate terminology when referring to such metaphors in technology. +- Making light of/making mocking comments about trigger warnings and content warnings. +- Public or private harassment, deliberate intimidation, or threats. +- Publishing others' private information, such as a physical or electronic address, without explicit permission. This includes any sort of "outing" of any aspect of someone's identity without their consent. +- Publishing screenshots or quotes, especially from identity channels, without all quoted users' _explicit_ consent. +- Publishing or telling others that a member belongs to a particular identity channel without asking their consent first. +- Publishing of non-harassing private communication. +- Any of the above even when [presented as "ironic" or "joking"](https://en.wikipedia.org/wiki/Hipster_racism). +- Any attempt to present "reverse-ism" versions of the above as violations. Examples of reverse-isms are "reverse racism", "reverse sexism", "heterophobia", and "cisphobia". +- Unsolicited explanations under the assumption that someone doesn't already know it. Ask before you teach! Don't assume what people's knowledge gaps are. +- [Feigning or exaggerating surprise](https://www.recurse.com/manual#no-feigned-surprise) when someone admits to not knowing something. +- "[Well-actuallies](https://www.recurse.com/manual#no-well-actuallys)" +- Other conduct which could reasonably be considered inappropriate in a professional or community setting. +## Scope -### Thanks +This Code of Conduct applies both within community spaces and in other spaces involving the community. This includes the GitHub repository, the Bundler Slack instance, the Bundler Twitter community, private email communications in the context of the community, and any events where members of the community are participating, as well as adjacent communities and venues affecting the community's members. -Thanks to the [JSConf Code of Conduct](http://jsconf.com/codeofconduct.html) and [Fedora Code of Conduct](http://fedoraproject.org/code-of-conduct) for inspiration and ideas. Additional thanks to [Contributor Covenant](http://contributor-covenant.org) for the [default code of conduct](https://github.com/bundler/bundler/blob/master/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt) included in generated gems. +Depending on the violation, the admins may decide that violations of this code of conduct that have happened outside of the scope of the community may deem an individual unwelcome, and take appropriate action to maintain the comfort and safety of its members. +This Code of Conduct is detailed for the purpose of removing ambiguity, not for the sake of strictness. It is the sincere hope of admins that it helps foster mutual understanding, and the creation of a space where everyone can participate in a way relevant to the project itself, without things going horribly due to accidental/well-intentioned toe stepping. Please be kind to one another! -### License +## Admin Enforcement Process -

- To the extent possible under law, The Bundler Team has waived all copyright and related or neighboring rights to the Bundler Code of Conduct. This work is published from the United States. -
-
- - CC0 - -

+Once the admins get involved, they will follow a documented series of steps and do their best to preserve the well-being of community members. This section covers actual concrete steps. + +### Contacting Admins + +You may get in touch with the Bundler admin team through any of the following methods: + +- Email [the Bundler maintainers](https://bundler.io/contributors.html) as a group at [team@bundler.io](mailto:team@bundler.io). +- Directly message any maintainer in private (through Slack, Twitter, email, or other available option) if that is more comfortable + +### Further Enforcement + +If you've already followed the [initial enforcement steps](#enforcement), these are the steps admins will take for further enforcement, as needed: + +1. Repeat the request to stop. +2. If the person doubles down, they will be removed from the discussion (where possible), and given an official warning. +3. If the behavior continues or is repeated later, the person will be blocked/deactivated for 24 hours. +4. If the behavior continues or is repeated after the temporary deactivation, a long-term (6-12mo) deactivation will be used. + +On top of this, admins may remove any offending messages, images, contributions, etc, as they deem necessary. + +Admins reserve full rights to skip any of these steps, at their discretion, if the violation is considered to be a serious and/or immediate threat to the health and well-being of members of the community. These include any threats, serious physical or verbal attacks, and other such behavior that would be completely unacceptable in any social setting that puts our members at risk. + +Members expelled from events or venues with any sort of paid attendance will not be refunded. + +### Who Watches the Watchers? + +Admins and other leaders who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the community's leadership. These may include anything from removal from the admin team to a permanent ban from the community. + +### Enforcement Examples + +#### The Best Case + +The vast majority of situations work out like this, in our experience. This interaction is common, and generally positive. + +> Alex: "Yeah I used X and it was really crazy!" + +> Patt: "Hey, could you not use that word? What about 'ridiculous' instead?" + +> Alex: "oh sorry, sure." -> edits old message to say "it was really confusing!" + +#### The Admin Case + +Sometimes, though, you need to get admins involved. Admins will do their best to resolve conflicts, but people who were harmed by something **will take priority**. + +> Patt: "Honestly, sometimes I just really hate using $language and anyone who uses it probably sucks at their job." + +> Alex: "Whoa there, could you dial it back a bit? There's a CoC thing about attacking folks' tech use like that." + +> Patt: "I'm not attacking anyone, are you deaf?" + +> Alex: _DMs admin_ "hey uh. Can someone look at #general? Patt is getting a bit aggro. I tried to nudge them about it, but nope." + +> MxAdmin1: "Hey Patt, admin here. Could you tone it down? This sort of attack is really not okay in this space." + +> Patt: "Leave me alone I haven't said anything bad wtf is wrong with you." + +> MxAdmin1: _removes patt_ _DMs patt_ "I mean it. Please refer to the CoC over at bundler.io/conduct.html if you have questions, but you can consider this an actual warning. I'd appreciate it if you reworded your messages in #general, since they made folks there uncomfortable. Let's try and be kind, yeah?" + +> Patt: _Replies to DM_ "@mxadmin1 Okay sorry. I'm just frustrated and I'm kinda burnt out and I guess I got carried away. I'll DM Alex a note apologizing and edit my messages. Sorry for the trouble." + +> MxAdmin1: _Replies to DM_ "@patt Thanks for that. I hear you on the stress. Burnout sucks :/. Have a good one!" + +#### The Nope Case + +> PepeTheFrog🐸: "Hi, I am a literal actual nazi and I think white supremacists are quite fashionable." + +> Patt: "NOOOOPE. OH NOPE NOPE." + +> Alex: "JFC NO. NOPE. `/admin nope nope nope @ #javascript`" + +> MxAdmin1: "👀 Nope. NOPE NOPE NOPE. 🔥" + +> PepeTheFrog🐸 has been deactivated. + +## Attribution + +This Code of Conduct is adapted from the [package.community Code of Conduct], adapted from the [WeAllJS Code of Conduct](https://wealljs.org/code-of-conduct), itself adapted from [Contributor Covenant](http://contributor-covenant.org) version 1.4, available at [http://contributor-covenant.org/version/1/4](http://contributor-covenant.org/version/1/4), as well as the LGBTQ in Technology Slack [Code of Conduct](http://lgbtq.technology/coc.html). + +Additional thanks to [Contributor Covenant](http://contributor-covenant.org) for the [default code of conduct](https://github.com/bundler/bundler/blob/master/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt) included in generated gems. diff --git a/README.md b/README.md index c9b85a7ca4..3a117a9be8 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ bundle install bundle exec rspec ``` -See [bundler.io](http://bundler.io) for the full documentation. +See [bundler.io](https://bundler.io) for the full documentation. ### Troubleshooting diff --git a/doc/README.md b/doc/README.md index 534dd941a7..5fe78d3254 100644 --- a/doc/README.md +++ b/doc/README.md @@ -1,8 +1,8 @@ # Docs: Contributing and developing Bundler -_If you're looking for documentation on how to use Bundler: visit [bundler.io](http://bundler.io/), or run `bundle help` from the command line. You may also be interested in [troubleshooting common issues](TROUBLESHOOTING.md) found when using Bundler._ +_If you're looking for documentation on how to use Bundler: visit [bundler.io](https://bundler.io/), or run `bundle help` from the command line. You may also be interested in [troubleshooting common issues](TROUBLESHOOTING.md) found when using Bundler._ -Bundler welcomes contributions from *everyone*. While contributing, please follow the project [code of conduct](http://bundler.io/conduct.html), so that everyone can be included. +Bundler welcomes contributions from *everyone*. While contributing, please follow the project [code of conduct](https://bundler.io/conduct.html), so that everyone can be included. Maintainers are expected to work together with the community in accordance with [our project policies](POLICIES.md). If you'd like to help make Bundler better, you totally rock! Thanks for helping us make Bundler better. diff --git a/doc/TROUBLESHOOTING.md b/doc/TROUBLESHOOTING.md index 6b1f831c70..7c48813f5e 100644 --- a/doc/TROUBLESHOOTING.md +++ b/doc/TROUBLESHOOTING.md @@ -25,10 +25,10 @@ Please open a ticket with [Heroku](https://www.heroku.com) if you're having trou ## Other problems -First, figure out exactly what it is that you're trying to do (see [XY Problem](http://xyproblem.info/)). Then, go to the [Bundler documentation website](http://bundler.io) and see if we have instructions on how to do that. +First, figure out exactly what it is that you're trying to do (see [XY Problem](http://xyproblem.info/)). Then, go to the [Bundler documentation website](https://bundler.io) and see if we have instructions on how to do that. Second, check [the compatibility -list](http://bundler.io/compatibility.html), and make sure that the version of Bundler that you are using works with the versions of Ruby and RubyGems that you are using. To see your versions: +list](https://bundler.io/compatibility.html), and make sure that the version of Bundler that you are using works with the versions of Ruby and RubyGems that you are using. To see your versions: # Bundler version bundle -v diff --git a/doc/contributing/COMMUNITY.md b/doc/contributing/COMMUNITY.md index 053938ad07..7196ae7d1c 100644 --- a/doc/contributing/COMMUNITY.md +++ b/doc/contributing/COMMUNITY.md @@ -4,10 +4,10 @@ Community is an important part of all we do. If you’d like to be part of the B It would be tremendously helpful to have more people answering questions about Bundler (and often simply about [RubyGems](https://github.com/rubygems/rubygems) or Ruby itself) in our [issue tracker](https://github.com/bundler/bundler/issues) or on [Stack Overflow](http://stackoverflow.com/questions/tagged/bundler). -Additional documentation and explanation is always helpful, too. If you have any suggestions for the Bundler website [bundler.io](http://bundler.io), we would absolutely love it if you opened an issue or pull request on the [bundler-site](https://github.com/bundler/bundler-site) repository. +Additional documentation and explanation is always helpful, too. If you have any suggestions for the Bundler website [bundler.io](https://bundler.io), we would absolutely love it if you opened an issue or pull request on the [bundler-site](https://github.com/bundler/bundler-site) repository. Sharing your experiences and discoveries by writing them up is a valuable way to help others who have similar problems or experiences in the future. You can write a blog post, create an example and commit it to GitHub, take screenshots, or make videos. Publishing examples of how Bundler is used helps everyone, and we’ve discovered that people already use it in ways that we never imagined when we were writing it. If you’re still not sure what to write about, there are also several projects doing interesting things based on Bundler. They could probably use publicity too. -Finally, all contributors to the Bundler project must agree to the contributor [code of conduct](http://bundler.io/conduct.html). By participating in this project you agree to abide by its terms. +Finally, all contributors to the Bundler project must agree to the contributor [code of conduct](https://bundler.io/conduct.html). By participating in this project you agree to abide by its terms. diff --git a/doc/contributing/GETTING_HELP.md b/doc/contributing/GETTING_HELP.md index 55ccb5f5e9..11b5bf9b5e 100644 --- a/doc/contributing/GETTING_HELP.md +++ b/doc/contributing/GETTING_HELP.md @@ -5,7 +5,7 @@ If you have any questions after reading the documentation for contributing, plea The best ways to get in touch are: * [Bundler Slack](https://bundler.slack.com). - * Not a member of the Slack? Join the Bundler team slack [here](http://slack.bundler.io/)! + * Not a member of the Slack? Join the Bundler team slack [here](https://slack.bundler.io/)! * [Bundler mailing list](http://groups.google.com/group/ruby-bundler) You may also find our guide on [filing issues](ISSUES.md) to be helpful as well! diff --git a/doc/contributing/HOW_YOU_CAN_HELP.md b/doc/contributing/HOW_YOU_CAN_HELP.md index 32a6107049..00653e2e0a 100644 --- a/doc/contributing/HOW_YOU_CAN_HELP.md +++ b/doc/contributing/HOW_YOU_CAN_HELP.md @@ -14,7 +14,7 @@ Generally, great ways to get started helping out with Bundler are: - [reporting bugs you encounter or suggesting new features](https://github.com/bundler/bundler/issues/new) - see our [issues guide](ISSUES.md) for help on filing issues - see the [new features documentation](../development/NEW_FEATURES.md) for more - - adding to or editing [the Bundler documentation website](http://bundler.io) and [Bundler man pages](http://bundler.io/man/bundle.1.html) + - adding to or editing [the Bundler documentation website](https://bundler.io) and [Bundler man pages](https://bundler.io/man/bundle.1.html) - [checking issues for completeness](BUG_TRIAGE.md) - closing issues that are not complete - adding a failing test for reproducible [reported bugs](https://github.com/bundler/bundler/issues) @@ -24,4 +24,4 @@ Generally, great ways to get started helping out with Bundler are: - get started setting up your dev environment with [these instructions](../development/SETUP.md) - backfilling [unit tests](https://github.com/bundler/bundler/tree/master/spec/bundler) for modules that lack [coverage](https://codeclimate.com/github/bundler/bundler/coverage) -If nothing on those lists looks good, [talk to us](http://slack.bundler.io/), and we'll figure out what you can help with. We can absolutely use your help, no matter what level of programming skill you have at the moment. +If nothing on those lists looks good, [talk to us](https://slack.bundler.io/), and we'll figure out what you can help with. We can absolutely use your help, no matter what level of programming skill you have at the moment. diff --git a/doc/contributing/ISSUES.md b/doc/contributing/ISSUES.md index 219a775719..361350badd 100644 --- a/doc/contributing/ISSUES.md +++ b/doc/contributing/ISSUES.md @@ -6,9 +6,9 @@ Before filing an issue, check our [troubleshooting guide](../TROUBLESHOOTING.md) ## Documentation -Instructions for common Bundler uses can be found on the [Bundler documentation site](http://bundler.io/). +Instructions for common Bundler uses can be found on the [Bundler documentation site](https://bundler.io/). -Detailed information about each Bundler command, including help with common problems, can be found in the [Bundler man pages](http://bundler.io/man/bundle.1.html) or [Bundler Command Line Reference](http://bundler.io/v1.11/commands.html). +Detailed information about each Bundler command, including help with common problems, can be found in the [Bundler man pages](https://bundler.io/man/bundle.1.html) or [Bundler Command Line Reference](https://bundler.io/v1.11/commands.html). ## Reporting unresolved problems diff --git a/doc/contributing/README.md b/doc/contributing/README.md index 55c742d2ae..fcfcd2ca7e 100644 --- a/doc/contributing/README.md +++ b/doc/contributing/README.md @@ -1,6 +1,6 @@ # Contributing to Bundler -Welcome to Bundler! We are so happy that you're here. We know joining a new open source project can be daunting, so here's a quick overview of what you can expect from this documentation. +Thank you for your interest in making Bundler better! We welcome contributions from everyone. Dozens of contributors like you have submitted feature improvements, fixed bugs, and written new documentation. [Join the Bundler Slack community](https://slack.bundler.io/) to connect with the Bundler core team and other contributors like you. *Something missing?* Send us a [pull request](../development/PULL_REQUESTS.md)! diff --git a/doc/documentation/README.md b/doc/documentation/README.md index bc2e1ceac6..0a9eceff8c 100644 --- a/doc/documentation/README.md +++ b/doc/documentation/README.md @@ -5,9 +5,9 @@ Code needs explanation, and sometimes those who know the code well have trouble Currently, Bundler has two main sources of documentation: 1. built-in `help` (including usage information and man pages) -2. [Bundler documentation site](http://bundler.io) +2. [Bundler documentation site](https://bundler.io) -If you have a suggestion or proposed change for [bundler.io](http://bundler.io), please open an issue or send a pull request to the [bundler-site](https://github.com/bundler/bundler-site) repository. +If you have a suggestion or proposed change for [bundler.io](https://bundler.io), please open an issue or send a pull request to the [bundler-site](https://github.com/bundler/bundler-site) repository. Not sure where to write documentation? In general, follow these guidelines: diff --git a/doc/documentation/VISION.md b/doc/documentation/VISION.md index 3d660ee36d..d401b94e77 100644 --- a/doc/documentation/VISION.md +++ b/doc/documentation/VISION.md @@ -3,7 +3,7 @@ Currently, documentation for using Bundler is spread across two places: 1. built-in `help` (including usage information and man pages) -2. [Bundler documentation site](http://bundler.io) +2. [Bundler documentation site](https://bundler.io) Additional documentation about using Bundler to publish gems can also be found on the [RubyGems guides](http://guides.rubygems.org/). diff --git a/doc/documentation/WRITING.md b/doc/documentation/WRITING.md index e3acf5de48..3975b57043 100644 --- a/doc/documentation/WRITING.md +++ b/doc/documentation/WRITING.md @@ -53,11 +53,11 @@ $ bin/rspec ./spec/commands/help_spec.rb $ bin/rspec ./spec/quality_spec.rb ``` -# Writing docs for [the Bundler documentation site](bundler.io) +# Writing docs for [the Bundler documentation site](https://bundler.io) -If you'd like to submit a pull request for any of the primary commands or utilities on [the Bundler documentation site](bundler.io), please follow the instructions above for writing documentation for man pages from the `bundler/bundler` repository. They are the same in each case. +If you'd like to submit a pull request for any of the primary commands or utilities on [the Bundler documentation site](https://bundler.io), please follow the instructions above for writing documentation for man pages from the `bundler/bundler` repository. They are the same in each case. -Note: Editing `.ronn` files from the `bundler/bundler` repository for the primary commands and utilities documentation is all you need 🎉. There is no need to manually change anything in the `bundler/bundler-site` repository, because the man pages and the docs for primary commands and utilities on [the Bundler documentation site](bundler.io) are one in the same. They are generated automatically from the `bundler/bundler` repository's `.ronn` files from the `rake man/build` command. In other words, after updating `.ronn` file and running `rake man/build` in `bundler`, `.ronn` files map to the auto-generated files in the `source/man` directory of `bundler-site`. +Note: Editing `.ronn` files from the `bundler/bundler` repository for the primary commands and utilities documentation is all you need 🎉. There is no need to manually change anything in the `bundler/bundler-site` repository, because the man pages and the docs for primary commands and utilities on [the Bundler documentation site](https://bundler.io) are one in the same. They are generated automatically from the `bundler/bundler` repository's `.ronn` files from the `rake man/build` command. In other words, after updating `.ronn` file and running `rake man/build` in `bundler`, `.ronn` files map to the auto-generated files in the `source/man` directory of `bundler-site`. Additionally, if you'd like to add a guide or tutorial: in the `bundler/bundler-site` repository, go to `/bundler-site/source/current_version_of_bundler/guides` and add [a new Markdown file](https://guides.github.com/features/mastering-markdown/) (with an extension ending in `.md`). Be sure to correctly format the title of your new guide, like so: ``` 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/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.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.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/spec/resolver/basic_spec.rb b/spec/resolver/basic_spec.rb index c023f5d7aa..04298699e6 100644 --- a/spec/resolver/basic_spec.rb +++ b/spec/resolver/basic_spec.rb @@ -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 -- cgit v1.2.1 From 65c4143beb1ebb281fa44afdd296298d22b4cc66 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Sun, 10 Feb 2019 18:27:40 +0000 Subject: Merge #6948 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6948: Bump rubygems to 3.0.2 and ruby to 2.6.1 in TravisCI r=deivid-rodriguez a=deivid-rodriguez The problem was that I have some spec failures locally, and they don't seem to be reproduced in TravisCI. My diagnosis was that either my environment is messed up or there's some issues with the latest rubygems + ruby combination. My fix is to use latest rubygems and ruby in Travis, so I can double check whether the problem is just my environment or a real problem. I chose this fix because it's always good practice to test against the latest versions of your dependencies. Co-authored-by: David Rodríguez (cherry picked from commit 0ca2f4ea781abf697c484df6ba26feeded744854) --- .travis.yml | 9 ++++++--- Rakefile | 9 ++++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index f34ea4ca81..bd2d1e5dcc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,7 +29,7 @@ addons: secure: "TrzIv116JLGUxm6PAUskCYrv8KTDguncKROVwbnjVPKTGDAgoDderd8JUdDEXrKoZ9qGLD2TPYKExt9/QDl71E+qHdWnVqWv4HKCUk2P9z/VLKzHuggOUBkCXiJUhjywUieCJhI3N92bfq2EjSBbu2/OFHqWOjLQ+QCooTEBjv8=" rvm: - - 2.6.0 + - 2.6.1 - 2.5.3 - 2.4.5 - 2.3.8 @@ -40,12 +40,15 @@ env: # We need to know if changes to rubygems will break bundler on release - RGV=master # Test the latest rubygems release with all of our supported rubies - - RGV=v3.0.1 + - RGV=v3.0.2 matrix: include: + - rvm: 2.6.1 + script: rake rubocop + stage: linting # 3.x mode - - rvm: 2.5.3 + - rvm: 2.6.1 env: RGV=v3.0.1 BUNDLER_SPEC_SUB_VERSION=3.0.0 # Ruby 2.5, Rubygems 2.7 and up - rvm: 2.5.3 diff --git a/Rakefile b/Rakefile index 1254bf2149..fcd05652e5 100644 --- a/Rakefile +++ b/Rakefile @@ -72,6 +72,13 @@ namespace :spec do # Install the gems with a consistent version of RubyGems sh "gem update --system 2.6.12" + # Fix incorrect default gem specifications on ruby 2.6.1. Can be removed + # when 2.6.2 is released and we start testing against it + if RUBY_VERSION == "2.6.1" + sh "gem install etc:1.0.1 --default" + sh "gem install bundler:1.17.2 --default" + end + $LOAD_PATH.unshift("./spec") require "support/rubygems_ext" Spec::Rubygems::DEPS["codeclimate-test-reporter"] = "~> 0.6.0" if RUBY_VERSION >= "2.2.0" @@ -133,7 +140,7 @@ begin rubyopt = ENV["RUBYOPT"] # When editing this list, also edit .travis.yml! branches = %w[master] - releases = %w[v1.3.6 v1.3.7 v1.4.2 v1.5.3 v1.6.2 v1.7.2 v1.8.29 v2.0.14 v2.1.11 v2.2.5 v2.4.8 v2.5.2 v2.6.8 v2.6.14 v2.7.7 v3.0.1] + releases = %w[v2.5.2 v2.6.14 v2.7.7 v3.0.2] (branches + releases).each do |rg| desc "Run specs with RubyGems #{rg}" RSpec::Core::RakeTask.new(rg) do |t| -- cgit v1.2.1 From 0223d2123d4928a70a814f7f2d83c4023e5499ef Mon Sep 17 00:00:00 2001 From: The Bundler Bot Date: Mon, 18 Sep 2017 09:14:57 +0000 Subject: Auto merge of #6038 - bundler:colby/rubocop-050, r=olleolleolle update rubocop to 0.50 This PR just updates rubocop to 0.50 (cherry picked from commit 0a672a1deb01fa4ce8b51eb2f5b545692c64cd83) --- .rubocop_todo.yml | 144 +++++++++++++++++++++++++++++++++++++----------------- bin/rubocop | 2 +- 2 files changed, 100 insertions(+), 46 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 7f97d0ecc4..832870b8c5 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2018-10-29 23:00:23 +1100 using RuboCop version 0.49.1. +# on 2019-04-04 19:50:10 +1100 using RuboCop version 0.50.0. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -19,7 +19,7 @@ Layout/EmptyLinesAroundExceptionHandlingKeywords: Layout/IndentArray: EnforcedStyle: consistent -# Offense count: 48 +# Offense count: 46 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, SupportedStyles. # SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent @@ -67,6 +67,11 @@ Lint/AmbiguousBlockAssociation: - 'spec/support/helpers.rb' - 'spec/support/indexes.rb' +# Offense count: 1 +Lint/DuplicateMethods: + Exclude: + - 'lib/bundler/rubygems_ext.rb' + # Offense count: 2 Lint/EmptyWhen: Exclude: @@ -84,6 +89,15 @@ Lint/IneffectiveAccessModifier: Exclude: - 'lib/bundler/settings.rb' +# Offense count: 6 +Lint/InterpolationCheck: + Exclude: + - 'lib/bundler/dsl.rb' + - 'lib/bundler/installer/standalone.rb' + - 'spec/commands/binstubs_spec.rb' + - 'spec/install/gems/standalone_spec.rb' + - 'spec/other/major_deprecation_spec.rb' + # Offense count: 3 Lint/NestedMethodDefinition: Exclude: @@ -99,6 +113,19 @@ Lint/RescueException: - 'lib/bundler/rubygems_integration.rb' - 'lib/bundler/worker.rb' +# Offense count: 14 +Lint/RescueWithoutErrorClass: + Exclude: + - 'Rakefile' + - 'lib/bundler/friendly_errors.rb' + - 'lib/bundler/installer.rb' + - 'lib/bundler/resolver.rb' + - 'lib/bundler/retry.rb' + - 'spec/support/artifice/compact_index.rb' + - 'spec/support/helpers.rb' + - 'spec/support/matchers.rb' + - 'task/release.rake' + # Offense count: 2 Lint/ShadowedException: Exclude: @@ -116,18 +143,63 @@ Lint/UselessAssignment: Exclude: - 'lib/bundler/index.rb' -# Offense count: 2785 +# Offense count: 1 +Lint/Void: + Exclude: + - 'lib/bundler/spec_set.rb' + +# Offense count: 2800 # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. # URISchemes: http, https Metrics/LineLength: Max: 207 +# Offense count: 1 +Naming/AccessorMethodName: + Exclude: + - 'lib/bundler/source/git.rb' + +# Offense count: 32 +# Configuration parameters: Blacklist. +# Blacklist: END, (?-mix:EO[A-Z]{1}) +Naming/HeredocDelimiterNaming: + Enabled: false + +# Offense count: 9 +# Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist. +# NamePrefix: is_, has_, have_ +# NamePrefixBlacklist: is_, has_, have_ +# NameWhitelist: is_a? +Naming/PredicateName: + Exclude: + - 'spec/**/*' + - 'lib/bundler/definition.rb' + - 'lib/bundler/installer/parallel_installer.rb' + - 'lib/bundler/settings.rb' + - 'lib/bundler/source/git.rb' + - 'lib/bundler/source/git/git_proxy.rb' + - 'lib/bundler/source/path.rb' + # Offense count: 2 Performance/Caller: Exclude: - 'lib/bundler/rubygems_integration.rb' - 'spec/support/builders.rb' +# Offense count: 9 +# Cop supports --auto-correct. +# Configuration parameters: AutoCorrect. +Performance/HashEachMethods: + Exclude: + - 'lib/bundler/definition.rb' + - 'lib/bundler/dependency.rb' + - 'lib/bundler/dsl.rb' + - 'lib/bundler/index.rb' + - 'lib/bundler/plugin.rb' + - 'spec/install/gems/standalone_spec.rb' + - 'spec/support/builders.rb' + - 'spec/support/helpers.rb' + # Offense count: 7 # Cop supports --auto-correct. Performance/RedundantBlockCall: @@ -151,6 +223,10 @@ Performance/RedundantMerge: Exclude: - 'lib/bundler/cli/gem.rb' +# Offense count: 37 +Performance/UnfreezeString: + Enabled: false + # Offense count: 4 Security/Eval: Exclude: @@ -166,11 +242,6 @@ Security/MarshalLoad: - 'spec/support/artifice/compact_index.rb' - 'spec/support/artifice/endpoint.rb' -# Offense count: 1 -Style/AccessorMethodName: - Exclude: - - 'lib/bundler/source/git.rb' - # Offense count: 3 Style/CaseEquality: Exclude: @@ -216,6 +287,19 @@ Style/EmptyMethod: - 'lib/bundler/ui/silent.rb' - 'spec/support/artifice/fail.rb' +# Offense count: 6 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles, AutoCorrectEncodingComment. +# SupportedStyles: when_needed, always, never +Style/Encoding: + Exclude: + - 'Rakefile' + - 'bundler.gemspec' + - 'lib/bundler/friendly_errors.rb' + - 'spec/bundler/bundler_spec.rb' + - 'spec/install/gemfile_spec.rb' + - 'spec/install/gemspecs_spec.rb' + # Offense count: 1 # Configuration parameters: SupportedStyles. # SupportedStyles: annotated, template @@ -229,7 +313,7 @@ Style/GlobalVars: - 'lib/bundler/cli.rb' - 'spec/spec_helper.rb' -# Offense count: 12 +# Offense count: 11 # Configuration parameters: MinBodyLength. Style/GuardClause: Exclude: @@ -242,7 +326,6 @@ Style/GuardClause: - 'lib/bundler/runtime.rb' - 'lib/bundler/source/path/installer.rb' - 'lib/bundler/source_list.rb' - - 'spec/commands/newgem_spec.rb' - 'spec/support/sometimes.rb' # Offense count: 1 @@ -274,14 +357,6 @@ Style/MethodMissing: - 'lib/bundler/remote_specification.rb' - 'spec/support/builders.rb' -# Offense count: 1 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, SupportedStyles. -# SupportedStyles: separated, grouped -Style/MixinGrouping: - Exclude: - - 'lib/bundler/spec_set.rb' - # Offense count: 2 # Configuration parameters: EnforcedStyle, SupportedStyles. # SupportedStyles: module_function, extend_self @@ -303,13 +378,15 @@ Style/MultilineIfModifier: # Offense count: 3 # Cop supports --auto-correct. +# Configuration parameters: Whitelist. +# Whitelist: be, be_a, be_an, be_between, be_falsey, be_kind_of, be_instance_of, be_truthy, be_within, eq, eql, end_with, include, match, raise_error, respond_to, start_with Style/NestedParenthesizedCalls: Exclude: - 'lib/bundler/resolver.rb' - 'spec/commands/lock_spec.rb' - 'spec/runtime/setup_spec.rb' -# Offense count: 7 +# Offense count: 6 # Cop supports --auto-correct. # Configuration parameters: AutoCorrect, EnforcedStyle, SupportedStyles. # SupportedStyles: predicate, comparison @@ -319,22 +396,6 @@ Style/NumericPredicate: - 'lib/bundler/cli/common.rb' - 'lib/bundler/gem_helper.rb' - 'lib/bundler/mirror.rb' - - 'lib/bundler/source/git/git_proxy.rb' - - 'lib/bundler/source/path.rb' - -# Offense count: 9 -# Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist. -# NamePrefix: is_, has_, have_ -# NamePrefixBlacklist: is_, has_, have_ -# NameWhitelist: is_a? -Style/PredicateName: - Exclude: - - 'spec/**/*' - - 'lib/bundler/definition.rb' - - 'lib/bundler/installer/parallel_installer.rb' - - 'lib/bundler/settings.rb' - - 'lib/bundler/source/git.rb' - - 'lib/bundler/source/git/git_proxy.rb' - 'lib/bundler/source/path.rb' # Offense count: 24 @@ -384,20 +445,13 @@ Style/RedundantParentheses: Exclude: - 'lib/bundler/cli/console.rb' -# Offense count: 7 +# Offense count: 41 # Cop supports --auto-correct. # Configuration parameters: ConvertCodeThatCanStartToReturnNil. Style/SafeNavigation: - Exclude: - - 'lib/bundler/cli/add.rb' - - 'lib/bundler/fetcher/compact_index.rb' - - 'lib/bundler/gem_helper.rb' - - 'lib/bundler/gem_remote_fetcher.rb' - - 'lib/bundler/rubygems_integration.rb' - - 'lib/bundler/source/rubygems.rb' - - 'spec/support/artifice/vcr.rb' + Enabled: false -# Offense count: 56 +# Offense count: 57 # Cop supports --auto-correct. # Configuration parameters: MinSize, SupportedStyles. # SupportedStyles: percent, brackets diff --git a/bin/rubocop b/bin/rubocop index 98ce0c89c2..81f4679fb8 100755 --- a/bin/rubocop +++ b/bin/rubocop @@ -10,7 +10,7 @@ bundler_spec.dependencies.each do |dep| gem dep.name, dep.requirement end -gem "rubocop", "= 0.49.1" +gem "rubocop", "= 0.50.0" Gem.finish_resolve if Gem.respond_to?(:finish_resolve) -- cgit v1.2.1 From be58791ff66e4b4fb97c07041184f9fcbc0e5ff8 Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Thu, 4 Apr 2019 21:04:45 +1100 Subject: restore `sh_with_code` in gem_helper --- lib/bundler/gem_helper.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb index 27243a9821..55f484f723 100644 --- a/lib/bundler/gem_helper.rb +++ b/lib/bundler/gem_helper.rb @@ -181,12 +181,14 @@ module Bundler out end - def sh_with_status(cmd, &block) + def sh_with_code(cmd, &block) + cmd += " 2>&1" + outbuf = String.new Bundler.ui.debug(cmd) SharedHelpers.chdir(base) do - outbuf = IO.popen(cmd, :err => [:child, :out], &:read) - status = $? - block.call(outbuf) if status.success? && block + outbuf = `#{cmd}` + status = $?.exitstatus + block.call(outbuf) if status.zero? && block [outbuf, status] end end -- cgit v1.2.1 From 57051874877a5efe51c58c914965aa3351125afc Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Sat, 9 Feb 2019 14:21:04 +0000 Subject: Merge #6952 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6952: Bump TravisCI build to Xenial r=colby-swandale a=deivid-rodriguez ### What was the end-user problem that led to this PR? The problem was that CI in #6938 is failing, and I'm not sure why. ### What was your diagnosis of the problem? My diagnosis was that I should split the two changes made in that PR to find out the culprit. ### What is your fix for the problem, implemented in this PR? My fix is to split the TravisCI update to xenial, because my guess is that this is not the culprit, so if the build is green, we can merge this and upgrade :tada: ### Why did you choose this fix out of the possible options? I chose this fix because it means no work for me, just delegate to TravisCI. :) Co-authored-by: David Rodríguez (cherry picked from commit 1a63384c807f164bfc2fe26ce34ac781a974c7e6) --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index bd2d1e5dcc..0e5cde1d08 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ language: ruby +dist: xenial script: rake spec:travis before_script: - travis_retry rake spec:travis:deps -- cgit v1.2.1 From e8b3821b21ebabcc3e75c437bfed3b3048523233 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Sun, 10 Feb 2019 18:27:40 +0000 Subject: Merge #6948 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6948: Bump rubygems to 3.0.2 and ruby to 2.6.1 in TravisCI r=deivid-rodriguez a=deivid-rodriguez The problem was that I have some spec failures locally, and they don't seem to be reproduced in TravisCI. My diagnosis was that either my environment is messed up or there's some issues with the latest rubygems + ruby combination. My fix is to use latest rubygems and ruby in Travis, so I can double check whether the problem is just my environment or a real problem. I chose this fix because it's always good practice to test against the latest versions of your dependencies. Co-authored-by: David Rodríguez (cherry picked from commit 0ca2f4ea781abf697c484df6ba26feeded744854) --- Rakefile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Rakefile b/Rakefile index fcd05652e5..aee7e11780 100644 --- a/Rakefile +++ b/Rakefile @@ -79,6 +79,13 @@ namespace :spec do sh "gem install bundler:1.17.2 --default" end + # Fix incorrect default gem specifications on ruby 2.6.1. Can be removed + # when 2.6.2 is released and we start testing against it + if RUBY_VERSION == "2.6.1" + sh "gem install etc:1.0.1 --default" + sh "gem install bundler:1.17.2 --default" + end + $LOAD_PATH.unshift("./spec") require "support/rubygems_ext" Spec::Rubygems::DEPS["codeclimate-test-reporter"] = "~> 0.6.0" if RUBY_VERSION >= "2.2.0" -- cgit v1.2.1 From fff40d00744cbe58c43012f6f6133eb7e97f0545 Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Thu, 4 Apr 2019 21:47:58 +1100 Subject: fix stages in travis ci --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 0e5cde1d08..d5b944e0af 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,6 +35,10 @@ rvm: - 2.4.5 - 2.3.8 +stages: + - linting + - test + # Rubygems versions MUST be available as rake tasks # see Rakefile:125 for the list of possible RGV values env: -- cgit v1.2.1 From f27d7c2dcb8ef36dd51713a7c7813b894b93b1f0 Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Thu, 4 Apr 2019 21:51:46 +1100 Subject: bump ruby versions in travis and adjust the CI matrix --- .travis.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index d5b944e0af..ccb39e55a8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,8 +30,8 @@ addons: secure: "TrzIv116JLGUxm6PAUskCYrv8KTDguncKROVwbnjVPKTGDAgoDderd8JUdDEXrKoZ9qGLD2TPYKExt9/QDl71E+qHdWnVqWv4HKCUk2P9z/VLKzHuggOUBkCXiJUhjywUieCJhI3N92bfq2EjSBbu2/OFHqWOjLQ+QCooTEBjv8=" rvm: - - 2.6.1 - - 2.5.3 + - 2.6.2 + - 2.5.5 - 2.4.5 - 2.3.8 @@ -45,15 +45,15 @@ env: # We need to know if changes to rubygems will break bundler on release - RGV=master # Test the latest rubygems release with all of our supported rubies - - RGV=v3.0.2 + - RGV=v3.0.3 -matrix: +jobs: include: - - rvm: 2.6.1 + - rvm: 2.6.2 script: rake rubocop stage: linting # 3.x mode - - rvm: 2.6.1 + - rvm: 2.6.2 env: RGV=v3.0.1 BUNDLER_SPEC_SUB_VERSION=3.0.0 # Ruby 2.5, Rubygems 2.7 and up - rvm: 2.5.3 -- cgit v1.2.1 From aa1569fceaa31992f3e931ca56d5ea4d10a3a346 Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Thu, 4 Apr 2019 22:04:08 +1100 Subject: remove linting step in travis (it will still run in each build) --- .travis.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index ccb39e55a8..6dec248d07 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,11 +47,8 @@ env: # Test the latest rubygems release with all of our supported rubies - RGV=v3.0.3 -jobs: +matrix: include: - - rvm: 2.6.2 - script: rake rubocop - stage: linting # 3.x mode - rvm: 2.6.2 env: RGV=v3.0.1 BUNDLER_SPEC_SUB_VERSION=3.0.0 -- cgit v1.2.1 From 0e11bce635045ba967f9223ccba5ea66725b8296 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Tue, 15 Jan 2019 07:55:51 +0000 Subject: Merge #6864 6864: Include URL in Bundler::Fetcher::FallbackError message for Net::HTTPNotFound r=segiddins a=greysteil ### What was the end-user problem that led to this PR? It was really painful to debug persistent NotFound errors, as it wasn't clear where they were coming from, ### What was your diagnosis of the problem? Bundler was obfuscating the URL that wasn't found unnecessarily. ### What is your fix for the problem, implemented in this PR? My fix is to add the URL to the `Bundler::Fetcher::FallbackError` message for `Net::HTTPNotFound` errors. ### Why did you choose this fix out of the possible options? I chose this fix because it was simple and easy to test. Co-authored-by: Grey Baker (cherry picked from commit 4557124b5ea30821895eb2686874cb4219f404e2) --- lib/bundler/fetcher/downloader.rb | 2 +- spec/bundler/fetcher/downloader_spec.rb | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/bundler/fetcher/downloader.rb b/lib/bundler/fetcher/downloader.rb index e0e0cbf1c9..87ad4140fd 100644 --- a/lib/bundler/fetcher/downloader.rb +++ b/lib/bundler/fetcher/downloader.rb @@ -37,7 +37,7 @@ module Bundler 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/spec/bundler/fetcher/downloader_spec.rb b/spec/bundler/fetcher/downloader_spec.rb index c9b4fa662a..07b507266b 100644 --- a/spec/bundler/fetcher/downloader_spec.rb +++ b/spec/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 -- cgit v1.2.1 From f674ead086636f2a79e33e235b991445a2caba33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Sat, 23 Mar 2019 17:02:52 +0100 Subject: Merge pull request #7061 from bundler/fix_circular_requires Fix circular require warnings (cherry picked from commit aaa0b0ce6a447aa0f01301799f3163832da6566d) --- lib/bundler/compatibility_guard.rb | 1 - lib/bundler/rubygems_ext.rb | 1 - lib/bundler/rubygems_integration.rb | 1 - 3 files changed, 3 deletions(-) diff --git a/lib/bundler/compatibility_guard.rb b/lib/bundler/compatibility_guard.rb index 750a1db04f..e2f8745b80 100644 --- a/lib/bundler/compatibility_guard.rb +++ b/lib/bundler/compatibility_guard.rb @@ -1,6 +1,5 @@ # frozen_string_literal: false -require "rubygems" require "bundler/version" if Bundler::VERSION.split(".").first.to_i >= 2 diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb index e9f0eac355..faec14fec6 100644 --- a/lib/bundler/rubygems_ext.rb +++ b/lib/bundler/rubygems_ext.rb @@ -7,7 +7,6 @@ if defined?(Gem::QuickLoader) Gem::QuickLoader.load_full_rubygems_library end -require "rubygems" require "rubygems/specification" begin diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index f088c2fdfb..a7d3368288 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true require "monitor" -require "rubygems" require "rubygems/config_file" module Bundler -- cgit v1.2.1 From 79b479c70101444da81f6b7c87bde80f26a0b882 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Fri, 29 Mar 2019 04:02:39 +0000 Subject: Merge #7078 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 7078: Allow `update` to install when `--no-install` used r=colby-swandale a=deivid-rodriguez Fixes #7077. ### What was the end-user problem that led to this PR? The problem was #7077. When the `no_install` configuration is activated, this prevents `bundle update` from installing gems, but `no_install` is only meant to affect `bundle package`. ### What was your diagnosis of the problem? My diagnosis was that `bundle update` needs to ignore this setting. ### What is your fix for the problem, implemented in this PR? My fix is to the same `bundle install` does to fix this problem. ### Why did you choose this fix out of the possible options? I chose this fix because it's the most straightforward solution, although the handling of this flag could probably use some refactoring. Co-authored-by: David Rodríguez (cherry picked from commit 91912a1da92a5c1d0c6c29b03f35ed4fc024021f) --- lib/bundler/cli.rb | 4 +++- spec/commands/package_spec.rb | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index 3efe193613..988c3168a6 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -277,7 +277,9 @@ module Bundler def update(*gems) SharedHelpers.major_deprecation(3, "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" diff --git a/spec/commands/package_spec.rb b/spec/commands/package_spec.rb index a8426e6322..083e636576 100644 --- a/spec/commands/package_spec.rb +++ b/spec/commands/package_spec.rb @@ -179,6 +179,18 @@ 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" + + expect(the_bundle).to include_gems "rack 1.0.0" + end end context "with --all-platforms" do -- cgit v1.2.1 From 9f83d7a92822ea8b23643682a9651249c6420c03 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Mon, 1 Apr 2019 11:23:07 +0000 Subject: Merge #6963 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6963: Allow to `bundle exec` default gems r=deivid-rodriguez a=deivid-rodriguez ### What was the end-user problem that led to this PR? The problem was that since `irb` and others were moved to default gems, users cannot directly use them in a bundler context, unless they add it to their gemfiles. In my opinion, this completely defeats the purpose of default gems, and makes bundler degrade the user experience instead of making it better. ### What was your diagnosis of the problem? My diagnosis was that when bundler replaces the set of gems known to rubygems, it restricts the world to what's in the Gemfile (or resolved from it), and that doesn't include default gems. ### What is your fix for the problem, implemented in this PR? My fix is to also include the set of default gems, unless they are already included in the gemfile dependencies. ### Why did you choose this fix out of the possible options? I chose this fix because it's reasonably simple and I think it shouldn't affect how other parts of bundler function. Fixes #6929. Fixes https://bugs.ruby-lang.org/issues/15503. Co-authored-by: David Rodríguez (cherry picked from commit 3b6c6e35b36fc056ec3610f9f22f1cea2ef0b06f) --- lib/bundler/rubygems_integration.rb | 19 +++++++++ spec/commands/exec_spec.rb | 77 +++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index a7d3368288..0209045fa1 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -513,6 +513,15 @@ 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) @@ -849,6 +858,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/spec/commands/exec_spec.rb b/spec/commands/exec_spec.rb index 2e3cb6621e..67bdc97ac3 100644 --- a/spec/commands/exec_spec.rb +++ b/spec/commands/exec_spec.rb @@ -147,6 +147,83 @@ 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 "handles gems installed with --without" do install_gemfile <<-G, forgotten_command_line_options(:without => "middleware") source "file://#{gem_repo1}" -- cgit v1.2.1 From b1ffbd3b955f6fa74adeb25973d0b360c9b16ab2 Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Thu, 4 Apr 2019 23:15:47 +1100 Subject: bump RubyGems v3 to the latest version on Travis --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index aee7e11780..8f083fa36d 100644 --- a/Rakefile +++ b/Rakefile @@ -147,7 +147,7 @@ begin rubyopt = ENV["RUBYOPT"] # When editing this list, also edit .travis.yml! branches = %w[master] - releases = %w[v2.5.2 v2.6.14 v2.7.7 v3.0.2] + releases = %w[v2.5.2 v2.6.14 v2.7.7 v3.0.3] (branches + releases).each do |rg| desc "Run specs with RubyGems #{rg}" RSpec::Core::RakeTask.new(rg) do |t| -- cgit v1.2.1 From c17d799436de359137403c676ce3e671ec09a214 Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Fri, 5 Apr 2019 14:52:31 +1100 Subject: change Bundler 3 specs in travis to use RubyGems 3.0.3 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6dec248d07..438f22202e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,7 +51,7 @@ matrix: include: # 3.x mode - rvm: 2.6.2 - env: RGV=v3.0.1 BUNDLER_SPEC_SUB_VERSION=3.0.0 + env: RGV=v3.0.3 BUNDLER_SPEC_SUB_VERSION=3.0.0 # Ruby 2.5, Rubygems 2.7 and up - rvm: 2.5.3 env: RGV=v2.7.7 -- cgit v1.2.1 From 8f3facd8e215b040a4cbb228f2a17f59c8048e67 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Tue, 26 Mar 2019 00:37:48 +0000 Subject: Merge #7067 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 7067: Tweaking vendoring r=hsbt a=deivid-rodriguez The problem was that we were not using the latest versions of some of our vendored dependencies. My diagnosis was that we should upgrade them. My fix is to upgrade them using `automatiek`, and add a few tweaks to our vendoring setup. I chose this fix because.... I didn't really considered other options. Co-authored-by: David Rodríguez (cherry picked from commit 6f39ea5b15d61e5bdf7915bc94d66c31b1242d15) --- lib/bundler/vendor/fileutils/lib/fileutils.rb | 149 +++++++++++++++++---- lib/bundler/vendor/thor/lib/thor/actions.rb | 18 ++- .../thor/lib/thor/actions/file_manipulation.rb | 13 +- lib/bundler/vendor/thor/lib/thor/base.rb | 7 +- lib/bundler/vendor/thor/lib/thor/error.rb | 82 ++++++++++++ lib/bundler/vendor/thor/lib/thor/group.rb | 4 +- lib/bundler/vendor/thor/lib/thor/parser/options.rb | 9 +- lib/bundler/vendor/thor/lib/thor/runner.rb | 4 +- lib/bundler/vendor/thor/lib/thor/shell.rb | 2 +- lib/bundler/vendor/thor/lib/thor/shell/basic.rb | 59 +++++++- lib/bundler/vendor/thor/lib/thor/version.rb | 2 +- 11 files changed, 298 insertions(+), 51 deletions(-) diff --git a/lib/bundler/vendor/fileutils/lib/fileutils.rb b/lib/bundler/vendor/fileutils/lib/fileutils.rb index cc69740845..77b3bade52 100644 --- a/lib/bundler/vendor/fileutils/lib/fileutils.rb +++ b/lib/bundler/vendor/fileutils/lib/fileutils.rb @@ -85,8 +85,12 @@ # :verbose flags to methods in Bundler::FileUtils. # +require 'rbconfig' + module Bundler::FileUtils + VERSION = "1.1.0" + def self.private_module_function(name) #:nodoc: module_function name private_class_method name @@ -117,8 +121,9 @@ module Bundler::FileUtils # 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 +250,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 @@ -293,6 +298,39 @@ module Bundler::FileUtils alias link ln module_function :link + # + # :call-seq: + # Bundler::FileUtils.cp_lr(src, dest, noop: nil, verbose: nil, dereference_root: true, remove_destination: false) + # + # Hard link +src+ to +dest+. If +src+ is a directory, this method links + # all its contents recursively. If +dest+ is a directory, links + # +src+ to +dest/src+. + # + # +src+ can be a list of files. + # + # # Installing the library "mylib" under the site_ruby directory. + # Bundler::FileUtils.rm_r site_ruby + '/mylib', :force => true + # 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) @@ -339,6 +377,26 @@ module Bundler::FileUtils end 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 +470,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) @@ -486,7 +544,7 @@ module Bundler::FileUtils module_function :move def rename_cannot_overwrite_file? #:nodoc: - /emx/ =~ RUBY_PLATFORM + /emx/ =~ RbConfig::CONFIG['host_os'] end private_module_function :rename_cannot_overwrite_file? @@ -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 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) @@ -1068,7 +1149,7 @@ module Bundler::FileUtils private def fu_windows? - /mswin|mingw|bccwin|emx/ =~ RUBY_PLATFORM + /mswin|mingw|bccwin|emx/ =~ RbConfig::CONFIG['host_os'] end def fu_copy_stream0(src, dest, blksize = nil) #:nodoc: @@ -1250,6 +1331,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/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:: the address of the given content. # destination:: 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..6d3f273ab1 100644 --- a/lib/bundler/vendor/thor/lib/thor/base.rb +++ b/lib/bundler/vendor/thor/lib/thor/base.rb @@ -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:: the destination file to solve conflicts - # block:: an optional block that returns the value to be used in diff + # block:: 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/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 -- cgit v1.2.1 From 65db92188d5102b7825cb5ba11622efea8d78aef Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Wed, 27 Mar 2019 06:54:21 +0000 Subject: Merge #7036 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 7036: Bump travis rubies r=hsbt a=deivid-rodriguez The problem was that hacks create confusion, even if they include TODO notes. My diagnosis was that we can should upgrade to the latest ruby releases to reduce the number of hacks we need to maintain. My fix is to upgrade rubies and remove hacks. I chose this fix because it's a good change. Co-authored-by: David Rodríguez (cherry picked from commit d368aa9e6257a27fab31efe0396069c8977cdc99) --- Rakefile | 7 ------- lib/bundler/rubygems_integration.rb | 1 - lib/bundler/vendor/fileutils/lib/fileutils.rb | 7 ++----- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/Rakefile b/Rakefile index 8f083fa36d..20eb75516e 100644 --- a/Rakefile +++ b/Rakefile @@ -79,13 +79,6 @@ namespace :spec do sh "gem install bundler:1.17.2 --default" end - # Fix incorrect default gem specifications on ruby 2.6.1. Can be removed - # when 2.6.2 is released and we start testing against it - if RUBY_VERSION == "2.6.1" - sh "gem install etc:1.0.1 --default" - sh "gem install bundler:1.17.2 --default" - end - $LOAD_PATH.unshift("./spec") require "support/rubygems_ext" Spec::Rubygems::DEPS["codeclimate-test-reporter"] = "~> 0.6.0" if RUBY_VERSION >= "2.2.0" diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index 0209045fa1..4100f637f8 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true require "monitor" -require "rubygems/config_file" module Bundler class RubygemsIntegration diff --git a/lib/bundler/vendor/fileutils/lib/fileutils.rb b/lib/bundler/vendor/fileutils/lib/fileutils.rb index 77b3bade52..3a48e80293 100644 --- a/lib/bundler/vendor/fileutils/lib/fileutils.rb +++ b/lib/bundler/vendor/fileutils/lib/fileutils.rb @@ -1082,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 @@ -1095,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 @@ -1108,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 -- cgit v1.2.1 From 531fcaa62cc68a3263de06c4dbbd6a56ecacfa28 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Thu, 28 Mar 2019 09:07:38 +0000 Subject: Merge #7068 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 7068: Bump vendored fileutils to 1.2.0 r=hsbt a=deivid-rodriguez ### What was the end-user problem that led to this PR? The problem was we manually updated some code in the vendored fileutils instead of using a released version. ### What was your diagnosis of the problem? My diagnosis was that we should use the recently released fileutils 1.2.0. ### What is your fix for the problem, implemented in this PR? My fix is to vendor it through `bin/rake vendor:fileutils[v1.2.0]`. ### Why did you choose this fix out of the possible options? I chose this fix because it properly upgrades the vendored code to match what's last released. Co-authored-by: David Rodríguez (cherry picked from commit 2167156db020fbe6ce74759cbf62ad1ceb651fb7) --- lib/bundler/vendor/fileutils/lib/fileutils.rb | 57 +++++++++++++--------- .../vendor/fileutils/lib/fileutils/version.rb | 5 ++ 2 files changed, 38 insertions(+), 24 deletions(-) create mode 100644 lib/bundler/vendor/fileutils/lib/fileutils/version.rb diff --git a/lib/bundler/vendor/fileutils/lib/fileutils.rb b/lib/bundler/vendor/fileutils/lib/fileutils.rb index 3a48e80293..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,13 +93,8 @@ # files/directories. This equates to passing the :noop and # :verbose flags to methods in Bundler::FileUtils. # - -require 'rbconfig' - module Bundler::FileUtils - VERSION = "1.1.0" - def self.private_module_function(name) #:nodoc: module_function name private_class_method name @@ -110,12 +114,14 @@ 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('/') # change directory # - # Bundler::FileUtils.cd('/', :verbose => true) # chdir and report it + # Bundler::FileUtils.cd('/', :verbose => true) # change directory and report it # - # Bundler::FileUtils.cd('/') do # chdir + # Bundler::FileUtils.cd('/') do # change directory # # ... # do something # end # return to original directory # @@ -519,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 @@ -543,11 +548,6 @@ module Bundler::FileUtils alias move mv module_function :move - def rename_cannot_overwrite_file? #:nodoc: - /emx/ =~ RbConfig::CONFIG['host_os'] - 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. @@ -698,7 +698,7 @@ module Bundler::FileUtils f.chown euid, -1 f.chmod 0700 } - rescue EISDIR # JRuby in non-native mode can't open files as dirs + 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?) @@ -1145,8 +1145,11 @@ module Bundler::FileUtils module StreamUtils_ private - def fu_windows? - /mswin|mingw|bccwin|emx/ =~ RbConfig::CONFIG['host_os'] + 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: @@ -1271,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 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 -- cgit v1.2.1 From 1fd59fa141ae04f8804618c86473daec880fa3e7 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Tue, 2 Apr 2019 08:46:08 +0000 Subject: Merge #7089 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 7089: Normalize file URIs in spec's lockfiles r=hsbt a=deivid-rodriguez ### What was the end-user problem that led to this PR? The problem was that bumping bundler's version in #7088 made a lockfile spec fail. ### What was your diagnosis of the problem? My diagnosis was that there was a combination of bugs that was making this spec pass, but the spec was incorrect. ### What is your fix for the problem, implemented in this PR? My fix is to change the test version the spec uses to not hit https://github.com/rubygems/rubygems/issues/2595, and thus reproduce the failure. And then fix the spec that was incorrect because the lockfile written had different URLs (`file://localhost/`) from the lockfile we were checking against (`file://`), thus tricking `bundle install` into thinking something had changed, and thus making it rewrite it with an incorrect bundler version. ### Why did you choose this fix out of the possible options? I chose this fix because it makes #7088 pass and it reduces surprises. Co-authored-by: David Rodríguez (cherry picked from commit 4cae424d604cbeb8ee84127a6b8896c45e7e2c84) --- spec/lock/lockfile_spec.rb | 2 +- spec/support/helpers.rb | 12 ++++++++---- spec/support/matchers.rb | 4 ++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/spec/lock/lockfile_spec.rb b/spec/lock/lockfile_spec.rb index 9e2fb3b2dd..ea454fe912 100644 --- a/spec/lock/lockfile_spec.rb +++ b/spec/lock/lockfile_spec.rb @@ -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 diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index ff1f5c39b3..0c018c6c68 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -263,18 +263,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 diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb index 8e17be3a02..76aeffb288 100644 --- a/spec/support/matchers.rb +++ b/spec/support/matchers.rb @@ -218,7 +218,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 +236,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) -- cgit v1.2.1 From b2c910cbb98a94c44d044678229413e54960642f Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Mon, 1 Apr 2019 14:23:59 +0000 Subject: Merge #7080 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 7080: Always pass the `--all` flag when needed r=deivid-rodriguez a=deivid-rodriguez The problem was that some specs were still using `bundle update` to update all gems, which is deprecated. My fix is to update all specs to use the new preferred command, namely, `bundle update --all`. Co-authored-by: David Rodríguez (cherry picked from commit 63cc70aa2573345ebfb6bddaeef0b9d465591dd9) (cherry picked from commit e423c83f1f6bccbfc992bca7aef2ad31d6449d75) --- spec/cache/gems_spec.rb | 2 +- spec/cache/git_spec.rb | 2 +- spec/cache/platform_spec.rb | 2 +- spec/commands/clean_spec.rb | 8 ++++---- spec/commands/package_spec.rb | 2 +- spec/commands/update_spec.rb | 30 +++++++++++++++--------------- spec/install/gemfile/git_spec.rb | 8 ++++---- spec/install/gems/compact_index_spec.rb | 2 +- spec/install/gems/dependency_api_spec.rb | 2 +- spec/install/git_spec.rb | 2 +- spec/install/post_bundle_message_spec.rb | 8 ++++---- spec/other/platform_spec.rb | 12 ++++++------ spec/realworld/parallel_spec.rb | 2 +- spec/support/helpers.rb | 4 ---- spec/update/gemfile_spec.rb | 8 ++++---- spec/update/gems/post_install_spec.rb | 4 ++-- spec/update/git_spec.rb | 8 ++++---- 17 files changed, 51 insertions(+), 55 deletions(-) diff --git a/spec/cache/gems_spec.rb b/spec/cache/gems_spec.rb index 4a0b953830..281e030c8f 100644 --- a/spec/cache/gems_spec.rb +++ b/spec/cache/gems_spec.rb @@ -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/cache/git_spec.rb b/spec/cache/git_spec.rb index 33387dbbb2..186b0269ab 100644 --- a/spec/cache/git_spec.rb +++ b/spec/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 diff --git a/spec/cache/platform_spec.rb b/spec/cache/platform_spec.rb index c0622a3c94..b3c4643ef5 100644 --- a/spec/cache/platform_spec.rb +++ b/spec/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/commands/clean_spec.rb b/spec/commands/clean_spec.rb index e1f007fc35..6addd36c32 100644 --- a/spec/commands/clean_spec.rb +++ b/spec/commands/clean_spec.rb @@ -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]})") @@ -378,7 +378,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,7 +441,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", "foo-1.0.1" end @@ -460,7 +460,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" diff --git a/spec/commands/package_spec.rb b/spec/commands/package_spec.rb index 083e636576..0159558975 100644 --- a/spec/commands/package_spec.rb +++ b/spec/commands/package_spec.rb @@ -187,7 +187,7 @@ RSpec.describe "bundle package" do D bundle! "package --no-install" - bundle! "update" + bundle! "update --all" expect(the_bundle).to include_gems "rack 1.0.0" end diff --git a/spec/commands/update_spec.rb b/spec/commands/update_spec.rb index 786719f50d..9b8aec9fcb 100644 --- a/spec/commands/update_spec.rb +++ b/spec/commands/update_spec.rb @@ -65,7 +65,7 @@ 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 @@ -167,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 @@ -282,7 +282,7 @@ 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) @@ -291,15 +291,15 @@ RSpec.describe "bundle update" do 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? + bundle "update", :all => true 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) 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). + 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 --delete deployment`./m) end end @@ -542,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 @@ -563,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) @@ -586,14 +586,14 @@ 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 @@ -612,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!" @@ -620,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 @@ -817,7 +817,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 @@ -839,7 +839,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 @@ -936,7 +936,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/install/gemfile/git_spec.rb b/spec/install/gemfile/git_spec.rb index fe396c7a0f..a4af90318f 100644 --- a/spec/install/gemfile/git_spec.rb +++ b/spec/install/gemfile/git_spec.rb @@ -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 .") @@ -798,14 +798,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 @@ -1268,7 +1268,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") diff --git a/spec/install/gems/compact_index_spec.rb b/spec/install/gems/compact_index_spec.rb index 2acade1166..123056fb02 100644 --- a/spec/install/gems/compact_index_spec.rb +++ b/spec/install/gems/compact_index_spec.rb @@ -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 diff --git a/spec/install/gems/dependency_api_spec.rb b/spec/install/gems/dependency_api_spec.rb index 3cb98db1eb..86b4f59b7a 100644 --- a/spec/install/gems/dependency_api_spec.rb +++ b/spec/install/gems/dependency_api_spec.rb @@ -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 diff --git a/spec/install/git_spec.rb b/spec/install/git_spec.rb index 48086a86c7..68b2f47c10 100644 --- a/spec/install/git_spec.rb +++ b/spec/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/install/post_bundle_message_spec.rb b/spec/install/post_bundle_message_spec.rb index 394134f523..5ab552385e 100644 --- a/spec/install/post_bundle_message_spec.rb +++ b/spec/install/post_bundle_message_spec.rb @@ -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/other/platform_spec.rb b/spec/other/platform_spec.rb index 6c59fd893c..2196cd4e18 100644 --- a/spec/other/platform_spec.rb +++ b/spec/other/platform_spec.rb @@ -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 diff --git a/spec/realworld/parallel_spec.rb b/spec/realworld/parallel_spec.rb index ed4430c68b..b735cd3f77 100644 --- a/spec/realworld/parallel_spec.rb +++ b/spec/realworld/parallel_spec.rb @@ -38,7 +38,7 @@ 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]: /) diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index 0c018c6c68..8af2b1ff2d 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -52,10 +52,6 @@ module Spec last_command.exitstatus end - def bundle_update_requires_all? - Bundler::VERSION.start_with?("2.") ? nil : true - end - def in_app_root(&blk) Dir.chdir(bundled_app, &blk) end diff --git a/spec/update/gemfile_spec.rb b/spec/update/gemfile_spec.rb index f59f3a2d32..b9f4328684 100644 --- a/spec/update/gemfile_spec.rb +++ b/spec/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 @@ -30,7 +30,7 @@ RSpec.describe "bundle update" do 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,7 +39,7 @@ 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)") @@ -55,7 +55,7 @@ RSpec.describe "bundle update" do create_file("Gemfile", "raise 'wrong Gemfile!'") bundle! :install - bundle! :update, :all => bundle_update_requires_all? + bundle! :update, :all => true expect(bundled_app("gems.rb")).to be_file expect(bundled_app("Gemfile.lock")).not_to be_file diff --git a/spec/update/gems/post_install_spec.rb b/spec/update/gems/post_install_spec.rb index 2fb3547806..fe411a8a6f 100644 --- a/spec/update/gems/post_install_spec.rb +++ b/spec/update/gems/post_install_spec.rb @@ -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/update/git_spec.rb b/spec/update/git_spec.rb index d97760e84b..19abceb08d 100644 --- a/spec/update/git_spec.rb +++ b/spec/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 @@ -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 @@ -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 -- cgit v1.2.1 From e8ea17604caf7759020ced419d401efb2924a750 Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Mon, 8 Apr 2019 23:33:19 +1000 Subject: port GemHelper from master --- lib/bundler/gem_helper.rb | 48 +++++++++++++++++++++++------------------ spec/bundler/gem_helper_spec.rb | 8 ++++--- 2 files changed, 32 insertions(+), 24 deletions(-) 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/spec/bundler/gem_helper_spec.rb b/spec/bundler/gem_helper_spec.rb index 774da9d45b..dc982c6ee7 100644 --- a/spec/bundler/gem_helper_spec.rb +++ b/spec/bundler/gem_helper_spec.rb @@ -181,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 @@ -208,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 -- cgit v1.2.1 From da0ff0c7c19c23e2c8deb11b748bdf6a34191411 Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Tue, 9 Apr 2019 19:48:17 +1000 Subject: add bors configuation --- .github/bors.toml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .github/bors.toml diff --git a/.github/bors.toml b/.github/bors.toml new file mode 100644 index 0000000000..8f4d9a640a --- /dev/null +++ b/.github/bors.toml @@ -0,0 +1,10 @@ +status = [ + "continuous-integration/travis-ci/push" +] + +timeout_sec = 14400 +delete_merged_branches = true + +[committer] +name = "Bundlerbot" +email = "bot@bundler.io" -- cgit v1.2.1 From 1953cfdbd34b8f701ea2a330820b6bfb6b56c638 Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Mon, 26 Nov 2018 23:09:40 +0000 Subject: Merge #6798 6798: Use https in the Github shortcut by default in Bundler 2 r=colby-swandale a=colby-swandale This PR is setting Git gems to be fetched over https by default. Note: This PR is successing #6791 Closes #6785 Co-authored-by: Colby Swandale (cherry picked from commit cf45792213fadf97f7aa6464de8ebd79f09725d2) --- lib/bundler/dsl.rb | 2 +- spec/bundler/dsl_spec.rb | 6 +++--- spec/other/major_deprecation_spec.rb | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index 90ac073c36..285b155197 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -305,7 +305,7 @@ module Bundler # 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"] + if Bundler.feature_flag.github_https? Bundler::SharedHelpers.major_deprecation 3, "The `github.https` setting will be removed" "https://github.com/#{repo_name}.git" else diff --git a/spec/bundler/dsl_spec.rb b/spec/bundler/dsl_spec.rb index 94d54ad877..8aeca6414a 100644 --- a/spec/bundler/dsl_spec.rb +++ b/spec/bundler/dsl_spec.rb @@ -44,7 +44,7 @@ RSpec.describe Bundler::Dsl do it "converts :github to :git" do subject.gem("sparks", :github => "indirect/sparks") - github_uri = "git://github.com/indirect/sparks.git" + github_uri = "https://github.com/indirect/sparks.git" expect(subject.dependencies.first.source.uri).to eq(github_uri) end @@ -62,7 +62,7 @@ RSpec.describe Bundler::Dsl do it "converts 'rails' to 'rails/rails'" do subject.gem("rails", :github => "rails") - github_uri = "git://github.com/rails/rails.git" + github_uri = "https://github.com/rails/rails.git" expect(subject.dependencies.first.source.uri).to eq(github_uri) end @@ -253,7 +253,7 @@ 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 diff --git a/spec/other/major_deprecation_spec.rb b/spec/other/major_deprecation_spec.rb index 50800dbb0c..04f71e2eca 100644 --- a/spec/other/major_deprecation_spec.rb +++ b/spec/other/major_deprecation_spec.rb @@ -198,7 +198,7 @@ RSpec.describe "major deprecations", :bundler => "< 3" do end context "with github gems" do - it "warns about the https change" do + it "warns about the https change", :bundler => "3" 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: -- cgit v1.2.1 From 50c3395479ff9bca569212fbdc3a6e8743b92802 Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Mon, 3 Jun 2019 19:59:32 +1000 Subject: fix bug where bundler v3 is running a test for bundflet 2 --- spec/other/major_deprecation_spec.rb | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/spec/other/major_deprecation_spec.rb b/spec/other/major_deprecation_spec.rb index 04f71e2eca..0a3c65a1e5 100644 --- a/spec/other/major_deprecation_spec.rb +++ b/spec/other/major_deprecation_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "major deprecations", :bundler => "< 3" do +RSpec.describe "major deprecations", :bundler => "<= 2" do let(:warnings) { last_command.bundler_err } # change to err in 2.0 let(:warnings_without_version_messages) { warnings.gsub(/#{Spec::Matchers::MAJOR_DEPRECATION}Bundler will only support ruby(gems)? >= .*/, "") } @@ -198,17 +198,6 @@ RSpec.describe "major deprecations", :bundler => "< 3" do end context "with github gems" do - it "warns about the https change", :bundler => "3" 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 - expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, msg) - subject.gem("sparks", :github => "indirect/sparks") - end - it "upgrades to https on request" do Bundler.settings.temporary "github.https" => true msg = <<-EOS -- cgit v1.2.1 From 6705960aeecf2d980f975fd69d2b1aecd50661ba Mon Sep 17 00:00:00 2001 From: Bundlerbot Date: Wed, 12 Jun 2019 07:49:45 +0000 Subject: Merge #7199 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 7199: Allow `rake release` to ask for input (3rd take) r=colby-swandale a=deivid-rodriguez This PR supersedes #7108 and #7005. It fixes #6854. ### What was the end-user problem that led to this PR? The problem was that if users has 2FA authentication on their rubygems account, `rake release` doesn't really work at the moment, since it hangs asking for the OTP code, but without letting the user know. ### What was your diagnosis of the problem? My diagnosis was that we need to allow the `rake release` helper that shells out to `gem push` to read `gem push` output and show it to the user, so that she can introduce the requested information. ### What is your fix for the problem, implemented in this PR? My fix is inspired by @segiddins's comment in https://github.com/bundler/bundler/issues/6854#issuecomment-450536844. `Kernel#system` works like we would expect in this situation. ### Why did you choose this fix out of the possible options? I chose this fix because #7108 had a few problems: * It would update the `sh` helper, which is used in many different places. This was unnecessary since most of the times we shell out to the `gem` CLI we don't need to ask for input, and it also produced a very verbose output in those cases, since everything the `gem` CLI prints to the screen would be printed by the bundler helpers too. This PR does not change the current output, other than for `rake release`. * It would print _duplicate_ output. This is a `rake release` test using #7108: ``` $ RUBYOPT="-I../bundler/lib" ../bundler/exe/bundle exec rake release Successfully built RubyGem Name: rake_release_tester Version: 0.1.0 File: rake_release_tester-0.1.0.gem rake_release_tester 0.1.0 built to pkg/rake_release_tester-0.1.0.gem. v0.1.0 Tag v0.1.0 has already been created. Pushing gem to https://rubygems.org... You have enabled multi-factor authentication. Please enter OTP code. Code: asd Your OTP code is incorrect. Please check it and retry. rake aborted! Pushing gem to https://rubygems.org... You have enabled multi-factor authentication. Please enter OTP code. Code: Your OTP code is incorrect. Please check it and retry. /home/deivid/Code/bundler/lib/bundler/gem_helper.rb:187:in `sh' /home/deivid/Code/bundler/lib/bundler/gem_helper.rb:109:in `rubygem_push' /home/deivid/Code/bundler/lib/bundler/gem_helper.rb:70:in `block in install' /home/deivid/Code/bundler/lib/bundler/cli/exec.rb:69:in `load' /home/deivid/Code/bundler/lib/bundler/cli/exec.rb:69:in `kernel_load' /home/deivid/Code/bundler/lib/bundler/cli/exec.rb:28:in `run' /home/deivid/Code/bundler/lib/bundler/cli.rb:468:in `exec' /home/deivid/Code/bundler/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run' /home/deivid/Code/bundler/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command' /home/deivid/Code/bundler/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch' /home/deivid/Code/bundler/lib/bundler/cli.rb:26:in `dispatch' /home/deivid/Code/bundler/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start' /home/deivid/Code/bundler/lib/bundler/cli.rb:17:in `start' ../bundler/exe/bundle:30:in `block in
' /home/deivid/Code/bundler/lib/bundler/friendly_errors.rb:123:in `with_friendly_errors' ../bundler/exe/bundle:22:in `
' Tasks: TOP => release => release:rubygem_push (See full trace by running task with --trace) ``` This is the same test using this PR: ``` $ RUBYOPT="-I../bundler/lib" ../bundler/exe/bundle exec rake release rake_release_tester 0.1.0 built to pkg/rake_release_tester-0.1.0.gem. Tag v0.1.0 has already been created. Pushing gem to https://rubygems.org... You have enabled multi-factor authentication. Please enter OTP code. Code: asdfasdf Your OTP code is incorrect. Please check it and retry. ``` * Previous approach was hard to test. The test included here might not be great but it's something... Co-authored-by: David Rodríguez (cherry picked from commit cd05f13a74ef2556823be48c23feaf509c3b1de7) --- lib/bundler/gem_helper.rb | 9 ++++++++- spec/bundler/gem_helper_spec.rb | 28 ++++++++++++++++++++-------- spec/commands/newgem_spec.rb | 14 +------------- spec/support/helpers.rb | 16 ++++++++++++++++ 4 files changed, 45 insertions(+), 22 deletions(-) diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb index e9ee03b8a2..c923a0ad37 100644 --- a/lib/bundler/gem_helper.rb +++ b/lib/bundler/gem_helper.rb @@ -106,7 +106,7 @@ module Bundler 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 - sh(gem_command) + sh_with_input(gem_command) Bundler.ui.confirm "Pushed #{name} #{version} to #{gem_push_host}" end @@ -180,6 +180,13 @@ module Bundler gemspec.name end + def sh_with_input(cmd) + Bundler.ui.debug(cmd) + SharedHelpers.chdir(base) do + abort unless Kernel.system(*cmd) + end + end + def sh(cmd, &block) out, status = sh_with_status(cmd, &block) unless status.success? diff --git a/spec/bundler/gem_helper_spec.rb b/spec/bundler/gem_helper_spec.rb index dc982c6ee7..4fa4831c59 100644 --- a/spec/bundler/gem_helper_spec.rb +++ b/spec/bundler/gem_helper_spec.rb @@ -11,6 +11,7 @@ RSpec.describe Bundler::GemHelper do before(:each) do global_config "BUNDLE_GEM__MIT" => "false", "BUNDLE_GEM__TEST" => "false", "BUNDLE_GEM__COC" => "false" bundle "gem #{app_name}" + prepare_gemspec(app_gemspec_path) end context "determining gemspec" do @@ -218,15 +219,26 @@ RSpec.describe Bundler::GemHelper do end end - it "on releasing" do - mock_build_message app_name, app_version - mock_confirm_message "Tagged v#{app_version}." - mock_confirm_message "Pushed git commits and tags." - expect(subject).to receive(:rubygem_push).with(app_gem_path.to_s) + context "on releasing" do + before do + mock_build_message app_name, app_version + mock_confirm_message "Tagged v#{app_version}." + mock_confirm_message "Pushed git commits and tags." - Dir.chdir(app_path) { sys_exec("git push -u origin master") } + Dir.chdir(app_path) { sys_exec("git push -u origin master") } + end - Rake.application["release"].invoke + it "calls rubygem_push with proper arguments" do + expect(subject).to receive(:rubygem_push).with(app_gem_path.to_s) + + Rake.application["release"].invoke + end + + it "uses Kernel.system" do + expect(Kernel).to receive(:system).with("gem", "push", app_gem_path.to_s, "--host", "http://example.org").and_return(true) + + Rake.application["release"].invoke + end end it "even if tag already exists" do @@ -249,7 +261,7 @@ RSpec.describe Bundler::GemHelper do before(:each) do Rake.application = Rake::Application.new subject.install - allow(subject).to receive(:sh) + allow(subject).to receive(:sh_with_input) end after(:each) do diff --git a/spec/commands/newgem_spec.rb b/spec/commands/newgem_spec.rb index 2914ba66c5..fada9c8bfc 100644 --- a/spec/commands/newgem_spec.rb +++ b/spec/commands/newgem_spec.rb @@ -182,19 +182,7 @@ RSpec.describe "bundle gem" do in_app_root bundle! "gem newgem --bin" - process_file(bundled_app("newgem", "newgem.gemspec")) do |line| - # Simulate replacing TODOs with real values - case line - when /spec\.metadata\["(?:allowed_push_host|homepage_uri|source_code_uri|changelog_uri)"\]/, /spec\.homepage/ - line.gsub(/\=.*$/, "= 'http://example.org'") - when /spec\.summary/ - line.gsub(/\=.*$/, "= %q{A short summary of my new gem.}") - when /spec\.description/ - line.gsub(/\=.*$/, "= %q{A longer description of my new gem.}") - else - line - end - end + prepare_gemspec(bundled_app("newgem", "newgem.gemspec")) Dir.chdir(bundled_app("newgem")) do gems = ["rake-10.0.2", :bundler] diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index 8af2b1ff2d..1e6b70b471 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -543,6 +543,22 @@ module Spec Dir[pattern].each(&chmod[0o755, 0o644]) end + # Simulate replacing TODOs with real values + def prepare_gemspec(pathname) + process_file(pathname) do |line| + case line + when /spec\.metadata\["(?:allowed_push_host|homepage_uri|source_code_uri|changelog_uri)"\]/, /spec\.homepage/ + line.gsub(/\=.*$/, "= 'http://example.org'") + when /spec\.summary/ + line.gsub(/\=.*$/, "= %q{A short summary of my new gem.}") + when /spec\.description/ + line.gsub(/\=.*$/, "= %q{A longer description of my new gem.}") + else + line + end + end + end + def process_file(pathname) changed_lines = pathname.readlines.map do |line| yield line -- cgit v1.2.1 From 8b7b84f0f613b726118355dbfe15b9efe1daa599 Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Wed, 12 Jun 2019 19:16:59 +1000 Subject: bump version to 2.0.2 --- lib/bundler/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb index 401f62447c..129e524d47 100644 --- a/lib/bundler/version.rb +++ b/lib/bundler/version.rb @@ -7,7 +7,7 @@ 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.0.2" unless defined?(::Bundler::VERSION) def self.overwrite_loaded_gem_version begin -- cgit v1.2.1 From 111d04e5777facf6baf20a32a3d5f8ec7ef74a74 Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Wed, 12 Jun 2019 21:22:38 +1000 Subject: add v2.0.2 changelog --- CHANGELOG.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0ca151f49..1e8912e123 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,29 @@ +## 2.0.2 (2019-05-13) + +Changes: + + - Fixes for Bundler integration with ruby-src ([#6941](https://github.com/bundler/bundler/pull/6941), [#6973](https://github.com/bundler/bundler/pull/6973), [#6977](https://github.com/bundler/bundler/pull/6977), [#6315](https://github.com/bundler/bundler/pull/6315), [#7061](https://github.com/bundler/bundler/pull/7061)) + - Use `__dir__` instead of `__FILE__` when generate a gem with `bundle gem` ([#6503](https://github.com/bundler/bundler/pull/6503)) + - Use `https` on externals links in the Bundler gemspec ([#6721](https://github.com/bundler/bundler/pull/6721)) + - Removed duplicate gem names from the suggested `did you mean` list for gem typos ([#6739](https://github.com/bundler/bundler/pull/6739)) + - Removed Ruby 1.x compatibility code ([#6764](https://github.com/bundler/bundler/pull/6764), [#6806](https://github.com/bundler/bundler/pull/6806)) + - Fixed an issue where `bundle remove` would crash with certain Gemfiles ([#6768](https://github.com/bundler/bundler/pull/6769)) + - Fixed indentation in the executable template ([#6773](https://github.com/bundler/bundler/pull/6773)) + - Fixed an issue where plugins could register for the same hook multiple times ([#6775](https://github.com/bundler/bundler/pull/6775)) + - Changed the "multiple sources" message in `bundle install` to be a warning instead of an error ([#6790](https://github.com/bundler/bundler/pull/6790)) + - Fixed a bug where path gems would be break when using `only_update_to_newer_versions` ([#6774](https://github.com/bundler/bundler/pull/6774)) + - Fixed a bug where installing plugins with the `--delpoyment` setting would fail ([#6805](https://github.com/bundler/bundler/pull/6805)) + - Fixed an issue where `bundle update` couldn't update & install a gem when `no_install` was set (a `bundle package` config) ([#7078](https://github.com/bundler/bundler/pull/7078)) + - Fixed an issue where users could not run `bundle exec` on default gems ([#6963](https://github.com/bundler/bundler/pull/6963)) + - Updated vendor libraries to their latest version ([#7076](https://github.com/bundler/bundler/pull/7067), [#7068](https://github.com/bundler/bundler/pull/7068)) + - Fixed an issue where the `github` source was not using `https` by default that we mentioned in the 2.0 release ([#7182](https://github.com/bundler/bundler/pull/7182)) + - Fixed an issue where `rake release` was not outputting the message to users asking for a 2fa token ([#7199](https://github.com/bundler/bundler/pull/7199)) + +Documentation: + + - Fix incorrect documented `BUNDLE_PATH_RELATIVE_TO_CWD` env var ([#6751](https://github.com/bundler/bundler/pull/6751)) + - Update URLs in Bundler's documentation to use `https` ([#6935](https://github.com/bundler/bundler/pull/6935)) + ## 2.0.1 (2019-01-04) Changes: -- cgit v1.2.1 From 496bca538711625189ce9efa64dd0f04a2bd7d85 Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Thu, 13 Jun 2019 18:49:10 +1000 Subject: fix changelog 2.0.2 typos --- CHANGELOG.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e8912e123..25df3babb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,15 +3,15 @@ Changes: - Fixes for Bundler integration with ruby-src ([#6941](https://github.com/bundler/bundler/pull/6941), [#6973](https://github.com/bundler/bundler/pull/6973), [#6977](https://github.com/bundler/bundler/pull/6977), [#6315](https://github.com/bundler/bundler/pull/6315), [#7061](https://github.com/bundler/bundler/pull/7061)) - - Use `__dir__` instead of `__FILE__` when generate a gem with `bundle gem` ([#6503](https://github.com/bundler/bundler/pull/6503)) + - Use `__dir__` instead of `__FILE__` when generating a gem with `bundle gem` ([#6503](https://github.com/bundler/bundler/pull/6503)) - Use `https` on externals links in the Bundler gemspec ([#6721](https://github.com/bundler/bundler/pull/6721)) - Removed duplicate gem names from the suggested `did you mean` list for gem typos ([#6739](https://github.com/bundler/bundler/pull/6739)) - Removed Ruby 1.x compatibility code ([#6764](https://github.com/bundler/bundler/pull/6764), [#6806](https://github.com/bundler/bundler/pull/6806)) - Fixed an issue where `bundle remove` would crash with certain Gemfiles ([#6768](https://github.com/bundler/bundler/pull/6769)) - - Fixed indentation in the executable template ([#6773](https://github.com/bundler/bundler/pull/6773)) - - Fixed an issue where plugins could register for the same hook multiple times ([#6775](https://github.com/bundler/bundler/pull/6775)) + - Fixed indentation in the Bundler executable template ([#6773](https://github.com/bundler/bundler/pull/6773)) + - Fixed an issue where plugins could register for the same Bundler hook multiple times ([#6775](https://github.com/bundler/bundler/pull/6775)) - Changed the "multiple sources" message in `bundle install` to be a warning instead of an error ([#6790](https://github.com/bundler/bundler/pull/6790)) - - Fixed a bug where path gems would be break when using `only_update_to_newer_versions` ([#6774](https://github.com/bundler/bundler/pull/6774)) + - Fixed a bug where path gems would break when using `only_update_to_newer_versions` ([#6774](https://github.com/bundler/bundler/pull/6774)) - Fixed a bug where installing plugins with the `--delpoyment` setting would fail ([#6805](https://github.com/bundler/bundler/pull/6805)) - Fixed an issue where `bundle update` couldn't update & install a gem when `no_install` was set (a `bundle package` config) ([#7078](https://github.com/bundler/bundler/pull/7078)) - Fixed an issue where users could not run `bundle exec` on default gems ([#6963](https://github.com/bundler/bundler/pull/6963)) -- cgit v1.2.1