Added mock build. Part 1

This commit is contained in:
alexey
2025-03-10 23:56:58 +03:00
parent 91fa281237
commit 48b648f46b
8 changed files with 275 additions and 9 deletions

View File

@@ -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