Class: Dependency
- Inherits:
-
Object
- Object
- Dependency
- Defined in:
- lib/dependency.rb
Direct Known Subclasses
Dependencies::Apk, Dependencies::Apt, Dependencies::Brew, Dependencies::Custom, Dependencies::Dir, Dependencies::Docker, Dependencies::Gem, Dependencies::Sshkey
Constant Summary collapse
- DESCRIPTION_TYPE_WIDTH =
8
Instance Attribute Summary collapse
-
#exit_code ⇒ Object
readonly
Returns the value of attribute exit_code.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
-
#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.
-
#initialize(name) ⇒ Dependency
constructor
A new instance of Dependency.
- #meet ⇒ Object
- #met? ⇒ Boolean
-
#should_meet? ⇒ Boolean
should_meet? can be used to implement dependencies that should only be met on some platforms, e.g.
- #success? ⇒ Boolean
- #type ⇒ Object
- #unmeet ⇒ Object
Constructor Details
#initialize(name) ⇒ Dependency
Returns a new instance of Dependency.
13 14 15 |
# File 'lib/dependency.rb', line 13 def initialize(name) @name = name end |
Instance Attribute Details
#exit_code ⇒ Object (readonly)
Returns the value of attribute exit_code.
11 12 13 |
# File 'lib/dependency.rb', line 11 def exit_code @exit_code end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
11 12 13 |
# File 'lib/dependency.rb', line 11 def name @name end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
11 12 13 |
# File 'lib/dependency.rb', line 11 def output @output 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
39 40 41 |
# File 'lib/dependency.rb', line 39 def always_act? false end |
#meet ⇒ Object
21 22 23 |
# File 'lib/dependency.rb', line 21 def meet raise NotImplementedError end |
#met? ⇒ Boolean
17 18 19 |
# File 'lib/dependency.rb', line 17 def met? raise NotImplementedError 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
33 34 35 |
# File 'lib/dependency.rb', line 33 def should_meet? true end |
#success? ⇒ Boolean
47 48 49 |
# File 'lib/dependency.rb', line 47 def success? @exit_code.nil? ? true : @exit_code.zero? end |
#type ⇒ Object
43 44 45 |
# File 'lib/dependency.rb', line 43 def type self.class.name.split('::').last end |
#unmeet ⇒ Object
25 26 27 |
# File 'lib/dependency.rb', line 25 def unmeet raise NotImplementedError end |