The corporate proxy at my company seems to be interfering with https
connections to rubygems.org (but not http
connections), causing failures when I attempt to install gems from the default gem source, https://rubygems.org. For this reason, I'm attempting to update my gem sources to replace the default source with the unsecured http
version of rubygems.org. (And yes, I'm aware of the security implications of this.)
When I do this manually from the command line everything works fine; I just have to get past a warning message:
$ gem sources --add http://rubygems.org
https://rubygems.org is recommended for security over http://rubygems.org
Do you want to add this insecure source? [yn]
However, there doesn't seem to be a way to bypass this prompt when running this command from an automated script. The gem
command doesn't have a --yes
or --force
option (as far as I'm aware), and attempting to use the yes
utility to get past the prompt just results in the following error message:
$ yes | gem sources --add http://rubygems.org
ERROR: While executing gem ... (Gem::OperationNotSupportedError)
Not connected to a tty and no default specified
How can I get through the warning message to programmatically add http://rubygems.org as a source?