Class: MaintenanceMode

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/core/maintenance_mode.rb

Instance Method Summary collapse

Constructor Details

#initialize(command) ⇒ MaintenanceMode

Returns a new instance of MaintenanceMode.



8
9
10
# File 'lib/core/maintenance_mode.rb', line 8

def initialize(command)
  @command = command
end

Instance Method Details

#disable!Object



30
31
32
33
34
35
36
# File 'lib/core/maintenance_mode.rb', line 30

def disable!
  if disabled?
    progress.puts("Maintenance mode is already disabled for app '#{config.app}'.")
  else
    disable_maintenance_mode
  end
end

#disabled?Boolean

Returns:

  • (Boolean)


17
18
19
20
# File 'lib/core/maintenance_mode.rb', line 17

def disabled?
  validate_domain_exists!
  cp.domain_workload_matches?(domain_data, one_off_workload)
end

#enable!Object



22
23
24
25
26
27
28
# File 'lib/core/maintenance_mode.rb', line 22

def enable!
  if enabled?
    progress.puts("Maintenance mode is already enabled for app '#{config.app}'.")
  else
    enable_maintenance_mode
  end
end

#enabled?Boolean

Returns:

  • (Boolean)


12
13
14
15
# File 'lib/core/maintenance_mode.rb', line 12

def enabled?
  validate_domain_exists!
  cp.domain_workload_matches?(domain_data, maintenance_workload)
end