Method: Rake::Pipeline::Step.step_dependencies

Defined in:
lib/rake_pipeline.rb

.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