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
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 128228dcd7c502914864f545a3f08eebcec11a836fa0955269d6e3da81ed099f
|
|
4
|
+
data.tar.gz: '072395d027bb7849364754b89ea554b15bae49334130c09ac3637c7fd041e7ca'
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 413a5e94dae20bdb6ea0fec365aa90973705fef6fa7e846b4b4e16aa84e28eac08fd03e9a6561b231aa4617f789337f348dea7cd1c7359c66fa1258b7d382e38
|
|
7
|
+
data.tar.gz: 99cc7a2a3f4717bc158c92879da21f9d44afda306579086945c5dab4dbd3bdfc691536da20ecc17fd162785956d98f7dcabf2c25164110a090432897f422195e
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented in this file, generated by
|
|
4
|
+
[git-cliff](https://git-cliff.org) from its commits; versions follow
|
|
5
|
+
[Semantic Versioning](https://semver.org).
|
|
6
|
+
|
|
7
|
+
## [0.1.0](https://github.com/veralvx/veragem/tree/v0.1.0) - 2026-10-26
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
- Bundle veragem, a Ruby gem generator as a Bundler plugin
|
|
12
|
+
- template: Rubocop-packaging, and RuboCop's project index (rubydex)
|
|
13
|
+
- template: The gem as a Nix package, and a command's OCI image
|
|
14
|
+
- template: A dependency review of pull requests, and RuboCop's offences annotated
|
|
15
|
+
- template: A Dependabot bump gets RuboCop's safe corrections as a commit
|
|
16
|
+
- template: Dependabot proposes a release once it is a week old
|
|
17
|
+
- template: The workflows and Dependabot's configuration audited by zizmor
|
|
18
|
+
|
|
19
|
+
### Fixes
|
|
20
|
+
|
|
21
|
+
- Refuse names the template cannot generate, read git config as bytes
|
|
22
|
+
- template: Release without unused steps, docs as the tools behave
|
|
23
|
+
- Long namespaced command lines, tool names, isolated git config test
|
|
24
|
+
- Refuse names whose modules a gem's tools would meet as classes
|
|
25
|
+
- Check a name's modules in Bundler's process and a sandboxed Ruby
|
|
26
|
+
- template: The Nix package's metadata read whole, its image's environment set
|
|
27
|
+
- Signatures as narrow as the code, comments that match it
|
|
28
|
+
- Refuse the names a gem's own tools would break, and harden the release
|
|
29
|
+
- A command line's modules clash-free, every conventional commit listed
|
|
30
|
+
- A generated gem's constants found as its code means them
|
|
31
|
+
- A name RubyGems reads as its own is refused; `d-bus` passes its checks
|
|
32
|
+
- template: The dependency review advisory and exact, RuboCop's corrections as a patch
|
|
33
|
+
- template: The autocorrection's commit runs its checks, bounded and recoverable
|
|
34
|
+
- template: The autocorrection's re-run, refused push and paths, as said
|
|
35
|
+
- template: The bump's corrections committed, their checks run on approval
|
|
36
|
+
- template: Only the job that pushes keeps its checkout's token
|
|
37
|
+
|
|
38
|
+
### Documentation
|
|
39
|
+
|
|
40
|
+
- template: The dependency review needs the dependency graph on
|
|
41
|
+
- The README names the bumps' RuboCop corrections [skip ci]
|
|
42
|
+
- The README opens with what veragem is, its name rules a list
|
|
43
|
+
- template: The README shows what the command prints
|
|
44
|
+
- Tighter documents and comments, nothing they say lost
|
|
45
|
+
- template: A gem's own signatures load with the Steepfile's library
|
|
46
|
+
|
|
47
|
+
### Tests
|
|
48
|
+
|
|
49
|
+
- A temporary experiment, a GITHUB_TOKEN push to this pull request
|
|
50
|
+
- The experiment's push, made with GITHUB_TOKEN
|
|
51
|
+
- The GITHUB_TOKEN push experiment again, no review rule in force
|
|
52
|
+
- The experiment's push, made with GITHUB_TOKEN
|
|
53
|
+
|
data/LICENSE-APACHE
ADDED
|
@@ -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 2026 veralvx
|
|
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.
|
data/LICENSE-MIT
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2026 veralvx
|
|
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.
|
data/README.md
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# veragem
|
|
2
|
+
|
|
3
|
+
A Bundler plugin that generates a Ruby gem with its toolchain wired up: the Ruby counterpart of
|
|
4
|
+
the [templates](https://github.com/veralvx/templates) repository's Python and Rust templates.
|
|
5
|
+
`bundle gem` gives a gemspec, a Rakefile, Minitest and RuboCop; `bundle veragem NAME` gives that
|
|
6
|
+
and the rest:
|
|
7
|
+
|
|
8
|
+
- **Ruby 4.0** or later, `required_ruby_version` and CI alike.
|
|
9
|
+
- **Types**: Steep checks `lib/` against the signatures in `sig/`, its strictest diagnostics on;
|
|
10
|
+
TypeProf infers signatures to start them from, and its editor support is configured.
|
|
11
|
+
- **Lint and format**: RuboCop with every new cop, rubocop-minitest, rubocop-packaging,
|
|
12
|
+
rubocop-performance and rubocop-rake; the project is indexed first (rubydex), so the cops that see
|
|
13
|
+
across files do. In CI, offences are annotated on the pull request and a failed run's summary
|
|
14
|
+
holds the safe corrections as a patch; a Dependabot bump the new cops fail gets them as a commit,
|
|
15
|
+
then merges as any bump once you approve its runs (`rubocop-autocorrect.yml`, no token to set).
|
|
16
|
+
- **Tests**: Minitest, a property test with [pbt](https://github.com/ohbarye/pbt), and SimpleCov's
|
|
17
|
+
`strict` profile: every line, branch and method of `lib/` covered.
|
|
18
|
+
- **Security**: bundler-audit over `Gemfile.lock`, daily in CI; a pull request's new gems and
|
|
19
|
+
actions reviewed for their licences and advisories (`dependency-review.yml`, advisory, as in the
|
|
20
|
+
Python and Rust templates); zizmor over the workflows and Dependabot's configuration; Dependabot
|
|
21
|
+
for the gems, the actions and the flake, a release proposed once a week old.
|
|
22
|
+
- **Commits and releases**: Conventional Commits (cocogitto, in CI and opt-in git hooks), a
|
|
23
|
+
changelog written by git-cliff at each release, `rake "bump[minor]"` then Bundler's own
|
|
24
|
+
`rake release`; the tag publishes to RubyGems by Trusted Publishing, no API key stored, and makes
|
|
25
|
+
the GitHub release.
|
|
26
|
+
- **Nix**: a flake with the development shell (Ruby and every tool the checks run), the gem as a
|
|
27
|
+
package (`nix build`), `nix fmt`, and checks for the Nix, the shell scripts, the workflows and
|
|
28
|
+
the package. With `--exe`, `nix run` runs the command, and its OCI image (`nix build .#image`)
|
|
29
|
+
is published to GHCR at each release (`image.yml`), as in the Python and Rust templates.
|
|
30
|
+
- dprint for the Markdown and TOML, an `.editorconfig`, the community documents (`CONTRIBUTING.md`,
|
|
31
|
+
`AGENTS.md`, `SECURITY.md`, `CODE_OF_CONDUCT.md`), issue and pull request templates.
|
|
32
|
+
|
|
33
|
+
In the generated gem, `bundle exec rake` runs the Ruby checks, as CI does;
|
|
34
|
+
`bundle exec rake checks` runs everything CI runs.
|
|
35
|
+
|
|
36
|
+
## Install
|
|
37
|
+
|
|
38
|
+
Ruby 4.0 or later, then:
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
bundle plugin install veragem
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Run outside a project, it installs for your user, and `bundle veragem` then works anywhere. From
|
|
45
|
+
the repository instead: `bundle plugin install veragem --git https://github.com/veralvx/veragem`
|
|
46
|
+
(or `--path` a local checkout).
|
|
47
|
+
|
|
48
|
+
## Usage
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
bundle veragem my_gem # and --author, --github where git config has no user.name, github.user
|
|
52
|
+
cd my_gem
|
|
53
|
+
bin/setup # the gems, and Gemfile.lock written
|
|
54
|
+
git add .
|
|
55
|
+
git commit -m "chore: initial commit from veragem"
|
|
56
|
+
bundle exec rake checks # its tools: the generated CONTRIBUTING.md's, or `nix develop`'s
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
| Option | Default | Goes into |
|
|
60
|
+
| ------------------- | ----------------------------------- | ----------------------------------------------- |
|
|
61
|
+
| `NAME` | -- | the gem, its module, its files: as `bundle gem` |
|
|
62
|
+
| `--exe` | a library alone | a command line: `exe/NAME`, `lib/NAME/cli.rb` |
|
|
63
|
+
| `--license=LICENSE` | `dual` (MIT OR Apache-2.0) | `mit`, `apache` or `dual`: the gemspec, LICENSE |
|
|
64
|
+
| `--author=NAME` | `git config user.name` (required) | the gemspec, the licence's copyright line |
|
|
65
|
+
| `--email=EMAIL` | `git config user.email` (optional) | the gemspec, the code of conduct |
|
|
66
|
+
| `--github=USER` | `git config github.user` (required) | the homepage, the repository's links |
|
|
67
|
+
| `--summary=TEXT` | `A Ruby gem.` | the gemspec, the README, the module's comment |
|
|
68
|
+
|
|
69
|
+
The name follows `bundle gem`'s rules, lower-case: `my_gem` is `MyGem` in `lib/my_gem.rb`, `my-gem`
|
|
70
|
+
is `My::Gem` in `lib/my/gem.rb`. Refused before anything is written, a name:
|
|
71
|
+
|
|
72
|
+
- whose module is already defined, by Ruby, Bundler, Rake or Minitest, or by its top-level library
|
|
73
|
+
where this Ruby has one (`set`, `option_parser`, `date-holidays`: Date is a class);
|
|
74
|
+
- whose file would shadow a library this Ruby has (`json`: lib/json.rb);
|
|
75
|
+
- whose module its tests or `gem build` would take for Minitest's or RubyGems' own
|
|
76
|
+
(`lifecycle_hooks`, `date_like`);
|
|
77
|
+
- that `bundle gem` would refuse or mangle (`1gem`, `my--gem`);
|
|
78
|
+
- one of the Gemfile's own tools (`rubocop-rake`);
|
|
79
|
+
- `test_helper`, whose lib/test_helper.rb would shadow the tests', or one that would write a
|
|
80
|
+
template file twice (`helper`: test/test_helper.rb);
|
|
81
|
+
- longer than 40 characters or deeper than 4 modules (the generated code's lines fit RuboCop's);
|
|
82
|
+
- with `--exe`, whose module is CLI or VERSION (`my-c_l_i`: its command line would find another
|
|
83
|
+
first).
|
|
84
|
+
|
|
85
|
+
The summary is plain text: written into the README as given, Markdown in it is dprint's to check.
|
|
86
|
+
As `bundle gem` does, veragem makes the git repository and adds the files, and runs no
|
|
87
|
+
`bundle install`: `bin/setup` writes the lock, to commit. The generated `CONTRIBUTING.md` lists
|
|
88
|
+
the first steps: the repository's settings, RubyGems' pending trusted publisher.
|
|
89
|
+
|
|
90
|
+
## What you get
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
NAME.gemspec the gem: its version from lib/NAME/version.rb, its files lib/, sig/, exe/
|
|
94
|
+
Gemfile the gemspec, then the tools; Gemfile.lock pins them (written by bin/setup)
|
|
95
|
+
Rakefile `rake`: RuboCop, Steep, the tests; `rake checks`: what CI runs;
|
|
96
|
+
`rake "bump[level]"`, `rake release`; `rake -T` lists them all
|
|
97
|
+
Steepfile, sig/ the types; typeprof.conf.jsonc, TypeProf's editor support
|
|
98
|
+
.rubocop.yml RuboCop and its extensions
|
|
99
|
+
lib/, test/ starter code: typed, documented, every line and branch tested
|
|
100
|
+
bin/setup, bin/console
|
|
101
|
+
flake.nix, flake.lock the dev shell, the package (and the command's image), `nix fmt`, the checks
|
|
102
|
+
.githooks/ opt-in (`rake hooks`): the quick checks before a commit, Conventional Commits
|
|
103
|
+
cliff.toml, cog.toml git-cliff's changelog, cocogitto's commit checks
|
|
104
|
+
dprint.json, .editorconfig
|
|
105
|
+
.github/ CI, the flake, bundler-audit, the dependency review, the release (and the
|
|
106
|
+
image), the style checks, Dependabot, its auto-merge and its bumps'
|
|
107
|
+
RuboCop corrections; issue and pull request templates
|
|
108
|
+
README, CONTRIBUTING, AGENTS, SECURITY, CODE_OF_CONDUCT, LICENSE-MIT / LICENSE-APACHE
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
The Gemfile leaves the development tools unconstrained: the lock pins them at the versions current
|
|
112
|
+
when `bin/setup` first runs, and Dependabot moves it. They need no development group: the built gem
|
|
113
|
+
holds neither the Gemfile nor the lock, its dependencies the gemspec's alone. The dev shell gives
|
|
114
|
+
Ruby and the other tools; the gems are Bundler's, from the lock CI installs from too (nixpkgs
|
|
115
|
+
packages few of them, and older).
|
|
116
|
+
|
|
117
|
+
## How it is verified
|
|
118
|
+
|
|
119
|
+
- The plugin's own tests (`bundle exec rake`): the name rules (`bundle gem`'s constant, as a
|
|
120
|
+
property), the options, every file of each kind and licence rendered, parsed and kept executable,
|
|
121
|
+
the gemspec read back, the values written as given whatever the locale.
|
|
122
|
+
- The harness here is the template's: this repository's Gemfile, Rakefile, workflows, hooks, flake
|
|
123
|
+
and tools' configuration are the template's own files, byte for byte (`test/test_sync.rb`), so
|
|
124
|
+
the template's are checked in place by this repository's checks, and a command line's own
|
|
125
|
+
(`image.yml`) by the smoke test's command gem.
|
|
126
|
+
- The smoke test (`dev/smoke.sh`, `smoke.yml`, weekly too): the plugin installed from this checkout
|
|
127
|
+
generates a gem of each kind and licence, and each passes its own `rake checks` and builds.
|
|
128
|
+
|
|
129
|
+
## Contributing
|
|
130
|
+
|
|
131
|
+
[CONTRIBUTING.md](CONTRIBUTING.md) (the tools, the checks, the template, the release),
|
|
132
|
+
[AGENTS.md](AGENTS.md) (the rules), [SECURITY.md](SECURITY.md),
|
|
133
|
+
[CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md).
|
|
134
|
+
|
|
135
|
+
## License
|
|
136
|
+
|
|
137
|
+
Licensed under either of
|
|
138
|
+
|
|
139
|
+
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or
|
|
140
|
+
<http://www.apache.org/licenses/LICENSE-2.0>)
|
|
141
|
+
- MIT license ([LICENSE-MIT](LICENSE-MIT) or <http://opensource.org/licenses/MIT>)
|
|
142
|
+
|
|
143
|
+
at your option.
|
|
144
|
+
|
|
145
|
+
The generated gems are yours: their licence is the one you choose at generation.
|
|
146
|
+
|
|
147
|
+
### Contribution
|
|
148
|
+
|
|
149
|
+
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in
|
|
150
|
+
the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without
|
|
151
|
+
any additional terms or conditions.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "erb"
|
|
4
|
+
require "fileutils"
|
|
5
|
+
|
|
6
|
+
module Veragem
|
|
7
|
+
# Writes a Project's gem from template/: each `.erb` file rendered, every other copied, each with
|
|
8
|
+
# its mode; then a git repository, its files added, as `bundle gem` leaves one.
|
|
9
|
+
module Generator
|
|
10
|
+
# __dir__ is nil only in code evaluated from a string, never in a required file
|
|
11
|
+
TEMPLATE = File.expand_path("../../template", __dir__) # steep:ignore ArgumentTypeMismatch
|
|
12
|
+
# The files a command line alone needs: its code, its test, its OCI image's workflow.
|
|
13
|
+
EXE = %w[exe/%name%.erb lib/%path%/cli.rb.erb test/test_cli.rb.erb .github/workflows/image.yml
|
|
14
|
+
.github/image-registries.sh].freeze
|
|
15
|
+
# git's variables that point it at another repository (`git rev-parse --local-env-vars`, but the
|
|
16
|
+
# configuration given with `git -c`), which a git hook sets: unset, the repository is the gem's.
|
|
17
|
+
GIT_LOCAL = %w[GIT_ALTERNATE_OBJECT_DIRECTORIES GIT_CONFIG GIT_OBJECT_DIRECTORY GIT_DIR GIT_WORK_TREE
|
|
18
|
+
GIT_IMPLICIT_WORK_TREE GIT_GRAFT_FILE GIT_INDEX_FILE GIT_NO_REPLACE_OBJECTS GIT_REPLACE_REF_BASE
|
|
19
|
+
GIT_PREFIX GIT_SHALLOW_FILE GIT_COMMON_DIR].to_h { [it, nil] }.freeze
|
|
20
|
+
# Each LICENSE-* file's SPDX identifier.
|
|
21
|
+
LICENSE_FILES = { "LICENSE-MIT.erb" => "MIT", "LICENSE-APACHE.erb" => "Apache-2.0" }.freeze
|
|
22
|
+
|
|
23
|
+
# Each template file the project takes, and its path in the gem.
|
|
24
|
+
def self.files(project)
|
|
25
|
+
skipped = skipped(project)
|
|
26
|
+
files = Dir.glob("**/*", File::FNM_DOTMATCH, base: TEMPLATE).sort.to_h { [it, path_of(it, project)] }
|
|
27
|
+
files.reject! { |file, _| skipped.include?(file) || File.directory?(File.join(TEMPLATE, file)) }
|
|
28
|
+
check(project, files.values)
|
|
29
|
+
check_command(project)
|
|
30
|
+
files
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# A name can be a tool's, which the Gemfile would name twice, or a template file's: `helper`'s
|
|
34
|
+
# test would be test/test_helper.rb.
|
|
35
|
+
def self.check(project, paths)
|
|
36
|
+
raise Error, "invalid gem name #{project.name}: the Gemfile's own tool" if tools.include?(project.name)
|
|
37
|
+
|
|
38
|
+
clash = paths.tally.find { |_, count| count > 1 }
|
|
39
|
+
raise Error, "invalid gem name #{project.name}: it would write #{clash[0]} twice" if clash
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# A command line names the gem's module from within it, <Gem>::CLI, whose constant lookup finds
|
|
43
|
+
# CLI and VERSION first: the gem's module cannot be named either.
|
|
44
|
+
def self.check_command(project)
|
|
45
|
+
innermost = project.modules.last
|
|
46
|
+
return unless project.exe && %w[CLI VERSION].include?(innermost)
|
|
47
|
+
|
|
48
|
+
raise Error, "invalid gem name #{project.name}: its command line would find another #{innermost} " \
|
|
49
|
+
"before its module"
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# The gems template/Gemfile names.
|
|
53
|
+
def self.tools = File.read(File.join(TEMPLATE, "Gemfile")).scan(/^gem "([^"]+)"/).flatten
|
|
54
|
+
|
|
55
|
+
# The files another kind or licence takes.
|
|
56
|
+
def self.skipped(project)
|
|
57
|
+
licenses = LICENSE_FILES.reject { |_, spdx| project.licenses.include?(spdx) }.keys
|
|
58
|
+
project.exe ? licenses : licenses + EXE
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def self.path_of(file, project)
|
|
62
|
+
file.delete_suffix(".erb").gsub("%name%", project.name).gsub("%path%", project.path)
|
|
63
|
+
.gsub("%underscored%", project.underscored)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Into +target+, a new directory: a failure, an interrupt included, leaves none behind.
|
|
67
|
+
def self.generate(project, target)
|
|
68
|
+
raise Error, "#{target} already exists" if File.exist?(target) || File.symlink?(target)
|
|
69
|
+
|
|
70
|
+
files = files(project)
|
|
71
|
+
Dir.mkdir(target)
|
|
72
|
+
removed_unless_done(target) do
|
|
73
|
+
files.each { |file, path| write(File.join(TEMPLATE, file), File.join(target, path), project) }
|
|
74
|
+
git(target, "init", "--quiet", "--initial-branch=main")
|
|
75
|
+
git(target, "add", "--all")
|
|
76
|
+
end
|
|
77
|
+
rescue SystemCallError => e
|
|
78
|
+
raise Error, e.message
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def self.removed_unless_done(target)
|
|
82
|
+
done = false
|
|
83
|
+
begin
|
|
84
|
+
yield
|
|
85
|
+
done = true
|
|
86
|
+
ensure
|
|
87
|
+
FileUtils.rm_rf(target) unless done
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def self.write(source, destination, project)
|
|
92
|
+
FileUtils.mkdir_p(File.dirname(destination))
|
|
93
|
+
File.binwrite(destination, source.end_with?(".erb") ? render(source, project) : File.binread(source))
|
|
94
|
+
return unless File.executable?(source)
|
|
95
|
+
|
|
96
|
+
# executable where readable, as `chmod +x` under the umask
|
|
97
|
+
mode = File.stat(destination).mode
|
|
98
|
+
File.chmod(mode | ((mode & 0o444) >> 2), destination)
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def self.render(source, project)
|
|
102
|
+
ERB.new(File.read(source, encoding: Encoding::UTF_8), trim_mode: "-").result(project.instance_eval { binding })
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def self.git(dir, *args)
|
|
106
|
+
system(GIT_LOCAL, "git", *args, chdir: dir) or raise Error, "git #{args.join(" ")} failed in #{dir}"
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
data/lib/veragem/name.rb
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "tmpdir"
|
|
4
|
+
|
|
5
|
+
module Veragem
|
|
6
|
+
# A gem's name, checked: `bundle gem`'s rules, and what the gem's files and tools would meet.
|
|
7
|
+
module Name
|
|
8
|
+
# `bundle gem`'s names, lower-case: words of letters and digits joined by `_` (one constant,
|
|
9
|
+
# `my_gem` is MyGem) or `-` (a namespace, `my-gem` is My::Gem), each constant a letter first.
|
|
10
|
+
PATTERN = /\A[a-z][a-z0-9]*(?:_[a-z0-9]+)*(?:-[a-z][a-z0-9]*(?:_[a-z0-9]+)*)*\z/
|
|
11
|
+
|
|
12
|
+
# Its modules, as `bundle gem` names them: `my-gem_tools`' My, GemTools.
|
|
13
|
+
def self.modules(name) = name.split("-").map { |word| word.split("_").map(&:capitalize).join }
|
|
14
|
+
|
|
15
|
+
# +name+, or an Error saying why a gem cannot have it.
|
|
16
|
+
def self.check(name)
|
|
17
|
+
unless PATTERN.match?(name)
|
|
18
|
+
raise Error, "invalid gem name #{name.inspect}: lower-case words of letters and digits, each a " \
|
|
19
|
+
"letter first after a dash, joined by _ or - (my_gem, my-gem)"
|
|
20
|
+
end
|
|
21
|
+
# the generated code's lines within RuboCop's 120 columns
|
|
22
|
+
if name.length > 40 || name.count("-") > 3
|
|
23
|
+
raise Error, "invalid gem name #{name}: at most 40 characters and 4 modules deep"
|
|
24
|
+
end
|
|
25
|
+
# lib/test_helper.rb would shadow the tests' own (Minitest's -Ilib:test)
|
|
26
|
+
raise Error, "invalid gem name #{name}: its lib/test_helper.rb would shadow the tests'" if name == "test_helper"
|
|
27
|
+
|
|
28
|
+
check_modules(name)
|
|
29
|
+
name
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# The gem writes lib/<path>.rb, `module` for each of its modules, and tests that name the first.
|
|
33
|
+
def self.check_modules(name)
|
|
34
|
+
nestings = nestings_of(name)
|
|
35
|
+
shadowed, found, *kinds = probe(library_of(name), name.tr("-", "/"), nestings)
|
|
36
|
+
check_shadowing(name, shadowed.to_s, found.to_s)
|
|
37
|
+
check_defined(name, nestings.zip(kinds).take_while { |_, kind| !kind.to_s.empty? }, nestings.last)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Its lib/<path>.rb, first on the load path, must not shadow a library its tools require
|
|
41
|
+
# (lib/json.rb, JSON's); its tests' classes, Minitest::Test's, and its gemspec, which `gem build`
|
|
42
|
+
# evaluates in Gem::Specification, must find its module, not one of theirs (`lifecycle_hooks`:
|
|
43
|
+
# Minitest::Test::LifecycleHooks).
|
|
44
|
+
def self.check_shadowing(name, shadowed, found)
|
|
45
|
+
unless shadowed.empty?
|
|
46
|
+
raise Error, "invalid gem name #{name}: its lib/#{name.tr("-", "/")}.rb would shadow #{shadowed}"
|
|
47
|
+
end
|
|
48
|
+
raise Error, "invalid gem name #{name}: #{found} for its module" unless found.empty?
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# The +defined+ nestings, outermost first, each with its class: the gem's own module, +innermost+,
|
|
52
|
+
# one defined already (Comparable) would reopen; an outer one that is a class (Set, Logger), it
|
|
53
|
+
# could not open.
|
|
54
|
+
def self.check_defined(name, defined, innermost)
|
|
55
|
+
raise Error, "invalid gem name #{name}: #{innermost} is already defined" if defined.last&.first == innermost
|
|
56
|
+
|
|
57
|
+
outer = defined.find { |_, kind| kind != "Module" }
|
|
58
|
+
raise Error, "invalid gem name #{name}: #{outer[0]} is a #{outer[1]}, not a module" if outer
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# The gem's top-level library: `date-holidays`' date
|
|
62
|
+
def self.library_of(name) = name.split("-").fetch(0)
|
|
63
|
+
|
|
64
|
+
# My, My::Gem
|
|
65
|
+
def self.nestings_of(name) = modules(name).then { |modules| (1..modules.size).map { modules.first(it).join("::") } }
|
|
66
|
+
|
|
67
|
+
# The child: no stdin, a scratch directory, its arguments cleared before the libraries load, their
|
|
68
|
+
# own output kept from the answers, no exit hooks.
|
|
69
|
+
PROBE = <<~RUBY
|
|
70
|
+
library, path, *nestings = ARGV
|
|
71
|
+
first = nestings.fetch(0)
|
|
72
|
+
ARGV.clear
|
|
73
|
+
answers = $stdout.dup
|
|
74
|
+
$stdout.reopen($stderr)
|
|
75
|
+
["bundler", "bundler/cli", "rake", "minitest", library].each do |feature|
|
|
76
|
+
require feature
|
|
77
|
+
rescue StandardError, ScriptError
|
|
78
|
+
nil
|
|
79
|
+
end
|
|
80
|
+
answers.puts($LOAD_PATH.resolve_feature_path(path)&.last)
|
|
81
|
+
readers = { "its tests" => defined?(Minitest::Test) && Minitest::Test, "gem build" => Gem::Specification }
|
|
82
|
+
found = readers.filter_map do |reader, context|
|
|
83
|
+
owner = context && (context.ancestors - Object.ancestors).find { it.const_defined?(first, false) }
|
|
84
|
+
"\#{reader} would find \#{owner}::\#{first}" if owner
|
|
85
|
+
end
|
|
86
|
+
answers.puts(found.first)
|
|
87
|
+
nestings.each { answers.puts(Object.const_defined?(it, false) ? Object.const_get(it, false).class : "") }
|
|
88
|
+
answers.flush
|
|
89
|
+
exit!(0)
|
|
90
|
+
RUBY
|
|
91
|
+
private_constant :PROBE
|
|
92
|
+
|
|
93
|
+
# The file +path+ already requires, what a Minitest::Test or Gem::Specification finds for the
|
|
94
|
+
# first of +nestings+, then each nesting's class -- Module, Class... --, each "" when none, where
|
|
95
|
+
# the gem meets them: in Bundler's CLI, which reads its gemspec (bin/setup's `bundle install`),
|
|
96
|
+
# in Rake and Minitest, and with its top-level +library+ (`date-holidays`: date), which its tools
|
|
97
|
+
# may require. Asked of a Ruby of its own, so the answer is the same however this one was
|
|
98
|
+
# started. Its answers come only once the libraries are loaded, then the child exits: one fewer
|
|
99
|
+
# is a failure.
|
|
100
|
+
def self.probe(library, path, nestings)
|
|
101
|
+
command = [RbConfig.ruby, "-e", PROBE, library, path, *nestings]
|
|
102
|
+
answers = Dir.mktmpdir do |dir|
|
|
103
|
+
IO.popen(Bundler.unbundled_env, command, unsetenv_others: true, in: File::NULL, err: File::NULL, chdir: dir,
|
|
104
|
+
&:readlines)
|
|
105
|
+
end
|
|
106
|
+
raise Error, "could not check #{library}'s modules" unless answers.size == nestings.size + 2
|
|
107
|
+
|
|
108
|
+
answers.map(&:chomp)
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|