Open new tab reset gemset by rvm

When I open the terminal, then go into the rails application, rvm will load the gemset into the .ruby-gemset as follows:

 > cd my_application/ > rvm gemset list 

The output is as follows:

 gemsets for ruby-2.2.2 (found in /home/yakout/.rvm/gems/ruby-2.2.2) (default) => my_gemset global 

Then I open a new tab in the terminal and run the rvm gemset list , the output will be:

 gemsets for ruby-2.2.1 (found in /home/yakout/.rvm/gems/ruby-2.2.1) => (default) global 

I put the following line in the .profile file:

 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* 

And I put the following lines in the .bash_profile file:

 [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* 

And I put the following line in the .bashrc :

 PATH=$PATH:$HOME/.rvm/bin 

And I changed the settings of my terminal: Edit β†’ Preferences β†’ Title and Command tab β†’ Run command as a login shell .

How can I make rvm load the current gemset when opening a new tab in the terminal?

+5
source share
3 answers

You can do this by simply adding two files to the application directory. with the following name:

.ruby-gemset

.ruby version

Inside .ruby-gemset just provide the name of your gemset

Inside the .ruby version just specify your ruby ​​version

+2
source

There is a workaround to get the correct gemset when opening a new tab. Add this line at the end of your ~ / .profile

 cd . 

I got this from https://github.com/rvm/rvm/issues/2527

+1
source

So, do you want this to be your default, even if you are not in the application? I would use:

  rvm --default use 2.2.2@my _gemset 
0
source

Source: https://habr.com/ru/post/1233050/


All Articles