Plugins? Components?


#1

Hi,

Newbie here :slight_smile:

Can someone help explain the difference between “plugins” (put in the
/vendor/plugins directory) and “components” (put into the /components
directory)?

Is it just that “plugins” have an init.rb file that is automatically
loaded?

Also, how can I dynamically find out which files/controllers are
available in the /components directory?

Thanks,
Estelle.


#2

On Sat, 2006-02-25 at 16:00 -0800, Estelle W. wrote:

Also, how can I dynamically find out which files/controllers are
available in the /components directory?


I can’t really do that because I don’t know what is meant by components
unless you are referring to the specific rails components themselves.

I do know however (and I had to patch to make this work) that if you run
commands for your ‘rails root’…

rake apidoc
rake appdoc
rake plugindoc

you will get folders in your doc/ directory that will list the various
apis, etc. derived from the appropriate sources which I found to be
marginally helpful but I am still very much newbie myself.

I hope this helps - as you can imagine my eagerness to help the one who
helped me.

Craig


#3

On Sat, 2006-02-25 at 19:34 -0800, Estelle W. wrote:

http://wiki.rubyonrails.com/rails/pages/Plugins, of which I have
installed Globalize and Liquid and they are both contained within the
/vendor/plugin directory of my application.

I think the difference between “plugins” and “components” (p.174 and
p.362 of AWD) is that components are meant to be parts of my
application which may possibly be reused elsewhere, whereas “plugins”
are often developed by a 3rd party and are more generic perhaps…
Also “plugins” have an init.rb file whereas components do not…


afaict there is not set ‘File’ class as part of rails base but can be
added - a quick perusal of rubyforge…

http://rubyforge.org/softwaremap/trove_list.php?form_cat=142

suggests that one of these (Rio?) could probably do what you want.

Thanks for the education…I’ve already figured out plugins and have
been using one for a little over a week now. Components…well I
probably read p.362 at least once but it obviously hasn’t stuck with me
and I am a child of the 60’s which probably explains it.

Craig


#4

Thanks for your help Craig :slight_smile:

Basically, the main thing I want to do, is from within one of my main
controllers I want to find out what files and/or directories exist in
the /components directory.

Perhaps using the File class… but I can’t find any examples on how
to get a list of files within a directory?

By “plugins” I am referring to the things on this page:
http://wiki.rubyonrails.com/rails/pages/Plugins, of which I have
installed Globalize and Liquid and they are both contained within the
/vendor/plugin directory of my application.

I think the difference between “plugins” and “components” (p.174 and
p.362 of AWD) is that components are meant to be parts of my
application which may possibly be reused elsewhere, whereas “plugins”
are often developed by a 3rd party and are more generic perhaps…
Also “plugins” have an init.rb file whereas components do not…

Regards,
Estelle.


#5

You might find this useful:

http://rails-engines.org/wiki/pages/Components+vs.+Plugins+vs.+Engines

  • james

On 2/26/06, Estelle W. removed_email_address@domain.invalid wrote:

Estelle.
http://lists.rubyonrails.org/mailman/listinfo/rails

  • J *
    ~

#6

There is a File and Dir class as part of the standard ruby library. I
haven’t tried it yet, but it looks like something like this should
work:

Dir.entries("/components") # => returns an array containing the
filenames

Then I should be able to dynamically use the controllers and actions
in the components directory.

Regards,
Estelle.

P.s. I’m only just beginning to grasp components and plugins (at least
I hope so :P). Still totally confused about gems and generators
(http://rails-engines.org/wiki/pages/Engines+vs.+Generators). I think
“engines” are the same as what I’ve been calling “plugins”… but
yeah, still learning the terminology and trying to get a grip on how
everything hangs together.