- I preferred zip file to one-click installer and downloaded ruby-1.8.7 (latest at this time of writing)
- As the zip file won't contain the gem (tool for managing ruby modules, also known as gems), download rubygems-1.3.1 (latest at this time of writing)
- Unzip the ruby distribution zip file to your local directory (say c:\ruby-1.8.7) and add c:\ruby-1.8.7\b
in to your path. You can verify this by typing "ruby -v" at the command prompt. - Unzip the rubygems distribution zip file to a local directory (say c:\rubygems). This will contain a file called setup.rb. Run this file from command prompt as "ruby setup.rb". This would create a batch file called "gem.bat" along with creating other folders, files in your ruby installation folder (c:\ruby-1.8.7\
bin). - Also download zlib and keep the zlib.dll in c:\ruby-1.8.7\b
in as this is required for running gem.bat
Initially there won't be any gems (ruby modules) installed. Type "gem environment" at the command prompt and confirm that all the variables are set correctly. For example, GEM PATHS would be set to c:\ruby-1.8.7\l
After verifying above details type "gem list --remote" to get a list of gems available at rubyforge. If you are behind a proxy, you would get below output instead of a list of gems:
*** REMOTE GEMS ***
ERROR: http://gems.rub
ERROR: While executing gem ... (Gem::RemoteFet
Errno::ECONNREF
To resolve this you need to set an environment property called http_proxy to your proxy host, would do like this on windows "set http_proxy=http
Now lets install a gem called progressbar by executing "gem install progressbar". Ignore the error saying SSLEAY32.dll is required ( no idea what exactly is failing, but gems are getting installed properly). Now let us test this by running the test script test.rb, available as part of progressbar installation. This would be available at c:\ruby-1.8.7\l
test.rb:1:in `require': no such file to load -- progressbar (LoadError)
from test.rb:1
This could be resolved in two ways:
- set an environment variable RUBYOPT as "set RUBYOPT=rubygem
s" - alternately, add "require 'rubygems'" before adding any "require
lines ".
No comments:
Post a Comment