ratatui_ruby-devtools 0.1.3 → 0.2.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/CHANGELOG.md +11 -0
- data/LICENSES/BSD-2-Clause.txt +9 -0
- data/README.md +1 -1
- data/exe/hbs +149 -209
- data/exe/scaffold +169 -282
- data/lib/ratatui_ruby/devtools/tasks/lint.rake +3 -7
- data/lib/ratatui_ruby/devtools/tasks/release/ci_run.rb +44 -0
- data/lib/ratatui_ruby/devtools/tasks/release/github_cli.rb +36 -0
- data/lib/ratatui_ruby/devtools/tasks/release/native_gem_version.rb +70 -0
- data/lib/ratatui_ruby/devtools/tasks/release/platform_gem.rb +63 -0
- data/lib/ratatui_ruby/devtools/tasks/release/versioned_binary.rb +36 -0
- data/lib/ratatui_ruby/devtools/tasks/release.rake +87 -0
- data/lib/ratatui_ruby/devtools/tasks/resources/rubies.yml +1 -1
- data/lib/ratatui_ruby/devtools/templates/.github/workflows/build-gems.yml.erb +124 -0
- data/lib/ratatui_ruby/devtools/templates/.github/workflows/ci.yml.erb +77 -0
- data/lib/ratatui_ruby/devtools/templates/.gitignore.erb +2 -0
- data/lib/ratatui_ruby/devtools/templates/.rubocop.yml.erb +6 -4
- data/lib/ratatui_ruby/devtools/templates/AGENTS.md.erb +101 -28
- data/lib/ratatui_ruby/devtools/templates/CODE_OF_CONDUCT.md.erb +44 -0
- data/lib/ratatui_ruby/devtools/templates/CONTRIBUTING.md.erb +80 -0
- data/lib/ratatui_ruby/devtools/templates/Gemfile.erb +2 -2
- data/lib/ratatui_ruby/devtools/templates/README.md.erb +46 -13
- data/lib/ratatui_ruby/devtools/templates/REUSE.toml.erb +2 -2
- data/lib/ratatui_ruby/devtools/templates/Rakefile.erb +4 -4
- data/lib/ratatui_ruby/devtools/templates/bin/setup.erb +21 -11
- data/lib/ratatui_ruby/devtools/templates/bin/setup.ps1.erb +105 -0
- data/lib/ratatui_ruby/devtools/templates/doc/custom.css.erb +3 -3
- data/lib/ratatui_ruby/devtools/templates/doc/getting_started/quickstart.md.erb +3 -3
- data/lib/ratatui_ruby/devtools/templates/doc/index.md.erb +2 -2
- data/lib/ratatui_ruby/devtools/templates/ext/.cargo/config.toml.erb +15 -0
- data/lib/ratatui_ruby/devtools/templates/ext/.gitignore.erb +6 -0
- data/lib/ratatui_ruby/devtools/templates/ext/Cargo.toml.erb +20 -0
- data/lib/ratatui_ruby/devtools/templates/ext/clippy.toml.erb +9 -0
- data/lib/ratatui_ruby/devtools/templates/ext/extconf.rb.erb +23 -0
- data/lib/ratatui_ruby/devtools/templates/ext/src/lib.rs.erb +13 -0
- data/lib/ratatui_ruby/devtools/templates/gemspec.erb +21 -14
- data/lib/ratatui_ruby/devtools/templates/lib/main.rb.erb +19 -0
- data/lib/ratatui_ruby/devtools/templates/lib/test_helper.rb.erb +26 -0
- data/lib/ratatui_ruby/devtools/templates/lib/version.rb.erb +10 -0
- data/lib/ratatui_ruby/devtools/templates/mise.toml.erb +3 -3
- data/lib/ratatui_ruby/devtools/templates/tasks/example_viewer.html.erb +23 -23
- data/lib/ratatui_ruby/devtools/templates/tasks/resources/index.html.erb +15 -16
- data/lib/ratatui_ruby/devtools/templates/tasks/resources/rubies.yml.erb +5 -6
- data/lib/ratatui_ruby/devtools/templates/test/test_helper.rb.erb +15 -0
- data/lib/ratatui_ruby/devtools/version.rb +1 -1
- data/lib/ratatui_ruby/devtools.rb +2 -2
- metadata +24 -5
- data/lib/ratatui_ruby/devtools/tasks/resources/build.yml.erb +0 -54
- data/lib/ratatui_ruby/devtools/tasks/sourcehut.rake +0 -94
- data/lib/ratatui_ruby/devtools/templates/tasks/resources/build.yml.erb +0 -62
- /data/lib/ratatui_ruby/devtools/templates/{vendor/goodcop/base.yml → lib/rubocop.yml} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
SPDX-FileCopyrightText:
|
|
2
|
+
SPDX-FileCopyrightText: <%= year %> <%= copyright_holder %>
|
|
3
3
|
SPDX-License-Identifier: CC-BY-SA-4.0
|
|
4
4
|
-->
|
|
5
5
|
|
|
@@ -9,57 +9,130 @@
|
|
|
9
9
|
|
|
10
10
|
Project Name: <%= gem_name %>
|
|
11
11
|
|
|
12
|
-
Description:
|
|
12
|
+
Description: <%= description %>
|
|
13
|
+
|
|
14
|
+
## Stability & Compatibility
|
|
15
|
+
|
|
16
|
+
<%- unless update_mode -%>
|
|
17
|
+
- **Project Status:** Pre-1.0.
|
|
18
|
+
- **Breaking Changes:** Backward compatibility is **NOT YET** a priority. You are encouraged to refactor APIs for better ergonomics and performance even if it breaks existing code.
|
|
19
|
+
<%- end -%>
|
|
20
|
+
- **Requirement:** All breaking changes **MUST** be explicitly documented in the [CHANGELOG.md](CHANGELOG.md)'s **Unreleased** section. Migration guides in `doc/` are expected for releases with significant numbers of breaking changes.
|
|
13
21
|
|
|
14
22
|
## 1. Standards
|
|
15
23
|
|
|
16
24
|
### STRICT REQUIREMENTS
|
|
17
25
|
|
|
26
|
+
- **Check Before Implementing:** FIRST check tests for existing coverage. If it works, say so and point to the test.
|
|
18
27
|
- Every file MUST begin with an SPDX-compliant header. Use `<%= license %>` for code; `CC-BY-SA-4.0` for documentation. `reuse annotate` can help you generate the header. **For Ruby files**, wrap SPDX comments in `#--` / `#++` to hide them from RDoc output.
|
|
19
28
|
- Every line of Ruby MUST be covered by tests that would stand up to mutation testing.
|
|
20
29
|
- Tests must be meaningful and verify specific behavior or rendering output; simply verifying that code "doesn't crash" is insufficient and unacceptable.
|
|
21
|
-
- **
|
|
30
|
+
- **Prefer snapshot tests** (`assert_snapshots`, plural) over manual assertions for UI output. Snapshots are self-documenting and easier to maintain.
|
|
31
|
+
<%- if has_rust -%>
|
|
32
|
+
- Every line of Rust MUST be covered by tests that would stand up to mutation testing.
|
|
33
|
+
- Tests must be meaningful; simply verifying that code "doesn't crash" or "compiles" is insufficient and unacceptable.
|
|
34
|
+
- Each widget implementation must have a `tests` module with unit tests verifying basic rendering.
|
|
35
|
+
<%- end -%>
|
|
36
|
+
- **Pre-commit:** Use `bundle exec agent_rake` to ensure commit-readiness. See Tools for detailed instructions.
|
|
22
37
|
- **Git Pager:** ALWAYS set `PAGER=cat` for ALL `git` commands (e.g., `PAGER=cat git diff`). This is mandatory.
|
|
23
38
|
|
|
24
39
|
### Tools
|
|
25
40
|
|
|
26
41
|
- **NEVER** run `bundle exec rake` directly. **NEVER** run `bundle exec ruby -Ilib:test ...` directly.
|
|
27
|
-
- **ALWAYS use `agent_rake`** (provided by the `ratatui_ruby-devtools` gem) for running tests, linting, or checking compilation.
|
|
42
|
+
- **ALWAYS use `bundle exec agent_rake`** (provided by the `ratatui_ruby-devtools` gem) for running tests, linting, or checking compilation.
|
|
28
43
|
- **Usage:**
|
|
29
|
-
- Runs default task (compile + test + lint): `agent_rake`
|
|
30
|
-
- Runs specific task: `agent_rake test:ruby` (for example)
|
|
44
|
+
- Runs default task (compile + test + lint): `bundle exec agent_rake`
|
|
45
|
+
- Runs specific task: `bundle exec agent_rake test:ruby` (for example)
|
|
46
|
+
- **Snapshot Testing:** When tests fail due to intentional behavior changes (not bugs), update snapshots:
|
|
47
|
+
- **Command:** `UPDATE_SNAPSHOTS=1 bundle exec agent_rake test:ruby`
|
|
48
|
+
- This regenerates all `snapshot/*{txt,ansi}` files to match current output
|
|
49
|
+
- **When to use:** After modifying rendering, changing default values, or updating UI behavior
|
|
50
|
+
- **When NOT to use:** For actual test failures that indicate bugs in your code
|
|
51
|
+
- After updating, verify the changes make sense by reviewing the diff of `.snapshot` files
|
|
31
52
|
- **Setup:** `bin/setup` must handle Bundler dependencies.
|
|
32
53
|
- **Git:** ALWAYS set `PAGER=cat` with `git`. **THIS IS CRITICAL!**
|
|
54
|
+
- **Rake:** Our rake tasks use `git ls-files`, so errors happen when you move or delete files. In this case, ask the user to stage changes for you.
|
|
33
55
|
|
|
34
56
|
### Ruby Standards
|
|
35
57
|
|
|
36
|
-
- Use `Data.define` for all value objects (Ruby 3.2+).
|
|
37
|
-
- Define types in `.rbs` files. Don't use `untyped` just because it's easy; be comprehensive and accurate.
|
|
38
|
-
- Every public Ruby class/method must be documented for humans in RDoc.
|
|
58
|
+
- Use `Data.define` for all value objects (Ruby 3.2+). (Prefer `class Foo < Data.define()` over `Foo = Data.define() do`).
|
|
59
|
+
- Define types in `.rbs` files. Don't use `untyped` just because it's easy; be comprehensive and accurate. Do not include `initialize` in `.rbs` files; use `self.new` for constructors instead.
|
|
60
|
+
- Every public Ruby class/method must be documented for humans in RDoc (preferred)--**not** YARD--or markdown files (fallback), and must have `*.rbs` types defined.
|
|
61
|
+
- Every significant architectural and design decision must be documented for contributors in markdown files. Mermaid is allowed.
|
|
62
|
+
<%- if has_rust -%>
|
|
63
|
+
- **Rust-backed methods:** For methods implemented in Rust (magnus bindings), use RDoc directives instead of empty method bodies. Use `##` followed by `:method:`, `:call-seq:`, and prose. End with `(Native method implemented in Rust)`.
|
|
64
|
+
<%- end -%>
|
|
39
65
|
|
|
40
|
-
|
|
66
|
+
<%- if has_rust -%>
|
|
67
|
+
### Rust Standards
|
|
41
68
|
|
|
42
|
-
-
|
|
43
|
-
- **
|
|
44
|
-
|
|
45
|
-
- Body: Explanation if necessary (wrap at 72 chars).
|
|
46
|
-
- **DON'T list the files changed or the edits made in the body.**
|
|
47
|
-
- **DON'T use markdown syntax** (no backticks, no bolding, no lists, no links).
|
|
69
|
+
- **Crate Type:** `cdylib`.
|
|
70
|
+
- **Bindings:** Use [magnus](https://github.com/matsadler/magnus).
|
|
71
|
+
- **Platform:** Support macOS (Apple Silicon), Linux, and Windows.
|
|
48
72
|
|
|
49
|
-
|
|
73
|
+
<%- end -%>
|
|
74
|
+
## 2. Configuration & Tooling
|
|
50
75
|
|
|
51
|
-
|
|
76
|
+
### Development Environment
|
|
52
77
|
|
|
53
|
-
|
|
54
|
-
2. **Documentation Updated:** If public APIs changed, update relevant docs.
|
|
55
|
-
3. **Changelog Updated:** If public APIs changed, update CHANGELOG.md's **Unreleased** section.
|
|
56
|
-
4. **Commit Message Suggested:** Include a suggested commit message block.
|
|
78
|
+
- **Scripting Preference:** Simple `sed` or shell one-liners are fine. When a one-off script grows to multiple lines of logic, prefer a temporary rake task or `ruby -e '...'` over a multi-line shell script in a string. Ruby's `File.read`/`File.write`, `Dir.glob`, and regex handle complex transformations more cleanly.
|
|
57
79
|
|
|
58
|
-
###
|
|
80
|
+
### Documentation
|
|
59
81
|
|
|
60
|
-
-
|
|
61
|
-
-
|
|
62
|
-
-
|
|
63
|
-
- `test/`: Use `test` for new/changed tests, or match the type of the code being tested.
|
|
64
|
-
- `doc/`: Always `docs`.
|
|
82
|
+
- **The `doc/` folder contains source markdown files** that are included in RDoc output.
|
|
83
|
+
- Documentation should separate "User Guide" (for application developers) from "Contributor Guide" (for library developers).
|
|
84
|
+
- DON'T write .md files for something RDoc (Ruby)<%= has_rust ? " or rustdoc (Rust)" : "" %> can generate. DO use RDoc<%= has_rust ? " and rustdoc" : "" %> for documentation.
|
|
65
85
|
|
|
86
|
+
## 3. Committing
|
|
87
|
+
|
|
88
|
+
- Who commits: DON'T stage (DON'T `git add`) unless explicitly instructed. DON'T commit unless explicitly instructed. DO suggest a commit message when you finish, even if not instructed.
|
|
89
|
+
- When: Before reporting the task as complete to the user, suggest the commit message.
|
|
90
|
+
- What: Consider not what you remember, but EVERYTHING in the `git diff` and `git diff --cached`.
|
|
91
|
+
- **Format:**
|
|
92
|
+
- Format: Use [Conventional Commits](https://www.conventionalcommits.org/).
|
|
93
|
+
- Body: Explanation if necessary (wrap at 72 chars).
|
|
94
|
+
- Explain why this is the implementation, as opposed to other possible implementations.
|
|
95
|
+
- Skip the body entirely if it's rote, a duplication of the diff, or otherwise unhelpful.
|
|
96
|
+
- **DON'T list the files changed or the edits made in the body.** Don't provide a bulleted list of changes. Use prose to explain the problem and the solution.
|
|
97
|
+
- **DON'T use markdown syntax** (no backticks, no bolding, no lists, no links). The commit message must be plain text.
|
|
98
|
+
- **Type conventions by directory:**
|
|
99
|
+
- `lib/`, `ext/`, `sig/`: Use `feat`, `fix`, `refactor`, `perf` as appropriate.
|
|
100
|
+
- `bin/`, `tasks/`, CI/CD: Use `chore` for tooling internal to developing this gem. Use `feat`/`fix` for user-facing executables or changes that affect downstream users.
|
|
101
|
+
- `examples/`: Always `docs` (documentation by example).
|
|
102
|
+
- `test/`: Use `test` for new/changed tests, or match the type of the code being tested.
|
|
103
|
+
- `doc/`: Always `docs`.
|
|
104
|
+
|
|
105
|
+
## 4. Changelog
|
|
106
|
+
|
|
107
|
+
- Follow [Semantic Versioning](https://semver.org/)
|
|
108
|
+
- Follow the [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) specification.
|
|
109
|
+
- **What belongs in CHANGELOG:** Only changes that affect **application developers** or **higher-level library developers** who use or depend on `<%= gem_name %>`:
|
|
110
|
+
- New public APIs or widget parameters
|
|
111
|
+
- Backwards-incompatible type signature changes, or behavioral additions to type signature changes
|
|
112
|
+
- Observable behavior changes (rendering, styling, layout)
|
|
113
|
+
- Deprecations and removals
|
|
114
|
+
- Breaking changes
|
|
115
|
+
- **What does NOT belong in CHANGELOG:** Internal or non-behavioral changes that don't affect downstream users:
|
|
116
|
+
- Test additions or improvements
|
|
117
|
+
- Documentation updates, RDoc fixes, markdown clarifications
|
|
118
|
+
- Refactors of internal code
|
|
119
|
+
- New or modified example code
|
|
120
|
+
- Internal tooling, CI/CD, or build configuration changes
|
|
121
|
+
- Code style or linting changes
|
|
122
|
+
- Performance improvements that affect applications
|
|
123
|
+
- Changelogs should be useful to downstream developers (both app and library developers), not simple restatements of diffs or commit messages.
|
|
124
|
+
- The Unreleased section MUST be considered "since the last git tag". Therefore, if a change was done in one commit and undone in another (both since the last tag), the second commit should remove its changelog entry.
|
|
125
|
+
- **Location:** New entries ALWAYS go in `## [Unreleased]`. Never edit past version sections (e.g., `## [0.4.0]`)—those are frozen history.
|
|
126
|
+
|
|
127
|
+
## 5. Definition of Done (DoD)
|
|
128
|
+
|
|
129
|
+
Before considering a task complete and returning control to the user, you **MUST** ensure:
|
|
130
|
+
|
|
131
|
+
0. **Production Ready:** RBS types are complete and accurate (no `untyped`), errors are handled with good DX, documentation follows guidelines, high code quality (no "pre-existing debt" excuses).
|
|
132
|
+
1. **Default Rake Task Passes:** Run `bundle exec agent_rake` (no args). Confirm it passes with ZERO errors **or warnings**.
|
|
133
|
+
- You will save time if you run `bundle exec agent_rake rubocop:autocorrect` first.
|
|
134
|
+
- If you think the rake is looking for deleted files, STOP EVERYTHING and tell the user.
|
|
135
|
+
2. **Documentation Updated:** If public APIs or observable behavior changed, update relevant RDoc, `doc/` files, `README.md`.
|
|
136
|
+
3. **Changelog Updated:** If public APIs, observable behavior, or gemspec dependencies have changed, update [CHANGELOG.md](CHANGELOG.md)'s **Unreleased** section.
|
|
137
|
+
4. **Commit Message Suggested:** You **MUST** ensure the final message to the user includes a suggested commit message block. This is NOT optional.
|
|
138
|
+
- You MUST also check `git log -n1` to see the current standard AI footer ("Generated with" and "Co-Authored-By") and include it in your suggested message.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
SPDX-FileCopyrightText: <%= Time.now.year %> <%= copyright_holder %>
|
|
3
|
+
SPDX-License-Identifier: CC-BY-SA-4.0
|
|
4
|
+
-->
|
|
5
|
+
# **<%= gem_name %>** Code of Conduct
|
|
6
|
+
|
|
7
|
+
This project is intended to be a safe, productive collaboration, and
|
|
8
|
+
contributors are expected to adhere to the [Ruby Community Conduct
|
|
9
|
+
Guideline](https://www.ruby-lang.org/en/conduct/).
|
|
10
|
+
|
|
11
|
+
For your convenience, it is reproduced below. If this document ever falls out of
|
|
12
|
+
date and/or conflicts with the linked [Ruby Community Conduct
|
|
13
|
+
Guideline](https://www.ruby-lang.org/en/conduct/) document, the linked document
|
|
14
|
+
takes precedence.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
<!--
|
|
18
|
+
SPDX-FileCopyrightText: 2016 Yukihiro Matsumoto <matz@netlab.jp>
|
|
19
|
+
SPDX-License-Identifier: BSD-2-Clause
|
|
20
|
+
-->
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## The Ruby Community Conduct Guideline
|
|
24
|
+
|
|
25
|
+
> **We have picked the following conduct guideline based on an early proposed
|
|
26
|
+
> draft of the PostgreSQL CoC, for Ruby developers community for safe, productive
|
|
27
|
+
> collaboration. Each Ruby related community (conference etc.) may pick their own
|
|
28
|
+
> Code of Conduct.**
|
|
29
|
+
>
|
|
30
|
+
> This document provides community guidelines for a safe, respectful, productive,
|
|
31
|
+
> and collaborative place for any person who is willing to contribute to the Ruby
|
|
32
|
+
> community. It applies to all "collaborative space", which is defined as
|
|
33
|
+
> community communications channels (such as mailing lists, submitted patches,
|
|
34
|
+
> commit comments, etc.).
|
|
35
|
+
>
|
|
36
|
+
> - Participants will be tolerant of opposing views.
|
|
37
|
+
>
|
|
38
|
+
> - Participants must ensure that their language and actions are free of personal
|
|
39
|
+
> attacks and disparaging personal remarks.
|
|
40
|
+
>
|
|
41
|
+
> - When interpreting the words and actions of others, participants should always
|
|
42
|
+
> assume good intentions.
|
|
43
|
+
>
|
|
44
|
+
> - Behaviour which can be reasonably considered harassment will not be tolerated.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
SPDX-FileCopyrightText: <%= Time.now.year %> <%= copyright_holder %>
|
|
3
|
+
SPDX-License-Identifier: CC-BY-SA-4.0
|
|
4
|
+
-->
|
|
5
|
+
|
|
6
|
+
# Contributing
|
|
7
|
+
|
|
8
|
+
This guide walks you through setting up a development environment for
|
|
9
|
+
<%= gem_display_name %>. By the end, you will have a working test suite on macOS, Linux,
|
|
10
|
+
or Windows.
|
|
11
|
+
|
|
12
|
+
## Prerequisites
|
|
13
|
+
|
|
14
|
+
The only prerequisite is [mise](https://mise.jdx.dev/installing-mise.html), a
|
|
15
|
+
dev tool manager. It installs Ruby, <%= has_rust ? "Rust, " : "" %>Python, and pre-commit hooks
|
|
16
|
+
according to `mise.toml`.
|
|
17
|
+
|
|
18
|
+
## Setup
|
|
19
|
+
|
|
20
|
+
Clone the repository and run the setup script for your platform.
|
|
21
|
+
|
|
22
|
+
### macOS / Linux
|
|
23
|
+
|
|
24
|
+
<!-- SPDX-SnippetBegin -->
|
|
25
|
+
<!--
|
|
26
|
+
SPDX-FileCopyrightText: <%= Time.now.year %> <%= copyright_holder %>
|
|
27
|
+
SPDX-License-Identifier: MIT-0
|
|
28
|
+
-->
|
|
29
|
+
```sh
|
|
30
|
+
bin/setup
|
|
31
|
+
```
|
|
32
|
+
<!-- SPDX-SnippetEnd -->
|
|
33
|
+
|
|
34
|
+
### Windows (PowerShell)
|
|
35
|
+
|
|
36
|
+
<!-- SPDX-SnippetBegin -->
|
|
37
|
+
<!--
|
|
38
|
+
SPDX-FileCopyrightText: <%= Time.now.year %> <%= copyright_holder %>
|
|
39
|
+
SPDX-License-Identifier: MIT-0
|
|
40
|
+
-->
|
|
41
|
+
```powershell
|
|
42
|
+
bin/setup.ps1
|
|
43
|
+
```
|
|
44
|
+
<!-- SPDX-SnippetEnd -->
|
|
45
|
+
|
|
46
|
+
Both scripts install <%= has_rust ? "Rust, " : "" %>Python, Bundler, and gem dependencies. On macOS
|
|
47
|
+
and Linux, mise handles everything including Ruby. On Windows, the script
|
|
48
|
+
installs Ruby via [RubyInstaller](https://rubyinstaller.org/) (winget) since
|
|
49
|
+
mise cannot compile working Ruby on Windows. RubyInstaller bundles the MSYS2
|
|
50
|
+
devkit for native gem compilation.<%= has_rust ? " If Visual Studio Build Tools are missing\n(Rust depends on them), the script offers to install them via winget." : "" %>
|
|
51
|
+
|
|
52
|
+
## Running Tests
|
|
53
|
+
|
|
54
|
+
The default Rake task runs lint fixes, the test suite, code quality tools,
|
|
55
|
+
license checks, and the Steep type checker:
|
|
56
|
+
|
|
57
|
+
<!-- SPDX-SnippetBegin -->
|
|
58
|
+
<!--
|
|
59
|
+
SPDX-FileCopyrightText: <%= Time.now.year %> <%= copyright_holder %>
|
|
60
|
+
SPDX-License-Identifier: MIT-0
|
|
61
|
+
-->
|
|
62
|
+
```sh
|
|
63
|
+
bundle exec rake
|
|
64
|
+
```
|
|
65
|
+
<!-- SPDX-SnippetEnd -->
|
|
66
|
+
|
|
67
|
+
## Community
|
|
68
|
+
|
|
69
|
+
Active development happens on the `trunk` branch. The `stable` branch tracks
|
|
70
|
+
releases only. Use `trunk` for contributions.
|
|
71
|
+
|
|
72
|
+
The [discussion forum](https://forum.setdef.com/tags/c/<%= gem_name.tr('_', '-') %>/discussion)
|
|
73
|
+
is the best place to ask questions, share patches, and get feedback. Report bugs
|
|
74
|
+
on the [bug tracker](https://forum.setdef.com/tags/c/<%= gem_name.tr('_', '-') %>/bug). Follow
|
|
75
|
+
[announcements](https://forum.setdef.com/tags/c/<%= gem_name.tr('_', '-') %>/announcement)
|
|
76
|
+
for release notes. All participants follow the
|
|
77
|
+
[Code of Conduct](./CODE_OF_CONDUCT.md).
|
|
78
|
+
|
|
79
|
+
File issues for the underlying Rust library at
|
|
80
|
+
[ratatui/ratatui](https://github.com/ratatui/ratatui).
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
#--
|
|
4
|
+
<%# REUSE-IgnoreStart -%>
|
|
4
5
|
# SPDX-FileCopyrightText: <%= Time.now.year %> <%= copyright_holder %>
|
|
5
|
-
# REUSE-IgnoreStart
|
|
6
6
|
# SPDX-License-Identifier: <%= license %>
|
|
7
|
-
|
|
7
|
+
<%# REUSE-IgnoreEnd -%>
|
|
8
8
|
#++
|
|
9
9
|
|
|
10
10
|
source "https://rubygems.org"
|
|
@@ -5,27 +5,60 @@
|
|
|
5
5
|
# <%= gem_name %>
|
|
6
6
|
|
|
7
7
|
[](https://github.com/<%= github_repo %>/actions/workflows/ci.yml) [](https://spdx.org/licenses/<%= license %>.html) [](https://rubygems.org/gems/<%= gem_name %>) [](https://rubygems.org/gems/<%= gem_name %>) [](https://forum.setdef.com/tags/c/<%= gem_name.tr('_', '-') %>/discussion) [](https://forum.setdef.com/tags/c/<%= gem_name.tr('_', '-') %>/bug) [](https://forum.setdef.com/tags/c/<%= gem_name.tr('_', '-') %>/announcement)
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
## Introduction
|
|
18
18
|
|
|
19
|
-
**<%= gem_name %>** is a gem in the [RatatuiRuby ecosystem](https://
|
|
19
|
+
**<%= gem_name %>** is a gem in the [RatatuiRuby ecosystem](https://www.ratatui-ruby.dev).
|
|
20
20
|
**ratatui_ruby** is a community wrapper that is not affiliated with [the Ratatui team](https://github.com/orgs/ratatui/people).
|
|
21
21
|
|
|
22
22
|
> [!WARNING]
|
|
23
23
|
> **<%= gem_name %>** is currently in **PRE-RELEASE**. The API will change rapidly, even between minor and patch versions.
|
|
24
24
|
|
|
25
|
-
**[Why RatatuiRuby?](https://
|
|
25
|
+
**[Why RatatuiRuby?](https://www.ratatui-ruby.dev/docs/trunk/doc/getting_started/why_md.html)** — Native Rust performance, zero runtime overhead, and Ruby's expressiveness. [See how we compare](https://www.ratatui-ruby.dev/docs/trunk/doc/getting_started/why_md.html) to CharmRuby, raw Rust, and Go.
|
|
26
26
|
|
|
27
|
-
Please
|
|
27
|
+
Please follow the [announcements](https://forum.setdef.com/tags/c/<%= gem_name.tr('_', '-') %>/announcement) to stay up-to-date on new releases. See the [`trunk` branch](https://github.com/<%= github_repo %>/tree/trunk) for pre-release updates.
|
|
28
28
|
|
|
29
|
+
----
|
|
30
|
+
|
|
31
|
+
## Quick Links
|
|
32
|
+
|
|
33
|
+
### The Ecosystem
|
|
34
|
+
|
|
35
|
+
**RatatuiRuby:** [Core engine](https://www.ratatui-ruby.dev)
|
|
36
|
+
• **Rooibos:** [MVU architecture](https://www.rooibos.run)
|
|
37
|
+
• **Kit:** [Component architecture](https://sr.ht/~kerrick/ratatui_ruby/#chapter-3-the-object-path--kit) (Planned)
|
|
38
|
+
• **DSL:** [Glimmer syntax](https://sr.ht/~kerrick/ratatui_ruby/#chapter-4-the-syntax) (Planned)
|
|
39
|
+
• **Framework:** [Omakase framework](https://sr.ht/~kerrick/ratatui_ruby/#chapter-5-the-framework) (Planned)
|
|
40
|
+
• **UI:** [Polished widgets](https://sr.ht/~kerrick/ratatui_ruby#chapter-6-licensing) (Planned)
|
|
41
|
+
• **UI Pro:** [More polished widgets](https://sr.ht/~kerrick/ratatui_ruby#chapter-6-licensing) (Planned)
|
|
42
|
+
|
|
43
|
+
### For App Developers
|
|
44
|
+
|
|
45
|
+
**Get Started:** [Quickstart](https://www.ratatui-ruby.dev/docs/trunk/doc/getting_started/quickstart_md.html)
|
|
46
|
+
• [Examples](https://www.ratatui-ruby.dev/docs/trunk/examples/app_all_events/README_md.html)
|
|
47
|
+
⸺ **Stay Informed:** [Announcements](https://forum.setdef.com/tags/c/<%= gem_name.tr('_', '-') %>/announcement)
|
|
48
|
+
• [FAQ](https://www.ratatui-ruby.dev/docs/trunk/doc/troubleshooting/index_md.html)
|
|
49
|
+
⸺ **Reach Out:** [Forum](https://forum.setdef.com/c/<%= gem_name.tr('_', '-') %>)
|
|
50
|
+
• [Bug Tracker](https://forum.setdef.com/tags/c/<%= gem_name.tr('_', '-') %>/bug)
|
|
51
|
+
|
|
52
|
+
### For Contributors
|
|
53
|
+
|
|
54
|
+
**Get Started:** [Contributing Guide](./CONTRIBUTING.md)
|
|
55
|
+
• [Code of Conduct](./CODE_OF_CONDUCT.md)
|
|
56
|
+
⸺ **Stay Informed:** [Announcements](https://forum.setdef.com/tags/c/<%= gem_name.tr('_', '-') %>/announcement)
|
|
57
|
+
• [FAQ](https://www.ratatui-ruby.dev/docs/trunk/doc/troubleshooting/index_md.html)
|
|
58
|
+
⸺ **Reach Out:** [Forum](https://forum.setdef.com/c/<%= gem_name.tr('_', '-') %>)
|
|
59
|
+
• [Bug Tracker](https://forum.setdef.com/tags/c/<%= gem_name.tr('_', '-') %>/bug)
|
|
60
|
+
|
|
61
|
+
----
|
|
29
62
|
|
|
30
63
|
## Compatibility
|
|
31
64
|
|
|
@@ -98,18 +131,18 @@ _Because this gem is in pre-release, it lacks documentation. Please check the so
|
|
|
98
131
|
| [Application Architecture](./doc/concepts/application_architecture.md) | Patterns for scaling your app |
|
|
99
132
|
| [Guides](./doc/index.md) | Tutorials, examples, and more |
|
|
100
133
|
| API Reference | To generate full RDoc documentation, run `bundle exec rake rdoc` |
|
|
101
|
-
| [
|
|
134
|
+
| [Ecosystem](https://www.ratatui-ruby.dev) | Learn more about the RatatuiRuby ecosystem |
|
|
102
135
|
|
|
103
136
|
|
|
104
137
|
## Contributing
|
|
105
138
|
|
|
106
|
-
|
|
139
|
+
The [discussion forum](https://forum.setdef.com/tags/c/<%= gem_name.tr('_', '-') %>/discussion) is the best place to ask questions, share patches, and get feedback. Report bugs on the [bug tracker](https://forum.setdef.com/tags/c/<%= gem_name.tr('_', '-') %>/bug). All participants follow the [Code of Conduct](./CODE_OF_CONDUCT.md).
|
|
107
140
|
<% if has_rust %>
|
|
108
141
|
|
|
109
|
-
Issues for the underlying Rust library should be filed
|
|
142
|
+
Issues for the underlying Rust library should be filed at [ratatui/ratatui](https://github.com/ratatui/ratatui).
|
|
110
143
|
<% end %>
|
|
111
144
|
|
|
112
|
-
Want to help develop **<%= gem_name %>**? Check out the [contribution guide
|
|
145
|
+
Want to help develop **<%= gem_name %>**? Check out the [contribution guide](./CONTRIBUTING.md).
|
|
113
146
|
|
|
114
147
|
**Note**: Active development happens on the `trunk` branch. Use `trunk` if you are a contributor or want the latest cutting-edge features. `stable` is for stable releases only.
|
|
115
148
|
|
|
@@ -124,4 +157,4 @@ Documentation is [CC-BY-SA-4.0](./LICENSES/CC-BY-SA-4.0.txt). Build tooling and
|
|
|
124
157
|
|
|
125
158
|
Some parts of this program are copied from other sources under appropriate reuse licenses, and the copyright belongs to their respective owners. See the [REUSE Specification – Version 3.3](https://reuse.software/spec-3.3/) for details.
|
|
126
159
|
|
|
127
|
-
This program was created with significant assistance from multiple LLMs. The process was human-controlled through creative prompts, with human contributions to each commit. See commit footers for model attribution. [declare-ai.org](https://declare-ai.org/1.0.0/creative.html)
|
|
160
|
+
This program was created with significant assistance from multiple LLMs. The process was human-controlled through creative prompts, with human contributions to each commit. See commit footers for model attribution. [declare-ai.org](https://declare-ai.org/1.0.0/creative.html)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
#--
|
|
4
|
+
<%# REUSE-IgnoreStart -%>
|
|
4
5
|
# SPDX-FileCopyrightText: <%= Time.now.year %> <%= copyright_holder %>
|
|
5
|
-
# REUSE-IgnoreStart
|
|
6
6
|
# SPDX-License-Identifier: <%= license %>
|
|
7
|
-
|
|
7
|
+
<%# REUSE-IgnoreEnd -%>
|
|
8
8
|
#++
|
|
9
9
|
|
|
10
10
|
require "bundler/gem_tasks"
|
|
@@ -22,8 +22,8 @@ Rake::ExtensionTask.new("<%= gem_name.tr('-', '_') %>") do |ext|
|
|
|
22
22
|
ext.lib_dir = "lib/<%= gem_name.tr('-', '/') %>"
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
task default: %w[compile lint:fix test lint reuse]
|
|
25
|
+
task default: %w[compile lint:fix install:force test lint reuse steep]
|
|
26
26
|
<%- else -%>
|
|
27
27
|
|
|
28
|
-
task default: %w[lint:fix test lint reuse]
|
|
28
|
+
task default: %w[lint:fix install:force test lint reuse steep]
|
|
29
29
|
<%- end -%>
|
|
@@ -1,24 +1,34 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
+
<%# REUSE-IgnoreStart -%>
|
|
2
3
|
# SPDX-FileCopyrightText: <%= Time.now.year %> <%= copyright_holder %>
|
|
3
|
-
# REUSE-IgnoreStart
|
|
4
4
|
# SPDX-License-Identifier: <%= license %>
|
|
5
|
-
|
|
5
|
+
<%# REUSE-IgnoreEnd -%>
|
|
6
6
|
|
|
7
7
|
set -euo pipefail
|
|
8
8
|
IFS=$'\n\t'
|
|
9
9
|
set -vx
|
|
10
10
|
|
|
11
|
-
if command -v mise >/dev/null 2>&1; then
|
|
12
|
-
mise install
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
if ! command -v mise >/dev/null 2>&1; then
|
|
12
|
+
echo "mise isn't installed. Please install it to continue." >&2
|
|
13
|
+
exit 1
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
mise install
|
|
17
|
+
<%- if has_rust -%>
|
|
18
|
+
mise x -- rustup component add rustfmt clippy
|
|
19
|
+
<%- end -%>
|
|
20
|
+
mise x -- pip install reuse
|
|
21
|
+
mise x -- gem install bundler:4.0.3
|
|
22
|
+
|
|
23
|
+
if [ "${CI:-}" = "true" ]; then
|
|
24
|
+
bundle config set --local frozen 'true'
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
mise x -- bundle install
|
|
28
|
+
|
|
29
|
+
if [ "${CI:-}" != "true" ]; then
|
|
15
30
|
pre-commit install
|
|
16
|
-
mise x -- reuse download --all
|
|
17
|
-
bundle exec rake sourcehut
|
|
18
31
|
<%- if has_rdoc -%>
|
|
19
32
|
bundle exec rake rdoc
|
|
20
33
|
<%- end -%>
|
|
21
|
-
else
|
|
22
|
-
echo "mise isn't installed. Please install it to continue." >&2
|
|
23
|
-
exit 1
|
|
24
34
|
fi
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<%# REUSE-IgnoreStart -%>
|
|
2
|
+
# SPDX-FileCopyrightText: <%= Time.now.year %> <%= copyright_holder %>
|
|
3
|
+
# SPDX-License-Identifier: <%= license %>
|
|
4
|
+
<%# REUSE-IgnoreEnd -%>
|
|
5
|
+
|
|
6
|
+
$ErrorActionPreference = "Stop"
|
|
7
|
+
Set-StrictMode -Version Latest
|
|
8
|
+
|
|
9
|
+
if (-not (Get-Command mise -ErrorAction SilentlyContinue)) {
|
|
10
|
+
Write-Error "mise isn't installed. Please install it to continue: https://mise.jdx.dev"
|
|
11
|
+
exit 1
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
# Read the Ruby version from mise.toml so we install the matching RubyInstaller.
|
|
15
|
+
$rubyVersion = (Select-String -Path mise.toml -Pattern 'ruby\s*=\s*"([^"]+)"').Matches.Groups[1].Value
|
|
16
|
+
$rubyMajorMinor = ($rubyVersion -split '\.')[0..1] -join '.'
|
|
17
|
+
|
|
18
|
+
# mise cannot compile Ruby from source on Windows (ruby-build produces broken
|
|
19
|
+
# native extension support). Install Ruby via RubyInstaller, which bundles the
|
|
20
|
+
# MSYS2 devkit for native gem compilation.
|
|
21
|
+
if (-not (Get-Command ruby -ErrorAction SilentlyContinue) -or -not ((ruby --version) -match $rubyMajorMinor)) {
|
|
22
|
+
Write-Host "Ruby $rubyMajorMinor is required but not installed."
|
|
23
|
+
if ($env:CI -ne "true") {
|
|
24
|
+
$answer = Read-Host "Install it now via RubyInstaller (winget)? This will require administrator privileges. [Y/n]"
|
|
25
|
+
if ($answer -and $answer -notmatch '^[Yy]') {
|
|
26
|
+
Write-Error "Cannot continue without Ruby."
|
|
27
|
+
exit 1
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
winget install --id "RubyInstallerTeam.RubyWithDevKit.$rubyMajorMinor" --accept-source-agreements --accept-package-agreements
|
|
31
|
+
# Refresh PATH so ruby is available
|
|
32
|
+
$env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
<%- if has_rust -%>
|
|
36
|
+
# Rust's default MSVC target requires Visual Studio Build Tools with the
|
|
37
|
+
# C++ workload.
|
|
38
|
+
$vsWhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
|
|
39
|
+
if (-not (Test-Path $vsWhere) -or -not (& $vsWhere -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath)) {
|
|
40
|
+
Write-Host "Visual Studio Build Tools with C++ workload is required for Rust compilation."
|
|
41
|
+
if ($env:CI -ne "true") {
|
|
42
|
+
$answer = Read-Host "Install it now via winget? This will require administrator privileges. [Y/n]"
|
|
43
|
+
if ($answer -and $answer -notmatch '^[Yy]') {
|
|
44
|
+
Write-Error "Cannot continue without Visual Studio Build Tools."
|
|
45
|
+
exit 1
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
winget install Microsoft.VisualStudio.2022.BuildTools --override "--wait --passive --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended"
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
<%- end -%>
|
|
52
|
+
# Create .mise.local.toml (gitignored) with Windows-specific overrides:
|
|
53
|
+
# - disable_tools: prevents mise from installing its own (broken) Ruby
|
|
54
|
+
if (-not (Test-Path .mise.local.toml) -or -not (Select-String -Path .mise.local.toml -Pattern 'disable_tools' -Quiet)) {
|
|
55
|
+
$localToml = @"
|
|
56
|
+
|
|
57
|
+
[settings]
|
|
58
|
+
disable_tools = ["ruby"]
|
|
59
|
+
"@
|
|
60
|
+
Add-Content -Path .mise.local.toml -Value $localToml
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
# mise handles Python and pre-commit. Ruby is disabled above.
|
|
64
|
+
mise install
|
|
65
|
+
<%- if has_rust -%>
|
|
66
|
+
mise x -- rustup target add x86_64-pc-windows-gnu
|
|
67
|
+
mise x -- rustup component add rustfmt clippy
|
|
68
|
+
<%- end -%>
|
|
69
|
+
mise x -- python -m pip install reuse
|
|
70
|
+
|
|
71
|
+
# pip installs scripts (like reuse.exe) to Python's Scripts directory,
|
|
72
|
+
# which mise does not add to PATH.
|
|
73
|
+
if (-not (Select-String -Path .mise.local.toml -Pattern '\[env\]' -Quiet -ErrorAction SilentlyContinue)) {
|
|
74
|
+
$scriptsDir = (mise x -- python -c "import sysconfig; print(sysconfig.get_path('scripts'))").Trim()
|
|
75
|
+
$envToml = @"
|
|
76
|
+
|
|
77
|
+
[env]
|
|
78
|
+
_.path = ["$($scriptsDir -replace '\\', '/')"]
|
|
79
|
+
"@
|
|
80
|
+
<%- if has_rust -%>
|
|
81
|
+
if ($env:RI_DEVKIT) {
|
|
82
|
+
$msysRoot = (Join-Path $env:RI_DEVKIT "ucrt64") -replace '\\', '/'
|
|
83
|
+
$envToml += @"
|
|
84
|
+
|
|
85
|
+
BINDGEN_EXTRA_CLANG_ARGS = "-include stdbool.h --target=x86_64-w64-mingw32 --sysroot=$msysRoot -I$msysRoot/include"
|
|
86
|
+
CARGO_BUILD_TARGET = "x86_64-pc-windows-gnu"
|
|
87
|
+
"@
|
|
88
|
+
}
|
|
89
|
+
<%- end -%>
|
|
90
|
+
Add-Content -Path .mise.local.toml -Value $envToml
|
|
91
|
+
}
|
|
92
|
+
gem install bundler:4.0.3
|
|
93
|
+
|
|
94
|
+
if ($env:CI -eq "true") {
|
|
95
|
+
bundle config set --local frozen true
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
bundle install
|
|
99
|
+
|
|
100
|
+
if ($env:CI -ne "true") {
|
|
101
|
+
pre-commit install
|
|
102
|
+
<%- if has_rdoc -%>
|
|
103
|
+
bundle exec rake rdoc
|
|
104
|
+
<%- end -%>
|
|
105
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
<%# REUSE-IgnoreStart -%>
|
|
1
2
|
/*
|
|
2
3
|
* SPDX-FileCopyrightText: <%= Time.now.year %> <%= copyright_holder %>
|
|
3
|
-
* REUSE-IgnoreStart
|
|
4
4
|
* SPDX-License-Identifier: <%= license %>
|
|
5
|
-
* REUSE-IgnoreEnd
|
|
6
5
|
*/
|
|
6
|
+
<%# REUSE-IgnoreEnd -%>
|
|
7
7
|
|
|
8
8
|
img {
|
|
9
9
|
max-width: 100%;
|
|
@@ -21,4 +21,4 @@ img {
|
|
|
21
21
|
img[src*="images/"] {
|
|
22
22
|
display: block;
|
|
23
23
|
margin: 2em auto;
|
|
24
|
-
}
|
|
24
|
+
}
|
|
@@ -50,7 +50,7 @@ Now that you've seen what **<%= gem_name %>** can do:
|
|
|
50
50
|
|
|
51
51
|
- **Deep dive**: Read the [Application Architecture](../concepts/application_architecture.md) guide for scaling patterns
|
|
52
52
|
- **Test your TUI**: See the [Testing Guide](../concepts/application_testing.md) for snapshot and style assertions
|
|
53
|
-
- **Avoid common mistakes**: See [Terminal Output During TUI Sessions](https://
|
|
53
|
+
- **Avoid common mistakes**: See [Terminal Output During TUI Sessions](https://www.ratatui-ruby.dev/docs/trunk/doc/troubleshooting/tui_output_md.html) to prevent screen corruption
|
|
54
54
|
- **Explore the API**: Browse the [full documentation](../index.md)
|
|
55
|
-
- **Learn the philosophy**: Read [Why RatatuiRuby?](https://
|
|
56
|
-
- **Get help**: Join the [discussion
|
|
55
|
+
- **Learn the philosophy**: Read [Why RatatuiRuby?](https://www.ratatui-ruby.dev/docs/trunk/doc/getting_started/why_md.html) for comparisons and design decisions
|
|
56
|
+
- **Get help**: Join the [discussion forum](https://forum.setdef.com/c/<%= gem_name.tr('_', '-') %>)
|