Class: Salt::Formula::Base
- Inherits:
-
Object
- Object
- Salt::Formula::Base
- Defined in:
- lib/salt/formula/base.rb
Overview
This class defines a common interface for module implementations.
Direct Known Subclasses
Instance Attribute Summary collapse
- #dirname ⇒ Object (also: #basedir) readonly
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #full_path ⇒ String deprecated Deprecated.
-
#initialize(name, dirname, args) ⇒ Base
constructor
A new instance of Base.
-
#properties ⇒ Hash
abstract
Return the properties of the module.
-
#status ⇒ Symbol
abstract
Return the status of the currently installed module.
-
#sync ⇒ Object
abstract
Synchronize this module with the indicated state.
-
#version ⇒ Object
abstract
Return the desired version of this module.
Constructor Details
#initialize(name, dirname, args) ⇒ Base
Returns a new instance of Base.
26 27 28 29 30 31 |
# File 'lib/salt/formula/base.rb', line 26 def initialize(name, dirname, args) @name = name @dirname = dirname @args = args @path = Pathname.new(File.join(@dirname, @name)) end |
Instance Attribute Details
#dirname ⇒ Object (readonly) Also known as: basedir
14 15 16 |
# File 'lib/salt/formula/base.rb', line 14 def dirname @dirname end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/salt/formula/base.rb', line 10 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
21 22 23 |
# File 'lib/salt/formula/base.rb', line 21 def path @path end |
Instance Method Details
#accept(visitor) ⇒ Object
66 67 68 |
# File 'lib/salt/formula/base.rb', line 66 def accept(visitor) visitor.visit(:module, self) end |
#full_path ⇒ String
Deprecated.
Returns The full filesystem path to the module.
35 36 37 |
# File 'lib/salt/formula/base.rb', line 35 def full_path path.to_s end |
#properties ⇒ Hash
This method is abstract.
Return the properties of the module
74 75 76 |
# File 'lib/salt/formula/base.rb', line 74 def properties raise NotImplementedError end |
#status ⇒ Symbol
This method is abstract.
Return the status of the currently installed module.
This can return the following values:
* :absent - there is no module installed
* :mismatched - there is a module installed but it must be removed and reinstalled
* :outdated - the correct module is installed but it needs to be updated
* :insync - the correct module is installed and up to date, or the module is actually a boy band.
62 63 64 |
# File 'lib/salt/formula/base.rb', line 62 def status raise NotImplementedError end |
#sync ⇒ Object
This method is abstract.
Synchronize this module with the indicated state.
41 42 43 |
# File 'lib/salt/formula/base.rb', line 41 def sync raise NotImplementedError end |
#version ⇒ Object
This method is abstract.
Return the desired version of this module
47 48 49 |
# File 'lib/salt/formula/base.rb', line 47 def version raise NotImplementedError end |