问题
Writing a script that cds into another dir, loads the correct rvm rvmrc file, then allows me to execute a rake task.
I have the below script working on my computer, but when others pull it down to their machine they get the following error "Ruby rvmrc is not installed".
Bundler.with_clean_env do
Dir.chdir("../some_dir") do
puts `source ~/.rvm/scripts/rvm && rvm --with-rubies rvmrc exec -- rake some_task`
end
end
I have the most up to date version of rvm (so do they) and I'm on mt.lion
I have tried creating a bash function like so...
function foo {
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" && rvm use @my_gemset
}
Or, replacing this line
rvm --with-rubies rvmrc exec
with things like...
rvm rvmrc load
rvm use <gemset>
rvm env --path -- ree-1.8.7@some_gemset
But none of it has worked. Thanks for the help
回答1:
this should work:
~/.rvm/bin/rvm rvmrc trust ../some_dir
~/.rvm/bin/rvm in ../some_dir do rake some_task
来源:https://stackoverflow.com/questions/12465166/how-to-load-rvm-with-correct-gemset-then-execute-a-rake-task