Method: FFWD::PluginLoader.list_modules

Defined in:
lib/ffwd/plugin_loader.rb

.list_modules(module_category, blacklist, &block) ⇒ Object



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/ffwd/plugin_loader.rb', line 85

def self.list_modules module_category, blacklist, &block
  load_paths.each do |source, path|
    dir = File.join(path, MODULE_NAME, module_category)

    next unless File.directory? dir

    Dir.foreach dir do |entity|
      next if entity.start_with? "."
      next unless entity.end_with? ".rb"
      next unless File.file? File.join(dir, entity)

      base = entity.slice(0, entity.size - 3)

      if blacklist.include? base
        log.warning "Ignoring blacklisted module: #{base}"
        next
      end

      path = [MODULE_NAME, module_category, base].join('/')
      yield source, path
    end
  end
end