module Automatic::Pipeline

Public Class Methods

load_plugin(module_name) click to toggle source
# File lib/automatic/pipeline.rb, line 18
def self.load_plugin(module_name)
  Dir[Automatic.user_plugins_dir + "/*",
      Automatic.plugins_dir + "/*"].each {|dir|
    subdir = File.basename dir
    if /#{subdir}_(.*)$/ =~ module_name.underscore
      path = dir + "/#{$1}.rb"
      return Automatic::Plugin.autoload module_name.to_sym,
        path.to_s if File.exists? path
    end
  }
  raise NoPluginError, "unknown plugin named #{module_name}"
end
run(recipe) click to toggle source
# File lib/automatic/pipeline.rb, line 31
def self.run(recipe)
  raise NoRecipeError if recipe.nil?
  pipeline = []
  recipe.each_plugin {|plugin|
    mod = plugin.module
    load_plugin(mod)
    klass = Automatic::Plugin.const_get(mod)
    pipeline = klass.new(plugin.config, pipeline).run
  }
end