Force ruby to use dbi Gem instead of dbi in site_ruby
Posted
by sutch
on Stack Overflow
See other posts from Stack Overflow
or by sutch
Published on 2010-03-22T18:22:11Z
Indexed on
2010/03/23
0:41 UTC
Read the original article
Hit count: 543
I'm using:
- Windows 7
- Ruby 1.8.6 One-Click Installer
- DBI version 0.4.3 installed using RubyGems
What I see when executing these commands:
C:>ruby -v
ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]
C:>gem -v
1.3.1
C:>ruby -r rubygems -r dbi -e "puts DBI::VERSION"
0.2.2
C:>gem list dbi
*** LOCAL GEMS ***
dbi (0.4.3)
Why do ruby scripts use the DBI installed in site_ruby rather than the DBI installed with RubyGems?
Updated to respond to Luis Lavena's answer...
Here's what happened when I attempted what you suggest:
C:>ruby -r rubygems -e "require 'rubygems'; puts DBI::VERSION"
-e:1: uninitialized constant DBI (NameError)
And when I updated to require DBI:
C:>ruby -r rubygems -e "require 'rubygems' ; require 'dbi' ; puts DBI::VERSION"
0.2.2
Why wouldn't RubyGems override the built-in library?
© Stack Overflow or respective owner