-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweb.rake
More file actions
28 lines (26 loc) · 908 Bytes
/
Copy pathweb.rake
File metadata and controls
28 lines (26 loc) · 908 Bytes
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
26
27
28
# 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.open(
File.join(File.dirname(__FILE__), "../../public/system/maintenance.html"),
"w"
) do |fh|
fh.write template.result(binding)
end
end
desc "Enable web"
task :enable do
maintenance_file = File.join(File.dirname(__FILE__),
"../../public/system/maintenance.html")
File.unlink(maintenance_file) if File.exist?(maintenance_file)
end
end