Class: MotherBrain::Gear::Base

Inherits:
Object
  • Object
show all
Includes:
VariaModel
Defined in:
lib/mb/gear.rb

Direct Known Subclasses

DynamicService, JMX, MySQL, Service

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.keywordSymbol (readonly)

The identifier for the Gear. The keyword is automatically populated based on the name of the Class including MotherBrain::Gear. The keyword must be unique among the other registered Gears. Also used to define a Gear in the plugin DSL.

Returns:

  • (Symbol)


31
32
33
# File 'lib/mb/gear.rb', line 31

def keyword
  @keyword
end

Class Method Details

.register_gear(keyword) ⇒ Object

Register the gear with MotherBrain::Gear with the given keyword. This is how a gear is identified within a plugin.

Parameters:

  • keyword (#to_sym)


37
38
39
40
# File 'lib/mb/gear.rb', line 37

def register_gear(keyword)
  @keyword = keyword.to_sym
  Gear.register(self)
end

Instance Method Details

#run(job, environment, *args) ⇒ Object

Parameters:

  • job (MB::Job)

    a job to update with status

  • environment (String)

    the environment this command is being run on

Raises:



49
50
51
# File 'lib/mb/gear.rb', line 49

def run(job, environment, *args)
  raise AbstractFunction, "#run(environment, *args) must be implemented on #{self.class}"
end