Sha256: c0b01ae3494604a720aea244bdaf1ea33f0f2c9c22a5788cd6fc24e889037c4c
Contents?: true
Size: 580 Bytes
Versions: 11
Compression:
Stored size: 580 Bytes
Contents
require 'tmpdir' require 'tempfile' module RBatch # @private module DoubleRunChecker module_function def lock_file_name(p) File.join("rbatch_lock_" + p) end def check(p) Dir::foreach(Dir.tmpdir) do |f| if Regexp.new(lock_file_name(p)) =~ f raise RBatch::DoubleRunCheckException, p + " is forbidden running doubly" end end end def make_lock_file(p) Tempfile::new(lock_file_name(p),Dir.tmpdir) end end # @private class DoubleRunCheckException < Exception ; end end
Version data entries
11 entries across 11 versions & 1 rubygems