views:

11

answers:

1

Whenever I add a new feature (eg. something I downloaded) I tend to want to put all the files (css, html, js, images) in one place.

Symfony 2.0 will have this new feature they called bundle system. Everything will be in its own folder. This will be great for adding new features so you don't have to mix all css, js, image files with each other. It should be per feature instead.

And also it would be great for deleting features. Then you know that all files are in one place and don't have to look for them throughout your application.

Eg.

Instead of this...

images/
  fader.img
  cart1.img
  cart2.img

javascripts/
  fader.js
  cart.js

stylesheets/
  fader.css
  cart_main.css
  cart_sub.css

...you should have it like this...

venture/
   fader/
     fader.img
     fader.css
     fader.js
   cart/
     cart1.img
     cart2.img
     cart.js
     cart_main.css
     cart_sub.css

Is there a way of doing so in Rails 3?

+1  A: 

Sure, you could just treat them like a plugin - making a set of files into a plugin is very simple, after all - you basically just put them in a folder, in a file structure parallel to the root of your rails app, then put that folder in your vendor/plugins folder.

Here's the guide on it: http://guides.rubyonrails.org/plugins.html

Then, if you want to delete a feature, just destroy it's plugin folder, and you're clean.

jasonpgignac
okay ill have a look at it. someone told me that this was a bad idea, to have 100 - 1000 features all as plugins for an app. does it seem like a good idea or just a cumbersome one?
never_had_a_name
Well... that depends on how you define feature. If you're talking about adding 100-1000 seperate features, like small iterations of the code, you may be thinking of the wrong tool - if this is just code that you are writing in new features, etc, it would be better to just do commits using git or a similar tool. Then, if you keep your commits clean, you can always roll back the changes in a commit, if you wish to remove a feature.
jasonpgignac