Ok, if you have tried to work with the gem command through a proxy, like gem install rails -p http://proxy.ccci.org:8080
you surely incurred in the following error:
ERROR: While executing gem ... (NoMethodError)
undefined method `[]=' for Gem::ConfigFile
The solution is barely to patch the Gem::ConfigFile class adding the following method:
def []=(key, value) @hash[key.to_s]=value end
(I added it at line 72)
The only hard part colud be to locate that class inside the ruby libraries… don’t worry here’s the path:
ruby/site_ruby/1.8/rubygems/config_file.rb
this is (obviously) relative to the ruby folder, on my MacBook it is located in: /opt/local/lib/
Update: Translation in Portuguese
Update/2: Gems Proxy under windows
Thank you, this was very helpful.
Thank you very much.
Thank you, and thanks for the search engine I used, forgot the name.
Thank you, I’ve been searching for hours for exactly this fix.
Any chance of this being better publicised? What’s causing this problem?
[…] (encontrei essa solução aqui: Gems through the proxy (or the «undefined method `[]=’» error) ) […]
Thank you so much !!!!
wtf this is pretty insane. How in the name of god did they manage to NOT fix an error like this? Anyway, thankss a lot for the fix!!
Thanks a ton, this was driving me nuts!
Thanks!!!
Works fine! Thanks!
Thank you, this has helped me twice now! :)
Thanks!
I hope this issue is fixed in 1.8.7. (oneclickinstaller… too lazy :P). Thanks a lot!
Thanks! This helped me quite a bit.
thanks buddy it works but i have started to get another error. Do you have solution for this also !!!
ERROR: While executing gem … (RuntimeError)
Error instaling watir:
watir requires win32-process >= 0.5.5
It seems that you need to install the win32-process gem with a version >= 0.5.5
try “gem list -l” to look at the gem you have already installed on your pc, or retry installing watir with the “–include-dependencies” option
Thanks for this!
Thanks for this.. You rock
Thanks!
Thanks a lot! Can’t understand why this is still not fixed in the mainstream distribution.
Hi, first thanks. Second, when I try to run this command:
gem update –system -p http://myproxy:8080
I get this error:
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:37:in `[]’: wrong number of arguments (1 for 2) (ArgumentError) from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:37:in `do_configuration’
Ideas?
Thanks a lot.
Darryl wrote:
I get this error:
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:37:in `[]‘: wrong number of arguments (1 for 2) (ArgumentError) from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:37:in `do_configuration’
To fix this error don’t move the old lines.
Here are the correct lines in config_file.rb
# The name of the configuration file.
def config_file_name
@config_file_name || Gem.config_file
end
# Return the configuration information for +key+.
def [](key)
@hash[key.to_s]
end
def []=(key, value)
@hash[key.to_s]=value
end
private…
while trying gem update –system -p http://172.17.10.22:8080 am getting the following error..
C:\>gem update –system -p http://172.17.10.22:8080
Updating RubyGems…
ERROR: While executing gem … (Gem::RemoteFetcher::FetchError)
A socket operation was attempted to an unreachable network. – connect(2)(Err
no::ENETUNREACH)
can any one help on this issue..
Thank you. Worked like a charm! :)
Thanks, that works fine !
Thanks, great work. In case anyone needs to know where the default windows (at least XP) location of the ruby file you need to find, it is in C:\ruby\lib\ruby\site_ruby\1.8\rubygems