Class: Runner

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

Defined Under Namespace

Classes: ActionConfigError, UnknownActionError

Instance Method Summary collapse

Constructor Details

#initialize(action_name, args, config, config_path) ⇒ Runner

Returns a new instance of Runner.


14
15
16
17
18
19
# File 'lib/runner.rb', line 14

def initialize(action_name, args, config, config_path)
	@action_name = action_name
	@args = args
	@config = config
	@config_path = config_path
end

Instance Method Details

#runObject

Raises:


21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/runner.rb', line 21

def run
	return forward.run if forward

	do_before_all

	return builtin.run if builtin

	raise UnknownActionError, "Unknown action: #{@action_name}" unless action
	raise ActionConfigError, action.config_errors.join("; ") unless action.config_valid?

	do_before_action
	Output.notice("Running '#{action}' in environment '#{ENV['environment']}'...")
	action.run
end

#suggestionsObject


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

def suggestions
	@suggestions ||= ActionSuggester.new(action_list.names + action_list.aliases + builtin_names).check(@action_name)
end