Class: Ops

Inherits:
Object
  • Object
show all
Defined in:
lib/ops.rb

Overview

executes commands based on local ‘ops.yml`

Defined Under Namespace

Classes: UnknownActionError

Constant Summary collapse

CONFIG_FILE =
"ops.yml"
INVALID_SYNTAX_EXIT_CODE =
64
UNKNOWN_ACTION_EXIT_CODE =
65

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Ops

Returns a new instance of Ops.



22
23
24
25
26
27
# File 'lib/ops.rb', line 22

def initialize(argv)
	@action_name = argv[0]
	@args = argv[1..-1]

	Options.set(config["options"] || {})
end

Instance Method Details

#runObject



29
30
31
32
33
34
35
36
# File 'lib/ops.rb', line 29

def run
	exit(INVALID_SYNTAX_EXIT_CODE) unless syntax_valid?

	run_action
rescue UnknownActionError => e
	Output.error("Error: #{e}")
	exit(UNKNOWN_ACTION_EXIT_CODE)
end