public
Description: Rails plugin providing a fallback server for mongrel
Homepage: http://www.sanityinc.com/
Clone URL: git://github.com/purcell/maintenance_server.git
Click here to lend your support to: maintenance_server and make a donation at www.pledgie.com !
purcell (author)
Sat Nov 17 01:42:50 -0800 2007
commit  4c0f5173311d78b6bc8035570e70b99b617d2352
tree    ca570b11fbd3acf993995d0f36589bd8fd449b80
parent  5e64a0aadeac73d5b07d50a0cf4453bc6e2a8742
maintenance_server / install.rb
100755 57 lines (52 sloc) 1.364 kb
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env ruby
 
require "#{File.dirname($0)}/../../../config/boot" unless defined?(RAILS_ROOT)
 
def create_file(path, &block)
  puts "Creating #{path}"
  if File.exist?(path)
    puts " - skipping: already exists"
  else
    File.open(path, 'w', &block)
    puts " - done"
  end
end
 
create_file("#{RAILS_ROOT}/script/maintenance_server") do |f|
  f.write(<<-'end_script')
#!/usr/bin/env ruby
# Avoid booting the full Rails environment...
RAILS_ROOT = "#{File.dirname(__FILE__)}/.."
require "#{RAILS_ROOT}/vendor/plugins/maintenance_server/lib/commands/maintenance_server"
end_script
  File.chmod(0755, f.path)
end
 
create_file("#{RAILS_ROOT}/public/maintenance.html") do |f|
  f.write(<<-end_html)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Site temporarily unavailable</title>
<style type="text/css">
#message {
background: white url(/images/logo.png) no-repeat top left;
font-size: 120%;
padding-top: 70px;
width: 700px;
margin: 50px;
}
</style>
</head>
<body>
<div id="message">
<h1>We'll be right back!</h1>
<p>
The site is temporarily unavailable while we make some improvements.
</p>
<p>
This usually takes only a few moments, so please bear with us and try again soon.
</p>
<p>
Best wishes from the team!
</div>
</body>
</html>
end_html
end