tzispa_helpers 0.1.10 → 0.1.11

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: 39ea40159bea483493eb49b8615a5467ec65b9ce
4
- data.tar.gz: d761108f0ba8f8f0c7ed451e394fe250f44414a3
3
+ metadata.gz: 29e3999c270e9035fee0521a2e7833292e3c974c
4
+ data.tar.gz: ba7a69a3d72d4e5a6ac465ffe4ba117b957be07e
5
5
  SHA512:
6
- metadata.gz: fb7e3ed6b2e523b09ea712a375b0df0684ba46d756d5805249228fe1157716a9c9db312599b4e68d560c630226cd687ae6f85d2e9b5cb40620594b427d5159d4
7
- data.tar.gz: 9d06b3d38f8569a4dd8273cca75294ba41e5bcb2068b28294493c8ca0eec4426f552a566218642429050ac80a7ff402c984e0e593884e475db77b1a365ab49cd
6
+ metadata.gz: 478db8c64ddf702eadb4615c8411d7ff1cf3bb6a63a5bb935a967a39071ffa0f1f04027a9ff696669075766325d48aae76e18adce92b3597c3af91dae3bc5819
7
+ data.tar.gz: b8d3bd9d9df9141f6f29b49d7ab70d2c4846d062247b0dc6ffaaadf06acf980be4638bee561abed8434dd7b216048b3ec795e4db703bf7fbff577429e665cb34
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  Tzispa Helpers
2
2
 
3
+ ## v0.1.11
4
+ - in error_view module rename error_report to debug_info
5
+ - add support for http/2 in redirect
6
+
3
7
  ## v0.1.10
4
8
  - response class add absolute parameter in redirect method
5
9
 
@@ -1,25 +1,27 @@
1
+ require 'tzispa'
1
2
  require 'tzispa/rig/template'
2
3
 
3
-
4
4
  module Tzispa
5
5
  module Helpers
6
6
  module ErrorView
7
7
 
8
- def error_report(error=nil)
9
- text = String.new('<!DOCTYPE html>')
10
- text << '<html lang="es"><head>'
11
- text << '<meta charset="utf-8" />'
12
- text << '<style> html {background:#cccccc; font-family:Arial; font-size:15px; color:#555;} body {width:75%; max-width:1200px; margin:18px auto; background:#fff; border-radius:6px; padding:32px 24px;} ul{list-style:none; margin:0; padding:0;} li{font-style:italic; color:#666;} h1 {color:#2ECC71;} </style>'
13
- text << '</head><body>'
14
- text << "<h5>#{Tzispa::FRAMEWORK_NAME} #{Tzispa::VERSION}</h5>\n"
15
- if error
16
- text << "<h1>#{error.class.name}</h1><h3>#{error.message}</h1>\n"
17
- text << '<ol>' + error.backtrace.map { |trace| "<li>#{trace}</li>\n" }.join + '</ol>' if error.respond_to?(:backtrace) && error.backtrace
18
- else
19
- text << "<h1>Error 500</h1>\n"
20
- text << "Se ha producido un error inesperado al tramitar la petición"
21
- end
22
- text << '</body></html>'
8
+ def debug_info(exception=nil, status: 500)
9
+ String.new.tap { |text|
10
+ text << '<!DOCTYPE html>'
11
+ text << '<html lang="es"><head>'
12
+ text << '<meta charset="utf-8" />'
13
+ text << '<style> html {background:#cccccc; font-family:Arial; font-size:15px; color:#555;} body {width:75%; max-width:1200px; margin:18px auto; background:#fff; border-radius:6px; padding:32px 24px;} ul{list-style:none; margin:0; padding:0;} li{font-style:italic; color:#666;} h1 {color:#2ECC71;} </style>'
14
+ text << '</head><body>'
15
+ text << "<h5>#{Tzispa::FRAMEWORK_NAME} #{Tzispa::VERSION}</h5>\n"
16
+ if exception
17
+ text << "<h1>#{exception.class.name}</h1><h3>#{exception.message}</h1>\n"
18
+ text << '<ol>' + exception.backtrace.map { |trace| "<li>#{trace}</li>\n" }.join + '</ol>' if exception.respond_to?(:backtrace) && exception.backtrace
19
+ else
20
+ text << "<h1>Error #{status}</h1>\n"
21
+ text << "Se ha producido un error inesperado al tramitar la petición"
22
+ end
23
+ text << '</body></html>'
24
+ }
23
25
  end
24
26
 
25
27
  def error_page(domain, status: 500)
@@ -27,16 +29,18 @@ module Tzispa
27
29
  error_file = "#{domain.path}/error/#{status}.htm"
28
30
  Tzispa::Rig::File.new(error_file).load!.content
29
31
  rescue
30
- text = String.new('<!DOCTYPE html>')
31
- text << '<html lang="es"><head>'
32
- text << '<meta charset="utf-8" />'
33
- text << '<style> html {background:#cccccc; font-family:Arial; font-size:15px; color:#555;} body {width:75%; max-width:1200px; margin:18px auto; background:#fff; border-radius:6px; padding:32px 24px;} #main {margin:auto; } h1 {color:#2ECC71; font-size:4em; text-align:center;} </style>'
34
- text << '</head><body>'
35
- text << '<div id="main">'
36
- text << "<h5>#{Tzispa::FRAMEWORK_NAME} #{Tzispa::VERSION}</h5>\n"
37
- text << "<h1>Error #{status}</h1>\n"
38
- text << '</div>'
39
- text << '</body></html>'
32
+ String.new.tap { |text|
33
+ text << '<!DOCTYPE html>'
34
+ text << '<html lang="es"><head>'
35
+ text << '<meta charset="utf-8" />'
36
+ text << '<style> html {background:#cccccc; font-family:Arial; font-size:15px; color:#555;} body {width:75%; max-width:1200px; margin:18px auto; background:#fff; border-radius:6px; padding:32px 24px;} #main {margin:auto; } h1 {color:#2ECC71; font-size:4em; text-align:center;} </style>'
37
+ text << '</head><body>'
38
+ text << '<div id="main">'
39
+ text << "<h5>#{Tzispa::FRAMEWORK_NAME} #{Tzispa::VERSION}</h5>\n"
40
+ text << "<h1>Error #{status}</h1>\n"
41
+ text << '</div>'
42
+ text << '</body></html>'
43
+ }
40
44
  end
41
45
  end
42
46
 
@@ -42,7 +42,7 @@ module Tzispa
42
42
 
43
43
  # Halt processing and redirect to the URI provided.
44
44
  def redirect(uri, absolute, *args)
45
- if env['HTTP_VERSION'] == 'HTTP/1.1' and env["REQUEST_METHOD"] != 'GET'
45
+ if (env['HTTP_VERSION'] == 'HTTP/1.1' || env['HTTP_VERSION'] == 'HTTP/2.0') && env["REQUEST_METHOD"] != 'GET'
46
46
  status 303
47
47
  else
48
48
  status 302
@@ -3,7 +3,7 @@
3
3
  module Tzispa
4
4
  module Helpers
5
5
 
6
- VERSION = '0.1.10'
6
+ VERSION = '0.1.11'
7
7
  NAME = 'Tzispa Helpers'
8
8
  GEM_NAME = 'tzispa_helpers'
9
9
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tzispa_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Antonio Piñero
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-18 00:00:00.000000000 Z
11
+ date: 2016-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mail