Ruby Gem Tips (GO)

Source: Internet
Author: User
Tags unpack

Upgrading Ruby Gems

Ruby Code
    1. Gem Update--system


View the Gem version

Ruby Code
    1. Gem-v


View gem version, Gems installation directory, remote sources, etc.

Ruby Code
    1. Gem ENV


View the remote sources you have added

Ruby Code
    1. Gem sources


Add a source

Ruby Code
    1. Gem sources-a ' htt://rubygems.org '


Install a gem package

Ruby Code
    1. Gem Install Will_paginate


Specify source Location

Ruby Code
    1. Gem install will_paginate--source ' http://rubygems.org '
    2. Gem install will_paginate-s ' http://rubygems.org '


Specify version

Ruby Code
    1. Gem Install rails-v=2.3.5


View all the gem packages that have been installed

Ruby Code
    1. 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
    1. Gem List D


See more in more detail

Ruby Code
    1. Gem List will_paginate-d


Uninstalling the Gem pack

Ruby Code
    1. Gem Uninstall Rails


Uninstalling the specified version

Ruby Code
    1. Gem Uninstall rails-v=2.1.0


Find a Gem Package

Ruby Code
    1. Gem Search will_paginate--both (search contains will_paginate keywords in local and remote sources)
    2. Gem List-r will_paginate
    3. Gem LIST-DR will_paginate (I use this)


To view the gem package depends on other gems:

Ruby Code
    1. Gem Dependency rails-v 2.3.5
    2. Gem rails-2.3.5
    3. Actionmailer (= 2.3.5, runtime)
    4. Actionpack (= 2.3.5, runtime)
    5. ActiveRecord (= 2.3.5, runtime)
    6. Activeresource (= 2.3.5, runtime)
    7. Activesupport (= 2.3.5, runtime)
    8. Rake (>= 0.8.3, runtime)


View the RDOC Help for the Gem pack

Ruby Code
    1. Gem Server (then http://localhost:8808 view)


Install on Windows platform

Ruby Code
    1. Gem install Hpricot--platform=mswin32 # does not specify an error in Windows installation


Do not install RI and RDoc

Ruby Code
    1. Gem Install Hpricot--no-ri--no-rdoc


For more gem help, you can

Ruby Code
    1. Gem-h



Common GEM commands in projects

Ruby Code
  1. RAKE-T Gems:
  2. (in/usr/local/system/entos/netposa_redmine)
  3. Rake Gems: Build # Build any native extensions for unpacked gems
  4. Rake Gems: Build: Force # Force the build of all gems
  5. Rake Gems: Install # installs all required gems.
  6. Rake Gems: Refresh_specs # Regenerate gem specifications in correct format.
  7. Rake Gems: Unpack # unpacks all required gems into vendor/gems.
  8. 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
    1. Config.gem ' paperclip ', ' 2.3.5 '


So

Ruby Code
    1. Rake Gems: Install


Will install paperclip 2.3.5 into your ruby directory,

Ruby Code
    1. 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
    1. Rake Gems: Refresh_specs


To generate the. Specifications file

Ruby Gem Tips (GO)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.