rvm and bundler - problem with RedCloth gem and rake
I set up a local project to use rvm, with a project-specific gemset, and did "bundle package" to put all my gems into vendor/cache. Then i checked it all into source control.
Now, on the server, i've installed rvm (same ruby - ruby-1.8.7-p302) and made a gemset again. I checked out the project folder, cd'd into it (i'm in the right rvm and gemset at this point). I thought i would be able to do "bundle install" to install from the gems in vendor/cache. But the RedCloth gem is falling over:
Using rake (0.8.7)
Installing RedCloth (4.2.3) with native extensions
/opt/ruby-enterprise-1.8.7-2011.01/lib/ruby/site_ruby/1.8/rubygems/installer.rb:529:in
`build_extensions': ERROR: Failed to build gem native extension.
(Gem::Installer::ExtensionBuildError)
/opt/ruby-enterprise-1.8.7-2011.01/bin/ruby extconf.rb
Gem files will remain installed in
/home/deploy/.rvm/gems/ruby-1.8.7-p302@akrotoski/gems/RedCloth-4.2.3 for inspectio开发者_高级运维n.
Here's what i have for "gem list" so far:
*** LOCAL GEMS ***
bundler (1.0.11)
rake (0.8.7)
RedCloth (4.2.7)
This is odd - even though it's falling over trying to build RedCloth it reckons it's installed.
What's also odd is that the error message refers to the "system" version of ruby, rather than the one for the current rvm. The current rvm is definitely activated:
rvm list
>> rvm rubies
>> => ruby-1.8.7-p302 [ x86_64 ]
which ruby
>> /home/deploy/.rvm/rubies/ruby-1.8.7-p302/bin/ruby
which gem
>> /home/deploy/.rvm/rubies/ruby-1.8.7-p302/bin/gem
I'm pretty confused at this point...One potential issue might be that in my local machine (which is 32 bit) i have the i386 version of ruby-1.8.7-p302, while on my server i have the x86_64 version - could that be causing this problem?
Grateful for any advice - max
step one : vendor everything with bundler
Just in case here's an excellent blog post on how to vendor everything (and that implies excluding the use of gemsets). I'm pointing to this because it seems to me there's a dangerous mixture of bundler & gemset in your environment. If you vendor everything (the safest) no gemset is requirred....
step 2 : include .rvmrc in your project's root.
ok this is explained in the aforementioned blogpost : it'll make sure you're in the same ruby version when you cd in the project (but it seem that's already the case...)
step 3 : run bundle install --deployment
the deployment option means the cached gems will be used automatically. This ensures your production environment reflects perfectly your dev one.
hope it solves the problem...
精彩评论