rack-maintenance 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.rdoc +5 -5
- data/lib/rack/maintenance.rb +1 -1
- data/lib/rack/maintenance/version.rb +1 -1
- data/spec/rack-maintenance_spec.rb +15 -1
- data/spec/unicode.html +13 -0
- metadata +16 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 273cdc12fe558a68d730f16823c0359af205338e
|
4
|
+
data.tar.gz: c81c4f77e24b81b7755bb6538e607781b28f0bcf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01b285fa1886ad10c2c9cbfd3d12f49ed1646eef8c1003747492c64643043803c233bff691df4d909d8d4896aed2068f755d73ec7109b5aa218e8406778dd85d
|
7
|
+
data.tar.gz: 3b516946df426e50157ce113ef6e4d42de8cb49625b96d556d1ed238f009dd392247f5f6e93de1e7188e5247d72e6f210814b400bf2c3e0caf5c962f2665f02b
|
data/README.rdoc
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Rack::Maintenance is a simple Rack middleware to detect the existence of a
|
4
4
|
maintenance page and display that instead of incoming requests.
|
5
5
|
|
6
|
-
{<img src="https://
|
6
|
+
{<img src="https://www.codeship.io/projects/740db0a0-1a2c-0132-42f9-66434e25f59b/status" />}[https://www.codeship.io/projects/34562]
|
7
7
|
|
8
8
|
== Installation
|
9
9
|
|
@@ -42,10 +42,6 @@ If <tt>:env</tt> is not specified, the maintenance page will be shown if it exis
|
|
42
42
|
:file => Rails.root.join('public', 'maintenance.html'),
|
43
43
|
:without => /\A\/assets/
|
44
44
|
|
45
|
-
If <tt>:paths</tt> is specified, only the paths specified in the given regular
|
46
|
-
expression will be put on maintenance mode. This is useful if you still want
|
47
|
-
access to an admin interface, as shown on the example.
|
48
|
-
|
49
45
|
== Note on Patches/Pull Requests
|
50
46
|
|
51
47
|
* Fork the project.
|
@@ -55,6 +51,10 @@ access to an admin interface, as shown on the example.
|
|
55
51
|
* Push your branch.
|
56
52
|
* Send me a pull request.
|
57
53
|
|
54
|
+
== Space Babies
|
55
|
+
|
56
|
+
We create internet. http://www.spacebabies.nl
|
57
|
+
|
58
58
|
== License
|
59
59
|
|
60
60
|
BSD. See LICENSE for details.
|
data/lib/rack/maintenance.rb
CHANGED
@@ -14,7 +14,7 @@ class Rack::Maintenance
|
|
14
14
|
def call(env)
|
15
15
|
if maintenance? && path_in_app(env)
|
16
16
|
data = File.read(file)
|
17
|
-
[ 503, { 'Content-Type' => content_type, 'Content-Length' => data.
|
17
|
+
[ 503, { 'Content-Type' => content_type, 'Content-Length' => data.bytesize.to_s }, [data] ]
|
18
18
|
else
|
19
19
|
app.call(env)
|
20
20
|
end
|
@@ -4,6 +4,7 @@ require 'fileutils'
|
|
4
4
|
shared_examples "RackMaintenance" do
|
5
5
|
let(:app) { Class.new { def call(env); end }.new }
|
6
6
|
let(:rack) { Rack::Maintenance.new(app, :file => file_name) }
|
7
|
+
let(:data) { data = File.read(file_name) }
|
7
8
|
|
8
9
|
context "without a :file option" do
|
9
10
|
it "raises an error" do
|
@@ -14,6 +15,10 @@ shared_examples "RackMaintenance" do
|
|
14
15
|
end
|
15
16
|
|
16
17
|
context "without maintenance file" do
|
18
|
+
before do
|
19
|
+
FileUtils.rm(file_name) if File.exists?(file_name)
|
20
|
+
end
|
21
|
+
|
17
22
|
it "calls the app" do
|
18
23
|
app.should_receive(:call).once
|
19
24
|
rack.call({})
|
@@ -35,7 +40,7 @@ shared_examples "RackMaintenance" do
|
|
35
40
|
end
|
36
41
|
|
37
42
|
it "returns the maintenance response" do
|
38
|
-
rack.call({}).should eq [503, {"Content-Type"=>content_type, "Content-Length"=>
|
43
|
+
rack.call({}).should eq [503, {"Content-Type"=>content_type, "Content-Length"=>data.bytesize.to_s}, [data]]
|
39
44
|
end
|
40
45
|
|
41
46
|
context "and :env option MAINTENANCE" do
|
@@ -98,3 +103,12 @@ describe "RackMaintenance with html maintenance file" do
|
|
98
103
|
end
|
99
104
|
end
|
100
105
|
|
106
|
+
describe "RackMaintenance with unicode maintenance file" do
|
107
|
+
before do
|
108
|
+
FileUtils.cp 'spec/unicode.html', 'spec/maintenance.html'
|
109
|
+
end
|
110
|
+
it_behaves_like "RackMaintenance" do
|
111
|
+
let(:file_name) { "spec/maintenance.html" }
|
112
|
+
let(:content_type) { "text/html" }
|
113
|
+
end
|
114
|
+
end
|
data/spec/unicode.html
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Under Maintenance</title>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
6
|
+
</head>
|
7
|
+
|
8
|
+
<body>
|
9
|
+
<div class="dialog">
|
10
|
+
<h1>ขณะนี้กำลังอยู่ระหว่างการปรับปรุงระบบ</h1>
|
11
|
+
</div>
|
12
|
+
</body>
|
13
|
+
</html>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-maintenance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Dollar
|
@@ -9,34 +9,34 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-09-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '1.0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '1.0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rspec
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '2.0'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '2.0'
|
42
42
|
description: Detect and show a maintenance page
|
@@ -47,14 +47,15 @@ executables: []
|
|
47
47
|
extensions: []
|
48
48
|
extra_rdoc_files: []
|
49
49
|
files:
|
50
|
-
- lib/rack/maintenance/version.rb
|
51
|
-
- lib/rack/maintenance.rb
|
52
|
-
- lib/rack-maintenance.rb
|
53
50
|
- LICENSE
|
54
|
-
- Rakefile
|
55
51
|
- README.rdoc
|
52
|
+
- Rakefile
|
53
|
+
- lib/rack-maintenance.rb
|
54
|
+
- lib/rack/maintenance.rb
|
55
|
+
- lib/rack/maintenance/version.rb
|
56
56
|
- spec/rack-maintenance_spec.rb
|
57
57
|
- spec/spec_helper.rb
|
58
|
+
- spec/unicode.html
|
58
59
|
homepage: http://github.com/tilsammans/rack-maintenance
|
59
60
|
licenses: []
|
60
61
|
metadata: {}
|
@@ -78,20 +79,22 @@ require_paths:
|
|
78
79
|
- lib
|
79
80
|
required_ruby_version: !ruby/object:Gem::Requirement
|
80
81
|
requirements:
|
81
|
-
- -
|
82
|
+
- - ">="
|
82
83
|
- !ruby/object:Gem::Version
|
83
84
|
version: '0'
|
84
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
86
|
requirements:
|
86
|
-
- -
|
87
|
+
- - ">="
|
87
88
|
- !ruby/object:Gem::Version
|
88
89
|
version: '0'
|
89
90
|
requirements: []
|
90
91
|
rubyforge_project:
|
91
|
-
rubygems_version: 2.
|
92
|
+
rubygems_version: 2.2.2
|
92
93
|
signing_key:
|
93
94
|
specification_version: 4
|
94
95
|
summary: Detect and show a maintenance page
|
95
96
|
test_files:
|
96
97
|
- spec/rack-maintenance_spec.rb
|
97
98
|
- spec/spec_helper.rb
|
99
|
+
- spec/unicode.html
|
100
|
+
has_rdoc:
|