How do you start ruby ​​1.9 without rubygems

I want my application to not be able to use any installed gems. Is there a ruby ​​1.9 launch option or a way to do this programmatically?

+6
source share
2 answers
ruby --disable-gems 

- The command line parameter MRI (1.9). "This prevents gem installation directories from being added to the default boot path." (Ruby Programming Language, p. 391)

Edit 10-25-2012: The Ruby core has the same idea as @rogerdpack in the comments, and adds a more detailed ruby --help parameter ruby --help . Ruby revision!

+10
source

Looking at the rubygems configuration file , I tried to hack gempath or gemhome to see if you can override (instead, just add to) the default values.

If, for example, the gempath installation should be empty or point to /dev/null , it prevents the use of system pearls, then this will be the way to go.

The main advantage of this, as I see it, is that your anti-rubygems configuration file can be passed to ruby ​​1.9 as a launch parameter (therefore not encoded), well documented and verified in your repository.

All this, of course, does not take into account that rubygems is part of the ruby ​​1.9 standard library - so ruby ​​can suffocate and die if he does not have access to his gems, depending on which part of the ruby ​​basic installation Requires gem functionality, YMMV.

+1
source

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


All Articles