Class: CmdExecutable::Runner

Inherits:
Thor
  • Object
show all
Includes:
CmdExecutable
Defined in:
lib/cmd_executable/runner.rb

Overview

CLI Runner

Usage on CLI:

$ cmd_executable ls
> OK

Constant Summary

Constants included from CmdExecutable

VERSION

Class Method Summary collapse

Instance Method Summary collapse

Methods included from CmdExecutable

#executable?, executable?

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/cmd_executable/runner.rb', line 37

def self.exit_on_failure?
  true
end

Instance Method Details

#check(command = '') ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/cmd_executable/runner.rb', line 44

def check(command = '')
  if executable?(command)
    puts 'OK'
    exit 0
  else
    puts 'NOT FOUND'
    exit 1
  end
rescue CmdExecutable::ParserError => e
  warn "Invalid command: `#{e.message}'"
  exit 16
end

#versionObject



59
60
61
# File 'lib/cmd_executable/runner.rb', line 59

def version
  puts CmdExecutable::VERSION
end