Issue
I consistently run the ruby sudo gem install mygem
command with these two options on my production system:
sudo gem install mygem --no-ri --no-rdoc
I do that to save a little on space and on how long it takes to setup the documentation. Is there a way (other than hardcoding them into the bin/gem file) to say ‘always run this command with these options’?
I figure someone might have a neat little one liner to insert this into the appropriate file with unix/linux somehow…
Solution
In your home directory there should be a .bashrc file or something similar that gets sourced at each bash session.
Put this in there at the end.
function gemi {
sudo gem install $1 --no-ri --no-rdoc
}
This is simple but you’d be calling the function “gemi” rather than the sudo gem command.
You’d call it like
gemi mygem
Intercepting those commands and replacing them with a wrapper function is a little complicated as far as passing arguments and such.
I am unfamiliar with ruby and the gem command but you may want to look at the man page
man gem
And see if there are environment variables for doing such things like how the Linux/Unix command grep uses GREP_OPTIONS environment variable.
Answered By – eric.frederich
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0