veragem 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/CHANGELOG.md +53 -0
- data/LICENSE-APACHE +201 -0
- data/LICENSE-MIT +7 -0
- data/README.md +151 -0
- data/lib/veragem/generator.rb +109 -0
- data/lib/veragem/name.rb +111 -0
- data/lib/veragem/options.rb +53 -0
- data/lib/veragem/project.rb +77 -0
- data/lib/veragem/version.rb +5 -0
- data/lib/veragem.rb +23 -0
- data/plugins.rb +15 -0
- data/sig/bundler.rbs +10 -0
- data/sig/veragem.rbs +79 -0
- data/template/%name%.gemspec.erb +30 -0
- data/template/.editorconfig +15 -0
- data/template/.githooks/commit-msg +12 -0
- data/template/.githooks/pre-commit +6 -0
- data/template/.githooks/pre-push +17 -0
- data/template/.github/ISSUE_TEMPLATE/bug_report.md +27 -0
- data/template/.github/ISSUE_TEMPLATE/config.yml.erb +5 -0
- data/template/.github/ISSUE_TEMPLATE/documentation.md +19 -0
- data/template/.github/ISSUE_TEMPLATE/feature_request.md +15 -0
- data/template/.github/PULL_REQUEST_TEMPLATE.md +14 -0
- data/template/.github/dependabot.yml +85 -0
- data/template/.github/image-registries.sh +31 -0
- data/template/.github/release-notes.sh +13 -0
- data/template/.github/workflows/dependabot-automerge.yml +70 -0
- data/template/.github/workflows/dependency-review.yml +50 -0
- data/template/.github/workflows/image.yml +140 -0
- data/template/.github/workflows/nix.yml +46 -0
- data/template/.github/workflows/release.yml +117 -0
- data/template/.github/workflows/rubocop-autocorrect.yml +114 -0
- data/template/.github/workflows/ruby-ci.yml +62 -0
- data/template/.github/workflows/security.yml +43 -0
- data/template/.github/workflows/style-check-cocogitto.yml +56 -0
- data/template/.github/workflows/style-check-dprint.yml +44 -0
- data/template/.gitignore +12 -0
- data/template/.rubocop.yml +27 -0
- data/template/AGENTS.md.erb +75 -0
- data/template/CODE_OF_CONDUCT.md.erb +18 -0
- data/template/CONTRIBUTING.md.erb +183 -0
- data/template/Gemfile +24 -0
- data/template/LICENSE-APACHE.erb +201 -0
- data/template/LICENSE-MIT.erb +7 -0
- data/template/README.md.erb +82 -0
- data/template/Rakefile +136 -0
- data/template/SECURITY.md.erb +21 -0
- data/template/Steepfile.erb +11 -0
- data/template/bin/console.erb +8 -0
- data/template/bin/setup +5 -0
- data/template/cliff.toml +70 -0
- data/template/cog.toml +8 -0
- data/template/dprint.json +23 -0
- data/template/exe/%name%.erb +6 -0
- data/template/flake.lock +27 -0
- data/template/flake.nix +213 -0
- data/template/lib/%path%/cli.rb.erb +45 -0
- data/template/lib/%path%/version.rb.erb +3 -0
- data/template/lib/%path%.rb.erb +13 -0
- data/template/sig/%path%.rbs.erb +16 -0
- data/template/test/test_%underscored%.rb.erb +27 -0
- data/template/test/test_cli.rb.erb +40 -0
- data/template/test/test_helper.rb.erb +15 -0
- data/template/typeprof.conf.jsonc +7 -0
- metadata +111 -0
data/template/.gitignore
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Bundler's settings and gems (setup-ruby installs into vendor/), the built gems, the coverage
|
|
2
|
+
/.bundle/
|
|
3
|
+
/vendor/
|
|
4
|
+
/pkg/
|
|
5
|
+
/coverage/
|
|
6
|
+
/doc/
|
|
7
|
+
/tmp/
|
|
8
|
+
# rbs collection install's (the lock, rbs_collection.lock.yaml, is committed)
|
|
9
|
+
/.gem_rbs_collection/
|
|
10
|
+
# Nix's build links, direnv's cache
|
|
11
|
+
/result*
|
|
12
|
+
/.direnv
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# RuboCop's defaults, each new cop on as it ships, and its extensions for the tests, packaging (the
|
|
2
|
+
# gem as distributions build it), performance and the Rakefile. The Ruby version is the gemspec's
|
|
3
|
+
# required_ruby_version.
|
|
4
|
+
plugins:
|
|
5
|
+
- rubocop-minitest
|
|
6
|
+
- rubocop-packaging
|
|
7
|
+
- rubocop-performance
|
|
8
|
+
- rubocop-rake
|
|
9
|
+
|
|
10
|
+
inherit_mode:
|
|
11
|
+
merge:
|
|
12
|
+
- Exclude
|
|
13
|
+
|
|
14
|
+
AllCops:
|
|
15
|
+
NewCops: enable
|
|
16
|
+
# `nix build`'s links: the gem installed, which the project index would take for a second copy
|
|
17
|
+
Exclude:
|
|
18
|
+
- "result*/**/*"
|
|
19
|
+
# the whole project indexed first (the rubydex gem), so the cops that can see across files do: a
|
|
20
|
+
# method defined twice in two files, a constant reassigned in another
|
|
21
|
+
UseProjectIndex: true
|
|
22
|
+
|
|
23
|
+
Style/StringLiterals:
|
|
24
|
+
EnforcedStyle: double_quotes
|
|
25
|
+
|
|
26
|
+
Style/StringLiteralsInInterpolation:
|
|
27
|
+
EnforcedStyle: double_quotes
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
Repository rules for `<%= name %>`. These apply to every contributor, human or AI-assisted.
|
|
4
|
+
Adding a dependency or a tool, the tests' rules and the release are
|
|
5
|
+
[CONTRIBUTING.md](CONTRIBUTING.md)'s.
|
|
6
|
+
|
|
7
|
+
## 1. The lint and type policy is the design
|
|
8
|
+
|
|
9
|
+
RuboCop runs with its defaults and every new cop as it ships (`NewCops: enable`), its Minitest,
|
|
10
|
+
packaging, performance and Rake extensions on, and the project indexed first (`UseProjectIndex`, the
|
|
11
|
+
rubydex gem) for the cops that look across files (`.rubocop.yml`). Steep checks `lib/` against the
|
|
12
|
+
signatures in `sig/`, its strictest diagnostics on (`Steepfile`): every method of `lib/` is declared
|
|
13
|
+
in `sig/`, and a warning fails as an error does. Gemfile.lock pins both, so the verdict is the same
|
|
14
|
+
locally and in CI.
|
|
15
|
+
|
|
16
|
+
**Never silence a new cop or diagnostic wholesale.** Either fix the site, or configure it in
|
|
17
|
+
`.rubocop.yml` (or the Steepfile) with a comment saying why it is wrong for this codebase.
|
|
18
|
+
|
|
19
|
+
The shell is held as the code is: shfmt formats it (`.editorconfig` holds its style) and it passes
|
|
20
|
+
ShellCheck. The Nix is nixfmt's. The workflows pass actionlint and, with Dependabot's
|
|
21
|
+
configuration, zizmor's security audit.
|
|
22
|
+
|
|
23
|
+
## 2. Types: signatures by hand, TypeProf to start them
|
|
24
|
+
|
|
25
|
+
`sig/` is written by hand and Steep holds `lib/` to it. `bundle exec rake typeprof` prints the
|
|
26
|
+
signatures TypeProf infers from `lib/`: a start for a new method's, never a replacement for
|
|
27
|
+
reading them -- it says `untyped` where it cannot tell. A signature is as narrow as the code
|
|
28
|
+
allows: `untyped` only where the value truly is any value.
|
|
29
|
+
|
|
30
|
+
## 3. Silence a cop or a diagnostic at the site, with a reason
|
|
31
|
+
|
|
32
|
+
```ruby
|
|
33
|
+
eval(code) # rubocop:disable Security/Eval -- code is this gem's own, never its input
|
|
34
|
+
|
|
35
|
+
# the library declares no signature -- above: text after Steep's diagnostic name voids the ignore
|
|
36
|
+
value = client.fetch # steep:ignore NoMethod
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Name the cop or diagnostic. A reason that restates the rule is not a reason: say what makes the
|
|
40
|
+
site safe. RuboCop reports a disable that no longer applies (`Lint/RedundantCopDisableDirective`),
|
|
41
|
+
so a justification cannot outlive the code it justified.
|
|
42
|
+
|
|
43
|
+
## 4. Comments: only what is essential
|
|
44
|
+
|
|
45
|
+
A comment says what the code cannot: why it is so, the source it follows, the constraint it keeps.
|
|
46
|
+
Make it concise and precise -- a line where a line does -- and never restate the code: that is
|
|
47
|
+
noise, and it goes stale. A change that falsifies a comment rewrites it.
|
|
48
|
+
|
|
49
|
+
## 5. Commits
|
|
50
|
+
|
|
51
|
+
[Conventional Commits](https://www.conventionalcommits.org/) are enforced by `cog check` locally
|
|
52
|
+
and in CI. The changelog is generated from the commits (`cliff.toml`), so the subject line is
|
|
53
|
+
user-facing text; `chore`, `ci` and `style` commits stay out of it, and `!` or a `BREAKING CHANGE`
|
|
54
|
+
footer lists a commit first:
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
feat: accept the name as a symbol too
|
|
58
|
+
fix: strip a trailing newline from the name
|
|
59
|
+
docs: explain the greeting's fallback
|
|
60
|
+
build(deps): depend on json
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
The git hooks (`bundle exec rake hooks`) check the same before a commit and a push; never bypass
|
|
64
|
+
them with `--no-verify`. `git revert` writes `Revert "..."`, which CI refuses: reword it as
|
|
65
|
+
`revert: ...`.
|
|
66
|
+
|
|
67
|
+
## 6. Before you claim a change is done
|
|
68
|
+
|
|
69
|
+
Run `bundle exec rake checks`. It is what CI runs: RuboCop, Steep, the tests with every line,
|
|
70
|
+
branch and method covered, bundler-audit, dprint, the commit messages, the shell, the workflows,
|
|
71
|
+
and the flake's checks. Reporting "done" on a change that has not passed it is the one thing that
|
|
72
|
+
wastes the most time here.
|
|
73
|
+
|
|
74
|
+
If a check fails for reasons unrelated to your change, say so explicitly rather than working
|
|
75
|
+
around it -- a broken check that everyone routes around stops protecting anything.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
This repository is for technical development.
|
|
4
|
+
|
|
5
|
+
- **Scope:** discussions, issues, and pull requests should focus on the
|
|
6
|
+
`<%= name %>` codebase, its architecture, and its implementation.
|
|
7
|
+
- **Conduct:** be direct about code and considerate about people. Critique the
|
|
8
|
+
change, not the contributor.
|
|
9
|
+
- **Moderation:** off-topic, abusive, or bad-faith content will be closed or
|
|
10
|
+
removed.
|
|
11
|
+
|
|
12
|
+
<%- if email -%>
|
|
13
|
+
Report conduct concerns to the maintainers at <%= email %>.
|
|
14
|
+
<%- else -%>
|
|
15
|
+
Report conduct concerns to the maintainers, or through GitHub's
|
|
16
|
+
[report content](https://docs.github.com/en/communities/maintaining-your-safety-on-github/reporting-abuse-or-spam)
|
|
17
|
+
feature.
|
|
18
|
+
<%- end -%>
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# Contributing to `<%= name %>`
|
|
2
|
+
|
|
3
|
+
Thank you for considering contributing to `<%= name %>`!
|
|
4
|
+
|
|
5
|
+
A project just generated: start at [First steps](#first-steps), under Maintainers.
|
|
6
|
+
|
|
7
|
+
## Prerequisites
|
|
8
|
+
|
|
9
|
+
Either **Nix** -- `nix develop` gives Ruby and every tool below at the versions `flake.lock` pins
|
|
10
|
+
-- or the tools installed yourself. The gems are Bundler's either way, from `Gemfile.lock`, as in
|
|
11
|
+
CI (nixpkgs packages few of them, and older).
|
|
12
|
+
|
|
13
|
+
- **[Ruby](https://www.ruby-lang.org) 4.0** or later, with Bundler (Ruby's own). `bin/setup`
|
|
14
|
+
installs the gems `Gemfile.lock` pins: Rake, RuboCop, its extensions and rubydex (its project
|
|
15
|
+
index), Steep, TypeProf, Minitest, SimpleCov, pbt, bundler-audit.
|
|
16
|
+
- **[ShellCheck](https://www.shellcheck.net/)** and **[shfmt](https://github.com/mvdan/sh)** --
|
|
17
|
+
the shell's linter and formatter (its style is `.editorconfig`'s).
|
|
18
|
+
- **[actionlint](https://github.com/rhysd/actionlint)** -- lints the workflows (and, through
|
|
19
|
+
ShellCheck, their `run:` scripts).
|
|
20
|
+
- **[zizmor](https://docs.zizmor.sh/)** -- audits the workflows' security, and Dependabot's
|
|
21
|
+
configuration.
|
|
22
|
+
- **[dprint](https://dprint.dev/)** -- formats the Markdown and TOML.
|
|
23
|
+
- **[cocogitto](https://docs.cog.tools/)** (`cog`) -- enforces Conventional Commits.
|
|
24
|
+
- **[git-cliff](https://git-cliff.org/)** -- writes the changelog at a release.
|
|
25
|
+
- **[Nix](https://nixos.org)** for the last of `rake checks`, the flake's checks (`rake nix`):
|
|
26
|
+
without it, `rake checks` stops there, every other check passed.
|
|
27
|
+
|
|
28
|
+
## Setup
|
|
29
|
+
|
|
30
|
+
1. Fork this repository and create your branch from `main`.
|
|
31
|
+
2. Clone your fork, and install the gems:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
git clone https://github.com/<you>/<%= name %> && cd <%= name %>
|
|
35
|
+
bin/setup
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
3. Optionally, `bundle exec rake hooks`: `.githooks/` then runs RuboCop, the shell, the workflows
|
|
39
|
+
and dprint before each commit, checks its message as a Conventional Commit, and every pushed
|
|
40
|
+
commit's message before a push: what CI would refuse, minutes earlier.
|
|
41
|
+
`git config --unset core.hooksPath` turns them off.
|
|
42
|
+
|
|
43
|
+
## Guidelines
|
|
44
|
+
|
|
45
|
+
Before you start, read [AGENTS.md](AGENTS.md): the lint and type policy, and what to do when a
|
|
46
|
+
cop or a diagnostic fires. It applies to human and AI-assisted contributions alike.
|
|
47
|
+
|
|
48
|
+
## Testing
|
|
49
|
+
|
|
50
|
+
- **Pure functions:** isolate logic from side effects wherever possible and cover it with unit
|
|
51
|
+
tests (Minitest, `test/test_*.rb`).
|
|
52
|
+
- **Properties:** where a rule holds for every input, state it as a property (pbt,
|
|
53
|
+
`Pbt.assert { Pbt.property(...) { ... } }`): it is checked on many generated inputs, and a
|
|
54
|
+
failure is shrunk to its smallest counterexample, with the seed that reproduces it.
|
|
55
|
+
- **Regressions:** if you are fixing a bug, include a test that reproduces the previous failure.
|
|
56
|
+
- **Coverage:** every line, branch and method of `lib/` (SimpleCov's `strict` profile,
|
|
57
|
+
`test/test_helper.rb`). Code a test cannot reach is questioned before it is excluded.
|
|
58
|
+
|
|
59
|
+
## Development Workflow
|
|
60
|
+
|
|
61
|
+
1. Every commit must be a [Conventional Commit](https://www.conventionalcommits.org/) (`cog check`
|
|
62
|
+
enforces it), and its subject is its changelog entry (git-cliff writes the changelog at each
|
|
63
|
+
release): write it for the gem's users.
|
|
64
|
+
2. Run the checks. The Rakefile runs the workflows' commands:
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
bundle exec rake # RuboCop, Steep, the tests: ruby-ci.yml
|
|
68
|
+
bundle exec rake checks # and bundler-audit, dprint, cog, the shell, the workflows, the flake's checks
|
|
69
|
+
bundle exec rake format # RuboCop's corrections, dprint and nixfmt, in place
|
|
70
|
+
bundle exec rake typeprof # the signatures TypeProf infers from lib/, to start sig/ from
|
|
71
|
+
nix build # the gem, built and installed by Nix (flake.nix)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`bundle exec rake -T` lists every task.
|
|
75
|
+
|
|
76
|
+
A new dependency of the gem goes in the gemspec (`spec.add_dependency`), and, for the Nix package,
|
|
77
|
+
its nixpkgs package in flake.nix's `dependencies` (`pkgs.rubyPackages_4_0.<gem>`): the flake's
|
|
78
|
+
`library` check, which loads the gem with its dependencies, fails without it, or with a version
|
|
79
|
+
the gemspec's requirement excludes -- one nixpkgs lacks is built there by `pkgs.buildRubyGem`. A
|
|
80
|
+
new tool goes in the Gemfile, which the built gem never holds: its dependencies are the gemspec's
|
|
81
|
+
alone. `bundle install` then updates the lock. Steep reads a library's signatures when the
|
|
82
|
+
Steepfile names it (`library "json"`): the standard library's, and a gem's own (its `sig/`). A gem
|
|
83
|
+
that ships none may have them in gem_rbs_collection, read through an RBS collection
|
|
84
|
+
(`rbs collection init`, then `rbs collection install`, as rbs's `docs/collection.md` describes).
|
|
85
|
+
|
|
86
|
+
## Creating a Pull Request
|
|
87
|
+
|
|
88
|
+
1. Make sure `bundle exec rake checks` passes.
|
|
89
|
+
2. Open a pull request against `main`, titled as a conventional commit: a squash merge of two or
|
|
90
|
+
more commits makes the title its commit, and so a changelog entry (CI checks it). Describe the
|
|
91
|
+
problem it solves, and link its issue (`Fixes #123`), if any.
|
|
92
|
+
3. Wait for a maintainer's review.
|
|
93
|
+
|
|
94
|
+
## Maintainers
|
|
95
|
+
|
|
96
|
+
### First steps
|
|
97
|
+
|
|
98
|
+
`bundle veragem` made the git repository and added its files. The lock is yours to write, from
|
|
99
|
+
this machine, and then the first commit -- which `cog check` (run by `rake checks` and by CI)
|
|
100
|
+
requires to follow [Conventional Commits](https://www.conventionalcommits.org/):
|
|
101
|
+
|
|
102
|
+
```sh
|
|
103
|
+
bin/setup
|
|
104
|
+
git add .
|
|
105
|
+
git commit -m "chore: initial commit from veragem"
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
With [Nix](https://nixos.org), `nix develop` first: its Ruby and tools are the ones `flake.lock`
|
|
109
|
+
pins. A flake sees git's files only, so they are added already.
|
|
110
|
+
|
|
111
|
+
Then, in whichever order suits you:
|
|
112
|
+
|
|
113
|
+
- Push to `https://github.com/<%= github %>/<%= name %>`.
|
|
114
|
+
- Enable the repository settings the auto-merge workflow needs, listed at the top of
|
|
115
|
+
`.github/workflows/dependabot-automerge.yml`: without required status checks, it merges bumps
|
|
116
|
+
that CI never gated.
|
|
117
|
+
- Enable private vulnerability reporting (Settings → Advanced Security; a public repository's
|
|
118
|
+
alone): it is off by default, and [SECURITY.md](SECURITY.md) and the issue form point to it.
|
|
119
|
+
- Enable the dependency graph (Settings → Advanced Security), if it is off: the dependency review
|
|
120
|
+
(`dependency-review.yml`) fails without it. A private repository's needs GitHub Code Security
|
|
121
|
+
too, an organization's; without it, delete the workflow.
|
|
122
|
+
- Add a pending trusted publisher on [RubyGems](https://rubygems.org/profile/oidc/pending_trusted_publishers)
|
|
123
|
+
for the gem `<%= name %>`: this repository, the workflow `release.yml`, the environment
|
|
124
|
+
`release`. A release tag then publishes without a stored key, its first version too, and its
|
|
125
|
+
GitHub release follows RubyGems': without the publisher, neither is made.
|
|
126
|
+
- If you limit the `release` environment's deployments (Settings → Environments), admit the
|
|
127
|
+
release tags, a rule of ref type Tag, `v*`: the RubyGems job runs on the tag, and an environment
|
|
128
|
+
that refuses it publishes nothing.
|
|
129
|
+
<%- if exe -%>
|
|
130
|
+
- After the first release, make the image public: GHCR publishes a new package as private (its
|
|
131
|
+
page, Package settings → Change visibility).
|
|
132
|
+
- To publish the image to Docker Hub too: create its repository there, then set the repository
|
|
133
|
+
variable `DOCKERHUB_USERNAME` and the secret `DOCKERHUB_TOKEN` (an access token that writes) --
|
|
134
|
+
and the variable `DOCKERHUB_REPOSITORY` (`namespace/name`) unless it is `<username>/<%= name %>`.
|
|
135
|
+
A Docker Hub failure in the build (its login, its name, a push) holds GHCR's tag back too.
|
|
136
|
+
<%- end -%>
|
|
137
|
+
- Run `bundle exec rake checks` once to confirm your tools are complete: a step that stops on a
|
|
138
|
+
missing command names it ([Prerequisites](#prerequisites) lists them; `nix develop` has them
|
|
139
|
+
all).
|
|
140
|
+
- `bundle exec rake hooks`, if you want git to run the quick checks before each commit and push
|
|
141
|
+
([Setup](#setup)).
|
|
142
|
+
- Make the project yours: the code, the tests, the signatures, the README and the gemspec's
|
|
143
|
+
summary.
|
|
144
|
+
|
|
145
|
+
### Releasing
|
|
146
|
+
|
|
147
|
+
From a clean `main`, CI green on it:
|
|
148
|
+
|
|
149
|
+
```sh
|
|
150
|
+
bundle exec rake changelog # the changes the next release will list
|
|
151
|
+
bundle exec rake "bump[minor]" # or major, or patch
|
|
152
|
+
bundle exec rake release
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
`rake bump` refuses a release with nothing in it -- the commits since the last tag must hold a
|
|
156
|
+
change a user meets (`feat`, `fix`, `perf`, `build`...): `chore`, `ci` and `style` alone make
|
|
157
|
+
none. It sets the version in `lib/<%= path %>/version.rb` (the first release keeps the version
|
|
158
|
+
declared, whatever the level), updates the lock, writes the changelog (git-cliff) and commits.
|
|
159
|
+
`rake release`, Bundler's own, builds the gem, tags `v<version>` and pushes the branch and the
|
|
160
|
+
tag; it pushes no gem. The tag runs `release.yml`: the checks and the build, the push to RubyGems
|
|
161
|
+
by Trusted Publishing, then the GitHub release of the same gem, its notes the changelog's new
|
|
162
|
+
section.
|
|
163
|
+
<%- if exe -%>
|
|
164
|
+
Beside `release.yml`, waiting for no RubyGems push, `image.yml` publishes the command's OCI image
|
|
165
|
+
to GHCR (`nix build .#image` builds it here).
|
|
166
|
+
<%- end -%>
|
|
167
|
+
|
|
168
|
+
`rake release` pushes to `main` directly: with "Require a pull request before merging" on, the
|
|
169
|
+
maintainer cutting it needs the rule's bypass. A refused push leaves the release commit and
|
|
170
|
+
removes the tag (Bundler's doing): run `rake release` again once allowed.
|
|
171
|
+
|
|
172
|
+
## Updating the tools
|
|
173
|
+
|
|
174
|
+
Dependabot moves the gems (`Gemfile.lock`) and the actions weekly, and the flake's inputs
|
|
175
|
+
monthly; `dependabot-automerge.yml` merges the minor and patch bumps once the checks pass.
|
|
176
|
+
dprint's plugins, pinned in `dprint.json`, move by hand: `dprint config update`. A new RuboCop
|
|
177
|
+
brings new cops (`NewCops: enable`), a new Steep new diagnostics: read them before silencing any.
|
|
178
|
+
A bump the new cops fail gets RuboCop's safe corrections as a commit on its branch
|
|
179
|
+
(`rubocop-autocorrect.yml`). GitHub holds the workflows of a commit a workflow's token pushes
|
|
180
|
+
until you approve them (the pull request's "Approve workflows to run"); corrected, the bump then
|
|
181
|
+
merges as any bump. What safe corrections leave is yours to fix, in a pull request of yours too: a
|
|
182
|
+
failed run's summary
|
|
183
|
+
holds the corrections as a patch, to `git apply`.
|
data/template/Gemfile
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
source "https://rubygems.org"
|
|
4
|
+
|
|
5
|
+
# The gem's own dependencies are its gemspec's.
|
|
6
|
+
gemspec
|
|
7
|
+
|
|
8
|
+
# The development tools, unconstrained: Gemfile.lock pins them and Dependabot moves the lock. No
|
|
9
|
+
# group needed: the built gem holds neither this file nor the lock, its dependencies the
|
|
10
|
+
# gemspec's alone.
|
|
11
|
+
gem "bundler-audit"
|
|
12
|
+
gem "irb"
|
|
13
|
+
gem "minitest"
|
|
14
|
+
gem "pbt"
|
|
15
|
+
gem "rake"
|
|
16
|
+
gem "rubocop"
|
|
17
|
+
gem "rubocop-minitest"
|
|
18
|
+
gem "rubocop-packaging"
|
|
19
|
+
gem "rubocop-performance"
|
|
20
|
+
gem "rubocop-rake"
|
|
21
|
+
gem "rubydex"
|
|
22
|
+
gem "simplecov"
|
|
23
|
+
gem "steep"
|
|
24
|
+
gem "typeprof"
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright <%= year %> <%= author %>
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright <%= year %> <%= author %>
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# <%= name %>
|
|
2
|
+
|
|
3
|
+
<%= summary %>
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
Ruby 4.0 or later.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
<%- if exe -%>
|
|
13
|
+
gem install <%= name %>
|
|
14
|
+
<%- else -%>
|
|
15
|
+
bundle add <%= name %>
|
|
16
|
+
<%- end -%>
|
|
17
|
+
```
|
|
18
|
+
<%- if exe -%>
|
|
19
|
+
|
|
20
|
+
With Nix, `nix run github:<%= github %>/<%= name %>`. As an OCI image, for Linux on amd64 and arm64:
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
docker run --rm ghcr.io/<%= github.downcase %>/<%= name %> --version
|
|
24
|
+
```
|
|
25
|
+
<%- end -%>
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
<%- if exe -%>
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
<%= name %> Ada # => Hello, Ada!
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
or, as a library:
|
|
35
|
+
<%- end -%>
|
|
36
|
+
|
|
37
|
+
```ruby
|
|
38
|
+
require "<%= path %>"
|
|
39
|
+
|
|
40
|
+
<%= constant %>.greeting("Ada") # => "Hello, Ada!"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Development
|
|
44
|
+
|
|
45
|
+
`bin/setup` installs the gems at `Gemfile.lock`'s versions (its first run writes the lock); then
|
|
46
|
+
`bundle exec rake` runs the Ruby checks (RuboCop, Steep and the tests with their coverage gate)
|
|
47
|
+
and `bundle exec rake checks` everything CI runs:
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
bin/setup
|
|
51
|
+
bundle exec rake checks
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for the tools those checks need, how a release is cut and,
|
|
55
|
+
in a project just generated, its [first steps](CONTRIBUTING.md#first-steps); and
|
|
56
|
+
[AGENTS.md](AGENTS.md) for the lint and type policy.
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
<%- if license == "dual" -%>
|
|
60
|
+
|
|
61
|
+
Licensed under either of
|
|
62
|
+
|
|
63
|
+
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or
|
|
64
|
+
<http://www.apache.org/licenses/LICENSE-2.0>)
|
|
65
|
+
- MIT license ([LICENSE-MIT](LICENSE-MIT) or <http://opensource.org/licenses/MIT>)
|
|
66
|
+
|
|
67
|
+
at your option.
|
|
68
|
+
|
|
69
|
+
### Contribution
|
|
70
|
+
|
|
71
|
+
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in
|
|
72
|
+
the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without
|
|
73
|
+
any additional terms or conditions.
|
|
74
|
+
<%- elsif license == "mit" -%>
|
|
75
|
+
|
|
76
|
+
Licensed under the MIT license ([LICENSE-MIT](LICENSE-MIT) or
|
|
77
|
+
<http://opensource.org/licenses/MIT>).
|
|
78
|
+
<%- else -%>
|
|
79
|
+
|
|
80
|
+
Licensed under the Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or
|
|
81
|
+
<http://www.apache.org/licenses/LICENSE-2.0>).
|
|
82
|
+
<%- end -%>
|