Sha256: a2c3d8d2652bb074356157598a8b6991159d0f51b107540bf32a8b28ade0a12c
Contents?: true
Size: 1.07 KB
Versions: 5
Compression:
Stored size: 1.07 KB
Contents
# maintenance page namespace :deploy do namespace :web do desc <<-DESC Present a maintenance page to visitors. $ cap deploy:web:disable REASON="a hardware upgrade" UNTIL="12pm Central Time" DESC task :disable do on roles(:web) do (execute "rm #{shared_path}/system/maintenance.html") rescue nil require 'erb' reason = ENV['REASON'] deadline = ENV['UNTIL'] template = File.read('app/views/admin/maintenance.html.erb') #page = ERB.new(template).result(binding) content = ERB.new(template).result(binding) path = "public/system/maintenance.html" File.open(path, "w") { |f| f.write content } upload! path, "#{shared_path}/public/system/maintenance.html", :mode => 0644 end end task :enable do on roles(:web) do # remove local path = "public/system/maintenance.html" File.delete(path) # execute "rm #{shared_path}/public/system/maintenance.html" end end end end
Version data entries
5 entries across 5 versions & 1 rubygems