Class: Litbuild::LogfileNamer

Inherits:
Object
  • Object
show all
Defined in:
lib/litbuild/logfile_namer.rb

Instance Method Summary collapse

Constructor Details

#initialize(log_dir) ⇒ LogfileNamer

Returns a new instance of LogfileNamer.



5
6
7
8
# File 'lib/litbuild/logfile_namer.rb', line 5

def initialize(log_dir)
  @log_dir = log_dir
  @counter = 0
end

Instance Method Details

#path_for(blueprint, phase = nil, stage = nil) ⇒ Object



10
11
12
13
14
15
# File 'lib/litbuild/logfile_namer.rb', line 10

def path_for(blueprint, phase = nil, stage = nil)
  count = format('%03d', @counter)
  @counter += 1
  file_name = build_name(count, blueprint, phase, stage)
  File.join(@log_dir, file_name)
end