Jeremy Hinegardner
2007-Jun-20 08:19 UTC
[webgen-users] custom menu plugin not working in 0.4.4
I was pushing out a new version of a site I have that I think was last generated with webgen 0.4.1. Since my gems are updated to 0.4.4 I''m getting this error when running ''webgen''. I''ve reverted back to 0.4.2 and that is the version where this custom vertical menu plugin starts breaking. So I''m not sure what has changed to cause this. I get this error on webgen 0.4.2, and 0.4.4, but not on 0.4.1 when using a custom site plugin. Any hints? proj/keybox/webgen/plugin/jjh-vertical.rb:27:in `load_plugin'': uninitialized constant #<Module:0xb7e52f88>::MenuStyles::DefaultMenuStyle (NameError) from /usr/lib/ruby/gems/1.8/gems/webgen-0.4.2/lib/webgen/plugin.rb:224:in `load_from_file'' from /usr/lib/ruby/gems/1.8/gems/webgen-0.4.2/lib/webgen/plugin.rb:223:in `catch'' from /usr/lib/ruby/gems/1.8/gems/webgen-0.4.2/lib/webgen/plugin.rb:223:in `load_from_file'' from /usr/lib/ruby/gems/1.8/gems/webgen-0.4.2/lib/webgen/plugin.rb:237:in `load_from_block'' from /usr/lib/ruby/gems/1.8/gems/webgen-0.4.2/lib/webgen/plugin.rb:237:in `catch'' from /usr/lib/ruby/gems/1.8/gems/webgen-0.4.2/lib/webgen/plugin.rb:237:in `load_from_block'' from /usr/lib/ruby/gems/1.8/gems/webgen-0.4.2/lib/webgen/plugin.rb:236:in `catch'' from /usr/lib/ruby/gems/1.8/gems/webgen-0.4.2/lib/webgen/plugin.rb:236:in `load_from_block'' ... 11 levels... from /usr/lib/ruby/gems/1.8/gems/webgen-0.4.2/lib/webgen/cli.rb:454:in `cli_main'' from /usr/lib/ruby/gems/1.8/gems/webgen-0.4.2/bin/webgen:4 from /usr/bin/webgen:16:in `load'' from /usr/bin/webgen:16 enjoy, -jeremy -- ======================================================================= Jeremy Hinegardner jeremy at hinegardner.org
Thomas Leitner
2007-Jun-20 09:03 UTC
[webgen-users] custom menu plugin not working in 0.4.4
> I was pushing out a new version of a site I have that I think was last > generated with webgen 0.4.1. Since my gems are updated to 0.4.4 > I''m getting > this error when running ''webgen''. I''ve reverted back to 0.4.2 and > that is the > version where this custom vertical menu plugin starts breaking. So > I''m not > sure what has changed to cause this. I get this error on webgen > 0.4.2, and > 0.4.4, but not on 0.4.1 when using a custom site plugin. > > Any hints? > > proj/keybox/webgen/plugin/jjh-vertical.rb:27:in `load_plugin'': > uninitialized constant #<Module: > 0xb7e52f88>::MenuStyles::DefaultMenuStyle (NameError) > from /usr/lib/ruby/gems/1.8/gems/webgen-0.4.2/lib/webgen/ > plugin.rb:224:in `load_from_file'' > from /usr/lib/ruby/gems/1.8/gems/webgen-0.4.2/lib/webgen/ > plugin.rb:223:in `catch'' > from /usr/lib/ruby/gems/1.8/gems/webgen-0.4.2/lib/webgen/ > plugin.rb:223:in `load_from_file'' > from /usr/lib/ruby/gems/1.8/gems/webgen-0.4.2/lib/webgen/ > plugin.rb:237:in `load_from_block'' > from /usr/lib/ruby/gems/1.8/gems/webgen-0.4.2/lib/webgen/ > plugin.rb:237:in `catch'' > from /usr/lib/ruby/gems/1.8/gems/webgen-0.4.2/lib/webgen/ > plugin.rb:237:in `load_from_block'' > from /usr/lib/ruby/gems/1.8/gems/webgen-0.4.2/lib/webgen/ > plugin.rb:236:in `catch'' > from /usr/lib/ruby/gems/1.8/gems/webgen-0.4.2/lib/webgen/ > plugin.rb:236:in `load_from_block'' > ... 11 levels... > from /usr/lib/ruby/gems/1.8/gems/webgen-0.4.2/lib/webgen/ > cli.rb:454:in `cli_main'' > from /usr/lib/ruby/gems/1.8/gems/webgen-0.4.2/bin/webgen:4 > from /usr/bin/webgen:16:in `load'' > from /usr/bin/webgen:16It may be possible that the plugin system tries to load your plugin before MenuStyle/Default. Did you use the ''load_plugin'' at the top of your plugin file? The following line should be at the top of your plugin: load_plugin ''webgen/plugins/menustyles/default'' If this does not solve the problem, I will investigate further! Best regards, Thomas
Jeremy Hinegardner
2007-Jun-20 15:18 UTC
[webgen-users] custom menu plugin not working in 0.4.4
On Wed, Jun 20, 2007 at 11:03:41AM +0200, Thomas Leitner wrote:> >I was pushing out a new version of a site I have that I think was last > >generated with webgen 0.4.1. Since my gems are updated to 0.4.4 > >I''m getting > >this error when running ''webgen''. I''ve reverted back to 0.4.2 and > >that is the > >version where this custom vertical menu plugin starts breaking. So > >I''m not > >sure what has changed to cause this. I get this error on webgen > >0.4.2, and > >0.4.4, but not on 0.4.1 when using a custom site plugin. > > > >Any hints? > > > >proj/keybox/webgen/plugin/jjh-vertical.rb:27:in `load_plugin'': > >uninitialized constant #<Module: > >0xb7e52f88>::MenuStyles::DefaultMenuStyle (NameError) > > from /usr/lib/ruby/gems/1.8/gems/webgen-0.4.2/lib/webgen/ > >plugin.rb:224:in `load_from_file'' > > from /usr/lib/ruby/gems/1.8/gems/webgen-0.4.2/lib/webgen/ > >plugin.rb:223:in `catch'' > > from /usr/lib/ruby/gems/1.8/gems/webgen-0.4.2/lib/webgen/ > >plugin.rb:223:in `load_from_file'' > > from /usr/lib/ruby/gems/1.8/gems/webgen-0.4.2/lib/webgen/ > >plugin.rb:237:in `load_from_block'' > > from /usr/lib/ruby/gems/1.8/gems/webgen-0.4.2/lib/webgen/ > >plugin.rb:237:in `catch'' > > from /usr/lib/ruby/gems/1.8/gems/webgen-0.4.2/lib/webgen/ > >plugin.rb:237:in `load_from_block'' > > from /usr/lib/ruby/gems/1.8/gems/webgen-0.4.2/lib/webgen/ > >plugin.rb:236:in `catch'' > > from /usr/lib/ruby/gems/1.8/gems/webgen-0.4.2/lib/webgen/ > >plugin.rb:236:in `load_from_block'' > > ... 11 levels... > > from /usr/lib/ruby/gems/1.8/gems/webgen-0.4.2/lib/webgen/ > >cli.rb:454:in `cli_main'' > > from /usr/lib/ruby/gems/1.8/gems/webgen-0.4.2/bin/webgen:4 > > from /usr/bin/webgen:16:in `load'' > > from /usr/bin/webgen:16 > > It may be possible that the plugin system tries to load your plugin > before MenuStyle/Default. Did you use the ''load_plugin'' at the top of > your plugin file? The following line should be at the top of your > plugin: > > load_plugin ''webgen/plugins/menustyles/default'' > > If this does not solve the problem, I will investigate further!Yup, that''s there... here''s the basic layout of the plugin load_plugin ''webgen/plugins/menustyles/default'' module MenuStyles class JJHVerticalMenuStyle < MenuStyles::DefaultMenuStyle infos( ... ) register_handler ''jjh-vertical'' param ... param ... param ... param ... def internal_build_menu(src_node,menu_tree) ... end end thanks for taking a look. enjoy, -jeremy -- ======================================================================= Jeremy Hinegardner jeremy at hinegardner.org
Thomas Leitner
2007-Jun-21 07:04 UTC
[webgen-users] custom menu plugin not working in 0.4.4
On 20.06.2007, at 17:18, Jeremy Hinegardner wrote:>> It may be possible that the plugin system tries to load your plugin >> before MenuStyle/Default. Did you use the ''load_plugin'' at the top of >> your plugin file? The following line should be at the top of your >> plugin: >> >> load_plugin ''webgen/plugins/menustyles/default'' >> >> If this does not solve the problem, I will investigate further! > > Yup, that''s there... here''s the basic layout of the plugin > > load_plugin ''webgen/plugins/menustyles/default'' > > module MenuStyles > > class JJHVerticalMenuStyle < MenuStyles::DefaultMenuStyle > > infos( ... ) > > > register_handler ''jjh-vertical'' > > param ... > param ... > param ... > param ... > > > def internal_build_menu(src_node,menu_tree) > ... > end > > endOkay, I have tried this out and realized that I have seen the problem before: it is the way webgen loads plugins. It loads custom plugins in a slightly different way than plugins shipped with webgen. I didn''t realize this when coding the plugin system. One thing that makes problems is when you define your class inside a module. So if you remove the top level MenuStyles module and declare the JJHVerticalMenuStyle at the top level of the source file, it should work. Another way is to include the top level environment in the module, something like: WEBGEN_ENV=self module MenuStyles include WEBGEN_ENV ... end This behaviour does not occur in the current development version of webgen since their "all plugins are equal". Regards, Thomas
Jeremy Hinegardner
2007-Jun-22 07:08 UTC
[webgen-users] custom menu plugin not working in 0.4.4
On Thu, Jun 21, 2007 at 09:04:40AM +0200, Thomas Leitner wrote:> Okay, I have tried this out and realized that I have seen the problem > before: it is the way webgen loads plugins. It loads custom plugins > in a slightly different way than plugins shipped with webgen. I > didn''t realize this when coding the plugin system. One thing that > makes problems is when you define your class inside a module. So if > you remove the top level MenuStyles module and declare the > JJHVerticalMenuStyle at the top level of the source file, it should > work.Yup, this worked. Thanks!> This behaviour does not occur in the current development version of > webgen since their "all plugins are equal".I''m Looking forward to the new version when it comes along. enjoy, -jeremy -- ======================================================================= Jeremy Hinegardner jeremy at hinegardner.org