Class: Vop::PluginFinder
- Inherits:
-
Object
- Object
- Vop::PluginFinder
- Defined in:
- lib/vop/parts/plugin_finder.rb
Instance Attribute Summary collapse
-
#plugins ⇒ Object
readonly
Returns the value of attribute plugins.
-
#templates ⇒ Object
readonly
Returns the value of attribute templates.
Instance Method Summary collapse
- #find(paths) ⇒ Object
-
#initialize ⇒ PluginFinder
constructor
A new instance of PluginFinder.
- #reset ⇒ Object
Constructor Details
#initialize ⇒ PluginFinder
Returns a new instance of PluginFinder.
9 10 11 |
# File 'lib/vop/parts/plugin_finder.rb', line 9 def initialize reset end |
Instance Attribute Details
#plugins ⇒ Object (readonly)
Returns the value of attribute plugins.
7 8 9 |
# File 'lib/vop/parts/plugin_finder.rb', line 7 def plugins @plugins end |
#templates ⇒ Object (readonly)
Returns the value of attribute templates.
7 8 9 |
# File 'lib/vop/parts/plugin_finder.rb', line 7 def templates @templates end |
Instance Method Details
#find(paths) ⇒ Object
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 |
# File 'lib/vop/parts/plugin_finder.rb', line 18 def find(paths) reset $logger.debug "scanning #{paths} for plugins..." paths = [ paths ] unless paths.is_a? Array if paths.size > 0 paths.each do |path| begin next unless File.exists? path rescue => e if e. =~ /Fixnum/ $logger.warn "unexpected Fixnum path : #{path}" end raise e end @plugins += Dir.glob("#{path}/**/*.plugin").map { |x| Pathname.new(File.dirname(x)).realpath.to_s } @templates += Dir.glob("#{path}/**/plugin.vop").map { |x| Pathname.new(x).realpath.to_s } end end self end |
#reset ⇒ Object
13 14 15 16 |
# File 'lib/vop/parts/plugin_finder.rb', line 13 def reset @plugins = [] @templates = [] end |