Module: EventedBluepill::Options
Constant Summary collapse
- APPLICATION_COMMANDS =
%w(status start stop restart unmonitor quit log)
Instance Method Summary collapse
- #[](key) ⇒ Object
- #parse! ⇒ Object
- #pids_dir ⇒ Object
- #privileged? ⇒ Boolean
- #running_applications ⇒ Object
- #sockets_dir ⇒ Object
Instance Method Details
#[](key) ⇒ Object
30 31 32 |
# File 'lib/evented_bluepill/options.rb', line 30 def [](key) [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_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_dir ⇒ Object
42 43 44 |
# File 'lib/evented_bluepill/options.rb', line 42 def pids_dir File.join([:base_dir], 'pids') end |
#privileged? ⇒ Boolean
46 47 48 |
# File 'lib/evented_bluepill/options.rb', line 46 def privileged? ![:privileged] || ::Process.euid == 0 end |
#running_applications ⇒ Object
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_dir ⇒ Object
38 39 40 |
# File 'lib/evented_bluepill/options.rb', line 38 def sockets_dir File.join([:base_dir], 'socks') end |