rubysmith 6.10.0 → 7.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.adoc +51 -61
- data/lib/rubysmith/builder.rb +9 -9
- data/lib/rubysmith/builders/abstract.rb +4 -4
- data/lib/rubysmith/builders/bundler.rb +2 -2
- data/lib/rubysmith/builders/caliber.rb +4 -4
- data/lib/rubysmith/builders/circle_ci.rb +3 -3
- data/lib/rubysmith/builders/console.rb +3 -3
- data/lib/rubysmith/builders/core.rb +6 -6
- data/lib/rubysmith/builders/documentation/citation.rb +3 -3
- data/lib/rubysmith/builders/documentation/license.rb +8 -9
- data/lib/rubysmith/builders/documentation/readme.rb +4 -4
- data/lib/rubysmith/builders/documentation/version.rb +4 -5
- data/lib/rubysmith/builders/git/commit.rb +4 -8
- data/lib/rubysmith/builders/git/ignore.rb +3 -3
- data/lib/rubysmith/builders/git/safe.rb +3 -3
- data/lib/rubysmith/builders/git/setup.rb +3 -3
- data/lib/rubysmith/builders/git_hub/ci.rb +27 -0
- data/lib/rubysmith/builders/git_hub/funding.rb +23 -0
- data/lib/rubysmith/builders/git_hub/template.rb +32 -0
- data/lib/rubysmith/builders/guard.rb +4 -4
- data/lib/rubysmith/builders/init.rb +2 -2
- data/lib/rubysmith/builders/rake/binstub.rb +24 -0
- data/lib/rubysmith/builders/rake/configuration.rb +29 -0
- data/lib/rubysmith/builders/reek.rb +3 -3
- data/lib/rubysmith/builders/rspec/binstub.rb +3 -3
- data/lib/rubysmith/builders/rspec/context.rb +6 -6
- data/lib/rubysmith/builders/rspec/helper.rb +3 -3
- data/lib/rubysmith/builders/setup.rb +3 -3
- data/lib/rubysmith/builders/version.rb +2 -2
- data/lib/rubysmith/cli/actions/amazing_print.rb +3 -3
- data/lib/rubysmith/cli/actions/caliber.rb +3 -3
- data/lib/rubysmith/cli/actions/circle_ci.rb +4 -4
- data/lib/rubysmith/cli/actions/citation.rb +3 -3
- data/lib/rubysmith/cli/actions/community.rb +3 -3
- data/lib/rubysmith/cli/actions/conduct.rb +3 -3
- data/lib/rubysmith/cli/actions/console.rb +3 -3
- data/lib/rubysmith/cli/actions/contributions.rb +3 -3
- data/lib/rubysmith/cli/actions/debug.rb +3 -3
- data/lib/rubysmith/cli/actions/funding.rb +4 -4
- data/lib/rubysmith/cli/actions/git.rb +3 -3
- data/lib/rubysmith/cli/actions/git_hub.rb +3 -3
- data/lib/rubysmith/cli/actions/git_hub_ci.rb +3 -3
- data/lib/rubysmith/cli/actions/git_lint.rb +3 -3
- data/lib/rubysmith/cli/actions/guard.rb +5 -3
- data/lib/rubysmith/cli/actions/irb_kit.rb +3 -3
- data/lib/rubysmith/cli/actions/license.rb +3 -3
- data/lib/rubysmith/cli/actions/maximum.rb +4 -4
- data/lib/rubysmith/cli/actions/minimum.rb +4 -4
- data/lib/rubysmith/cli/actions/name.rb +2 -2
- data/lib/rubysmith/cli/actions/rake.rb +3 -3
- data/lib/rubysmith/cli/actions/readme.rb +3 -3
- data/lib/rubysmith/cli/actions/reek.rb +3 -3
- data/lib/rubysmith/cli/actions/refinements.rb +3 -3
- data/lib/rubysmith/cli/actions/rspec.rb +3 -3
- data/lib/rubysmith/cli/actions/rtc.rb +3 -3
- data/lib/rubysmith/cli/actions/security.rb +3 -3
- data/lib/rubysmith/cli/actions/setup.rb +3 -3
- data/lib/rubysmith/cli/actions/simple_cov.rb +3 -3
- data/lib/rubysmith/cli/actions/versions.rb +3 -3
- data/lib/rubysmith/cli/actions/zeitwerk.rb +3 -3
- data/lib/rubysmith/cli/commands/build.rb +33 -31
- data/lib/rubysmith/cli/shell.rb +0 -1
- data/lib/rubysmith/configuration/contract.rb +16 -14
- data/lib/rubysmith/configuration/defaults.yml +22 -2
- data/lib/rubysmith/configuration/model.rb +30 -28
- data/lib/rubysmith/configuration/transformers/git_hub_user.rb +2 -2
- data/lib/rubysmith/container.rb +18 -9
- data/lib/rubysmith/extensions/bundler.rb +7 -7
- data/lib/rubysmith/extensions/pragmater.rb +10 -10
- data/lib/rubysmith/extensions/rubocop.rb +7 -7
- data/lib/rubysmith/extensions/tocer.rb +8 -8
- data/lib/rubysmith/renderers/erb.rb +4 -4
- data/lib/rubysmith/templates/%project_name%/.circleci/config.yml.erb +1 -1
- data/lib/rubysmith/templates/%project_name%/.github/FUNDING.yml.erb +1 -1
- data/lib/rubysmith/templates/%project_name%/.github/workflows/ci.yml.erb +1 -1
- data/lib/rubysmith/templates/%project_name%/CITATION.cff.erb +12 -12
- data/lib/rubysmith/templates/%project_name%/Gemfile.erb +18 -18
- data/lib/rubysmith/templates/%project_name%/LICENSE-apache.adoc.erb +1 -1
- data/lib/rubysmith/templates/%project_name%/LICENSE-apache.md.erb +1 -1
- data/lib/rubysmith/templates/%project_name%/LICENSE-mit.adoc.erb +1 -1
- data/lib/rubysmith/templates/%project_name%/LICENSE-mit.md.erb +1 -1
- data/lib/rubysmith/templates/%project_name%/README.adoc.erb +21 -21
- data/lib/rubysmith/templates/%project_name%/README.md.erb +21 -21
- data/lib/rubysmith/templates/%project_name%/Rakefile.erb +10 -10
- data/lib/rubysmith/templates/%project_name%/VERSIONS.adoc.erb +1 -1
- data/lib/rubysmith/templates/%project_name%/VERSIONS.md.erb +1 -1
- data/lib/rubysmith/templates/%project_name%/bin/console.erb +1 -1
- data/lib/rubysmith/templates/%project_name%/bin/setup.erb +1 -1
- data/lib/rubysmith/templates/%project_name%/lib/%project_path%.rb.erb +7 -7
- data/lib/rubysmith/templates/%project_name%/spec/lib/%project_path%_spec.rb.erb +2 -2
- data/lib/rubysmith/templates/%project_name%/spec/spec_helper.rb.erb +4 -4
- data/lib/rubysmith/templates/%project_name%/spec/support/shared_contexts/temp_dir.rb.erb +3 -3
- data/lib/rubysmith.rb +1 -0
- data/rubysmith.gemspec +11 -12
- data.tar.gz.sig +0 -0
- metadata +28 -43
- metadata.gz.sig +0 -0
- data/lib/rubysmith/builders/git_hub.rb +0 -39
- data/lib/rubysmith/builders/git_hub_ci.rb +0 -25
- data/lib/rubysmith/builders/rake.rb +0 -39
- data/lib/rubysmith/cli/actions/publish.rb +0 -35
- data/lib/rubysmith/configuration/transformers/target_root.rb +0 -18
- data/lib/rubysmith/extensions/milestoner.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98de14cb0b27d946e2c34e742a2d8c41a35be86d0a807a43d5d269c556f5ecf9
|
4
|
+
data.tar.gz: e3374105862254535024815aadf97a8e22a6ec95aac89f4abb3d1149c846896d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22444127ca4b4ef35b36b5aac3cf54d936c71de4bb72c36ae9fc0e7713145f978048910036c450a96d2c1bfce026338965bd781eb26bd36e5edc56b4327868eb
|
7
|
+
data.tar.gz: b162fa1f1f7aff11957208ba4b43ac8d4b0e59c7eb87d9228328630c12bc1ee311df84a895d10c64b376474976b1123aa229b578f7b7c323e415319f8a11b199
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/README.adoc
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
|
5
5
|
:gemsmith_link: link:https://alchemists.io/projects/gemsmith[Gemsmith]
|
6
6
|
:bundler_inline_link: link:https://alchemists.io/articles/ruby_bundler_inline[Bundler Inline]
|
7
|
+
:string_formats_link: link:https://docs.ruby-lang.org/en/3.3/format_specifications_rdoc.html[String Formats]
|
7
8
|
|
8
9
|
= Rubysmith
|
9
10
|
|
@@ -28,7 +29,6 @@ toc::[]
|
|
28
29
|
* Supports link:https://git-scm.com[Git].
|
29
30
|
* Supports link:https://github.com[GitHub].
|
30
31
|
* Supports link:https://alchemists.io/projects/git-lint[Git Lint].
|
31
|
-
* Supports link:https://github.com/guard/guard[Guard].
|
32
32
|
* Supports link:https://alchemists.io/projects/irb-kit[IRB Kit].
|
33
33
|
* Supports link:https://github.com/ruby/rake[Rake].
|
34
34
|
* Supports link:https://github.com/troessner/reek[Reek].
|
@@ -77,7 +77,7 @@ gem install rubysmith
|
|
77
77
|
|
78
78
|
From the command line, type: `rubysmith --help`
|
79
79
|
|
80
|
-
image:https://alchemists.io/images/projects/rubysmith/screenshots/usage.png[Usage,width=
|
80
|
+
image:https://alchemists.io/images/projects/rubysmith/screenshots/usage.png[Usage,width=554,height=301,role=focal_point]
|
81
81
|
|
82
82
|
==== Build
|
83
83
|
|
@@ -95,10 +95,10 @@ options, you can use `--no-*` prefixes. Example:
|
|
95
95
|
|
96
96
|
[source,bash]
|
97
97
|
----
|
98
|
-
rubysmith build --name demo --no-debug --no-
|
98
|
+
rubysmith build --name demo --no-debug --no-reek
|
99
99
|
----
|
100
100
|
|
101
|
-
With the above example, both Debug and
|
101
|
+
With the above example, both Debug and Reek support would have been disabled when building the
|
102
102
|
`demo` project. Taking this a step further, you can also use the `--min` option to generate a
|
103
103
|
project with bare minimum of options. Example:
|
104
104
|
|
@@ -208,6 +208,8 @@ manner.
|
|
208
208
|
|
209
209
|
===== Guard
|
210
210
|
|
211
|
+
⚠️ _This is deprecated and will be removed in the next major version._
|
212
|
+
|
211
213
|
The `--guard` option allows you add the link:https://github.com/guard/guard[Guard] gem to your
|
212
214
|
project for rapid red, green, refactor development cycles.
|
213
215
|
|
@@ -279,21 +281,6 @@ The `--zeitwerk` option allows you add the link:https://github.com/fxn/zeitwerk[
|
|
279
281
|
|
280
282
|
This includes having access to your project's Zeitwerk loader for inspection and debugging purposes. This means if you built a `Demo` project, you'd immediately have access to your project's loader via `Demo.loader` when using the project console (i.e. `bin/console`, assuming you built your project with the `--console` flag enabled which is default behavior).
|
281
283
|
|
282
|
-
==== Publish
|
283
|
-
|
284
|
-
Rubysmith can be used to publish your Ruby projects. This is done via the `--publish` command. If,
|
285
|
-
for example, you want to publish `0.1.0` of your `demo` project you could do that as follows:
|
286
|
-
|
287
|
-
[source,bash]
|
288
|
-
----
|
289
|
-
cd demo
|
290
|
-
rubysmith --publish 0.1.0
|
291
|
-
----
|
292
|
-
|
293
|
-
This will publish (tag) your `demo` project as `0.1.0` both locally and on your remote Git repository.
|
294
|
-
Rubysmith uses link:https://alchemists.io/projects/milestoner[Milestoner] to handle publishing
|
295
|
-
of your project for you. You can use either but the convenience is built in for you.
|
296
|
-
|
297
284
|
=== Configuration
|
298
285
|
|
299
286
|
This gem can be configured via a global configuration:
|
@@ -308,10 +295,8 @@ variables. The default configuration is as follows:
|
|
308
295
|
[source,yaml]
|
309
296
|
----
|
310
297
|
author:
|
311
|
-
|
312
|
-
|
313
|
-
given_name:
|
314
|
-
url:
|
298
|
+
handle: undefined
|
299
|
+
uri: "%<organization_uri>s/team/%<author_handle>s"
|
315
300
|
build:
|
316
301
|
amazing_print: true
|
317
302
|
caliber: true
|
@@ -328,8 +313,8 @@ build:
|
|
328
313
|
git_hub: false
|
329
314
|
git_hub_ci: false
|
330
315
|
git_lint: true
|
331
|
-
guard:
|
332
|
-
irb_kit:
|
316
|
+
guard: false
|
317
|
+
irb_kit: true
|
333
318
|
license: true
|
334
319
|
maximum: false
|
335
320
|
minimum: false
|
@@ -345,64 +330,69 @@ build:
|
|
345
330
|
versions: true
|
346
331
|
zeitwerk: true
|
347
332
|
citation:
|
348
|
-
affiliation:
|
349
333
|
message: Please use the following metadata when citing this project in your work.
|
350
|
-
orcid:
|
351
334
|
documentation:
|
352
335
|
format: "adoc"
|
353
|
-
git_hub:
|
354
|
-
user:
|
355
336
|
license:
|
356
337
|
label: Hippocratic
|
357
338
|
name: hippocratic
|
358
339
|
version: "2.1"
|
359
340
|
organization:
|
360
|
-
|
341
|
+
uri: https://undefined.io
|
361
342
|
project:
|
362
|
-
|
363
|
-
community:
|
364
|
-
conduct:
|
365
|
-
contributions:
|
366
|
-
download:
|
367
|
-
funding:
|
368
|
-
home:
|
369
|
-
issues:
|
370
|
-
license:
|
371
|
-
security:
|
372
|
-
source:
|
373
|
-
versions:
|
343
|
+
uri:
|
344
|
+
community: "%<organization_uri>s/community"
|
345
|
+
conduct: "%<organization_uri>s/policies/code_of_conduct"
|
346
|
+
contributions: "%<organization_uri>s/policies/contributions"
|
347
|
+
download: "https://rubygems.org/gems/%<project_name>s"
|
348
|
+
funding: "%<repository_uri>s/sponsors/%<repository_handle>s"
|
349
|
+
home: "%<organization_uri>s/projects/%<project_name>s"
|
350
|
+
issues: "%<repository_uri>s/%<repository_handle>s/%<project_name>s/issues"
|
351
|
+
license: "%<organization_uri>s/policies/license"
|
352
|
+
security: "%<organization_uri>s/policies/security"
|
353
|
+
source: "%<repository_uri>s/%<repository_handle>s/%<project_name>s"
|
354
|
+
versions: "%<organization_uri>s/projects/%<project_name>s/versions"
|
374
355
|
version: 0.0.0
|
356
|
+
repository:
|
357
|
+
handle: undefined
|
358
|
+
uri: https://github.com
|
375
359
|
----
|
376
360
|
|
377
|
-
By customizing your configuration, you can change Rubysmith's default behavior when building projects. This is a great way to define your own specialized settings other than what is provide for you by default. This is also a handy way to provide additional information needed for some of the build options.
|
361
|
+
By customizing your configuration, you can change Rubysmith's default behavior when building projects. This is a great way to define your own specialized settings other than what is provide for you by default. This is also a handy way to provide additional information needed for some of the build options.
|
362
|
+
|
363
|
+
You'll also notice some of the values use {string_formats_link} which means you can use any fully qualified key as a string specifier for supported keys like those found in the `author` and `project` sections.
|
364
|
+
|
365
|
+
The next sections will walk you through each configuration so you can learn more.
|
378
366
|
|
379
367
|
==== Author
|
380
368
|
|
381
369
|
Author information is used when generating project documentation and is recommended you fill this
|
382
370
|
information in before building a project. Example:
|
383
371
|
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
372
|
+
[source,yaml]
|
373
|
+
----
|
374
|
+
author:
|
375
|
+
email: jsmith@example.com
|
376
|
+
family_name: Smith
|
377
|
+
given_name: Jill
|
378
|
+
----
|
389
379
|
|
390
380
|
If your global link:https://git-scm.com[Git] configuration is properly configured, your given name;
|
391
381
|
family name; and email will be used by default. Should you not want to defer to Git, you can supply
|
392
|
-
custom values as desired. The
|
382
|
+
custom values as desired. The URI is the only value that can't be automatically computed for you.
|
393
383
|
|
394
384
|
==== Build
|
395
385
|
|
396
386
|
All build options only accept booleans values and can be customized as desired. When changing your build options, they will dynamically render when displaying usage (i.e. `rubysmith --help`). All of these options have been explained in greater detail in the _Usage_ section.
|
397
387
|
|
398
|
-
ℹ️ The `cli` option is provided to support
|
388
|
+
ℹ️ The `cli` option is provided to support {gemsmith_link} but is not, currently, used by
|
399
389
|
this project.
|
400
390
|
|
401
391
|
==== Citations
|
402
392
|
|
403
393
|
This section allows you to configure your link:https://orcid.org[ORCID]
|
404
394
|
link:https://citation-file-format.github.io[citation] information used by the research community.
|
405
|
-
You should definitely fill this in. Your author information, detailed above, will be used
|
395
|
+
You should definitely fill this in. Your author information, detailed above, will also be used when building this file.
|
406
396
|
|
407
397
|
==== Documentation
|
408
398
|
|
@@ -412,10 +402,6 @@ following options are available:
|
|
412
402
|
* `adoc` - Uses link:https://asciidoctor.org[ASCII Doc] format.
|
413
403
|
* `md` - Uses link:https://asciidoctor.org[Markdown] format.
|
414
404
|
|
415
|
-
==== GitHub
|
416
|
-
|
417
|
-
Your GitHub user is the handle you setup when creating your GitHub account (i.e. `+https://github.com/<your_handle>+`). This information is used for template, funding, and/or URL construction purposes.
|
418
|
-
|
419
405
|
==== License
|
420
406
|
|
421
407
|
Use this section to define the license you want to use for your project. The following are available:
|
@@ -428,20 +414,20 @@ When picking a license, you can also supply the appropriate label and version in
|
|
428
414
|
|
429
415
|
==== Organization
|
430
416
|
|
431
|
-
Use this section to define
|
417
|
+
Use this section to define URI information that points to your organization. This is useful for information that isn't project specific but related to all projects within your organization. You'll want to customize this URI especially for documentation purposes.
|
432
418
|
|
433
419
|
==== Project
|
434
420
|
|
435
|
-
There are two sub-categories within this section:
|
436
|
-
specific documentation related to your project. You'll want to customize these
|
437
|
-
used for documentation, citations, and general project information. Some of the
|
421
|
+
There are two sub-categories within this section: URIs and version. The URIs allow you to link to
|
422
|
+
specific documentation related to your project. You'll want to customize these URIs since they are
|
423
|
+
used for documentation, citations, and general project information. Some of the URIs are also used
|
438
424
|
by the {gemsmith_link} gem.
|
439
425
|
|
440
|
-
One powerful feature of this configuration is that you can use
|
426
|
+
One powerful feature of this configuration is that you can use `%<project_name>s` as a placeholder _anywhere_ in your URIs and Rubysmith will ensure your place holder is replaced with your project name when generating a new project. Example:
|
441
427
|
|
442
428
|
....
|
443
429
|
# Configuration
|
444
|
-
https://www.example.com
|
430
|
+
https://www.example.com/%<project_name>s
|
445
431
|
|
446
432
|
# Command
|
447
433
|
rubysmith build --name demo
|
@@ -452,6 +438,10 @@ https://www.example.com/demo
|
|
452
438
|
|
453
439
|
As for the `version` key, this defines the default version of newly created projects. `0.0.0` is the default but you can use a higher version number like `0.1.0` or even `1.0.0` if you are super confident in your work. That said, a lower the number is recommended when building your initial project which is why `0.0.0` is the default.
|
454
440
|
|
441
|
+
==== Repository
|
442
|
+
|
443
|
+
Your repisotry handle is the handle you setup when creating your account (i.e. `+https://github.com/<your_handle>+`). This information is used for template, funding, and/or URI construction purposes.
|
444
|
+
|
455
445
|
== Development
|
456
446
|
|
457
447
|
To contribute, run:
|
data/lib/rubysmith/builder.rb
CHANGED
@@ -15,10 +15,10 @@ module Rubysmith
|
|
15
15
|
|
16
16
|
def self.call(...) = new(...)
|
17
17
|
|
18
|
-
def initialize(
|
19
|
-
|
20
|
-
@configuration = configuration
|
18
|
+
def initialize(settings, helpers: HELPERS, **)
|
19
|
+
@settings = settings
|
21
20
|
@helpers = helpers
|
21
|
+
super(**)
|
22
22
|
end
|
23
23
|
|
24
24
|
def append content
|
@@ -107,7 +107,7 @@ module Rubysmith
|
|
107
107
|
|
108
108
|
private
|
109
109
|
|
110
|
-
attr_reader :
|
110
|
+
attr_reader :settings, :helpers
|
111
111
|
|
112
112
|
def execute *command
|
113
113
|
executor.capture2e(*command).then do |result, status|
|
@@ -117,20 +117,20 @@ module Rubysmith
|
|
117
117
|
|
118
118
|
def inserter = helpers.fetch(__method__)
|
119
119
|
|
120
|
-
def renderer = helpers.fetch(__method__).new(
|
120
|
+
def renderer = helpers.fetch(__method__).new(settings)
|
121
121
|
|
122
122
|
def executor = helpers.fetch(__method__)
|
123
123
|
|
124
|
-
def relative_build_path = build_path.relative_path_from(
|
124
|
+
def relative_build_path = build_path.relative_path_from(settings.target_root)
|
125
125
|
|
126
126
|
def build_path
|
127
127
|
pathway.end_path
|
128
|
-
.gsub("%project_name%",
|
129
|
-
.sub("%project_path%",
|
128
|
+
.gsub("%project_name%", settings.project_name)
|
129
|
+
.sub("%project_path%", settings.project_path)
|
130
130
|
.sub ".erb", ""
|
131
131
|
end
|
132
132
|
|
133
|
-
def pathway =
|
133
|
+
def pathway = settings.pathway
|
134
134
|
|
135
135
|
def log_debug(message) = logger.debug { message }
|
136
136
|
|
@@ -4,11 +4,11 @@ module Rubysmith
|
|
4
4
|
module Builders
|
5
5
|
# Provides default implementation from which builders can inherit from.
|
6
6
|
class Abstract
|
7
|
-
|
7
|
+
include Import[:settings]
|
8
8
|
|
9
|
-
def initialize
|
10
|
-
@configuration = configuration
|
9
|
+
def initialize(builder: Builder, **)
|
11
10
|
@builder = builder
|
11
|
+
super(**)
|
12
12
|
end
|
13
13
|
|
14
14
|
def call
|
@@ -18,7 +18,7 @@ module Rubysmith
|
|
18
18
|
|
19
19
|
protected
|
20
20
|
|
21
|
-
attr_reader :
|
21
|
+
attr_reader :builder
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -9,7 +9,7 @@ module Rubysmith
|
|
9
9
|
using Refinements::Struct
|
10
10
|
|
11
11
|
def call
|
12
|
-
builder.call(
|
12
|
+
builder.call(settings.merge(template_path: "%project_name%/Gemfile.erb"))
|
13
13
|
.render
|
14
14
|
.replace(/\n\s+group/, "\n\ngroup")
|
15
15
|
.replace(/\n\s+gem/, "\n gem")
|
@@ -18,7 +18,7 @@ module Rubysmith
|
|
18
18
|
.replace(/\n\ngroup :(quality|development|test|tools) do\nend/, "")
|
19
19
|
.replace(/org"\n+/, "org\"\n\n")
|
20
20
|
|
21
|
-
|
21
|
+
true
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -9,15 +9,15 @@ module Rubysmith
|
|
9
9
|
using Refinements::Struct
|
10
10
|
|
11
11
|
def call
|
12
|
-
return
|
12
|
+
return false unless settings.build_caliber
|
13
13
|
|
14
|
-
builder.call(
|
14
|
+
builder.call(settings.merge(template_path: "%project_name%/bin/rubocop.erb"))
|
15
15
|
.render
|
16
16
|
.permit 0o755
|
17
17
|
|
18
18
|
path = "%project_name%/.config/rubocop/config.yml.erb"
|
19
|
-
builder.call(
|
20
|
-
|
19
|
+
builder.call(settings.merge(template_path: path)).render
|
20
|
+
true
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -9,13 +9,13 @@ module Rubysmith
|
|
9
9
|
using Refinements::Struct
|
10
10
|
|
11
11
|
def call
|
12
|
-
return
|
12
|
+
return false unless settings.build_circle_ci
|
13
13
|
|
14
|
-
builder.call(
|
14
|
+
builder.call(settings.merge(template_path: "%project_name%/.circleci/config.yml.erb"))
|
15
15
|
.render
|
16
16
|
.replace(/\n\n\Z/, "\n")
|
17
17
|
|
18
|
-
|
18
|
+
true
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -9,13 +9,13 @@ module Rubysmith
|
|
9
9
|
using Refinements::Struct
|
10
10
|
|
11
11
|
def call
|
12
|
-
return
|
12
|
+
return false unless settings.build_console
|
13
13
|
|
14
|
-
builder.call(
|
14
|
+
builder.call(settings.merge(template_path: "%project_name%/bin/console.erb"))
|
15
15
|
.render
|
16
16
|
.permit 0o755
|
17
17
|
|
18
|
-
|
18
|
+
true
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -13,13 +13,13 @@ module Rubysmith
|
|
13
13
|
def call
|
14
14
|
render_implementation
|
15
15
|
render_specification
|
16
|
-
|
16
|
+
true
|
17
17
|
end
|
18
18
|
|
19
19
|
private
|
20
20
|
|
21
21
|
def render_implementation
|
22
|
-
builder.call(
|
22
|
+
builder.call(settings.merge(template_path: "%project_name%/lib/%project_path%.rb.erb"))
|
23
23
|
.render
|
24
24
|
.replace(" require", "require")
|
25
25
|
.replace(/ (?=(Zeit|loader|end))/, "")
|
@@ -28,15 +28,15 @@ module Rubysmith
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def render_specification
|
31
|
-
return unless
|
31
|
+
return unless settings.build_zeitwerk
|
32
32
|
|
33
33
|
path = "%project_name%/spec/lib/%project_path%_spec.rb.erb"
|
34
|
-
builder.call(
|
34
|
+
builder.call(settings.merge(template_path: path)).render
|
35
35
|
end
|
36
36
|
|
37
|
-
def indentation = ::Core::EMPTY_STRING.indent
|
37
|
+
def indentation = ::Core::EMPTY_STRING.indent settings.project_levels
|
38
38
|
|
39
|
-
def module_name =
|
39
|
+
def module_name = settings.project_class
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
@@ -10,10 +10,10 @@ module Rubysmith
|
|
10
10
|
using Refinements::Struct
|
11
11
|
|
12
12
|
def call
|
13
|
-
return
|
13
|
+
return false unless settings.build_citation
|
14
14
|
|
15
|
-
builder.call(
|
16
|
-
|
15
|
+
builder.call(settings.merge(template_path: "%project_name%/CITATION.cff.erb")).render
|
16
|
+
true
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "refinements/struct"
|
4
|
-
require "tocer"
|
5
4
|
|
6
5
|
module Rubysmith
|
7
6
|
module Builders
|
@@ -11,21 +10,21 @@ module Rubysmith
|
|
11
10
|
using Refinements::Struct
|
12
11
|
|
13
12
|
def call
|
14
|
-
return
|
13
|
+
return false unless settings.build_license
|
15
14
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
settings.merge(template_path: "%project_name%/LICENSE-#{license}.#{kind}.erb")
|
16
|
+
.then do |updated_settings|
|
17
|
+
builder.call(updated_settings).render.rename "LICENSE.#{kind}"
|
18
|
+
end
|
20
19
|
|
21
|
-
|
20
|
+
true
|
22
21
|
end
|
23
22
|
|
24
23
|
private
|
25
24
|
|
26
|
-
def kind =
|
25
|
+
def kind = settings.documentation_format
|
27
26
|
|
28
|
-
def license =
|
27
|
+
def license = settings.license_name
|
29
28
|
end
|
30
29
|
end
|
31
30
|
end
|
@@ -10,19 +10,19 @@ module Rubysmith
|
|
10
10
|
using Refinements::Struct
|
11
11
|
|
12
12
|
def call
|
13
|
-
return
|
13
|
+
return false unless settings.build_readme
|
14
14
|
|
15
|
-
builder.call(
|
15
|
+
builder.call(settings.merge(template_path: "%project_name%/README.#{kind}.erb"))
|
16
16
|
.render
|
17
17
|
.replace(/\n{2,}/, "\n\n")
|
18
18
|
.replace("\n \n", "\n")
|
19
19
|
|
20
|
-
|
20
|
+
true
|
21
21
|
end
|
22
22
|
|
23
23
|
protected
|
24
24
|
|
25
|
-
def kind =
|
25
|
+
def kind = settings.documentation_format
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -11,17 +11,16 @@ module Rubysmith
|
|
11
11
|
using Refinements::Struct
|
12
12
|
|
13
13
|
def call
|
14
|
-
return
|
14
|
+
return false unless settings.build_versions
|
15
15
|
|
16
|
-
builder.call(
|
17
|
-
.render
|
16
|
+
builder.call(settings.merge(template_path: "%project_name%/VERSIONS.#{kind}.erb")).render
|
18
17
|
|
19
|
-
|
18
|
+
true
|
20
19
|
end
|
21
20
|
|
22
21
|
private
|
23
22
|
|
24
|
-
def kind =
|
23
|
+
def kind = settings.documentation_format
|
25
24
|
end
|
26
25
|
end
|
27
26
|
end
|
@@ -7,21 +7,17 @@ module Rubysmith
|
|
7
7
|
class Commit < Abstract
|
8
8
|
include Import[:specification]
|
9
9
|
|
10
|
-
def initialize(configuration, builder: Builder, **)
|
11
|
-
super
|
12
|
-
end
|
13
|
-
|
14
10
|
def call
|
15
|
-
return
|
11
|
+
return false unless settings.build_git
|
16
12
|
|
17
|
-
builder.call(
|
13
|
+
builder.call(settings)
|
18
14
|
.run("git add .", chdir: project_name)
|
19
15
|
.run(
|
20
16
|
%(git commit --all --message "Added project skeleton" --message "#{body}"),
|
21
17
|
chdir: project_name
|
22
18
|
)
|
23
19
|
|
24
|
-
|
20
|
+
true
|
25
21
|
end
|
26
22
|
|
27
23
|
private
|
@@ -31,7 +27,7 @@ module Rubysmith
|
|
31
27
|
"#{specification.version}."
|
32
28
|
end
|
33
29
|
|
34
|
-
def project_name =
|
30
|
+
def project_name = settings.project_name
|
35
31
|
end
|
36
32
|
end
|
37
33
|
end
|
@@ -10,13 +10,13 @@ module Rubysmith
|
|
10
10
|
using Refinements::Struct
|
11
11
|
|
12
12
|
def call
|
13
|
-
return
|
13
|
+
return false unless settings.build_git
|
14
14
|
|
15
|
-
builder.call(
|
15
|
+
builder.call(settings.merge(template_path: "%project_name%/.gitignore.erb"))
|
16
16
|
.render
|
17
17
|
.replace(" ", "")
|
18
18
|
|
19
|
-
|
19
|
+
true
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -10,10 +10,10 @@ module Rubysmith
|
|
10
10
|
using Refinements::Struct
|
11
11
|
|
12
12
|
def call
|
13
|
-
return
|
13
|
+
return false unless settings.build_git
|
14
14
|
|
15
|
-
builder.call(
|
16
|
-
|
15
|
+
builder.call(settings.merge(template_path: "%project_name%/.git/safe")).make_path
|
16
|
+
true
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -6,10 +6,10 @@ module Rubysmith
|
|
6
6
|
# Initializes project skeleton as a Git repository.
|
7
7
|
class Setup < Abstract
|
8
8
|
def call
|
9
|
-
return
|
9
|
+
return false unless settings.build_git
|
10
10
|
|
11
|
-
builder.call(
|
12
|
-
|
11
|
+
builder.call(settings).run("git init", chdir: settings.project_name)
|
12
|
+
true
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "refinements/struct"
|
4
|
+
|
5
|
+
module Rubysmith
|
6
|
+
module Builders
|
7
|
+
module GitHub
|
8
|
+
# Builds project skeleton GitHub CI template.
|
9
|
+
class CI < Abstract
|
10
|
+
using Refinements::Struct
|
11
|
+
|
12
|
+
def call
|
13
|
+
return false unless settings.build_git_hub_ci
|
14
|
+
|
15
|
+
builder.call(with_template).render.replace(/\n\n\Z/, "\n")
|
16
|
+
true
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def with_template
|
22
|
+
settings.merge template_path: "%project_name%/.github/workflows/ci.yml.erb"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|