gems are ruby source code management tool, code in accordance with a certain directory structure was organized into a lib.
For instance: rake, rails, rcov have gem version.
Installation of a rake gem only implementation required gem install rake. Rake download the source code has been down after being placed in a specific location. Can also download rake.gem through the implementation of gem install rake.gem to manually install.
Then how to use it?
require 'rubygems'
require 'rake'
Should do it.
Previous article I said that ruby's LOAD_PATH, rubygems position at a time when it is installed has been added to the LOAD_PATH years, and at require 'rubygems' time, rake gem below also add lib path to LOADPATH Lane.
* rake gem install at the command line then you can use it?
No!
gem contains only the original ruby code base, in order to require the use must be cited.
If the command line to run the rake, the rake must install the command-line tool, like apt-get install rake.
* rails can use gems
Two kinds of ways:
1. Direct reference to the gem library system
2. Put gem bound to rails, the gemsonrails this through command-line tool
Directly to the gem is actually a folder copy to the rails / vendor / gems under the
How to freeze rails to rails peoject
rake rails: freeze: gems (from rails app root)
rake rails: unfreeze
Rake in the rails app paper cites the system's rake, and then rake the system to quote the system for each gem of the rake file.
* rails of the plugin can script / plugin command to install
plugin can call the procedure gem lies in how to write plugin procedures.
* rake and plugin the relationship between
rails in the Rake file reference config / boot, almost all of the rails quoted Runtime Environment things
* rails of gems only running rails at a time when, by the introduction of enviroment.rb.
rake not automatically the introduction of the code and the path gems. If you want to use the words, one needs to require 'vendor / gems / lib / xxx'.
gem can be freeze to rake in rails app go
Since rake automatically invoke plugin, so first installed the plugin a gems
1.script/plugin install http://svn.ardes.com/rails_plugins/gems
And then
2.rake gems: freeze GEM = gem_name
* rcov for rails plugin specific job not a matter of fact, it is the call system command-line tool rcov.
Rcov must be installed so the command-line tool, apt-get install rcov
Rails rcov plugin why rcov does not contain all the functions?
Since rcov and systems related to the installation at the time required to compile, which is the same as OCI8.








Responses to “ruby, ruby gems, gemsonrails, rails plugin the relationship between”