rubysmith 0.6.1 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/README.adoc +4 -2
  5. data/bin/rubysmith +0 -4
  6. data/lib/rubysmith.rb +4 -2
  7. data/lib/rubysmith/builder.rb +14 -30
  8. data/lib/rubysmith/builders/bundler.rb +11 -9
  9. data/lib/rubysmith/builders/console.rb +6 -8
  10. data/lib/rubysmith/builders/core.rb +7 -8
  11. data/lib/rubysmith/builders/documentation.rb +17 -22
  12. data/lib/rubysmith/builders/git/commit.rb +7 -11
  13. data/lib/rubysmith/builders/git/setup.rb +6 -8
  14. data/lib/rubysmith/builders/guard.rb +9 -9
  15. data/lib/rubysmith/builders/pragma.rb +9 -14
  16. data/lib/rubysmith/builders/rake.rb +5 -7
  17. data/lib/rubysmith/builders/reek.rb +6 -8
  18. data/lib/rubysmith/builders/rspec/context.rb +10 -11
  19. data/lib/rubysmith/builders/rspec/helper.rb +6 -8
  20. data/lib/rubysmith/builders/rubocop/formatter.rb +5 -7
  21. data/lib/rubysmith/builders/rubocop/setup.rb +7 -9
  22. data/lib/rubysmith/builders/ruby_critic.rb +25 -0
  23. data/lib/rubysmith/builders/setup.rb +8 -8
  24. data/lib/rubysmith/cli/configuration/content.rb +69 -0
  25. data/lib/rubysmith/cli/{defaults.yml → configuration/defaults.yml} +1 -0
  26. data/lib/rubysmith/cli/configuration/loader.rb +35 -0
  27. data/lib/rubysmith/cli/parsers.rb +11 -0
  28. data/lib/rubysmith/cli/parsers/assembler.rb +10 -15
  29. data/lib/rubysmith/cli/parsers/build.rb +11 -7
  30. data/lib/rubysmith/cli/parsers/core.rb +5 -9
  31. data/lib/rubysmith/cli/processors/build.rb +10 -8
  32. data/lib/rubysmith/cli/processors/config.rb +3 -7
  33. data/lib/rubysmith/cli/shell.rb +12 -18
  34. data/lib/rubysmith/identity.rb +1 -1
  35. data/lib/rubysmith/pathway.rb +3 -9
  36. data/lib/rubysmith/renderers/erb.rb +7 -9
  37. data/lib/rubysmith/renderers/namespace.rb +1 -3
  38. data/lib/rubysmith/templates/%project_name%/.rubocop.yml.erb +5 -5
  39. data/lib/rubysmith/templates/%project_name%/.rubycritic.yml.erb +3 -0
  40. data/lib/rubysmith/templates/%project_name%/CHANGES.adoc.erb +1 -1
  41. data/lib/rubysmith/templates/%project_name%/CHANGES.md.erb +1 -1
  42. data/lib/rubysmith/templates/%project_name%/CODE_OF_CONDUCT.adoc.erb +2 -2
  43. data/lib/rubysmith/templates/%project_name%/CODE_OF_CONDUCT.md.erb +1 -1
  44. data/lib/rubysmith/templates/%project_name%/Gemfile.erb +21 -16
  45. data/lib/rubysmith/templates/%project_name%/LICENSE-apache.adoc.erb +1 -1
  46. data/lib/rubysmith/templates/%project_name%/LICENSE-apache.md.erb +1 -1
  47. data/lib/rubysmith/templates/%project_name%/LICENSE-mit.adoc.erb +1 -1
  48. data/lib/rubysmith/templates/%project_name%/LICENSE-mit.md.erb +1 -1
  49. data/lib/rubysmith/templates/%project_name%/README.adoc.erb +5 -5
  50. data/lib/rubysmith/templates/%project_name%/README.md.erb +5 -5
  51. data/lib/rubysmith/templates/%project_name%/Rakefile.erb +19 -13
  52. data/lib/rubysmith/templates/%project_name%/bin/console.erb +1 -1
  53. data/lib/rubysmith/templates/%project_name%/bin/guard.erb +0 -1
  54. data/lib/rubysmith/templates/%project_name%/bin/rubocop.erb +0 -1
  55. data/lib/rubysmith/templates/%project_name%/lib/%project_name%.rb.erb +3 -0
  56. data/lib/rubysmith/templates/%project_name%/spec/spec_helper.rb.erb +8 -3
  57. data/lib/rubysmith/templates/%project_name%/spec/support/shared_contexts/temp_dir.rb.erb +4 -4
  58. metadata +28 -25
  59. metadata.gz.sig +0 -0
  60. data/lib/rubysmith/cli/configuration.rb +0 -29
  61. data/lib/rubysmith/realm.rb +0 -73
