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

Plugin archtecture #7

Open
paulohtfs opened this issue Jul 26, 2016 · 2 comments
Open

Plugin archtecture #7

paulohtfs opened this issue Jul 26, 2016 · 2 comments
Assignees

Comments

@paulohtfs
Copy link
Member

Cupper must be extensible for plugins.

@paulohtfs
Copy link
Member Author

I spoke with Joênio, and a plugin architecture can be done in different ways. The most basic is to create a interface and tell the plugin to implement those methods that are used to collect data on each distros. The current implementation it's already using this method, the next step is to separate the classes that implement the concrete class in a plugin directory.

@paulohtfs
Copy link
Member Author

Searching for more information about plugins on Ohai architecture, I built an example of how can implement a plugins arch using something similar to Ohai.

First we have a module or class that implements a plugin method (see below).

# some_lib.rb
module Cupper
  def self.method(text)
    puts text
  end
  def self.plugin(name, &block)
    Cupper.class_eval(&block)
  end

  load 'some_plugin.rb' # The starting point of loading the plugins
end

This method will receive a block of code from the plugin

# some_plugin.rb
Cupper.plugin(:plugin_name) do
  method "Texto to display"
end

That's the rough structure, but I don't think that is a good think to do it now.

@paulohtfs paulohtfs added next and removed priority labels Sep 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant