lib/plugins/plugins.rb in rsence-2.0.0.6.pre vs lib/plugins/plugins.rb in rsence-2.0.0.7.pre

- old
+ new

@@ -21,12 +21,13 @@ require 'plugins/plugin_plugins' module ::RSence module Plugins - # plugin.rb contains the Plugin skeleton class require 'plugins/plugin' + + # The PluginMaker mimic class creates the Plugin class from PluginTemplate def self.PluginMaker lambda do |ns| klass = Class.new( PluginTemplate ) do def self.ns=(ns) define_method( :bundle_info ) do @@ -37,13 +38,13 @@ klass.ns = ns if ns klass end end - # gui_plugin.rb is an extension of Plugin that uses - # GUIParser to init the gui automatically. require 'plugins/gui_plugin' + + # The GUIPluginMaker mimic class creates the GUIPlugin class from GUIPluginTemplate def self.GUIPluginMaker lambda do |ns| klass = Class.new( GUIPluginTemplate ) do def self.ns=(ns) define_method( :bundle_info ) do @@ -54,12 +55,13 @@ klass.ns = ns if ns klass end end - # servlet includes the Servlet class, for handling any requests / responses require 'plugins/servlet' + + # The ServletMaker mimic class creates the Servlet class from ServletTemplate def self.ServletMaker lambda do |ns| klass = Class.new( ServletTemplate ) do def self.ns=(ns) define_method( :bundle_info ) do @@ -70,9 +72,14 @@ klass.ns = ns if ns klass end end + # Loads bundle according to the +params+ hash. + # Some essential params: + # :src_path => '/path/of/the_plugin/the_plugin.rb' + # :bundle_path => '/path/of/the_plugin' + # :bundle_name => :the_plugin def self.bundle_loader( params ) src_path = params[:src_path] begin mod = Module.new do |m| if RUBY_VERSION.to_f >= 1.9