-
Notifications
You must be signed in to change notification settings - Fork 481
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
Extract Guard::UI into a separate gem #713
Comments
👍 |
Promoted to "bug", because guard-plugins depend on UI/notify functionality (but do not need anything else from guard) - and this causes problems for users. |
What can we do to simplify this? |
I thought about this. There is quite a bit of code in guard for doing stuff like color, logging, etc, which is now better handled by standard logger, rainbow, with a custom formatter. Why not deprecated all of the global state, deprecate guard-compat, and then inject that state into the classes directly. e.g. class Plugin
def initialize(logger)
@logger = logger
end
attr :logger
end
class MyPlugin < Plugin
end We could add some compatibility hooks to make this as easy as possible. I think if you expose the global state, it's going to be an endless battle. |
We'd have to probably to a major version bump to implement this, but we could do it with minimal impact. Perhaps we can tie it into the inevitable updates to |
I've been working on https://github.com/socketry/guard-falcon and I've tried to figure out what a guard-plugin should look like. Making the gem name a class e.g. Ideally we'd just use local methods on the class, e.g. We can do a fair amount of monkey patching to fix old plugins, including adding to the plugin base Thoughts? |
Another option is that we completely break away from the inheritance method of doing things, and use a module instead - e.g. Ideally, we probably make a new gem, |
I think we should move away from the inheritance model, but I would argue that Guard should provide a module that plugin classes would include: module Guard
module API
# A module with the content of the current Guard::Plugin
# Guard::Plugin#initialize would show a deprecation warning.
end
end
module Guard
module RSpec
class Plugin
include ::Guard::API
end
end
end The benefit is that See #873, guard/guard-compat#6, and guard/guard-rspec#397. |
TL;DR - UI functionality should be in a separate gem to solve many problems
Basically to decouple the functionality from Guard, because it's a maintenance nightmare:
The text was updated successfully, but these errors were encountered: