require_bench 1.0.4.pre.alpha.2 → 1.0.4.pre.alpha.5
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/require_bench/color_printer.rb +4 -4
- data/lib/require_bench/printer.rb +3 -3
- data/lib/require_bench/version.rb +1 -1
- data/lib/require_bench.rb +9 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f285dc3596cb6bdb255ca52e04672eb3db41190a00d539ccb95afb799ffe54b6
|
4
|
+
data.tar.gz: 2e3516aabd3abd17ca1b5d2cb6446a2c35b8f4eb618072784147259b2d68b324
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dad7f222558be2eed0b2c4ff1747417ccd6a3fed369a179b864947f874856c3168586552d97ea9d333e09757d8331c95ce805419688cb34b0a481dd2767497c1
|
7
|
+
data.tar.gz: 945bec799822d77e515612adf017b79b298aafa9e2ae5d04265c1209051c9e6a2b6236ee7e3be0c131afc6f1ce59c329c93297ae7a00e928246ec742089b9ef9
|
@@ -18,20 +18,20 @@ class Printer
|
|
18
18
|
end
|
19
19
|
|
20
20
|
# Log statement when a file starts loading
|
21
|
-
def
|
21
|
+
def out_start(file, type)
|
22
22
|
printf "🚥 #{ColorizedString["[RequireBench-#{type}]"].colorize(first)} 📖 %s 🚥\n", file
|
23
|
-
rotate!
|
24
23
|
end
|
25
24
|
|
26
25
|
# Log statement when a file completed loading
|
27
|
-
def
|
26
|
+
def out_consume(seconds, file, type)
|
28
27
|
printf "🚥 #{ColorizedString["[RequireBench-#{type}]"].colorize(first)} ☑️ %10f %s 🚥\n", seconds, file
|
29
28
|
rotate!
|
30
29
|
end
|
31
30
|
|
32
31
|
# Log statement when a file raises an error while loading
|
33
|
-
def
|
32
|
+
def out_err(error, file, type)
|
34
33
|
printf "🚥 #{ColorizedString["[RequireBench-#{type}]"].colorize(first)} ❌ '#{error.class}: #{error.message}' loading %s 🚥\n#{error.backtrace.join("\n")}",
|
35
34
|
file
|
35
|
+
rotate!
|
36
36
|
end
|
37
37
|
end
|
@@ -2,18 +2,18 @@
|
|
2
2
|
|
3
3
|
class Printer
|
4
4
|
# Log statement when a file starts loading
|
5
|
-
def
|
5
|
+
def out_start(file, type)
|
6
6
|
printf "🚥 [RequireBench-#{type}] 📖 %s 🚥\n", file
|
7
7
|
rotate!
|
8
8
|
end
|
9
9
|
|
10
10
|
# Log statement when a file completed loading
|
11
|
-
def
|
11
|
+
def out_consume(seconds, file, type)
|
12
12
|
printf "🚥 [RequireBench-#{type}] ☑️ %10f %s 🚥\n", seconds, file
|
13
13
|
end
|
14
14
|
|
15
15
|
# Log statement when a file raises an error while loading
|
16
|
-
def
|
16
|
+
def out_err(error, file, type)
|
17
17
|
printf "🚥 [RequireBench-#{type}] ❌ '#{error.class}: #{error.message}' loading %s 🚥\n#{error.backtrace.join("\n")}",
|
18
18
|
file
|
19
19
|
end
|
data/lib/require_bench.rb
CHANGED
@@ -39,6 +39,12 @@ module RequireBench
|
|
39
39
|
require 'require_bench/printer'
|
40
40
|
end
|
41
41
|
PRINTER = Printer.new
|
42
|
+
|
43
|
+
if rescued_classes.any?
|
44
|
+
rescued_classes.map! do |klass|
|
45
|
+
Kernel.const_get(klass)
|
46
|
+
end
|
47
|
+
end
|
42
48
|
if skips && !skips.empty?
|
43
49
|
skip_pattern = case skips
|
44
50
|
when /,/
|
@@ -102,7 +108,7 @@ module RequireBench
|
|
102
108
|
end
|
103
109
|
end
|
104
110
|
end
|
105
|
-
PRINTER.
|
111
|
+
PRINTER.out_consume(seconds, file, short_type)
|
106
112
|
if prefix.nil? && (NO_GROUP_PATTERN.nil? || !NO_GROUP_PATTERN.match?(file))
|
107
113
|
# This results in grouping all files with the same leading path part (e.g. "models", or "lib")
|
108
114
|
# into the same timing bucket.
|
@@ -151,12 +157,12 @@ if REQUIRE_BENCH_ENABLED
|
|
151
157
|
short_type = type[0]
|
152
158
|
measure = RequireBench::INCLUDE_PATTERN && file_path.match?(RequireBench::INCLUDE_PATTERN)
|
153
159
|
skippy = RequireBench::SKIP_PATTERN && file_path.match?(RequireBench::SKIP_PATTERN)
|
154
|
-
PRINTER.
|
160
|
+
RequireBench::PRINTER.out_start(file, short_type) if RequireBench::LOG_START
|
155
161
|
if RequireBench::RESCUED_CLASSES.any?
|
156
162
|
begin
|
157
163
|
_require_bench_file(type, measure, skippy, file_path)
|
158
164
|
rescue *RequireBench::RESCUED_CLASSES => e
|
159
|
-
PRINTER.
|
165
|
+
RequireBench::PRINTER.out_error(e, file, short_type)
|
160
166
|
end
|
161
167
|
else
|
162
168
|
_require_bench_file(type, measure, skippy, file_path)
|