retest 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 56507242c2a092f077dbad839369ce929e59bdc8e0b6c0e29436a9893d12ca79
4
- data.tar.gz: 27eb3934eba008e23834ebec21bb42e680a143c349d33bb42c56d9b396bfed5a
3
+ metadata.gz: 11025d0acc3dd4ebc43c33828e0617d86658890155f686c9d15c58fcf7cac9a1
4
+ data.tar.gz: 8a0a8a7dd9bfbb1412b7ac81e2c2e36d007770d10ab057c10c3c7bbdb4b8db88
5
5
  SHA512:
6
- metadata.gz: a0fc4a62969f81110fef3630ae11a0badc4436c93cbc0502922f4f342c2ff050e449b15c5b4f949f37a6a8e755702e1b5c03741c3dccb7870401d95a67c8702e
7
- data.tar.gz: 6042dcced199dd65e4b276f2eecc56c487f482216529079c35a84b5c133525c169dd7695d6f2d92d6c3074f6edeac50f7818a4f75ec1d1c179eca65727b5a581
6
+ metadata.gz: a9ece5d9b5b65b2fb23ece15cf129b231de2dfdb9990a3136c2a5b0661ecb9fab176b42cd852a7cd8d44543f5138c29c5ae219d46d002a3ebb7b81056e574ba8
7
+ data.tar.gz: 74d8c637ada13a8d0bf4aa7709802bb0a37fd5012b34d25af8eebf65a8e4907370bd614cf4ded9ba7a2658b2be85a4176d0b972d93bd6ead7c57647f32dc894c
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- retest (0.3.1)
4
+ retest (0.4.0)
5
5
  listen (~> 3.2)
6
6
  string-similarity (~> 2.1)
7
7
 
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. You don't need a configuration file to start refactoring.
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
+ ![demo](https://alexbarret.com/images/external/retest-demo-26bcad04.gif)
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 withing Docker.
69
+ - [x] Run within Docker.
68
70
  - [ ] Aliases from oh-my-zsh and bash profiles?
69
71
 
70
72
  ## Development
@@ -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 'Could not find a file test matching'
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
 
@@ -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)
@@ -1,3 +1,3 @@
1
1
  module Retest
2
- VERSION = "0.3.1"
2
+ VERSION = "0.4.0"
3
3
  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: 0.3.1
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-06 00:00:00.000000000 Z
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.1.2
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: []