TL;DR It would be great if bundle outdated has an --ignore exact flag to skip over gems with a = in their version. I would also like to take a stab at implementing this if you agree it is a useful addition to the outdated subcommand.
Describe the problem as clearly as you can
We regularly update all our outdated gems using bundle outdated --only-explicit. However, each project normally has a couple of gems that are defined like so e.g.:
gem 'faraday', '= 2.7.12' # NOTE: Salesforce gem has a transitive dependency on this. Cannot upgrade until restforce gem is updated.
This gem, as an example, cannot be updated because of an outdated shared dependency. There are many other reasons why we would want to explicitly lock a gem at a specific version.
I would like to run bundle outdated --only-explicit --ignore-exact and have it filter out outdated gems that have an exact version in our gemfile.
By doing so, we can integrate bundle outdated into our pipelines and ensure we are always up to date. Right now, it would exit with a status of 1 with these gems specified.
Before
root@bbf593aba375:/# bundle outdated --only-explicit
Fetching gem metadata from https://rubygems.org/........
Resolving dependencies...
Gem Current Latest Requested Groups
google-ads-googleads 35.2.0 40.1.0 = 35.2.0 default
pagy 9.4.0 43.5.3 ~> 9.4.0 default
pipedrive-connect 2.0.1 2.1.2 = 2.0.1 default
view_component 4.9.0 4.10.0 ~> 4.9.0 default
root@bbf593aba375:/# echo $?
1
After
root@bbf593aba375:/# bundle outdated --only-explicit --ignore-exact
Fetching gem metadata from https://rubygems.org/........
Resolving dependencies...
Gem Current Latest Requested Groups
pagy 9.4.0 43.5.3 ~> 9.4.0 default
view_component 4.9.0 4.10.0 ~> 4.9.0 default
root@bbf593aba375:/# echo $?
1
and assuming we resolve the two outdated gems:
root@bbf593aba375:/# bundle outdated --only-explicit --ignore-exact
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Bundle up to date!
root@bbf593aba375:/# echo $?
0
More on behaviour of flag
Developers normally specify an exact version in one of two ways:
The version pin without the equals is normally added when copying and pasting, and it's ambiguous as to whether or not the intention is truly to use that exact version. However, when prepending with =, the developer is signalling that they do indeed wish to use that exact version, and not anything else.
Therefore, making the --ignore-exact flag only ignore gems explicitly marked with = could be considered safe behaviour for this flag.
Did you try upgrading rubygems & bundler?
I've checked, and bundler 4.0.11, the latest as of creating this issue, does not have this feature.
TL;DR It would be great if
bundle outdatedhas an--ignore exactflag to skip over gems with a=in their version. I would also like to take a stab at implementing this if you agree it is a useful addition to theoutdatedsubcommand.Describe the problem as clearly as you can
We regularly update all our outdated gems using
bundle outdated --only-explicit. However, each project normally has a couple of gems that are defined like so e.g.:This gem, as an example, cannot be updated because of an outdated shared dependency. There are many other reasons why we would want to explicitly lock a gem at a specific version.
I would like to run
bundle outdated --only-explicit --ignore-exactand have it filter out outdated gems that have an exact version in our gemfile.By doing so, we can integrate
bundle outdatedinto our pipelines and ensure we are always up to date. Right now, it would exit with a status of1with these gems specified.Before
After
and assuming we resolve the two outdated gems:
More on behaviour of flag
Developers normally specify an exact version in one of two ways:
"1.2.3""= 1.2.3"The version pin without the equals is normally added when copying and pasting, and it's ambiguous as to whether or not the intention is truly to use that exact version. However, when prepending with
=, the developer is signalling that they do indeed wish to use that exact version, and not anything else.Therefore, making the
--ignore-exactflag only ignore gems explicitly marked with=could be considered safe behaviour for this flag.Did you try upgrading rubygems & bundler?
I've checked, and bundler
4.0.11, the latest as of creating this issue, does not have this feature.