Class Object
In: lib/webgen/gui/main.rb
lib/webgen/plugin.rb
Parent: Object
RuntimeError PluginParamNotFound PluginNotFound ConfigurationFileInvalid CmdParse::CommandParser CommandParser Test::Unit::TestCase TestCase PluginTestCase DirectoryInfo GalleryStyle WebSiteStyle WebSiteTemplate SipttraStyle TagTestCase CmdParse::Command ShowCommand CheckCommand UseCommand CreateCommand TSort DependencyHash Hash Comparable Language ::Logger Logger Logger DEFAULT_WRAPPER_MODULE WebSite Qt::MainWindow MainWindow Qt::Dialog NewWebsiteDialog Qt::TextEdit LogWidget ::Rake::TaskLib WebgenTask ConfigurationFile Website PluginManager PluginLoader PluginParamValueNotFound Dummy Color CliUtils PluginDefs OpenStruct HandlerPlugin Plugin CommandPlugin lib/webgen/languages.rb lib/webgen/website.rb lib/webgen/gui/common.rb lib/webgen/plugin.rb lib/webgen/test.rb lib/webgen/cli.rb ClassMethods PluginDefs LanguageManager lib/webgen/gui/new_website_dlg.rb lib/webgen/gui/main.rb GUI lib/webgen/rake/webgentask.rb Rake Webgen dot/f_60.png

Methods

Public Class methods

[Source]

    # File lib/webgen/gui/main.rb, line 16
16:   def self.set_logger( logger, set_it = false )
17:     @@logger = logger if set_it
18:   end

Public Instance methods

Used to load optional parts. You have to specify a unique name for the optional part and options with some information about it. The following keys can be used:

:needed_gems :an array of Rubygem‘s gem names that are required for the part
:error_msg :error message that should be displayed if the part can‘t be loaded
:info :information about what the part does

[Source]

     # File lib/webgen/plugin.rb, line 171
171:     def load_optional_part( name, options = {} )
172:       options[:loaded] = true
173:       begin
174:         yield
175:       rescue LoadError => e
176:         options[:loaded] = false
177:         options[:error_msg] ||= e.message
178:       end
179:       callcc {|cont| throw :load_optional_part, [cont, name, options]}
180:     end

This method should be used instead of require when loading a plugin file.

[Source]

     # File lib/webgen/plugin.rb, line 151
151:     def load_plugin( file )
152:       file = file + '.rb' unless /\.rb$/ =~ file
153:       wrapper, do_load = callcc {|cont| throw :load_plugin_file?, [cont, file]}
154: 
155:       realfile = file
156:       if /^(\/|\w:)/ !~ realfile
157:         $:.each do |path|
158:           realfile = File.join( path, file )
159:           break if File.exists?( realfile )
160:         end
161:       end
162: 
163:       wrapper.module_eval( File.read( realfile ), file, 1 ) if do_load
164:     end

[Validate]