Rails: vendor/gems or vendor/plugins?
I'm to tracking dependencies with git-submodules in my rails app. So far I've added submodules for things like, haml, shoulda, and authlogic to 'vendor/plugins'. I've seen indications that I should be usi开发者_如何学JAVAng 'vendor/gems' instead though.
Question: which directory is the appropriate place to put dependencies being tracked as submodules? Is the choice arbitrary?
Thanks
In short, I'd use config.gems for everything except for the exceptions I've noted below.
This is the workflow I'd use:
All plugins/libraries for which gems exist for the version I need, I do
environment.rb
config.gem "plugin_name", :version => ">=1.0.0"
then:
rake gems:unpack:dependencies
All other plugins that I install from source (Github, etc.) I run:
script/plugin install github_url
and the plugin is placed in vendor plugins.
As far as submodules go, I'd only use submodules for plugins/gems that I'm actively developing or for which I plan to use specific commits, rather than the HEAD, and if I plan to change the commit I'm using often.
The short version - if it's a plugin put it into vendor/plugins, if it's a gem it goes to vendor/gems. However, there's no need to track gem dependencies via submodules - Rails config is just good enough for that. So, the usual pattern is this: use config.gem for gem dependencies tracking and git-submodules for plugin dependencies - and plugins always go to vendor/plugins.
精彩评论