retest 1.1.0 → 1.4.0
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 +3 -2
- data/Gemfile.lock +5 -5
- data/README.md +50 -56
- data/bin/debug +8 -2
- data/bin/test/ruby-bare +6 -0
- data/exe/retest +8 -2
- data/lib/retest/command/rails.rb +13 -6
- data/lib/retest/command/rake.rb +13 -6
- data/lib/retest/command/rspec.rb +12 -5
- data/lib/retest/command/ruby.rb +17 -5
- data/lib/retest/command.rb +4 -4
- data/lib/retest/file_system.rb +9 -0
- data/lib/retest/options.rb +15 -14
- data/lib/retest/program.rb +49 -0
- data/lib/retest/runner.rb +1 -1
- data/lib/retest/version.rb +1 -1
- data/lib/retest.rb +2 -46
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c5dc87b26d27197158d859e17e179f9dc0b00ec2280dfefff165da388c77eb6
|
4
|
+
data.tar.gz: cffbfbf72ea1b51e7f63e288fba08727498ec582192536a54ad9d2b47f04d1d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad4051278ba14ff9f7284de5f8f643bdec7512864bb330aac803f6e3c672cc24f5584eb4b26be9f4a2b533a229fd5366a0eece8b4aa53eb816ff3e9c6575f200
|
7
|
+
data.tar.gz: 3b52308adcef24e6098f40ee07d55848f39104838c4db404394ee33a8ffe38466478cd18f347aa73b3a0072fc0c263592a9eecf1ed98e459345be160c02ed30f
|
data/.github/workflows/ci.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
retest (1.
|
4
|
+
retest (1.4.0)
|
5
5
|
listen (~> 3.2)
|
6
6
|
string-similarity (~> 2.1)
|
7
7
|
tty-option (~> 0.1)
|
@@ -10,17 +10,17 @@ GEM
|
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
12
|
byebug (11.1.3)
|
13
|
-
ffi (1.15.
|
14
|
-
listen (3.
|
13
|
+
ffi (1.15.4)
|
14
|
+
listen (3.7.0)
|
15
15
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
16
16
|
rb-inotify (~> 0.9, >= 0.9.10)
|
17
17
|
minitest (5.14.1)
|
18
18
|
rake (12.3.3)
|
19
|
-
rb-fsevent (0.
|
19
|
+
rb-fsevent (0.11.0)
|
20
20
|
rb-inotify (0.10.1)
|
21
21
|
ffi (~> 1.0)
|
22
22
|
string-similarity (2.1.0)
|
23
|
-
tty-option (0.
|
23
|
+
tty-option (0.2.0)
|
24
24
|
|
25
25
|
PLATFORMS
|
26
26
|
ruby
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
[](https://badge.fury.io/rb/retest)
|
2
|
+
|
1
3
|
# Retest
|
2
4
|
|
3
5
|
Retest is a small command-line tool to help you refactor code by watching a file change and running its matching spec. Designed to be dev-centric and project independent, it can be used on the fly. No Gemfile updates, no commits to a repo or configuration files required to start refactoring. Works with every Ruby projects (at least that is the end goal)
|
@@ -14,13 +16,37 @@ Install it on your machine without adding it on a Gemfile:
|
|
14
16
|
|
15
17
|
## Usage
|
16
18
|
|
17
|
-
|
19
|
+
Retest is used in your terminal after accessing your ruby project folder.
|
20
|
+
|
21
|
+
### Help
|
22
|
+
|
23
|
+
Find out what retest can do anytime with
|
24
|
+
|
25
|
+
$ retest -h
|
26
|
+
|
27
|
+
### For Refactoring
|
28
|
+
|
29
|
+
#### 1. Run a hardcoded command
|
30
|
+
|
31
|
+
This the most simple usage of retest: running the same command over and over after each file update.
|
18
32
|
|
19
|
-
|
33
|
+
Example:
|
20
34
|
|
21
|
-
$ retest 'bundle exec rspec
|
35
|
+
$ retest 'bundle exec rspec spec/features/posts_spec.rb'
|
22
36
|
|
23
|
-
|
37
|
+
In this example, the feature spec `spec/features/posts_spec.rb` will be tested after any ruby file is updated.
|
38
|
+
|
39
|
+
#### 2. Run a dynamic command
|
40
|
+
|
41
|
+
You can use the placeholder `<test>` to tell the gem where to put the test file path in your command. When a file is changed, the gem will find its matching test and run the test command with it.
|
42
|
+
|
43
|
+
Example:
|
44
|
+
|
45
|
+
$ retest 'bin/rails test <test>'
|
46
|
+
|
47
|
+
In this example, if `app/models/post.rb` is changed then retest will run `bin/rails test test/models/post_test.rb`
|
48
|
+
|
49
|
+
#### 3. Run a dynamic command with shortcuts
|
24
50
|
|
25
51
|
Few shortcut flags exist to avoid writing the full test command.
|
26
52
|
|
@@ -28,65 +54,29 @@ Few shortcut flags exist to avoid writing the full test command.
|
|
28
54
|
$ retest --rails
|
29
55
|
$ retest --rake --all
|
30
56
|
|
31
|
-
|
57
|
+
#### 4. Let retest figure it all out
|
58
|
+
|
59
|
+
Let retest find your ruby setup and run the appropriate command using:
|
32
60
|
|
33
61
|
$ retest
|
34
|
-
$ retest --
|
35
|
-
|
62
|
+
$ retest --all
|
63
|
+
|
64
|
+
#### Running rules
|
36
65
|
|
37
66
|
The gem works as follows:
|
38
67
|
|
39
|
-
* When a file is changed, retest will run its matching test.
|
40
|
-
* When a test
|
68
|
+
* When a **ruby file** is changed, retest will run its matching test.
|
69
|
+
* When a **test file** is changed, retest will run the test file.
|
41
70
|
* When multiple matching test files are found, retest asks you to confirm the file and save the answer.
|
42
71
|
* When a test file is not found, retest runs the last run command or throw a 404.
|
43
72
|
|
44
|
-
|
73
|
+
### Pull request scans
|
45
74
|
|
46
|
-
|
47
|
-
Usage: retest [OPTIONS] [COMMAND]
|
48
|
-
|
49
|
-
Watch a file change and run it matching spec.
|
50
|
-
|
51
|
-
Arguments:
|
52
|
-
COMMAND The test command to rerun when a file changes.
|
53
|
-
Use <test> placeholder to tell retest where to put the matching
|
54
|
-
spec.
|
55
|
-
|
56
|
-
|
57
|
-
Options:
|
58
|
-
--all Run all the specs of a specificied ruby setup
|
59
|
-
--auto Indentify repository setup and runs appropriate command
|
60
|
-
-h, --help Print usage
|
61
|
-
--rails Shortcut for 'bundle exec rails test <test>'
|
62
|
-
--rake Shortcut for 'bundle exec rake test TEST=<test>'
|
63
|
-
--rspec Shortcut for 'bundle exec rspec <test>'
|
64
|
-
--ruby Shortcut for 'bundle exec ruby <test>'
|
65
|
-
|
66
|
-
Examples:
|
67
|
-
Runs a matching rails test after a file change
|
68
|
-
$ retest 'bundle exec rails test <test>'
|
69
|
-
$ retest --rails
|
75
|
+
You can diff a branch and test all the relevant test files before pushing your branch and trigger a full CI suite.
|
70
76
|
|
71
|
-
|
72
|
-
$ retest 'bundle exec rails test'
|
73
|
-
$ retest --rails --all
|
77
|
+
$ retest --diff origin/main
|
74
78
|
|
75
|
-
|
76
|
-
$ retest 'ruby lib/bottles_test.rb'
|
77
|
-
|
78
|
-
Let retest identify which command to run
|
79
|
-
$ retest
|
80
|
-
$ retest --auto
|
81
|
-
|
82
|
-
Let retest identify which command to run for all tests
|
83
|
-
$ retest --all
|
84
|
-
$ retest --auto --all
|
85
|
-
|
86
|
-
Run a sanity check on changed files from a branch
|
87
|
-
$ retest --diff origin/main --rails
|
88
|
-
$ retest --diff main --auto
|
89
|
-
```
|
79
|
+
In this example, retest lists all the files changed between `HEAD` and `origin/main`, finds all the relevant tests and only run those.
|
90
80
|
|
91
81
|
## Why?
|
92
82
|
It is advised to be one `cmd + z` away from green tests when refactoring. This means running tests after every line change. Let Retest rerun your tests after every file change you make.
|
@@ -98,8 +88,12 @@ For fully fledged solutions, some cli tools already exists: [autotest](https://g
|
|
98
88
|
## Docker
|
99
89
|
|
100
90
|
Retest works in Docker too. You can install the gem and launch retest in your container while refactoring.
|
91
|
+
|
101
92
|
```bash
|
102
|
-
|
93
|
+
# Enter your container. Ex:
|
94
|
+
$ docker-compose run web bash
|
95
|
+
|
96
|
+
# Install the gem and run retest in your container shell
|
103
97
|
$ gem install retest
|
104
98
|
$ retest 'bundle exec rails test <test>'
|
105
99
|
```
|
@@ -118,12 +112,13 @@ Retest supports ruby 2.4 and above.
|
|
118
112
|
- [x] When multiple test files are found, ask which file to run and save the answer.
|
119
113
|
- [x] When a test file is not found run the last command again.
|
120
114
|
- [x] Run within Docker.
|
121
|
-
- [
|
115
|
+
- [x] Handle main Ruby setups
|
122
116
|
- [x] Bundler Gem
|
123
117
|
- [x] Rails
|
124
118
|
- [x] Ad-hoc scripts
|
125
119
|
- [x] Hanami
|
126
|
-
- [ ] Handle other languages: Elixir, Node, Python, PHP
|
120
|
+
- [ ] Handle other languages: Go, Elixir, Node, Python, PHP
|
121
|
+
- [ ] Go (project started)
|
127
122
|
- [ ] Aliases from oh-my-zsh and bash profiles?
|
128
123
|
|
129
124
|
## Development
|
@@ -136,7 +131,6 @@ To run integration tests on one setup (ex: hanami-app): `bin/test/hanami-app`
|
|
136
131
|
|
137
132
|
To access an app container (ex: ruby-app): `docker-compose -f features/ruby-app/docker-compose.yml run retest sh`
|
138
133
|
|
139
|
-
|
140
134
|
## Contributing
|
141
135
|
|
142
136
|
Bug reports and pull requests are welcome on GitHub at https://github.com/alexb52/retest.
|
data/bin/debug
CHANGED
@@ -13,9 +13,15 @@ if options.help?
|
|
13
13
|
return
|
14
14
|
end
|
15
15
|
|
16
|
+
repository = Retest::Repository.new(files: Retest::VersionControl.files)
|
17
|
+
command = Retest::Command.for_options(options)
|
18
|
+
runner = Retest::Runner.for(command.to_s)
|
19
|
+
|
16
20
|
program = Retest::Program.new(
|
17
|
-
|
18
|
-
|
21
|
+
extension: options.extension,
|
22
|
+
repository: repository,
|
23
|
+
command: command,
|
24
|
+
runner: runner
|
19
25
|
)
|
20
26
|
|
21
27
|
if options.params[:diff]
|
data/bin/test/ruby-bare
ADDED
data/exe/retest
CHANGED
@@ -11,9 +11,15 @@ if options.help?
|
|
11
11
|
return
|
12
12
|
end
|
13
13
|
|
14
|
+
repository = Retest::Repository.new(files: Retest::VersionControl.files)
|
15
|
+
command = Retest::Command.for_options(options)
|
16
|
+
runner = Retest::Runner.for(command.to_s)
|
17
|
+
|
14
18
|
program = Retest::Program.new(
|
15
|
-
|
16
|
-
|
19
|
+
extension: options.extension,
|
20
|
+
repository: repository,
|
21
|
+
command: command,
|
22
|
+
runner: runner
|
17
23
|
)
|
18
24
|
|
19
25
|
if options.params[:diff]
|
data/lib/retest/command/rails.rb
CHANGED
@@ -1,22 +1,29 @@
|
|
1
1
|
module Retest
|
2
2
|
class Command
|
3
|
-
Rails
|
4
|
-
|
5
|
-
|
3
|
+
class Rails
|
4
|
+
attr_reader :all, :file_system
|
5
|
+
|
6
|
+
def initialize(all:, file_system: FileSystem)
|
7
|
+
@file_system = file_system
|
8
|
+
@all = all
|
6
9
|
end
|
7
10
|
|
8
|
-
def
|
11
|
+
def to_s
|
9
12
|
return "#{root_command} <test>" unless all
|
10
13
|
root_command
|
11
14
|
end
|
12
15
|
|
16
|
+
def run_all(*files, runner:)
|
17
|
+
runner.run files.join(' ')
|
18
|
+
end
|
19
|
+
|
13
20
|
private
|
14
21
|
|
15
22
|
def root_command
|
16
|
-
return 'bin/rails test' if
|
23
|
+
return 'bin/rails test' if file_system.exist? 'bin/rails'
|
17
24
|
|
18
25
|
'bundle exec rails test'
|
19
26
|
end
|
20
27
|
end
|
21
28
|
end
|
22
|
-
end
|
29
|
+
end
|
data/lib/retest/command/rake.rb
CHANGED
@@ -1,22 +1,29 @@
|
|
1
1
|
module Retest
|
2
2
|
class Command
|
3
|
-
Rake
|
4
|
-
|
5
|
-
|
3
|
+
class Rake
|
4
|
+
attr_reader :all, :file_system
|
5
|
+
|
6
|
+
def initialize(all:, file_system: FileSystem)
|
7
|
+
@file_system = file_system
|
8
|
+
@all = all
|
6
9
|
end
|
7
10
|
|
8
|
-
def
|
11
|
+
def to_s
|
9
12
|
return "#{root_command} TEST=<test>" unless all
|
10
13
|
root_command
|
11
14
|
end
|
12
15
|
|
16
|
+
def run_all(*files, runner:)
|
17
|
+
runner.run files.size > 1 ? "\"{#{files.join(',')}}\"" : files.first
|
18
|
+
end
|
19
|
+
|
13
20
|
private
|
14
21
|
|
15
22
|
def root_command
|
16
|
-
return 'bin/rake test' if
|
23
|
+
return 'bin/rake test' if file_system.exist? 'bin/rake'
|
17
24
|
|
18
25
|
'bundle exec rake test'
|
19
26
|
end
|
20
27
|
end
|
21
28
|
end
|
22
|
-
end
|
29
|
+
end
|
data/lib/retest/command/rspec.rb
CHANGED
@@ -1,19 +1,26 @@
|
|
1
1
|
module Retest
|
2
2
|
class Command
|
3
|
-
Rspec
|
4
|
-
|
5
|
-
|
3
|
+
class Rspec
|
4
|
+
attr_reader :all, :file_system
|
5
|
+
|
6
|
+
def initialize(all:, file_system: FileSystem)
|
7
|
+
@file_system = file_system
|
8
|
+
@all = all
|
6
9
|
end
|
7
10
|
|
8
|
-
def
|
11
|
+
def to_s
|
9
12
|
return "#{root_command} <test>" unless all
|
10
13
|
root_command
|
11
14
|
end
|
12
15
|
|
16
|
+
def run_all(*files, runner:)
|
17
|
+
runner.run files.join(' ')
|
18
|
+
end
|
19
|
+
|
13
20
|
private
|
14
21
|
|
15
22
|
def root_command
|
16
|
-
return 'bin/rspec' if
|
23
|
+
return 'bin/rspec' if file_system.exist? 'bin/rspec'
|
17
24
|
|
18
25
|
'bundle exec rspec'
|
19
26
|
end
|
data/lib/retest/command/ruby.rb
CHANGED
@@ -1,12 +1,24 @@
|
|
1
1
|
module Retest
|
2
2
|
class Command
|
3
|
-
Ruby
|
4
|
-
|
5
|
-
|
3
|
+
class Ruby
|
4
|
+
attr_reader :all, :file_system
|
5
|
+
|
6
|
+
def initialize(all:, file_system: FileSystem)
|
7
|
+
@file_system = file_system
|
8
|
+
@all = all
|
9
|
+
end
|
10
|
+
|
11
|
+
def run_all(*files, runner:)
|
12
|
+
paths = files.map { |file| "require './#{file}';" }.join
|
13
|
+
runner.run %Q{-e "#{paths}"}
|
6
14
|
end
|
7
15
|
|
8
|
-
def
|
9
|
-
|
16
|
+
def to_s
|
17
|
+
if file_system.exist? 'Gemfile.lock'
|
18
|
+
'bundle exec ruby <test>'
|
19
|
+
else
|
20
|
+
'ruby <test>'
|
21
|
+
end
|
10
22
|
end
|
11
23
|
end
|
12
24
|
end
|
data/lib/retest/command.rb
CHANGED
@@ -59,19 +59,19 @@ module Retest
|
|
59
59
|
private
|
60
60
|
|
61
61
|
def rspec_command
|
62
|
-
Rspec.
|
62
|
+
Rspec.new(all: full_suite?)
|
63
63
|
end
|
64
64
|
|
65
65
|
def rails_command
|
66
|
-
Rails.
|
66
|
+
Rails.new(all: full_suite?)
|
67
67
|
end
|
68
68
|
|
69
69
|
def rake_command
|
70
|
-
Rake.
|
70
|
+
Rake.new(all: full_suite?)
|
71
71
|
end
|
72
72
|
|
73
73
|
def ruby_command
|
74
|
-
Ruby.
|
74
|
+
Ruby.new(all: full_suite?)
|
75
75
|
end
|
76
76
|
end
|
77
77
|
end
|
data/lib/retest/options.rb
CHANGED
@@ -4,15 +4,6 @@ module Retest
|
|
4
4
|
class Options
|
5
5
|
include TTY::Option
|
6
6
|
|
7
|
-
RSPEC_COMMAND = "bundle exec rspec <test>"
|
8
|
-
RAILS_COMMAND = "bundle exec rails test <test>"
|
9
|
-
RAKE_COMMAND = "bundle exec rake test TEST=<test>"
|
10
|
-
RUBY_COMMAND = "bundle exec ruby <test>"
|
11
|
-
|
12
|
-
ALL_RAKE_COMMAND = "bundle exec rake test"
|
13
|
-
ALL_RAILS_COMMAND = "bundle exec rails test"
|
14
|
-
ALL_RSPEC_COMMAND = "bundle exec rspec"
|
15
|
-
|
16
7
|
usage do
|
17
8
|
program "retest"
|
18
9
|
|
@@ -69,6 +60,12 @@ module Retest
|
|
69
60
|
long "--diff=git-branch"
|
70
61
|
end
|
71
62
|
|
63
|
+
option :ext do
|
64
|
+
desc "Regex of file extensions to listen to"
|
65
|
+
long "--ext=regex"
|
66
|
+
default "\\.rb$"
|
67
|
+
end
|
68
|
+
|
72
69
|
flag :all do
|
73
70
|
long "--all"
|
74
71
|
desc "Run all the specs of a specificied ruby setup"
|
@@ -87,22 +84,22 @@ module Retest
|
|
87
84
|
|
88
85
|
flag :rspec do
|
89
86
|
long "--rspec"
|
90
|
-
desc "Shortcut for
|
87
|
+
desc "Shortcut for a standard RSpec setup"
|
91
88
|
end
|
92
89
|
|
93
90
|
flag :rake do
|
94
91
|
long "--rake"
|
95
|
-
desc "Shortcut for
|
92
|
+
desc "Shortcut for a standard Rake setup"
|
96
93
|
end
|
97
94
|
|
98
95
|
flag :rails do
|
99
96
|
long "--rails"
|
100
|
-
desc "Shortcut for
|
97
|
+
desc "Shortcut for a standard Rails setup"
|
101
98
|
end
|
102
99
|
|
103
100
|
flag :ruby do
|
104
101
|
long "--ruby"
|
105
|
-
desc "Shortcut for
|
102
|
+
desc "Shortcut for a Ruby project"
|
106
103
|
end
|
107
104
|
|
108
105
|
attr_reader :args
|
@@ -133,10 +130,14 @@ module Retest
|
|
133
130
|
params[:auto]
|
134
131
|
end
|
135
132
|
|
133
|
+
def extension
|
134
|
+
Regexp.new(params[:ext])
|
135
|
+
end
|
136
|
+
|
136
137
|
private
|
137
138
|
|
138
139
|
def no_options_passed?
|
139
|
-
params.to_h.values.compact.uniq == [false]
|
140
|
+
params.to_h.values.compact.uniq == ["\\.rb$", false]
|
140
141
|
end
|
141
142
|
end
|
142
143
|
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Retest
|
2
|
+
class Program
|
3
|
+
attr_accessor :runner, :repository, :command, :extension
|
4
|
+
def initialize(runner: nil, repository: nil, command: nil, extension: /\.rb$/)
|
5
|
+
@runner = runner
|
6
|
+
@repository = repository
|
7
|
+
@command = command
|
8
|
+
@extension = extension
|
9
|
+
end
|
10
|
+
|
11
|
+
def start
|
12
|
+
puts "Launching Retest..."
|
13
|
+
build.start
|
14
|
+
puts "Ready to refactor! You can make file changes now"
|
15
|
+
end
|
16
|
+
|
17
|
+
def diff(branch)
|
18
|
+
raise "Git not installed" unless VersionControl::Git.installed?
|
19
|
+
test_files = repository.find_tests VersionControl::Git.diff_files(branch)
|
20
|
+
|
21
|
+
puts "Tests found:"
|
22
|
+
test_files.each { |test_file| puts " - #{test_file}" }
|
23
|
+
|
24
|
+
puts "Running tests..."
|
25
|
+
command.run_all *test_files, runner: runner
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def build
|
31
|
+
Listen.to('.', only: extension, relative: true) do |modified, added, removed|
|
32
|
+
begin
|
33
|
+
repository.add(added)
|
34
|
+
repository.remove(removed)
|
35
|
+
runner.remove(removed)
|
36
|
+
system('clear 2>/dev/null') || system('cls 2>/dev/null')
|
37
|
+
|
38
|
+
runner.run test_file_to_run(modified + added)
|
39
|
+
rescue => e
|
40
|
+
puts "Something went wrong: #{e.message}"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_file_to_run(changed_files)
|
46
|
+
repository.find_test changed_files.first if runner.matching?
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
data/lib/retest/runner.rb
CHANGED
data/lib/retest/version.rb
CHANGED
data/lib/retest.rb
CHANGED
@@ -9,53 +9,9 @@ require "retest/options"
|
|
9
9
|
require "retest/version_control"
|
10
10
|
require "retest/setup"
|
11
11
|
require "retest/command"
|
12
|
+
require "retest/file_system"
|
13
|
+
require "retest/program"
|
12
14
|
|
13
15
|
module Retest
|
14
16
|
class Error < StandardError; end
|
15
|
-
|
16
|
-
class Program
|
17
|
-
attr_accessor :runner, :repository
|
18
|
-
def initialize(runner: nil, repository: nil)
|
19
|
-
@runner = runner
|
20
|
-
@repository = repository
|
21
|
-
end
|
22
|
-
|
23
|
-
def start
|
24
|
-
puts "Launching Retest..."
|
25
|
-
build.start
|
26
|
-
puts "Ready to refactor! You can make file changes now"
|
27
|
-
end
|
28
|
-
|
29
|
-
def diff(branch)
|
30
|
-
raise "Git not installed" unless VersionControl::Git.installed?
|
31
|
-
test_files = repository.find_tests VersionControl::Git.diff_files(branch)
|
32
|
-
|
33
|
-
puts "Tests found:"
|
34
|
-
test_files.each { |test_file| puts " - #{test_file}" }
|
35
|
-
|
36
|
-
puts "Running tests..."
|
37
|
-
test_files.each { |test_file| runner.run test_file }
|
38
|
-
end
|
39
|
-
|
40
|
-
private
|
41
|
-
|
42
|
-
def build
|
43
|
-
Listen.to('.', only: /\.rb$/, relative: true) do |modified, added, removed|
|
44
|
-
begin
|
45
|
-
repository.add(added)
|
46
|
-
repository.remove(removed)
|
47
|
-
runner.remove(removed)
|
48
|
-
system('clear 2>/dev/null') || system('cls 2>/dev/null')
|
49
|
-
|
50
|
-
runner.run test_file_to_run(modified + added)
|
51
|
-
rescue => e
|
52
|
-
puts "Something went wrong: #{e.message}"
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def test_file_to_run(changed_files)
|
58
|
-
repository.find_test changed_files.first if runner.matching?
|
59
|
-
end
|
60
|
-
end
|
61
17
|
end
|
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: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexandre Barret
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: string-similarity
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- bin/test/rspec-rails
|
79
79
|
- bin/test/rspec-ruby
|
80
80
|
- bin/test/ruby-app
|
81
|
+
- bin/test/ruby-bare
|
81
82
|
- exe/retest
|
82
83
|
- lib/retest.rb
|
83
84
|
- lib/retest/command.rb
|
@@ -85,7 +86,9 @@ files:
|
|
85
86
|
- lib/retest/command/rake.rb
|
86
87
|
- lib/retest/command/rspec.rb
|
87
88
|
- lib/retest/command/ruby.rb
|
89
|
+
- lib/retest/file_system.rb
|
88
90
|
- lib/retest/options.rb
|
91
|
+
- lib/retest/program.rb
|
89
92
|
- lib/retest/repository.rb
|
90
93
|
- lib/retest/runner.rb
|
91
94
|
- lib/retest/setup.rb
|