Class: Aka::App

Inherits:
Object
  • Object
show all
Includes:
Methadone::CLILogging, Methadone::Main
Defined in:
lib/aka/app.rb

Class Method Summary collapse

Class Method Details

.go!Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/aka/app.rb', line 20

def self.go!
  setup_defaults
  opts.post_setup
  opts.parse!
  opts.check_args!
  result = call_main
  if result.kind_of? Fixnum
    exit result
  else
    exit 0
  end
rescue OptionParser::ParseError => ex
  logger.error ex.message
  puts
  store = Aka::Store.new
  store.help(nil, nil)
  exit 64 # Linux standard for bad command line
end

.which(executable) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/aka/app.rb', line 9

def self.which(executable)
  if File.file?(executable) && File.executable?(executable)
    executable
  elsif ENV['PATH']
    path = ENV['PATH'].split(File::PATH_SEPARATOR).find do |p|
      File.executable?(File.join(p, executable))
    end
    path && File.expand_path(executable, path)
  end
end