Class: UWA::Plugin
Instance Attribute Summary collapse
-
#list ⇒ Object
readonly
Returns the value of attribute list.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Plugin
constructor
A new instance of Plugin.
- #load ⇒ Object
Constructor Details
#initialize ⇒ Plugin
Returns a new instance of Plugin.
13 14 15 |
# File 'lib/uwa/plugin.rb', line 13 def initialize @list = {} end |
Instance Attribute Details
#list ⇒ Object (readonly)
Returns the value of attribute list.
11 12 13 |
# File 'lib/uwa/plugin.rb', line 11 def list @list end |
Class Method Details
.method_missing(name, *args) ⇒ Object
7 8 9 |
# File 'lib/uwa/plugin.rb', line 7 def self.method_missing(name, *args) self.instance.send(name, *args) end |
Instance Method Details
#load ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/uwa/plugin.rb', line 17 def load sdir = File.join(Gem.dir, "specifications") gems = Gem::SourceIndex.from_installed_gems(sdir) needs = {"uwa" => false} gems.each do |path, gem| next if @list.has_key? gem.name check = needs.dup gem.dependencies.each do |dep| if check.has_key? dep.name check[dep.name] = !check[dep.name] end end if (check.select {|name,test| !test}).length == 0 gem_dir = File.join(Gem.dir, "gems", path) file = File.join(gem_dir, "lib", gem.name, "widget.rb") before = UWA::Widget.constants rescue [] require file after = UWA::Widget.constants @list[gem.name] = { :base => gem_dir, :class => UWA::Widget.const_get((after - before).first.to_sym), :script => Dir[File.join(gem_dir, 'ressources', '*.js')], :css => Dir[File.join(gem_dir, 'ressources', '*.css')] } end end @list end |