ruby/lib
David Rodríguez c0688c21fe [rubygems/rubygems] Raise a simpler error when RubyGems fails to activate a dependency
If you force uninstall a dependency but leave other gems depending on
it, those gems will fail to be activated.

In that case, RubyGems prints a rather complicated error:

```
$ rails --version
/Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems/specification.rb:1413:in 'block in Gem::Specification#activate_dependencies': Could not find 'activesupport' (= 8.0.1) among 478 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/Users/deivid/.local/share/gem/ruby/3.4.0:/Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/gems/3.4.0' at: /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/gems/3.4.0/specifications/railties-8.0.1.gemspec, execute `gem env` for more information
	from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems/specification.rb:1399:in 'Array#each'
	from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems/specification.rb:1399:in 'Gem::Specification#activate_dependencies'
	from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems/specification.rb:1381:in 'Gem::Specification#activate'
	from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems.rb:283:in 'block in Gem.activate_bin_path'
	from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems.rb:282:in 'Thread::Mutex#synchronize'
	from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems.rb:282:in 'Gem.activate_bin_path'
	from /Users/deivid/.asdf/installs/ruby/3.4.1/bin/rails:25:in '<main>'
/Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems/dependency.rb:303:in 'Gem::Dependency#to_specs': Could not find 'activesupport' (= 8.0.1) - did find: [activesupport-7.1.3,activesupport-7.0.8.7] (Gem::MissingSpecVersionError)
Checked in 'GEM_PATH=/Users/deivid/.local/share/gem/ruby/3.4.0:/Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/gems/3.4.0' , execute `gem env` for more information
	from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems/specification.rb:1411:in 'block in Gem::Specification#activate_dependencies'
	from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems/specification.rb:1399:in 'Array#each'
	from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems/specification.rb:1399:in 'Gem::Specification#activate_dependencies'
	from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems/specification.rb:1381:in 'Gem::Specification#activate'
	from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems.rb:283:in 'block in Gem.activate_bin_path'
	from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems.rb:282:in 'Thread::Mutex#synchronize'
	from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems.rb:282:in 'Gem.activate_bin_path'
	from /Users/deivid/.asdf/installs/ruby/3.4.1/bin/rails:25:in '<main>'
```

With this commit, the error becomes a bit simpler to parse:

```
$ rails --version
/Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems/specification.rb:1421:in 'block in Gem::Specification#activate_dependencies': Could not find 'activesupport' (= 8.0.1) among 478 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/Users/deivid/.local/share/gem/ruby/3.4.0:/Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/gems/3.4.0' at: /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/gems/3.4.0/specifications/railties-8.0.1.gemspec, execute `gem env` for more information
	from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems/specification.rb:1407:in 'Array#each'
	from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems/specification.rb:1407:in 'Gem::Specification#activate_dependencies'
	from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems/specification.rb:1389:in 'Gem::Specification#activate'
	from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems.rb:283:in 'block in Gem.activate_bin_path'
	from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems.rb:282:in 'Thread::Mutex#synchronize'
	from /Users/deivid/.asdf/installs/ruby/3.4.1/lib/ruby/site_ruby/3.4.0/rubygems.rb:282:in 'Gem.activate_bin_path'
	from /Users/deivid/.asdf/installs/ruby/3.4.1/bin/rails:25:in '<main>'
```

And also, we reduce exception based control flow in our code.

