Class: DInstaller::InstallationPhase

Inherits:
Object
  • Object
show all
Defined in:
lib/dinstaller/installation_phase.rb

Overview

Represents the installation phase of the manager service and allows to configure callbacks to be called when the installation phase value changes

Constant Summary collapse

STARTUP =

Possible installation phase values

"startup"
CONFIG =
"config"
INSTALL =
"install"

Instance Method Summary collapse

Constructor Details

#initializeInstallationPhase

Returns a new instance of InstallationPhase.



31
32
33
# File 'lib/dinstaller/installation_phase.rb', line 31

def initialize
  @on_change_callbacks = []
end

Instance Method Details

#configself

Note:

Callbacks are called.

Sets the installation phase value to config

Returns:

  • (self)


71
72
73
74
# File 'lib/dinstaller/installation_phase.rb', line 71

def config
  change_to(CONFIG)
  self
end

#config?Boolean

Whether the current installation phase value is config

Returns:

  • (Boolean)


45
46
47
# File 'lib/dinstaller/installation_phase.rb', line 45

def config?
  value == CONFIG
end

#installself

Note:

Callbacks are called.

Sets the installation phase value to install

Returns:

  • (self)


81
82
83
84
# File 'lib/dinstaller/installation_phase.rb', line 81

def install
  change_to(INSTALL)
  self
end

#install?Boolean

Whether the current installation phase value is install

Returns:

  • (Boolean)


52
53
54
# File 'lib/dinstaller/installation_phase.rb', line 52

def install?
  value == INSTALL
end

#on_change(&block) ⇒ Object

Registers callbacks to be called when the installation phase value changes

Parameters:

  • block (Proc)


89
90
91
# File 'lib/dinstaller/installation_phase.rb', line 89

def on_change(&block)
  @on_change_callbacks << block
end

#startupself

Note:

Callbacks are called.

Sets the installation phase value to startup

Returns:

  • (self)


61
62
63
64
# File 'lib/dinstaller/installation_phase.rb', line 61

def startup
  change_to(STARTUP)
  self
end

#startup?Boolean

Whether the current installation phase value is startup

Returns:

  • (Boolean)


38
39
40
# File 'lib/dinstaller/installation_phase.rb', line 38

def startup?
  value == STARTUP
end