From 6c5583a0d71cdfaf75259e315deda34506b0d10e Mon Sep 17 00:00:00 2001 From: Alexandre Barret Date: Sun, 26 Jan 2025 16:07:48 +1300 Subject: [PATCH] Log launching details from executable instead --- bin/test/bundler-app | 6 +++--- bin/test/rspec-ruby | 13 ++++++++++--- bin/test/ruby-app | 4 ++-- exe/retest | 14 ++++++++++++++ .../retest_test/interactive_commands_test.rb | 1 + features/hanami-app/retest/retest_test.rb | 2 ++ features/rails-app/retest/retest_test.rb | 2 ++ features/rspec-rails/retest/retest_test.rb | 2 ++ .../rspec-ruby/retest/retest_test/flags_test.rb | 1 + features/ruby-app/retest/retest_test.rb | 3 +++ features/ruby-bare/retest/scenarios/auto_flag.rb | 1 + 11 files changed, 41 insertions(+), 8 deletions(-) diff --git a/bin/test/bundler-app b/bin/test/bundler-app index 1a49ef40..456c2222 100755 --- a/bin/test/bundler-app +++ b/bin/test/bundler-app @@ -4,10 +4,10 @@ FOLDER="features/bundler-app" bundle install bundle exec rake build -cp -R features/support features/bundler-app/retest -ls -t pkg | head -n1 | xargs -I {} mv pkg/{} "$FOLDER/retest.gem" +cp -R features/support $FOLDER/retest +ls -t pkg | head -n1 | xargs -I {} mv pkg/{} $FOLDER/retest.gem -if [[ "$1" == "--no-build" ]]; then +if [[ "$1" == "--nobuild" ]]; then docker compose -f "$FOLDER/docker-compose.yml" up --exit-code-from retest else docker compose -f "$FOLDER/docker-compose.yml" up --build --exit-code-from retest diff --git a/bin/test/rspec-ruby b/bin/test/rspec-ruby index a067e8af..702392d7 100755 --- a/bin/test/rspec-ruby +++ b/bin/test/rspec-ruby @@ -1,7 +1,14 @@ #!/usr/bin/env bash +FOLDER="features/rspec-ruby" + bundle install bundle exec rake build -cp -R features/support features/rspec-ruby/retest -ls -t pkg | head -n1 | xargs -I {} mv pkg/{} features/rspec-ruby/retest.gem -docker compose -f features/rspec-ruby/docker-compose.yml up --build --exit-code-from retest \ No newline at end of file +cp -R features/support $FOLDER/retest +ls -t pkg | head -n1 | xargs -I {} mv pkg/{} $FOLDER/retest.gem + +if [[ "$1" == "--nobuild" ]]; then + docker compose -f "$FOLDER/docker-compose.yml" up --exit-code-from retest +else + docker compose -f "$FOLDER/docker-compose.yml" up --build --exit-code-from retest +fi diff --git a/bin/test/ruby-app b/bin/test/ruby-app index 2284770c..8a9d8db2 100755 --- a/bin/test/ruby-app +++ b/bin/test/ruby-app @@ -4,8 +4,8 @@ FOLDER="features/ruby-app" bundle install bundle exec rake build -cp -R features/support "$FOLDER/retest" -ls -t pkg | head -n1 | xargs -I {} mv pkg/{} features/ruby-app/retest.gem +cp -R features/support $FOLDER/retest +ls -t pkg | head -n1 | xargs -I {} mv pkg/{} $FOLDER/retest.gem if [[ "$1" == "--nobuild" ]]; then docker compose -f "$FOLDER/docker-compose.yml" up --exit-code-from retest diff --git a/exe/retest b/exe/retest index ce307158..00dec214 100755 --- a/exe/retest +++ b/exe/retest @@ -44,12 +44,26 @@ if options.params[:diff] return end +# LOGGING LAUNCHING DETAILS + +case command +when Retest::Command::Rspec then puts "Setup: [RSPEC]" +when Retest::Command::Rails then puts "Setup: [RAILS]" +when Retest::Command::Rake then puts "Setup: [RAKE]" +when Retest::Command::Ruby then puts "Setup: [RUBY]" +else puts "Setup: [UNKNOWN]" +end + +puts "Command: '#{command}'" + if watcher == Retest::Watcher::Watchexec puts "Watcher: [WATCHEXEC]" else puts "Watcher: [LISTEN]" end +puts # break linke + launching_message = "Launching Retest..." if options.force_polling? launching_message = "Launching Retest with polling method..." diff --git a/features/bundler-app/retest/retest_test/interactive_commands_test.rb b/features/bundler-app/retest/retest_test/interactive_commands_test.rb index 6090c556..5616b1b8 100644 --- a/features/bundler-app/retest/retest_test/interactive_commands_test.rb +++ b/features/bundler-app/retest/retest_test/interactive_commands_test.rb @@ -16,6 +16,7 @@ def test_start_help Setup: [RAKE] Command: 'bundle exec rake test TEST=' Watcher: [LISTEN] + Launching Retest... Ready to refactor! You can make file changes now diff --git a/features/hanami-app/retest/retest_test.rb b/features/hanami-app/retest/retest_test.rb index 1f3557a5..a9e6a3f2 100644 --- a/features/hanami-app/retest/retest_test.rb +++ b/features/hanami-app/retest/retest_test.rb @@ -78,6 +78,7 @@ def test_with_no_command Setup: [RAKE] Command: 'bundle exec rake test TEST=' Watcher: [LISTEN] + Launching Retest... Ready to refactor! You can make file changes now OUTPUT @@ -90,6 +91,7 @@ def test_with_no_command_all Setup: [RAKE] Command: 'bundle exec rake test' Watcher: [LISTEN] + Launching Retest... Ready to refactor! You can make file changes now OUTPUT diff --git a/features/rails-app/retest/retest_test.rb b/features/rails-app/retest/retest_test.rb index 1ccfc1b9..775cd2fb 100644 --- a/features/rails-app/retest/retest_test.rb +++ b/features/rails-app/retest/retest_test.rb @@ -88,6 +88,7 @@ def test_with_no_command Setup: [RAILS] Command: 'bin/rails test ' Watcher: [LISTEN] + Launching Retest... Ready to refactor! You can make file changes now OUTPUT @@ -100,6 +101,7 @@ def test_with_no_command_all Setup: [RAILS] Command: 'bin/rails test' Watcher: [LISTEN] + Launching Retest... Ready to refactor! You can make file changes now OUTPUT diff --git a/features/rspec-rails/retest/retest_test.rb b/features/rspec-rails/retest/retest_test.rb index 4e517979..a8c10958 100644 --- a/features/rspec-rails/retest/retest_test.rb +++ b/features/rspec-rails/retest/retest_test.rb @@ -88,6 +88,7 @@ def test_with_no_command Setup: [RSPEC] Command: 'bundle exec rspec ' Watcher: [LISTEN] + Launching Retest... Ready to refactor! You can make file changes now OUTPUT @@ -100,6 +101,7 @@ def test_with_no_command_all Setup: [RSPEC] Command: 'bundle exec rspec' Watcher: [LISTEN] + Launching Retest... Ready to refactor! You can make file changes now OUTPUT diff --git a/features/rspec-ruby/retest/retest_test/flags_test.rb b/features/rspec-ruby/retest/retest_test/flags_test.rb index 8d16012e..4f775dca 100644 --- a/features/rspec-ruby/retest/retest_test/flags_test.rb +++ b/features/rspec-ruby/retest/retest_test/flags_test.rb @@ -15,6 +15,7 @@ def test_with_no_command Setup: [RSPEC] Command: 'bundle exec rspec ' Watcher: [LISTEN] + Launching Retest... Ready to refactor! You can make file changes now OUTPUT diff --git a/features/ruby-app/retest/retest_test.rb b/features/ruby-app/retest/retest_test.rb index 9fd0edf4..ddba31f1 100644 --- a/features/ruby-app/retest/retest_test.rb +++ b/features/ruby-app/retest/retest_test.rb @@ -27,6 +27,7 @@ def test_start_retest Setup: [RUBY] Command: 'bundle exec ruby ' Watcher: [LISTEN] + Launching Retest... Ready to refactor! You can make file changes now EXPECTED @@ -51,6 +52,7 @@ def test_start_retest Setup: [RUBY] Command: 'bundle exec ruby ' Watcher: [WATCHEXEC] + Launching Retest... Ready to refactor! You can make file changes now EXPECTED @@ -75,6 +77,7 @@ def test_uses_watchexec_when_installed Setup: [RUBY] Command: 'bundle exec ruby ' Watcher: [WATCHEXEC] + Launching Retest... Ready to refactor! You can make file changes now EXPECTED diff --git a/features/ruby-bare/retest/scenarios/auto_flag.rb b/features/ruby-bare/retest/scenarios/auto_flag.rb index 5edd0d76..a7ee6058 100644 --- a/features/ruby-bare/retest/scenarios/auto_flag.rb +++ b/features/ruby-bare/retest/scenarios/auto_flag.rb @@ -12,6 +12,7 @@ def test_start_retest Setup: [RUBY] Command: 'ruby ' Watcher: [LISTEN] + Launching Retest... Ready to refactor! You can make file changes now OUTPUT