Module: EventedBluepill::Options

Extended by:
Options
Included in:
Options
Defined in:
lib/evented_bluepill/options.rb

Constant Summary collapse

APPLICATION_COMMANDS =
%w(status start stop restart unmonitor quit log)

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Object



30
31
32
# File 'lib/evented_bluepill/options.rb', line 30

def [](key)
  @options[key]
end

#parse!Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/evented_bluepill/options.rb', line 19

def parse!
  parse_options!
  parse_application!

  # Check for root
  unless privileged?
    $stderr.puts "You must run evented_bluepill as root or use --no-privileged option."
    exit(3)
  end
end

#pids_dirObject



42
43
44
# File 'lib/evented_bluepill/options.rb', line 42

def pids_dir
  File.join(@options[:base_dir], 'pids')
end

#privileged?Boolean



46
47
48
# File 'lib/evented_bluepill/options.rb', line 46

def privileged?
  !@options[:privileged] || ::Process.euid == 0
end

#running_applicationsObject



34
35
36
# File 'lib/evented_bluepill/options.rb', line 34

def running_applications
  Dir[File.join(EventedBluepill::Options.sockets_dir, "*.sock")].map {|x| File.basename(x, ".sock")}
end

#sockets_dirObject



38
39
40
# File 'lib/evented_bluepill/options.rb', line 38

def sockets_dir
  File.join(@options[:base_dir], 'socks')
end