Tim Harding
2009-Oct-20 19:58 UTC
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
Jacob Helwig
2009-Oct-20 21:48 UTC
Re: rake gems:build when deploying code that requires native gems
On Tue, Oct 20, 2009 at 12:58, Tim Harding <tim.harding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > 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 >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
Tim Harding
2009-Oct-20 22:07 UTC
Re: rake gems:build when deploying code that requires native gems
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 10:48 PM, Jacob Helwig <jacob-+YYYIWJ67T87SacDN8F0fl6hYfS7NtTn@public.gmane.org>wrote:> > On Tue, Oct 20, 2009 at 12:58, Tim Harding <tim.harding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > 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 > > > > 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 > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jacob Helwig
2009-Oct-20 22:29 UTC
Re: rake gems:build when deploying code that requires native gems
On Tue, Oct 20, 2009 at 15:07, Tim Harding <tim.harding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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? > -TimOption B.