Skip to content

Ruby: Extract Herb#ensure_installed helper#1665

Merged
marcoroth merged 1 commit into
mainfrom
ensure-installed
Apr 21, 2026
Merged

Ruby: Extract Herb#ensure_installed helper#1665
marcoroth merged 1 commit into
mainfrom
ensure-installed

Conversation

@marcoroth

@marcoroth marcoroth commented Apr 21, 2026

Copy link
Copy Markdown
Owner

This pull request extracts a shared Herb.ensure_installed helper that handles inline gem installation via Bundler.

Previously, both RenderAnalyzer and Project duplicated the same bundler/inline gemfile block with identical boilerplate for requiring, installing, and suppressing Ruby warnings during gem activation.

The new helper centralizes this into a single method on the Herb module, making call sites one-liners and suppressing the noisy RDoc constant redefinition warnings that bundler/inline triggers in some environments:

❯ bundle exec herb actionview graph app/views/profiles/_header.html.erb

 Herb 🌿 v0.9.7

 Building render graph...
/Users/marcoroth/.local/share/mise/installs/ruby/4.0.0/lib/ruby/gems/4.0.0/gems/rdoc-7.0.3/lib/rdoc/version.rb:8: warning: already initialized constant RDoc::VERSION
/Users/marcoroth/.local/share/mise/installs/ruby/4.0.0/lib/ruby/gems/4.0.0/gems/rdoc-7.2.0/lib/rdoc/version.rb:8: warning: previous definition of VERSION was here
/Users/marcoroth/.local/share/mise/installs/ruby/4.0.0/lib/ruby/gems/4.0.0/gems/rdoc-7.0.3/lib/rdoc.rb:68: warning: already initialized constant RDoc::VISIBILITIES
/Users/marcoroth/.local/share/mise/installs/ruby/4.0.0/lib/ruby/gems/4.0.0/gems/rdoc-7.2.0/lib/rdoc.rb:68: warning: previous definition of VISIBILITIES was here
/Users/marcoroth/.local/share/mise/installs/ruby/4.0.0/lib/ruby/gems/4.0.0/gems/rdoc-7.0.3/lib/rdoc.rb:74: warning: already initialized constant RDoc::DOT_DOC_FILENAME
/Users/marcoroth/.local/share/mise/installs/ruby/4.0.0/lib/ruby/gems/4.0.0/gems/rdoc-7.2.0/lib/rdoc.rb:74: warning: previous definition of DOT_DOC_FILENAME was here
/Users/marcoroth/.local/share/mise/installs/ruby/4.0.0/lib/ruby/gems/4.0.0/gems/rdoc-7.0.3/lib/rdoc.rb:79: warning: already initialized constant RDoc::GENERAL_MODIFIERS
/Users/marcoroth/.local/share/mise/installs/ruby/4.0.0/lib/ruby/gems/4.0.0/gems/rdoc-7.2.0/lib/rdoc.rb:79: warning: previous definition of GENERAL_MODIFIERS was here
/Users/marcoroth/.local/share/mise/installs/ruby/4.0.0/lib/ruby/gems/4.0.0/gems/rdoc-7.0.3/lib/rdoc.rb:84: warning: already initialized constant RDoc::CLASS_MODIFIERS
/Users/marcoroth/.local/share/mise/installs/ruby/4.0.0/lib/ruby/gems/4.0.0/gems/rdoc-7.2.0/lib/rdoc.rb:84: warning: previous definition of CLASS_MODIFIERS was here
/Users/marcoroth/.local/share/mise/installs/ruby/4.0.0/lib/ruby/gems/4.0.0/gems/rdoc-7.0.3/lib/rdoc.rb:89: warning: already initialized constant RDoc::ATTR_MODIFIERS
/Users/marcoroth/.local/share/mise/installs/ruby/4.0.0/lib/ruby/gems/4.0.0/gems/rdoc-7.2.0/lib/rdoc.rb:89: warning: previous definition of ATTR_MODIFIERS was here
/Users/marcoroth/.local/share/mise/installs/ruby/4.0.0/lib/ruby/gems/4.0.0/gems/rdoc-7.0.3/lib/rdoc.rb:94: warning: already initialized constant RDoc::CONSTANT_MODIFIERS
/Users/marcoroth/.local/share/mise/installs/ruby/4.0.0/lib/ruby/gems/4.0.0/gems/rdoc-7.2.0/lib/rdoc.rb:94: warning: previous definition of CONSTANT_MODIFIERS was here
/Users/marcoroth/.local/share/mise/installs/ruby/4.0.0/lib/ruby/gems/4.0.0/gems/rdoc-7.0.3/lib/rdoc.rb:99: warning: already initialized constant RDoc::METHOD_MODIFIERS
/Users/marcoroth/.local/share/mise/installs/ruby/4.0.0/lib/ruby/gems/4.0.0/gems/rdoc-7.2.0/lib/rdoc.rb:99: warning: previous definition of METHOD_MODIFIERS was here
/Users/marcoroth/.local/share/mise/installs/ruby/4.0.0/lib/ruby/gems/4.0.0/gems/rdoc-7.0.3/lib/rdoc/markdown.rb:257: warning: already initialized constant RDoc::Markdown::KpegPosInfo
/Users/marcoroth/.local/share/mise/installs/ruby/4.0.0/lib/ruby/gems/4.0.0/gems/rdoc-7.2.0/lib/rdoc/markdown.rb:257: warning: previous definition of KpegPosInfo was here

Might be related to #1435

@pkg-pr-new

pkg-pr-new Bot commented Apr 21, 2026

Copy link
Copy Markdown
npx https://pkg.pr.new/@herb-tools/formatter@1665
npx https://pkg.pr.new/@herb-tools/language-server@1665
npx https://pkg.pr.new/@herb-tools/linter@1665

commit: e5d2dea

@github-actions

github-actions Bot commented Apr 21, 2026

Copy link
Copy Markdown

🌿 Interactive Playground and Documentation Preview

A preview deployment has been built for this pull request. Try out the changes live in the interactive playground:


🌱 Grown from commit e5d2dea


✅ Preview deployment has been cleaned up.

@marcoroth marcoroth merged commit 5b2f829 into main Apr 21, 2026
32 checks passed
@marcoroth marcoroth deleted the ensure-installed branch April 21, 2026 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant