rubysmith 6.10.0 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/README.adoc +46 -57
  4. data/lib/rubysmith/builder.rb +9 -9
  5. data/lib/rubysmith/builders/abstract.rb +4 -4
  6. data/lib/rubysmith/builders/bundler.rb +2 -2
  7. data/lib/rubysmith/builders/caliber.rb +4 -4
  8. data/lib/rubysmith/builders/circle_ci.rb +3 -3
  9. data/lib/rubysmith/builders/console.rb +3 -3
  10. data/lib/rubysmith/builders/core.rb +6 -6
  11. data/lib/rubysmith/builders/documentation/citation.rb +3 -3
  12. data/lib/rubysmith/builders/documentation/license.rb +8 -9
  13. data/lib/rubysmith/builders/documentation/readme.rb +4 -4
  14. data/lib/rubysmith/builders/documentation/version.rb +4 -5
  15. data/lib/rubysmith/builders/git/commit.rb +4 -8
  16. data/lib/rubysmith/builders/git/ignore.rb +3 -3
  17. data/lib/rubysmith/builders/git/safe.rb +3 -3
  18. data/lib/rubysmith/builders/git/setup.rb +3 -3
  19. data/lib/rubysmith/builders/git_hub/ci.rb +27 -0
  20. data/lib/rubysmith/builders/git_hub/funding.rb +23 -0
  21. data/lib/rubysmith/builders/git_hub/template.rb +32 -0
  22. data/lib/rubysmith/builders/guard.rb +4 -4
  23. data/lib/rubysmith/builders/init.rb +2 -2
  24. data/lib/rubysmith/builders/rake/binstub.rb +24 -0
  25. data/lib/rubysmith/builders/rake/configuration.rb +29 -0
  26. data/lib/rubysmith/builders/reek.rb +3 -3
  27. data/lib/rubysmith/builders/rspec/binstub.rb +3 -3
  28. data/lib/rubysmith/builders/rspec/context.rb +6 -6
  29. data/lib/rubysmith/builders/rspec/helper.rb +3 -3
  30. data/lib/rubysmith/builders/setup.rb +3 -3
  31. data/lib/rubysmith/builders/version.rb +2 -2
  32. data/lib/rubysmith/cli/actions/amazing_print.rb +3 -3
  33. data/lib/rubysmith/cli/actions/caliber.rb +3 -3
  34. data/lib/rubysmith/cli/actions/circle_ci.rb +4 -4
  35. data/lib/rubysmith/cli/actions/citation.rb +3 -3
  36. data/lib/rubysmith/cli/actions/community.rb +3 -3
  37. data/lib/rubysmith/cli/actions/conduct.rb +3 -3
  38. data/lib/rubysmith/cli/actions/console.rb +3 -3
  39. data/lib/rubysmith/cli/actions/contributions.rb +3 -3
  40. data/lib/rubysmith/cli/actions/debug.rb +3 -3
  41. data/lib/rubysmith/cli/actions/funding.rb +4 -4
  42. data/lib/rubysmith/cli/actions/git.rb +3 -3
  43. data/lib/rubysmith/cli/actions/git_hub.rb +3 -3
  44. data/lib/rubysmith/cli/actions/git_hub_ci.rb +3 -3
  45. data/lib/rubysmith/cli/actions/git_lint.rb +3 -3
  46. data/lib/rubysmith/cli/actions/guard.rb +3 -3
  47. data/lib/rubysmith/cli/actions/irb_kit.rb +3 -3
  48. data/lib/rubysmith/cli/actions/license.rb +3 -3
  49. data/lib/rubysmith/cli/actions/maximum.rb +4 -4
  50. data/lib/rubysmith/cli/actions/minimum.rb +4 -4
  51. data/lib/rubysmith/cli/actions/name.rb +2 -2
  52. data/lib/rubysmith/cli/actions/rake.rb +3 -3
  53. data/lib/rubysmith/cli/actions/readme.rb +3 -3
  54. data/lib/rubysmith/cli/actions/reek.rb +3 -3
  55. data/lib/rubysmith/cli/actions/refinements.rb +3 -3
  56. data/lib/rubysmith/cli/actions/rspec.rb +3 -3
  57. data/lib/rubysmith/cli/actions/rtc.rb +3 -3
  58. data/lib/rubysmith/cli/actions/security.rb +3 -3
  59. data/lib/rubysmith/cli/actions/setup.rb +3 -3
  60. data/lib/rubysmith/cli/actions/simple_cov.rb +3 -3
  61. data/lib/rubysmith/cli/actions/versions.rb +3 -3
  62. data/lib/rubysmith/cli/actions/zeitwerk.rb +3 -3
  63. data/lib/rubysmith/cli/commands/build.rb +33 -31
  64. data/lib/rubysmith/cli/shell.rb +0 -1
  65. data/lib/rubysmith/configuration/contract.rb +16 -14
  66. data/lib/rubysmith/configuration/defaults.yml +21 -1
  67. data/lib/rubysmith/configuration/model.rb +30 -28
  68. data/lib/rubysmith/configuration/transformers/git_hub_user.rb +2 -2
  69. data/lib/rubysmith/container.rb +19 -9
  70. data/lib/rubysmith/extensions/bundler.rb +7 -7
  71. data/lib/rubysmith/extensions/pragmater.rb +10 -10
  72. data/lib/rubysmith/extensions/rubocop.rb +7 -7
  73. data/lib/rubysmith/extensions/tocer.rb +8 -8
  74. data/lib/rubysmith/renderers/erb.rb +4 -4
  75. data/lib/rubysmith/templates/%project_name%/.circleci/config.yml.erb +1 -1
  76. data/lib/rubysmith/templates/%project_name%/.github/FUNDING.yml.erb +1 -1
  77. data/lib/rubysmith/templates/%project_name%/.github/workflows/ci.yml.erb +1 -1
  78. data/lib/rubysmith/templates/%project_name%/CITATION.cff.erb +12 -12
  79. data/lib/rubysmith/templates/%project_name%/Gemfile.erb +18 -18
  80. data/lib/rubysmith/templates/%project_name%/LICENSE-apache.adoc.erb +1 -1
  81. data/lib/rubysmith/templates/%project_name%/LICENSE-apache.md.erb +1 -1
  82. data/lib/rubysmith/templates/%project_name%/LICENSE-mit.adoc.erb +1 -1
  83. data/lib/rubysmith/templates/%project_name%/LICENSE-mit.md.erb +1 -1
  84. data/lib/rubysmith/templates/%project_name%/README.adoc.erb +21 -21
  85. data/lib/rubysmith/templates/%project_name%/README.md.erb +21 -21
  86. data/lib/rubysmith/templates/%project_name%/Rakefile.erb +10 -10
  87. data/lib/rubysmith/templates/%project_name%/VERSIONS.adoc.erb +1 -1
  88. data/lib/rubysmith/templates/%project_name%/VERSIONS.md.erb +1 -1
  89. data/lib/rubysmith/templates/%project_name%/bin/console.erb +1 -1
  90. data/lib/rubysmith/templates/%project_name%/bin/setup.erb +1 -1
  91. data/lib/rubysmith/templates/%project_name%/lib/%project_path%.rb.erb +7 -7
  92. data/lib/rubysmith/templates/%project_name%/spec/lib/%project_path%_spec.rb.erb +2 -2
  93. data/lib/rubysmith/templates/%project_name%/spec/spec_helper.rb.erb +4 -4
  94. data/lib/rubysmith/templates/%project_name%/spec/support/shared_contexts/temp_dir.rb.erb +3 -3
  95. data/lib/rubysmith.rb +1 -0
  96. data/rubysmith.gemspec +11 -12
  97. data.tar.gz.sig +0 -0
  98. metadata +28 -43
  99. metadata.gz.sig +4 -2
  100. data/lib/rubysmith/builders/git_hub.rb +0 -39
  101. data/lib/rubysmith/builders/git_hub_ci.rb +0 -25
  102. data/lib/rubysmith/builders/rake.rb +0 -39
  103. data/lib/rubysmith/cli/actions/publish.rb +0 -35
  104. data/lib/rubysmith/configuration/transformers/target_root.rb +0 -18
  105. data/lib/rubysmith/extensions/milestoner.rb +0 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ed5911cc50ea1b09a9084b3978e8c52b0ac912fa12a3cd588653ed485a48df40
4
- data.tar.gz: 92f240e6c4f43ca45361f83273436f15d0554552c47270d1adb53178e8a396b5
3
+ metadata.gz: 3ba99960f8d5238ff9f23bc08b866c1d2e808bb7704f2d745b28254ecda1aaab
4
+ data.tar.gz: 420ef6ebfc7751d9aa490a2abbe2a24fe09206ef5a4735da6e9f3bb4aaf673b1
5
5
  SHA512:
6
- metadata.gz: 38057a03922b7aff2554ec616ca93d8e1ca5104eb36e802c6ffa9fd266c7a2f4c8f1dd351deecd5b144452cce825abcd643351d9e44c31960f07ffdf4ba76d35
7
- data.tar.gz: 937fa75a994a09541e041a4c163fc90613652909c2db285629862dd37398b249be2dffe71c62fa0d54485f04e4c488157886a366919179869cedd0b0f87ae626
6
+ metadata.gz: 53f5f436d69f6218b4eaee550f844fab11c1667666d6bbf19ad01b3ab463fcfcbc0d8e3bd36f2da0e6c384ddea2f1e585311ce3706c87a30246b14a1508af493
7
+ data.tar.gz: 69d5ece05c1d3017d01d615dbd4c7efca795dfd863c8ba1149e0057d978095665c8d14f1f877e8c60d35bc2d4279265f5619cee06807e1d7a7b7936e752ec2da
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
 
@@ -77,7 +78,7 @@ gem install rubysmith
77
78
 
78
79
  From the command line, type: `rubysmith --help`
79
80
 
80
- image:https://alchemists.io/images/projects/rubysmith/screenshots/usage.png[Usage,width=604,height=345,role=focal_point]
81
+ image:https://alchemists.io/images/projects/rubysmith/screenshots/usage.png[Usage,width=554,height=301,role=focal_point]
81
82
 
82
83
  ==== Build
83
84
 
@@ -279,21 +280,6 @@ The `--zeitwerk` option allows you add the link:https://github.com/fxn/zeitwerk[
279
280
 
280
281
  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
282
 
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
283
  === Configuration
298
284
 
299
285
  This gem can be configured via a global configuration:
@@ -308,10 +294,8 @@ variables. The default configuration is as follows:
308
294
  [source,yaml]
309
295
  ----
310
296
  author:
311
- email:
312
- family_name:
313
- given_name:
314
- url:
297
+ handle: undefined
298
+ uri: "%<organization_uri>s/team/%<author_handle>s"
315
299
  build:
316
300
  amazing_print: true
317
301
  caliber: true
@@ -329,7 +313,7 @@ build:
329
313
  git_hub_ci: false
330
314
  git_lint: true
331
315
  guard: true
332
- irb_kit: false
316
+ irb_kit: true
333
317
  license: true
334
318
  maximum: false
335
319
  minimum: false
@@ -345,64 +329,69 @@ build:
345
329
  versions: true
346
330
  zeitwerk: true
347
331
  citation:
348
- affiliation:
349
332
  message: Please use the following metadata when citing this project in your work.
350
- orcid:
351
333
  documentation:
352
334
  format: "adoc"
353
- git_hub:
354
- user:
355
335
  license:
356
336
  label: Hippocratic
357
337
  name: hippocratic
358
338
  version: "2.1"
359
339
  organization:
360
- url:
340
+ uri: https://undefined.io
361
341
  project:
362
- url:
363
- community:
364
- conduct:
365
- contributions:
366
- download:
367
- funding:
368
- home:
369
- issues:
370
- license:
371
- security:
372
- source:
373
- versions:
342
+ uri:
343
+ community: "%<organization_uri>s/community"
344
+ conduct: "%<organization_uri>s/policies/code_of_conduct"
345
+ contributions: "%<organization_uri>s/policies/contributions"
346
+ download: "https://rubygems.org/gems/%<project_name>s"
347
+ funding: "%<repository_uri>s/sponsors/%<repository_handle>s"
348
+ home: "%<organization_uri>s/projects/%<project_name>s"
349
+ issues: "%<repository_uri>s/%<repository_handle>s/%<project_name>s/issues"
350
+ license: "%<organization_uri>s/policies/license"
351
+ security: "%<organization_uri>s/policies/security"
352
+ source: "%<repository_uri>s/%<repository_handle>s/%<project_name>s"
353
+ versions: "%<organization_uri>s/projects/%<project_name>s/versions"
374
354
  version: 0.0.0
355
+ repository:
356
+ handle: undefined
357
+ uri: https://github.com
375
358
  ----
376
359
 
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. The next sections will walk you through each configuration so you can learn more.
360
+ 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
+
362
+ 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.
363
+
364
+ The next sections will walk you through each configuration so you can learn more.
378
365
 
379
366
  ==== Author
380
367
 
381
368
  Author information is used when generating project documentation and is recommended you fill this
382
369
  information in before building a project. Example:
383
370
 
384
- author:
385
- email: jsmith@example.com
386
- family_name: Smith
387
- given_name: Jill
388
- url: https://www.exmaple.com/team/jsmith
371
+ [source,yaml]
372
+ ----
373
+ author:
374
+ email: jsmith@example.com
375
+ family_name: Smith
376
+ given_name: Jill
377
+ ----
389
378
 
390
379
  If your global link:https://git-scm.com[Git] configuration is properly configured, your given name;
391
380
  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 URL is the only value that can't be automatically computed for you.
381
+ custom values as desired. The URI is the only value that can't be automatically computed for you.
393
382
 
394
383
  ==== Build
395
384
 
396
385
  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
386
 
398
- ℹ️ The `cli` option is provided to support the {gemsmith_link} gem but is not, currently, used by
387
+ ℹ️ The `cli` option is provided to support {gemsmith_link} but is not, currently, used by
399
388
  this project.
400
389
 
401
390
  ==== Citations
402
391
 
403
392
  This section allows you to configure your link:https://orcid.org[ORCID]
404
393
  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 as well.
394
+ You should definitely fill this in. Your author information, detailed above, will also be used when building this file.
406
395
 
407
396
  ==== Documentation
408
397
 
@@ -412,10 +401,6 @@ following options are available:
412
401
  * `adoc` - Uses link:https://asciidoctor.org[ASCII Doc] format.
413
402
  * `md` - Uses link:https://asciidoctor.org[Markdown] format.
414
403
 
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
404
  ==== License
420
405
 
421
406
  Use this section to define the license you want to use for your project. The following are available:
@@ -428,20 +413,20 @@ When picking a license, you can also supply the appropriate label and version in
428
413
 
429
414
  ==== Organization
430
415
 
431
- Use this section to define URL 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 URL especially for documentation purposes.
416
+ 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
417
 
433
418
  ==== Project
434
419
 
435
- There are two sub-categories within this section: URLs and version. The URLs allow you to link to
436
- specific documentation related to your project. You'll want to customize these URLs since they are
437
- used for documentation, citations, and general project information. Some of the URLs are also used
420
+ There are two sub-categories within this section: URIs and version. The URIs allow you to link to
421
+ specific documentation related to your project. You'll want to customize these URIs since they are
422
+ used for documentation, citations, and general project information. Some of the URIs are also used
438
423
  by the {gemsmith_link} gem.
439
424
 
440
- One powerful feature of this configuration is that you can use `%project_name%` as a placeholder _anywhere_ in your URLs and Rubysmith will ensure your place holder is replaced with your project name when generating a new project. Example:
425
+ 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
426
 
442
427
  ....
443
428
  # Configuration
444
- https://www.example.com/%project_name%
429
+ https://www.example.com/%<project_name>s
445
430
 
446
431
  # Command
447
432
  rubysmith build --name demo
@@ -452,6 +437,10 @@ https://www.example.com/demo
452
437
 
453
438
  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
439
 
440
+ ==== Repository
441
+
442
+ 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.
443
+
455
444
  == Development
456
445
 
457
446
  To contribute, run:
@@ -15,10 +15,10 @@ module Rubysmith
15
15
 
16
16
  def self.call(...) = new(...)
17
17
 
18
- def initialize(configuration, helpers: HELPERS, **)
19
- super(**)
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 :configuration, :helpers
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(configuration)
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(configuration.target_root)
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%", configuration.project_name)
129
- .sub("%project_path%", configuration.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 = configuration.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
- def self.call(...) = new(...).call
7
+ include Import[:settings]
8
8
 
9
- def initialize configuration, builder: Builder
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 :configuration, :builder
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(configuration.merge(template_path: "%project_name%/Gemfile.erb"))
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
- configuration
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 configuration unless configuration.build_caliber
12
+ return false unless settings.build_caliber
13
13
 
14
- builder.call(configuration.merge(template_path: "%project_name%/bin/rubocop.erb"))
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(configuration.merge(template_path: path)).render
20
- configuration
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 configuration unless configuration.build_circle_ci
12
+ return false unless settings.build_circle_ci
13
13
 
14
- builder.call(configuration.merge(template_path: "%project_name%/.circleci/config.yml.erb"))
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
- configuration
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 configuration unless configuration.build_console
12
+ return false unless settings.build_console
13
13
 
14
- builder.call(configuration.merge(template_path: "%project_name%/bin/console.erb"))
14
+ builder.call(settings.merge(template_path: "%project_name%/bin/console.erb"))
15
15
  .render
16
16
  .permit 0o755
17
17
 
18
- configuration
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
- configuration
16
+ true
17
17
  end
18
18
 
19
19
  private
20
20
 
21
21
  def render_implementation
22
- builder.call(configuration.merge(template_path: "%project_name%/lib/%project_path%.rb.erb"))
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 configuration.build_zeitwerk
31
+ return unless settings.build_zeitwerk
32
32
 
33
33
  path = "%project_name%/spec/lib/%project_path%_spec.rb.erb"
34
- builder.call(configuration.merge(template_path: path)).render
34
+ builder.call(settings.merge(template_path: path)).render
35
35
  end
36
36
 
37
- def indentation = ::Core::EMPTY_STRING.indent configuration.project_levels
37
+ def indentation = ::Core::EMPTY_STRING.indent settings.project_levels
38
38
 
39
- def module_name = configuration.project_class
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 configuration unless configuration.build_citation
13
+ return false unless settings.build_citation
14
14
 
15
- builder.call(configuration.merge(template_path: "%project_name%/CITATION.cff.erb")).render
16
- configuration
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 configuration unless configuration.build_license
13
+ return false unless settings.build_license
15
14
 
16
- configuration.merge(template_path: "%project_name%/LICENSE-#{license}.#{kind}.erb")
17
- .then do |updated_configuration|
18
- builder.call(updated_configuration).render.rename "LICENSE.#{kind}"
19
- end
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
- configuration
20
+ true
22
21
  end
23
22
 
24
23
  private
25
24
 
26
- def kind = configuration.documentation_format
25
+ def kind = settings.documentation_format
27
26
 
28
- def license = configuration.license_name
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 configuration unless configuration.build_readme
13
+ return false unless settings.build_readme
14
14
 
15
- builder.call(configuration.merge(template_path: "%project_name%/README.#{kind}.erb"))
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
- configuration
20
+ true
21
21
  end
22
22
 
23
23
  protected
24
24
 
25
- def kind = configuration.documentation_format
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 configuration unless configuration.build_versions
14
+ return false unless settings.build_versions
15
15
 
16
- builder.call(configuration.merge(template_path: "%project_name%/VERSIONS.#{kind}.erb"))
17
- .render
16
+ builder.call(settings.merge(template_path: "%project_name%/VERSIONS.#{kind}.erb")).render
18
17
 
19
- configuration
18
+ true
20
19
  end
21
20
 
22
21
  private
23
22
 
24
- def kind = configuration.documentation_format
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 configuration unless configuration.build_git
11
+ return false unless settings.build_git
16
12
 
17
- builder.call(configuration)
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
- configuration
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 = configuration.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 configuration unless configuration.build_git
13
+ return false unless settings.build_git
14
14
 
15
- builder.call(configuration.merge(template_path: "%project_name%/.gitignore.erb"))
15
+ builder.call(settings.merge(template_path: "%project_name%/.gitignore.erb"))
16
16
  .render
17
17
  .replace(" ", "")
18
18
 
19
- configuration
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 configuration unless configuration.build_git
13
+ return false unless settings.build_git
14
14
 
15
- builder.call(configuration.merge(template_path: "%project_name%/.git/safe")).make_path
16
- configuration
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 configuration unless configuration.build_git
9
+ return false unless settings.build_git
10
10
 
11
- builder.call(configuration).run("git init", chdir: configuration.project_name)
12
- configuration
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
@@ -0,0 +1,23 @@
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 funding template.
9
+ class Funding < Abstract
10
+ using Refinements::Struct
11
+
12
+ def call
13
+ return false unless settings.build_git_hub && settings.build_funding
14
+
15
+ settings.merge(template_path: "%project_name%/.github/FUNDING.yml.erb")
16
+ .then { |updated_configuration| builder.call(updated_configuration).render }
17
+
18
+ true
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end