ratatui_ruby-devtools 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/.builds/ruby-4.0.yml +38 -0
- data/.pre-commit-config.yaml +16 -0
- data/.rubocop.yml +8 -0
- data/AGENTS.md +72 -0
- data/CHANGELOG.md +23 -0
- data/LICENSE +661 -0
- data/LICENSES/AGPL-3.0-or-later.txt +661 -0
- data/LICENSES/CC-BY-SA-4.0.txt +427 -0
- data/LICENSES/CC0-1.0.txt +121 -0
- data/LICENSES/MIT-0.txt +16 -0
- data/LICENSES/MIT.txt +18 -0
- data/README.md +199 -0
- data/REUSE.toml +18 -0
- data/Rakefile +13 -0
- data/bin/agent_rake +13 -0
- data/bin/announce +13 -0
- data/bin/console +14 -0
- data/bin/consolidate_md +13 -0
- data/bin/hbs +13 -0
- data/bin/setup +17 -0
- data/doc/contributors/documentation_style.md +121 -0
- data/doc/custom.css +22 -0
- data/exe/agent_rake +96 -0
- data/exe/announce +1120 -0
- data/exe/consolidate_md +246 -0
- data/exe/hbs +670 -0
- data/exe/scaffold +662 -0
- data/lib/ratatui_ruby/devtools/tasks/autodoc/examples.rb +133 -0
- data/lib/ratatui_ruby/devtools/tasks/autodoc/member.rb +116 -0
- data/lib/ratatui_ruby/devtools/tasks/autodoc/name.rb +33 -0
- data/lib/ratatui_ruby/devtools/tasks/autodoc.rake +21 -0
- data/lib/ratatui_ruby/devtools/tasks/bump/cargo_lockfile.rb +38 -0
- data/lib/ratatui_ruby/devtools/tasks/bump/changelog.rb +67 -0
- data/lib/ratatui_ruby/devtools/tasks/bump/header.rb +43 -0
- data/lib/ratatui_ruby/devtools/tasks/bump/history.rb +50 -0
- data/lib/ratatui_ruby/devtools/tasks/bump/links.rb +78 -0
- data/lib/ratatui_ruby/devtools/tasks/bump/manifest.rb +63 -0
- data/lib/ratatui_ruby/devtools/tasks/bump/ruby_gem.rb +77 -0
- data/lib/ratatui_ruby/devtools/tasks/bump/sem_ver.rb +63 -0
- data/lib/ratatui_ruby/devtools/tasks/bump/unreleased_section.rb +75 -0
- data/lib/ratatui_ruby/devtools/tasks/bump.rake +80 -0
- data/lib/ratatui_ruby/devtools/tasks/cargo.rake +47 -0
- data/lib/ratatui_ruby/devtools/tasks/doc.rake +887 -0
- data/lib/ratatui_ruby/devtools/tasks/example_viewer.html.erb +172 -0
- data/lib/ratatui_ruby/devtools/tasks/license/headers_md.rb +276 -0
- data/lib/ratatui_ruby/devtools/tasks/license/headers_rb.rb +236 -0
- data/lib/ratatui_ruby/devtools/tasks/license/license_utils.rb +143 -0
- data/lib/ratatui_ruby/devtools/tasks/license/snippets_md.rb +353 -0
- data/lib/ratatui_ruby/devtools/tasks/license/snippets_rdoc.rb +186 -0
- data/lib/ratatui_ruby/devtools/tasks/license.rake +91 -0
- data/lib/ratatui_ruby/devtools/tasks/lint.rake +84 -0
- data/lib/ratatui_ruby/devtools/tasks/rdoc_config.rb +45 -0
- data/lib/ratatui_ruby/devtools/tasks/resources/build.yml.erb +54 -0
- data/lib/ratatui_ruby/devtools/tasks/resources/rubies.yml +7 -0
- data/lib/ratatui_ruby/devtools/tasks/reuse.rake +104 -0
- data/lib/ratatui_ruby/devtools/tasks/sourcehut.rake +94 -0
- data/lib/ratatui_ruby/devtools/tasks/test.rake +18 -0
- data/lib/ratatui_ruby/devtools/templates/.builds/ruby.yml.erb +47 -0
- data/lib/ratatui_ruby/devtools/templates/.gitignore.erb +18 -0
- data/lib/ratatui_ruby/devtools/templates/.pre-commit-config.yaml.erb +16 -0
- data/lib/ratatui_ruby/devtools/templates/.rubocop.yml.erb +8 -0
- data/lib/ratatui_ruby/devtools/templates/AGENTS.md.erb +65 -0
- data/lib/ratatui_ruby/devtools/templates/CHANGELOG.md.erb +18 -0
- data/lib/ratatui_ruby/devtools/templates/Gemfile.erb +32 -0
- data/lib/ratatui_ruby/devtools/templates/README.md.erb +127 -0
- data/lib/ratatui_ruby/devtools/templates/REUSE.toml.erb +33 -0
- data/lib/ratatui_ruby/devtools/templates/Rakefile.erb +29 -0
- data/lib/ratatui_ruby/devtools/templates/bin/console.erb +18 -0
- data/lib/ratatui_ruby/devtools/templates/bin/setup.erb +24 -0
- data/lib/ratatui_ruby/devtools/templates/doc/concepts/application_architecture.md.erb +16 -0
- data/lib/ratatui_ruby/devtools/templates/doc/concepts/application_testing.md.erb +49 -0
- data/lib/ratatui_ruby/devtools/templates/doc/custom.css.erb +24 -0
- data/lib/ratatui_ruby/devtools/templates/doc/getting_started/quickstart.md.erb +56 -0
- data/lib/ratatui_ruby/devtools/templates/doc/images/.gitkeep +0 -0
- data/lib/ratatui_ruby/devtools/templates/doc/index.md.erb +25 -0
- data/lib/ratatui_ruby/devtools/templates/exe/.gitkeep +0 -0
- data/lib/ratatui_ruby/devtools/templates/gemspec.erb +58 -0
- data/lib/ratatui_ruby/devtools/templates/mise.toml.erb +12 -0
- data/lib/ratatui_ruby/devtools/templates/tasks/example_viewer.html.erb +174 -0
- data/lib/ratatui_ruby/devtools/templates/tasks/resources/build.yml.erb +62 -0
- data/lib/ratatui_ruby/devtools/templates/tasks/resources/index.html.erb +46 -0
- data/lib/ratatui_ruby/devtools/templates/tasks/resources/rubies.yml.erb +9 -0
- data/lib/ratatui_ruby/devtools/templates/vendor/goodcop/base.yml +1047 -0
- data/lib/ratatui_ruby/devtools/version.rb +13 -0
- data/lib/ratatui_ruby/devtools.rb +137 -0
- data/mise.toml +7 -0
- data/sig/ratatui_ruby/devtools.rbs +15 -0
- data/vendor/goodcop/base.yml +1047 -0
- metadata +252 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
#--
|
|
4
|
+
# SPDX-FileCopyrightText: <%= Time.now.year %> <%= copyright_holder %>
|
|
5
|
+
# REUSE-IgnoreStart
|
|
6
|
+
# SPDX-License-Identifier: <%= license %>
|
|
7
|
+
# REUSE-IgnoreEnd
|
|
8
|
+
#++
|
|
9
|
+
|
|
10
|
+
source "https://rubygems.org"
|
|
11
|
+
|
|
12
|
+
gemspec
|
|
13
|
+
|
|
14
|
+
gem "irb"
|
|
15
|
+
gem "rake", "~> 13.0"
|
|
16
|
+
|
|
17
|
+
gem "minitest", "~> 5.16"
|
|
18
|
+
|
|
19
|
+
gem "rubocop", "~> 1.21"
|
|
20
|
+
gem "rubycritic", "~> 4.11"
|
|
21
|
+
gem "inch", "~> 0.4"
|
|
22
|
+
gem "flog", "4.8.0"
|
|
23
|
+
|
|
24
|
+
gem "nokogiri" # For RDoc sidebar post-processing
|
|
25
|
+
gem "faker" # For realistic example data
|
|
26
|
+
|
|
27
|
+
group :development do
|
|
28
|
+
gem "ratatui_ruby-devtools"
|
|
29
|
+
<%- if has_rust -%>
|
|
30
|
+
gem "rake-compiler"
|
|
31
|
+
<%- end -%>
|
|
32
|
+
end
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
SPDX-FileCopyrightText: <%= Time.now.year %> <%= copyright_holder %>
|
|
3
|
+
SPDX-License-Identifier: CC-BY-SA-4.0
|
|
4
|
+
-->
|
|
5
|
+
# <%= gem_name %>
|
|
6
|
+
|
|
7
|
+
[](https://builds.sr.ht/~kerrick/<%= gem_name %>?) [%22&replace=%241&label=License&color=a2c93e)](https://spdx.org/licenses/<%= license %>.html) [](https://rubygems.org/gems/<%= gem_name %>) [](https://rubygems.org/gems/<%= gem_name %>) [](https://lists.sr.ht/~kerrick/ratatui_ruby-discuss) [](https://lists.sr.ht/~kerrick/ratatui_ruby-devel) [](https://lists.sr.ht/~kerrick/ratatui_ruby-announce)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## Introduction
|
|
18
|
+
|
|
19
|
+
**<%= gem_name %>** is a gem in the [RatatuiRuby ecosystem](https://sr.ht/~kerrick/ratatui_ruby/).
|
|
20
|
+
**ratatui_ruby** is a community wrapper that is not affiliated with [the Ratatui team](https://github.com/orgs/ratatui/people).
|
|
21
|
+
|
|
22
|
+
> [!WARNING]
|
|
23
|
+
> **<%= gem_name %>** is currently in **PRE-RELEASE**. The API will change rapidly, even between minor and patch versions.
|
|
24
|
+
|
|
25
|
+
**[Why RatatuiRuby?](https://man.sr.ht/~kerrick/ratatui_ruby/why.md)** — Native Rust performance, zero runtime overhead, and Ruby's expressiveness. [See how we compare](https://man.sr.ht/~kerrick/ratatui_ruby/why.md) to CharmRuby, raw Rust, and Go.
|
|
26
|
+
|
|
27
|
+
Please join the **announce** mailing list at https://lists.sr.ht/~kerrick/ratatui_ruby-announce to stay up-to-date on new releases and announcements. See the [`trunk` branch](https://git.sr.ht/~kerrick/<%= gem_name %>/tree/trunk) for pre-release updates.
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## Compatibility
|
|
31
|
+
|
|
32
|
+
**<%= gem_name %>** is designed to run on [everything Ruby does](https://www.ruby-lang.org/en/documentation/installation/), including:
|
|
33
|
+
|
|
34
|
+
- GNU/Linux, macOS, Windows, OpenBSD, and FreeBSD; and
|
|
35
|
+
- x86_64 (AMD, Intel) and ARM (Apple Silicon, Raspberry Pi).
|
|
36
|
+
|
|
37
|
+
We support the latest minor version of every
|
|
38
|
+
[non-eol Ruby version](https://www.ruby-lang.org/en/downloads/branches/),
|
|
39
|
+
including Ruby 4.
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
Add this line to your application's Gemfile:
|
|
45
|
+
|
|
46
|
+
<!-- SPDX-SnippetBegin -->
|
|
47
|
+
<!--
|
|
48
|
+
SPDX-FileCopyrightText: <%= Time.now.year %> <%= author %>
|
|
49
|
+
SPDX-License-Identifier: MIT-0
|
|
50
|
+
-->
|
|
51
|
+
```ruby
|
|
52
|
+
gem "<%= gem_name %>"
|
|
53
|
+
```
|
|
54
|
+
<!-- SPDX-SnippetEnd -->
|
|
55
|
+
|
|
56
|
+
And then execute:
|
|
57
|
+
|
|
58
|
+
<!-- SPDX-SnippetBegin -->
|
|
59
|
+
<!--
|
|
60
|
+
SPDX-FileCopyrightText: <%= Time.now.year %> <%= author %>
|
|
61
|
+
SPDX-License-Identifier: MIT-0
|
|
62
|
+
-->
|
|
63
|
+
```bash
|
|
64
|
+
bundle install
|
|
65
|
+
```
|
|
66
|
+
<!-- SPDX-SnippetEnd -->
|
|
67
|
+
|
|
68
|
+
Or install it yourself with:
|
|
69
|
+
|
|
70
|
+
<!-- SPDX-SnippetBegin -->
|
|
71
|
+
<!--
|
|
72
|
+
SPDX-FileCopyrightText: <%= Time.now.year %> <%= author %>
|
|
73
|
+
SPDX-License-Identifier: MIT-0
|
|
74
|
+
-->
|
|
75
|
+
```bash
|
|
76
|
+
gem install <%= gem_name %>
|
|
77
|
+
```
|
|
78
|
+
<!-- SPDX-SnippetEnd -->
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
## Usage
|
|
82
|
+
|
|
83
|
+
_Because this gem is in pre-release, it lacks documentation. Please check the source files.
|
|
84
|
+
|
|
85
|
+
For a full tutorial, see [the Quickstart](./doc/getting_started/quickstart.md). For an explanation of the application architecture, see [Application Architecture](./doc/concepts/application_architecture.md).
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
## Features
|
|
89
|
+
|
|
90
|
+
_Because this gem is in pre-release, it lacks documentation. Please check the source files.
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
## Documentation
|
|
94
|
+
|
|
95
|
+
| Resource | Description |
|
|
96
|
+
|----------|-------------|
|
|
97
|
+
| [Quickstart](./doc/getting_started/quickstart.md) | Get running in 5 minutes |
|
|
98
|
+
| [Application Architecture](./doc/concepts/application_architecture.md) | Patterns for scaling your app |
|
|
99
|
+
| [Guides](./doc/index.md) | Tutorials, examples, and more |
|
|
100
|
+
| API Reference | To generate full RDoc documentation, run `bundle exec rake rdoc` |
|
|
101
|
+
| [Wiki](https://man.sr.ht/~kerrick/ratatui_ruby) | Learn more about the RatatuiRuby ecosystem |
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
## Contributing
|
|
105
|
+
|
|
106
|
+
Bug reports and pull requests are welcome on [sourcehut](https://sourcehut.org) at https://sr.ht/~kerrick/ratatui_ruby/. This project is intended to be a safe, productive collaboration, and contributors are expected to adhere to the [Code of Conduct](https://man.sr.ht/~kerrick/ratatui_ruby/code_of_conduct.md).
|
|
107
|
+
<% if has_rust %>
|
|
108
|
+
|
|
109
|
+
Issues for the underlying Rust library should be filed in their issue tracker.
|
|
110
|
+
<% end %>
|
|
111
|
+
|
|
112
|
+
Want to help develop **<%= gem_name %>**? Check out the [contribution guide on the wiki](https://man.sr.ht/~kerrick/ratatui_ruby/contributing.md).
|
|
113
|
+
|
|
114
|
+
**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
|
+
|
|
116
|
+
|
|
117
|
+
## Copyright & License
|
|
118
|
+
|
|
119
|
+
**<%= gem_name %>** is copyright <%= Time.now.year %>, <%= author %>.
|
|
120
|
+
|
|
121
|
+
The library is [<%= license %>](./LICENSES/<%= license %>.txt)<% if license.include?("LGPL") %>: you can use it in proprietary applications, but you must share changes you make to **<%= gem_name %>** itself<% end %>. Documentation snippets and widget examples are [MIT-0](./LICENSES/MIT-0.txt): copy and use them without attribution.
|
|
122
|
+
|
|
123
|
+
Documentation is [CC-BY-SA-4.0](./LICENSES/CC-BY-SA-4.0.txt). Build tooling and full app examples are [<%= license %>](./LICENSES/<%= license %>.txt). See each file's SPDX comment for specifics.
|
|
124
|
+
|
|
125
|
+
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
|
+
|
|
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)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: <%= Time.now.year %> <%= copyright_holder %>
|
|
2
|
+
# REUSE-IgnoreStart
|
|
3
|
+
# SPDX-License-Identifier: <%= license %>
|
|
4
|
+
# REUSE-IgnoreEnd
|
|
5
|
+
|
|
6
|
+
version = 1
|
|
7
|
+
|
|
8
|
+
[[annotations]]
|
|
9
|
+
path = 'Gemfile.lock'
|
|
10
|
+
SPDX-FileCopyrightText = "<%= Time.now.year %> <%= copyright_holder %>"
|
|
11
|
+
SPDX-License-Identifier = "CC0-1.0"
|
|
12
|
+
<%- if has_rust -%>
|
|
13
|
+
|
|
14
|
+
[[annotations]]
|
|
15
|
+
path = 'ext/<%= gem_name %>/Cargo.lock'
|
|
16
|
+
SPDX-FileCopyrightText = "<%= Time.now.year %> <%= copyright_holder %>"
|
|
17
|
+
SPDX-License-Identifier = "CC0-1.0"
|
|
18
|
+
<%- end -%>
|
|
19
|
+
|
|
20
|
+
[[annotations]]
|
|
21
|
+
path = '**/snapshots/*.txt'
|
|
22
|
+
SPDX-FileCopyrightText = "<%= Time.now.year %> <%= copyright_holder %>"
|
|
23
|
+
SPDX-License-Identifier = "<%= license %>"
|
|
24
|
+
|
|
25
|
+
[[annotations]]
|
|
26
|
+
path = '**/snapshots/*.ansi'
|
|
27
|
+
SPDX-FileCopyrightText = "<%= Time.now.year %> <%= copyright_holder %>"
|
|
28
|
+
SPDX-License-Identifier = "<%= license %>"
|
|
29
|
+
|
|
30
|
+
[[annotations]]
|
|
31
|
+
path = 'doc/images/*'
|
|
32
|
+
SPDX-FileCopyrightText = "2026 Kerrick Long <me@kerricklong.com>"
|
|
33
|
+
SPDX-License-Identifier = "CC-BY-SA-4.0"
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
#--
|
|
4
|
+
# SPDX-FileCopyrightText: <%= Time.now.year %> <%= copyright_holder %>
|
|
5
|
+
# REUSE-IgnoreStart
|
|
6
|
+
# SPDX-License-Identifier: <%= license %>
|
|
7
|
+
# REUSE-IgnoreEnd
|
|
8
|
+
#++
|
|
9
|
+
|
|
10
|
+
require "bundler/gem_tasks"
|
|
11
|
+
require "ratatui_ruby/devtools"
|
|
12
|
+
|
|
13
|
+
RatatuiRuby::Devtools.install!
|
|
14
|
+
|
|
15
|
+
# Import project-specific tasks
|
|
16
|
+
Dir.glob("tasks/*.rake").each { |r| import r }
|
|
17
|
+
<%- if has_rust -%>
|
|
18
|
+
|
|
19
|
+
require "rake/extensiontask"
|
|
20
|
+
|
|
21
|
+
Rake::ExtensionTask.new("<%= gem_name.tr('-', '_') %>") do |ext|
|
|
22
|
+
ext.lib_dir = "lib/<%= gem_name.tr('-', '/') %>"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
task default: %w[compile lint:fix test lint reuse]
|
|
26
|
+
<%- else -%>
|
|
27
|
+
|
|
28
|
+
task default: %w[lint:fix test lint reuse]
|
|
29
|
+
<%- end -%>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#--
|
|
5
|
+
<%# REUSE-IgnoreStart -%>
|
|
6
|
+
# SPDX-FileCopyrightText: <%= Time.now.year %> <%= copyright_holder %>
|
|
7
|
+
# SPDX-License-Identifier: <%= license %>
|
|
8
|
+
<%# REUSE-IgnoreEnd -%>
|
|
9
|
+
#++
|
|
10
|
+
|
|
11
|
+
require "bundler/setup"
|
|
12
|
+
require "<%= gem_name.tr("-", "/") %>"
|
|
13
|
+
|
|
14
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
15
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
16
|
+
|
|
17
|
+
require "irb"
|
|
18
|
+
IRB.start(__FILE__)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# SPDX-FileCopyrightText: <%= Time.now.year %> <%= copyright_holder %>
|
|
3
|
+
# REUSE-IgnoreStart
|
|
4
|
+
# SPDX-License-Identifier: <%= license %>
|
|
5
|
+
# REUSE-IgnoreEnd
|
|
6
|
+
|
|
7
|
+
set -euo pipefail
|
|
8
|
+
IFS=$'\n\t'
|
|
9
|
+
set -vx
|
|
10
|
+
|
|
11
|
+
if command -v mise >/dev/null 2>&1; then
|
|
12
|
+
mise install
|
|
13
|
+
mise x -- pip install reuse
|
|
14
|
+
mise x -- bundle install
|
|
15
|
+
pre-commit install
|
|
16
|
+
mise x -- reuse download --all
|
|
17
|
+
bundle exec rake sourcehut
|
|
18
|
+
<%- if has_rdoc -%>
|
|
19
|
+
bundle exec rake rdoc
|
|
20
|
+
<%- end -%>
|
|
21
|
+
else
|
|
22
|
+
echo "mise isn't installed. Please install it to continue." >&2
|
|
23
|
+
exit 1
|
|
24
|
+
fi
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
SPDX-FileCopyrightText: <%= Time.now.year %> <%= copyright_holder %>
|
|
3
|
+
SPDX-License-Identifier: CC-BY-SA-4.0
|
|
4
|
+
-->
|
|
5
|
+
|
|
6
|
+
# Application Architecture
|
|
7
|
+
|
|
8
|
+
Architect robust TUI applications using core library patterns and API best practices.
|
|
9
|
+
|
|
10
|
+
## Core Concepts
|
|
11
|
+
|
|
12
|
+
_Because this gem is in pre-release, it lacks documentation. Please check the source files._
|
|
13
|
+
|
|
14
|
+
## Thread and Ractor Safety
|
|
15
|
+
|
|
16
|
+
_Because this gem is in pre-release, it lacks documentation. Please check the source files._
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
SPDX-FileCopyrightText: <%= Time.now.year %> <%= copyright_holder %>
|
|
3
|
+
SPDX-License-Identifier: CC-BY-SA-4.0
|
|
4
|
+
-->
|
|
5
|
+
# Application Testing Guide
|
|
6
|
+
|
|
7
|
+
This guide explains how to test your RatatuiRuby applications using the provided `RatatuiRuby::TestHelper`.
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
You need to verify that your application looks and behaves correctly. Manually checking every character on a terminal screen is tedious. Dealing with race conditions and complex state management in tests creates friction.
|
|
12
|
+
|
|
13
|
+
The `TestHelper` module solves this. It provides a headless "test terminal" to capture output and a suite of robust assertions to verify state.
|
|
14
|
+
|
|
15
|
+
Use it to write fast, deterministic tests for your TUI applications.
|
|
16
|
+
|
|
17
|
+
## Setup
|
|
18
|
+
|
|
19
|
+
First, require the test helper in your test file or `test_helper.rb`:
|
|
20
|
+
|
|
21
|
+
<!-- SPDX-SnippetBegin -->
|
|
22
|
+
<!--
|
|
23
|
+
SPDX-FileCopyrightText: <%= Time.now.year %> <%= author %>
|
|
24
|
+
SPDX-License-Identifier: MIT-0
|
|
25
|
+
-->
|
|
26
|
+
```ruby
|
|
27
|
+
require "ratatui_ruby/test_helper"
|
|
28
|
+
require "minitest/autorun" # or your preferred test framework
|
|
29
|
+
```
|
|
30
|
+
<!-- SPDX-SnippetEnd -->
|
|
31
|
+
|
|
32
|
+
Then, include the module in your test class:
|
|
33
|
+
|
|
34
|
+
<!-- SPDX-SnippetBegin -->
|
|
35
|
+
<!--
|
|
36
|
+
SPDX-FileCopyrightText: <%= Time.now.year %> <%= author %>
|
|
37
|
+
SPDX-License-Identifier: MIT-0
|
|
38
|
+
-->
|
|
39
|
+
```ruby
|
|
40
|
+
class MyApplicationTest < Minitest::Test
|
|
41
|
+
include RatatuiRuby::TestHelper
|
|
42
|
+
# ...
|
|
43
|
+
end
|
|
44
|
+
```
|
|
45
|
+
<!-- SPDX-SnippetEnd -->
|
|
46
|
+
|
|
47
|
+
## Writing Tests
|
|
48
|
+
|
|
49
|
+
_Because this gem is in pre-release, it lacks documentation. Please check the source files and automated tests._
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* SPDX-FileCopyrightText: <%= Time.now.year %> <%= copyright_holder %>
|
|
3
|
+
* REUSE-IgnoreStart
|
|
4
|
+
* SPDX-License-Identifier: <%= license %>
|
|
5
|
+
* REUSE-IgnoreEnd
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
img {
|
|
9
|
+
max-width: 100%;
|
|
10
|
+
height: auto;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.theme-toggle {
|
|
14
|
+
margin-left: 0 !important;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* Terminal Previews (Native PNGs)
|
|
18
|
+
* The images already contain the window chrome and shadows.
|
|
19
|
+
* We just need to center them and ensure they scale down on mobile.
|
|
20
|
+
*/
|
|
21
|
+
img[src*="images/"] {
|
|
22
|
+
display: block;
|
|
23
|
+
margin: 2em auto;
|
|
24
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
SPDX-FileCopyrightText: <%= Time.now.year %> <%= copyright_holder %>
|
|
3
|
+
SPDX-License-Identifier: CC-BY-SA-4.0
|
|
4
|
+
-->
|
|
5
|
+
# Quickstart
|
|
6
|
+
|
|
7
|
+
Welcome to **<%= gem_name %>**! This guide will help you get up and running with your first Terminal User Interface in Ruby.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
See [Installation in the README](../README.md#installation) for setup instructions.
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## Tutorials
|
|
15
|
+
|
|
16
|
+
### Basic Application
|
|
17
|
+
|
|
18
|
+
Here is a "Hello World" application that demonstrates the core lifecycle of a **<%= gem_name %>** app.
|
|
19
|
+
|
|
20
|
+
_Because this gem is in pre-release, it lacks documentation. Please check the source files.
|
|
21
|
+
|
|
22
|
+
#### How it works
|
|
23
|
+
|
|
24
|
+
_Because this gem is in pre-release, it lacks documentation. Please check the source files.
|
|
25
|
+
|
|
26
|
+
## Examples
|
|
27
|
+
|
|
28
|
+
These examples showcase the full power of **<%= gem_name %>**. You can find their source code in the [examples directory](../examples).
|
|
29
|
+
|
|
30
|
+
### Widget Demos
|
|
31
|
+
|
|
32
|
+
Focused examples for individual concepts. Each demonstrates a single concept and ways to interact with it.
|
|
33
|
+
|
|
34
|
+
| Widget | What it demonstrates |
|
|
35
|
+
|--------|---------------------|
|
|
36
|
+
| _Automated Tests_ | _Because this gem is in pre-release, it lacks documentation. Please check the automated tests for details._ |
|
|
37
|
+
|
|
38
|
+
### Sample Applications
|
|
39
|
+
|
|
40
|
+
These larger examples combine concepts into complete applications, demonstrating real-world TUI patterns and architectures.
|
|
41
|
+
|
|
42
|
+
| Application | Architecture | What you'll learn |
|
|
43
|
+
|-------------|--------------|-------------------|
|
|
44
|
+
| _Automated Tests_ | _Because this gem is in pre-release, it lacks documentation. Please check the automated tests for details._ |
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
## Next Steps
|
|
48
|
+
|
|
49
|
+
Now that you've seen what **<%= gem_name %>** can do:
|
|
50
|
+
|
|
51
|
+
- **Deep dive**: Read the [Application Architecture](../concepts/application_architecture.md) guide for scaling patterns
|
|
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://man.sr.ht/~kerrick/ratatui_ruby/troubleshooting/tui_output.md) to prevent screen corruption
|
|
54
|
+
- **Explore the API**: Browse the [full documentation](../index.md)
|
|
55
|
+
- **Learn the philosophy**: Read [Why RatatuiRuby?](https://man.sr.ht/~kerrick/ratatui_ruby/why.md) for comparisons and design decisions
|
|
56
|
+
- **Get help**: Join the [discussion mailing list](https://lists.sr.ht/~kerrick/ratatui_ruby-discuss)
|
|
File without changes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
SPDX-FileCopyrightText: <%= Time.now.year %> <%= copyright_holder %>
|
|
3
|
+
SPDX-License-Identifier: CC-BY-SA-4.0
|
|
4
|
+
-->
|
|
5
|
+
# Start Here
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Documentation for Users
|
|
9
|
+
|
|
10
|
+
- [README](../README.md): Project overview and installation
|
|
11
|
+
|
|
12
|
+
### Getting Started
|
|
13
|
+
|
|
14
|
+
- [Why RatatuiRuby?](https://man.sr.ht/~kerrick/ratatui_ruby/why.md): Philosophy, comparisons, and what makes us different
|
|
15
|
+
- [Quickstart](./getting_started/quickstart.md): Build your first TUI app
|
|
16
|
+
|
|
17
|
+
### Concepts
|
|
18
|
+
|
|
19
|
+
- [Application Architecture](./concepts/application_architecture.md): Lifecycle patterns and API choices
|
|
20
|
+
- [Testing Your Application](./concepts/application_testing.md): Snapshot testing and style assertions
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## Documentation for Contributors
|
|
24
|
+
|
|
25
|
+
- [Contributing Guidelines](https://man.sr.ht/~kerrick/ratatui_ruby/contributing.md): How to contribute patches and features
|
|
File without changes
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
#--
|
|
4
|
+
# SPDX-FileCopyrightText: <%= Time.now.year %> <%= copyright_holder %>
|
|
5
|
+
# REUSE-IgnoreStart
|
|
6
|
+
# SPDX-License-Identifier: <%= license %>
|
|
7
|
+
# REUSE-IgnoreEnd
|
|
8
|
+
#++
|
|
9
|
+
|
|
10
|
+
require_relative "<%= version_file_require %>"
|
|
11
|
+
|
|
12
|
+
Gem::Specification.new do |spec|
|
|
13
|
+
spec.name = "<%= gem_name %>"
|
|
14
|
+
spec.version = <%= module_name %>::VERSION
|
|
15
|
+
spec.authors = ["<%= author %>"]
|
|
16
|
+
spec.email = ["<%= email %>"]
|
|
17
|
+
|
|
18
|
+
spec.summary = "<%= summary %>"
|
|
19
|
+
spec.description = "<%= description %>"
|
|
20
|
+
spec.homepage = "https://sr.ht/~kerrick/ratatui_ruby/"
|
|
21
|
+
spec.license = "<%= license %>"
|
|
22
|
+
spec.required_ruby_version = [">= 3.2.9", "< 5"]
|
|
23
|
+
|
|
24
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
|
25
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
26
|
+
spec.metadata["bug_tracker_uri"] = "https://todo.sr.ht/~kerrick/ratatui_ruby"
|
|
27
|
+
spec.metadata["mailing_list_uri"] = "https://lists.sr.ht/~kerrick/ratatui_ruby-discuss"
|
|
28
|
+
spec.metadata["source_code_uri"] = "https://git.sr.ht/~kerrick/<%= gem_name %>"
|
|
29
|
+
spec.metadata["changelog_uri"] = "https://git.sr.ht/~kerrick/<%= gem_name %>/tree/stable/item/CHANGELOG.md"
|
|
30
|
+
spec.metadata["documentation_uri"] = "https://git.sr.ht/~kerrick/<%= gem_name %>/tree/HEAD/doc/index.md"
|
|
31
|
+
spec.metadata["wiki_uri"] = "https://man.sr.ht/~kerrick/ratatui_ruby/"
|
|
32
|
+
spec.metadata["funding_uri"] = "https://opencollective.com/ratatui" # Don't fund me, fund the upstream project.
|
|
33
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
|
34
|
+
|
|
35
|
+
gemspec = File.basename(__FILE__)
|
|
36
|
+
spec.files = IO.popen(%w[git ls-files -z], chdir: __dir__, err: IO::NULL) do |ls|
|
|
37
|
+
ls.readlines("\x0", chomp: true).reject do |f|
|
|
38
|
+
(f == gemspec) ||
|
|
39
|
+
f.start_with?(*%w[bin/ test/ spec/ features/ .git .github appveyor Gemfile])
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
spec.bindir = "exe"
|
|
43
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
|
44
|
+
spec.require_paths = ["lib"]
|
|
45
|
+
<%- if has_rust -%>
|
|
46
|
+
spec.extensions = ["ext/<%= gem_name.tr("-", "_") %>/extconf.rb"]
|
|
47
|
+
|
|
48
|
+
spec.add_dependency "rb_sys", "~> 0.9"
|
|
49
|
+
spec.add_development_dependency "rake-compiler", "~> 1.2"
|
|
50
|
+
<%- end -%>
|
|
51
|
+
|
|
52
|
+
spec.add_dependency "ostruct", "~> 0.6"
|
|
53
|
+
spec.add_development_dependency "rdoc", "~> 7.0"
|
|
54
|
+
spec.add_development_dependency "faker", "~> 3.5"
|
|
55
|
+
<%- dependencies.each do |dep| -%>
|
|
56
|
+
spec.add_dependency "<%= dep[:name] %>", "<%= dep[:version] %>"
|
|
57
|
+
<%- end -%>
|
|
58
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: <%= Time.now.year %> <%= copyright_holder %>
|
|
2
|
+
# REUSE-IgnoreStart
|
|
3
|
+
# SPDX-License-Identifier: <%= license %>
|
|
4
|
+
# REUSE-IgnoreEnd
|
|
5
|
+
|
|
6
|
+
[tools]
|
|
7
|
+
ruby = "4.0.0"
|
|
8
|
+
<%- if has_rust -%>
|
|
9
|
+
rust = "1.91.1"
|
|
10
|
+
<%- end -%>
|
|
11
|
+
python = "3.12"
|
|
12
|
+
pre-commit = "latest"
|