69 |
# core:: [FreeBASE::Core] The FreeBASE core instance |
# core:: [FreeBASE::Core] The FreeBASE core instance |
70 |
# filespec:: [String] The path to the plugin.xml file |
# filespec:: [String] The path to the plugin.xml file |
71 |
# |
# |
72 |
def initialize(core, filespec) |
def initialize(core, filespec, plugin_element) |
73 |
@core = core |
@core = core |
74 |
@plugin_file = filespec |
@plugin_file = filespec |
75 |
parse_xml |
parse_xml(plugin_element) |
76 |
# configure base slot |
# configure base slot |
77 |
@base_slot = @core.bus["/plugins/#{@name}"] |
@base_slot = @core.bus["/plugins/#{@name}"] |
78 |
@base_slot.manager = self |
@base_slot.manager = self |
278 |
|
|
279 |
private |
private |
280 |
|
|
281 |
def parse_xml |
def parse_xml(plugin_element) |
282 |
file = File.new(@plugin_file) |
@name = plugin_element.attributes["name"] |
283 |
xml = REXML::Document.new file |
@version = plugin_element.attributes["version"] |
284 |
file.close |
@autoload = plugin_element.attributes["autoload"]=="true" ? true : false |
285 |
@name = xml.root.attributes["name"] |
@require_file = plugin_element.elements["require"].text |
286 |
@version = xml.root.attributes["version"] |
@startup_module = plugin_element.elements["module"].text |
287 |
@autoload = xml.root.attributes["autoload"]=="true" ? true : false |
if plugin_element.elements["resourcePath"] |
288 |
@require_file = xml.root.elements["require"].text |
@resource_path = plugin_element.elements["resourcePath"].text |
|
@startup_module = xml.root.elements["module"].text |
|
|
if xml.root.elements["resourcePath"] |
|
|
@resource_path = xml.root.elements["resourcePath"].text |
|
289 |
end |
end |
290 |
if xml.root.elements["properties"] |
if plugin_element.elements["properties"] |
291 |
@properties_file = xml.root.elements["properties"].text |
@properties_file = plugin_element.elements["properties"].text |
292 |
end |
end |
293 |
@dependencies = {} |
@dependencies = {} |
294 |
xml.root.each_element("dependency") do |element| |
plugin_element.each_element("dependency") do |element| |
295 |
dependency = Dependency.new(element.attributes["state"], element.attributes["action"]) |
dependency = Dependency.new(element.attributes["state"], element.attributes["action"]) |
296 |
element.each_element("when") do |pelement| |
element.each_element("when") do |pelement| |
297 |
attr = pelement.attributes |
attr = pelement.attributes |