retest 1.13.2 → 2.0.0.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +2 -2
- data/.gitignore +2 -1
- data/Gemfile.lock +3 -3
- data/bin/test/bundler-app +2 -1
- data/bin/test/git-ruby +2 -1
- data/bin/test/hanami-app +4 -3
- data/bin/test/rails-app +2 -1
- data/bin/test/reset_helpers +13 -0
- data/bin/test/rspec-rails +2 -1
- data/bin/test/rspec-ruby +2 -1
- data/bin/test/ruby-app +2 -1
- data/bin/test/ruby-bare +2 -1
- data/exe/retest +61 -4
- data/lib/retest/program/pausable.rb +17 -0
- data/lib/retest/program.rb +19 -2
- data/lib/retest/prompt.rb +26 -20
- data/lib/retest/version.rb +1 -1
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8619aafdd8a06156dcd417ca5ed6dcf453acacdf025a3fba15578d4caba4caf9
|
4
|
+
data.tar.gz: ecee718559ad1ace718eeec856bab148aa37aa05a75a427dc060f52c4961a2c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3389785c3fdf525180b9203b87b316046a8ac4963f958ad70066d0a73be7fff879efd11878bfa12744aaf43b54c163ba509ec9248c104447b8746c8422f8ee1b
|
7
|
+
data.tar.gz: a59c5006a914117cda203394d3734660d496fc38e65633be54afe62b441e47d6ef4c4d4adccdba9a91cc4d73c02d9ab86527da3e8b3fb0d24a11892a6214d910
|
data/.github/workflows/ci.yml
CHANGED
@@ -11,7 +11,7 @@ on:
|
|
11
11
|
push:
|
12
12
|
branches: [ main ]
|
13
13
|
pull_request:
|
14
|
-
branches: [ main ]
|
14
|
+
branches: [ main, v2.0 ]
|
15
15
|
|
16
16
|
jobs:
|
17
17
|
unit-tests:
|
@@ -28,7 +28,7 @@ jobs:
|
|
28
28
|
- 3.2
|
29
29
|
- 3.3
|
30
30
|
include:
|
31
|
-
- os: macos-
|
31
|
+
- os: macos-13
|
32
32
|
ruby: 2.5
|
33
33
|
name: Ruby ${{ matrix.ruby }} test (${{ matrix.os }})
|
34
34
|
steps:
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
retest (
|
4
|
+
retest (2.0.0.pre)
|
5
5
|
listen (~> 3.9)
|
6
6
|
observer (~> 0.1)
|
7
7
|
string-similarity (~> 2.1)
|
@@ -11,7 +11,7 @@ GEM
|
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
13
|
byebug (11.1.3)
|
14
|
-
ffi (1.
|
14
|
+
ffi (1.17.0)
|
15
15
|
listen (3.9.0)
|
16
16
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
17
17
|
rb-inotify (~> 0.9, >= 0.9.10)
|
@@ -19,7 +19,7 @@ GEM
|
|
19
19
|
observer (0.1.2)
|
20
20
|
rake (13.0.6)
|
21
21
|
rb-fsevent (0.11.2)
|
22
|
-
rb-inotify (0.
|
22
|
+
rb-inotify (0.11.1)
|
23
23
|
ffi (~> 1.0)
|
24
24
|
string-similarity (2.1.0)
|
25
25
|
tty-option (0.3.0)
|
data/bin/test/bundler-app
CHANGED
@@ -2,5 +2,6 @@
|
|
2
2
|
|
3
3
|
bundle install
|
4
4
|
bundle exec rake build
|
5
|
+
cp -R features/support features/bundler-app/retest
|
5
6
|
ls -t pkg | head -n1 | xargs -I {} mv pkg/{} features/bundler-app/retest.gem
|
6
|
-
docker
|
7
|
+
docker compose -f features/bundler-app/docker-compose.yml up --build --exit-code-from retest
|
data/bin/test/git-ruby
CHANGED
@@ -2,5 +2,6 @@
|
|
2
2
|
|
3
3
|
bundle install
|
4
4
|
bundle exec rake build
|
5
|
+
cp -R features/support features/git-ruby/retest
|
5
6
|
ls -t pkg | head -n1 | xargs -I {} mv pkg/{} features/git-ruby/retest.gem
|
6
|
-
docker
|
7
|
+
docker compose -f features/git-ruby/docker-compose.yml up --build --exit-code-from retest
|
data/bin/test/hanami-app
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
|
3
3
|
bundle install
|
4
4
|
bundle exec rake build
|
5
|
+
cp -R features/support features/hanami-app/retest
|
5
6
|
ls -t pkg | head -n1 | xargs -I {} mv pkg/{} features/hanami-app/retest.gem
|
6
|
-
docker
|
7
|
-
docker
|
8
|
-
docker
|
7
|
+
docker compose -f features/hanami-app/docker-compose.yml build
|
8
|
+
docker compose -f features/hanami-app/docker-compose.yml run retest sh bin/test_setup
|
9
|
+
docker compose -f features/hanami-app/docker-compose.yml up --exit-code-from retest
|
data/bin/test/rails-app
CHANGED
@@ -2,5 +2,6 @@
|
|
2
2
|
|
3
3
|
bundle install
|
4
4
|
bundle exec rake build
|
5
|
+
cp -R features/support features/rails-app/retest
|
5
6
|
ls -t pkg | head -n1 | xargs -I {} mv pkg/{} features/rails-app/retest.gem
|
6
|
-
docker
|
7
|
+
docker compose -f features/rails-app/docker-compose.yml up --build --exit-code-from retest
|
data/bin/test/rspec-rails
CHANGED
@@ -2,5 +2,6 @@
|
|
2
2
|
|
3
3
|
bundle install
|
4
4
|
bundle exec rake build
|
5
|
+
cp -R features/support features/rspec-rails/retest
|
5
6
|
ls -t pkg | head -n1 | xargs -I {} mv pkg/{} features/rspec-rails/retest.gem
|
6
|
-
docker
|
7
|
+
docker compose -f features/rspec-rails/docker-compose.yml up --build --exit-code-from retest
|
data/bin/test/rspec-ruby
CHANGED
@@ -2,5 +2,6 @@
|
|
2
2
|
|
3
3
|
bundle install
|
4
4
|
bundle exec rake build
|
5
|
+
cp -R features/support features/rspec-ruby/retest
|
5
6
|
ls -t pkg | head -n1 | xargs -I {} mv pkg/{} features/rspec-ruby/retest.gem
|
6
|
-
docker
|
7
|
+
docker compose -f features/rspec-ruby/docker-compose.yml up --build --exit-code-from retest
|
data/bin/test/ruby-app
CHANGED
@@ -2,5 +2,6 @@
|
|
2
2
|
|
3
3
|
bundle install
|
4
4
|
bundle exec rake build
|
5
|
+
cp -R features/support features/ruby-app/retest
|
5
6
|
ls -t pkg | head -n1 | xargs -I {} mv pkg/{} features/ruby-app/retest.gem
|
6
|
-
docker
|
7
|
+
docker compose -f features/ruby-app/docker-compose.yml up --build --exit-code-from retest
|
data/bin/test/ruby-bare
CHANGED
@@ -2,5 +2,6 @@
|
|
2
2
|
|
3
3
|
bundle install
|
4
4
|
bundle exec rake build
|
5
|
+
cp -R features/support features/ruby-bare/retest
|
5
6
|
ls -t pkg | head -n1 | xargs -I {} mv pkg/{} features/ruby-bare/retest.gem
|
6
|
-
docker
|
7
|
+
docker compose -f features/ruby-bare/docker-compose.yml up --build --exit-code-from retest
|
data/exe/retest
CHANGED
@@ -3,8 +3,14 @@
|
|
3
3
|
require 'retest'
|
4
4
|
|
5
5
|
$stdout.sync = true
|
6
|
+
prompt_rd, prompt_wr = IO.pipe
|
6
7
|
|
7
|
-
Signal.trap(:INT)
|
8
|
+
Signal.trap(:INT) do
|
9
|
+
$stdout.puts "Goodbye"
|
10
|
+
prompt_rd.close
|
11
|
+
prompt_wr.close
|
12
|
+
exit
|
13
|
+
end
|
8
14
|
|
9
15
|
options = Retest::Options.new(ARGV)
|
10
16
|
|
@@ -18,7 +24,7 @@ if options.version?
|
|
18
24
|
return
|
19
25
|
end
|
20
26
|
|
21
|
-
prompt = Retest::Prompt.new
|
27
|
+
prompt = Retest::Prompt.new(input: prompt_rd)
|
22
28
|
repository = Retest::Repository.new(files: Retest::VersionControl.files, prompt: prompt)
|
23
29
|
command = Retest::Command.for_options(options)
|
24
30
|
runner = Retest::Runners.runner_for(command.to_s)
|
@@ -49,7 +55,9 @@ end
|
|
49
55
|
$stdout.puts launching_message
|
50
56
|
Retest.listen(options) do |modified, added, removed|
|
51
57
|
begin
|
52
|
-
program.run(modified, added, removed)
|
58
|
+
program.run(modified, added, removed) do
|
59
|
+
print_interactive_message
|
60
|
+
end
|
53
61
|
rescue => e
|
54
62
|
$stdout.puts "Something went wrong: #{e.message}"
|
55
63
|
end
|
@@ -58,4 +66,53 @@ $stdout.puts "Ready to refactor! You can make file changes now"
|
|
58
66
|
|
59
67
|
# not blocking
|
60
68
|
|
61
|
-
|
69
|
+
def print_interactive_message
|
70
|
+
puts "\nType interactive command and press enter"
|
71
|
+
print(">\s")
|
72
|
+
end
|
73
|
+
|
74
|
+
loop do
|
75
|
+
print_interactive_message
|
76
|
+
|
77
|
+
input = $stdin.gets.chomp
|
78
|
+
if prompt.question_asked?
|
79
|
+
prompt_wr.puts input
|
80
|
+
next
|
81
|
+
end
|
82
|
+
|
83
|
+
case input
|
84
|
+
when 'p', 'pause'
|
85
|
+
program.pause
|
86
|
+
puts "Program is paused\n"
|
87
|
+
when 'u', 'unpause'
|
88
|
+
program.resume
|
89
|
+
puts "Program has been resumed\n"
|
90
|
+
when 'e', 'exit'
|
91
|
+
Process.kill("INT", 0)
|
92
|
+
when ''
|
93
|
+
puts "Running last command\n"
|
94
|
+
runner.run(nil, repository: repository)
|
95
|
+
when 'ra', 'run all'
|
96
|
+
puts "Running all tests\n"
|
97
|
+
tmp_opts = options.dup.tap { |opts| opts.params[:all] = true }
|
98
|
+
tmp_cmd = Retest::Command.for_options(tmp_opts)
|
99
|
+
tmp_runner = Retest::Runners.runner_for(tmp_cmd.to_s)
|
100
|
+
tmp_runner.add_observer(sounds)
|
101
|
+
tmp_runner.run
|
102
|
+
tmp_runner.delete_observers
|
103
|
+
when /^di?f?f?\s(.*)$/
|
104
|
+
program.diff($1)
|
105
|
+
when 'h', 'help'
|
106
|
+
puts <<~HELP
|
107
|
+
|
108
|
+
* 'h' or 'help' -> Prints help
|
109
|
+
* 'p' or 'pause' -> Pauses Retest. Tests aren't run until unpaused.
|
110
|
+
* 'u' or 'unpause' -> Unpauses Retest
|
111
|
+
* <Enter> -> Runs last changed triggered command
|
112
|
+
* 'ra', 'run all' -> Runs all tests
|
113
|
+
* 'e' or 'exit' -> Exits Retest
|
114
|
+
HELP
|
115
|
+
else
|
116
|
+
puts "Unknown interactive command #{input}\n"
|
117
|
+
end
|
118
|
+
end
|
data/lib/retest/program.rb
CHANGED
@@ -1,18 +1,27 @@
|
|
1
|
+
require_relative 'program/pausable'
|
2
|
+
|
1
3
|
module Retest
|
2
4
|
class Program
|
5
|
+
include Pausable
|
6
|
+
|
3
7
|
attr_accessor :runner, :repository, :command
|
4
|
-
def initialize(runner: nil, repository: nil, command: nil)
|
8
|
+
def initialize(runner: nil, repository: nil, command: nil, clear_window: true)
|
5
9
|
@runner = runner
|
6
10
|
@repository = repository
|
7
11
|
@command = command
|
12
|
+
@clear_window = clear_window
|
13
|
+
initialize_pause(false)
|
8
14
|
end
|
9
15
|
|
10
16
|
def run(modified, added, removed)
|
11
17
|
repository.sync(added: added, removed: removed)
|
12
18
|
runner.sync(added: added, removed: removed)
|
13
|
-
system('clear 2>/dev/null') || system('cls 2>/dev/null')
|
14
19
|
|
20
|
+
return if paused?
|
21
|
+
|
22
|
+
clear_terminal
|
15
23
|
runner.run (modified + added).first, repository: repository
|
24
|
+
yield if block_given?
|
16
25
|
end
|
17
26
|
|
18
27
|
def diff(branch)
|
@@ -25,5 +34,13 @@ module Retest
|
|
25
34
|
puts "Running tests..."
|
26
35
|
runner.run_all_tests command.format_batch(*test_files)
|
27
36
|
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def clear_terminal
|
41
|
+
return unless @clear_window
|
42
|
+
|
43
|
+
system('clear 2>/dev/null') || system('cls 2>/dev/null')
|
44
|
+
end
|
28
45
|
end
|
29
46
|
end
|
data/lib/retest/prompt.rb
CHANGED
@@ -2,36 +2,34 @@ module Retest
|
|
2
2
|
class Prompt
|
3
3
|
include Observable
|
4
4
|
|
5
|
-
def self.ask_which_test_to_use(path, files)
|
6
|
-
new.ask_which_test_to_use(path, files)
|
7
|
-
end
|
8
|
-
|
9
|
-
def self.puts(*args)
|
10
|
-
new.puts(*args)
|
11
|
-
end
|
12
|
-
|
13
5
|
attr_accessor :input, :output
|
14
6
|
def initialize(input: nil, output: nil)
|
15
7
|
@input = input || $stdin
|
16
8
|
@output = output || $stdout
|
9
|
+
@question_asked = false
|
17
10
|
end
|
18
11
|
|
19
|
-
def
|
20
|
-
|
21
|
-
|
22
|
-
options = options(files)
|
12
|
+
def question_asked?
|
13
|
+
@question_asked
|
14
|
+
end
|
23
15
|
|
24
|
-
|
25
|
-
|
16
|
+
def ask_which_test_to_use(path, files)
|
17
|
+
ask_question do
|
18
|
+
changed
|
19
|
+
notify_observers(:question)
|
20
|
+
options = options(files)
|
26
21
|
|
27
|
-
|
22
|
+
output.puts(<<~QUESTION)
|
23
|
+
We found few tests matching: #{path}
|
28
24
|
|
29
|
-
|
30
|
-
Enter the file number now:
|
31
|
-
QUESTION
|
32
|
-
output.print("> ")
|
25
|
+
#{list_options(options.keys)}
|
33
26
|
|
34
|
-
|
27
|
+
Which file do you want to use?
|
28
|
+
Enter the file number now:
|
29
|
+
QUESTION
|
30
|
+
output.print("> ")
|
31
|
+
options.values[input.gets.chomp.to_i]
|
32
|
+
end
|
35
33
|
end
|
36
34
|
|
37
35
|
def puts(*args)
|
@@ -42,6 +40,14 @@ module Retest
|
|
42
40
|
output.tap(&:rewind).read
|
43
41
|
end
|
44
42
|
|
43
|
+
def ask_question
|
44
|
+
old_question_asked = @question_asked
|
45
|
+
@question_asked = true
|
46
|
+
yield
|
47
|
+
ensure
|
48
|
+
@question_asked = old_question_asked
|
49
|
+
end
|
50
|
+
|
45
51
|
private
|
46
52
|
|
47
53
|
def options(files, blank_option: 'none')
|
data/lib/retest/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: retest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexandre Barret
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: string-similarity
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0.1'
|
69
|
-
description:
|
69
|
+
description:
|
70
70
|
email:
|
71
71
|
- alex@abletech.nz
|
72
72
|
executables:
|
@@ -90,6 +90,7 @@ files:
|
|
90
90
|
- bin/test/git-ruby
|
91
91
|
- bin/test/hanami-app
|
92
92
|
- bin/test/rails-app
|
93
|
+
- bin/test/reset_helpers
|
93
94
|
- bin/test/rspec-rails
|
94
95
|
- bin/test/rspec-ruby
|
95
96
|
- bin/test/ruby-app
|
@@ -106,6 +107,7 @@ files:
|
|
106
107
|
- lib/retest/matching_options/path.rb
|
107
108
|
- lib/retest/options.rb
|
108
109
|
- lib/retest/program.rb
|
110
|
+
- lib/retest/program/pausable.rb
|
109
111
|
- lib/retest/prompt.rb
|
110
112
|
- lib/retest/repository.rb
|
111
113
|
- lib/retest/runners.rb
|
@@ -127,7 +129,7 @@ licenses:
|
|
127
129
|
metadata:
|
128
130
|
homepage_uri: https://github.com/AlexB52/retest
|
129
131
|
source_code_uri: https://github.com/AlexB52/retest
|
130
|
-
post_install_message:
|
132
|
+
post_install_message:
|
131
133
|
rdoc_options: []
|
132
134
|
require_paths:
|
133
135
|
- lib
|
@@ -142,8 +144,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
144
|
- !ruby/object:Gem::Version
|
143
145
|
version: '0'
|
144
146
|
requirements: []
|
145
|
-
rubygems_version: 3.
|
146
|
-
signing_key:
|
147
|
+
rubygems_version: 3.5.3
|
148
|
+
signing_key:
|
147
149
|
specification_version: 4
|
148
150
|
summary: A simple command line tool to watch file change and run its matching spec.
|
149
151
|
test_files: []
|