ruby plugin discovery goes boom
Sun, Jun 18, 2006I recently ran into a little problem with script/plugin discover. The problem resulted in the following:
This stems from a change in a link name on the rails wiki. Namely the edit link. The plugin discovery code opens that page and scrapes it, evaluating all the lines searching for ones with /plugins/. The wiki page itself happens to be named Plugins, but the edit link refers to /plugins/. The fix I’m using is pretty simple , edit the plugin.rb file and replace(eval):3:ineach': undefined method
[]’ for nil:NilClass (NoMethodError ) from c:/bin/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/plugin. rb:658:inscrape' from c:/bin/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/plugin. rb:632:in
parse!’ from c:/bin/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/plugin. rb:631:inparse!' from c:/bin/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/plugin. rb:447:in
parse!’ from c:/bin/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/plugin. rb:463:inparse!' from c:/bin/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/plugin. rb:872 from c:/bin/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
require’ from c:/bin/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_s upport/dependencies.rb:147:in `require’ from script/plugin:3
if uri =~ /\/plugins\// and uri !~ /\/browser\//
with if uri =~ /\/plugins\// and uri !~ /\/browser\// and uri !~ /\/pages\/plugins\/versions/
. I’ll be checking if this is already done in edge rails, and submitting a patch/bug otherwise.
<update>It’s already fixed in edge rails, though they replace the problem line with
if uri =~ /^\w+:\/\// && uri =~ /\/plugins\// && uri !~ /\/browser\// && uri !~ /^http:\/\/wiki.rubyonrails/ && uri !~ /http:\/\/instiki/
</update>