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?
From the main menu, select Tools | Gem | Push Gem. In the Run tool window, specify your RubyGems credentials. Your gem will be published to RubyGems.org.
Use $ gem list | grep YOURGEM to check if the YOURGEM is present.
Open up the 'Software Center' app from your launcher and type in `RubyGems` without quotes into the application search box at the top right, and press [enter]. RubyGems then can be installed by just clicking on the button labeled 'Install', thats it.
RubyGems is a package manager for the Ruby programming language that provides a standard format for distributing Ruby programs and libraries (in a self-contained format called a "gem"), a tool designed to easily manage the installation of gems, and a server for distributing them.
To remove the https sources:
gem sources -r https://rubygems.org/
If you put the following in ~/.gemrc it will pick it up in gem env
---
:backtrace: false
:bulk_threshold: 1000
:sources: ["http://rubygems.org"]
:update_sources: true
:verbose: true
gem env snippet:
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["http://rubygems.org"]
- REMOTE SOURCES:
- http://rubygems.org
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With