Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Bundler::Plugin.loaded? helper #6964

Merged
merged 2 commits into from
Nov 1, 2023

Conversation

ccutrer
Copy link
Contributor

@ccutrer ccutrer commented Sep 15, 2023

What was the end-user or developer problem that led to this PR?

I have a bundler plugin that adds to the bundler DSL. Right now users of the plugin must do something like return unless defined?(...) to see if the plugin has loaded. A simpler, more direct helper was desired.

What is your fix for the problem, implemented in this PR?

Add a Plugin.loaded? helper. Use it internally, also making Plugin.load_plugin idempotent (many plugins I've looked at have a tendency to call that method directly, and use a unless defined?(...) guard.

Make sure the following tasks are checked

Useful if your plugin introduces new methods to the DSL, so that
Gemfiles can easily abort if the plugin hasn't loaded yet
it was a performance improvement only, but it causes failures in
unrelated tests
@duckinator
Copy link
Member

This is a very nice improvement, thank you for the PR!

@duckinator duckinator merged commit f8e87eb into rubygems:master Nov 1, 2023
92 checks passed
deivid-rodriguez pushed a commit that referenced this pull request Nov 8, 2023
Add Bundler::Plugin.loaded? helper

(cherry picked from commit f8e87eb)
deivid-rodriguez pushed a commit that referenced this pull request Nov 8, 2023
Add Bundler::Plugin.loaded? helper

(cherry picked from commit f8e87eb)
deivid-rodriguez pushed a commit that referenced this pull request Nov 8, 2023
Add Bundler::Plugin.loaded? helper

(cherry picked from commit f8e87eb)
deivid-rodriguez pushed a commit that referenced this pull request Nov 8, 2023
Add Bundler::Plugin.loaded? helper

(cherry picked from commit f8e87eb)
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.

None yet

3 participants