utopia 1.6.13 → 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/utopia/exceptions/mailer.rb +12 -1
- data/lib/utopia/static.rb +1 -1
- data/lib/utopia/version.rb +1 -1
- data/spec/utopia/exceptions/handler_spec.rb +2 -0
- data/spec/utopia/exceptions/mailer_spec.rb +42 -0
- data/spec/utopia/exceptions/mailer_spec.ru +6 -0
- data/utopia.gemspec +2 -2
- metadata +12 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3390ed8d54ee8c008436db759edf55d1ed597125
|
4
|
+
data.tar.gz: 400382f8bd1cf1cc415f1807b41b131a66b93cc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c1c7ece8a229674da398b5e51603b9dbcde275519d7b279f442e35bc07ef40101c1b80ff75d8527f089fa7f970144c6257d177262372a9d024bcdc25902b406
|
7
|
+
data.tar.gz: 8095d7678c15039a31c8f2a5b04850dc32bfb45c4f96141ce85869ee80bec1283a9609f14a71f9aba6830ca3a70ac7f2e1f8daafdce933cbcec67e4fcb4870c4
|
@@ -55,7 +55,12 @@ module Utopia
|
|
55
55
|
|
56
56
|
private
|
57
57
|
|
58
|
-
REQUEST_KEYS = [
|
58
|
+
REQUEST_KEYS = [
|
59
|
+
:ip,
|
60
|
+
:referrer,
|
61
|
+
:path,
|
62
|
+
:user_agent,
|
63
|
+
]
|
59
64
|
|
60
65
|
def generate_body(exception, env)
|
61
66
|
io = StringIO.new
|
@@ -78,6 +83,12 @@ module Utopia
|
|
78
83
|
|
79
84
|
io.puts
|
80
85
|
|
86
|
+
env.select{|key,_| key.start_with? 'HTTP_'}.each do |key, value|
|
87
|
+
io.puts "#{key}: #{value.inspect}"
|
88
|
+
end
|
89
|
+
|
90
|
+
io.puts
|
91
|
+
|
81
92
|
io.puts "#{exception.class.name}: #{exception.to_s}"
|
82
93
|
|
83
94
|
if exception.respond_to?(:backtrace)
|
data/lib/utopia/static.rb
CHANGED
@@ -187,7 +187,7 @@ module Utopia
|
|
187
187
|
CONTENT_RANGE = 'Content-Range'.freeze
|
188
188
|
|
189
189
|
def serve(env, response_headers)
|
190
|
-
ranges = Rack::Utils.
|
190
|
+
ranges = Rack::Utils.get_byte_ranges(env['HTTP_RANGE'], size)
|
191
191
|
response = [200, response_headers, self]
|
192
192
|
|
193
193
|
# puts "Requesting ranges: #{ranges.inspect} (#{size})"
|
data/lib/utopia/version.rb
CHANGED
@@ -0,0 +1,42 @@
|
|
1
|
+
#!/usr/bin/env rspec
|
2
|
+
|
3
|
+
# Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in
|
13
|
+
# all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
# THE SOFTWARE.
|
22
|
+
|
23
|
+
require_relative '../rack_helper'
|
24
|
+
|
25
|
+
require 'utopia/exceptions'
|
26
|
+
require 'utopia/controller'
|
27
|
+
|
28
|
+
RSpec.describe Utopia::Exceptions::Mailer do
|
29
|
+
include_context "rack app", File.expand_path("mailer_spec.ru", __dir__)
|
30
|
+
|
31
|
+
before(:each) do
|
32
|
+
Mail::TestMailer.deliveries.clear
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should send an email to report the failure" do
|
36
|
+
expect{get "/blow"}.to raise_error('Arrrh!')
|
37
|
+
|
38
|
+
last_mail = Mail::TestMailer.deliveries.last
|
39
|
+
|
40
|
+
expect(last_mail.to_s).to include("GET", "blow", "request.ip", "HTTP_", "TharSheBlows")
|
41
|
+
end
|
42
|
+
end
|
data/utopia.gemspec
CHANGED
@@ -25,11 +25,11 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.required_ruby_version = '~> 2.0'
|
26
26
|
|
27
27
|
spec.add_dependency 'trenni', '~> 1.6'
|
28
|
-
spec.add_dependency 'mime-types',
|
28
|
+
spec.add_dependency 'mime-types', '~> 3.0'
|
29
29
|
|
30
30
|
spec.add_dependency 'samovar', '~> 1.1'
|
31
31
|
|
32
|
-
spec.add_dependency 'rack', '~>
|
32
|
+
spec.add_dependency 'rack', '~> 2.0'
|
33
33
|
|
34
34
|
spec.add_dependency 'http-accept', '~> 1.4'
|
35
35
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: utopia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trenni
|
@@ -28,22 +28,16 @@ dependencies:
|
|
28
28
|
name: mime-types
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '2.0'
|
34
|
-
- - "<"
|
31
|
+
- - "~>"
|
35
32
|
- !ruby/object:Gem::Version
|
36
|
-
version: '
|
33
|
+
version: '3.0'
|
37
34
|
type: :runtime
|
38
35
|
prerelease: false
|
39
36
|
version_requirements: !ruby/object:Gem::Requirement
|
40
37
|
requirements:
|
41
|
-
- - "
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: '2.0'
|
44
|
-
- - "<"
|
38
|
+
- - "~>"
|
45
39
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
40
|
+
version: '3.0'
|
47
41
|
- !ruby/object:Gem::Dependency
|
48
42
|
name: samovar
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -64,14 +58,14 @@ dependencies:
|
|
64
58
|
requirements:
|
65
59
|
- - "~>"
|
66
60
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
61
|
+
version: '2.0'
|
68
62
|
type: :runtime
|
69
63
|
prerelease: false
|
70
64
|
version_requirements: !ruby/object:Gem::Requirement
|
71
65
|
requirements:
|
72
66
|
- - "~>"
|
73
67
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
68
|
+
version: '2.0'
|
75
69
|
- !ruby/object:Gem::Dependency
|
76
70
|
name: http-accept
|
77
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -311,6 +305,8 @@ files:
|
|
311
305
|
- spec/utopia/exceptions/handler_spec.rb
|
312
306
|
- spec/utopia/exceptions/handler_spec.ru
|
313
307
|
- spec/utopia/exceptions/handler_spec/controller.rb
|
308
|
+
- spec/utopia/exceptions/mailer_spec.rb
|
309
|
+
- spec/utopia/exceptions/mailer_spec.ru
|
314
310
|
- spec/utopia/extensions_spec.rb
|
315
311
|
- spec/utopia/http/status_spec.rb
|
316
312
|
- spec/utopia/locale_spec.rb
|
@@ -426,6 +422,8 @@ test_files:
|
|
426
422
|
- spec/utopia/exceptions/handler_spec.rb
|
427
423
|
- spec/utopia/exceptions/handler_spec.ru
|
428
424
|
- spec/utopia/exceptions/handler_spec/controller.rb
|
425
|
+
- spec/utopia/exceptions/mailer_spec.rb
|
426
|
+
- spec/utopia/exceptions/mailer_spec.ru
|
429
427
|
- spec/utopia/extensions_spec.rb
|
430
428
|
- spec/utopia/http/status_spec.rb
|
431
429
|
- spec/utopia/locale_spec.rb
|