ruby, ruby gems, gemsonrails, rails plugin the relationship between
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.
Related Posts of ruby, ruby gems, gemsonrails, rails plugin the relationship between
-
Struts2 Spring Hibernate's easy to integrate
1. Add Spring 2.0 in Libraries Choose the following four jar, and configure the / WEB-INF/lib under Spring2.0 AOP Libraries Spring2.0 Core Libraries Spring2.0 Persistence Core Libraries Spring2.0 WEb Libraries At the same time, the applicationContext ...
-
How the primary key agent-hibernate
Existing Table A, B Statement: A, B field id-based keys. A: [id, name] B: [id, Aid, title] B and A's set up a many-to-one relationship because of A, B two tables are the primary key id field so add B when Hibernate will automatically retrieve id ...
-
Dynamic loading JS script four kinds of methods
To achieve dynamic loading JS script has four kinds of methods: 1, direct document.write <script language="javascript"> document.write ( "<script src='test.js'> <\ / script>"); </ script> 2, dynamic scri
-
Hibernate primary key strategy-sequence
Today, the use of hibernate in the company encountered a troublesome problem, the use of hibernate when the primary key generation strategy set sequence, but always reported in the implementation could not get next sequence value of the error, then o ...
-
Hibernate pessimistic locking mechanism for locking and optimistic locking
hibernate lock mechanism 1. Pessimistic lock It refers to the modification of data by outsiders hold a conservative attitude. The assumption that at any time access to data, may also have another client to access the same data, in order to maintain t ...
-
What is the appfuse
First, Appfuse brief introduction Matt Raible are Appfuse developed a guiding entry-level J2EE framework, how to integrate its popular Spring, Hibernate, ibatis, struts, Xdcolet, junit, etc. give the basic framework of the model, the latest version 1.7 is
-
Nan-Jing 5: When IBatis.Hibernate mixed affairs, pay attention to your SQL
[Problem] Now, in the development of the so-called multi-storey JavaEE applications, data persistence layer is always essential, and "Automatic" of ORM - Hibernate, and "all-manual-type" of SqlMap - IBatis, equivalent data are Per ...
-
hibernate to use the principle of
The use of hibernate, implementation of data persistence. Has the following several processes. One configuration database connection information. Hibernate.config 2 configuration mapping. 3 use: the use of the process are the following steps: 3.1: Ge ...
-
Based on JDBC, JPA Annotation achieve simple CRUD Generic Dao
The origin of ideas are pretty long history of reasons: [Use iBATIS history] The use of iBATIS has been a long time, the system is to use the CRUD template tool to generate the code, although there are tools to generate, but looked at a lot of CRUD the Sq
-
Hibernate's lazy strategy
hibernate Lazy strategy can be used in: <class> tag, it can be true / false Tags can <PROPERTY> values true / false type of necessary tools to enhance <set> <list> can tag values true / false / extra <many-to-one> <on ...












