How to load rvm with correct gemset then execute a rake task

寵の児 提交于 2020-01-05 06:32:11

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!