Module: Eye::Local
- Defined in:
- lib/eye/local.rb
Class Method Summary collapse
- .cache_path ⇒ Object
- .client_timeout ⇒ Object
- .dir ⇒ Object
- .ensure_eye_dir ⇒ Object
- .eyeconfig ⇒ Object
- .home ⇒ Object
- .host ⇒ Object
- .host=(hostname) ⇒ Object
- .path(path) ⇒ Object
- .pid_path ⇒ Object
- .root? ⇒ Boolean
- .socket_path ⇒ Object
- .supported_setsid? ⇒ Boolean
Class Method Details
.cache_path ⇒ Object
48 49 50 |
# File 'lib/eye/local.rb', line 48 def cache_path path("processes#{ENV['EYE_V']}.cache") end |
.client_timeout ⇒ Object
52 53 54 |
# File 'lib/eye/local.rb', line 52 def client_timeout 5 end |
.dir ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/eye/local.rb', line 6 def dir if root? '/var/run/eye' else File.(File.join(home, '.eye')) end end |
.ensure_eye_dir ⇒ Object
36 37 38 |
# File 'lib/eye/local.rb', line 36 def ensure_eye_dir FileUtils.mkdir_p( dir ) end |
.eyeconfig ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/eye/local.rb', line 14 def eyeconfig if root? '/etc/eye.conf' else File.(File.join(home, '.eyeconfig')) end end |
.home ⇒ Object
26 27 28 29 30 |
# File 'lib/eye/local.rb', line 26 def home h = ENV['EYE_HOME'] || ENV['HOME'] raise "HOME undefined, should be HOME or EYE_HOME environment" unless h h end |
.host ⇒ Object
60 61 62 63 64 65 |
# File 'lib/eye/local.rb', line 60 def host @host ||= begin require 'socket' Socket.gethostname end end |
.host=(hostname) ⇒ Object
67 68 69 |
# File 'lib/eye/local.rb', line 67 def host=(hostname) @host = hostname end |
.path(path) ⇒ Object
32 33 34 |
# File 'lib/eye/local.rb', line 32 def path(path) File.join(dir, path) end |
.pid_path ⇒ Object
44 45 46 |
# File 'lib/eye/local.rb', line 44 def pid_path path(ENV['EYE_PID'] || "pid#{ENV['EYE_V']}") end |
.socket_path ⇒ Object
40 41 42 |
# File 'lib/eye/local.rb', line 40 def socket_path path(ENV['EYE_SOCK'] || "sock#{ENV['EYE_V']}") end |
.supported_setsid? ⇒ Boolean
56 57 58 |
# File 'lib/eye/local.rb', line 56 def supported_setsid? RUBY_VERSION >= '2.0' end |