Available Globally Gemfile

I have many gems that I use in all Rails projects, but which are not part of Gems projects, such as powder for managing POW.

It would be wise for me to manage them using the global Gemfile, but I don't see any examples of this.

How do I manage global gems that I donโ€™t need in my gemfiles projects? It would be nice to have a single installation point when I was setting up a new machine, etc.

I use chruby along with ruby-install to manage my versions of Ruby.

+6
source share
3 answers

Create a Gemfile as usual and put it in any folder. It should not be a project folder. Then you can simply do:

bundle install --system 

This will install gems in the Gemfile throughout the system and ask for the root password if you do not have access to the system folder.

- system : Installs gems in the kit into the location of the system. This overrides any previous use of -path.

You can also name your Gemfile (s) if you want to arrange them in some way, then do:

 bundle install --system --gemfile Gemfile_name 
+9
source

As a complement to @Casper's answer:

I created a directory for my Gem system files.

Then I added a directory for each version of ruby. I wanted to install system gems. I added a Gemfile to every directory and .ruby version file with the correct version. Now I can install the system stones for the ruby โ€‹โ€‹version using:

 $ cd path/to/system_gems_dir/1.9.3-p484 $ bundle install --system 

or

 $ cd cd path/to/system_gems_dir/2.0.0-p353 $ bundle install --system 
+3
source

You can create a GlobalGemfile (or whatever you name it) and do it.

 bundle install --gemfile GlobalGemfile 

Cool wrong :)

-1
source

Source: https://habr.com/ru/post/959462/


All Articles