Skip to content

Conversation

@is-alnilam
Copy link
Contributor

@is-alnilam is-alnilam commented Oct 29, 2025

Currently only pre-existing Rubies are used, although the code will search for and consider multiple versions. This allows a hook to require 3.4.7 when the default system Ruby is 3.4.6, but RVM (or a similar tool) has installed 3.4.7. If a suitable Ruby cannot be found, the user is prompted to install one manually and re-run.

Hooks get an isolated GEM_HOME, based on the hook repository, any additional_dependencies, and the interpreter version/path. Any Ruby upgrade would therefore re-install the gems to ensure that stale versions aren't used. Repository gem dependencies are installed based on the included gemspec files, combined with the additional_dependencies field.

Updates #43

Currently only pre-existing Rubies are used, although the code will
search for and consider multiple versions. This allows a hook to require
3.4.7 when the default system Ruby is 3.4.6, but RVM (or a similar tool)
has installed 3.4.7. If a suitable Ruby cannot be found, the user is
prompted to install one manually and re-run.

Hooks get an isolated GEM_HOME, based on the hook repository, any
additional_dependencies, and the interpreter version/path. Any Ruby
upgrade would therefore re-install the gems to ensure that stale
versions aren't used. Repository gem dependencies are installed based on
the included gemspec files, combined with the additional_dependencies
field.
@codecov
Copy link

codecov bot commented Oct 29, 2025

Codecov Report

❌ Patch coverage is 91.22257% with 56 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.70%. Comparing base (156f069) to head (a27a265).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/languages/ruby/installer.rs 88.30% 38 Missing ⚠️
src/languages/ruby/ruby.rs 91.86% 10 Missing ⚠️
src/languages/ruby/version.rs 95.83% 4 Missing ⚠️
src/languages/ruby/gem.rs 97.70% 2 Missing ⚠️
src/languages/version.rs 66.66% 1 Missing ⚠️
src/store.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #993      +/-   ##
==========================================
+ Coverage   89.61%   89.70%   +0.09%     
==========================================
  Files          68       72       +4     
  Lines       12400    13038     +638     
==========================================
+ Hits        11112    11696     +584     
- Misses       1288     1342      +54     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link

github-actions bot commented Oct 29, 2025

📦 Cargo Bloat Comparison

Binary size change: +0.62% (16.1 MiB → 16.2 MiB)

Expand for cargo-bloat output

Head Branch Results

 File  .text     Size          Crate Name
 0.6%   1.3% 101.3KiB          prek? <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.6%   1.3%  97.4KiB           prek prek::builtin::pre_commit_hooks::Implemented::run::{{closure}}
 0.6%   1.2%  94.2KiB           prek prek::languages::<impl prek::config::Language>::run::{{closure}}
 0.4%   1.0%  72.7KiB           prek prek::archive::unpack::{{closure}}
 0.3%   0.6%  48.8KiB           prek prek::run::{{closure}}
 0.2%   0.5%  40.0KiB           prek prek::languages::<impl prek::config::Language>::install::{{closure}}
 0.2%   0.5%  39.1KiB          prek? <prek::cli::RunArgs as clap_builder::derive::Args>::augment_args
 0.2%   0.5%  37.3KiB regex_automata regex_automata::meta::strategy::new
 0.2%   0.4%  32.5KiB             h2 h2::proto::connection::Connection<T,P,B>::poll
 0.2%   0.4%  32.3KiB           prek prek::languages::node::installer::NodeInstaller::install::{{closure}}
 0.2%   0.4%  31.9KiB             h2 h2::proto::connection::DynConnection<B>::recv_frame
 0.2%   0.4%  31.5KiB           prek prek::workspace::Workspace::discover
 0.2%   0.4%  30.8KiB           prek prek::cli::run::run::run::{{closure}}
 0.2%   0.4%  27.6KiB           prek prek::identify::by_extension::{{closure}}
 0.2%   0.3%  25.4KiB     hyper_util hyper_util::client::legacy::client::Client<C,B>::connect_to::{{closure}}::{{closure}}::{{closure}}
 0.2%   0.3%  25.1KiB           prek prek::main
 0.1%   0.3%  24.8KiB     hyper_util hyper_util::client::legacy::client::Client<C,B>::send_request::{{closure}}
 0.1%   0.3%  24.8KiB           prek prek::hook::HookBuilder::build::{{closure}}
 0.1%   0.3%  24.2KiB           prek prek::languages::golang::installer::GoInstaller::install::{{closure}}
 0.1%   0.3%  23.9KiB          hyper hyper::proto::h1::dispatch::Dispatcher<D,Bs,I,T>::poll_loop
