Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the syntax for `gem install` multiple gems, specifying versions for each one?

Tags:

ruby

rubygems

How can I use gem install to install multiple gems at the same time, while also specifying the versions I want?

Example:

gem install akami -v  1.2.0 --ignore-dependencies
gem install atomic -v  1.1.14 --ignore-dependencies
gem install aws-s3 -v 0.6.2 --ignore-dependencies
gem install backports -v  3.3.0 --ignore-dependencies
gem install brendanlim-sms-fu -v 1.0.0 --ignore-dependencies
gem install builder -v  3.1.3 --ignore-dependencies
gem install capistrano -v  2.9.0 --ignore-dependencies

How could I instruct gem install to execute that in one line?


The accepted answer do answer the question. But the final approach I took was to use bundler 1.0.22, which is compatible with ruby 1.8.6.

like image 421
Nerian Avatar asked Apr 22 '14 08:04

Nerian


People also ask

How do I specify a gem version?

There are several ways to specify gem versions: Use a specific version: gem "name-of-gem", "1.0" . You can find specific versions on Rubygems.org (provided that's the source you”re using) by searching for your gem and looking at the “Versions” listed. Use a version operator: gem "name-of-gem", ">1.0" .

What is gem install command?

The install command installs local or remote gem into a gem repository. For gems with executables ruby installs a wrapper file into the executable directory by default. This can be overridden with the –no-wrappers option.

Why bundle install is installing gems in vendor bundle?

In deployment, isolation is a more important default. In addition, the user deploying the application may not have permission to install gems to the system, or the web server may not have permission to read them. As a result, bundle install --deployment installs gems to the vendor/bundle directory in the application.

How do I get a list of installed gems?

Listing Installed Gems The list command shows your locally installed gems: $ gem list *** LOCAL GEMS *** abbrev (default: 0.1. 0) awesome_print (1.9. 2) base64 (default: 0.1.


1 Answers

Since Rubygems 2.0 you can specify a version for multiple package installations like this:

$ gem install akami:1.2.0 atomic:1.1.14 aws-s3:0.6.2 backports:3.3.0 \
brendanlim-sms-fu:1.0.0 builder:3.1.3 capistrano:2.9.0 \
--ignore-dependencies
like image 121
toro2k Avatar answered Oct 19 '22 09:10

toro2k