5

I made similar question for npm here: npm equivalent of `pip install -r requirements.txt`

This is for gem.

What are the gem equivalent of:

pip freeze > requirements.txt
pip install -r requirements.txt
Community
  • 1
  • 1
Ron
  • 6,768
  • 11
  • 37
  • 40

2 Answers2

7

There isn't a direct comparison in Ruby, but we have something very similar. Look at the bundler gem for how to write your list of required gems into a Gemfile and automatically generate a Gemfile.lock which contains the current versions installed.

Bruno Duyé
  • 883
  • 10
  • 13
Spooner
  • 427
  • 7
  • 7
2

My solution is:

serverA: $ gem list | awk -F'[ ()]' '{print $1" -v "$(NF-1)}' > gem_reqs.txt
serverB: $ cat gem_reqs.txt | xargs gem install

My situation was. On server "A" I have 3rd party developed ruby scripts with many dependencies and no Gemfile. I have to use those same ruby scripts on server "B". How can I easily "copy" ruby env with all possibly required gems to server "B" (same versions).

Juraj Michalak
  • 950
  • 9
  • 7