Module: Fragile::PipelineManager

Included in:
Application
Defined in:
lib/fragile/pipeline_manager.rb

Instance Method Summary collapse

Instance Method Details

#define_pipeline(name, &block) ⇒ Object



16
17
18
19
20
# File 'lib/fragile/pipeline_manager.rb', line 16

def define_pipeline(name, &block)
  p = Pipeline.new(name.to_s)
  p.instance_eval(&block)
  self.pipelines[name.to_s] = p
end

#pipeline_exist?(name) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/fragile/pipeline_manager.rb', line 22

def pipeline_exist?(name)
  self.pipelines.has_key?(name.to_s)
end

#pipelinesObject



12
13
14
# File 'lib/fragile/pipeline_manager.rb', line 12

def pipelines
  @pipelines ||= {}
end

#run_pipeline(*names) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/fragile/pipeline_manager.rb', line 26

def run_pipeline(*names)
  names.flatten.each do |name|
    unless pipeline_exist?(name)
      raise Fragile::PipelineError.new("Pipeline #{name} not found.")
    end
    self.pipelines[name.to_s].run
  end
end