File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed 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 ) }
7-
6+ @result = [ ]
7+ # Capture stdout
8+ old_stdout = $stdout
9+ $stdout = StringIO . new
10+ Bundler ::Stats ::CLI . start ( [ "-f" , "json" ] )
11+ bundler_stats_cli_json_result = $stdout. string
12+ $stdout = old_stdout
13+
14+ # Parse and append the JSON result
15+ @result << JSON . parse ( bundler_stats_cli_json_result ) unless bundler_stats_cli_json_result . strip . empty?
16+
17+ @result += @statistics . map { |key , stats | stat_hash ( key , stats ) }
818 @result << stat_hash ( "Code" , @code_total ) . merge ( code_test_hash ) if @code_total
919 @result << stat_hash ( "Tests" , @tests_total ) . merge ( code_test_hash ) if @tests_total
1020 @result << stat_hash ( "Total" , @grand_total ) . merge ( code_test_hash ) if @grand_total
You can’t perform that action at this time.
0 commit comments