How to force the gem installation command to install only after installation or update

I read the documentation from the rubygems website, but I think the gem install command will always reinstall, recompile everything, even if the same version is already installed ..

how to force the gem installation command to install only if necessary?

+5
source share
3 answers

You can use something external like gembundler to control the installation of gem projects.

If you must use rubygems directly for this, a command like

ruby -e "puts `gem install GEMTOINSTALL` if(`gem list --no-versions | grep GEMTOINSTALL`) == ''"

will do the job.

+1
source

It looks like the flag --conservativewill force the gem command to do what you want.

gem install rake --conservative

From the documentation gem install --help:

- ,

+15

bundle install. gemfile .

Gemfile . -, , , Gemfile, http://rubygems.org. Rubygems, bundler , .

Bundler rubygems.org ( , ), , . gemfile ( ), bundle install gemfile .

- , Bundler . , bundler , Gemfile.lock.

bundle install, bundler ( ) . , gem list. , , . , .

Unix, , . ( sudo), , , .

--deployment, .

--deployment Gemfile.lock, , ( ) , production. bundle check , , Gemfile.lock . , , bundle install, ( ) gemfile.

+1

All Articles