Module: RBatch::DoubleRunChecker

Defined in:
lib/rbatch/double_run_checker.rb

Class Method Summary (collapse)

Class Method Details

+ (Object) check(p)



11
12
13
14
15
16
17
# File 'lib/rbatch/double_run_checker.rb', line 11

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

+ (Object) lock_file_name(p)



7
8
9
# File 'lib/rbatch/double_run_checker.rb', line 7

def lock_file_name(p)
  File.join("rbatch_lock_" + p)
end

+ (Object) make_lock_file(p)



19
20
21
# File 'lib/rbatch/double_run_checker.rb', line 19

def make_lock_file(p)
  Tempfile::new(lock_file_name(p),Dir.tmpdir)
end