Hi Adam,

Replies inline:

On 15 June 2013 18:49, Adam Stanton <adamstanton1...@gmail.com> wrote:

> Hi,
>
> I'm seeing issues when I run "cap deploy". When the script reaches the
> stage of running bundle, it reports:
>
> rbenv: bundle: command not found
>
> As you can tell, I'm using rbenv instead of rvm.
>

Good call.


> Here is a link to my deploy.rb:
> https://gist.github.com/stantona/ff10f0beaef4a16e6a83
>
> I'm also using a rbenv recipe to install rbenv, after which it runs "gem
> install bundler": https://gist.github.com/stantona/24f7408f6423c162d7c6
>
> When the above task is run, it reports that bundler gem was installed
> successfully.
>

Have you rehashed the rbenv shims?


> I can confirm that it was installed by ssh into server and running "which
> -a bundle", returning "/home/vagrant/.rbenv/shims/bundle".
>

Unfortunately that doesn't confirm anything, see
https://github.com/sstephenson/rbenv/wiki/Unix-shell-initialization


> Where I am confused is when I run bundle in my home directory, it finds
> the bundler command no problem, since it prints out
> "Bundler::GemfileNotFound".
>

See above


> However, when I run it anywhere outside my home directory (say /mnt), it
> can't find the command and prints out: "rbenv: bundle: command not found".
> The same error that "cap:deploy" is reporting. I am deploying to /mnt (as
> defined in deploy.rb)
>

So a shell initialisation script in your home directory is responsible for
setting up rbenv, and it's not always (by design) running.


> This doesn't make sense to me because I can still do "which -a bundle"
> (inside /mnt), returning "/home/vagrant/.rbenv/shims/bundle".
>

That only works if rbenv has been loaded, and has prepended
/home/vagrant/.rbenv/shims to your $PATH.


> If I run "gem install bundler" from /mnt, the shell can now find the
> command, despite the fact that when I run "which -a bundle", it still
> returns the single "/home/vagrant/.rbenv/shims/bundle". NB when I run "gem
> install bundler" manually I'm able to deploy no problem.
>
> Here is a gist of my gem environment (running "gem env"):
> https://gist.github.com/stantona/1a487d030788f66e28c4
>
> This has really got me stumped, any help would be appreciated.
>

Long story short, you should set the :bundler variable (See the bundler
integration for Capistrano documentation) to the full path to the rbenv
shim. (The rbenv shim itself takes care of loading environmental variables,
and booting rbenv if it's not loaded, etc) you could also modify the cap
variable:default_env to set the PATH.


> Thanks.
>
>
>  --
> --
> * You received this message because you are subscribed to the Google
> Groups "Capistrano" group.
> * To post to this group, send email to capistrano@googlegroups.com
> * To unsubscribe from this group, send email to
> capistrano+unsubscr...@googlegroups.com For more options, visit this
> group at http://groups.google.com/group/capistrano?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Capistrano" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to capistrano+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
* You received this message because you are subscribed to the Google Groups 
"Capistrano" group.
* To post to this group, send email to capistrano@googlegroups.com
* To unsubscribe from this group, send email to 
capistrano+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/capistrano?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to capistrano+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to