7e48c49f2d
2025-02-03 10:05:34 +09:00
..
bundler Stop generating binstubs for Bundler itself 2025-01-31 14:34:55 +09:00
cgi Make Pstore tests as optional 2025-01-10 10:19:39 +09:00
did_you_mean [ruby/did_you_mean] Bump version to 2.0.0 2024-12-04 12:32:02 +00:00
erb [ruby/erb] Make @scanner_map of ERB::Compiler::Scanner ractor-shareable 2025-01-15 04:07:43 +00:00
error_highlight [ruby/error_highlight] Ensure first_line and last_line are set 2025-01-29 08:51:42 +00:00
forwardable
net [ruby/net-http] Provide a 'Changelog' link on rubygems.org/gems/net-http 2025-01-06 01:19:55 +00:00
open3
optparse [ruby/optparse] Fix typo [ci skip] 2024-04-18 10:27:19 +09:00
prism [ruby/prism] Fix parser translator scope issues for implicit hash values 2025-01-20 18:03:13 +00:00
random Freeze Random::Formatter::ALPHANUMERIC and its elements 2024-12-16 20:54:40 +09:00
ruby_vm/rjit Mark strings returned by Symbol#to_s as chilled (#12065) 2024-11-13 09:20:00 -05:00
rubygems [rubygems/rubygems] Raise a simpler error when RubyGems fails to activate a dependency 2025-02-03 10:05:34 +09:00
set
syntax_suggest [ruby/syntax_suggest] v2.0.2 2024-11-15 16:09:30 +00:00
unicode_normalize
uri [ruby/uri] [DOC] Make documentation 100% 2025-01-24 01:45:08 +00:00
yaml [ruby/yaml] Support old version of Psych 2024-10-16 08:49:54 +00:00
bundled_gems.rb Added force_activate feature again 2025-01-24 15:46:46 +09:00
bundler.rb [rubygems/rubygems] Don't fallback to evaluating YAML gemspecs as Ruby code 2025-01-20 13:50:25 +09:00
cgi.rb
delegate.gemspec [ruby/delegate] Bump up required ruby version to 3.0 2024-11-07 02:26:50 +00:00
delegate.rb [ruby/delegate] Bump up v0.4.0 2024-11-07 02:26:50 +00:00
did_you_mean.rb [ruby/did_you_mean] Removed deprecated constants for Ruby 3.4 2024-12-04 12:07:11 +00:00
English.gemspec
English.rb
erb.gemspec
erb.rb [ruby/erb] Make ERB::NOT_GIVEN ractor-shareable 2025-01-15 04:07:43 +00:00
error_highlight.rb
fileutils.gemspec [ruby/fileutils] Update license files same as ruby/ruby 2024-08-27 00:39:24 +00:00
fileutils.rb [ruby/fileutils] Bump up v1.7.3 2024-11-01 05:04:32 +00:00
find.gemspec [ruby/find] find.gemspec: Drop executables dir config 2024-05-17 02:05:31 +00:00
find.rb
forwardable.rb
ipaddr.gemspec [ruby/ipaddr] Drop support for Ruby 2.3 2024-10-23 04:07:30 +00:00
ipaddr.rb [ruby/ipaddr] Bump the version to 1.2.7 2024-10-19 12:59:03 +00:00
mkmf.rb [DOC] About create_makefile 2025-01-14 15:34:17 +09:00
open-uri.gemspec
open-uri.rb [ruby/open-uri] Bump up v0.5.0 2024-11-06 08:37:52 +00:00
open3.rb
optionparser.rb
optparse.rb [ruby/optparse] Bump up v0.6.0 2024-11-08 04:22:33 +00:00
pp.gemspec Fix commit miss [ci skip] 2024-11-12 11:53:01 +09:00
pp.rb [ruby/pp] Bump up 0.6.2 2024-12-03 04:52:19 +00:00
prettyprint.gemspec
prettyprint.rb
prism.rb [ruby/prism] Refactor serializer 2025-01-14 15:32:41 +00:00
resolv.gemspec [ruby/resolv] Add spec extensions 2024-09-10 08:33:32 +00:00
resolv.rb [ruby/resolv] Check for Windows in JRuby-compatible way 2025-01-21 08:03:42 +00:00
ruby2_keywords.gemspec
rubygems.rb [rubygems/rubygems] Print message when blocking on a file lock. 2025-01-14 12:24:37 +09:00
securerandom.gemspec [ruby/securerandom] Provide a 'Changelog' link on rubygems.org/gems/securerandom 2025-01-06 01:19:30 +00:00
securerandom.rb [ruby/securerandom] Bump up v0.4.1 2024-12-16 05:43:01 +00:00
set.rb [ruby/set] Fix ^ to respect subclasses 2024-12-02 08:28:58 +09:00
shellwords.gemspec [ruby/shellwords] Exclude unnecessary files from the packages 2024-07-03 10:15:22 +00:00
shellwords.rb [ruby/shellwords] Bump up v0.2.2 2024-12-13 00:50:02 +00:00
singleton.gemspec
singleton.rb [ruby/singleton] Bump up v0.3.0 2024-11-08 03:54:21 +00:00
syntax_suggest.rb
tempfile.gemspec
tempfile.rb [ruby/tempfile] Bump up v0.3.1 2024-11-18 04:28:47 +00:00
time.gemspec
time.rb [ruby/time] [DOC] Make RDoc coverage 100% 2024-11-29 01:39:01 +00:00
timeout.gemspec
timeout.rb [ruby/timeout] Bump up v0.4.3 2024-12-16 03:53:22 +00:00
tmpdir.gemspec [ruby/tmpdir] Bump up v0.3.1 2024-12-17 06:47:52 +00:00
tmpdir.rb [ruby/tmpdir] Move private constants under Dir::Tmpname module 2024-12-16 10:28:10 +00:00
tsort.gemspec
tsort.rb
un.gemspec
un.rb
uri.rb
weakref.gemspec [ruby/weakref] weakref.gemspec: Drop gemspec config on executables 2025-01-23 00:24:44 +00:00
weakref.rb
yaml.rb [ruby/yaml] Bump up v0.4.0 2024-11-06 07:32:52 +00:00