Class: AgentsControl::Service
- Inherits:
-
Object
- Object
- AgentsControl::Service
- Defined in:
- lib/agents_control/service.rb
Overview
Autostarting the daemon: launchd on macOS, systemd on Linux.
Everything here is built around one rule: absolute paths. The service starts not from an interactive shell but from a system manager, where PATH is completely different and can't be relied on.
Defined Under Namespace
Constant Summary collapse
- LABEL =
"com.agents-control.daemon"
Instance Attribute Summary collapse
-
#ruby ⇒ Object
readonly
Returns the value of attribute ruby.
-
#script ⇒ Object
readonly
Returns the value of attribute script.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(ruby: nil, script: nil, logger: $stdout) ⇒ Service
constructor
The interpreter isn't looked up on PATH, it's the one running this code right now: a PATH search could find a version manager's broken shim ahead of the working Ruby.
- #log_path ⇒ Object
Constructor Details
#initialize(ruby: nil, script: nil, logger: $stdout) ⇒ Service
The interpreter isn't looked up on PATH, it's the one running this code right now: a PATH search could find a version manager's broken shim ahead of the working Ruby. RbConfig.ruby by definition points at the live interpreter.
23 24 25 26 27 |
# File 'lib/agents_control/service.rb', line 23 def initialize(ruby: nil, script: nil, logger: $stdout) @ruby = ruby || RbConfig.ruby @script = script || default_script @logger = logger end |
Instance Attribute Details
#ruby ⇒ Object (readonly)
Returns the value of attribute ruby.
29 30 31 |
# File 'lib/agents_control/service.rb', line 29 def ruby @ruby end |
#script ⇒ Object (readonly)
Returns the value of attribute script.
29 30 31 |
# File 'lib/agents_control/service.rb', line 29 def script @script end |
Class Method Details
Instance Method Details
#log_path ⇒ Object
31 |
# File 'lib/agents_control/service.rb', line 31 def log_path = File.("~/Library/Logs/agents_control.log") |