-
Notifications
You must be signed in to change notification settings - Fork 35
/
web.rake
25 lines (23 loc) · 879 Bytes
/
web.rake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true
namespace :web do
desc "Disable web"
task disable: :environment do
require "erb"
@reason = ENV["REASON"] || "DOWNTIME! The toobs are being vacuumed, " \
"check back in a couple of minutes."
template_file = File.join(File.dirname(__FILE__),
"../../config/maintenance.erb")
template = ""
File.open(template_file) { |fh| template = fh.read }
template = ERB.new(template)
File.write(File.join(File.dirname(__FILE__),
"../../public/system/maintenance.html"),
template.result(binding))
end
desc "Enable web"
task enable: :environment do
maintenance_file = File.join(File.dirname(__FILE__),
"../../public/system/maintenance.html")
FileUtils.rm_f(maintenance_file)
end
end