> On Sep 12, 2017, at 4:18 PM, Ben Edwards <[email protected]> wrote:
> 
> Thanks.  OK, so if I do rbenv local in my app directory will unicorn use that 
> version to run unicorn when I do 'service unicorn_eventpuddle start '?
> 
> I was using ' ruby server' from bash on my dev box and had the following in 
> my .bashrc so I used rbenv.
> 
> export RBENV_ROOT=/usr/local/rbenv
> export PATH="$RBENV_ROOT/bin:$PATH"
> eval "$(rbenv init -)"
> 
> So do I need to put this in the /etc/init.d/unicorn_appname script as it is 
> run as root (I think).
>  
> 
> Also wondering exactly how .ruby-version works.  I know 'rbenv local 3.2.1' 
> creates it but when I do ruby stuff does it just look in the current 
> directory for the file or does it traverse up the directory tree until it 
> fins one? 

Yes, I believe it works that way. If you have one at the global root, then it 
would be your last resort. Any ruby executable that does not specifically mark 
a particular ruby version using a "shebang" will run the local environment's 
idea of what constitutes ruby. Part of that comes from your path, but rbenv 
also hijacks that by creating shims to particular versions and rotating them in 
based on the lookup of the local version variable. I use rbenv at work, but I 
have much more experience with rvm, and still prefer it. That's a much larger 
hammer, as it hooks all shell commands to use your preferred ruby, and doesn't 
just shim the ruby command itself.

Walter

> 
> On Tuesday, September 12, 2017 at 8:48:52 PM UTC+1, Walter Lee Davis wrote:
> If you are in the directory containing the application, you can use the rbenv 
> local command to get and set the ruby version to use within the app. 
> 
> rbenv local 3.2.1 
> 
> will set the ruby version. It does this by creating or modifying a 
> .ruby-version file in the application root. 
> 
> Walter 
> 
> > On Sep 12, 2017, at 3:25 PM, Ben Edwards <[email protected]> wrote: 
> > 
> > Hi, ive managed to get unicorn/nginx working (using 
> > https://www.digitalocean.com/community/tutorials/how-to-deploy-a-rails-app-with-unicorn-and-nginx-on-ubuntu-14-04)
> >  and i am using rbenv.  The setup used a .rbenv-vars configuration file in 
> > the ruby app directory.   what I cant figure out is how to specify what 
> > version of ruby to tell it to use.  Ime ding this on my dev box, where I 
> > only have one version but when I put it on prod they have several so I need 
> > to specify which to use. 
> > 
> > 
> > -- 
> > You received this message because you are subscribed to the Google Groups 
> > "Ruby on Rails: Talk" group. 
> > To unsubscribe from this group and stop receiving emails from it, send an 
> > email to [email protected]. 
> > To post to this group, send email to [email protected]. 
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/rubyonrails-talk/15d10ba9-f588-43ee-8184-cc27aa39f3f1%40googlegroups.com.
> >  
> > For more options, visit https://groups.google.com/d/optout. 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/rubyonrails-talk/dd3b868e-54bd-4389-ab58-974e8dfe8bcf%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/81FAEE82-5F3C-4CD8-8BCF-0F889839B538%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to