better_errors 2.10.0.beta1 → 2.10.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +5 -1
- data/.gitignore +4 -0
- data/better_errors.gemspec +5 -4
- data/lib/better_errors.rb +0 -1
- data/lib/better_errors/code_formatter.rb +16 -27
- data/lib/better_errors/code_formatter/html.rb +15 -1
- data/lib/better_errors/error_page.rb +3 -1
- data/lib/better_errors/error_page_style.rb +30 -0
- data/lib/better_errors/middleware.rb +2 -2
- data/lib/better_errors/templates/main.erb +3 -723
- data/lib/better_errors/version.rb +2 -1
- metadata +19 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0902382bac90f4d54634a19663ed03b7aa6d64edd17002f3329c895e2b2784d
|
4
|
+
data.tar.gz: 6228791b815616739067a11405f18b041cf6d21c19013bcbaaf34a1b1bcdfa85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc552c327ab6230dae1fea0100c5fe8a20f9bfc6e63b245ac2eb221cf17d01531ec3ae46ea0b1545881476739d725a0723eacf9448c8a368fc9b7f4eedd8e24f
|
7
|
+
data.tar.gz: ce04e4dd447ff7e789f19d8a0d1cefa8b63e2e00cf3f81321877da3dd343df8a6cb5bc17a09fe21bfaba093900dc2ae41520941ad323d3b96a859c2a0cc023e4
|
@@ -48,10 +48,14 @@ jobs:
|
|
48
48
|
run: |
|
49
49
|
bundle exec gem bump better_errors --version ${{ steps.get_version.outputs.version }} --no-commit
|
50
50
|
|
51
|
+
- name: Compile CSS
|
52
|
+
run: |
|
53
|
+
bundle exec rake style:build
|
54
|
+
|
51
55
|
- name: Build gem
|
52
56
|
run: gem build better_errors.gemspec
|
53
57
|
|
54
|
-
- name:
|
58
|
+
- name: Add gem to GitHub Release
|
55
59
|
uses: actions/upload-release-asset@v1
|
56
60
|
env:
|
57
61
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
data/.gitignore
CHANGED
data/better_errors.gemspec
CHANGED
@@ -12,9 +12,9 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.homepage = "https://github.com/BetterErrors/better_errors"
|
13
13
|
s.license = "MIT"
|
14
14
|
|
15
|
-
s.files = `git ls-files -z`.split("\x0").reject
|
16
|
-
f.match(%r{^((test|spec|features|feature-screenshots)/|Rakefile)})
|
17
|
-
|
15
|
+
s.files = `git ls-files -z`.split("\x0").reject { |f|
|
16
|
+
f.match(%r{^((test|spec|features|feature-screenshots)/|Rakefile)|\.scss$})
|
17
|
+
} + %w[lib/better_errors/templates/main.css]
|
18
18
|
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
|
@@ -25,12 +25,13 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.add_development_dependency "rspec-html-matchers"
|
26
26
|
s.add_development_dependency "rspec-its"
|
27
27
|
s.add_development_dependency "yard"
|
28
|
+
s.add_development_dependency "sassc"
|
28
29
|
# kramdown 2.1 requires Ruby 2.3+
|
29
30
|
s.add_development_dependency "kramdown", (RUBY_VERSION < '2.3' ? '< 2.0.0' : '> 2.0.0')
|
30
31
|
# simplecov and coveralls must not be included here. See the Gemfiles instead.
|
31
32
|
|
32
33
|
s.add_dependency "erubi", ">= 1.0.0"
|
33
|
-
s.add_dependency "
|
34
|
+
s.add_dependency "rouge", ">= 1.0.0"
|
34
35
|
s.add_dependency "rack", ">= 0.9.0"
|
35
36
|
|
36
37
|
# optional dependencies:
|
data/lib/better_errors.rb
CHANGED
@@ -4,14 +4,6 @@ module BetterErrors
|
|
4
4
|
require "better_errors/code_formatter/html"
|
5
5
|
require "better_errors/code_formatter/text"
|
6
6
|
|
7
|
-
FILE_TYPES = {
|
8
|
-
".rb" => :ruby,
|
9
|
-
"" => :ruby,
|
10
|
-
".html" => :html,
|
11
|
-
".erb" => :erb,
|
12
|
-
".haml" => :haml
|
13
|
-
}
|
14
|
-
|
15
7
|
attr_reader :filename, :line, :context
|
16
8
|
|
17
9
|
def initialize(filename, line, context = 5)
|
@@ -26,13 +18,21 @@ module BetterErrors
|
|
26
18
|
source_unavailable
|
27
19
|
end
|
28
20
|
|
29
|
-
def
|
30
|
-
|
21
|
+
def line_range
|
22
|
+
min = [line - context, 1].max
|
23
|
+
max = [line + context, source_lines.count].min
|
24
|
+
min..max
|
31
25
|
end
|
32
26
|
|
33
|
-
def
|
34
|
-
|
35
|
-
|
27
|
+
def context_lines
|
28
|
+
range = line_range
|
29
|
+
source_lines[(range.begin - 1)..(range.end - 1)] or raise Errno::EINVAL
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def formatted_code
|
35
|
+
formatted_lines.join
|
36
36
|
end
|
37
37
|
|
38
38
|
def each_line_of(lines, &blk)
|
@@ -41,23 +41,12 @@ module BetterErrors
|
|
41
41
|
}
|
42
42
|
end
|
43
43
|
|
44
|
-
def
|
45
|
-
|
46
|
-
end
|
47
|
-
|
48
|
-
def context_lines
|
49
|
-
range = line_range
|
50
|
-
source_lines[(range.begin - 1)..(range.end - 1)] or raise Errno::EINVAL
|
44
|
+
def source
|
45
|
+
@source ||= File.read(filename)
|
51
46
|
end
|
52
47
|
|
53
48
|
def source_lines
|
54
|
-
@source_lines ||=
|
55
|
-
end
|
56
|
-
|
57
|
-
def line_range
|
58
|
-
min = [line - context, 1].max
|
59
|
-
max = [line + context, source_lines.count].min
|
60
|
-
min..max
|
49
|
+
@source_lines ||= source.lines
|
61
50
|
end
|
62
51
|
end
|
63
52
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require "rouge"
|
2
|
+
|
1
3
|
module BetterErrors
|
2
4
|
# @private
|
3
5
|
class CodeFormatter::HTML < CodeFormatter
|
@@ -20,7 +22,19 @@ module BetterErrors
|
|
20
22
|
end
|
21
23
|
|
22
24
|
def formatted_code
|
23
|
-
%{
|
25
|
+
%{
|
26
|
+
<div class="code_linenums">#{formatted_nums.join}</div>
|
27
|
+
<div class="code"><div class='code-wrapper'>#{super}</div></div>
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def rouge_lexer
|
32
|
+
Rouge::Lexer.guess(filename: filename, source: source) { Rouge::Lexers::Ruby }
|
24
33
|
end
|
34
|
+
|
35
|
+
def highlighted_lines
|
36
|
+
Rouge::Formatters::HTML.new.format(rouge_lexer.lex(context_lines.join)).lines
|
37
|
+
end
|
38
|
+
|
25
39
|
end
|
26
40
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
require "cgi"
|
2
2
|
require "json"
|
3
3
|
require "securerandom"
|
4
|
+
require "rouge"
|
5
|
+
require "better_errors/error_page_style"
|
4
6
|
|
5
7
|
module BetterErrors
|
6
8
|
# @private
|
@@ -157,7 +159,7 @@ module BetterErrors
|
|
157
159
|
result, prompt, prefilled_input = @repls[index].send_input(code)
|
158
160
|
|
159
161
|
{
|
160
|
-
highlighted_input:
|
162
|
+
highlighted_input: Rouge::Formatters::HTML.new.format(Rouge::Lexers::Ruby.lex(code)),
|
161
163
|
prefilled_input: prefilled_input,
|
162
164
|
prompt: prompt,
|
163
165
|
result: result
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require "sassc"
|
2
|
+
|
3
|
+
module BetterErrors
|
4
|
+
# @private
|
5
|
+
module ErrorPageStyle
|
6
|
+
def self.compiled_css(for_deployment = false)
|
7
|
+
style_dir = File.expand_path("style", File.dirname(__FILE__))
|
8
|
+
style_file = "#{style_dir}/main.scss"
|
9
|
+
|
10
|
+
engine = SassC::Engine.new(
|
11
|
+
File.read(style_file),
|
12
|
+
filename: style_file,
|
13
|
+
style: for_deployment ? :compressed : :expanded,
|
14
|
+
line_comments: !for_deployment,
|
15
|
+
load_paths: [style_dir],
|
16
|
+
)
|
17
|
+
engine.render
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.style_tag(csp_nonce)
|
21
|
+
style_file = File.expand_path("templates/main.css", File.dirname(__FILE__))
|
22
|
+
css = if File.exist?(style_file)
|
23
|
+
File.open(style_file).read
|
24
|
+
else
|
25
|
+
compiled_css(false)
|
26
|
+
end
|
27
|
+
"<style type='text/css' nonce='#{csp_nonce}'>\n#{css}\n</style>"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -119,8 +119,8 @@ module BetterErrors
|
|
119
119
|
# for older browsers without nonce support.
|
120
120
|
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src
|
121
121
|
"script-src 'self' 'nonce-#{csp_nonce}' 'unsafe-inline'",
|
122
|
-
|
123
|
-
"
|
122
|
+
"style-src 'self' 'nonce-#{csp_nonce}' 'unsafe-inline'",
|
123
|
+
"img-src data:",
|
124
124
|
"connect-src 'self'",
|
125
125
|
"navigate-to 'self' #{BetterErrors.editor.scheme}",
|
126
126
|
].join('; '),
|
@@ -2,731 +2,11 @@
|
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<title><%= exception_type %> at <%= request_path %></title>
|
5
|
+
<link rel="icon" href="data:;base64,=" />
|
5
6
|
</head>
|
6
7
|
<body class="better-errors-javascript-not-loaded">
|
7
8
|
<%# Stylesheets are placed in the <body> for Turbolinks compatibility. %>
|
8
|
-
|
9
|
-
/* Basic reset */
|
10
|
-
* {
|
11
|
-
margin: 0;
|
12
|
-
padding: 0;
|
13
|
-
}
|
14
|
-
|
15
|
-
table {
|
16
|
-
width: 100%;
|
17
|
-
border-collapse: collapse;
|
18
|
-
}
|
19
|
-
|
20
|
-
th, td {
|
21
|
-
vertical-align: top;
|
22
|
-
text-align: left;
|
23
|
-
}
|
24
|
-
|
25
|
-
textarea {
|
26
|
-
resize: none;
|
27
|
-
}
|
28
|
-
|
29
|
-
body {
|
30
|
-
font-size: 10pt;
|
31
|
-
}
|
32
|
-
|
33
|
-
body, td, input, textarea {
|
34
|
-
font-family: helvetica neue, lucida grande, sans-serif;
|
35
|
-
line-height: 1.5;
|
36
|
-
color: #333;
|
37
|
-
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
|
38
|
-
}
|
39
|
-
|
40
|
-
html {
|
41
|
-
background: #f0f0f5;
|
42
|
-
}
|
43
|
-
|
44
|
-
.clearfix::after{
|
45
|
-
clear: both;
|
46
|
-
content: ".";
|
47
|
-
display: block;
|
48
|
-
height: 0;
|
49
|
-
visibility: hidden;
|
50
|
-
}
|
51
|
-
|
52
|
-
/* ---------------------------------------------------------------------
|
53
|
-
* Basic layout
|
54
|
-
* --------------------------------------------------------------------- */
|
55
|
-
|
56
|
-
/* Small */
|
57
|
-
@media screen and (max-width: 1100px) {
|
58
|
-
html {
|
59
|
-
overflow-y: scroll;
|
60
|
-
}
|
61
|
-
|
62
|
-
body {
|
63
|
-
margin: 0 20px;
|
64
|
-
}
|
65
|
-
|
66
|
-
header.exception {
|
67
|
-
margin: 0 -20px;
|
68
|
-
}
|
69
|
-
|
70
|
-
nav.sidebar {
|
71
|
-
padding: 0;
|
72
|
-
margin: 20px 0;
|
73
|
-
}
|
74
|
-
|
75
|
-
ul.frames {
|
76
|
-
max-height: 200px;
|
77
|
-
overflow: auto;
|
78
|
-
}
|
79
|
-
}
|
80
|
-
|
81
|
-
/* Wide */
|
82
|
-
@media screen and (min-width: 1100px) {
|
83
|
-
header.exception {
|
84
|
-
position: fixed;
|
85
|
-
top: 0;
|
86
|
-
left: 0;
|
87
|
-
right: 0;
|
88
|
-
}
|
89
|
-
|
90
|
-
nav.sidebar,
|
91
|
-
.frame_info {
|
92
|
-
position: fixed;
|
93
|
-
top: 102px;
|
94
|
-
bottom: 0;
|
95
|
-
|
96
|
-
box-sizing: border-box;
|
97
|
-
|
98
|
-
overflow-y: auto;
|
99
|
-
overflow-x: hidden;
|
100
|
-
}
|
101
|
-
|
102
|
-
nav.sidebar {
|
103
|
-
width: 40%;
|
104
|
-
left: 20px;
|
105
|
-
top: 122px;
|
106
|
-
bottom: 20px;
|
107
|
-
}
|
108
|
-
|
109
|
-
.frame_info {
|
110
|
-
display: none;
|
111
|
-
|
112
|
-
right: 0;
|
113
|
-
left: 40%;
|
114
|
-
|
115
|
-
padding: 20px;
|
116
|
-
padding-left: 10px;
|
117
|
-
margin-left: 30px;
|
118
|
-
}
|
119
|
-
.frame_info.current {
|
120
|
-
display: block;
|
121
|
-
}
|
122
|
-
}
|
123
|
-
|
124
|
-
nav.sidebar {
|
125
|
-
background: #d3d3da;
|
126
|
-
border-top: solid 3px #a33;
|
127
|
-
border-bottom: solid 3px #a33;
|
128
|
-
border-radius: 4px;
|
129
|
-
box-shadow: 0 0 6px rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(0, 0, 0, 0.1);
|
130
|
-
}
|
131
|
-
|
132
|
-
/* ---------------------------------------------------------------------
|
133
|
-
* Header
|
134
|
-
* --------------------------------------------------------------------- */
|
135
|
-
|
136
|
-
header.exception {
|
137
|
-
padding: 18px 20px;
|
138
|
-
|
139
|
-
height: 66px;
|
140
|
-
min-height: 59px;
|
141
|
-
|
142
|
-
overflow: hidden;
|
143
|
-
|
144
|
-
background-color: #20202a;
|
145
|
-
color: #aaa;
|
146
|
-
text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
|
147
|
-
font-weight: 200;
|
148
|
-
box-shadow: inset 0 -5px 3px -3px rgba(0, 0, 0, 0.05), inset 0 -1px 0 rgba(0, 0, 0, 0.05);
|
149
|
-
|
150
|
-
-webkit-text-smoothing: antialiased;
|
151
|
-
}
|
152
|
-
|
153
|
-
/* Heading */
|
154
|
-
header.exception .fix-actions {
|
155
|
-
margin-top: .5em;
|
156
|
-
}
|
157
|
-
|
158
|
-
header.exception .fix-actions input[type=submit] {
|
159
|
-
font-weight: bold;
|
160
|
-
}
|
161
|
-
|
162
|
-
header.exception h2 {
|
163
|
-
font-weight: 200;
|
164
|
-
font-size: 11pt;
|
165
|
-
}
|
166
|
-
|
167
|
-
header.exception h2,
|
168
|
-
header.exception p {
|
169
|
-
line-height: 1.5em;
|
170
|
-
overflow: hidden;
|
171
|
-
white-space: pre;
|
172
|
-
text-overflow: ellipsis;
|
173
|
-
}
|
174
|
-
|
175
|
-
header.exception h2 strong {
|
176
|
-
font-weight: 700;
|
177
|
-
color: #d55;
|
178
|
-
}
|
179
|
-
|
180
|
-
header.exception p {
|
181
|
-
font-weight: 200;
|
182
|
-
font-size: 17pt;
|
183
|
-
color: white;
|
184
|
-
}
|
185
|
-
|
186
|
-
header.exception:hover {
|
187
|
-
height: auto;
|
188
|
-
z-index: 2;
|
189
|
-
}
|
190
|
-
|
191
|
-
header.exception:hover h2,
|
192
|
-
header.exception:hover p {
|
193
|
-
padding-right: 20px;
|
194
|
-
overflow-y: auto;
|
195
|
-
word-wrap: break-word;
|
196
|
-
white-space: pre-wrap;
|
197
|
-
height: auto;
|
198
|
-
max-height: 7.5em;
|
199
|
-
}
|
200
|
-
|
201
|
-
@media screen and (max-width: 1100px) {
|
202
|
-
header.exception {
|
203
|
-
height: auto;
|
204
|
-
}
|
205
|
-
|
206
|
-
header.exception h2,
|
207
|
-
header.exception p {
|
208
|
-
padding-right: 20px;
|
209
|
-
overflow-y: auto;
|
210
|
-
word-wrap: break-word;
|
211
|
-
height: auto;
|
212
|
-
max-height: 7em;
|
213
|
-
}
|
214
|
-
}
|
215
|
-
|
216
|
-
<%#
|
217
|
-
/* Light theme */
|
218
|
-
header.exception {
|
219
|
-
text-shadow: 0 1px 0 rgba(250, 250, 250, 0.6);
|
220
|
-
background: rgba(200,100,50,0.10);
|
221
|
-
color: #977;
|
222
|
-
}
|
223
|
-
header.exception h2 strong {
|
224
|
-
color: #533;
|
225
|
-
}
|
226
|
-
header.exception p {
|
227
|
-
color: #744;
|
228
|
-
}
|
229
|
-
%>
|
230
|
-
|
231
|
-
/* ---------------------------------------------------------------------
|
232
|
-
* Navigation
|
233
|
-
* --------------------------------------------------------------------- */
|
234
|
-
|
235
|
-
.better-errors-javascript-not-loaded .backtrace .tabs {
|
236
|
-
display: none;
|
237
|
-
}
|
238
|
-
|
239
|
-
nav.tabs {
|
240
|
-
border-bottom: solid 1px #ddd;
|
241
|
-
|
242
|
-
background-color: #eee;
|
243
|
-
text-align: center;
|
244
|
-
|
245
|
-
padding: 6px;
|
246
|
-
|
247
|
-
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
|
248
|
-
}
|
249
|
-
|
250
|
-
nav.tabs a {
|
251
|
-
display: inline-block;
|
252
|
-
|
253
|
-
height: 22px;
|
254
|
-
line-height: 22px;
|
255
|
-
padding: 0 10px;
|
256
|
-
|
257
|
-
text-decoration: none;
|
258
|
-
font-size: 8pt;
|
259
|
-
font-weight: bold;
|
260
|
-
|
261
|
-
color: #999;
|
262
|
-
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
|
263
|
-
}
|
264
|
-
|
265
|
-
nav.tabs a.selected {
|
266
|
-
color: white;
|
267
|
-
background: rgba(0, 0, 0, 0.5);
|
268
|
-
border-radius: 16px;
|
269
|
-
box-shadow: 1px 1px 0 rgba(255, 255, 255, 0.1);
|
270
|
-
text-shadow: 0 0 4px rgba(0, 0, 0, 0.4), 0 1px 0 rgba(0, 0, 0, 0.4);
|
271
|
-
}
|
272
|
-
|
273
|
-
nav.tabs a.disabled {
|
274
|
-
text-decoration: line-through;
|
275
|
-
text-shadow: none;
|
276
|
-
cursor: default;
|
277
|
-
}
|
278
|
-
|
279
|
-
/* ---------------------------------------------------------------------
|
280
|
-
* Sidebar
|
281
|
-
* --------------------------------------------------------------------- */
|
282
|
-
|
283
|
-
ul.frames {
|
284
|
-
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
285
|
-
}
|
286
|
-
|
287
|
-
/* Each item */
|
288
|
-
ul.frames li {
|
289
|
-
background-color: #f8f8f8;
|
290
|
-
background: -webkit-linear-gradient(top, #f8f8f8 80%, #f0f0f0);
|
291
|
-
background: -moz-linear-gradient(top, #f8f8f8 80%, #f0f0f0);
|
292
|
-
background: linear-gradient(top, #f8f8f8 80%, #f0f0f0);
|
293
|
-
box-shadow: inset 0 -1px 0 #e2e2e2;
|
294
|
-
padding: 7px 20px;
|
295
|
-
|
296
|
-
cursor: pointer;
|
297
|
-
overflow: hidden;
|
298
|
-
}
|
299
|
-
|
300
|
-
ul.frames .name,
|
301
|
-
ul.frames .location {
|
302
|
-
overflow: hidden;
|
303
|
-
height: 1.5em;
|
304
|
-
|
305
|
-
white-space: nowrap;
|
306
|
-
word-wrap: none;
|
307
|
-
text-overflow: ellipsis;
|
308
|
-
}
|
309
|
-
|
310
|
-
ul.frames .method {
|
311
|
-
color: #966;
|
312
|
-
}
|
313
|
-
|
314
|
-
ul.frames .location {
|
315
|
-
font-size: 0.85em;
|
316
|
-
font-weight: 400;
|
317
|
-
color: #999;
|
318
|
-
}
|
319
|
-
|
320
|
-
ul.frames .line {
|
321
|
-
font-weight: bold;
|
322
|
-
}
|
323
|
-
|
324
|
-
/* Selected frame */
|
325
|
-
ul.frames li.selected {
|
326
|
-
background: #38a;
|
327
|
-
box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.1), inset 0 2px 0 rgba(255, 255, 255, 0.01), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
|
328
|
-
}
|
329
|
-
|
330
|
-
ul.frames li.selected .name,
|
331
|
-
ul.frames li.selected .method,
|
332
|
-
ul.frames li.selected .location {
|
333
|
-
color: white;
|
334
|
-
text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
|
335
|
-
}
|
336
|
-
|
337
|
-
ul.frames li.selected .location {
|
338
|
-
opacity: 0.6;
|
339
|
-
}
|
340
|
-
|
341
|
-
/* Iconography */
|
342
|
-
ul.frames li {
|
343
|
-
padding-left: 60px;
|
344
|
-
position: relative;
|
345
|
-
}
|
346
|
-
|
347
|
-
ul.frames li .icon {
|
348
|
-
display: block;
|
349
|
-
width: 20px;
|
350
|
-
height: 20px;
|
351
|
-
line-height: 20px;
|
352
|
-
border-radius: 15px;
|
353
|
-
|
354
|
-
text-align: center;
|
355
|
-
|
356
|
-
background: white;
|
357
|
-
border: solid 2px #ccc;
|
358
|
-
|
359
|
-
font-size: 9pt;
|
360
|
-
font-weight: 200;
|
361
|
-
font-style: normal;
|
362
|
-
|
363
|
-
position: absolute;
|
364
|
-
top: 14px;
|
365
|
-
left: 20px;
|
366
|
-
}
|
367
|
-
|
368
|
-
ul.frames .icon.application {
|
369
|
-
background: #808090;
|
370
|
-
border-color: #555;
|
371
|
-
}
|
372
|
-
|
373
|
-
ul.frames .icon.application:before {
|
374
|
-
content: 'A';
|
375
|
-
color: white;
|
376
|
-
text-shadow: 0 0 3px rgba(0, 0, 0, 0.2);
|
377
|
-
}
|
378
|
-
|
379
|
-
/* Responsiveness -- flow to single-line mode */
|
380
|
-
@media screen and (max-width: 1100px) {
|
381
|
-
ul.frames li {
|
382
|
-
padding-top: 6px;
|
383
|
-
padding-bottom: 6px;
|
384
|
-
padding-left: 36px;
|
385
|
-
line-height: 1.3;
|
386
|
-
}
|
387
|
-
|
388
|
-
ul.frames li .icon {
|
389
|
-
width: 11px;
|
390
|
-
height: 11px;
|
391
|
-
line-height: 11px;
|
392
|
-
|
393
|
-
top: 7px;
|
394
|
-
left: 10px;
|
395
|
-
font-size: 5pt;
|
396
|
-
}
|
397
|
-
|
398
|
-
ul.frames .name,
|
399
|
-
ul.frames .location {
|
400
|
-
display: inline-block;
|
401
|
-
line-height: 1.3;
|
402
|
-
height: 1.3em;
|
403
|
-
}
|
404
|
-
|
405
|
-
ul.frames .name {
|
406
|
-
margin-right: 10px;
|
407
|
-
}
|
408
|
-
}
|
409
|
-
|
410
|
-
/* ---------------------------------------------------------------------
|
411
|
-
* Monospace
|
412
|
-
* --------------------------------------------------------------------- */
|
413
|
-
|
414
|
-
pre, code, .be-repl input, .be-repl .command-line span, textarea, .code_linenums {
|
415
|
-
font-family: menlo, lucida console, monospace;
|
416
|
-
font-size: 8pt;
|
417
|
-
}
|
418
|
-
|
419
|
-
/* ---------------------------------------------------------------------
|
420
|
-
* Display area
|
421
|
-
* --------------------------------------------------------------------- */
|
422
|
-
|
423
|
-
p.no-javascript-notice {
|
424
|
-
margin-bottom: 1em;
|
425
|
-
padding: 1em;
|
426
|
-
border: 2px solid #e00;
|
427
|
-
}
|
428
|
-
.better-errors-javascript-loaded .no-javascript-notice {
|
429
|
-
display: none;
|
430
|
-
}
|
431
|
-
.no-inline-style-notice {
|
432
|
-
display: none;
|
433
|
-
}
|
434
|
-
|
435
|
-
.trace_info {
|
436
|
-
background: #fff;
|
437
|
-
padding: 6px;
|
438
|
-
border-radius: 3px;
|
439
|
-
margin-bottom: 2px;
|
440
|
-
box-shadow: 0 0 10px rgba(0, 0, 0, 0.03), 1px 1px 0 rgba(0, 0, 0, 0.05), -1px 1px 0 rgba(0, 0, 0, 0.05), 0 0 0 4px rgba(0, 0, 0, 0.04);
|
441
|
-
}
|
442
|
-
|
443
|
-
.code_block{
|
444
|
-
background: #f1f1f1;
|
445
|
-
border-left: 1px solid #ccc;
|
446
|
-
}
|
447
|
-
|
448
|
-
/* Titlebar */
|
449
|
-
.trace_info .title {
|
450
|
-
background: #f1f1f1;
|
451
|
-
|
452
|
-
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
|
453
|
-
overflow: hidden;
|
454
|
-
padding: 6px 10px;
|
455
|
-
|
456
|
-
border: solid 1px #ccc;
|
457
|
-
border-bottom: 0;
|
458
|
-
|
459
|
-
border-top-left-radius: 2px;
|
460
|
-
border-top-right-radius: 2px;
|
461
|
-
}
|
462
|
-
|
463
|
-
.trace_info .title .name,
|
464
|
-
.trace_info .title .location {
|
465
|
-
font-size: 9pt;
|
466
|
-
line-height: 26px;
|
467
|
-
height: 26px;
|
468
|
-
overflow: hidden;
|
469
|
-
}
|
470
|
-
|
471
|
-
.trace_info .title .location {
|
472
|
-
float: left;
|
473
|
-
font-weight: bold;
|
474
|
-
font-size: 10pt;
|
475
|
-
}
|
476
|
-
|
477
|
-
.trace_info .title .location a {
|
478
|
-
color:inherit;
|
479
|
-
text-decoration:none;
|
480
|
-
border-bottom:1px solid #aaaaaa;
|
481
|
-
}
|
482
|
-
|
483
|
-
.trace_info .title .location a:hover {
|
484
|
-
border-color:#666666;
|
485
|
-
}
|
486
|
-
|
487
|
-
.trace_info .title .name {
|
488
|
-
float: right;
|
489
|
-
font-weight: 200;
|
490
|
-
}
|
491
|
-
|
492
|
-
.better-errors-javascript-not-loaded .be-repl {
|
493
|
-
display: none;
|
494
|
-
}
|
495
|
-
|
496
|
-
.code, .be-console, .unavailable {
|
497
|
-
background: #fff;
|
498
|
-
padding: 5px;
|
499
|
-
|
500
|
-
box-shadow: inset 3px 3px 3px rgba(0, 0, 0, 0.1), inset 0 0 0 1px rgba(0, 0, 0, 0.1);
|
501
|
-
}
|
502
|
-
|
503
|
-
.code_linenums{
|
504
|
-
background:#f1f1f1;
|
505
|
-
padding-top:10px;
|
506
|
-
padding-bottom:9px;
|
507
|
-
float:left;
|
508
|
-
}
|
509
|
-
|
510
|
-
.code_linenums span{
|
511
|
-
display:block;
|
512
|
-
padding:0 12px;
|
513
|
-
}
|
514
|
-
|
515
|
-
.code {
|
516
|
-
margin-bottom: -1px;
|
517
|
-
border-top-left-radius:2px;
|
518
|
-
padding: 10px 0;
|
519
|
-
overflow: auto;
|
520
|
-
}
|
521
|
-
|
522
|
-
.code pre{
|
523
|
-
padding-left:12px;
|
524
|
-
min-height:16px;
|
525
|
-
}
|
526
|
-
|
527
|
-
/* Source unavailable */
|
528
|
-
p.unavailable {
|
529
|
-
padding: 20px 0 40px 0;
|
530
|
-
text-align: center;
|
531
|
-
color: #b99;
|
532
|
-
font-weight: bold;
|
533
|
-
}
|
534
|
-
|
535
|
-
p.unavailable:before {
|
536
|
-
content: '\00d7';
|
537
|
-
display: block;
|
538
|
-
|
539
|
-
color: #daa;
|
540
|
-
|
541
|
-
text-align: center;
|
542
|
-
font-size: 40pt;
|
543
|
-
font-weight: normal;
|
544
|
-
margin-bottom: -10px;
|
545
|
-
}
|
546
|
-
|
547
|
-
@-webkit-keyframes highlight {
|
548
|
-
0% { background: rgba(220, 30, 30, 0.3); }
|
549
|
-
100% { background: rgba(220, 30, 30, 0.1); }
|
550
|
-
}
|
551
|
-
@-moz-keyframes highlight {
|
552
|
-
0% { background: rgba(220, 30, 30, 0.3); }
|
553
|
-
100% { background: rgba(220, 30, 30, 0.1); }
|
554
|
-
}
|
555
|
-
@keyframes highlight {
|
556
|
-
0% { background: rgba(220, 30, 30, 0.3); }
|
557
|
-
100% { background: rgba(220, 30, 30, 0.1); }
|
558
|
-
}
|
559
|
-
|
560
|
-
.code .highlight, .code_linenums .highlight {
|
561
|
-
background: rgba(220, 30, 30, 0.1);
|
562
|
-
-webkit-animation: highlight 400ms linear 1;
|
563
|
-
-moz-animation: highlight 400ms linear 1;
|
564
|
-
animation: highlight 400ms linear 1;
|
565
|
-
}
|
566
|
-
|
567
|
-
/* REPL shell */
|
568
|
-
.be-console {
|
569
|
-
padding: 0 1px 10px 1px;
|
570
|
-
border-bottom-left-radius: 2px;
|
571
|
-
border-bottom-right-radius: 2px;
|
572
|
-
}
|
573
|
-
|
574
|
-
.be-console pre {
|
575
|
-
padding: 10px 10px 0 10px;
|
576
|
-
max-height: 400px;
|
577
|
-
overflow-x: none;
|
578
|
-
overflow-y: auto;
|
579
|
-
margin-bottom: -3px;
|
580
|
-
word-wrap: break-word;
|
581
|
-
white-space: pre-wrap;
|
582
|
-
}
|
583
|
-
|
584
|
-
/* .command-line > span + input */
|
585
|
-
.be-console .command-line {
|
586
|
-
display: table;
|
587
|
-
width: 100%;
|
588
|
-
}
|
589
|
-
|
590
|
-
.be-console .command-line span,
|
591
|
-
.be-console .command-line input {
|
592
|
-
display: table-cell;
|
593
|
-
}
|
594
|
-
|
595
|
-
.be-console .command-line span {
|
596
|
-
width: 1%;
|
597
|
-
padding-right: 5px;
|
598
|
-
padding-left: 10px;
|
599
|
-
white-space: pre;
|
600
|
-
}
|
601
|
-
|
602
|
-
.be-console .command-line input {
|
603
|
-
width: 99%;
|
604
|
-
}
|
605
|
-
|
606
|
-
/* Input box */
|
607
|
-
.be-console input,
|
608
|
-
.be-console input:focus {
|
609
|
-
outline: 0;
|
610
|
-
border: 0;
|
611
|
-
padding: 0;
|
612
|
-
background: transparent;
|
613
|
-
margin: 0;
|
614
|
-
}
|
615
|
-
|
616
|
-
/* Hint text */
|
617
|
-
.hint {
|
618
|
-
margin: 15px 0 20px 0;
|
619
|
-
font-size: 8pt;
|
620
|
-
color: #8080a0;
|
621
|
-
padding-left: 20px;
|
622
|
-
}
|
623
|
-
.console-has-been-used .live-console-hint {
|
624
|
-
display: none;
|
625
|
-
}
|
626
|
-
.better-errors-javascript-not-loaded .live-console-hint {
|
627
|
-
display: none;
|
628
|
-
}
|
629
|
-
|
630
|
-
.hint:before {
|
631
|
-
content: '\25b2';
|
632
|
-
margin-right: 5px;
|
633
|
-
opacity: 0.5;
|
634
|
-
}
|
635
|
-
|
636
|
-
/* ---------------------------------------------------------------------
|
637
|
-
* Variable infos
|
638
|
-
* --------------------------------------------------------------------- */
|
639
|
-
|
640
|
-
.sub {
|
641
|
-
padding: 10px 0;
|
642
|
-
margin: 10px 0;
|
643
|
-
}
|
644
|
-
|
645
|
-
.sub h3 {
|
646
|
-
color: #39a;
|
647
|
-
font-size: 1.1em;
|
648
|
-
margin: 10px 0;
|
649
|
-
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
|
650
|
-
|
651
|
-
-webkit-font-smoothing: antialiased;
|
652
|
-
}
|
653
|
-
|
654
|
-
.sub .inset {
|
655
|
-
overflow-y: auto;
|
656
|
-
}
|
657
|
-
|
658
|
-
.sub table {
|
659
|
-
table-layout: fixed;
|
660
|
-
}
|
661
|
-
|
662
|
-
.sub table td {
|
663
|
-
border-top: dotted 1px #ddd;
|
664
|
-
padding: 7px 1px;
|
665
|
-
}
|
666
|
-
|
667
|
-
.sub table td.name {
|
668
|
-
width: 150px;
|
669
|
-
|
670
|
-
font-weight: bold;
|
671
|
-
font-size: 0.8em;
|
672
|
-
padding-right: 20px;
|
673
|
-
|
674
|
-
word-wrap: break-word;
|
675
|
-
}
|
676
|
-
|
677
|
-
.sub table td pre {
|
678
|
-
max-height: 15em;
|
679
|
-
overflow-y: auto;
|
680
|
-
}
|
681
|
-
|
682
|
-
.sub table td pre {
|
683
|
-
width: 100%;
|
684
|
-
|
685
|
-
word-wrap: break-word;
|
686
|
-
white-space: normal;
|
687
|
-
}
|
688
|
-
|
689
|
-
/* "(object doesn't support inspect)" */
|
690
|
-
.sub .unsupported {
|
691
|
-
font-family: sans-serif;
|
692
|
-
color: #777;
|
693
|
-
}
|
694
|
-
|
695
|
-
/* ---------------------------------------------------------------------
|
696
|
-
* Scrollbar
|
697
|
-
* --------------------------------------------------------------------- */
|
698
|
-
|
699
|
-
nav.sidebar::-webkit-scrollbar,
|
700
|
-
.inset pre::-webkit-scrollbar,
|
701
|
-
.be-console pre::-webkit-scrollbar,
|
702
|
-
.code::-webkit-scrollbar {
|
703
|
-
width: 10px;
|
704
|
-
height: 10px;
|
705
|
-
}
|
706
|
-
|
707
|
-
.inset pre::-webkit-scrollbar-thumb,
|
708
|
-
.be-console pre::-webkit-scrollbar-thumb,
|
709
|
-
.code::-webkit-scrollbar-thumb {
|
710
|
-
background: #ccc;
|
711
|
-
border-radius: 5px;
|
712
|
-
}
|
713
|
-
|
714
|
-
nav.sidebar::-webkit-scrollbar-thumb {
|
715
|
-
background: rgba(0, 0, 0, 0.0);
|
716
|
-
border-radius: 5px;
|
717
|
-
}
|
718
|
-
|
719
|
-
nav.sidebar:hover::-webkit-scrollbar-thumb {
|
720
|
-
background-color: #999;
|
721
|
-
background: -webkit-linear-gradient(left, #aaa, #999);
|
722
|
-
}
|
723
|
-
|
724
|
-
.be-console pre:hover::-webkit-scrollbar-thumb,
|
725
|
-
.inset pre:hover::-webkit-scrollbar-thumb,
|
726
|
-
.code:hover::-webkit-scrollbar-thumb {
|
727
|
-
background: #888;
|
728
|
-
}
|
729
|
-
</style>
|
9
|
+
<%== ErrorPageStyle.style_tag(csp_nonce) %>
|
730
10
|
|
731
11
|
<%# IE8 compatibility crap %>
|
732
12
|
<script nonce="<%= csp_nonce %>">
|
@@ -969,7 +249,7 @@
|
|
969
249
|
self.writeOutput(response.error + "\n");
|
970
250
|
}
|
971
251
|
self.writeOutput(self._prompt + " ");
|
972
|
-
self.writeRawOutput(response.highlighted_input + "
|
252
|
+
self.writeRawOutput("<span class='syntax-highlighted'>" + response.highlighted_input + "</span>\n");
|
973
253
|
self.writeOutput(response.result);
|
974
254
|
self.setPrompt(response.prompt);
|
975
255
|
self.setInput(response.prefilled_input);
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: better_errors
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.10.0.
|
4
|
+
version: 2.10.0.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Charlie Somerville
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-12-
|
11
|
+
date: 2020-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: sassc
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: kramdown
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,7 +123,7 @@ dependencies:
|
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: 1.0.0
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
126
|
+
name: rouge
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
114
128
|
requirements:
|
115
129
|
- - ">="
|
@@ -185,6 +199,7 @@ files:
|
|
185
199
|
- lib/better_errors/code_formatter/text.rb
|
186
200
|
- lib/better_errors/editor.rb
|
187
201
|
- lib/better_errors/error_page.rb
|
202
|
+
- lib/better_errors/error_page_style.rb
|
188
203
|
- lib/better_errors/exception_extension.rb
|
189
204
|
- lib/better_errors/exception_hint.rb
|
190
205
|
- lib/better_errors/inspectable_value.rb
|
@@ -195,6 +210,7 @@ files:
|
|
195
210
|
- lib/better_errors/repl/basic.rb
|
196
211
|
- lib/better_errors/repl/pry.rb
|
197
212
|
- lib/better_errors/stack_frame.rb
|
213
|
+
- lib/better_errors/templates/main.css
|
198
214
|
- lib/better_errors/templates/main.erb
|
199
215
|
- lib/better_errors/templates/text.erb
|
200
216
|
- lib/better_errors/templates/variable_info.erb
|