tzispa_helpers 0.1.10 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/tzispa/helpers/error_view.rb +30 -26
- data/lib/tzispa/helpers/response.rb +1 -1
- data/lib/tzispa/helpers/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29e3999c270e9035fee0521a2e7833292e3c974c
|
4
|
+
data.tar.gz: ba7a69a3d72d4e5a6ac465ffe4ba117b957be07e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 478db8c64ddf702eadb4615c8411d7ff1cf3bb6a63a5bb935a967a39071ffa0f1f04027a9ff696669075766325d48aae76e18adce92b3597c3af91dae3bc5819
|
7
|
+
data.tar.gz: b8d3bd9d9df9141f6f29b49d7ab70d2c4846d062247b0dc6ffaaadf06acf980be4638bee561abed8434dd7b216048b3ec795e4db703bf7fbff577429e665cb34
|
data/CHANGELOG.md
CHANGED
@@ -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
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
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
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
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'
|
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
|
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.
|
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-
|
11
|
+
date: 2016-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mail
|