grubber-twin 0.1.1 → 0.1.2
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/README.md +97 -31
- data/lib/twin/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f64af56bba3d804493af420740dccbe9421ce4571d3c406941d40470dc0dd985
|
|
4
|
+
data.tar.gz: db99fff5aa8de2c7f63756ef151b893cd96a20a70f4ac779bab4a77ea7fd10ab
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 12cc7de69f750b230928d346fd062a96b8771580182d05acb5ffd2b4127e9b954af996c3da33cbfa32fe0137586dfe58ffdf2ee030ceafe0f7b4360af031c3d8
|
|
7
|
+
data.tar.gz: 4d4506b0b8afc2743e990f3b727b58414de97b6cb7d3e8f7eb8c6418979ec071f22f15ec30be765c06a9107712dac1afc742398ea8f4d93692b0019fa39790e2
|
data/README.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# twin
|
|
2
2
|
|
|
3
|
+
[](https://rubygems.org/gems/grubber-twin)
|
|
4
|
+
[](https://github.com/rhsev/grubber-twin/actions/workflows/test.yml)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
3
7
|
Sync configuration folders between two Macs from self-documenting Markdown files.
|
|
4
8
|
|
|
5
9
|
Sync entries are defined in Markdown files with YAML blocks — human-readable,
|
|
@@ -20,28 +24,29 @@ Sync-definitions in Markdown + YAML are three things at once:
|
|
|
20
24
|
add new entries or refactor existing ones, and the result stays valid for both
|
|
21
25
|
humans and grubber.
|
|
22
26
|
|
|
23
|
-
##
|
|
27
|
+
## Screenshots
|
|
24
28
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
twin home_macbook.md # picker — one sync-file in sync_dir (by name)
|
|
28
|
-
twin /abs/path/to/file.md # picker — any sync-file by absolute path
|
|
29
|
-
twin ./relative/dir/ # picker — all sync-files in a directory
|
|
30
|
-
twin list # plain listing
|
|
31
|
-
twin status # listing with source/target mtimes
|
|
32
|
-
twin sync -p grubber # sync one program by name pattern
|
|
33
|
-
twin sync --file=repos # sync all programs from a sync-file
|
|
34
|
-
twin sync --dry-run # preview without writing
|
|
35
|
-
twin --help # show usage
|
|
36
|
-
```
|
|
29
|
+
Stage 1 — program picker. One row per program, color-coded status, indented
|
|
30
|
+
paths underneath:
|
|
37
31
|
|
|
38
|
-
|
|
32
|
+

|
|
39
33
|
|
|
40
|
-
-
|
|
41
|
-
|
|
34
|
+
Stage 2 — multi-select over the paths of one program. The right pane shows a
|
|
35
|
+
compact preview of the relevant sync-file section, rendered by apex:
|
|
36
|
+
|
|
37
|
+

|
|
42
38
|
|
|
43
39
|
## Installation
|
|
44
40
|
|
|
41
|
+
### 1. Install grubber
|
|
42
|
+
|
|
43
|
+
twin parses sync-files via [grubber](https://github.com/rhsev/grubber), a
|
|
44
|
+
small Go binary. Download the latest release for your platform from
|
|
45
|
+
[github.com/rhsev/grubber/releases](https://github.com/rhsev/grubber/releases)
|
|
46
|
+
and put it somewhere in your `PATH` (e.g. `/usr/local/bin/grubber`).
|
|
47
|
+
|
|
48
|
+
### 2. Install twin
|
|
49
|
+
|
|
45
50
|
```bash
|
|
46
51
|
gem install grubber-twin
|
|
47
52
|
```
|
|
@@ -55,9 +60,65 @@ gem build grubber-twin.gemspec
|
|
|
55
60
|
gem install ./grubber-twin-*.gem
|
|
56
61
|
```
|
|
57
62
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
`
|
|
63
|
+
### 3. Other tools
|
|
64
|
+
|
|
65
|
+
Also required in `PATH`: `rsync` (preinstalled on macOS), `fzf`
|
|
66
|
+
(`brew install fzf`). For the stage-2 preview, one of `apex`, `glow`,
|
|
67
|
+
or `bat` is recommended (falls back in that order; `cat` if none are
|
|
68
|
+
present).
|
|
69
|
+
|
|
70
|
+
## Quickstart
|
|
71
|
+
|
|
72
|
+
1. **Pick a directory for sync-files** (anywhere; this example uses `~/Sync`):
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
mkdir -p ~/Sync
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
2. **Create the config** at `~/.config/twin/config.yaml`:
|
|
79
|
+
|
|
80
|
+
```yaml
|
|
81
|
+
sync_dir: ~/Sync
|
|
82
|
+
global_excludes:
|
|
83
|
+
- .DS_Store
|
|
84
|
+
- .git/
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
3. **Drop a sync-file** into `~/Sync`. The simplest starting point is to copy
|
|
88
|
+
one of the [examples](examples/) and adapt the frontmatter:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
cp examples/home.md ~/Sync/
|
|
92
|
+
$EDITOR ~/Sync/home.md # edit Source: and Target:
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
4. **Run twin**:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
twin
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Pick a program, then the paths to sync, hit Enter.
|
|
102
|
+
|
|
103
|
+
## Usage
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
twin # picker — all programs across all sync-files
|
|
107
|
+
twin home.md # picker — one sync-file in sync_dir (by name)
|
|
108
|
+
twin /abs/path/to/file.md # picker — any sync-file by absolute path
|
|
109
|
+
twin ./relative/dir/ # picker — all sync-files in a directory
|
|
110
|
+
twin list # plain listing
|
|
111
|
+
twin status # listing with source/target mtimes
|
|
112
|
+
twin sync -p grubber # sync one program by name pattern
|
|
113
|
+
twin sync --file=repos # sync all programs from a sync-file
|
|
114
|
+
twin sync --dry-run # preview without writing
|
|
115
|
+
twin --help # show usage
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
File argument resolution:
|
|
119
|
+
|
|
120
|
+
- bare name (no `/`) → looked up by substring in `sync_dir`
|
|
121
|
+
- contains `/` → resolved as path (absolute or relative); file or directory both work
|
|
61
122
|
|
|
62
123
|
## Configuration
|
|
63
124
|
|
|
@@ -70,8 +131,11 @@ global_excludes:
|
|
|
70
131
|
- .DS_Store
|
|
71
132
|
- .git/
|
|
72
133
|
|
|
73
|
-
|
|
74
|
-
|
|
134
|
+
# Optional preview rendering (apex):
|
|
135
|
+
# apex_theme: default
|
|
136
|
+
# apex_width: 80
|
|
137
|
+
# apex_code_highlight: monokai
|
|
138
|
+
# apex_code_highlight_theme: dark
|
|
75
139
|
```
|
|
76
140
|
|
|
77
141
|
Environment overrides: `TWIN_SYNC_DIR`, `TWIN_CONFIG`.
|
|
@@ -79,14 +143,17 @@ Environment overrides: `TWIN_SYNC_DIR`, `TWIN_CONFIG`.
|
|
|
79
143
|
## Sync-files
|
|
80
144
|
|
|
81
145
|
Each Markdown file represents one sync relationship. Frontmatter defines the
|
|
82
|
-
relationship; YAML blocks define individual paths.
|
|
146
|
+
relationship (Source/Target); YAML blocks define individual paths.
|
|
147
|
+
|
|
148
|
+
See [examples/home.md](examples/home.md) and [examples/repos.md](examples/repos.md)
|
|
149
|
+
for ready-to-adapt templates.
|
|
83
150
|
|
|
84
|
-
|
|
151
|
+
Minimal example:
|
|
85
152
|
|
|
86
153
|
````markdown
|
|
87
154
|
---
|
|
88
155
|
Active: 1
|
|
89
|
-
Label: mac-mini→macbook
|
|
156
|
+
Label: mac-mini → macbook
|
|
90
157
|
Source: /Users/admin
|
|
91
158
|
Target: /Volumes/macbook/Users/admin
|
|
92
159
|
---
|
|
@@ -107,17 +174,16 @@ Frontmatter fields (`Active`, `Label`, `Source`, `Target`) are merged into
|
|
|
107
174
|
every block by grubber. Multiple blocks can share the same `Program` — twin
|
|
108
175
|
groups them and treats the program as the unit of selection.
|
|
109
176
|
|
|
110
|
-
The optional `Cmd` field runs a shell command after a successful sync
|
|
177
|
+
The optional `Cmd` field runs a shell command after a successful sync (useful
|
|
178
|
+
for reloading services or notifying companions).
|
|
111
179
|
|
|
112
180
|
## Design
|
|
113
181
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
- **No TUI framework:** `fzf` does the interactive part, `apex` the rendering.
|
|
118
|
-
Composition over framework.
|
|
182
|
+
Sync instructions and context in one place — the same Markdown file holds
|
|
183
|
+
both the `Path:` directives and the prose explaining them. No TUI framework:
|
|
184
|
+
`fzf` does the interactive part, `apex` the rendering.
|
|
119
185
|
|
|
120
|
-
See
|
|
186
|
+
See [ARCHITECTURE.md](ARCHITECTURE.md) for the data model and internals.
|
|
121
187
|
|
|
122
188
|
## Tests
|
|
123
189
|
|
data/lib/twin/version.rb
CHANGED