简体   繁体   中英

RVM switching to @global gemset instead of a specific one

When I enter my rails dir on server RVM switch to

/home/capistrano/.rvm/gems/ruby-1.9.2-p290@global/bin/bundle

although it should use ruby-1.9.2-p290@mygemset/bin/bundle as it works on my local machine. When I type rvm use 1.9.2@mygemset it works. Nginx server is also looking for gems in the @global gemset

my .rvmrc file:

environment_id="ruby-1.9.2-p290@mygemset"

if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
  && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
then
  \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"

  if [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]]
  then
    . "${rvm_path:-$HOME/.rvm}/hooks/after_use"
  fi
else
  # If the environment file has not yet been created, use the RVM CLI to select.
  if ! rvm --create use  "$environment_id"
  then
    echo "Failed to create RVM environment '${environment_id}'."
    return 1
  fi
fi

RVM is going through rapid develpment so the syntax and functionality of commands sometimes vary. Anyway, I solved it with upgrading to stable RVM:

rvm get stable

which is now rvm 1.14.1 (stable) . Afterwards commands like rvm 1.9.3-p194@mygemset --create works perfectly.

Another thing I was missing is the new syntax for executing commands:

rvm @mygemset do bundle install

This will install all gems for given gemset and ruby specified in .rvmrc file

I'm not sure if I understood you but you could place an .rvmc file in your rails folder and put something like this in it.

rvm use ruby-1.9.2@mygemset

Whenever you cd into that directory rvm will use settings from the .rvmc file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM