Skip to content

Commit

Permalink
bundle update --bundler
Browse files Browse the repository at this point in the history
had to fix command detection, since with 2.5.10, CLI::Install is
_always_ required for the new auto-install feature
  • Loading branch information
ccutrer committed May 17, 2024
1 parent ab8671a commit 4447973
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,4 @@ DEPENDENCIES
stringio (~> 3.1)

BUNDLED WITH
2.5.9
2.5.10
2 changes: 1 addition & 1 deletion Gemfile.ruby-2.6.lock
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ DEPENDENCIES
stringio (= 3.0.6)

BUNDLED WITH
2.5.9
2.5.10
23 changes: 11 additions & 12 deletions lib/bundler/multilock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4447973

Please sign in to comment.