retest 0.3.1 → 0.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/Gemfile.lock +1 -1
- data/README.md +4 -2
- data/lib/retest/command.rb +4 -1
- data/lib/retest/repository.rb +6 -0
- data/lib/retest/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11025d0acc3dd4ebc43c33828e0617d86658890155f686c9d15c58fcf7cac9a1
|
4
|
+
data.tar.gz: 8a0a8a7dd9bfbb1412b7ac81e2c2e36d007770d10ab057c10c3c7bbdb4b8db88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9ece5d9b5b65b2fb23ece15cf129b231de2dfdb9990a3136c2a5b0661ecb9fab176b42cd852a7cd8d44543f5138c29c5ae219d46d002a3ebb7b81056e574ba8
|
7
|
+
data.tar.gz: 74d8c637ada13a8d0bf4aa7709802bb0a37fd5012b34d25af8eebf65a8e4907370bd614cf4ded9ba7a2658b2be85a4176d0b972d93bd6ead7c57647f32dc894c
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Retest
|
2
2
|
|
3
|
-
Retest is a small command line tool to help refactor code by watching a file change and running its matching spec.
|
3
|
+
Retest is a small command line tool to help refactor code by watching a file change and running its matching spec. It is meant to be used on the fly. No Gemfile updates or configuration file required to start refactoring. Works with every Ruby projects (at least that is the end goal)
|
4
4
|
|
5
5
|
## Why?
|
6
6
|
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.
|
@@ -9,6 +9,8 @@ Retest gem is meant to be simple and follow testing conventions encountered in R
|
|
9
9
|
|
10
10
|
For stable, yet more and fully fledged solutions, some cli tools already exists: [autotest](https://github.com/grosser/autotest), [guard](https://github.com/guard/guard), [zentest](https://github.com/seattlerb/zentest)
|
11
11
|
|
12
|
+

|
13
|
+
|
12
14
|
## Installation
|
13
15
|
|
14
16
|
Install it on your machine with:
|
@@ -64,7 +66,7 @@ $ retest 'bundle exec rails test <test>'
|
|
64
66
|
- [x] MVP
|
65
67
|
- [x] When multiple test files are found, ask which file to run and save the answer.
|
66
68
|
- [x] When a test file is not found run the last command again.
|
67
|
-
- [x] Run
|
69
|
+
- [x] Run within Docker.
|
68
70
|
- [ ] Aliases from oh-my-zsh and bash profiles?
|
69
71
|
|
70
72
|
## Development
|
data/lib/retest/command.rb
CHANGED
@@ -25,7 +25,10 @@ module Retest
|
|
25
25
|
puts "Test File Selected: #{cached_test_file}"
|
26
26
|
system command.gsub('<test>', cached_test_file)
|
27
27
|
else
|
28
|
-
puts
|
28
|
+
puts <<~ERROR
|
29
|
+
404 - Test File Not Found
|
30
|
+
Retest could not find a matching test file to run.
|
31
|
+
ERROR
|
29
32
|
end
|
30
33
|
end
|
31
34
|
|
data/lib/retest/repository.rb
CHANGED
@@ -26,6 +26,8 @@ module Retest
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def test_options(path)
|
29
|
+
return [path] if is_test_file?(path)
|
30
|
+
|
29
31
|
files.select { |file| regex(path) =~ file }
|
30
32
|
.sort_by { |file| String::Similarity.levenshtein(path, file) }
|
31
33
|
.last(5)
|
@@ -36,6 +38,10 @@ module Retest
|
|
36
38
|
@default_files ||= Dir.glob('**/*') - Dir.glob('{tmp,node_modules}/**/*')
|
37
39
|
end
|
38
40
|
|
41
|
+
def is_test_file?(path)
|
42
|
+
Regexp.new(".*(?:spec|test)#{File.extname(path)}") =~ path
|
43
|
+
end
|
44
|
+
|
39
45
|
def regex(path)
|
40
46
|
extname = File.extname(path)
|
41
47
|
basename = File.basename(path, extname)
|
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: 0.
|
4
|
+
version: 0.4.0
|
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: 2020-09-
|
11
|
+
date: 2020-09-12 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'
|
69
|
-
description:
|
69
|
+
description:
|
70
70
|
email:
|
71
71
|
- alex@abletech.nz
|
72
72
|
executables:
|
@@ -96,7 +96,7 @@ licenses:
|
|
96
96
|
metadata:
|
97
97
|
homepage_uri: https://github.com/AlexB52/retest
|
98
98
|
source_code_uri: https://github.com/AlexB52/retest
|
99
|
-
post_install_message:
|
99
|
+
post_install_message:
|
100
100
|
rdoc_options: []
|
101
101
|
require_paths:
|
102
102
|
- lib
|
@@ -111,8 +111,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: '0'
|
113
113
|
requirements: []
|
114
|
-
rubygems_version: 3.
|
115
|
-
signing_key:
|
114
|
+
rubygems_version: 3.0.3
|
115
|
+
signing_key:
|
116
116
|
specification_version: 4
|
117
117
|
summary: A simple command line tool to watch file change and run its matching spec.
|
118
118
|
test_files: []
|