[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    Re: seeking design ideas for a lightweight plugin system
From:       Martin DeMello <martindemello () gmail ! com>
Date:       2014-03-24 19:25:52
Message-ID: CAFrFfuHMy=5XHqthZUYjKgB0yT_NVT64yRfEWxX==XRXnknv9Q () mail ! gmail ! com
[Download RAW message or body]

Thanks, logstash looks interesting! Will examine their code and see how
they do it. Examining the contrib directory they seem to both inherit from
a base plugin class and provide a register method.

martin


On Mon, Mar 24, 2014 at 3:46 AM, Jes=FAs Gabriel y Gal=E1n <
jgabrielygalan@gmail.com> wrote:

> On Mon, Mar 24, 2014 at 12:50 AM, Martin DeMello
> <martindemello@gmail.com> wrote:
> > I'm writing a crossword format interchange app, modelled on pandoc
> > [https://github.com/martindemello/pangrid], which I'd like to do with a=
n
> > "open set of plugins" architecture.
> >
> > The basic idea is that the library provides a base crossword format, an=
d
> > converters provide one or both of read (string -> crossword) and write
> > (crossword -> string) methods, and a description. The main program woul=
d
> > scan the plugin directory and know all the available readers and writer=
s.
> >
> > So a couple of questions:
> >
> > 1. It's been a while (1.9.3) since I've used ruby for anything other th=
an
> > small scripts; is inherited hooks still the best way to do this? Or
> perhaps
> > an explicit register class method, so that I don't need to subclass
> anything
> > just to get the hook?
>
> I don't know what is the best way, but I've been looking recently into
> Logstash (http://logstash.net/), which has a pluggable, and they do it
> using inheritance. Maybe you could take a look at their source code
> (https://github.com/elasticsearch/logstash and
> https://github.com/elasticsearch/logstash-contrib for separate
> plugins)
>
>
> > 2. Some of the plugins have dependencies on other gems (e.g. axslx).
> What's
> > a good way to determine at load time whether a plugin has its
> dependencies
> > met or not?
>
> Maybe bundler provides some facility to manage this easily.
>
> Jesus.
>

[Attachment #3 (text/html)]

<div dir="ltr">Thanks, logstash looks interesting! Will examine their code and see \
how they do it. Examining the contrib directory they seem to both inherit from a base \
plugin class and provide a register method.<div><br></div> \
<div>martin</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On \
Mon, Mar 24, 2014 at 3:46 AM, Jesús Gabriel y Galán <span dir="ltr">&lt;<a \
href="mailto:jgabrielygalan@gmail.com" \
target="_blank">jgabrielygalan@gmail.com</a>&gt;</span> wrote:<br> <blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div class="">On Mon, Mar 24, 2014 at 12:50 AM, Martin \
DeMello<br> &lt;<a href="mailto:martindemello@gmail.com">martindemello@gmail.com</a>&gt; \
wrote:<br> &gt; I&#39;m writing a crossword format interchange app, modelled on \
pandoc<br> &gt; [<a href="https://github.com/martindemello/pangrid" \
target="_blank">https://github.com/martindemello/pangrid</a>], which I&#39;d like to \
do with an<br> &gt; &quot;open set of plugins&quot; architecture.<br>
&gt;<br>
&gt; The basic idea is that the library provides a base crossword format, and<br>
&gt; converters provide one or both of read (string -&gt; crossword) and write<br>
&gt; (crossword -&gt; string) methods, and a description. The main program would<br>
&gt; scan the plugin directory and know all the available readers and writers.<br>
&gt;<br>
&gt; So a couple of questions:<br>
&gt;<br>
&gt; 1. It&#39;s been a while (1.9.3) since I&#39;ve used ruby for anything other \
than<br> &gt; small scripts; is inherited hooks still the best way to do this? Or \
perhaps<br> &gt; an explicit register class method, so that I don&#39;t need to \
subclass anything<br> &gt; just to get the hook?<br>
<br>
</div>I don&#39;t know what is the best way, but I&#39;ve been looking recently \
into<br> Logstash (<a href="http://logstash.net/" \
target="_blank">http://logstash.net/</a>), which has a pluggable, and they do it<br> \
using inheritance. Maybe you could take a look at their source code<br> (<a \
href="https://github.com/elasticsearch/logstash" \
target="_blank">https://github.com/elasticsearch/logstash</a> and<br> <a \
href="https://github.com/elasticsearch/logstash-contrib" \
target="_blank">https://github.com/elasticsearch/logstash-contrib</a> for \
separate<br> plugins)<br>
<div class=""><br>
<br>
&gt; 2. Some of the plugins have dependencies on other gems (e.g. axslx). \
What&#39;s<br> &gt; a good way to determine at load time whether a plugin has its \
dependencies<br> &gt; met or not?<br>
<br>
</div>Maybe bundler provides some facility to manage this easily.<br>
<br>
Jesus.<br>
</blockquote></div><br></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic