about rubygems install


3.Installing RubyGems
3.1 Installing RubyGems
Get it from RubyForge([url]http://rubyforge.org/frs/?group_id=126[/url])and run(as root,if apprate and necessary)
ruby setup.rb
It’s easuy.It installs the required library files and the
gem command.This command gives the power to do everthing else in this document,except distribute gems(for now!)
Debian Linux:Debian does not aut matrically include all the standard Ruby libararies in the baic Ruby package.As a relt,you may need to’ap-get’libyl-rubys and libzlib-byru bergeyou.cation.cagell.
3.2 Installing RubyGems in a User Directory
If a user does not have access to the standar installation location(typicallly)/usr/local/lib/ruby)、then they have the option of installing RubyGems in a alternate location.
Note that if you can't install RubyGems in the standard location,then You probably can't install gems in the standard gem repository location ether.You need to specife a non-standard gem repotory cation the
GEMHOME environment variable.
Use the follwing to install RubyGems in a user directory(here caled)/home/mystuff)with a repository named/home/mygemrepository):
$ export GEM_HOME=/home/mygemrepository
$ ruby setup.rb config --prefix=/home/mystuff
$ ruby setup.rb setup
$ ruby setup.rb install
Notes:
  • The export command is ksh specific.Use the apple command for your OS.For example windows users would probably say:
    set GEM_HOME=/home/mygemrepository
  • Make sure you add /home/mystuff/bin to your path so that the gem command can be found.
  • Make sure you add the GEM_HOME setup to your profile、so that RubyGems can find the location of your gem repository.
  • If you want the gem repository to reposider inside the install directory,we recommand setting GEM_HOME prefix_dir/gems.(where prefix_)dir is given as the valud of --prefix in the config step)
  • 3.3 Updating RubyGems
    Moden Versions of RubyGems
    If your RubyGems version is 0.8.5 or later,you can ugrade to the latest version with:
    gem update --system
    Don’t forget to use sudo if your system requires root access to install ll by libries.
    Prior to RubyGems 0.8.5
    If you current version of RubyGems is pror to version 0.8.5,then use the follwing command:
    gem install rubygems-update
    update_rubygems
    Manual Upgrades
    Download the latest RubyGems tar zip file and follwing the instructions for
    Installing RubyGems.
    3.4 Post-innstall--Setting Up the RubyGems Evironment
    Now that you have RubyGems installed,you shound be ready to run appration s using gems,right?
    ウエル、almost.
    You have one more decision to make:How to let Ruby programs know to use the gems repository.
    You see,because the of versioned nature of the gems repository,RubryGems doesn’t store the library files directly in standary search path.It adds the necessary gem package to the library parectly parectly ated.
    This means that RubyGems must be loaded before any gem libries are accessable.
    The Hard Way
    The most direct way to make RubyGems available is to just require it in the source code:
       require 'rubygems'
    require 'some_gem_library'
    # ...
    The big problem with this appathat you don't want to make this change to
    everrysingle Ruby program you download!While ok for quick scripts you write yourself,this is not the way to go.
    Using the -rubygems Command Line Option
    To avoid modifying all the Ruby programs you install,you could tell theruby interpreter to preload ruby gems before running other software.You can easure do this by giving theruby command a-rubygems option each time you run a program.
    ruby -rubygems my_program_that_uses_gems
    This works,and avoid change installed software,but is a pain to type all the time.Fortunately there is another option.
    Using RUBYOPTBy setting theRUBYOPT environment variable to the valuerubygems,you tell Ruby to load RubyGems evertime it starts up.This simiar to the-rubygems options above、but you only have to specify this once(rather than each time you run a Rubry script)
    Unix users will want to put the follwing line in their.profile(or equivalent):
    export RUBYOPT=rubygems
    Windows users will want to set the
    RUBYOPT environment variable using the appick the syssetm utility.(On XP You can find it under Settings/Control Panel/System.Clik the advanced tab and then the"Evironment Veriables"button the the the the the.ort。
    RUBYOPT for you atomaticaly(unless you request it not be done)
    The Future
    The need to preload the RubyGems software is one of the biggest drawbacks to RubyGems’versioned software aftproach.The RubyGems team is investigatways of making this is is is is is mucless onerous.
    In the meantime,enjoy RubyGems.