diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 86e2d6b..12d8e7f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,12 +14,12 @@ jobs: fail-fast: false matrix: ruby-version: [2.6, 2.7, "3.0", 3.1, 3.2] - bundler-version: [2.4.19, 2.4.22, 2.5.9] + bundler-version: [2.4.19, 2.4.22, 2.5.10] exclude: - ruby-version: 2.6 - bundler-version: 2.5.9 + bundler-version: 2.5.10 - ruby-version: 2.7 - bundler-version: 2.5.9 + bundler-version: 2.5.10 env: BUNDLER_VERSION: ${{ matrix.bundler-version }} BUNDLE_LOCKFILE: active diff --git a/Gemfile.lock b/Gemfile.lock index 1970025..b419586 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -102,4 +102,4 @@ DEPENDENCIES stringio (~> 3.1) BUNDLED WITH - 2.5.9 + 2.5.10 diff --git a/Gemfile.ruby-2.6.lock b/Gemfile.ruby-2.6.lock index 4c7bdb0..7bf465c 100644 --- a/Gemfile.ruby-2.6.lock +++ b/Gemfile.ruby-2.6.lock @@ -50,4 +50,4 @@ DEPENDENCIES stringio (= 3.0.6) BUNDLED WITH - 2.5.9 + 2.5.10 diff --git a/lib/bundler/multilock.rb b/lib/bundler/multilock.rb index 828b584..c659b14 100644 --- a/lib/bundler/multilock.rb +++ b/lib/bundler/multilock.rb @@ -82,18 +82,17 @@ def add_lockfile(lockfile = nil, enforce_pinned_additional_dependencies: enforce_pinned_additional_dependencies }) - if (defined?(CLI::Check) || - defined?(CLI::Install) || - defined?(CLI::Lock) || - defined?(CLI::Update)) && - !defined?(CLI::Cache) && !env_lockfile - # always use Gemfile.lock for `bundle check`, `bundle install`, - # `bundle lock`, and `bundle update`. `bundle cache` delegates to - # `bundle install`, but we want that to run as normal. - # If they're using BUNDLE_LOCKFILE, then they really do want to - # use a particular lockfile, and it overrides whatever they - # dynamically set in their gemfile - active = lockfile == Bundler.default_lockfile(force_original: true) + # If they're using BUNDLE_LOCKFILE, then they really do want to + # use a particular lockfile, and it overrides whatever they + # dynamically set in their gemfile + unless env_lockfile + # this is a little icky, but there's no other way to determine which command was run + cli = ObjectSpace.each_object(CLI).first + if %i[check install lock update].include?(cli&.current_command_chain&.first) + # always use Gemfile.lock for `bundle check`, `bundle install`, + # `bundle lock`, and `bundle update`. + active = lockfile == Bundler.default_lockfile(force_original: true) + end end if active