# Plugins? Components?

**URL:** <https://www.ruby-forum.com/t/plugins-components/54185>\
**Category:** Rails\
**Created:** [February 26, 2006, 1:01am UTC](https://www.ruby-forum.com/t/plugins-components/54185 "2006-02-26T01:01:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Estelle\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f475e1/32.png) [@Estelle\_W](https://www.ruby-forum.com/u/Estelle_W)\
**Post date:** [February 26, 2006, 1:01am UTC](https://www.ruby-forum.com/t/plugins-components/54185/1 "2006-02-26T01:01:26Z")

</div>

Hi,

Newbie here 🙂

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.

---

<div class="post-metadata">

**Author:** ![Estelle\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f475e1/32.png) [@Estelle\_W](https://www.ruby-forum.com/u/Estelle_W)\
**Post date:** [February 26, 2006, 1:31am UTC](https://www.ruby-forum.com/t/plugins-components/54185/2 "2006-02-26T01:31:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Estelle\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f475e1/32.png) [@Estelle\_W](https://www.ruby-forum.com/u/Estelle_W)\
**Post date:** [February 26, 2006, 5:28am UTC](https://www.ruby-forum.com/t/plugins-components/54185/3 "2006-02-26T05:28:44Z")

</div>

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

> [Peak Obsession](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](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

---

<div class="post-metadata">

**Author:** ![Estelle\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f475e1/32.png) [@Estelle\_W](https://www.ruby-forum.com/u/Estelle_W)\
**Post date:** [February 26, 2006, 4:36am UTC](https://www.ruby-forum.com/t/plugins-components/54185/4 "2006-02-26T04:36:56Z")

</div>

Thanks for your help Craig 🙂

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:  
[Peak Obsession](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.

---

<div class="post-metadata">

**Author:** ![Estelle\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f475e1/32.png) [@Estelle\_W](https://www.ruby-forum.com/u/Estelle_W)\
**Post date:** [February 26, 2006, 8:36am UTC](https://www.ruby-forum.com/t/plugins-components/54185/5 "2006-02-26T08:36:44Z")

</div>

You might find this useful:

[http://rails-engines.org/wiki/pages/Components+vs.+Plugins+vs.+Engines](http://rails-engines.org/wiki/pages/Components+vs.+Plugins+vs.+Engines)

- james

On 2/26/06, Estelle W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Estelle.  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

–

- J \*  
~

---

<div class="post-metadata">

**Author:** ![Estelle\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f475e1/32.png) [@Estelle\_W](https://www.ruby-forum.com/u/Estelle_W)\
**Post date:** [February 26, 2006, 7:27am UTC](https://www.ruby-forum.com/t/plugins-components/54185/6 "2006-02-26T07:27:18Z")

</div>

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](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.
