Rake gems:build when deploying code that requires native gems

Hi,

I’ve vendored my gems using rake gems:unpack:dependencies and can rake
gems:build on my development machine to take care of the gems
(rdiscount, nokogiri) with native code.

When it comes to production deployment is it expected that I should
run rake gems:build as a part of each (capistrano) deployment?

Is there a way to avoid that?

Thanks,

-Tim

On Tue, Oct 20, 2009 at 12:58, Tim H. [email protected]
wrote:

Is there a way to avoid that?

Thanks,

-Tim

Dunno about avoiding it (without just installing the gems on the
server, and de-vendoring them), but you can trivially automate it.

In your deploy.rb:

task :after_update_code, :roles => :app do

Rebuild the gem native extensions, unless we explicitly say not to.

unless ENV[‘BUILD_GEMS’] and ENV[‘BUILD_GEMS’] == ‘0’
run “rake -f #{release_path}/Rakefile gems:build”
end
end

-Jacob

Thanks Jacob,
can you explain what’s going on with the BUILD_GEMS environment
variable?

Is that set somewhere already or is that there so I can call:

BUILD_GEMS=0 cap deploy

to avoid building the gems?

-Tim

On Tue, Oct 20, 2009 at 15:07, Tim H. [email protected]
wrote:

Thanks Jacob,
can you explain what’s going on with the BUILD_GEMS environment variable?
Is that set somewhere already or is that there so I can call:
BUILD_GEMS=0 cap deploy
to avoid building the gems?
-Tim

Option B.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs