Added mock build. Part 1
This commit is contained in:
@@ -1,11 +1,27 @@
|
||||
class MockManager
|
||||
attr :path, :error, :last_status, :last_pid
|
||||
require_relative "spork"
|
||||
require_relative "runner"
|
||||
|
||||
def initialize(path)
|
||||
class MockManager
|
||||
attr :path, :config, :error, :last_status, :last_pid, :prep_dir
|
||||
|
||||
def initialize(path, config, cfg_counter_path)
|
||||
@error = nil
|
||||
unless File.exist? (path)
|
||||
Dir.mkdir(path)
|
||||
end
|
||||
@path = path
|
||||
@config = config
|
||||
cntr = 0
|
||||
|
||||
File.open(cfg_counter_path, "r+") do |f|
|
||||
f.flock(File::LOCK_EX)
|
||||
counter = f.gets.strip
|
||||
i_counter = counter.to_i
|
||||
i_counter = i_counter + 1
|
||||
f.puts("#{i_counter}")
|
||||
cnt = i_counter
|
||||
end
|
||||
tmp_name = (0...10).map { ("a".."z").to_a[rand(26)] }.join
|
||||
@prep_dir = File.join(path, "#{cntr}_#{tmp_name}")
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user