From a9d7594b247ec09f2f5b31dff74ab29d90b995bc Mon Sep 17 00:00:00 2001 From: Alexandre Barret Date: Wed, 11 Dec 2024 20:41:20 +1300 Subject: [PATCH] Refactor command.rb --- lib/retest/command.rb | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/lib/retest/command.rb b/lib/retest/command.rb index a73e4fe..0269179 100644 --- a/lib/retest/command.rb +++ b/lib/retest/command.rb @@ -27,17 +27,20 @@ def command options_command || default_command end + private + def options_command - if params[:command] - return hardcoded_command(params[:command]) + if params[:command] then hardcoded_command(params[:command]) + elsif params[:rspec] then rspec_command + elsif params[:rails] then rails_command + elsif params[:ruby] then ruby_command + elsif params[:rake] then rake_command end + end - if params[:rspec] then rspec_command - elsif params[:rails] then rails_command - elsif params[:ruby] then ruby_command - elsif params[:rake] then rake_command - else - end + def default_command + log "Setup identified: [#{type.upcase}]. Using command: '#{setup_command}'" + setup_command end def setup_command @@ -50,13 +53,6 @@ def setup_command end end - def default_command - log "Setup identified: [#{type.upcase}]. Using command: '#{setup_command}'" - setup_command - end - - private - def log(message) @stdout&.puts(message) end