Wednesday, December 2, 2009

REE playing nice with rake gems:install

Following the advice by Pratik Naik given during his talk at Rails Summit Latin America, I decided to setup Passenger in development mode. While at it why not setup Ruby Enterprise Edition (REE) also? So I did that but rake gems:install (or in my case /opt/ree/bin/rake gems:install would not install the gems in the REE environment.

A bit of source spelunking turned out that Rails doesn't use Rubygems in a very elegant wait to run the rake tasks, mostly forking a new gem process. Even worse, Gem::Dependency simply guesses which gem command to run based on the current platform. I monkey-patched my Rakefile to force it to use REE (it's a project-specific file anyway) and that worked for me. It's not elegant and not portable but it's hard to make a case as to the "right" way of doing it, except for using the loaded Gem class (!!) correctly. If I ever get to doing that I'll submit a patch. For now, you can append this to your Rakefile:


module Rails
class GemDependency < Gem::Dependency
private
def gem_command
'/opt/ree/bin/gem'
# or File.dirname(File.readlink("/proc/#{$$}/exe")) + '/gem'
end
end
end


and simply running sudo /opt/ree/bin/rake gems:install will work as expected.

1 comment:

3om9n6kurn said...

In this format the participant begins with a single 5 card hand and as usual is requested decide out} which playing cards they wish to maintain and which to discard. Those machines are exhausting to seek out|to search out}.Casinos don't wish to put games on the ground that potentially lose cash. Here again, VPFree2can allow you to discover good-paying machines. With that many arms and with a multiplier, the potential is there for big wins. The tradeoff is that losing arms value twice as much cash as usual, and the extra bet turns some winners into total losers. 온라인 카지노 In Double Double Bonus Triple Play, for example, a straight plus two losing arms brings 20 cash in return -- a winner when you're betting 15 cash however a loser when you're betting 30.