views:

99

answers:

1

Trying to figure out how to install rails plugins manually on windows so I have a few questions.

  1. What does the directory need to be named in vendor/plugins? Is it arbitrary or is it linked to something within the plugin config files or is that what you set in the environment.rb?

  2. Once I've copied the files to the correct directory, do I always need to run something inside like init.rb or is it good to go?

  3. What's the difference between 'require' and 'include'?

Thanks!

+1  A: 
  • What does the directory need to be named in vendor/plugins? Is it arbitrary or is it linked to something within the plugin config files or is that what you set in the environment.rb?

Depends on your definition of "need". In theory the plugin directories could be called plugin1, plugin2, plugin3 etc. But for the sake of your own sanity, it is better that they are named after the plugin they host, so the will_paginate plugin should be inside the vendor/plugins/will_paginate directory and so on.

If they are hosted on github, the folders will be called the same way as the github project.

Normally all plugins will have a init.rb file on their "root folder" : vendor/plugins/will_paginate/init.rb. That's how you can know that you put the right files on the right path. They also usually (not allways) have a lib directory inside them: vendor/plugins/will_paginate/lib/*

  • Once I've copied the files to the correct directory, do I always need to run something inside like init.rb or is it good to go?

You don't need to run init.rb yourself, but it neither exactly "good to go": You have to re-start the web server. When initializing, rails goes through the vendor/plugins/* directories, calling the init.rb files itself.

  • What's the difference between 'require' and 'include'?

That's a completely different question. Besides, it is already answered on StackOverflow. So I hope you don't mind if I point you to the already existing question & its answers.

  • I'm just looking for strategies in general for installing plugins manually without using script/plugin install

The simplest way is actually installing git on windows. This can be done with msysgit.

Then your script/plugin install will probably work. If it doesn't you can install the plugin yourself using git clone. Here's an example with a random github plugin:

cd vendor/plugins
git clone git://github.com/mbleigh/acts-as-taggable-on.git

This will create the plugin folder just like script/plugin install would. Just don't forget to cd to the vendor/plugins folder first.

If you can't/don't want to use git, then github has a 'download as a zip' link on the top of each project. I guess you can download the plugins as zips and them uncompress them on the right places.

I hope this helps.

egarcia
Awesome. Thank you very much :)
Kevin