tzispa_helpers 0.1.7 → 0.1.8
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 +3 -0
- data/lib/tzispa/helpers/error_view.rb +46 -0
- data/lib/tzispa/helpers/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7246f7e42a315b2700166638e8c0d32a19ea825a
|
4
|
+
data.tar.gz: 98267d92dbd04420d0b26bce1970be58828cd860
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1e3e29f99766414cf726c14cd94944d7fa054f4c41046b91606c443d0afaf7c3d27b2d868142f9c842bf7e4c49bff2ab00b5ce1b9e98797524b41e462c1ff81
|
7
|
+
data.tar.gz: f5e3f0109818213be35a1122b4dc559ff3ebe5f20a23a084fe1ccd83a0d3f558b527ffd62b2a3b8bd55abe0c6b173d010ee512edb9e498905b57b583bb920a16
|
data/CHANGELOG.md
CHANGED
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'tzispa/rig/template'
|
2
|
+
|
3
|
+
|
4
|
+
module Tzispa
|
5
|
+
module Helpers
|
6
|
+
module ErrorView
|
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>'
|
23
|
+
end
|
24
|
+
|
25
|
+
def error_page(status, domain)
|
26
|
+
begin
|
27
|
+
error_file = "#{domain.path}/error/#{status}.htm"
|
28
|
+
Tzispa::Rig::File.new(error_file).load!.content
|
29
|
+
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>'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
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.8
|
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-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mail
|
@@ -105,6 +105,7 @@ files:
|
|
105
105
|
- README.md
|
106
106
|
- lib/tzispa/helpers.rb
|
107
107
|
- lib/tzispa/helpers/crawler.rb
|
108
|
+
- lib/tzispa/helpers/error_view.rb
|
108
109
|
- lib/tzispa/helpers/hash_trans.rb
|
109
110
|
- lib/tzispa/helpers/html.rb
|
110
111
|
- lib/tzispa/helpers/mail.rb
|