Module: StepPlugin

Included in:
GenerateFromTemplates, Target::Deb, ZipDirectories
Defined in:
lib/gpm/target/step_plugin.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/gpm/target/step_plugin.rb', line 2

def self.included(base)
  if base.is_a? Class
    def base.in_phase(phase, description=nil, &block)
      self.add_step_for_phase(phase,block,description)
    end
  elsif base.is_a? Module
    def base.in_phase(phase, description=nil, &block)
      @phase_blocks||= {}
      @phase_blocks[phase] ||= []
      @phase_blocks[phase] << [block, description]
    end
    def base.plugin_included(clazz)
      (@phase_blocks || []).each do |phase, blocks|
        blocks.each do |block_and_description|
          block, description = block_and_description
          clazz.add_step_for_phase(phase,block,description)
        end
      end
    end
    def base.included(clazz)
      plugin_included(clazz)
    end
  end
end