Why is Ruby 1.9.2 on Windows 7 using a 1.9.1 path for gems? it is using c:/ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/commands.rb
From a little FAQ chapter to the release:
The standard library is installed in /usr/local/lib/ruby/1.9.1
This version number is "library compatibility version". Ruby 1.9.2 is
mostly compatible with the 1.9.2, so its library is installed in the
directory.
Why are we installing Ruby 1.9.2/1.9.3 gems into a 1.9.1 folder?
In Ruby 1.9.0, the C interface was changed from the Ruby 1.8 series.
Gems that compile to native code had to be recompiled.
The interface was again changed in Ruby 1.9.1 and kept the same in Ruby 1.9.2 & 3. This explains the 1.9.1 you are seeing in your path.
The idea is that you can install different versions of Ruby on your system and that gems would be shared within groups having the same C api. So Ruby 1.8.6 and 1.8.7 could share their gems, and so could Ruby 1.9.1, .2 and .3.
It's not necessarily the best idea, though. In any case, most people use rvm
to access different versions of Ruby and rvm
keeps gems separate for each version, irrespective of the C api version.
can't get ruby 1.8.7 to work after installing 1.9.2
While RubyInstaller include RubyGems with the package, Ruby 1.8.x itself does not activate RubyGems by default like 1.9.1 and 1.9.2 do.
You need to require "rubygems"
before doing require to any of the gems you want to load.
Since your script can work on both versions of Ruby, you can do something like this:
require "rubygems" unless defined?(Gem)
Which will enable RubyGems if is not defined (which is under Ruby 1.9.2)
Hope that helps.
Ruby 1.9.1 Load Path Craziness
setting GEM_PATH=/usr/local/lib/ruby/gems/1.9.1
solved the problem. I knew it was something simple. Just aggravates me that it took ALL DAY to figure out!! This is due to never having this issue with 1.8.7 and of course NOT RTFM!!
Trouble with ruby Development Kit
Installing the dev kit in a directory with spaces is a source of trouble.
Don't use C:/Program Files
but another directory, e.g. C:/ProgramFiles
or C:/bin
...
See also
- Issues installing Ruby and Rails and DevKit on windows 7 x64 - fix needed
- Bundle command not found. Bad Interpreter
Error running autotest on Windows 7 with Rails 3, Ruby 1.9.2
Oh, yes! I found the solution! The gems I need in this setup are:
gem 'ZenTest'
gem 'autotest-rails-pure'
The ZenTest
gem generates the correct command line string (which actually just has the "unit_diff -u" behind the pipe, without the path). The autotest-rails-pure
gem finds the correct test set.
rmagick under windows
I installed ImageMagick and RMagick on Windows Vista in a Rails environment this way:
First I downloaded ImageMagick-6.6.7-Q16 from http://www.imagemagick.org/download/binaries/ and installed it in "C:\ImageMagick-6.6.7-Q16" folder.
Then I downloaded RMagick from https://github.com/rmagick/rmagick/zipball/master and extracted it into "C:\RailsInstaller\Ruby1.9.2\lib\ruby\gems\1.9.1\bundler\gems\rmagick-rmagick\" folder (which is my ruby bundler gems folder).
Then I simply called
'gem install rmagick'
from my prompt and it all worked fine.
Now I can call from a Rails app Gemfile
gem "rmagick"
And then 'bundle install' works fine.
PS: please note that I first installed Rails with http://www.railsinstaller.org.
Related Topics
How to Write the JSON Schema If JSON Has Multiple Data Set
Ruby Ternary Operator and Method Call
How to Replace a Pattern in Ruby Array
Continuous Integration for Ruby on Rails
Ruby: Calling Class Method from Instance
What Ruby Knowledge Should I Have
Pg::Error: Error: New Encoding (Utf8) Is Incompatible
How to Output Leading Zeros in Ruby
What Is the Path to Learn Bdd on Ruby on Rails
Resize Existing Images to New Style in Paperclip & Rmagick
Jruby on Rails VS. Ruby on Rails, What's Difference
Count, Size, Length...Too Many Choices in Ruby
How to Install Ruby Gems on MAC
How to Install Nokogiri on MAC Os Sierra 10.12
How to Enable Auto Completion in Ruby's Irb