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 2727 gem uninstall bundler -a -x || true
2828 - name : Install Bundler
2929 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
3133 gem install bundler -v "~> 2.4.0"
3234 else
3335 gem install bundler
Original file line number Diff line number Diff line change 11# main ([ unreleased] ( https://github.com/fastruby/rails_stats/compare/v1.0.2...main ) )
22
3- *
3+ * [ BUGFIX: Fix JSON output missing Code and Tests total count] ( https://github.com/fastruby/rails_stats/pull/40 )
4+ * Update README examples
45
56# v2.0.1 ([ commits] ( https://github.com/fastruby/rails_stats/compare/v2.0.0...v2.0.1 ) )
67
Original file line number Diff line number Diff line change @@ -5,10 +5,10 @@ gemspec
55group :development , :test do
66 gem "bundler" , ">= 1.6" , "< 3.0"
77 gem "byebug"
8- gem "codecov"
8+ gem "codecov" , "~> 0.6.0"
99 gem "minitest"
1010 gem "minitest-around"
1111 gem "minitest-spec-context"
12- gem "simplecov"
12+ gem "simplecov" , "~> 0.21"
1313 gem "simplecov-console"
1414end
Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change 33module RailsStats
44 class JSONFormatter < StatsFormatter
55 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
712
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
1119
1220 @result
1321 end
1422
1523 def to_s
16- puts result . to_json
24+ puts JSON . generate ( result , ascii_only : false )
1725 end
1826
1927 private
Original file line number Diff line number Diff line change 11+-----------------------|------------|----------------+
22| Name | Total Deps | 1st Level Deps |
33+-----------------------|------------|----------------+
4- | simplecov-console | 7 | 3 |
5- | codecov | 5 | 2 |
4+ | simplecov-console | 8 | 3 |
5+ | codecov | 4 | 1 |
66| rails_stats | 4 | 2 |
77| simplecov | 3 | 3 |
88| minitest-around | 1 | 1 |
1414
1515 Declared Gems 9
1616 Total Gems 18
17- Unpinned Versions 8
17+ Unpinned Versions 6
1818 Github Refs 0
1919
2020+----------------------+---------+---------+---------+---------+---------+-----+-------+
2121| Name | Files | Lines | LOC | Classes | Methods | M/C | LOC/M |
2222+----------------------+---------+---------+---------+---------+---------+-----+-------+
2323| 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 |
2525| Controllers | 1 | 7 | 6 | 1 | 1 | 1 | 4 |
2626| Helpers | 1 | 3 | 3 | 0 | 0 | 0 | 0 |
2727| Javascripts | 3 | 27 | 7 | 0 | 0 | 0 | 0 |
You can’t perform that action at this time.
0 commit comments