@@ -1,4 +1,4 @@
1
- Copyright <%= realm.now.strftime "%Y" %> [<%= realm.author_name %>](<%= realm.author_url %>).
1
+ Copyright <%= configuration.now.strftime "%Y" %> [<%= configuration.author_name %>](<%= configuration.author_url %>).
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -2,9 +2,9 @@
2
2
  :toclevels: 5
3
3
  :figure-caption!:
4
4
 
5
- = <%= realm.project_label %>
5
+ = <%= configuration.project_label %>
6
6
 
7
- <% if realm.build_rubocop %>
7
+ <% if configuration.build_rubocop %>
8
8
  [link=https://www.alchemists.io/projects/code_quality]
9
9
  image::https://img.shields.io/badge/code_style-alchemists-brightgreen.svg[Alchemists Style Guide]
10
10
  <% end %>
@@ -20,7 +20,7 @@ toc::[]
20
20
  . link:https://www.ruby-lang.org[Ruby].
21
21
 
22
22
  == Setup
23
- <% if realm.build_setup %>
23
+ <% if configuration.build_setup %>
24
24
 
25
25
  To set up the project, run:
26
26
 
@@ -33,7 +33,7 @@ bin/setup
33
33
  == Usage
34
34
 
35
35
  == Development
36
- <% if realm.build_console %>
36
+ <% if configuration.build_console %>
37
37
 
38
38
  You can also use the IRB console for direct access to all objects:
39
39
 
@@ -80,4 +80,4 @@ Built with link:https://www.alchemists.io/projects/rubysmith[Rubysmith].
80
80
 
81
81
  == Credits
82
82
 
83
- Engineered by link:<%= realm.author_url %>[<%= realm.author_name %>].
83
+ Engineered by link:<%= configuration.author_url %>[<%= configuration.author_name %>].
@@ -1,6 +1,6 @@
1
- # <%= realm.project_label %>
1
+ # <%= configuration.project_label %>
2
2
 
3
- <% if realm.build_rubocop %>
3
+ <% if configuration.build_rubocop %>
4
4
  [![Alchemists Style Guide](https://img.shields.io/badge/code_style-alchemists-brightgreen.svg)](https://www.alchemists.io/projects/code_quality)
5
5
  <% end %>
6
6
 
@@ -16,7 +16,7 @@
16
16
  1. [Ruby](https://www.ruby-lang.org)
17
17
 
18
18
  ## Setup
19
- <% if realm.build_setup %>
19
+ <% if configuration.build_setup %>
20
20
 
21
21
  To set up the project, run:
22
22
 
@@ -26,7 +26,7 @@ To set up the project, run:
26
26
  ## Usage
27
27
 
28
28
  ## Development
29
- <% if realm.build_console %>
29
+ <% if configuration.build_console %>
30
30
 
31
31
  You can also use the IRB console for direct access to all objects:
32
32
 
@@ -67,4 +67,4 @@ Built with [Rubysmith](https://www.alchemists.io/projects/rubysmith).
67
67
 
68
68
  ## Credits
69
69
 
70
- Engineered by [<%= realm.author_name %>](<%= realm.author_url %>).
70
+ Engineered by [<%= configuration.author_name %>](<%= configuration.author_url %>).
@@ -1,41 +1,47 @@
1
1
  require "bundler/setup"
2
2
 
3
- <% if realm.build_bundler_audit %>
3
+ <% if configuration.build_bundler_audit %>
4
4
  require "bundler/audit/task"
5
5
  <% end %>
6
- <% if realm.build_bundler_leak %>
6
+ <% if configuration.build_bundler_leak %>
7
7
  require "bundler/plumber/task"
8
8
  <% end %>
9
- <% if realm.build_git && realm.build_git_lint %>
9
+ <% if configuration.build_git && configuration.build_git_lint %>
10
10
  require "git/lint/rake/setup"
11
11
  <% end %>
12
- <% if realm.build_reek %>
12
+ <% if configuration.build_reek %>
13
13
  require "reek/rake/task"
14
14
  <% end %>
15
- <% if realm.build_rspec %>
15
+ <% if configuration.build_rspec %>
16
16
  require "rspec/core/rake_task"
17
17
  <% end %>
18
- <% if realm.build_rubocop %>
18
+ <% if configuration.build_rubocop %>
19
19
  require "rubocop/rake_task"
20
20
  <% end %>
21
+ <% if configuration.build_ruby_critic %>
22
+ require "rubycritic/rake_task"
23
+ <% end %>
21
24
 
22
- <% if realm.build_bundler_audit %>
25
+ <% if configuration.build_bundler_audit %>
23
26
  Bundler::Audit::Task.new
24
27
  <% end %>
25
- <% if realm.build_bundler_leak %>
28
+ <% if configuration.build_bundler_leak %>
26
29
  Bundler::Plumber::Task.new
27
30
  <% end %>
28
- <% if realm.build_reek %>
31
+ <% if configuration.build_reek %>
29
32
  Reek::Rake::Task.new
30
33
  <% end %>
31
- <% if realm.build_rspec %>
34
+ <% if configuration.build_rspec %>
32
35
  RSpec::Core::RakeTask.new :spec
33
36
  <% end %>
34
- <% if realm.build_rubocop %>
37
+ <% if configuration.build_rubocop %>
35
38
  RuboCop::RakeTask.new
36
39
  <% end %>
40
+ <% if configuration.build_ruby_critic %>
41
+ RubyCritic::RakeTask.new
42
+ <% end %>
37
43
 
38
44
  desc "Run code quality checks"
39
- task code_quality: %i[<% if realm.build_bundler_audit %>bundle:audit<% end %> <% if realm.build_bundler_leak %>bundle:leak<% end %> <% if realm.build_git && realm.build_git_lint %>git_lint<% end %> <% if realm.build_reek %>reek<% end %> <% if realm.build_rubocop %>rubocop<% end %>]
45
+ task code_quality: %i[<% if configuration.build_bundler_audit %>bundle:audit<% end %> <% if configuration.build_bundler_leak %>bundle:leak<% end %> <% if configuration.build_git && configuration.build_git_lint %>git_lint<% end %> <% if configuration.build_reek %>reek<% end %> <% if configuration.build_rubocop %>rubocop<% end %> <% if configuration.build_ruby_critic %>rubycritic<% end %>]
40
46
 
41
- task default: %i[code_quality <% if realm.build_rspec %>spec<% end %>]
47
+ task default: %i[code_quality <% if configuration.build_rspec %>spec<% end %>]
@@ -3,7 +3,7 @@
3
3
  require "bundler/setup"
4
4
  Bundler.require :tools
5
5
 
6
- require_relative "../lib/<%= realm.project_name %>"
6
+ require_relative "../lib/<%= configuration.project_name %>"
7
7
  require "irb"
8
8
 
9
9
  IRB.start __FILE__
@@ -1,6 +1,5 @@
1
1
  #! /usr/bin/env ruby
2
2
 
3
- require "rubygems"
4
3
  require "bundler/setup"
5
4
 
6
5
  load Gem.bin_path "guard", "guard"
@@ -1,7 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- require "rubygems"
5
4
  require "bundler/setup"
6
5
 
7
6
  load Gem.bin_path "rubocop", "rubocop"
@@ -0,0 +1,3 @@
1
+ # The project namespace.
2
+ module <%= configuration.project_class %>
3
+ end
@@ -1,15 +1,20 @@
1
1
  require "bundler/setup"
2
2
  Bundler.require :tools
3
3
 
4
- <% if realm.build_simple_cov %>
4
+ <% if configuration.build_simple_cov %>
5
5
  require "simplecov"
6
6
  SimpleCov.start { enable_coverage :branch }
7
7
  <% end %>
8
8
 
9
- require "<%= realm.project_name %>"
10
- <% if realm.build_refinements %>
9
+ require "<%= configuration.project_name %>"
10
+ <% if configuration.build_refinements %>
11
11
  require "refinements"
12
+ <% end %>
13
+
14
+ GC.auto_compact = true
15
+ GC.verify_compaction_references double_heap: true, toward: :empty
12
16
 
17
+ <% if configuration.build_refinements %>
13
18
  using Refinements::Pathnames
14
19
 
15
20
  Pathname.require_tree __dir__, "support/shared_contexts/**/*.rb"
@@ -1,11 +1,11 @@
1
- RSpec.shared_context "with temporary directory", :temp_dir do
2
- <% if realm.build_refinements %>using Refinements::Pathnames<% end %>
1
+ RSpec.shared_context "with temporary directory" do
2
+ <% if configuration.build_refinements %>using Refinements::Pathnames<% end %>
3
3
 
4
4
  let(:temp_dir) { Bundler.root.join "tmp/rspec" }
5
5
 
6
6
  around do |example|
7
- <%= realm.build_refinements ? "temp_dir.make_path" : "FileUtils.mkdir_p temp_dir" %>
7
+ <%= configuration.build_refinements ? "temp_dir.make_path" : "FileUtils.mkdir_p temp_dir" %>
8
8
  example.run
9
- <%= realm.build_refinements ? "temp_dir.remove_tree" : "FileUtils.rm_rf temp_dir" %>
9
+ <%= configuration.build_refinements ? "temp_dir.remove_tree" : "FileUtils.rm_rf temp_dir" %>
10
10
  end
11
11
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubysmith
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -10,9 +10,9 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIC/jCCAeagAwIBAgIBAzANBgkqhkiG9w0BAQsFADAlMSMwIQYDVQQDDBpicm9v
14
- a2UvREM9YWxjaGVtaXN0cy9EQz1pbzAeFw0yMDAzMTUxNDQ1MzJaFw0yMTAzMTUx
15
- NDQ1MzJaMCUxIzAhBgNVBAMMGmJyb29rZS9EQz1hbGNoZW1pc3RzL0RDPWlvMIIB
13
+ MIIC/jCCAeagAwIBAgIBBDANBgkqhkiG9w0BAQsFADAlMSMwIQYDVQQDDBpicm9v
14
+ a2UvREM9YWxjaGVtaXN0cy9EQz1pbzAeFw0yMTAzMTkxMjQ4MDZaFw0yMjAzMTkx
15
+ MjQ4MDZaMCUxIzAhBgNVBAMMGmJyb29rZS9EQz1hbGNoZW1pc3RzL0RDPWlvMIIB
16
16
  IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6l1qpXTiomH1RfMRloyw7MiE
17
17
  xyVx/x8Yc3EupdH7uhNaTXQGyORN6aOY//1QXXMHIZ9tW74nZLhesWMSUMYy0XhB
18
18
  brs+KkurHnc9FnEJAbG7ebGvl/ncqZt72nQvaxpDxvuCBHgJAz+8i5wl6FhLw+oT
@@ -20,15 +20,15 @@ cert_chain:
20
20
  D5vkU0YlAm1r98BymuJlcQ1qdkVEI1d48ph4kcS0S0nv1RiuyVb6TCAR3Nu3VaVq
21
21
  3fPzZKJLZBx67UvXdbdicWPiUR75elI4PXpLIic3xytaF52ZJYyKZCNZJhNwfQID
22
22
  AQABozkwNzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU0nzow9vc
23
- 2CdikiiE3fJhP/gY4ggwDQYJKoZIhvcNAQELBQADggEBAIHhAlD3po4sTYqacXaQ
24
- XI9jIhrfMy//2PgbHWcETtlJPBeNUbbSNBABcllUHKqYsVDlSvSmss034KSWNR8F
25
- bF1GcloicyvcCC4y6IoW4it0COAcdeaaxkxiBSgKdQFpff9REnDlIKK4uQ9lLxIo
26
- Y2G5xubiziKZkyfWFuSr67PIjW3Bu673D1JVBArhA1qbgQmYQcy1CkGOjo+iO8Nf
27
- 7u/QSfBHb+r/bXhKscDgPpnKwbUmvgO2+94zJG9KsrmIydlzYfsD09aXKx0t6Xy4
28
- 2XV8FRa7/JimI07sPLC13eLY3xd/aYTi85Z782KIA4j0G8XEEWAX0ouBhlXPocZv
29
- QWc=
23
+ 2CdikiiE3fJhP/gY4ggwDQYJKoZIhvcNAQELBQADggEBAEjpaOXHHp8s/7GL2qCb
24
+ YAs7urOLv9VHSPfQWAwaTMVnSsIf3Sw4xzISOP/mmfEPBPXtz61K5esrE/uTFtgb
25
+ FyjxQk2H0sEWgrRXGGNHBWQRhhEs7LP/TByoC15A0br++xLxRz4r7HBLGAWQQDpg
26
+ 66BJ2TBVjxS6K64tKbq7+ACyrOZGgTfNHACh4M076y0x0oRf/rwBrU39/KRfuhbb
27
+ cm+nNCEtO35gTmZ2bVDHLGvWazi3gJt6+huQjfXTCUUG2YYBxwhu+GPdAGQPxpf9
28
+ lkHilIrX69jq8wMPpBhlaw2mRmeSL50Wv5u6xVBvOHhXFSP1crXM95vfLhLyRYod
29
+ W2A=
30
30
  -----END CERTIFICATE-----
31
- date: 2020-12-11 00:00:00.000000000 Z
31
+ date: 2021-04-18 00:00:00.000000000 Z
32
32
  dependencies:
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: pragmater
@@ -36,56 +36,56 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '8.1'
39
+ version: '9.0'
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '8.1'
46
+ version: '9.0'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: refinements
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '7.16'
53
+ version: '8.0'
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '7.16'
60
+ version: '8.0'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: rubocop
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '1.5'
67
+ version: '1.10'
68
68
  type: :runtime
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: '1.5'
74
+ version: '1.10'
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: runcom
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: '6.4'
81
+ version: '7.0'
82
82
  type: :runtime
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: '6.4'
88
+ version: '7.0'
89
89
  description:
90
90
  email:
91
91
  - brooke@alchemists.io
@@ -115,9 +115,12 @@ files:
115
115
  - lib/rubysmith/builders/rspec/helper.rb
116
116
  - lib/rubysmith/builders/rubocop/formatter.rb
117
117
  - lib/rubysmith/builders/rubocop/setup.rb
118
+ - lib/rubysmith/builders/ruby_critic.rb
118
119
  - lib/rubysmith/builders/setup.rb
119
- - lib/rubysmith/cli/configuration.rb
120
- - lib/rubysmith/cli/defaults.yml
120
+ - lib/rubysmith/cli/configuration/content.rb
121
+ - lib/rubysmith/cli/configuration/defaults.yml
122
+ - lib/rubysmith/cli/configuration/loader.rb
123
+ - lib/rubysmith/cli/parsers.rb
121
124
  - lib/rubysmith/cli/parsers/assembler.rb
122
125
  - lib/rubysmith/cli/parsers/build.rb
123
126
  - lib/rubysmith/cli/parsers/core.rb
@@ -126,12 +129,12 @@ files:
126
129
  - lib/rubysmith/cli/shell.rb
127
130
  - lib/rubysmith/identity.rb
128
131
  - lib/rubysmith/pathway.rb
129
- - lib/rubysmith/realm.rb
130
132
  - lib/rubysmith/renderers/erb.rb
131
133
  - lib/rubysmith/renderers/namespace.rb
132
134
  - lib/rubysmith/templates/%project_name%/.reek.yml.erb
133
135
  - lib/rubysmith/templates/%project_name%/.rubocop.yml.erb
134
136
  - lib/rubysmith/templates/%project_name%/.ruby-version.erb
137
+ - lib/rubysmith/templates/%project_name%/.rubycritic.yml.erb
135
138
  - lib/rubysmith/templates/%project_name%/CHANGES.adoc.erb
136
139
  - lib/rubysmith/templates/%project_name%/CHANGES.md.erb
137
140
  - lib/rubysmith/templates/%project_name%/CODE_OF_CONDUCT.adoc.erb
@@ -171,14 +174,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
171
174
  requirements:
172
175
  - - "~>"
173
176
  - !ruby/object:Gem::Version
174
- version: '2.7'
177
+ version: '3.0'
175
178
  required_rubygems_version: !ruby/object:Gem::Requirement
176
179
  requirements:
177
180
  - - ">="
178
181
  - !ruby/object:Gem::Version
179
182
  version: '0'
180
183
  requirements: []
181
- rubygems_version: 3.2.0
184
+ rubygems_version: 3.2.16
182
185
  signing_key:
183
186
  specification_version: 4
184
187
  summary: A command line interface for smithing Ruby projects.
metadata.gz.sig CHANGED
Binary file
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "yaml"
4
- require "refinements/hashes"
5
- require "runcom"
6
-
7
- module Rubysmith
8
- module CLI
9
- # Represents the fully assembled Command Line Interface (CLI) configuration.
10
- class Configuration
11
- using Refinements::Hashes
12
-
13
- DEFAULTS = YAML.load_file(Pathname(__dir__).join("defaults.yml")).freeze
14
- CLIENT = Runcom::Config.new "#{Identity::NAME}/configuration.yml", defaults: DEFAULTS
15
-
16
- def initialize client: CLIENT
17
- @client = client
18
- end
19
-
20
- def to_h
21
- client.to_h.flatten_keys
22
- end
23
-
24
- private
25
-
26
- attr_reader :client
27
- end
28
- end
29
- end
@@ -1,73 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "pathname"
4
- require "refinements/strings"
5
-
6
- module Rubysmith
7
- REALM_KEYS = %i[
8
- config
9
- template_root
10
- template_path
11
- build_root
12
- project_name
13
- author_name
14
- author_email
15
- author_url
16
- now
17
- documentation_format
18
- documentation_license
19
- build_minimum
20
- build_amazing_print
21
- build_bundler_audit
22
- build_bundler_leak
23
- build_console
24
- build_documentation
25
- build_git
26
- build_git_lint
27
- build_guard
28
- build_pry
29
- build_reek
30
- build_refinements
31
- build_rspec
32
- build_rubocop
33
- build_setup
34
- build_simple_cov
35
- builders_pragmater_comments
36
- builders_pragmater_includes
37
- version
38
- help
39
- ].freeze
40
-
41
- # Represents the common context in which all builders and templates operate in.
42
- Realm = Struct.new(*REALM_KEYS, keyword_init: true) do
43
- using Refinements::Strings
44
-
45
- def initialize *arguments
46
- super
47
-
48
- self[:template_root] ||= Pathname(__dir__).join("templates").expand_path
49
- self[:build_root] ||= Pathname.pwd
50
- freeze
51
- end
52
-
53
- def with attributes
54
- self.class.new to_h.merge(attributes)
55
- end
56
-
57
- def project_label
58
- project_name.titleize
59
- end
60
-
61
- def project_class
62
- project_name.camelcase
63
- end
64
-
65
- def project_root
66
- build_root.join project_name
67
- end
68
-
69
- def to_pathway
70
- Pathway[start_root: template_root, start_path: template_path, end_root: build_root]
71
- end
72
- end
73
- end