rack-contrib 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rack-contrib might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ebb4015dc4f7430d92377b2e07290fce6b77e761
4
- data.tar.gz: cf782e8189841d0ea1f1e8172de8eeba99a31b9e
3
+ metadata.gz: 6e6fdc1793443b60b19d951c29f4454178c07e5e
4
+ data.tar.gz: d3ef6b5dfd00f8c79c80fd24e7db42b9a90d8e88
5
5
  SHA512:
6
- metadata.gz: 5a652866eeee2c3882f693a54e7aece3b6235cd652ff9851dd06635b353896675e1f8d3a5573ef151ed56bdcb03ad2c93f05461a07adcb0a140b7c2b5ffee7fa
7
- data.tar.gz: f4143356a5e113cd337f0a6d32e74564bc109e4cb4d3ad3bc724e53171100df19007357a0e89be91d8cd2301606a180c097d6b4b928b52632bd0b654a64d37fb
6
+ metadata.gz: ce6c4cd334d41918b2004dfb034ced650ce6b9c9d5d50472776e3239fd1f1483266efa62afa28a3383b180f5a7fbd00a5fff9b7c8a36b57b5b71557d7552bc8e
7
+ data.tar.gz: cefd817385ec17640810a98b4c46580ec4fe370f16c40a2464715dbe582dae52572e56d7b2bf5577affb2cf2792c5da703fb2b579a773b07b2f699a4d927587e
data/README.md CHANGED
@@ -6,6 +6,7 @@ interface:
6
6
  * `Rack::AcceptFormat` - Adds a format extension at the end of the URI when there is none, corresponding to the mime-type given in the Accept HTTP header.
7
7
  * `Rack::Access` - Limits access based on IP address
8
8
  * `Rack::Backstage` - Returns content of specified file if it exists, which makes it convenient for putting up maintenance pages.
9
+ * `Rack::BounceFavicon` - Returns a 404 for requests to `/favicon.ico`
9
10
  * `Rack::CSSHTTPRequest` - Adds CSSHTTPRequest support by encoding responses as CSS for cross-site AJAX-style data loading
10
11
  * `Rack::Callbacks` - Implements DSL for pure before/after filter like Middlewares.
11
12
  * `Rack::Config` - Shared configuration for cooperative middleware.
@@ -1,10 +1,16 @@
1
1
  require 'rack'
2
- require 'git-version-bump'
3
2
 
4
3
  module Rack
5
4
  module Contrib
6
5
  def self.release
6
+ require "git-version-bump"
7
7
  GVB.version
8
+ rescue LoadError
9
+ begin
10
+ Gem::Specification.find_by_name("rack-contrib").version.to_s
11
+ rescue Gem::LoadError
12
+ "0.0.0.1.ENOGEM"
13
+ end
8
14
  end
9
15
  end
10
16
 
@@ -34,7 +34,13 @@ module Rack
34
34
 
35
35
  lang = languages_and_qvalues.sort_by { |(locale, qvalue)|
36
36
  qvalue.to_f
37
- }.last.first
37
+ }.reverse.detect { |(locale, qvalue)|
38
+ if I18n.enforce_available_locales
39
+ locale == '*' || I18n.available_locales.include?(locale.to_sym)
40
+ else
41
+ true
42
+ end
43
+ }.first
38
44
 
39
45
  lang == '*' ? nil : lang
40
46
  end
@@ -1,18 +1,31 @@
1
1
  module Rack
2
- # Rack::NotFound is a default endpoint. Initialize with the path to
3
- # your 404 page.
2
+ # Rack::NotFound is a default endpoint. Optionally initialize with the
3
+ # path to a custom 404 page, to override the standard response body.
4
+ #
5
+ # Examples:
6
+ #
7
+ # Serve default 404 response:
8
+ # run Rack::NotFound.new
9
+ #
10
+ # Serve a custom 404 page:
11
+ # run Rack::NotFound.new('path/to/your/404.html')
4
12
 
5
13
  class NotFound
6
14
  F = ::File
7
15
 
8
- def initialize(path)
9
- file = F.expand_path(path)
10
- @content = F.read(file)
16
+ def initialize(path = nil, content_type = 'text/html')
17
+ if path.nil?
18
+ @content = "Not found\n"
19
+ else
20
+ @content = F.read(path)
21
+ end
11
22
  @length = @content.size.to_s
23
+
24
+ @content_type = content_type
12
25
  end
13
26
 
14
27
  def call(env)
15
- [404, {'Content-Type' => 'text/html', 'Content-Length' => @length}, [@content]]
28
+ [404, {'Content-Type' => @content_type, 'Content-Length' => @length}, [@content]]
16
29
  end
17
30
  end
18
31
  end
@@ -1,11 +1,7 @@
1
1
  require 'rack/file'
2
2
 
3
3
  module Rack
4
- class File #:nodoc:
5
- alias :to_path :path
6
- end
7
4
 
8
- # = Sendfile
9
5
  #
10
6
  # The Sendfile middleware intercepts responses whose body is being
11
7
  # served from a file and replaces it with a server specific X-Sendfile
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-contrib
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - rack-devel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-31 00:00:00.000000000 Z
11
+ date: 2017-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -25,33 +25,33 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.4'
27
27
  - !ruby/object:Gem::Dependency
28
- name: git-version-bump
28
+ name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.15'
34
- type: :runtime
33
+ version: '1.0'
34
+ type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.15'
40
+ version: '1.0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: bundler
42
+ name: git-version-bump
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.0'
47
+ version: '0.15'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.0'
54
+ version: '0.15'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: github-release
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +72,20 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0.4'
75
+ version: '0.5'
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: 0.5.2
76
79
  type: :development
77
80
  prerelease: false
78
81
  version_requirements: !ruby/object:Gem::Requirement
79
82
  requirements:
80
83
  - - "~>"
81
84
  - !ruby/object:Gem::Version
82
- version: '0.4'
85
+ version: '0.5'
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: 0.5.2
83
89
  - !ruby/object:Gem::Dependency
84
90
  name: json
85
91
  requirement: !ruby/object:Gem::Requirement
@@ -87,6 +93,9 @@ dependencies:
87
93
  - - "~>"
88
94
  - !ruby/object:Gem::Version
89
95
  version: '1.8'
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: 1.8.5
90
99
  type: :development
91
100
  prerelease: false
92
101
  version_requirements: !ruby/object:Gem::Requirement
@@ -94,6 +103,23 @@ dependencies:
94
103
  - - "~>"
95
104
  - !ruby/object:Gem::Version
96
105
  version: '1.8'
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: 1.8.5
109
+ - !ruby/object:Gem::Dependency
110
+ name: mime-types
111
+ requirement: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - "<"
114
+ - !ruby/object:Gem::Version
115
+ version: '3'
116
+ type: :development
117
+ prerelease: false
118
+ version_requirements: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - "<"
121
+ - !ruby/object:Gem::Version
122
+ version: '3'
97
123
  - !ruby/object:Gem::Dependency
98
124
  name: minitest
99
125
  requirement: !ruby/object:Gem::Requirement
@@ -273,7 +299,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
273
299
  version: '0'
274
300
  requirements: []
275
301
  rubyforge_project:
276
- rubygems_version: 2.2.2
302
+ rubygems_version: 2.5.2
277
303
  signing_key:
278
304
  specification_version: 2
279
305
  summary: Contributed Rack Middleware and Utilities