Skip to content

Commit

Permalink
Rename 'custom lockfile' in code
Browse files Browse the repository at this point in the history
  • Loading branch information
andyw8 committed Oct 17, 2024
1 parent 4cd1e1b commit 9f9935b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/ruby_lsp/setup_bundler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def run_bundle_install(bundle_gemfile = @gemfile)
$stderr.puts("Ruby LSP> Running bundle install for the composed bundle. This may take a while...")
$stderr.puts("Ruby LSP> Command: #{command}")

# Try to run the bundle install or update command. If that fails, it normally means that the custom lockfile is in
# Try to run the bundle install or update command. If that fails, it normally means that the composed lockfile is in
# a bad state that no longer reflects the top level one. In that case, we can remove the whole directory, try
# another time and give up if it fails again
if !system(env, command) && !@retry && @custom_dir.exist?
Expand Down Expand Up @@ -288,13 +288,13 @@ def should_bundle_update?
if @rails_app
return false if @dependencies.values_at("ruby-lsp", "ruby-lsp-rails", "debug").all?

# If the custom lockfile doesn't include `ruby-lsp`, `ruby-lsp-rails` or `debug`, we need to run bundle install
# If the composed lockfile doesn't include `ruby-lsp`, `ruby-lsp-rails` or `debug`, we need to run bundle install
# before updating
return false if composed_bundle_dependencies.values_at("ruby-lsp", "debug", "ruby-lsp-rails").any?(&:nil?)
else
return false if @dependencies.values_at("ruby-lsp", "debug").all?

# If the custom lockfile doesn't include `ruby-lsp` or `debug`, we need to run bundle install before updating
# If the composed lockfile doesn't include `ruby-lsp` or `debug`, we need to run bundle install before updating
return false if composed_bundle_dependencies.values_at("ruby-lsp", "debug").any?(&:nil?)
end

Expand Down
2 changes: 1 addition & 1 deletion test/setup_bundler_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def test_changing_lockfile_causes_composed_bundle_to_be_rebuilt

# At this point, the composed bundle includes the `ruby-lsp` in its lockfile, but that will be overwritten when
# we copy the top level lockfile. If composed bundle dependencies are eagerly evaluated, then we would think the
# ruby-lsp is a part of the custom lockfile and would try to run `bundle update ruby-lsp`, which would fail. If
# ruby-lsp is a part of the composed lockfile and would try to run `bundle update ruby-lsp`, which would fail. If
# we evaluate lazily, then we only find dependencies after the lockfile was copied, and then run bundle install
# instead, which re-locks and adds the ruby-lsp
Bundler.with_unbundled_env do
Expand Down

0 comments on commit 9f9935b

Please sign in to comment.