rack-dev-mark 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rack/dev-mark/middleware.rb +12 -10
- data/lib/rack/dev-mark/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fff2b9a8075587a3cd9e845a0c894cdb3ba57aca
|
4
|
+
data.tar.gz: 740888ac9204d53a0956cec0379c9c401f06b538
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 975b82a47ccc2761bdb6015d8982a929db6cc8f299ac7d32bd5d0ba0e39ade48d848958622ede56463defffc347046137e2c7ed1284bd92fd45d2bae641651f3
|
7
|
+
data.tar.gz: 5987c26f01630eaf4dd057d415facb884887f1799d3d41d50bbcdcf1bc44957844b14ea0dea25f1cbba6ac0ea694123d7b029d5039cb0223417ef5c86bafe190
|
@@ -16,11 +16,17 @@ module Rack
|
|
16
16
|
headers = HeaderHash.new(headers)
|
17
17
|
|
18
18
|
if headers['Content-Type'].to_s =~ %r{^text/html;}i
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
new_body = ''
|
20
|
+
response.each do |b|
|
21
|
+
begin
|
22
|
+
new_body << insert_dev_marks(b)
|
23
|
+
rescue Rack::DevMark::Exception => e
|
24
|
+
$stderr.write "Failed to insert dev marks: #{e.message}\n"
|
25
|
+
end
|
23
26
|
end
|
27
|
+
response.close if response.respond_to?(:close)
|
28
|
+
headers['Content-Length'] &&= bytesize(new_body).to_s
|
29
|
+
response = [new_body]
|
24
30
|
end
|
25
31
|
|
26
32
|
[status, headers, response]
|
@@ -28,14 +34,10 @@ module Rack
|
|
28
34
|
|
29
35
|
private
|
30
36
|
|
31
|
-
def insert_dev_marks(
|
32
|
-
body = ""
|
33
|
-
response.each do |r|
|
34
|
-
body.concat r.to_s
|
35
|
-
end
|
37
|
+
def insert_dev_marks(body)
|
36
38
|
body = @title.insert_into(body, Rack::DevMark.env, Rack::DevMark.revision)
|
37
39
|
body = @theme.insert_into(body, Rack::DevMark.env, Rack::DevMark.revision)
|
38
|
-
|
40
|
+
body
|
39
41
|
end
|
40
42
|
end
|
41
43
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-dev-mark
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daisuke Taniwaki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|