class Ridoku::Maintenance
Attributes
app[RW]
Public Instance Methods
run()
click to toggle source
# File lib/ridoku/maintenance.rb, line 13 def run clist = Base.config[:command] command = clist.shift sub_command = clist.shift case sub_command when 'on' maintenance(true) when 'off' maintenance(false) when 'status', nil status else print_maintenance_help end end
Protected Instance Methods
maintenance(maint)
click to toggle source
# File lib/ridoku/maintenance.rb, line 32 def maintenance(maint) Base.fetch_stack Base.fetch_app Base.custom_json['deploy'][Base.app[:shortname]]['maintenance'] = maint Base.save_stack Ridoku::Cook.cook_recipe_on_layers('deploy::maintenance', ['rails-app'], deploy: { Base.app[:shortname] => { application_type: 'rails' } } ) status end
print_maintenance_help()
click to toggle source
# File lib/ridoku/maintenance.rb, line 66 def print_maintenance_help $stderr.puts <<-EOF Command: maintenance Set maintenance mode on the specific applications: maintenance:on Turn on maintenance mode for all application instances. maintenance:off Turn off maintenance mode for all application instances. EOF end
status()
click to toggle source
# File lib/ridoku/maintenance.rb, line 49 def status Base.fetch_stack Base.fetch_app $stdout.print 'Maintenance: ' app_json = Base.custom_json['deploy'][Base.app[:shortname]] if app_json.key?('maintenance') maint = (app_json['maintenance'] == true) $stdout.puts $stdout.colorize((maint ? 'on' : 'off'), [:bold, (maint ? :red : :green)]) else $stdout.puts $stdout.colorize('off', :green) end end