Module: Rake::Pipeline::Info

Defined in:
lib/rake_pipeline.rb

Class Method Summary collapse

Class Method Details

.info_file(filename) ⇒ Object


76
77
78
79
# File 'lib/rake_pipeline.rb', line 76

def self.info_file(filename)
  info = Rake::Pipeline::Step.parse_filename(filename)
  "#{info[:prefix]}/.info/#{info[:job]}.yaml"
end

.load_info(t) ⇒ Object


81
82
83
84
85
86
87
88
89
90
# File 'lib/rake_pipeline.rb', line 81

def self.load_info(t)
  filename = t.name
  info_filename = info_file(filename)

  if File.exists? info_filename
    YAML.load(File.open(info_filename))
  else
    {}
  end
end

.save_info(t, info = {}) ⇒ Object


92
93
94
95
96
97
98
99
100
# File 'lib/rake_pipeline.rb', line 92

def self.save_info(t, info = {})
  filename = t.name
  info_filename = info_file(filename)

  FileUtils.mkdir_p File.dirname(info_filename) unless File.exists? File.dirname(info_filename)
  File.open(info_filename,'w'){|file|
    file.write YAML.dump info
  }
end