In Rails, a standard way to include GEM is config.gem 'name' or gem 'name'; what about standard way to include plugin?
I think I understand it as, if it is Rails 2.x
config.gem 'gem_name' # in config/environment.rb, and then rake gems:install
and in Rails 3.x
gem 'gem_name' # in Gemfile, and then bundle install
these are the two standard ways to add a gem into a Rails project.
Is there a开发者_StackOverflow社区 standard way to add a plugin? It seems that it usually get installed as
script/plugin install _________________.git
and what is the standard way to include it?
(I think the current recommendation is to use gem or bundler, but what if we just need to use plugin in a particular situation?)
After running script/plugin install
, the plugin ends up in vendor/plugins
, the contents of which are included automatically on startup. If that folder is checked into version control, you're good to go.
In Rails 3.x you need to install plugins with rails plugin install
Alternative way is to clone git repo into plugins
directory:
cd vendor/plugins/
git clone http://github.com/__plug_name.git
or add as submodule to application:
git submodule add http://github.com/__plug_name.git vendor/plugins/__plug_name
精彩评论