red_dot 0.1.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 +7 -0
- data/LICENSE +21 -0
- data/README.md +190 -0
- data/exe/rdot +9 -0
- data/lib/red_dot/app.rb +1169 -0
- data/lib/red_dot/cli.rb +41 -0
- data/lib/red_dot/config.rb +85 -0
- data/lib/red_dot/example_discovery.rb +87 -0
- data/lib/red_dot/rspec_result.rb +101 -0
- data/lib/red_dot/rspec_runner.rb +71 -0
- data/lib/red_dot/spec_discovery.rb +180 -0
- data/lib/red_dot/version.rb +5 -0
- data/lib/red_dot.rb +23 -0
- metadata +89 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: e48a83c891b5b2979651d8c6f766f47b8f25718e4c303ebca0068764bca0226e
|
|
4
|
+
data.tar.gz: aa3bf5f6074d7a126336e2292e7c8803698ed62d50eaba4aeae7f65254704d94
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: c811553942cc8d55e78b802e5fe056f57130e56de9956dd1d32a0cf147e0f63a379ae044f06a36465ce382ea0512bfa14bfeb6cc143f725845cf6da29e5eb664
|
|
7
|
+
data.tar.gz: 5325b9d2fb1cb15902c398893077e4d9eb55ecf98ddae1c3af7a9b7ae912b5f25e86f37f40f2c0ebf7367cdaff472215f405dbb157961bcd1556f21f24481fa1
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Vell
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# Red Dot
|
|
2
|
+
|
|
3
|
+
A terminal UI for running RSpec tests. Start it from your project directory, leave it open, and run specs whenever you want.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add to your Gemfile:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem "red_dot"
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or install directly:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
gem install red_dot
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Build and install locally
|
|
20
|
+
|
|
21
|
+
To build and install the gem from source (e.g. for development or testing):
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
git clone https://github.com/red_dot/red_dot.git
|
|
25
|
+
cd red_dot
|
|
26
|
+
bundle install
|
|
27
|
+
gem build red_dot.gemspec
|
|
28
|
+
gem install red_dot-*.gem
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Or install without building a `.gem` file (uses the local directory):
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
cd /path/to/red_dot
|
|
35
|
+
bundle install
|
|
36
|
+
gem install --local .
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Requires Ruby 3.2+ and `bundle install` will pull in dependencies (bubbletea, lipgloss).
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
**Single project**: From your project root (where your `spec/` directory lives), or from any directory with a `spec/`:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
rdot
|
|
47
|
+
# or with a specific directory
|
|
48
|
+
rdot /path/to/project
|
|
49
|
+
|
|
50
|
+
# Index spec files with the following key combination:
|
|
51
|
+
shift + i
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Umbrella / component projects**: From the repo root that has a root-level `components/` directory, run `rdot` to see and run specs from the root (if it has a `spec/` dir) and from each direct child of `components/` that has a `spec/` subdirectory. Each component’s specs run in that component’s directory (using its Gemfile). You can still run `rdot` from inside a component (e.g. `cd components/auth && rdot`) for single-component mode.
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
### One-off options (CLI)
|
|
58
|
+
|
|
59
|
+
Override options for a single run without editing config or the TUI:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
rdot --format documentation
|
|
63
|
+
rdot --tag slow --fail-fast /path/to/project/root
|
|
64
|
+
rdot -f progress -t focus -o /tmp/out.txt
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
| Option | Short | Description |
|
|
68
|
+
|--------|-------|-------------|
|
|
69
|
+
| `--format` | `-f` | RSpec formatter (e.g. progress, documentation) |
|
|
70
|
+
| `--tag` | `-t` | Tag filter (repeatable) |
|
|
71
|
+
| `--output` | `-o` | Output file path |
|
|
72
|
+
| `--example` | `-e` | Example filter (e.g. regex) |
|
|
73
|
+
| `--line` | `-l` | Line number (run single example at path:line when running one file) |
|
|
74
|
+
| `--fail-fast` | — | Stop on first failure |
|
|
75
|
+
|
|
76
|
+
### Configuration
|
|
77
|
+
|
|
78
|
+
Options are merged in this order (later overrides earlier):
|
|
79
|
+
|
|
80
|
+
1. **Defaults** (see table below)
|
|
81
|
+
2. **User config** — `~/.config/red_dot/config.yml` (or `$XDG_CONFIG_HOME/red_dot/config.yml`)
|
|
82
|
+
3. **Project config** — `.red_dot.yml` in the project root
|
|
83
|
+
4. **CLI** — flags passed to `rdot`
|
|
84
|
+
|
|
85
|
+
All of these can be overridden via config YAML (user or project). In the TUI, press `o` to focus the options bar and edit any field (Enter to edit or toggle).
|
|
86
|
+
|
|
87
|
+
| Option | Default | Config key | Notes |
|
|
88
|
+
|--------|--------|------------|-------|
|
|
89
|
+
| Tags | *(empty)* | `tags` or `tags_str` | RSpec tag filter. Use `tags:` (array) or `tags_str:` (string, e.g. `"~slow, focus"`). |
|
|
90
|
+
| Format | `progress` | `format` | RSpec formatter: e.g. `progress`, `documentation`. |
|
|
91
|
+
| Output | *(empty)* | `output` | File path for RSpec output. Also accepts legacy key `out_path`. |
|
|
92
|
+
| Example | *(empty)* | `example_filter` | Example filter (e.g. regex) passed to RSpec. |
|
|
93
|
+
| Line | *(empty)* | `line_number` | Line number for single-file runs (path:line). |
|
|
94
|
+
| Fail-fast | `false` | `fail_fast` | Stop on first failure. Use `true` or `false`. |
|
|
95
|
+
| Seed | *(empty)* | `seed` | RSpec random seed (e.g. `12345`) for reproducibility. |
|
|
96
|
+
| Editor | `cursor` | `editor` | Editor for “open file” (O): `vscode`, `cursor`, or `textmate`. |
|
|
97
|
+
|
|
98
|
+
| Components | *(auto)* | `components` | Umbrella only: list of component root paths (relative to project root). Overrides automatic discovery. Use `"."` or `""` for root, e.g. `[".", "components/auth", "apps/web"]`. |
|
|
99
|
+
|
|
100
|
+
Example `~/.config/red_dot/config.yml`:
|
|
101
|
+
|
|
102
|
+
```yaml
|
|
103
|
+
format: documentation
|
|
104
|
+
tags_str: "~slow"
|
|
105
|
+
fail_fast: false
|
|
106
|
+
editor: cursor # vscode, cursor, or textmate — used when opening file (O)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Example `.red_dot.yml` in project root:
|
|
110
|
+
|
|
111
|
+
```yaml
|
|
112
|
+
format: progress
|
|
113
|
+
tags:
|
|
114
|
+
- focus
|
|
115
|
+
output: /tmp/rspec.out
|
|
116
|
+
editor: vscode # optional: vscode, cursor, or textmate
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
You can edit any option in the TUI: press `o` for Options, then ←/→ or j/k to move, Enter to edit a field, toggle fail-fast, or cycle editor (vscode → cursor → textmate).
|
|
120
|
+
|
|
121
|
+
The TUI uses a layout with numbered panels and a shared status bar:
|
|
122
|
+
|
|
123
|
+
- **Panel 1 — Options**: Top bar (Tags, Format, Output, Example, Line, Fail-fast, Editor). Press `1` or `o` to focus; ←/→ or j/k to move, Enter to edit or toggle (Editor cycles vscode/cursor/textmate); `b` or Esc to unfocus.
|
|
124
|
+
- **Panel 2 — Spec files**: Left panel (browse, →/← expand/collapse to show tests per file, Space to select files, Enter/s to run, `e` to run at line or run focused example, `O` to open selected file in editor).
|
|
125
|
+
- **Panel 3 — Output/Results**: Right panel (idle message, live RSpec output, or results). Press `3` to focus when results are available.
|
|
126
|
+
- **Status bar**: Key hints at the bottom. Press **`1`**, **`2`**, or **`3`** from anywhere to switch focus to that panel.
|
|
127
|
+
|
|
128
|
+
The TUI stays open until you press `q` or Ctrl+C. You can:
|
|
129
|
+
|
|
130
|
+
- **File list**: Browse spec files; press **→** to expand a file (list its tests) and **←** to collapse. Press **I** to **index** all spec files (builds a searchable cache with a progress bar; run once so find can match test names without expanding). Select files with Space, run with Enter or `s` (selected), `a` (all), `e` (run at line on a file, or run the focused example when on an example row), `f` (failed, after a run with failures). Use **/** to find; search matches file paths and test names for indexed (or expanded) files — put the cursor on a matched example and press Enter to run just that test. **Esc** or **Enter** exits find and collapses all files. Use **]** to expand all files and **\[** to collapse all.
|
|
131
|
+
- **Options** (top bar): Always visible. Press `o` to focus; ←/→ or j/k to move, Enter to edit a field or toggle fail-fast; `b` or Esc to unfocus.
|
|
132
|
+
- **Running**: See live RSpec output in the right panel. Press `q` to kill the run and return to the file list.
|
|
133
|
+
- **Results**: In the right panel; j/k to move over failures, `e` to run that single example (path:line), `O` to open that file in your configured editor, `r` to rerun same scope, `f` to rerun only failed examples.
|
|
134
|
+
|
|
135
|
+
### Key bindings
|
|
136
|
+
|
|
137
|
+
| Key | Action |
|
|
138
|
+
|-----|--------|
|
|
139
|
+
| **1** | Focus panel 1 (Options) |
|
|
140
|
+
| **2** | Focus panel 2 (Spec files) |
|
|
141
|
+
| **3** | Focus panel 3 (Output/Results; only when results exist) |
|
|
142
|
+
| q / Esc | Quit |
|
|
143
|
+
|
|
144
|
+
| Key | Action (file list — panel 2) |
|
|
145
|
+
|-----|------------------------------|
|
|
146
|
+
| j / ↓ | Move down |
|
|
147
|
+
| k / ↑ | Move up |
|
|
148
|
+
| → | Expand file (show its tests) |
|
|
149
|
+
| ← | Collapse file (or move to parent file and collapse) |
|
|
150
|
+
| ] | Expand all files |
|
|
151
|
+
| [ | Collapse all files |
|
|
152
|
+
| Space | Toggle selection (files only) |
|
|
153
|
+
| Enter | Run selected (or current file/example if none selected) |
|
|
154
|
+
| a | Run all specs |
|
|
155
|
+
| s | Run selected specs |
|
|
156
|
+
| e | Run at line (prompt for line number on a file) or run this example (when on an example row) |
|
|
157
|
+
| O | Open selected file (or example’s file at line) in configured editor (vscode/cursor/textmate) |
|
|
158
|
+
| f | Run failed only (after a run with failures) |
|
|
159
|
+
| I | Index all spec files (build cache for find; shows progress bar) |
|
|
160
|
+
| o | Focus options (panel 1) |
|
|
161
|
+
| R | Refresh file list |
|
|
162
|
+
| q / Esc | Quit |
|
|
163
|
+
|
|
164
|
+
| Key | Action (options bar — panel 1) |
|
|
165
|
+
|-----|---------------------------------|
|
|
166
|
+
| 2 | Focus panel 2 (Spec files) |
|
|
167
|
+
| ← / → or j / k | Move between fields |
|
|
168
|
+
| Enter | Edit field, toggle fail-fast, or cycle editor (vscode/cursor/textmate) |
|
|
169
|
+
| b / Esc | Unfocus options, back to file list |
|
|
170
|
+
| q | Quit |
|
|
171
|
+
|
|
172
|
+
| Key | Action (results — panel 3) |
|
|
173
|
+
|-----|----------------------------|
|
|
174
|
+
| j / k | Move between failed examples |
|
|
175
|
+
| e | Run this example only (path:line) |
|
|
176
|
+
| O | Open this file in configured editor |
|
|
177
|
+
| 2 / b / Esc | Back to file list |
|
|
178
|
+
| r | Rerun same scope |
|
|
179
|
+
| f | Rerun failed only |
|
|
180
|
+
| q | Quit |
|
|
181
|
+
|
|
182
|
+
## Requirements
|
|
183
|
+
|
|
184
|
+
- Ruby 3.2+
|
|
185
|
+
- A terminal (TTY)
|
|
186
|
+
- RSpec in your project (the gem invokes `bundle exec rspec` or `rspec` via the CLI)
|
|
187
|
+
|
|
188
|
+
## License
|
|
189
|
+
|
|
190
|
+
MIT
|
data/exe/rdot
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
gem_root = File.expand_path('..', __dir__)
|
|
5
|
+
require 'bundler/setup' if File.exist?(File.join(gem_root, 'Gemfile'))
|
|
6
|
+
load File.expand_path('lib/red_dot.rb', gem_root)
|
|
7
|
+
|
|
8
|
+
parsed = RedDot::Cli.parse(ARGV)
|
|
9
|
+
RedDot.run(working_dir: parsed[:working_dir], option_overrides: parsed[:option_overrides])
|