wunderbar 1.0.12 → 1.0.13
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/lib/wunderbar/cgi-methods.rb +5 -5
- data/lib/wunderbar/environment.rb +27 -0
- data/lib/wunderbar/polymer.rb +1 -1
- data/lib/wunderbar/script.rb +4 -4
- data/lib/wunderbar/sinatra.rb +3 -3
- data/lib/wunderbar/version.rb +1 -1
- data/wunderbar.gemspec +2 -2
- 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: cb5b1e488c39649096635f0d794283d15bd94da6
|
4
|
+
data.tar.gz: 330d0001b28b0fdb38dd5077ce240e80ce993f08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00cfc80008a5c687ed7ef832c5c3bfa21fe821d210b4136fe8197915ac7e86d6e4f15b7567fd9c4d4018ca46be6f442249f59f59ebc14f1b14f87d6982fa0591
|
7
|
+
data.tar.gz: cdbc2207899c4ecc6197cb1fb6115b272a16230ced7725eeeaf4c14cdf81f4f994675849849e65e6963de985f01d45761b6ae05d11f488926aadd776a2e2b9c4
|
@@ -9,9 +9,9 @@ module Wunderbar
|
|
9
9
|
'Cache-Control' => 'no-cache' }
|
10
10
|
builder = JsonBuilder.new(scope)
|
11
11
|
output = builder.encode(&block)
|
12
|
-
headers['status'] =
|
12
|
+
headers['status'] = "404 Not Found" if output == {}
|
13
13
|
rescue Exception => exception
|
14
|
-
headers['status'] =
|
14
|
+
headers['status'] = Wunderbar::ServerError.text
|
15
15
|
builder._! Hash.new unless builder.target? Hash
|
16
16
|
builder._exception exception
|
17
17
|
ensure
|
@@ -23,9 +23,9 @@ module Wunderbar
|
|
23
23
|
headers = {'type' => 'text/plain', 'charset' => 'UTF-8'}
|
24
24
|
builder = TextBuilder.new(scope)
|
25
25
|
output = builder.encode(&block)
|
26
|
-
headers['status'] =
|
26
|
+
headers['status'] = "404 Not Found" if output == ''
|
27
27
|
rescue Exception => exception
|
28
|
-
headers['status'] =
|
28
|
+
headers['status'] = Wunderbar::ServerError.text
|
29
29
|
builder._exception exception
|
30
30
|
ensure
|
31
31
|
out?(scope, headers) { builder.target! }
|
@@ -101,7 +101,7 @@ module Wunderbar
|
|
101
101
|
output = x.html *args, &block
|
102
102
|
end
|
103
103
|
rescue ::Exception => exception
|
104
|
-
headers['status'] =
|
104
|
+
headers['status'] = Wunderbar::ServerError.text
|
105
105
|
x.clear!
|
106
106
|
output = x.html(*args) do
|
107
107
|
_h1 'Internal Server Error'
|
@@ -75,6 +75,33 @@ module Wunderbar
|
|
75
75
|
Wunderbar.templates[name.to_s.gsub('_','-')] = block
|
76
76
|
end
|
77
77
|
end
|
78
|
+
|
79
|
+
#
|
80
|
+
# Some proxies will replace server errors with their own output, and
|
81
|
+
# some applications will want to indicate that there is useful, parseable,
|
82
|
+
# content in controlled failures. For this reason, allow the server
|
83
|
+
# error responses to be customized by the application.
|
84
|
+
#
|
85
|
+
module ServerError
|
86
|
+
@@status = 500
|
87
|
+
@@text = 'Internal Server Error'
|
88
|
+
|
89
|
+
def self.status=(status)
|
90
|
+
@@status = status
|
91
|
+
end
|
92
|
+
|
93
|
+
def self.text=(text)
|
94
|
+
@@text = text
|
95
|
+
end
|
96
|
+
|
97
|
+
def self.status
|
98
|
+
@@status
|
99
|
+
end
|
100
|
+
|
101
|
+
def self.text
|
102
|
+
"#{@@status} #{@@text}"
|
103
|
+
end
|
104
|
+
end
|
78
105
|
end
|
79
106
|
|
80
107
|
require 'socket'
|
data/lib/wunderbar/polymer.rb
CHANGED
@@ -31,7 +31,7 @@ if self.to_s == 'main'
|
|
31
31
|
end
|
32
32
|
output = element.serialize.join("\n") + "\n"
|
33
33
|
rescue ::Exception => exception
|
34
|
-
headers['status'] =
|
34
|
+
headers['status'] = Wunderbar::ServerError.text
|
35
35
|
x.clear!
|
36
36
|
output = x.html(*args) do
|
37
37
|
_h1 'Internal Server Error'
|
data/lib/wunderbar/script.rb
CHANGED
@@ -58,12 +58,12 @@ module Wunderbar
|
|
58
58
|
begin
|
59
59
|
output = Ruby2JS.convert(block) + "\n"
|
60
60
|
rescue Parser::SyntaxError => exception
|
61
|
-
headers['status'] =
|
61
|
+
headers['status'] = Wunderbar::ServerError.text
|
62
62
|
location = exception.diagnostic.location
|
63
63
|
output = "// Syntax Error: line #{location.line}, " +
|
64
64
|
"column: #{location.column}\n#{exception}\n"
|
65
65
|
rescue ::Exception => exception
|
66
|
-
headers['status'] =
|
66
|
+
headers['status'] = Wunderbar::ServerError.text
|
67
67
|
output = "// Internal Server Error: #{exception}\n"
|
68
68
|
exception.backtrace.each do |frame|
|
69
69
|
next if CALLERS_TO_IGNORE.any? {|re| frame =~ re}
|
@@ -85,12 +85,12 @@ module Wunderbar
|
|
85
85
|
begin
|
86
86
|
Ruby2JS.convert(block ? block : data, ivars: locals, file: file).to_s
|
87
87
|
rescue Parser::SyntaxError => exception
|
88
|
-
scope.response.status =
|
88
|
+
scope.response.status = Wunderbar::ServerError.status
|
89
89
|
location = exception.diagnostic.location
|
90
90
|
"Syntax Error: line #{location.line}, column: #{location.column}" +
|
91
91
|
"\n#{exception}\n"
|
92
92
|
rescue Exception => exception
|
93
|
-
scope.response.status =
|
93
|
+
scope.response.status = Wunderbar::ServerError.status
|
94
94
|
output = "Internal Server Error: #{exception}\n"
|
95
95
|
exception.backtrace.each do |frame|
|
96
96
|
next if CALLERS_TO_IGNORE.any? {|re| frame =~ re}
|
data/lib/wunderbar/sinatra.rb
CHANGED
@@ -110,7 +110,7 @@ module Wunderbar
|
|
110
110
|
begin
|
111
111
|
_evaluate_safely(builder, scope, locals, &block)
|
112
112
|
rescue Exception => exception
|
113
|
-
scope.response.status =
|
113
|
+
scope.response.status = Wunderbar::ServerError.status
|
114
114
|
builder.clear!
|
115
115
|
builder.html do
|
116
116
|
_h1 'Internal Server Error'
|
@@ -139,7 +139,7 @@ module Wunderbar
|
|
139
139
|
|
140
140
|
rescue Exception => exception
|
141
141
|
scope.content_type self.class.default_mime_type, :charset => 'utf-8'
|
142
|
-
scope.response.status =
|
142
|
+
scope.response.status = Wunderbar::ServerError.status
|
143
143
|
builder._exception exception
|
144
144
|
end
|
145
145
|
scope.cache_control :no_cache
|
@@ -162,7 +162,7 @@ module Wunderbar
|
|
162
162
|
scope.response.status = 404 if builder.target!.empty?
|
163
163
|
rescue Exception => exception
|
164
164
|
scope.headers['Content-Type'] = self.class.default_mime_type
|
165
|
-
scope.response.status =
|
165
|
+
scope.response.status = Wunderbar::ServerError.status
|
166
166
|
builder._exception exception
|
167
167
|
end
|
168
168
|
builder.target!
|
data/lib/wunderbar/version.rb
CHANGED
data/wunderbar.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "wunderbar"
|
5
|
-
s.version = "1.0.
|
5
|
+
s.version = "1.0.13"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Sam Ruby"]
|
9
|
-
s.date = "2016-01-
|
9
|
+
s.date = "2016-01-12"
|
10
10
|
s.description = " Wunderbar makes it easy to produce valid HTML5, wellformed XHTML, Unicode\n (utf-8), consistently indented, readable applications.'\n"
|
11
11
|
s.email = "rubys@intertwingly.net"
|
12
12
|
s.files = ["wunderbar.gemspec", "README.md", "COPYING", "lib/wunderbar", "lib/wunderbar/angularjs", "lib/wunderbar/angularjs/resource.rb", "lib/wunderbar/angularjs/route.rb", "lib/wunderbar/angularjs.rb", "lib/wunderbar/asset.rb", "lib/wunderbar/backtick.rb", "lib/wunderbar/bootstrap", "lib/wunderbar/bootstrap/theme.rb", "lib/wunderbar/bootstrap.rb", "lib/wunderbar/builder.rb", "lib/wunderbar/cgi-methods.rb", "lib/wunderbar/coderay.rb", "lib/wunderbar/coffeescript.rb", "lib/wunderbar/cssproxy.rb", "lib/wunderbar/environment.rb", "lib/wunderbar/eventsource.rb", "lib/wunderbar/html-methods.rb", "lib/wunderbar/installation.rb", "lib/wunderbar/job-control.rb", "lib/wunderbar/jquery", "lib/wunderbar/jquery/filter.rb", "lib/wunderbar/jquery/stupidtable.rb", "lib/wunderbar/jquery.rb", "lib/wunderbar/listen.rb", "lib/wunderbar/logger.rb", "lib/wunderbar/markdown.rb", "lib/wunderbar/marked.rb", "lib/wunderbar/node.rb", "lib/wunderbar/pagedown.rb", "lib/wunderbar/polymer.rb", "lib/wunderbar/rack.rb", "lib/wunderbar/rails.rb", "lib/wunderbar/react.rb", "lib/wunderbar/script.rb", "lib/wunderbar/server.rb", "lib/wunderbar/sinatra.rb", "lib/wunderbar/underscore.rb", "lib/wunderbar/vendor", "lib/wunderbar/vendor/angular-resource.min.js", "lib/wunderbar/vendor/angular-route.min.js", "lib/wunderbar/vendor/angular.min.js", "lib/wunderbar/vendor/bootstrap-theme.min.css", "lib/wunderbar/vendor/bootstrap.min.css", "lib/wunderbar/vendor/bootstrap.min.js", "lib/wunderbar/vendor/eventsource.min.js", "lib/wunderbar/vendor/jquery-1.11.2.min.js", "lib/wunderbar/vendor/Markdown.Converter.js", "lib/wunderbar/vendor/marked.min.js", "lib/wunderbar/vendor/polymer-v0.0.20131003.min.js", "lib/wunderbar/vendor/react-dom-0.14.3.min.js", "lib/wunderbar/vendor/react-with-addons-0.14.3.min.js", "lib/wunderbar/vendor/stupidtable.min.js", "lib/wunderbar/vendor/underscore-min.js", "lib/wunderbar/version.rb", "lib/wunderbar/websocket.rb", "lib/wunderbar.rb"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wunderbar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Ruby
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|