Module: Eye::Settings

Defined in:
lib/eye/settings.rb

Class Method Summary collapse

Class Method Details

.cache_pathObject



46
47
48
# File 'lib/eye/settings.rb', line 46

def cache_path
  path("processes#{ENV['EYE_V']}.cache")
end

.client_timeoutObject



50
51
52
# File 'lib/eye/settings.rb', line 50

def client_timeout
  5
end

.dirObject



6
7
8
9
10
11
12
# File 'lib/eye/settings.rb', line 6

def dir
  if root?
    '/var/run/eye'
  else
    File.expand_path(File.join(home, '.eye'))
  end
end

.ensure_eye_dirObject



34
35
36
# File 'lib/eye/settings.rb', line 34

def ensure_eye_dir
  FileUtils.mkdir_p( dir )
end

.eyeconfigObject



14
15
16
17
18
19
20
# File 'lib/eye/settings.rb', line 14

def eyeconfig
  if root?
    '/etc/eye.conf'
  else
    File.expand_path(File.join(home, '.eyeconfig'))
  end
end

.homeObject



26
27
28
# File 'lib/eye/settings.rb', line 26

def home
  ENV['EYE_HOME'] || ENV['HOME']
end

.path(path) ⇒ Object



30
31
32
# File 'lib/eye/settings.rb', line 30

def path(path)
  File.join(dir, path)
end

.pid_pathObject



42
43
44
# File 'lib/eye/settings.rb', line 42

def pid_path
  path(ENV['EYE_PID'] || "pid#{ENV['EYE_V']}")
end

.root?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/eye/settings.rb', line 22

def root?
  Process::UID.eid == 0
end

.socket_pathObject



38
39
40
# File 'lib/eye/settings.rb', line 38

def socket_path
  path(ENV['EYE_SOCK'] || "sock#{ENV['EYE_V']}")
end

.supported_setsid?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/eye/settings.rb', line 54

def supported_setsid?
  RUBY_VERSION >= '2.0'
end