Class: RQ::Locker
- Inherits:
-
MainHelper
- Object
- MainHelper
- RQ::Locker
- Defined in:
- lib/rq-0.1.7/locker.rb
Constant Summary
Constants included from Logging
RQ::Logging::DIV0, RQ::Logging::DIV1, RQ::Logging::DIV2, RQ::Logging::DIV3, RQ::Logging::EOL, RQ::Logging::SEC0, RQ::Logging::SEC1, RQ::Logging::SEC2, RQ::Logging::SEC3
Instance Attribute Summary
Attributes inherited from MainHelper
#argv, #cmd, #env, #logger, #main, #mode, #options, #q, #qpath
Instance Method Summary collapse
-
#lock ⇒ Object
{{{.
Methods inherited from MainHelper
Methods included from Logging
Methods included from RQ::Logging::LogMethods
#debug, #error, #fatal, #info, #logerr, #logger, #logger=, #warn
Methods included from Util
#alive?, append_features, #btrace, #columnize, #defval, #emsg, #erreq, #errmsg, #escape, #escape!, #exec, export, #fork, #getopt, #hashify, #host, #hostname, #klass, #maim, #mcp, #realpath, #stamptime, #system, #timestamp, #tmpnam, #uncache
Constructor Details
This class inherits a constructor from RQ::MainHelper
Instance Method Details
#lock ⇒ Object
{{{
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/rq-0.1.7/locker.rb', line 12 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 |