@@ -5,7 +5,7 @@ module CLI
55 # Thin CLI glue. Orchestrates engine + output adapters.
66 class Runner
77 VALID_OPTIONS = %w[ --dry-run --verbose -v --help -h ] . freeze
8- VALID_SUBCOMMANDS = %w[ folders ] . freeze
8+ VALID_SUBCOMMANDS = %w[ folders rspec ] . freeze
99
1010 def self . run ( args )
1111 new ( args ) . execute
@@ -42,6 +42,8 @@ def execute
4242 case @subcommand
4343 when "folders"
4444 return list_grafana_folders
45+ when "rspec"
46+ return run_rspec
4547 end
4648
4749 warn "[diffdash] v#{ VERSION } "
@@ -105,6 +107,13 @@ def find_invalid_arguments
105107 end
106108 end
107109
110+ def rspec_args
111+ idx = @args . index ( "rspec" )
112+ return [ ] unless idx
113+
114+ @args [ ( idx + 1 ) ..] || [ ]
115+ end
116+
108117 def build_outputs ( change_set )
109118 title = Formatters ::DashboardTitle . sanitize ( change_set . branch_name )
110119
@@ -200,6 +209,13 @@ def list_grafana_folders
200209 1
201210 end
202211
212+ def run_rspec
213+ cmd = [ "bundle" , "exec" , "rspec" , *rspec_args ]
214+ warn "[diffdash] Running: #{ cmd . join ( " " ) } "
215+ system ( *cmd )
216+ $?. success? ? 0 : 1
217+ end
218+
203219 def print_signal_summary ( bundle , url : nil )
204220 log_count = bundle . logs . size
205221 counter_count = bundle . metrics . count { |s | s . metadata [ :metric_type ] == :counter }
@@ -275,6 +291,7 @@ def print_help
275291
276292 Commands:
277293 folders List available Grafana folders
294+ rspec [args] Run the RSpec suite (passes args through)
278295 (none) Run analysis and generate/upload dashboard
279296
280297 Options:
0 commit comments