File tree Expand file tree Collapse file tree 7 files changed +416
-347
lines changed Expand file tree Collapse file tree 7 files changed +416
-347
lines changed Original file line number Diff line number Diff line change 27
27
gem uninstall bundler -a -x || true
28
28
- name : Install Bundler
29
29
run : |
30
- if [[ "${{ matrix.ruby-version }}" == "2.6" || "${{ matrix.ruby-version }}" == "2.7" ]]; then
30
+ if [[ "${{ matrix.ruby-version }}" == "2.5" ]]; then
31
+ gem install bundler -v "~> 2.3.27"
32
+ elif [[ "${{ matrix.ruby-version }}" == "2.6" || "${{ matrix.ruby-version }}" == "2.7" ]]; then
31
33
gem install bundler -v "~> 2.4.0"
32
34
else
33
35
gem install bundler
Original file line number Diff line number Diff line change 1
1
# main ([ unreleased] ( https://github.com/fastruby/rails_stats/compare/v1.0.2...main ) )
2
2
3
- *
3
+ * [ BUGFIX: Fix JSON output missing Code and Tests total count] ( https://github.com/fastruby/rails_stats/pull/40 )
4
+ * Update README examples
4
5
5
6
# v2.0.1 ([ commits] ( https://github.com/fastruby/rails_stats/compare/v2.0.0...v2.0.1 ) )
6
7
Original file line number Diff line number Diff line change @@ -5,10 +5,10 @@ gemspec
5
5
group :development , :test do
6
6
gem "bundler" , ">= 1.6" , "< 3.0"
7
7
gem "byebug"
8
- gem "codecov"
8
+ gem "codecov" , "~> 0.6.0"
9
9
gem "minitest"
10
10
gem "minitest-around"
11
11
gem "minitest-spec-context"
12
- gem "simplecov"
12
+ gem "simplecov" , "~> 0.21"
13
13
gem "simplecov-console"
14
14
end
Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change 3
3
module RailsStats
4
4
class JSONFormatter < StatsFormatter
5
5
def result
6
- @result = @statistics . map { |key , stats | stat_hash ( key , stats ) }
6
+ @result = [ ]
7
+ old_stdout = $stdout
8
+ $stdout = StringIO . new
9
+ Bundler ::Stats ::CLI . start ( [ "-f" , "json" ] )
10
+ bundler_stats_cli_json_result = $stdout. string
11
+ $stdout = old_stdout
7
12
8
- if @grand_total
9
- @result << stat_hash ( "Total" , @grand_total ) . merge ( code_test_hash )
10
- end
13
+ @result << JSON . parse ( bundler_stats_cli_json_result ) unless bundler_stats_cli_json_result . strip . empty?
14
+
15
+ @result += @statistics . map { |key , stats | stat_hash ( key , stats ) }
16
+ @result << stat_hash ( "Code" , @code_total ) . merge ( code_test_hash ) if @code_total
17
+ @result << stat_hash ( "Tests" , @tests_total ) . merge ( code_test_hash ) if @tests_total
18
+ @result << stat_hash ( "Total" , @grand_total ) . merge ( code_test_hash ) if @grand_total
11
19
12
20
@result
13
21
end
14
22
15
23
def to_s
16
- puts result . to_json
24
+ puts JSON . generate ( result , ascii_only : false )
17
25
end
18
26
19
27
private
Original file line number Diff line number Diff line change 1
1
+-----------------------|------------|----------------+
2
2
| Name | Total Deps | 1st Level Deps |
3
3
+-----------------------|------------|----------------+
4
- | simplecov-console | 7 | 3 |
5
- | codecov | 5 | 2 |
4
+ | simplecov-console | 8 | 3 |
5
+ | codecov | 4 | 1 |
6
6
| rails_stats | 4 | 2 |
7
7
| simplecov | 3 | 3 |
8
8
| minitest-around | 1 | 1 |
14
14
15
15
Declared Gems 9
16
16
Total Gems 18
17
- Unpinned Versions 8
17
+ Unpinned Versions 6
18
18
Github Refs 0
19
19
20
20
+----------------------+---------+---------+---------+---------+---------+-----+-------+
21
21
| Name | Files | Lines | LOC | Classes | Methods | M/C | LOC/M |
22
22
+----------------------+---------+---------+---------+---------+---------+-----+-------+
23
23
| Channels | 2 | 8 | 8 | 2 | 0 | 0 | 0 |
24
- | Configuration | 19 | 417 | 111 | 1 | 0 | 0 | 0 |
24
+ | Configuration | 19 | 417 | 111 | 1 | 0 | 0 | 0 |
25
25
| Controllers | 1 | 7 | 6 | 1 | 1 | 1 | 4 |
26
26
| Helpers | 1 | 3 | 3 | 0 | 0 | 0 | 0 |
27
27
| Javascripts | 3 | 27 | 7 | 0 | 0 | 0 | 0 |
You can’t perform that action at this time.
0 commit comments