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
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
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.
My solution is:
serverA: $ gem list | tr -s ',[ ()]' ' ' | awk '$2 ~ /[0-9]\.[0-9]/ {print $1" -v "$2; next} $3 ~ /[0-9]\.[0-9]/ {print $1" -v "$3}' > reqs.txt
serverB: $ cat reqs.txt | while read l; do echo "=== Installing 'gem install $l' ==="; gem install $l --conservative || exit 1; done
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).