I wanted to install some plugins to Rails, and I was surprised with following errors:
[SOME SITES WITH PLUGINS] (eval):3:in `each': undefined method `[]' for nil:NilClass (NoMethodError) from /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/plugin.rb:658:in `scrape' from /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/plugin.rb:632:in `parse!' from /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/plugin.rb:631:in `parse!' from /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/plugin.rb:447:in `parse!' from /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/plugin.rb:463:in `parse!' from /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/plugin.rb:871 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in `require' from ./script/plugin:3
What the heck? Few days ago in other application, on the same development machine discover was successful.
I’ve jumped into Ruby, and in /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/plugin.rb
I’ve discovered, that without any parameters plugin discover
connects to http://wiki.rubyonrails.org/rails/pages/Plugins and fetches list of servers with plugins. Now, this error become looking more reasonable – it looked like script got wrong input data (something empty after parsed wiki page), and throws exceptions.
Since RoR wiki is sometimes attacked with spamers, I noticed on Plugins page last modified by: Anonymous Coward. I went Back In Time and gave this link as an argument for plugin
script and it worked:
/script/plugin discover http://wiki.rubyonrails.com/rails/pages/Plugins/versions/558
As You can see, in my case rigth page version has number 558. Probably every time (ohh there can be plenty other errors preventing script to be successful) this command will succeed, but remember, version 558 has some plugin list, and newer versions of this page will have more plugins. So remember about this, when You copy&paste this link.
Nice detective work! Thanks a ton – ran into the same problem today and your fix was exactly what I needed.
Yes – good work. your fix worked for me as well.