Thursday, 12 September 2013

Issues with running a bash with an RVM environment

Issues with running a bash with an RVM environment

I am using whiskey_disk in order to handle deployments. This isn't a
whiskey_disk issue, but what it does is run a post deploy script after it
finishes cloning from git into the project destination directory. The
script I'm trying to deploy is to invoke a bundle install and looks a
little something like this:
#!/bin/bash
# Load RVM into a shell session *as a function*
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
source "$HOME/.rvm/scripts/rvm"
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
source "/usr/local/rvm/scripts/rvm"
else
printf "ERROR: An RVM installation was not found.\n"
fi
export
PATH=/home/ec2-user/.rvm/gems/ruby-2.0.0-p247/bin:/home/ec2-user/.rvm/gems/ruby-2.0.0-p247@global/bin:/home/ec2-user/.rvm/rubies/ruby-2.0.0-p247/bin:/home/ec2-user/.rvm/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/aws/bin:/home/ec2-user/bin
echo "["`hostname`"] Installing the bundle..."
bundle install --binstubs --local --path ../shared/bundle --deployment
--without development test console replication|grep -vi using
That fails, and is not able to find bundle or rake, even though it's
clearly setup in my $PATH above:
/home/ec2-user/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:296:in
`to_specs': Could not find 'bundler' (>= 0) among 90 total gem(s)
(Gem::LoadError)
from
/home/ec2-user/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:307:in
`to_spec'
from
/home/ec2-user/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in
`gem'
from /home/ec2-user/.rvm/gems/ruby-2.0.0-p247@global/bin/bundle:22:in
`<main>'
from
/home/ec2-user/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in
`eval'
from
/home/ec2-user/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in
`<main>'
/home/ec2-user/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:296:in
`to_specs': Could not find 'rake' (>= 0) among 90 total gem(s)
(Gem::LoadError)
from
/home/ec2-user/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:307:in
`to_spec'
from
/home/ec2-user/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in
`gem'
from /home/ec2-user/.rvm/gems/ruby-2.0.0-p247@global/bin/rake:22:in
`<main>'
from
/home/ec2-user/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in
`eval'
from
/home/ec2-user/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in
`<main>'
Thought I initialized the environment above fine in the beginning of the
script and by additionally setting my PATH which you could see is seen
fine with an interactive shell:
[ec2-user@ip-1 ~]$ which bundle
~/.rvm/gems/ruby-2.0.0-p247@global/bin/bundle
[ec2-user@ip-1 ~]$ which rake
~/.rvm/gems/ruby-2.0.0-p247@global/bin/rake
Any suggestions on what else could be the issue?

No comments:

Post a Comment