Sha256: 5f2ca3e946f32ae06f420908e811bf672fa1b6b88f48304243c4c29f60fd3e7e
Contents?: true
Size: 976 Bytes
Versions: 1
Compression:
Stored size: 976 Bytes
Contents
unless defined? $__rq_locker__ module RQ #{{{ LIBDIR = File::dirname(File::expand_path(__FILE__)) + File::SEPARATOR unless defined? LIBDIR require LIBDIR + 'util' require LIBDIR + 'locker' class Locker < MainHelper #{{{ def lock #{{{ set_q ltype = @argv.shift debug{ "ltype <#{ ltype }>" } read_only = case ltype when /^\s*r(?:ead)?|^\s*sh(?:ared)?/io true when /^\s*w(?:rite)?|^\s*ex(?:clusive)?/io false else raise "lock type must be one of (r)ead|(sh)ared|(w)rite|(ex)clusive, not <#{ ltype }>" end cmd = @argv.join(' ').strip raise "no command given for lock type <#{ ltype }>" if cmd.empty? debug{ "cmd <#{ cmd }>" } @q.lock(:read_only => read_only){ Util::system cmd } #}}} end #}}} end # class Locker #}}} end # module RQ $__rq_locker__ = __FILE__ end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rq-0.1.7 | lib/rq-0.1.7/locker.rb |