Module: Eye::Local
- Defined in:
- lib/eye/local.rb
Class Attribute Summary collapse
-
.local_runner ⇒ Object
Returns the value of attribute local_runner.
Class Method Summary collapse
- .cache_path ⇒ Object
- .client_timeout ⇒ Object
- .client_timeout=(cl) ⇒ Object
- .dir ⇒ Object
- .dir=(d) ⇒ Object
- .ensure_eye_dir ⇒ Object
- .eyeconfig ⇒ Object
- .eyefile ⇒ Object
- .find_eyefile(start_from_dir) ⇒ Object
- .home ⇒ Object
- .host ⇒ Object
- .host=(hostname) ⇒ Object
- .path(path) ⇒ Object
- .pid_path ⇒ Object
- .root? ⇒ Boolean
- .socket_path ⇒ Object
- .supported_setsid? ⇒ Boolean
Class Attribute Details
.local_runner ⇒ Object
Returns the value of attribute local_runner.
98 99 100 |
# File 'lib/eye/local.rb', line 98 def local_runner @local_runner end |
Class Method Details
.cache_path ⇒ Object
53 54 55 |
# File 'lib/eye/local.rb', line 53 def cache_path path("processes#{ENV['EYE_V']}.cache") end |
.client_timeout ⇒ Object
57 58 59 |
# File 'lib/eye/local.rb', line 57 def client_timeout @client_timeout ||= 5 end |
.client_timeout=(cl) ⇒ Object
61 62 63 |
# File 'lib/eye/local.rb', line 61 def client_timeout=(cl) @client_timeout = cl end |
.dir ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/eye/local.rb', line 5 def dir @dir ||= begin if root? '/var/run/eye' else File.(File.join(home, '.eye')) end end end |
.dir=(d) ⇒ Object
15 16 17 |
# File 'lib/eye/local.rb', line 15 def dir=(d) @dir = d end |
.ensure_eye_dir ⇒ Object
41 42 43 |
# File 'lib/eye/local.rb', line 41 def ensure_eye_dir FileUtils.mkdir_p( dir ) end |
.eyeconfig ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/eye/local.rb', line 19 def eyeconfig if root? '/etc/eye.conf' else File.(File.join(home, '.eyeconfig')) end end |
.eyefile ⇒ Object
80 81 82 |
# File 'lib/eye/local.rb', line 80 def eyefile @eyefile ||= find_eyefile('.') end |
.find_eyefile(start_from_dir) ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 95 96 |
# 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.(start_from_dir) until !File.directory?(current) || current == previous filename = File.join(current, 'Eyefile') return filename if File.file?(filename) current, previous = File.('..', current), current end end |
.home ⇒ Object
31 32 33 34 35 |
# 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 ⇒ Object
69 70 71 72 73 74 |
# File 'lib/eye/local.rb', line 69 def host @host ||= begin require 'socket' Socket.gethostname end end |
.host=(hostname) ⇒ Object
76 77 78 |
# File 'lib/eye/local.rb', line 76 def host=(hostname) @host = hostname end |
.path(path) ⇒ Object
37 38 39 |
# File 'lib/eye/local.rb', line 37 def path(path) File.join(dir, path) end |
.pid_path ⇒ Object
49 50 51 |
# File 'lib/eye/local.rb', line 49 def pid_path path(ENV['EYE_PID'] || "pid#{ENV['EYE_V']}") end |
.socket_path ⇒ Object
45 46 47 |
# File 'lib/eye/local.rb', line 45 def socket_path path(ENV['EYE_SOCK'] || "sock#{ENV['EYE_V']}") end |
.supported_setsid? ⇒ Boolean
65 66 67 |
# File 'lib/eye/local.rb', line 65 def supported_setsid? RUBY_VERSION >= '2.0' end |