Class: OpenfireAdmin::PluginList

Inherits:
Array
  • Object
show all
Defined in:
lib/openfire_admin/plugin.rb

Overview

plugin list array. this can find plugin by key.

Constant Summary collapse

PLUGIN_LIST_URL =
"http://www.igniterealtime.org/projects/openfire/versions.jsp"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.availables(client, xml = nil) ⇒ Object



117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/openfire_admin/plugin.rb', line 117

def self.availables(client, xml=nil)
  xml = open(PLUGIN_LIST_URL).read unless xml
  ret = PluginList.new
  doc = HtmlParser.new(xml)
  doc.search('//plugin') do |tr|
    ap = AvailablePlugin.new(client, tr[:url].match(/\/([^\.\/]+)\.[^\/.]+$/)[1])
    ap.name = tr[:name]
    ap.description = tr[:description]
    ap.version = tr[:latest]
    ap.url = tr[:url]
    ret << ap
  end
  ret
end

.installed(client) ⇒ Object



105
106
107
108
109
110
111
112
113
114
115
# File 'lib/openfire_admin/plugin.rb', line 105

def self.installed(client)
  ret = PluginList.new
  client.get_installed_plugins.each{|p|
    r = InstalledPlugin.new(client, p[:key])
    r.name = p[:name]
    r.description = p[:description]
    r.version = p[:version]
    ret << r
  }
  ret
end

Instance Method Details

#[](name) ⇒ Object



97
98
99
100
101
102
103
# File 'lib/openfire_admin/plugin.rb', line 97

def [](name)
  if name.is_a?(String)
    self.find{|p| p.eql? name }
  else
    super
  end
end