Class: Action
- Inherits:
-
Object
show all
- Defined in:
- lib/action.rb
Overview
represents one action to be performed in the shell can assemble a command line from a command and args
Defined Under Namespace
Classes: NotAllowedInEnvError
Instance Method Summary
collapse
Constructor Details
#initialize(config, args) ⇒ Action
Returns a new instance of Action.
10
11
12
13
|
# File 'lib/action.rb', line 10
def initialize(config, args)
@config = config
@args = args
end
|
Instance Method Details
#alias ⇒ Object
27
28
29
|
# File 'lib/action.rb', line 27
def alias
@config["alias"]
end
|
#command ⇒ Object
31
32
33
|
# File 'lib/action.rb', line 31
def command
@config["command"]
end
|
#config_errors ⇒ Object
47
48
49
50
51
52
53
54
55
|
# File 'lib/action.rb', line 47
def config_errors
@config_errors ||= begin
errors = []
errors << "No 'command' specified in 'action'." unless @config['command']
errors
end
end
|
#config_valid? ⇒ Boolean
43
44
45
|
# File 'lib/action.rb', line 43
def config_valid?
config_errors.empty?
end
|
#description ⇒ Object
35
36
37
|
# File 'lib/action.rb', line 35
def description
@config["description"]
end
|
#load_secrets? ⇒ Boolean
57
58
59
|
# File 'lib/action.rb', line 57
def load_secrets?
@config["load_secrets"].nil? ? false : @config["load_secrets"]
end
|
#skip_hooks?(name) ⇒ Boolean
39
40
41
|
# File 'lib/action.rb', line 39
def skip_hooks?(name)
@config["skip_#{name}_hooks"]
end
|
#to_s ⇒ Object
23
24
25
|
# File 'lib/action.rb', line 23
def to_s
"#{command} #{@args.join(' ')}".strip
end
|