Questions on writing plugin for merb
Luke Sutton
luke.sutton at gmail.com
Wed Dec 19 01:11:19 EST 2007
Hi Tim,
> I am looking to write a plugin for merb and have a few queries about
> how to best go about it. I have a few questions (sorry if some are
> very merb newbie ones):
>
> - It seems all the plugins are gems; I can just add dependencies (my
> plugin will require soap4r) as per any usual gem spec?
Yep
> - If I want my plugin to add some new generate functionality? Is this
> possible? If so, are there any examples? I dont seem to be able to
> find any :(
Do you mean adding generators? I don't know too much about this, but
someone else on the list can probably fill you in.
> - The plugin needs to go into the gem dir right? So anything within
> the gem dir is automatically included on the app load path?
That's right. Although they don't have to be in the gem dir if you
don't need. They can be installed like regular gems.
> - If there were some view helpers in the gem, is there way of forcing
> them to be included like in rails where you include them into the
> ActionView module so they are instantly available in views?
Yep. You need to mix them into the ViewContext module. The
merb_helpers plugin has a good example:
class Merb::ViewContext #:nodoc:
include Merb::Helpers::Form
end
> It also seems that in version 0.4.2, doing "merb -P my_plugin" doesnt
> work outside a merb app? Is this a bug?
I've heard a few other people complain about this, but I haven't seen
it myself. It's definitely a bug :)
--
Luke
More information about the Merb-devel
mailing list