Upgrading Ruby Gems
Ruby Code
- Gem Update--system
View the Gem version
Ruby Code
- Gem-v
View gem version, Gems installation directory, remote sources, etc.
Ruby Code
- Gem ENV
View the remote sources you have added
Ruby Code
- Gem sources
Add a source
Ruby Code
- Gem sources-a ' htt://rubygems.org '
Install a gem package
Ruby Code
- Gem Install Will_paginate
Specify source Location
Ruby Code
- Gem install will_paginate--source ' http://rubygems.org '
- Gem install will_paginate-s ' http://rubygems.org '
Specify version
Ruby Code
- Gem Install rails-v=2.3.5
View all the gem packages that have been installed
Ruby Code
- Gem List
or gem list-d to view specific information, such as Project Author,homepage, the path installed in the system, and so on, it is recommended to add this parameter ...
View the gem package at the beginning of D
Ruby Code
- Gem List D
See more in more detail
Ruby Code
- Gem List will_paginate-d
Uninstalling the Gem pack
Ruby Code
- Gem Uninstall Rails
Uninstalling the specified version
Ruby Code
- Gem Uninstall rails-v=2.1.0
Find a Gem Package
Ruby Code
- Gem Search will_paginate--both (search contains will_paginate keywords in local and remote sources)
- Gem List-r will_paginate
- Gem LIST-DR will_paginate (I use this)
To view the gem package depends on other gems:
Ruby Code
- Gem Dependency rails-v 2.3.5
- Gem rails-2.3.5
- Actionmailer (= 2.3.5, runtime)
- Actionpack (= 2.3.5, runtime)
- ActiveRecord (= 2.3.5, runtime)
- Activeresource (= 2.3.5, runtime)
- Activesupport (= 2.3.5, runtime)
- Rake (>= 0.8.3, runtime)
View the RDOC Help for the Gem pack
Ruby Code
- Gem Server (then http://localhost:8808 view)
Install on Windows platform
Ruby Code
- Gem install Hpricot--platform=mswin32 # does not specify an error in Windows installation
Do not install RI and RDoc
Ruby Code
- Gem Install Hpricot--no-ri--no-rdoc
For more gem help, you can
Ruby Code
- Gem-h
Common GEM commands in projects
Ruby Code
- RAKE-T Gems:
- (in/usr/local/system/entos/netposa_redmine)
- Rake Gems: Build # Build any native extensions for unpacked gems
- Rake Gems: Build: Force # Force the build of all gems
- Rake Gems: Install # installs all required gems.
- Rake Gems: Refresh_specs # Regenerate gem specifications in correct format.
- Rake Gems: Unpack # unpacks all required gems into vendor/gems.
- Rake Gems: Unpack:d ependencies # unpacks all required gems and their dependencies into vendor/gems.
For example, you configured the paperclip gem in enviroment.rb
Ruby Code
- Config.gem ' paperclip ', ' 2.3.5 '
So
Ruby Code
- Rake Gems: Install
Will install paperclip 2.3.5 into your ruby directory,
Ruby Code
- Rake Gems: Unpack:d ependencies
The dependent gem package will be unpack to the Vendor/gems directory,
If you are directly from the GEM package copy to the Vendor/gems directory, you need to perform
Ruby Code
- Rake Gems: Refresh_specs
To generate the. Specifications file
Ruby Gem Tips (GO)