Hi all,
We use ruby as part of our development team tools for Windows and Mac
machines. This is maintained internally in an SVN repository where the
platform-specific files are interleaved, i.e. the bin/ directory
contains both a Windows ruby.exe and a Mac ruby executable. This
repository is packaged into installers so we can deploy to our dev team
ensuring that everyone has the correct ruby version and gems.
New gems are installed on an administrator's machine and SVN added to
the gems folder (and the corresponding gemspec is added to the
specifications folder). Most of these are platform agnostic but we have
a few that are Windows-only, e.g. qtbindings.
This was working fine until trying to get sqlite3 running on both PC and
Mac. The PC version was installed first
(gems/sqlite3-1.3.6-x86-mingw32) and this worked fine. The mingw32
version is PC only so I installed sqlite3 on an OSX machine which added
the new gem to gems\sqlite3-1.3.6.
This new gem conflicts with the PC version, e.g. attempting to require
via IRB on the Mac:
irb(main):001:0> require 'sqlite3'
LoadError: cannot load such file -- sqlite3/sqlite3_native
from
/Users/aallmont/nm/buildtools/ruby/1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
`require'
from
/Users/aallmont/nm/buildtools/ruby/1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
`require'
This error goes away if I remove the gems/sqlite3-1.3.6-x86-mingw32
folder on the Mac. There is a similar error on the PC which goes away
if I remove the gems/sqlite3-1.3.6-x86 folder, i.e. they are mutually
exclusive.
I would like to only load gems/sqlite3-1.3.6-x86 when running on the Mac
and only load gems/sqlite3-1.3.6-x86-mingw32 when running on the PC. Is
this possible?
Many thanks,
Alex
on 2013-01-03 13:00
on 2013-01-04 04:08
In my config/database.yml I have the following: development: adapter: <%= "jdbc" if defined?(JRUBY_PLATFORM) %>sqlite3 database: db/dtf_development.sqlite3 pool: 5 timeout: 5000 In my spec/spec_helper I have the following (Need to change the YAML engine used under JRuby): # Set the YAML engine for JRuby if RUBY_PLATFORM == "java" ::YAML::ENGINE.yamler = 'psych' end When working with gems (as in writing them) use this in your gemspec for specifying a specific sqlite3 based on the platform: gem.add_dependency "sqlite3" if RUBY_PLATFORM == "ruby" gem.add_dependency "jdbc-sqlite3" if RUBY_PLATFORM == "java" #gem.add_dependency "activerecord-jdbcsqlite3-adapter" if RUBY_PLATFORM == "java" gem.add_dependency "jruby-openssl" if RUBY_PLATFORM == "java" In these instances, I am adapting to change for use with JRuby. Modify as you need for the Windows platform. > > team ensuring that everyone has the correct ruby version and gems. > added the new gem to gems\sqlite3-1.3.6. > `require' > I would like to only load gems/sqlite3-1.3.6-x86 when running on the > Mac and only load gems/sqlite3-1.3.6-x86-mingw32 when running on the > PC. Is this possible? > > Many thanks, > > Alex > -- D. Deryl Downey "The bug which you would fright me with I seek" - William Shakespeare - The Winter's Tale, Act III, Scene II - A court of Justice.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.

