class Plugin

This class is used to load QuartzFlow plugins (loadAll), and represents a single plugin. Plugins contain:

- a links.rb file that defines menu links that show up on the main QuartzFlow page
- a routes.rb file that defines new Sinatra routes
- a views directory that contains new templates for use with the routes defined in routes.rb

Attributes

routesFile[R]

Public Class Methods

loadAll() click to toggle source

Load all plugins under plugins/ and return an array of the loaded Plugin objects.

# File lib/quartz_flow/plugin.rb, line 31
def self.loadAll
  plugins = []
  Dir.new("plugins").each do |e|
    next if e =~ /^\./
    path = "plugins" + File::SEPARATOR + e
    if File.directory?(path)
   
      puts "Loading plugin #{e}"
 
      links = loadPluginLinks(path)
      routesFile = path + File::SEPARATOR + "routes.rb"
      if ! File.exists?(routesFile)
        routesFile = nil 
        puts "  plugin has no routes.rb file"
      end

      plugins.push Plugin.new(links, routesFile)
    end
  end
  plugins
end
new(links, routesFile) click to toggle source
# File lib/quartz_flow/plugin.rb, line 22
def initialize(links, routesFile)
  @links = links
  @routesFile = routesFile
end

Private Class Methods