Module: Loops
- Includes:
- Errors
- Defined in:
- lib/loops/version.rb,
lib/loops.rb,
lib/loops/cli.rb,
lib/loops/queue.rb,
lib/loops/worker.rb,
lib/loops/autoload.rb,
lib/loops/daemonize.rb,
lib/loops/cli/options.rb,
lib/loops/worker_pool.rb,
lib/loops/cli/commands.rb,
lib/loops/process_manager.rb
Overview
Contains information about currently used Loops version.
Defined Under Namespace
Modules: Commands, Daemonize, Errors, Version Classes: Base, CLI, Command, Engine, Logger, ProcessManager, Queue, Worker, WorkerPool
Constant Summary collapse
- LIB_ROOT =
Returns a full path to the loops “lib” directory.
File.(File.dirname(__FILE__))
- BINARY =
Returns a full path to the loops binary file.
File.(File.join(LIB_ROOT, '../bin/loops'))
Constants included from Errors
Errors::Error, Errors::InvalidCommandError, Errors::InvalidFrameworkError
Class Method Summary collapse
- .__p(*path) ⇒ Object
-
.config_file ⇒ Pathname
Get loops config file full path.
-
.config_file=(config_file) ⇒ Pathname
Set loops config file path.
-
.default_logger ⇒ Logger
Get the current framework’s default logger.
-
.default_logger=(logger) ⇒ Logger
Set the current framework’s default logger.
-
.logger ⇒ Loops::Logger
Get the current loops logger.
-
.logger=(logger) ⇒ Object
Set the current loops logger.
-
.loops_root ⇒ Pathname
Get directory containing loops classes.
-
.loops_root=(loops_root) ⇒ Pathname
Set loops classes directory path.
-
.pid_file ⇒ Pathname
Get the loops monitor process pid file path.
-
.pid_file=(pid_file) ⇒ Pathname
Set the loops monitor pid file path.
-
.root ⇒ Pathname
Loops root directory.
-
.root=(path) ⇒ Pathname
Set loops root directory.
-
.running? ⇒ Boolean
Returns true if current process is started with loops CLI.
Class Method Details
.__p(*path) ⇒ Object
3 |
# File 'lib/loops/autoload.rb', line 3 def self.__p(*path) File.join(Loops::LIB_ROOT, 'loops', *path) end |
.config_file ⇒ Pathname
Get loops config file full path.
48 49 50 |
# File 'lib/loops.rb', line 48 def self.config_file @@config_file ||= root.join('config/loops.yml') end |
.config_file=(config_file) ⇒ Pathname
Set loops config file path.
This is internal method used to set the loops config file path.
64 65 66 |
# File 'lib/loops.rb', line 64 def self.config_file=(config_file) @@config_file = root.join(config_file) if config_file end |
.default_logger ⇒ Logger
Get the current framework’s default logger.
150 151 152 |
# File 'lib/loops.rb', line 150 def self.default_logger @@default_logger end |
.default_logger=(logger) ⇒ Logger
Set the current framework’s default logger.
163 164 165 |
# File 'lib/loops.rb', line 163 def self.default_logger=(logger) @@default_logger = logger end |
.logger ⇒ Loops::Logger
Get the current loops logger.
There are two contexts where different devices (usually) will be configured for this logger instance:
-
In context of loops monitor logger device will be retrieved from the global section of the loops config file, or STDOUT when it was not configured.
-
In context of loop proccess logger device will be configured based on logger value of the particular loop section in the config file.
135 136 137 |
# File 'lib/loops.rb', line 135 def self.logger @@logger ||= ::Loops::Logger.new($stdout) end |
.logger=(logger) ⇒ Object
Set the current loops logger.
141 142 143 |
# File 'lib/loops.rb', line 141 def self.logger=(logger) @@logger = logger end |
.loops_root ⇒ Pathname
Get directory containing loops classes.
73 74 75 |
# File 'lib/loops.rb', line 73 def self.loops_root @@loops_root ||= root.join('app/loops') end |
.loops_root=(loops_root) ⇒ Pathname
Set loops classes directory path.
This is internal method used to set directory where loops classes will be searched.
89 90 91 |
# File 'lib/loops.rb', line 89 def self.loops_root=(loops_root) @@loops_root = root.join(loops_root) if loops_root end |
.pid_file ⇒ Pathname
Get the loops monitor process pid file path.
98 99 100 |
# File 'lib/loops.rb', line 98 def self.pid_file @@pid_file ||= root.join('loops.pid') end |
.pid_file=(pid_file) ⇒ Pathname
Set the loops monitor pid file path.
This is internal method used to set the loops monitor pid file path.
113 114 115 |
# File 'lib/loops.rb', line 113 def self.pid_file=(pid_file) @@pid_file = root.join(pid_file) if pid_file end |
.root ⇒ Pathname
Loops root directory.
Usually it is initialized with framework’s root dir (RAILS_ROOT or MERB_ROOT), but you can specify another directory using command line arguments. Default: current directory.
Loops current directory will is set to this value (chdir).
24 25 26 |
# File 'lib/loops.rb', line 24 def self.root @@root ||= Pathname.new('').realpath end |
.root=(path) ⇒ Pathname
Set loops root directory.
This is internal method used to set the loops root directory.
39 40 41 |
# File 'lib/loops.rb', line 39 def self.root=(path) @@root = Pathname.new(path).realpath end |