jekyll_plugin_support 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/jekyll_plugin_support/version.rb +1 -1
- data/lib/jekyll_plugin_support.rb +23 -11
- data/spec/status_persistence.txt +0 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89499adafe6c65e0579f3a9bb6a1e724001dda3465777f189ba67407ae105f73
|
4
|
+
data.tar.gz: 284b6a91b644e2989e4f28decb8a29c597b0b1baaf30549b611ea21939d00990
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bb5b49b8bcf8d7ac2f6a8b0650c4ddf2e405db76295190cf5257154495db1f4f2491c676842a01c1c8607f4abd666655336fd4675828df716eff85bf0f66483
|
7
|
+
data.tar.gz: 54bc0d824c5e635be5143b70088a0229cd79b6a80992284e53119c2578b3e7a6fb3e57a31ec0b23f2dec5a8ed6afffd800213d0b5e1617d1d2d087241651d3b9
|
data/CHANGELOG.md
CHANGED
@@ -16,7 +16,7 @@ module JekyllSupport
|
|
16
16
|
DISPLAYED_CALLS = 8
|
17
17
|
|
18
18
|
def self.error_short_trace(logger, error)
|
19
|
-
remaining =
|
19
|
+
remaining = error.backtrace.length - DISPLAYED_CALLS
|
20
20
|
logger.error do
|
21
21
|
error.message + "\n" + # rubocop:disable Style/StringConcatenation
|
22
22
|
error.backtrace.take(DISPLAYED_CALLS).join("\n") +
|
@@ -25,7 +25,7 @@ module JekyllSupport
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def self.warn_short_trace(logger, error)
|
28
|
-
remaining =
|
28
|
+
remaining = error.backtrace.length - DISPLAYED_CALLS
|
29
29
|
logger.warn do
|
30
30
|
error.message + "\n" + # rubocop:disable Style/StringConcatenation
|
31
31
|
error.backtrace.take(DISPLAYED_CALLS).join("\n") +
|
@@ -76,14 +76,12 @@ module JekyllSupport
|
|
76
76
|
@paginator = @envs[:paginator]
|
77
77
|
@theme = @envs[:theme]
|
78
78
|
|
79
|
-
@mode = @config['env']['JEKYLL_ENV']
|
79
|
+
@mode = @config['env']&.key?('JEKYLL_ENV') ? @config['env']['JEKYLL_ENV'] : 'development'
|
80
80
|
|
81
81
|
render_impl text
|
82
82
|
rescue StandardError => e
|
83
83
|
@logger.error { "#{self.class} died with a #{e.full_message}" }
|
84
|
-
|
85
|
-
e.set_backtrace []
|
86
|
-
raise e
|
84
|
+
JekyllSupport.error_short_trace(@logger, e)
|
87
85
|
end
|
88
86
|
|
89
87
|
# Jekyll plugins should override this method, not render,
|
@@ -110,7 +108,7 @@ module JekyllSupport
|
|
110
108
|
@logger.debug { "#{self.class}: respond_to?(:o_arg_parsing) #{respond_to?(:no_arg_parsing) ? 'yes' : 'no'}." }
|
111
109
|
rescue StandardError => e
|
112
110
|
@logger.error { "#{self.class} died with a #{e.full_message}" }
|
113
|
-
|
111
|
+
JekyllSupport.error_short_trace(@logger, e)
|
114
112
|
end
|
115
113
|
|
116
114
|
def warn_short_trace(error)
|
@@ -140,12 +138,26 @@ module JekyllSupport
|
|
140
138
|
@helper = JekyllPluginHelper.new(tag_name, argument_string, @logger, respond_to?(:no_arg_parsing))
|
141
139
|
end
|
142
140
|
|
143
|
-
|
141
|
+
# If a Jekyll plugin needs to crash exit, and stop Jekyll, call this method.
|
142
|
+
# It does not generate a stack trace.
|
143
|
+
# This method does not return because the process is abruptly terminated.
|
144
|
+
#
|
145
|
+
# @param error StandardError or a subclass of StandardError is required
|
146
|
+
#
|
147
|
+
# Do not raise the error before calling this method, just create it via 'new', like this:
|
148
|
+
# exit_without_stack_trace StandardError.new('This is my error message')
|
149
|
+
#
|
150
|
+
# If you want to call this method from a handler method, the default index for the backtrace array must be specified.
|
151
|
+
# The default backtrace index is 1, which means the calling method.
|
152
|
+
# To specify the calling method's caller, pass in 2, like this:
|
153
|
+
# exit_without_stack_trace StandardError.new('This is my error message'), 2
|
154
|
+
def exit_without_stack_trace(error, caller_index = 1)
|
144
155
|
raise error
|
145
156
|
rescue StandardError => e
|
146
|
-
file, line_number, caller = e.backtrace[
|
157
|
+
file, line_number, caller = e.backtrace[caller_index].split(':')
|
147
158
|
caller = caller.tr('`', "'")
|
148
159
|
warn "#{self.class} died with a '#{error.message}' #{caller} on line #{line_number} of #{file}".red
|
160
|
+
# Process.kill('HUP', Process.pid) # generates huge stack trace
|
149
161
|
exec "echo ''"
|
150
162
|
end
|
151
163
|
|
@@ -170,11 +182,11 @@ module JekyllSupport
|
|
170
182
|
@site = liquid_context.registers[:site]
|
171
183
|
|
172
184
|
@config = @site.config
|
173
|
-
@mode = @config['env']
|
185
|
+
@mode = @config['env']&.key?('JEKYLL_ENV') ? @config['env']['JEKYLL_ENV'] : 'development'
|
174
186
|
|
175
187
|
render_impl
|
176
188
|
rescue StandardError => e
|
177
|
-
|
189
|
+
JekyllSupport.error_short_trace(@logger, e)
|
178
190
|
end
|
179
191
|
|
180
192
|
# Jekyll plugins must override this method, not render, so their plugin can be tested more easily
|
data/spec/status_persistence.txt
CHANGED
@@ -1,6 +0,0 @@
|
|
1
|
-
example_id | status | run_time |
|
2
|
-
------------------------------------------------ | ------ | --------------- |
|
3
|
-
./spec/jekyll_plugin_helper_options_spec.rb[1:1] | passed | 0.00559 seconds |
|
4
|
-
./spec/jekyll_plugin_helper_options_spec.rb[1:2] | passed | 0.00583 seconds |
|
5
|
-
./spec/jekyll_plugin_helper_options_spec.rb[1:3] | passed | 0.00543 seconds |
|
6
|
-
./spec/jekyll_plugin_helper_options_spec.rb[1:4] | passed | 0.00157 seconds |
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll_plugin_support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Slinn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-08-
|
11
|
+
date: 2023-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: facets
|