module Eye::Local
Attributes
local_runner[RW]
Public Class Methods
cache_path()
click to toggle source
# File lib/eye/local.rb, line 53 def cache_path path("processes#{ENV['EYE_V']}.cache") end
client_timeout()
click to toggle source
# File lib/eye/local.rb, line 57 def client_timeout @client_timeout ||= 5 end
client_timeout=(cl)
click to toggle source
# File lib/eye/local.rb, line 61 def client_timeout=(cl) @client_timeout = cl end
dir()
click to toggle source
# File lib/eye/local.rb, line 5 def dir @dir ||= begin if root? '/var/run/eye' else File.expand_path(File.join(home, '.eye')) end end end
dir=(d)
click to toggle source
# File lib/eye/local.rb, line 15 def dir=(d) @dir = d end
ensure_eye_dir()
click to toggle source
# File lib/eye/local.rb, line 41 def ensure_eye_dir FileUtils.mkdir_p( dir ) end
eyeconfig()
click to toggle source
# File lib/eye/local.rb, line 19 def eyeconfig if root? '/etc/eye.conf' else File.expand_path(File.join(home, '.eyeconfig')) end end
eyefile()
click to toggle source
# File lib/eye/local.rb, line 80 def eyefile @eyefile ||= find_eyefile('.') end
find_eyefile(start_from_dir)
click to toggle source
# File lib/eye/local.rb, line 84 def find_eyefile(start_from_dir) fromenv = ENV['EYEFILE'] return fromenv if fromenv && !fromenv.empty? && File.exist?(fromenv) previous = nil current = File.expand_path(start_from_dir) until !File.directory?(current) || current == previous filename = File.join(current, 'Eyefile') return filename if File.file?(filename) current, previous = File.expand_path('..', current), current end end
home()
click to toggle source
# File lib/eye/local.rb, line 31 def home h = ENV['EYE_HOME'] || ENV['HOME'] raise "HOME undefined, should be HOME or EYE_HOME environment" unless h h end
host()
click to toggle source
# File lib/eye/local.rb, line 69 def host @host ||= begin require 'socket' Socket.gethostname end end
host=(hostname)
click to toggle source
# File lib/eye/local.rb, line 76 def host=(hostname) @host = hostname end
path(path)
click to toggle source
# File lib/eye/local.rb, line 37 def path(path) File.join(dir, path) end
pid_path()
click to toggle source
# File lib/eye/local.rb, line 49 def pid_path path(ENV['EYE_PID'] || "pid#{ENV['EYE_V']}") end
root?()
click to toggle source
# File lib/eye/local.rb, line 27 def root? Process::UID.eid == 0 end
socket_path()
click to toggle source
# File lib/eye/local.rb, line 45 def socket_path path(ENV['EYE_SOCK'] || "sock#{ENV['EYE_V']}") end
supported_setsid?()
click to toggle source
# File lib/eye/local.rb, line 65 def supported_setsid? RUBY_VERSION >= '2.0' end