Sha256: b575da13f4384fcd094e6a3088ba1a9461484c4e6bde7e1d361775625b41bbc7

Contents?: true

Size: 636 Bytes

Versions: 2

Compression:

Stored size: 636 Bytes

Contents

require 'fileutils'

module Eye::Settings
  module_function
  
  def dir
    if Process::UID.eid == 0 # root
      '/var/run/eye'
    else
      File.expand_path(File.join(home, '.eye'))
    end
  end

  def eyeconfig
    if Process::UID.eid == 0 # root
      '/etc/eye.conf'
    else
      File.expand_path(File.join(home, '.eyeconfig'))
    end
  end

  def home
    ENV['EYE_HOME'] || ENV['HOME']
  end
  
  def path(path)
    File.join(dir, path)
  end

  def ensure_eye_dir
    FileUtils.mkdir_p( dir )
  end

  def socket_path
    path('sock')
  end
  
  def pid_path
    path('pid')
  end
  
  def client_timeout
    5
  end

end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
reel-eye-0.3.1 lib/eye/settings.rb
eye-0.3.1 lib/eye/settings.rb