devbar 0.0.1 → 0.0.2

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.
Files changed (3) hide show
  1. data/lib/devbar/version.rb +1 -1
  2. data/lib/devbar.rb +13 -6
  3. metadata +2 -2
@@ -1,3 +1,3 @@
1
1
  module Devbar
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/devbar.rb CHANGED
@@ -7,15 +7,22 @@ module Rack
7
7
  end
8
8
 
9
9
  def call(env)
10
- status, headers, response = @app.call(env)
10
+ status, headers, body = @app.call(env)
11
+ return [status, headers, response] unless headers['Content-Type'] =~ /html/
11
12
 
12
- if headers["Content-Type"].include? "text/html"
13
- full_body = response.body
14
- full_body.sub! /<\/body>/, bar + "</body>"
15
- response.body = full_body
13
+ body.each do |part|
14
+ if part =~ /<\/body>/
15
+ part.sub!(/<\/body>/, "#{bar}</body>")
16
+
17
+ if headers['Content-Length']
18
+ headers['Content-Length'] = (headers['Content-Length'].to_i + bar.length).to_s
19
+ end
20
+
21
+ break
22
+ end
16
23
  end
17
24
 
18
- [status, headers, response]
25
+ [status, headers, body]
19
26
  end
20
27
 
21
28
  def bar
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devbar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-13 00:00:00.000000000 Z
12
+ date: 2013-03-14 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! ' Rack middleware to output a bar showing environment '
15
15
  email: