すがブロ

sugamasaoのhatenablogだよ

rubygems がぶっ壊れた

いまいち心当たりないんですけど

今日書いたスクリプトを gem 化して、github に上げようと思っていたのね。
んで、大分スクリプトが動くようになったし、gemspec ファイルもほぼできた。

だが、しかし

ふと気がつくと、gemspec ファイルの内容云々ではなく、rubygems がエラーを吐くようになっていた!/(^o^)\
なんかもう、rubygems を通ってライブラリを探しに行く所で死んでるっぽい。

gem install ./hogehoge
gem uninstall hogehoge

の繰り返しはしたものの、特に rubygems 自体をいじくるようなことはしていなかったのが。。。
問題を切り分けるため、全然関係ない haml を reuire してためしてみる。

irb(main):003:0> require 'rubygems'
irb(main):004:0> require 'haml'
TypeError: can't convert String into Array
        from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/gem_path_searcher.rb:87:in `<=>'
        from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/gem_path_searcher.rb:87:in `init_gemspecs'
        from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/gem_path_searcher.rb:86:in `sort'
        from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/gem_path_searcher.rb:86:in `init_gemspecs'
        from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/gem_path_searcher.rb:21:in `initialize'
        from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems.rb:684:in `new'
        from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems.rb:684:in `searcher'
        from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems.rb:683:in `synchronize'
        from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems.rb:683:in `searcher'
        from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:34:in `require'
        from (irb):4
        from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems.rb:342

なんすか。なんなんすかこれ。
rubygems のスクリプト辺りに何か問題が発生してしまったかもしれないので、臭い物には蓋をする精神に乗っ取り、update_rubygems でアップグレードすることで、解消しようと試みた。
ソースにゴミが入ろうが、upgrade されればソースも上書きされるだろうと思っての事だ*1
・・・が、update_rubygems を実行している最中も上記と同じエラーで死亡/(^o^)\
port で再インストールしても同様/(^o^)\

手の打ちようが無い・・・!

今うかつにも port の update をしているので、それが終わったら rubygems 1.3.4 を直接インストールしなおす、という手順を取るつもり。これでできなければガチで rubygems 終了のお知らせである。というか、どうしたらいいんですかね\(^o^)/

おわた\(^o^)/

ports でインストールした ruby を使ってインストールしているにも関わらず、同じ症状だ。何これ、どうしたらいいの!!!

sugamasao% where ruby
/opt/local/bin/ruby
/usr/bin/ruby
sugamasao% where gem
/usr/bin/gem
sugamasao% sudo ruby setup.rb
./lib/rubygems/gem_path_searcher.rb:87:in `<=>': can't convert String into Array (TypeError)
        from ./lib/rubygems/gem_path_searcher.rb:87:in `init_gemspecs'
        from ./lib/rubygems/gem_path_searcher.rb:86:in `sort'
        from ./lib/rubygems/gem_path_searcher.rb:86:in `init_gemspecs'
        from ./lib/rubygems/gem_path_searcher.rb:19:in `initialize'
        from ./lib/rubygems.rb:888:in `new'
        from ./lib/rubygems.rb:888:in `searcher'
        from ./lib/rubygems.rb:887:in `synchronize'
        from ./lib/rubygems.rb:887:in `searcher'
        from ./lib/rubygems.rb:527:in `find_files'
        from ./lib/rubygems.rb:1131
        from setup.rb:24:in `require'
        from setup.rb:24

追記(2009/6/23)

なんかよくわからんけど、再度 setup.rb を実行したらなんとかなった。
なんだったんだろう。なんかキャッシュとかがおかしくなっていたのかな・・・><

*1:当時使っていたのは 1.3.1 で、現在の最新は 1.3.4