factory_bot_profile 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/Gemfile.lock +4 -4
- data/lib/factory_bot_profile/report/simple_report.rb +6 -5
- data/lib/factory_bot_profile/version.rb +1 -1
- data/lib/factory_bot_profile.rb +4 -4
- metadata +4 -5
- data/factory_bot_profile.gemspec +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29043f7c22b70be6456a1de2560643e054b64af118d40a258107215542944e8b
|
4
|
+
data.tar.gz: 334aac68ce12a573f8fa8ede825ff9a0f1c3f53da1f8d6e22b5c6332d6434204
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7553d19dbf8a004f00d8a4c938ad78a7824f7c0abc05b31936d0f1c917f973bc252ed1edcb3e635d97e716e911e6363f297f13bbfea51abd16cfaca31c2ef09
|
7
|
+
data.tar.gz: 96adfb65631249f4fa345eefea5d04844e0b9a04bc1bf54541b8e754ea4dbb733ea0c7ba9a6da37e5b739066bb1e07ba06cd4f4b39378ed2868b9335ef15af5c
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
-
## [0.
|
3
|
+
## [0.2.0] - 2023-01-24
|
4
|
+
|
5
|
+
- Added: configuration for how many factories SimpleReport should list (#6)
|
6
|
+
- Added: arbitrary configuration forwarded to the report class (#6)
|
7
|
+
- Fixed: Homepage link
|
8
|
+
|
9
|
+
## [0.1.0] - 2022-10-24
|
4
10
|
|
5
11
|
- Initial release
|
data/Gemfile.lock
CHANGED
@@ -1,26 +1,26 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
factory_bot_profile (0.
|
4
|
+
factory_bot_profile (0.2.0)
|
5
5
|
factory_bot (>= 6.2.1)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activesupport (7.0.4)
|
10
|
+
activesupport (7.0.4.1)
|
11
11
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
12
|
i18n (>= 1.6, < 2)
|
13
13
|
minitest (>= 5.1)
|
14
14
|
tzinfo (~> 2.0)
|
15
15
|
ast (2.4.2)
|
16
|
-
concurrent-ruby (1.
|
16
|
+
concurrent-ruby (1.2.0)
|
17
17
|
diff-lcs (1.5.0)
|
18
18
|
factory_bot (6.2.1)
|
19
19
|
activesupport (>= 5.0.0)
|
20
20
|
i18n (1.12.0)
|
21
21
|
concurrent-ruby (~> 1.0)
|
22
22
|
json (2.6.2)
|
23
|
-
minitest (5.
|
23
|
+
minitest (5.17.0)
|
24
24
|
parallel (1.22.1)
|
25
25
|
parser (3.1.2.1)
|
26
26
|
ast (~> 2.4.1)
|
@@ -1,9 +1,10 @@
|
|
1
1
|
module FactoryBotProfile
|
2
2
|
module Report
|
3
3
|
class SimpleReport
|
4
|
-
def initialize(stats, io: $stdout)
|
4
|
+
def initialize(stats, io: $stdout, count: 3)
|
5
5
|
@stats = stats
|
6
6
|
@io = io
|
7
|
+
@count = count
|
7
8
|
end
|
8
9
|
|
9
10
|
def deliver
|
@@ -13,7 +14,7 @@ module FactoryBotProfile
|
|
13
14
|
io.puts " Spent #{stats.total_time.round(2)} seconds in factory_bot"
|
14
15
|
io.puts
|
15
16
|
io.puts " Factories taking the most time overall:"
|
16
|
-
stats.highest_total_time(
|
17
|
+
stats.highest_total_time(count).each do |stat|
|
17
18
|
io.puts " - :#{stat.name} factory took #{stat.total_time.round(2)} seconds overall (ran #{stat.count} times)"
|
18
19
|
stat.child_stats_by_total_time.reverse_each do |child_stat|
|
19
20
|
io.puts " - #{child_stat.total_time.round(2)} seconds spent in :#{child_stat.name} (ran #{child_stat.count}/#{stat.count} times)"
|
@@ -22,7 +23,7 @@ module FactoryBotProfile
|
|
22
23
|
end
|
23
24
|
io.puts
|
24
25
|
io.puts " Slowest factories on average:"
|
25
|
-
stats.highest_average_time(
|
26
|
+
stats.highest_average_time(count).each do |stat|
|
26
27
|
io.puts " - :#{stat.name} factory took #{stat.average_time.round(2)} seconds on average (ran #{stat.count} times)"
|
27
28
|
stat.child_stats_by_average_time.reverse_each do |child_stat|
|
28
29
|
io.puts " - #{child_stat.average_time.round(2)} seconds spent in :#{child_stat.name} on average (ran #{child_stat.count}/#{stat.count} times)"
|
@@ -31,14 +32,14 @@ module FactoryBotProfile
|
|
31
32
|
end
|
32
33
|
io.puts
|
33
34
|
io.puts " Most used factories:"
|
34
|
-
stats.highest_count(
|
35
|
+
stats.highest_count(count).each do |stat|
|
35
36
|
io.puts " - :#{stat.name} factory ran #{stat.count} times"
|
36
37
|
end
|
37
38
|
end
|
38
39
|
|
39
40
|
private
|
40
41
|
|
41
|
-
attr_reader :stats, :io
|
42
|
+
attr_reader :stats, :io, :count
|
42
43
|
end
|
43
44
|
end
|
44
45
|
end
|
data/lib/factory_bot_profile.rb
CHANGED
@@ -22,12 +22,12 @@ module FactoryBotProfile
|
|
22
22
|
Subscription.new(stats).subscribe
|
23
23
|
end
|
24
24
|
|
25
|
-
def self.report(stats, reporter: Report::SimpleReport,
|
26
|
-
reporter.new(stats,
|
25
|
+
def self.report(stats, reporter: Report::SimpleReport, **options)
|
26
|
+
reporter.new(stats, **options).deliver if stats
|
27
27
|
end
|
28
28
|
|
29
|
-
def self.merge_and_report(all_stats, reporter: Report::SimpleReport,
|
29
|
+
def self.merge_and_report(all_stats, reporter: Report::SimpleReport, **options)
|
30
30
|
merged_stats = all_stats.reduce(AggregateStats.new, &:merge!)
|
31
|
-
report(merged_stats, reporter: reporter,
|
31
|
+
report(merged_stats, reporter: reporter, **options)
|
32
32
|
end
|
33
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: factory_bot_profile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Colson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: factory_bot
|
@@ -40,7 +40,6 @@ files:
|
|
40
40
|
- LICENSE.txt
|
41
41
|
- README.md
|
42
42
|
- Rakefile
|
43
|
-
- factory_bot_profile.gemspec
|
44
43
|
- lib/factory_bot_profile.rb
|
45
44
|
- lib/factory_bot_profile/aggregate_stats.rb
|
46
45
|
- lib/factory_bot_profile/frame.rb
|
@@ -50,7 +49,7 @@ files:
|
|
50
49
|
- lib/factory_bot_profile/subscriber.rb
|
51
50
|
- lib/factory_bot_profile/subscription.rb
|
52
51
|
- lib/factory_bot_profile/version.rb
|
53
|
-
homepage: https://github.com/
|
52
|
+
homepage: https://github.com/composerinteralia/factory_bot_profile
|
54
53
|
licenses:
|
55
54
|
- MIT
|
56
55
|
metadata: {}
|
@@ -69,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
68
|
- !ruby/object:Gem::Version
|
70
69
|
version: '0'
|
71
70
|
requirements: []
|
72
|
-
rubygems_version: 3.
|
71
|
+
rubygems_version: 3.4.1
|
73
72
|
signing_key:
|
74
73
|
specification_version: 4
|
75
74
|
summary: Profiling for factory_bot
|
data/factory_bot_profile.gemspec
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "lib/factory_bot_profile/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = "factory_bot_profile"
|
7
|
-
spec.version = FactoryBotProfile::VERSION
|
8
|
-
spec.authors = ["Daniel Colson"]
|
9
|
-
spec.email = ["danieljamescolson@gmail.com"]
|
10
|
-
|
11
|
-
spec.summary = "Profiling for factory_bot"
|
12
|
-
spec.homepage = "https://github.com/composerinterali/factory_bot_profile"
|
13
|
-
spec.license = "MIT"
|
14
|
-
spec.required_ruby_version = ">= 3.0.0"
|
15
|
-
|
16
|
-
# Specify which files should be added to the gem when it is released.
|
17
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
18
|
-
spec.files = Dir.chdir(__dir__) do
|
19
|
-
`git ls-files -z`.split("\x0").reject do |f|
|
20
|
-
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
21
|
-
end
|
22
|
-
end
|
23
|
-
spec.bindir = "exe"
|
24
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
25
|
-
spec.require_paths = ["lib"]
|
26
|
-
|
27
|
-
spec.add_dependency "factory_bot", ">= 6.2.1"
|
28
|
-
end
|