Reputation: 1762
Rails n00b here - need some assistance. I am trying to port a Rails3 app from Linux to Windows. My Gemfile looks as follows:
source 'http://rubygems.org'
gem 'rails', '3.0.0'
gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'
gem 'ruby-oci8', '1.0.6'
I do not have an Oracle client on this Windows machine, so I will not be able to natively compile a ruby-oci8 gem.
I have commented out the 'ruby-oci8' line in my Gemfile and I installed the gem manually from here: http://rubygems.org/downloads/ruby-oci8-1.0.6-x86-mswin32-60.gem. I have also copied the necessary DLLs into ruby\bin
.
I have verified that it works:
ruby -rubygems -e "require 'oci8'; OCI8.new('user','password','pasdev:2700/gen11dvu').exec('select * from ARCS_USER_LO
GON') do |r| puts r.join(','); end"
This returns lots of data from my db, so I know it works.
However, if I try to require 'oci8'
from a rails console (or from the running app), I get the following:
LoadError: no such file to load -- oci8
I presume this happens b/c Rails only loads the gems specified in the Gemfile, but I cannot figure out how to specify it! I already have the gem I need installed:
C:\javadev\ashbtw3>gem list
*** LOCAL GEMS ***
activerecord (3.0.0)
bundler (1.0.21, 1.0.0)
rails (3.0.0)
rake (0.8.7)
ruby-oci8 (1.0.6 x86-mswin32-60)
...etc...
Yet if I uncomment this line in the Gemfile:
gem 'ruby-oci8', '1.0.6'
bundler tries to download and compile another 1.0.6, which of course fails. I have also tried all of these variations unsuccessfully:
gem 'ruby-oci8', '1.0.6', :platforms => :mingw
gem 'ruby-oci8', '1.0.6-x86-mswin32-60', :platforms => :mingw32
gem 'ruby-oci8-1.0.6-x86-mswin32-60'
gem 'ruby-oci8', '1.0.6-x86-mswin32-60'
Why is bundler trying to install a gem that I already have? How do I properly specify the version and platform to make Bundler see that this gem is already installed, and just include it in Gemfile.lock? Is there some other solution here that I can use w/o installing an Oracle client?
EDIT 1:
As per Kyle's suggestion, I tried the following:
gem 'ruby-oci8', :path => 'C:/Ruby187/lib/ruby/gems/1.8/gems/ruby-oci8-1.0.6-x86-mswin32-60
This made Bundler run successfully!
Using ruby-oci8 (1.0.6) from source at C:/Ruby187/lib/ruby/gems/1.8/gems/ruby-oci8-1.0.6-x86-mswin32-60
However, trying to require 'oci8' from the Rails console now gives me this:
C:\javadev\ashbtw3>ruby script\rails console
Loading development environment (Rails 3.0.0)
irb(main):001:0> require 'oci8'
LoadError: no such file to load -- oci8lib
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `load_dependency'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:591:in `new_constants_in'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `load_dependency'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
from C:/Ruby187/lib/ruby/gems/1.8/gems/ruby-oci8-1.0.6-x86-mswin32-60/lib/oci8.rb:20
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
The file it's missing is in under ext/oci8
in the installed gem directory, yet it does not see it.
Is there something additional I can do?
Upvotes: 3
Views: 3119
Reputation: 22258
Have you tried specifying the :path
?
gem 'ruby-oci8', :path => '/path/to/ruby-oci8-1.0.6-x86-mswin32-60'
Upvotes: 2