[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [GMG-Devel] Idea: extend gmg command set through plugins
From: |
Christopher Allan Webber |
Subject: |
Re: [GMG-Devel] Idea: extend gmg command set through plugins |
Date: |
Fri, 20 Jun 2014 10:50:09 -0500 |
User-agent: |
mu4e 0.9.9.6pre2; emacs 24.3.1 |
address@hidden writes:
> I'm working on a plugin and I ended up writing a "gmg-style" command
> for it. I just thought that it would be nice to have a hook to extend
> the SUBCOMMAND_MAP in gmg_commands/__init__.py and just profit from
> the infrastructure that's already setup there.
>
> I'll figure it out and come up with something if you think it is a
> good idea.
>
> On the other hand, the command in question is just a generic utility
> that populates tables from csv files, so it might be interesting to
> bring it up to core anyway.
This would definitely be good. The biggest challenge as far as I can
tell is that getting the plugin system up and running currently involves
getting the whole MediaGoblin application up and running. That means
setting up the database and etc.
Here's the problem: some of the commands are built for when the
application *can't yet be set up*. For example, "gmg dbupdate"
assumes the application is not yet set up because the database needs
updates still before it can be done.
There are probably a few ways around this:
1) the long run plan I'd *really like to do* would be to introduce some
sort of dependency graph / directed acyclic graph to handle the
initialization of the application depending on how much you need.
This goes back to an old complaint from Elrond: why set up the
template system and the storage systems if all we need is the
database?
This could also allow for commands when parts of the application
*can't* be set up yet because there isn't enough there for them to
be.
The challenge here would be figuring out a dependency graph that is
pretty simple and easy to integrate, and not a super heavy
dependency. My knowledge of graph theory is pretty weak / high
level.
2) As a "patch-over" solution, we could try accessing the built-in
commands first before we turn on the plugin system. If someone is
running dbupdate, we can just run that command, plain and simple.
However, if the command given is not one of the "built-in" commands,
we can then (try to) load up the full MediaGoblin application, which
will allow us to set up the plugins right.
I'd much prefer the former than the latter... it seems like work
though. In the meanwhile, #2 would be still a good improvement. I
agree that plugins should be able to add gmg commands.
If you wanted to take on one of these, I think that'd be most welcome!
I'm happy to do more conversation on here or on IRC, though it might
make sense to make a bug on the issue tracker.
- Chris