40.0%  87.6%   6.5MiB                And 10226 smaller methods. Use -n N to show more.
45.6% 100.0%   7.4MiB                .text section size, the file size is 16.2MiB

Base Branch Results

 File  .text     Size          Crate Name
 0.6%   1.3% 101.3KiB          prek? <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.6%   1.3%  97.4KiB           prek prek::builtin::pre_commit_hooks::Implemented::run::{{closure}}
 0.5%   1.1%  85.6KiB           prek prek::languages::<impl prek::config::Language>::run::{{closure}}
 0.4%   1.0%  72.7KiB           prek prek::archive::unpack::{{closure}}
 0.3%   0.6%  48.8KiB           prek prek::run::{{closure}}
 0.2%   0.5%  40.3KiB           prek prek::languages::<impl prek::config::Language>::install::{{closure}}
 0.2%   0.5%  39.1KiB          prek? <prek::cli::RunArgs as clap_builder::derive::Args>::augment_args
 0.2%   0.5%  37.3KiB regex_automata regex_automata::meta::strategy::new
 0.2%   0.4%  32.5KiB             h2 h2::proto::connection::Connection<T,P,B>::poll
 0.2%   0.4%  32.3KiB           prek prek::languages::node::installer::NodeInstaller::install::{{closure}}
 0.2%   0.4%  31.9KiB             h2 h2::proto::connection::DynConnection<B>::recv_frame
 0.2%   0.4%  31.5KiB           prek prek::workspace::Workspace::discover
 0.2%   0.4%  30.8KiB           prek prek::cli::run::run::run::{{closure}}
 0.2%   0.4%  27.6KiB           prek prek::identify::by_extension::{{closure}}
 0.2%   0.3%  25.4KiB     hyper_util hyper_util::client::legacy::client::Client<C,B>::connect_to::{{closure}}::{{closure}}::{{closure}}
 0.2%   0.3%  25.1KiB           prek prek::main
 0.2%   0.3%  24.8KiB     hyper_util hyper_util::client::legacy::client::Client<C,B>::send_request::{{closure}}
 0.1%   0.3%  24.8KiB           prek prek::hook::HookBuilder::build::{{closure}}
 0.1%   0.3%  24.2KiB           prek prek::languages::golang::installer::GoInstaller::install::{{closure}}
 0.1%   0.3%  23.9KiB          hyper hyper::proto::h1::dispatch::Dispatcher<D,Bs,I,T>::poll_loop
39.9%  87.6%   6.4MiB                And 10190 smaller methods. Use -n N to show more.
45.5% 100.0%   7.3MiB                .text section size, the file size is 16.1MiB

@is-alnilam
Copy link
Contributor Author

Just to say that I'll have limited time after next week to look at this for a while. All your tweaks look good to me (not that you need my approval!) and thanks for finding the areas where I'd missed parts of the existing code...

Let me know if you want me to pick up on any tasks over the next few days, for instance rebasing / catchup merge from master, otherwise I'll leave it in your hands so we don't duplicate effort.

# Conflicts:
#	.github/workflows/ci.yml
@j178 j178 merged commit d9baf0a into j178:master Nov 3, 2025
21 checks passed
@j178
Copy link
Owner

j178 commented Nov 3, 2025

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants