`bundle lock` commands do not run hooks such as `after-install-all`
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 4k
- Forks
- 1.9k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 81
Description
Describe the problem as clearly as you can
bundle lock commands, including --update don't seem to work with any registered hooks. I could see them having a different set of hooks or simply applying the existing ones since many of the operations end up having a similar effect as bundle update and bundle install.
Did you try upgrading rubygems & bundler?
I am running the latest Bundler (2.5.7 as of this posting)
Post steps to reproduce the problem
I just looked through the source code, but if you created a simple plugin that registered an after-install-all hook you can see that it runs in most operations, but not bundle lock
Bundler::Plugin::API.hook('after-install-all') do |_deps|
puts 'after-install-all hook run!'
end
Which command did you run?
bundle lock --add-platform
bundle lock --update=rake --conservative
What were you expecting to happen?
I expect a registered after-install-all hook to run after updating gems (and before-install-all to run before) or really even after any change to the lockfile is made. However, in the latter case, I just expect that hooks of some kind are available for plugins to use. So, I am not against additional events being added and run during bundle lock operations.
Example with bundle update:
~/dev/bundle-all 🔮❯❯❯ bundle update rake --conservative
Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies...
Using rake 13.1.0 (was 13.0.6)
after-install-all hook run!
What actually happened?
The after-install-all hook doesn't run. (No other hooks do either.)
Example with bundle lock:
~/dev/bundle-all 🔮❯❯❯ bundle lock --update=rake --conservative
Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies...
Writing lockfile to /Users/joesharp/dev/bundle-all/Gemfile.lock
It doesn't mention it, but this command does in fact change the Gemfile.lock to use rake 13.1.0, just like the first example using bundle update.
If not included with the output of your command, run bundle env and paste the output below
Environment
Bundler 2.5.6
Platforms ruby, arm64-darwin-22
Ruby 3.2.3p157 (2024-01-18 revision 52bb2ac0a6971d0391efa2275f7a66bff319087c) [arm64-darwin-22]
Full Path /Users/joesharp/.asdf/installs/ruby/3.2.3/bin/ruby
Config Dir /Users/joesharp/.asdf/installs/ruby/3.2.3/etc
RubyGems 3.4.19
Gem Home /Users/joesharp/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0
Gem Path /Users/joesharp/.gem/ruby/3.2.0:/Users/joesharp/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0
User Home /Users/joesharp
User Path /Users/joesharp/.gem/ruby/3.2.0
Bin Dir /Users/joesharp/.asdf/installs/ruby/3.2.3/bin
Tools
Git 2.39.2 (Apple Git-143)
RVM not installed
rbenv not installed
chruby not installed
Bundler Build Metadata
Built At 2024-02-06
Git SHA 7ac045dcaa
Released Version true
Bundler settings
jobs
Set for the current user (/Users/joesharp/.bundle/config): 9
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the behavior with bundle lock --add-platform <platform> and bundle lock --update=rake --conservative, then compare it with bundle update and the Bundler::Plugin::API.hook('after-install-all') example. Done means the relevant hooks, or clearly defined lockfile-operation hooks, run consistently during bundle lock operations and are covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100