rack-dev-mark 0.7.3 → 0.7.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e536e84497366fccf4c91419da55af604cce73e8
4
- data.tar.gz: 99358d2e3e4cf7723501ec7040199f8be07bdbe0
3
+ metadata.gz: a173b3197798c1b4bed2595c70a02d19a2cdfc6c
4
+ data.tar.gz: dbb27824100c85d43e182b4db0013276f640a5fb
5
5
  SHA512:
6
- metadata.gz: 82eb7b6a40748a4a7accceb112e790d272542ecb476131f70d5a1c4b79a11da7c9d4dc58fd37180e44311d4f507dcafc6279ec7612bd4e00f833679125cedd6e
7
- data.tar.gz: 93ab4550f6eb4b7233ecfc6d382cbb547cdd3335c2d98d6f6eb720cb701cf48fa472e84e02b107341bef156892b33d294544e277f67bd43ecf29a089383b7afd
6
+ metadata.gz: 64944f433a68c065feb9618dc55172391bd1c5d761845ef8cf4a1d9086ba4657d71a3614cdb3fa4a01978d964755d756120c9b288a0fa6465154a52dddaa83a1
7
+ data.tar.gz: 602fa4ab9b0bfd1e04bea2d8ef8dafb107e98705ecd3c389ee1809467635bb93a5102ad6b6d27f4dfcd0138d81b5778deb86d4f0d88bf430e13800e915a72861
data/.travis.yml CHANGED
@@ -4,6 +4,7 @@ rvm:
4
4
  - 1.9.3
5
5
  - 2.0.0
6
6
  - 2.1
7
+ - 2.2
7
8
 
8
9
  env:
9
10
  -
@@ -11,9 +12,12 @@ env:
11
12
  - RACK_VERSION=1.2.0
12
13
  - RACK_VERSION=1.3.0
13
14
  - RACK_VERSION=1.4.0
15
+ - RACK_VERSION=1.5.0
16
+ - RACK_VERSION=1.6.0
14
17
  - RAILS_VERSION=3.2.0
15
18
  - RAILS_VERSION=4.0.0
16
19
  - RAILS_VERSION=4.1.0
20
+ - RAILS_VERSION=4.2.0
17
21
  - I18N_VERSION=0.6.0
18
22
 
19
23
  script: "bundle exec rake spec"
data/README.md CHANGED
@@ -44,6 +44,16 @@ use Rack::DevMark::Middleware
44
44
  run MyApp
45
45
  ```
46
46
 
47
+ #### Middleman
48
+
49
+ Add the settings in `config.rb`.
50
+
51
+ ```ruby
52
+ require 'rack/dev-mark'
53
+ Rack::DevMark.env = "Your Env"
54
+ use Rack::DevMark::Middleware
55
+ ```
56
+
47
57
  ### For Rails App
48
58
 
49
59
  In `config/environments/development.rb`
@@ -132,7 +142,7 @@ end
132
142
 
133
143
  ```ruby
134
144
  class FooController < ApplicationController
135
- skip_rack_dev_mark except: [:iframe]
145
+ skip_rack_dev_mark only: [:iframe]
136
146
 
137
147
  def index
138
148
  # Do something
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.3
1
+ 0.7.4
@@ -12,7 +12,7 @@ module Rack
12
12
  @revision = Rack::DevMark.revision
13
13
  @timestamp = Rack::DevMark.timestamp
14
14
  end
15
-
15
+
16
16
  def call(env)
17
17
  Rack::DevMark.tmp_disabled = false
18
18
 
@@ -22,7 +22,8 @@ module Rack
22
22
 
23
23
  headers['X-Rack-Dev-Mark-Env'] = CGI.escape Rack::DevMark.env
24
24
 
25
- if !Rack::DevMark.tmp_disabled && headers['Content-Type'].to_s =~ %r{\btext/html\b}i
25
+ redirect = 300 <= status.to_i && status.to_i < 400
26
+ if !redirect && !Rack::DevMark.tmp_disabled && headers['Content-Type'].to_s =~ %r{\btext/html\b}i
26
27
  new_body = ''
27
28
  response.each do |b|
28
29
  begin
@@ -4,8 +4,9 @@ require 'spec_helper'
4
4
  describe Rack::DevMark::Middleware do
5
5
  let(:headers) { {'Content-Type' => 'text/html; charset=utf-8'} }
6
6
  let(:body) { ['response'] }
7
+ let(:status) { 200 }
7
8
  let(:theme) { d = double setup: nil; allow(d).to receive(:insert_into){ |b| "#{b} dev-mark" }; d }
8
- let(:app) { double call: [200, headers, body] }
9
+ let(:app) { double call: [status, headers, body] }
9
10
  let(:env) { 'test' }
10
11
  let(:revision) { 'rev' }
11
12
  subject { Rack::DevMark::Middleware.new(app, theme) }
@@ -91,4 +92,14 @@ describe Rack::DevMark::Middleware do
91
92
  expect(body).to eq(["response"])
92
93
  end
93
94
  end
95
+ context "redirection" do
96
+ let(:status) { 302 }
97
+ let(:body) { ['<html><head></head><body></body></html>'] }
98
+ it "does not insert dev mark" do
99
+ status, headers, body = subject.call({})
100
+ expect(status).to eq(302)
101
+ expect(headers).to include('Content-Type' => 'text/html; charset=utf-8')
102
+ expect(body).to eq(['<html><head></head><body></body></html>'])
103
+ end
104
+ end
94
105
  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.7.3
4
+ version: 0.7.4
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-08-16 00:00:00.000000000 Z
11
+ date: 2015-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
142
  version: '0'
143
143
  requirements: []
144
144
  rubyforge_project:
145
- rubygems_version: 2.2.2
145
+ rubygems_version: 2.4.5
146
146
  signing_key:
147
147
  specification_version: 4
148
148
  summary: Differentiate development environment from production
@@ -162,3 +162,4 @@ test_files:
162
162
  - spec/spec_helper.rb
163
163
  - spec/support/fork_helper.rb
164
164
  - spec/support/theme_helper.rb
165
+ has_rdoc: