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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a4f118b111a6205bde23daf92b97693d4e6796dc
4
- data.tar.gz: 2fd98fcf04663dafd87d72be8a42dcacbf3d3c8e
3
+ metadata.gz: 3390ed8d54ee8c008436db759edf55d1ed597125
4
+ data.tar.gz: 400382f8bd1cf1cc415f1807b41b131a66b93cc1
5
5
  SHA512:
6
- metadata.gz: 561fbf74c3e86c603d7c6736fcd23649ff4bb199c45f2f892ace98a05df60bf055bdbba2b1f587adc8bac95a679e1a66e7eface0eead21448a68087a19211e4d
7
- data.tar.gz: d1e5927b49bd60c593c18cfd6907d72e3f9d50b47a2e4b86b6a91ce9b87e627f24d8a1c49f6435e6bb7fabc7747a058a4876fbf6b3485925d16b845b064b0773
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 = [:ip, :referrer, :path, :user_agent]
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.byte_ranges(env, size)
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})"
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Utopia
22
- VERSION = "1.6.13"
22
+ VERSION = "1.7.1"
23
23
  end
@@ -21,7 +21,9 @@
21
21
  # THE SOFTWARE.
22
22
 
23
23
  require_relative '../rack_helper'
24
+
24
25
  require 'utopia/exceptions'
26
+ require 'utopia/controller'
25
27
 
26
28
  RSpec.describe Utopia::Exceptions::Handler do
27
29
  include_context "rack app", File.expand_path("handler_spec.ru", __dir__)
@@ -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
@@ -0,0 +1,6 @@
1
+
2
+ use Utopia::Exceptions::Mailer, delivery_method: :test, from: 'test@localhost'
3
+
4
+ use Utopia::Controller, root: File.expand_path('handler_spec', __dir__)
5
+
6
+ run lambda {|env| [404, {}, []]}
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', ['>= 2.0', '< 4']
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', '~> 1.6'
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.6.13
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-07-23 00:00:00.000000000 Z
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: '4'
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: '4'
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: '1.6'
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: '1.6'
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