test-prof 0.4.6 → 0.4.7
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 +7 -0
- data/lib/test_prof.rb +5 -1
- data/lib/test_prof/ruby_prof.rb +21 -8
- data/lib/test_prof/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20a2f32b0735b5254ea790c2d7aca6a342e5fdcf
|
4
|
+
data.tar.gz: 462e6279110f67ddd11523f662c3958e1346b279
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7466fa2bf79b1b73f3677d48bb56381695b463d019c725343ad85e06419bf5cdfbc70183f36241a87c97fda8b5f3562e2d1d92feb8eaaef0813653f0a04b9b86
|
7
|
+
data.tar.gz: af769d6f5a0a6d2736d4c79cfb3c42831f7f8aa91216a2ab08d90c47a0e3eeaa3a24b31362bd51200c354c9fe399b8d06f3d1cce7d6651cce1352c3b6b11cb3f
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 0.4.7
|
6
|
+
|
7
|
+
- [#57](https://github.com/palkan/test-prof/pull/57) Fix RubyProf Printers Support ([@rabotyaga][])
|
8
|
+
|
9
|
+
## 0.4.6
|
10
|
+
|
5
11
|
- Upgrade RSpec/AggregateFailures to RuboCop 0.52.0. ([@palkan][])
|
6
12
|
|
7
13
|
RuboCop < 0.51.0 is not supported anymore.
|
@@ -143,3 +149,4 @@ Ensure output dir exists in `#artifact_path` method.
|
|
143
149
|
[@Shkrt]: https://github.com/Shkrt
|
144
150
|
[@IDolgirev]: https://github.com/IDolgirev
|
145
151
|
[@desoleary]: https://github.com/desoleary
|
152
|
+
[@rabotyaga]: https://github.com/rabotyaga
|
data/lib/test_prof.rb
CHANGED
@@ -73,7 +73,7 @@ module TestProf
|
|
73
73
|
|
74
74
|
# Return a path to store artifact
|
75
75
|
def artifact_path(filename)
|
76
|
-
|
76
|
+
create_artifact_dir
|
77
77
|
|
78
78
|
with_timestamps(
|
79
79
|
::File.join(
|
@@ -83,6 +83,10 @@ module TestProf
|
|
83
83
|
)
|
84
84
|
end
|
85
85
|
|
86
|
+
def create_artifact_dir
|
87
|
+
FileUtils.mkdir_p(config.output_dir)[0]
|
88
|
+
end
|
89
|
+
|
86
90
|
private
|
87
91
|
|
88
92
|
def activate!(env_var, val)
|
data/lib/test_prof/ruby_prof.rb
CHANGED
@@ -37,13 +37,14 @@ module TestProf
|
|
37
37
|
|
38
38
|
PRINTERS = {
|
39
39
|
'flat' => 'FlatPrinter',
|
40
|
-
'flat_wln' => '
|
40
|
+
'flat_wln' => 'FlatPrinterWithLineNumbers',
|
41
41
|
'graph' => 'GraphPrinter',
|
42
42
|
'graph_html' => 'GraphHtmlPrinter',
|
43
43
|
'dot' => 'DotPrinter',
|
44
44
|
'.' => 'DotPrinter',
|
45
45
|
'call_stack' => 'CallStackPrinter',
|
46
|
-
'call_tree' => 'CallTreePrinter'
|
46
|
+
'call_tree' => 'CallTreePrinter',
|
47
|
+
'multi' => 'MultiPrinter'
|
47
48
|
}.freeze
|
48
49
|
|
49
50
|
# Mapping from printer to report file extension
|
@@ -52,10 +53,11 @@ module TestProf
|
|
52
53
|
'graph_html' => 'html',
|
53
54
|
'dot' => 'dot',
|
54
55
|
'.' => 'dot',
|
55
|
-
'call_stack' => 'html'
|
56
|
-
'call_tree' => 'dat'
|
56
|
+
'call_stack' => 'html'
|
57
57
|
}.freeze
|
58
58
|
|
59
|
+
LOGFILE_PREFIX = "ruby-prof-report".freeze
|
60
|
+
|
59
61
|
attr_accessor :printer, :mode, :min_percent,
|
60
62
|
:include_threads, :eliminate_methods
|
61
63
|
|
@@ -107,10 +109,21 @@ module TestProf
|
|
107
109
|
config.eliminate_methods?
|
108
110
|
|
109
111
|
printer_type, printer_class = config.resolve_printer
|
110
|
-
path = build_path name, printer_type
|
111
112
|
|
112
|
-
|
113
|
-
|
113
|
+
if %w[call_tree multi].include?(printer_type)
|
114
|
+
path = TestProf.create_artifact_dir
|
115
|
+
printer_class.new(result).print(
|
116
|
+
path: path,
|
117
|
+
profile: "#{RubyProf::Configuration::LOGFILE_PREFIX}-#{printer_type}-" \
|
118
|
+
"#{config.mode}-#{name}",
|
119
|
+
min_percent: config.min_percent
|
120
|
+
)
|
121
|
+
else
|
122
|
+
path = build_path name, printer_type
|
123
|
+
File.open(path, 'w') do |f|
|
124
|
+
printer_class.new(result).print(f, min_percent: config.min_percent)
|
125
|
+
end
|
126
|
+
|
114
127
|
end
|
115
128
|
|
116
129
|
log :info, "RubyProf report generated: #{path}"
|
@@ -120,7 +133,7 @@ module TestProf
|
|
120
133
|
|
121
134
|
def build_path(name, printer)
|
122
135
|
TestProf.artifact_path(
|
123
|
-
"
|
136
|
+
"#{RubyProf::Configuration::LOGFILE_PREFIX}-#{printer}-#{config.mode}-#{name}" \
|
124
137
|
".#{RubyProf::Configuration::PRINTER_EXTENSTION.fetch(printer, 'txt')}"
|
125
138
|
)
|
126
139
|
end
|
data/lib/test_prof/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-prof
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladimir Dementyev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '12.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '12.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|