Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to switch between different version of gem installed?

I have three version of rack installed on local machine (rack (1.4.1, 1.3.6, 1.3.5)). For some gem (such as Cucumber), it requires a lower version of rack to be activated?

I have tried with bundle but there is no good.

When executed, cucumber will still use the activated rack with version 1.4.1 of the system. Bundlespecifies which gem should be installed but doesn't ensure which gem will be activated.

How could I activate certain version of rack?

like image 588
steveyang Avatar asked Mar 14 '12 13:03

steveyang


People also ask

How do I use a specific version of a gem?

You can install a specific gem version with gem install [name] -v [version] and use it as [name] _[version]_ [command] [line] [args] .

How do I switch between rails versions?

To know all rails versions released, you check out on all rails versions. You can also do it with your terminal with the command line gem list rails --remote --all | grep "^rails " . I you want to install rails on another version of ruby, you need to switch version of ruby and re-install version of rails.

How do I install a specific version of a bundler gem?

Install BundlerSelect Tools | Bundler | Install Bundler from the main menu. Press Ctrl twice and execute the gem install bundler command in the invoked popup. Open the RubyMine terminal emulator and execute the gem install bundler command.


2 Answers

You can specify a version in gemfile of your project

gem "rack",  "1.3.5"

Pointed by matt:

To use gem specified in Gemfile:

bundle exec cucumber
like image 90
megas Avatar answered Nov 12 '22 05:11

megas


Use bundler it will manage it for you.

like image 29
iafonov Avatar answered Nov 12 '22 06:11

iafonov