Reputation: 6404
I have a Rails app deployed to Ubuntu with RVM via Capistrano3.
I am trying to use Eye gem but can not execute it. It is installed via RVM on Ubuntu and I can run it on Ubuntu just fine.
namespace :eye do
desc 'Load Eye'
task :load do
on roles(:app) do
execute "cd #{current_path} && eye load #{current_path}/lib/tasks/conductor.eye"
end
end
end
The error I am getting is :
bash: eye: command not found
cap aborted!
If I do bundle exec I get same error for bundler..
If I run echo $PATH via Capistrano I get:
BUG [f84df590] Command: echo $PATH
DEBUG [f84df590] /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
while $PATH on Ubuntu is :
/home/cmsapplication/.rvm/gems/ruby-2.1.1/bin:/home/cmsapplication/.rvm/gems/ruby-2.1.1@global/bin:/home/cmsapplication/.rvm/rubies/ruby-2.1.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/cmsapplication/.rvm/bin:/home/cmsapplication/.rvm/bin
Capfile:
require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/rails'
require 'capistrano/bundler'
require 'capistrano/rvm'
require 'capistrano/puma'
require "whenever/capistrano"
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
Upvotes: 0
Views: 366
Reputation: 309
Make sure you have the files:
~/.bash_profile
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
source ~/.profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
~/.profile
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
And change the line in your task from
execute "cd #{current_path} && eye load #{current_path}/lib/tasks/conductor.eye"
to
execute "cd #{current_path} && /bin/bash --login -c 'eye load #{current_path}/lib/tasks/conductor.eye'"
Upvotes: 1