Class: EY::Serverside::Maintenance

Inherits:
Object
  • Object
show all
Defined in:
lib/engineyard-serverside/maintenance.rb

Instance Method Summary collapse

Constructor Details

#initialize(servers, config, shell) ⇒ Maintenance

Returns a new instance of Maintenance.



5
6
7
# File 'lib/engineyard-serverside/maintenance.rb', line 5

def initialize(servers, config, shell)
  @servers, @config, @shell = servers, config, shell
end

Instance Method Details

#conditionally_disableObject



45
46
47
48
49
50
51
# File 'lib/engineyard-serverside/maintenance.rb', line 45

def conditionally_disable
  if config.disable_maintenance_page?
    disable
  elsif exist?
    shell.info "[Attention] Maintenance page is still up.\nYou must remove it manually using `ey web enable`."
  end
end

#conditionally_enableObject



37
38
39
40
41
42
43
# File 'lib/engineyard-serverside/maintenance.rb', line 37

def conditionally_enable
  if config.enable_maintenance_page?
    enable
  else
    explain_not_enabling
  end
end

#exist?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/engineyard-serverside/maintenance.rb', line 9

def exist?
  enabled_maintenance_page_pathname.exist?
end

#manually_disableObject



27
28
29
30
31
32
33
34
35
# File 'lib/engineyard-serverside/maintenance.rb', line 27

def manually_disable
  if paths.deployed?
    disable
    shell.status "Maintenance page disabled"
  else
    shell.fatal "Cannot enabled maintenance page. Application #{config.app_name} has never been deployed."
    false
  end
end

#manually_enableObject



17
18
19
20
21
22
23
24
25
# File 'lib/engineyard-serverside/maintenance.rb', line 17

def manually_enable
  if paths.deployed?
    enable
    shell.status "Maintenance page enabled"
  else
    shell.fatal "Cannot enabled maintenance page. Application #{config.app_name} has never been deployed."
    false
  end
end

#up?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/engineyard-serverside/maintenance.rb', line 13

def up?
  @up
end