Skip to content

Handle non-installed gems#7

Open
kbrock wants to merge 1 commit intorubygems:masterfrom
kbrock:lenient_dependencies
Open

Handle non-installed gems#7
kbrock wants to merge 1 commit intorubygems:masterfrom
kbrock:lenient_dependencies

Conversation

@kbrock
Copy link
Copy Markdown

@kbrock kbrock commented Oct 17, 2024

When there are production gems that are not installed in development, graph will not be able to find the gem.

Unfortunately, there is no information available to fix the issue other than open the gem and add a rescue / puts.

Before

It threw an exception without any actionable information.

[master] manageiq $ bundle graph -W test:development --format svg

--- ERROR REPORT TEMPLATE -------------------------------------------------------
NoMethodError: undefined method `runtime_dependencies' for nil
  /Users/kbrock/.gem/ruby/3.3.4/gems/bundler-graph-0.2.1/lib/bundler/dep_graph.rb:47:in `block (2 levels) in _populate_relations'
          /Users/kbrock/.rubies/ruby-3.3.4/lib/ruby/3.3.0/set.rb:501:in `each_key'
          /Users/kbrock/.rubies/ruby-3.3.4/lib/ruby/3.3.0/set.rb:501:in `each'
          /Users/kbrock/.gem/ruby/3.3.4/gems/bundler-graph-0.2.1/lib/bundler/dep_graph.rb:38:in `block in _populate_relations'
          <internal:kernel>:187:in `loop'
...
--- TEMPLATE END ----------------------------------------------------------------

Unfortunately, an unexpected error occurred, and Bundler cannot continue.
...

After

[master] manageiq $ bundle graph -W test:development --format svg

Could not find dependency qpid_proton [group: qpid_proton]
Could not find dependency dbus-systemd [group: systemd]
Could not find dependency sd_notify [group: systemd]
Could not find dependency systemd-journal [group: systemd]
Could not find dependency irb [group: appliance]
Could not find dependency manageiq-appliance_console [group: appliance]
Could not find dependency rdoc [group: appliance]

/Users/kbrock/src/manageiq/gem_graph.svg

[master] manageiq $ bundle graph -W test:development:qpid_proton:systemd:appliance --format svg

/Users/kbrock/src/manageiq/gem_graph.svg

[master] manageiq $

DISCLAIMER: I did add a few blank lines in this PR to make the output easier to read. Those are not in the actual output.

When there are production gems that are not installed in development, graph
will not be able to find the gem.

Before
It threw an exception without any actionable information.

After
It still generates a graph, but also provides information so the user can exclude the group with -W if desired
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.

1 participant