Class: Salt::Formula::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/salt/formula/base.rb

Overview

This class defines a common interface for module implementations.

Direct Known Subclasses

Git

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, dirname, args) ⇒ Base

Returns a new instance of Base.

Parameters:

  • title (String)
  • dirname (String)
  • args (Array)


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

#dirnameObject (readonly) Also known as: basedir

Parameters:

  • dirname (r)

    @return [String] The name of the directory containing this module



14
15
16
# File 'lib/salt/formula/base.rb', line 14

def dirname
  @dirname
end

#nameObject (readonly)

Returns the value of attribute name.



10
11
12
# File 'lib/salt/formula/base.rb', line 10

def name
  @name
end

#pathObject (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_pathString

Deprecated.

Returns The full filesystem path to the module.

Returns:

  • (String)

    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

#propertiesHash

This method is abstract.

Return the properties of the module

Returns:

  • (Hash)

Raises:

  • (NotImplementedError)


74
75
76
# File 'lib/salt/formula/base.rb', line 74

def properties
  raise NotImplementedError
end

#statusSymbol

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.

Returns:

  • (Symbol)

Raises:

  • (NotImplementedError)


62
63
64
# File 'lib/salt/formula/base.rb', line 62

def status
  raise NotImplementedError
end

#syncObject

This method is abstract.

Synchronize this module with the indicated state.

Raises:

  • (NotImplementedError)


41
42
43
# File 'lib/salt/formula/base.rb', line 41

def sync
  raise NotImplementedError
end

#versionObject

This method is abstract.

Return the desired version of this module

Raises:

  • (NotImplementedError)


47
48
49
# File 'lib/salt/formula/base.rb', line 47

def version
  raise NotImplementedError
end