Skip to content

Commit 190bb8d

Browse files
committed
Update Readme
1 parent 9ebece2 commit 190bb8d

File tree

1 file changed

+44
-76
lines changed

1 file changed

+44
-76
lines changed

README.md

Lines changed: 44 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
[![Gem Version](https://badge.fury.io/rb/retest.svg)](https://badge.fury.io/rb/retest)
22

3-
### Retest 2.0 is now available as a pre-release! You can try it out with `gem install retest --pre`.
3+
### Retest 2.0 is now available!
44

55
Feedback is welcome in this [Discussion - Retest V2.0 - Interactive Panel (proof of concept)](https://github.com/AlexB52/retest/discussions/216)
66

77
# Retest
88

9-
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)
9+
A trusty CLI companion to monitor file changes and automatically run the corresponding Ruby specs. Ready to assist on any Ruby project, no setup needed! 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)
1010

1111
## Demo
1212

13-
1413
https://user-images.githubusercontent.com/7149034/153734043-1d136f27-5c24-4676-868b-0fde76016b13.mp4
1514

1615
## Installation
@@ -19,84 +18,72 @@ Install it on your machine without adding it on a Gemfile:
1918

2019
$ gem install retest
2120

22-
## Usage
23-
24-
Retest is used in your terminal after accessing your ruby project folder.
25-
26-
### Help
27-
28-
Find out what retest can do anytime with
29-
30-
$ retest -h
31-
32-
### For Refactoring
33-
34-
#### 1. Run a hardcoded command
35-
36-
This the most simple usage of retest: running the same command over and over after each file update.
37-
38-
Example:
21+
## Ruby Support
3922

40-
$ retest 'bundle exec rspec spec/features/posts_spec.rb'
23+
Retest supports ruby 2.5 and above.
4124

42-
In this example, the feature spec `spec/features/posts_spec.rb` will be tested after any ruby file is updated.
25+
## Watching tools: Watchexec & Listen
4326

44-
#### 2. Run a dynamic command with placeholders
27+
By default retest ships with [Listen](https://github.com/guard/listen) which is used to listen to file changes.
4528

46-
Retest provides few placeholders to help you run a command after every file change. The placeholders can be used on their own or together.
29+
Retest will use [watchexec](https://github.com/watchexec/watchexec) a more performant file watcher when installed on the matchine. watchexec will only work with a version >= 2.2.0
4730

48-
1. `<test>` placeholder
31+
To force the usage of a watcher you can use the `-w` option as `retest -w watchexec`
4932

50-
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.
33+
## Usage
5134

52-
Example:
35+
Retest is used in your terminal after accessing your ruby project folder.
5336

54-
$ retest 'bin/rails test <test>'
55-
56-
In this example, if `app/models/post.rb` is changed then retest will run `bin/rails test test/models/post_test.rb`
57-
58-
2. `<changed>` placeholder
59-
60-
You can use the placeholder `<changed>` to tell the gem where to put the changed file path in your command. When a file is changed, the gem will run the command with it.
37+
### Help
6138

62-
Example:
39+
Find out what retest can do anytime with
6340

64-
$ retest 'rubocop <changed>'
65-
66-
In this example, if `app/models/post.rb` is changed then retest will run `rubocop app/models/post.rb`
41+
$ retest -h
6742

68-
#### 3. Run a dynamic command with shortcuts
43+
Here is a quick summary:
6944

70-
Few shortcut flags exist to avoid writing the full test command.
45+
* run a hardcoded command: `retest 'bin/rails test test/models/post_test.rb'`
46+
* use placeholders: `retest 'bin/rails test <test> && rubocop <changed>`
47+
* play a sound for feedback: `retest --notify`
48+
* run all specs when a file change: `retest --all`
49+
* run all matching specs from a diffed branch: `retest --diff origin/main`
7150

72-
$ retest --rspec
73-
$ retest --rails
74-
$ retest --rake --all
51+
### Interactive companion
7552

76-
#### 4. Let retest figure it all out
53+
An interactive shell will start when launching retest to help your testing workflow. Enter 'h' to see all the options.
7754

78-
Let retest find your ruby setup and run the appropriate command using:
55+
```
56+
Setup identified: [RAKE]. Using command: 'bundle exec rake test TEST=<test>'
57+
Watcher: [WATCHEXEC]
58+
Launching Retest...
59+
Ready to refactor! You can make file changes now
60+
61+
Type interactive command and press enter. Enter 'h' for help.
62+
> h
63+
64+
* 'h', 'help' # Prints help.
65+
* 'p', 'pause' # Pauses Retest. Tests aren't run on file change events until unpaused.
66+
* 'u', 'unpause' # Unpauses Retest.
67+
* <ENTER> # Runs last changed triggered command.
68+
* 'ra, 'run all' # Runs all tests.
69+
* 'f', 'force' # Forces a selection of test to run on every file change.
70+
* 'r', 'reset' # Disables forced selection.
71+
* 'd', 'diff' [GIT BRANCH] # Runs matching specs that changed from a target branch.
72+
* 'c' # Clears window.
73+
* 'e', 'exit' # Exits Retest.
7974
80-
$ retest
81-
$ retest --all
75+
```
76+
### Running rules
8277

83-
#### Running rules
78+
When on a forced selection, retest will run the forced selection regardless of the file changed.
8479

85-
The gem works as follows:
80+
Otherwise, the gem works as follows:
8681

8782
* When a **ruby file** is changed, retest will run its matching test.
8883
* When a **test file** is changed, retest will run the test file.
8984
* When multiple matching test files are found, retest asks you to confirm the file and save the answer.
9085
* When a test file is not found, retest runs the last run command or throw a 404.
9186

92-
### Pull request scans
93-
94-
You can diff a branch and test all the relevant test files before pushing your branch and trigger a full CI suite.
95-
96-
$ retest --diff origin/main
97-
98-
In this example, retest lists all the files changed between `HEAD` and `origin/main`, finds all the relevant tests and only run those.
99-
10087
## Why?
10188
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.
10289

@@ -121,25 +108,6 @@ $ retest 'bundle exec rails test <test>'
121108
* If an error comes in try using `bundle exec` like so: `$ retest 'bundle exec rake test <test>'`
122109
* Aliases saved on ~/.bashrc or ~/.zshrc cannot be run that way with the `retest` command
123110

124-
## Ruby Support
125-
126-
Retest supports ruby 2.5 and above.
127-
128-
## Roadmap
129-
130-
- [x] MVP
131-
- [x] When multiple test files are found, ask which file to run and save the answer.
132-
- [x] When a test file is not found run the last command again.
133-
- [x] Run within Docker.
134-
- [x] Handle main Ruby setups
135-
- [x] Bundler Gem
136-
- [x] Rails
137-
- [x] Ad-hoc scripts
138-
- [x] Hanami
139-
- [ ] Handle other languages: Go, Elixir, Node, Python, PHP
140-
- [ ] Go (project started)
141-
- [ ] Aliases from oh-my-zsh and bash profiles?
142-
143111
## Development
144112

145113
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.

0 commit comments

Comments
 (0)