Class: Dependency
- Inherits:
-
Object
show all
- Defined in:
- lib/dependency.rb
Constant Summary
collapse
- DESCRIPTION_TYPE_WIDTH =
8
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of Dependency.
11
12
13
|
# File 'lib/dependency.rb', line 11
def initialize(name)
@name = name
end
|
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
9
10
11
|
# File 'lib/dependency.rb', line 9
def name
@name
end
|
Instance Method Details
#always_act? ⇒ Boolean
if true, this type of resource must always have ‘meet` and `unmeet` called; useful for resources that can’t easily be checked to see if they’re met
37
38
39
|
# File 'lib/dependency.rb', line 37
def always_act?
false
end
|
#exit_code ⇒ Object
57
58
59
|
# File 'lib/dependency.rb', line 57
def exit_code
@executor&.exit_code
end
|
#failure? ⇒ Boolean
49
50
51
|
# File 'lib/dependency.rb', line 49
def failure?
!success?
end
|
#meet ⇒ Object
19
20
21
|
# File 'lib/dependency.rb', line 19
def meet
raise NotImplementedError
end
|
#met? ⇒ Boolean
15
16
17
|
# File 'lib/dependency.rb', line 15
def met?
raise NotImplementedError
end
|
#output ⇒ Object
53
54
55
|
# File 'lib/dependency.rb', line 53
def output
@executor&.output
end
|
#should_meet? ⇒ Boolean
should_meet? can be used to implement dependencies that should only be met on some platforms, e.g. brew on Macs and apt on Linux it can be used to base a decision on anything else that can be read from the environment at runtime
31
32
33
|
# File 'lib/dependency.rb', line 31
def should_meet?
true
end
|
#success? ⇒ Boolean
45
46
47
|
# File 'lib/dependency.rb', line 45
def success?
@executor.nil? ? true : @executor.success?
end
|
#type ⇒ Object
41
42
43
|
# File 'lib/dependency.rb', line 41
def type
self.class.name.split('::').last
end
|
#unmeet ⇒ Object
23
24
25
|
# File 'lib/dependency.rb', line 23
def unmeet
raise NotImplementedError
end
|