Module: Rake::Pipeline::Step

Defined in:
lib/rake_pipeline.rb

Constant Summary collapse

@@step_descriptions =
{}
@@last_step =
nil

Class Method Summary collapse

Class Method Details

.add_description(re, step, message) ⇒ Object



30
31
32
# File 'lib/rake_pipeline.rb', line 30

def add_description(re, step, message)
  @@step_descriptions[re] = "#{ step }: #{ message }"                       
end

.parse_filename(filename) ⇒ Object



63
64
65
66
67
68
69
70
# File 'lib/rake_pipeline.rb', line 63

def parse_filename(filename)
  filename.match(/^(.*?)([^\/]*)\/([^\/]*)$/)
  {
    :prefix => $1 == "" ? "." : $1,
    :step => $2,
    :job => $3,
  }
end

.step_dependencies(name, dependencies = nil) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/rake_pipeline.rb', line 35

def step_dependencies(name, dependencies = nil)

  re = Regexp.new(/(?:^|\/)#{name}\/.*$/)

  # Take the last_description and associate it with the name
  if Rake.application.last_description
    add_description(re, name, Rake.application.last_description)
  end

  if dependencies.nil? && ! @@last_step.nil?
    dependencies = @@last_step
  end
  @@last_step = name

  # Generate the Hash definition
  case 
  when dependencies.nil?
    re
  when String === dependencies || Symbol === dependencies
    {re => lambda{|filename| filename.sub(name.to_s,dependencies.to_s) }}
  when Array === dependencies
    {re => lambda{|filename| dependencies.collect{|dep| filename.sub(name.to_s, dep.to_s) } }}
  when Proc === dependencies
    {re => dependencies}
  end

end

.step_descriptionsObject



26
27
28
# File 'lib/rake_pipeline.rb', line 26

def step_descriptions
  @@step_descriptions
end