How to inline specify gem version in the shell
The problem:
I’ve multiple versions of rails gem and I’d like to generate new app but in different version than the default one
> gem list | grep rails
rails (5.2.4, 5.2.3, 4.2.11.1)
Typing just rails new my_app
would generate rails app with version 5.2.4
The solution:
It turns out, that it’s possible to specify gem version like this:
rails _4.2.11.1_ new my_app
It works with bundler, rspec and probably any other gem callable from shell as well
bundle _1.17.2_ install
rspec _3.8.0_
Tested on zsh + asdf
and zsh + rvm