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



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

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

#conditionally_enableObject



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

def conditionally_enable
  if using_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



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

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

#manually_enableObject



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

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

#up?Boolean

Returns:

  • (Boolean)


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

def up?
  @up
end