Dist::Zilla-style plugin architecture for actions #6

Closed
pshangov opened this Issue Mar 22, 2012 · 3 comments

Comments

Projects
None yet
3 participants

Currently a pinto command executes what has been defined in its corresponding action class. I would like, instead, for Pinto to be able to work with plugins, so that the purpose of an action would be to load all plugins implementing a corresponding role and execute them in turn.

For example:

Pinto::Role::Mirror - role requiring a 'mirror' method
Pinto::Plugin::MyMirror - plugin implementing Pinto::Role::Mirror and providing a custom 'mirror method'
Pinto::Action::Mirror - load all plugins implementing Pinto::Role::Mirror and execute their 'mirror' method.

This is the architectire that Dist::Zilla and Perlanet use.

Most of the current pinto actions would then have corresponding roles, and a plugin will implement one or more of these as necessary. Examples:

Pinto::Role::Mirror - mirror stuff

  • plugin to mirror the latest releases on CPAN
  • plugin to mirror all of CPAN
  • plugin to mirror only specific releases on CPAN (e.g. CPAN::Mini::Devel)
  • plugin to mirror specific releases from BackPAN, from a list in a configuration file

Pinto::Role::Index - update index after new distributions have been added

  • plugin to update 02packages.details.txt.gz
  • plugin to update pinto.db
  • plugin to update other sources, e.g. ElastticSearch for a local MetaCPAN::API, or a CPANIDX index
  • plugin to create a RECENT file
  • plugin to send an email message to all developers that the repo has been updated

Pinto::Role::Clean - a role that allows plugins (e.g. mirroring plugins) to say which files they no longer need
Pinto::Role::Verify - a role that allows plugins to check that whatever files they care about are consistent with the index
Pinto::Role::Initialize - a role that allows plugins to do stuff at repo creation, e.g. to set up pinto.db or other databases

I am willing to work on this feature if you believe it makes sense to implement.

Contributor

karenetheridge commented Mar 22, 2012

Sounds interesting.. it would likely also help eliminate the duplication between the code that describes the command line syntax for commands, and the moose attributes that contain those configs (drawing again on what Dist::Zilla does here), and the duplication between pinto-admin and pinto-remote.

(PS. I've created the #pinto channel on irc.perl.org... currently it's just me there.. but this could be the start of a new community!)

Owner

thaljef commented Mar 26, 2012

On Mar 22, 2012, at 5:41 AM, Peter Shangov wrote:

Currently a pinto command executes what has been defined in its corresponding action class. I would like, instead, for Pinto to be able to work with plugins, so that the purpose of an action would be to load all plugins implementing a corresponding role and execute them in turn.

...

I am willing to work on this feature if you believe it makes sense to implement.

Yes. Please help!

I think the main reason that I didn't follow DZ's plugin model from the start is because I just didn't (and still don't) fully understand it. But I can't really argue with DZ's success -- they must be doing something right! So show me the way :)

I can definitely see roles like BeforeMIrror / AfterMirror or BeforeCommit / AfterCommit that perform tasks at specific times. But I'm a little nervous about making the action itself entirely role-based. But I'm sure we'll figure that out.

-Jeff

Owner

thaljef commented Mar 27, 2013

I've gotten better at using roles, but I still don't see an opportunity to make Pinto totally pluggable like Dist::Zilla. So I'm gonna stick with this architecture for now. But I'm always open to new ideas if you can show me a better way.

@thaljef thaljef closed this Mar 27, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment