Class: EY::Serverside::Maintenance
- Inherits:
-
Object
- Object
- EY::Serverside::Maintenance
- Defined in:
- lib/engineyard-serverside/maintenance.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#shell ⇒ Object
readonly
Returns the value of attribute shell.
Instance Method Summary collapse
- #conditionally_disable ⇒ Object
- #conditionally_enable ⇒ Object
- #exist? ⇒ Boolean
-
#initialize(servers, config, shell) ⇒ Maintenance
constructor
A new instance of Maintenance.
- #manually_disable ⇒ Object
- #manually_enable ⇒ Object
- #status ⇒ Object
- #up? ⇒ Boolean
Constructor Details
#initialize(servers, config, shell) ⇒ Maintenance
Returns a new instance of Maintenance.
7 8 9 |
# File 'lib/engineyard-serverside/maintenance.rb', line 7 def initialize(servers, config, shell) @servers, @config, @shell = servers, config, shell end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
5 6 7 |
# File 'lib/engineyard-serverside/maintenance.rb', line 5 def config @config end |
#shell ⇒ Object (readonly)
Returns the value of attribute shell.
5 6 7 |
# File 'lib/engineyard-serverside/maintenance.rb', line 5 def shell @shell end |
Instance Method Details
#conditionally_disable ⇒ Object
54 55 56 57 58 59 60 |
# File 'lib/engineyard-serverside/maintenance.rb', line 54 def conditionally_disable if using_maintenance_page? disable elsif exist? shell.status "[Attention] Maintenance page is still up.\nYou must remove it manually using `ey web enable`." end end |
#conditionally_enable ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/engineyard-serverside/maintenance.rb', line 46 def conditionally_enable if using_maintenance_page? enable else explain_not_enabling end end |
#exist? ⇒ Boolean
11 12 13 |
# File 'lib/engineyard-serverside/maintenance.rb', line 11 def exist? enabled_maintenance_page_pathname.exist? end |
#manually_disable ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/engineyard-serverside/maintenance.rb', line 37 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_enable ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/engineyard-serverside/maintenance.rb', line 28 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 |
#status ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/engineyard-serverside/maintenance.rb', line 19 def status if exist? shell.info "Maintenance page: up" else shell.info "Maintenance page: down" end exist? end |
#up? ⇒ Boolean
15 16 17 |
# File 'lib/engineyard-serverside/maintenance.rb', line 15 def up? @up end |