rubysmith 0.16.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/LICENSE.adoc +207 -155
  4. data/README.adoc +340 -94
  5. data/lib/rubysmith/builder.rb +1 -2
  6. data/lib/rubysmith/builders/bundler.rb +7 -11
  7. data/lib/rubysmith/builders/circle_ci.rb +8 -2
  8. data/lib/rubysmith/builders/console.rb +8 -2
  9. data/lib/rubysmith/builders/core.rb +7 -3
  10. data/lib/rubysmith/builders/documentation/{change.rb → citation.rb} +8 -8
  11. data/lib/rubysmith/builders/documentation/license.rb +9 -4
  12. data/lib/rubysmith/builders/documentation/readme.rb +12 -18
  13. data/lib/rubysmith/builders/documentation/{contribution.rb → version.rb} +10 -5
  14. data/lib/rubysmith/builders/git/commit.rb +3 -1
  15. data/lib/rubysmith/builders/git/setup.rb +2 -1
  16. data/lib/rubysmith/builders/git_hub.rb +8 -3
  17. data/lib/rubysmith/builders/guard.rb +9 -3
  18. data/lib/rubysmith/builders/rake.rb +8 -3
  19. data/lib/rubysmith/builders/reek.rb +7 -2
  20. data/lib/rubysmith/builders/rspec/context.rb +8 -2
  21. data/lib/rubysmith/builders/rspec/helper.rb +8 -2
  22. data/lib/rubysmith/builders/rubocop.rb +34 -0
  23. data/lib/rubysmith/builders/setup.rb +8 -2
  24. data/lib/rubysmith/cli/actions/build.rb +10 -12
  25. data/lib/rubysmith/cli/actions/config.rb +4 -2
  26. data/lib/rubysmith/cli/actions/publish.rb +21 -0
  27. data/lib/rubysmith/cli/parser.rb +31 -0
  28. data/lib/rubysmith/cli/parsers/build.rb +80 -45
  29. data/lib/rubysmith/cli/parsers/core.rb +14 -10
  30. data/lib/rubysmith/cli/shell.rb +22 -15
  31. data/lib/rubysmith/configuration/content.rb +170 -0
  32. data/lib/rubysmith/configuration/defaults.yml +88 -0
  33. data/lib/rubysmith/configuration/enhancers/current_time.rb +24 -0
  34. data/lib/rubysmith/configuration/enhancers/git_email.rb +31 -0
  35. data/lib/rubysmith/configuration/enhancers/git_hub_user.rb +31 -0
  36. data/lib/rubysmith/configuration/enhancers/git_user.rb +33 -0
  37. data/lib/rubysmith/configuration/loader.rb +48 -0
  38. data/lib/rubysmith/container.rb +1 -1
  39. data/lib/rubysmith/extensions/bundler.rb +30 -0
  40. data/lib/rubysmith/extensions/milestoner.rb +35 -0
  41. data/lib/rubysmith/extensions/pragmater.rb +35 -0
  42. data/lib/rubysmith/extensions/rubocop.rb +29 -0
  43. data/lib/rubysmith/extensions/tocer.rb +37 -0
  44. data/lib/rubysmith/identity.rb +1 -1
  45. data/lib/rubysmith/templates/%project_name%/.github/ISSUE_TEMPLATE.md.erb +1 -4
  46. data/lib/rubysmith/templates/%project_name%/.rubocop.yml.erb +2 -0
  47. data/lib/rubysmith/templates/%project_name%/CITATION.cff.erb +16 -0
  48. data/lib/rubysmith/templates/%project_name%/Gemfile.erb +12 -9
  49. data/lib/rubysmith/templates/%project_name%/LICENSE-hippocratic.adoc.erb +214 -0
  50. data/lib/rubysmith/templates/%project_name%/LICENSE-hippocratic.md.erb +214 -0
  51. data/lib/rubysmith/templates/%project_name%/README.adoc.erb +20 -21
  52. data/lib/rubysmith/templates/%project_name%/README.md.erb +20 -21
  53. data/lib/rubysmith/templates/%project_name%/VERSIONS.adoc.erb +5 -0
  54. data/lib/rubysmith/templates/%project_name%/VERSIONS.md.erb +5 -0
  55. data/lib/rubysmith/templates/%project_name%/bin/rubocop.erb +0 -1
  56. data.tar.gz.sig +0 -0
  57. metadata +54 -38
  58. metadata.gz.sig +3 -2
  59. data/lib/rubysmith/builders/documentation/conduct.rb +0 -32
  60. data/lib/rubysmith/builders/pragma.rb +0 -32
  61. data/lib/rubysmith/builders/rubocop/formatter.rb +0 -31
  62. data/lib/rubysmith/builders/rubocop/setup.rb +0 -31
  63. data/lib/rubysmith/cli/configuration/content.rb +0 -97
  64. data/lib/rubysmith/cli/configuration/defaults.yml +0 -46
  65. data/lib/rubysmith/cli/configuration/enhancers/current_time.rb +0 -26
  66. data/lib/rubysmith/cli/configuration/enhancers/git_hub_user.rb +0 -33
  67. data/lib/rubysmith/cli/configuration/enhancers/version.rb +0 -26
  68. data/lib/rubysmith/cli/configuration/loader.rb +0 -46
  69. data/lib/rubysmith/cli/parsers/assembler.rb +0 -32
  70. data/lib/rubysmith/cli/parsers.rb +0 -11
  71. data/lib/rubysmith/templates/%project_name%/CHANGES.adoc.erb +0 -5
  72. data/lib/rubysmith/templates/%project_name%/CHANGES.md.erb +0 -5
  73. data/lib/rubysmith/templates/%project_name%/CODE_OF_CONDUCT.adoc.erb +0 -114
  74. data/lib/rubysmith/templates/%project_name%/CODE_OF_CONDUCT.md.erb +0 -115
  75. data/lib/rubysmith/templates/%project_name%/CONTRIBUTING.adoc.erb +0 -22
  76. data/lib/rubysmith/templates/%project_name%/CONTRIBUTING.md.erb +0 -22
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.16.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -28,7 +28,7 @@ cert_chain:
28
28
  lkHilIrX69jq8wMPpBhlaw2mRmeSL50Wv5u6xVBvOHhXFSP1crXM95vfLhLyRYod
29
29
  W2A=
30
30
  -----END CERTIFICATE-----
31
- date: 2021-11-20 00:00:00.000000000 Z
31
+ date: 2022-01-01 00:00:00.000000000 Z
32
32
  dependencies:
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: dry-container
@@ -50,14 +50,28 @@ dependencies:
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '0.6'
53
+ version: '1.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: '0.6'
60
+ version: '1.0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: milestoner
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '13.0'
68
+ type: :runtime
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '13.0'
61
75
  - !ruby/object:Gem::Dependency
62
76
  name: pastel
63
77
  requirement: !ruby/object:Gem::Requirement
@@ -78,70 +92,70 @@ dependencies:
78
92
  requirements:
79
93
  - - "~>"
80
94
  - !ruby/object:Gem::Version
81
- version: '9.0'
95
+ version: '10.0'
82
96
  type: :runtime
83
97
  prerelease: false
84
98
  version_requirements: !ruby/object:Gem::Requirement
85
99
  requirements:
86
100
  - - "~>"
87
101
  - !ruby/object:Gem::Version
88
- version: '9.0'
102
+ version: '10.0'
89
103
  - !ruby/object:Gem::Dependency
90
104
  name: refinements
91
105
  requirement: !ruby/object:Gem::Requirement
92
106
  requirements:
93
107
  - - "~>"
94
108
  - !ruby/object:Gem::Version
95
- version: '8.5'
109
+ version: '9.0'
96
110
  type: :runtime
97
111
  prerelease: false
98
112
  version_requirements: !ruby/object:Gem::Requirement
99
113
  requirements:
100
114
  - - "~>"
101
115
  - !ruby/object:Gem::Version
102
- version: '8.5'
116
+ version: '9.0'
103
117
  - !ruby/object:Gem::Dependency
104
118
  name: rubocop
105
119
  requirement: !ruby/object:Gem::Requirement
106
120
  requirements:
107
121
  - - "~>"
108
122
  - !ruby/object:Gem::Version
109
- version: '1.20'
123
+ version: '1.24'
110
124
  type: :runtime
111
125
  prerelease: false
112
126
  version_requirements: !ruby/object:Gem::Requirement
113
127
  requirements:
114
128
  - - "~>"
115
129
  - !ruby/object:Gem::Version
116
- version: '1.20'
130
+ version: '1.24'
117
131
  - !ruby/object:Gem::Dependency
118
132
  name: runcom
119
133
  requirement: !ruby/object:Gem::Requirement
120
134
  requirements:
121
135
  - - "~>"
122
136
  - !ruby/object:Gem::Version
123
- version: '7.0'
137
+ version: '8.0'
124
138
  type: :runtime
125
139
  prerelease: false
126
140
  version_requirements: !ruby/object:Gem::Requirement
127
141
  requirements:
128
142
  - - "~>"
129
143
  - !ruby/object:Gem::Version
130
- version: '7.0'
144
+ version: '8.0'
131
145
  - !ruby/object:Gem::Dependency
132
146
  name: tocer
133
147
  requirement: !ruby/object:Gem::Requirement
134
148
  requirements:
135
149
  - - "~>"
136
150
  - !ruby/object:Gem::Version
137
- version: '12.1'
151
+ version: '13.0'
138
152
  type: :runtime
139
153
  prerelease: false
140
154
  version_requirements: !ruby/object:Gem::Requirement
141
155
  requirements:
142
156
  - - "~>"
143
157
  - !ruby/object:Gem::Version
144
- version: '12.1'
158
+ version: '13.0'
145
159
  - !ruby/object:Gem::Dependency
146
160
  name: zeitwerk
147
161
  requirement: !ruby/object:Gem::Requirement
@@ -175,37 +189,40 @@ files:
175
189
  - lib/rubysmith/builders/circle_ci.rb
176
190
  - lib/rubysmith/builders/console.rb
177
191
  - lib/rubysmith/builders/core.rb
178
- - lib/rubysmith/builders/documentation/change.rb
179
- - lib/rubysmith/builders/documentation/conduct.rb
180
- - lib/rubysmith/builders/documentation/contribution.rb
192
+ - lib/rubysmith/builders/documentation/citation.rb
181
193
  - lib/rubysmith/builders/documentation/license.rb
182
194
  - lib/rubysmith/builders/documentation/readme.rb
195
+ - lib/rubysmith/builders/documentation/version.rb
183
196
  - lib/rubysmith/builders/git/commit.rb
184
197
  - lib/rubysmith/builders/git/setup.rb
185
198
  - lib/rubysmith/builders/git_hub.rb
186
199
  - lib/rubysmith/builders/guard.rb
187
- - lib/rubysmith/builders/pragma.rb
188
200
  - lib/rubysmith/builders/rake.rb
189
201
  - lib/rubysmith/builders/reek.rb
190
202
  - lib/rubysmith/builders/rspec/context.rb
191
203
  - lib/rubysmith/builders/rspec/helper.rb
192
- - lib/rubysmith/builders/rubocop/formatter.rb
193
- - lib/rubysmith/builders/rubocop/setup.rb
204
+ - lib/rubysmith/builders/rubocop.rb
194
205
  - lib/rubysmith/builders/setup.rb
195
206
  - lib/rubysmith/cli/actions/build.rb
196
207
  - lib/rubysmith/cli/actions/config.rb
197
- - lib/rubysmith/cli/configuration/content.rb
198
- - lib/rubysmith/cli/configuration/defaults.yml
199
- - lib/rubysmith/cli/configuration/enhancers/current_time.rb
200
- - lib/rubysmith/cli/configuration/enhancers/git_hub_user.rb
201
- - lib/rubysmith/cli/configuration/enhancers/version.rb
202
- - lib/rubysmith/cli/configuration/loader.rb
203
- - lib/rubysmith/cli/parsers.rb
204
- - lib/rubysmith/cli/parsers/assembler.rb
208
+ - lib/rubysmith/cli/actions/publish.rb
209
+ - lib/rubysmith/cli/parser.rb
205
210
  - lib/rubysmith/cli/parsers/build.rb
206
211
  - lib/rubysmith/cli/parsers/core.rb
207
212
  - lib/rubysmith/cli/shell.rb
213
+ - lib/rubysmith/configuration/content.rb
214
+ - lib/rubysmith/configuration/defaults.yml
215
+ - lib/rubysmith/configuration/enhancers/current_time.rb
216
+ - lib/rubysmith/configuration/enhancers/git_email.rb
217
+ - lib/rubysmith/configuration/enhancers/git_hub_user.rb
218
+ - lib/rubysmith/configuration/enhancers/git_user.rb
219
+ - lib/rubysmith/configuration/loader.rb
208
220
  - lib/rubysmith/container.rb
221
+ - lib/rubysmith/extensions/bundler.rb
222
+ - lib/rubysmith/extensions/milestoner.rb
223
+ - lib/rubysmith/extensions/pragmater.rb
224
+ - lib/rubysmith/extensions/rubocop.rb
225
+ - lib/rubysmith/extensions/tocer.rb
209
226
  - lib/rubysmith/identity.rb
210
227
  - lib/rubysmith/pathway.rb
211
228
  - lib/rubysmith/renderers/erb.rb
@@ -216,21 +233,20 @@ files:
216
233
  - lib/rubysmith/templates/%project_name%/.reek.yml.erb
217
234
  - lib/rubysmith/templates/%project_name%/.rubocop.yml.erb
218
235
  - lib/rubysmith/templates/%project_name%/.ruby-version.erb
219
- - lib/rubysmith/templates/%project_name%/CHANGES.adoc.erb
220
- - lib/rubysmith/templates/%project_name%/CHANGES.md.erb
221
- - lib/rubysmith/templates/%project_name%/CODE_OF_CONDUCT.adoc.erb
222
- - lib/rubysmith/templates/%project_name%/CODE_OF_CONDUCT.md.erb
223
- - lib/rubysmith/templates/%project_name%/CONTRIBUTING.adoc.erb
224
- - lib/rubysmith/templates/%project_name%/CONTRIBUTING.md.erb
236
+ - lib/rubysmith/templates/%project_name%/CITATION.cff.erb
225
237
  - lib/rubysmith/templates/%project_name%/Gemfile.erb
226
238
  - lib/rubysmith/templates/%project_name%/Guardfile.erb
227
239
  - lib/rubysmith/templates/%project_name%/LICENSE-apache.adoc.erb
228
240
  - lib/rubysmith/templates/%project_name%/LICENSE-apache.md.erb
241
+ - lib/rubysmith/templates/%project_name%/LICENSE-hippocratic.adoc.erb
242
+ - lib/rubysmith/templates/%project_name%/LICENSE-hippocratic.md.erb
229
243
  - lib/rubysmith/templates/%project_name%/LICENSE-mit.adoc.erb
230
244
  - lib/rubysmith/templates/%project_name%/LICENSE-mit.md.erb
231
245
  - lib/rubysmith/templates/%project_name%/README.adoc.erb
232
246
  - lib/rubysmith/templates/%project_name%/README.md.erb
233
247
  - lib/rubysmith/templates/%project_name%/Rakefile.erb
248
+ - lib/rubysmith/templates/%project_name%/VERSIONS.adoc.erb
249
+ - lib/rubysmith/templates/%project_name%/VERSIONS.md.erb
234
250
  - lib/rubysmith/templates/%project_name%/bin/console.erb
235
251
  - lib/rubysmith/templates/%project_name%/bin/guard.erb
236
252
  - lib/rubysmith/templates/%project_name%/bin/rubocop.erb
@@ -241,10 +257,10 @@ files:
241
257
  - lib/rubysmith/text/inserter.rb
242
258
  homepage: https://github.com/bkuhlmann/rubysmith
243
259
  licenses:
244
- - Apache-2.0
260
+ - Hippocratic-3.0
245
261
  metadata:
246
262
  bug_tracker_uri: https://github.com/bkuhlmann/rubysmith/issues
247
- changelog_uri: https://www.alchemists.io/projects/rubysmith/changes.html
263
+ changelog_uri: https://www.alchemists.io/projects/rubysmith/versions
248
264
  documentation_uri: https://www.alchemists.io/projects/rubysmith
249
265
  rubygems_mfa_required: 'true'
250
266
  source_code_uri: https://github.com/bkuhlmann/rubysmith
@@ -256,14 +272,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
256
272
  requirements:
257
273
  - - "~>"
258
274
  - !ruby/object:Gem::Version
259
- version: '3.0'
275
+ version: '3.1'
260
276
  required_rubygems_version: !ruby/object:Gem::Requirement
261
277
  requirements:
262
278
  - - ">="
263
279
  - !ruby/object:Gem::Version
264
280
  version: '0'
265
281
  requirements: []
266
- rubygems_version: 3.2.31
282
+ rubygems_version: 3.3.4
267
283
  signing_key:
268
284
  specification_version: 4
269
285
  summary: A command line interface for smithing Ruby projects.
metadata.gz.sig CHANGED
@@ -1,2 +1,3 @@
1
- �����`ǹd�b��f&��U(_c,�D%C�R�����h@t�T��{�ٙ0����*� ��Q o�w���~n�T$�v�w��g��Z�7-�w�$�5˴�(|�=Y\E���z�_���6�{4E4 ���eޯ�n
2
- .��T��ӵަӁ�MP��W�ܺ�߸@�W��ؙ�ě؞X����c�[_3BMFk�?���; �+�x���� |�5`���L�3>>���uSЂ���8�4�-���E��
1
+ ���x
2
+
3
+ ���˪DS����R_���� \hq>hapZWң!��ucӯ�C�
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "tocer"
4
-
5
- module Rubysmith
6
- module Builders
7
- module Documentation
8
- # Builds project skeleton CODE_OF_CONDUCT documentation.
9
- class Conduct
10
- def self.call(...) = new(...).call
11
-
12
- def initialize configuration, builder: Builder
13
- @configuration = configuration
14
- @builder = builder
15
- end
16
-
17
- def call
18
- return unless configuration.build_conduct
19
-
20
- configuration.with(template_path: "%project_name%/CODE_OF_CONDUCT.#{kind}.erb")
21
- .then { |updated_configuration| builder.call(updated_configuration).render }
22
- end
23
-
24
- private
25
-
26
- attr_reader :configuration, :builder
27
-
28
- def kind = configuration.documentation_format || "md"
29
- end
30
- end
31
- end
32
- end
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "pragmater"
4
-
5
- module Rubysmith
6
- module Builders
7
- # Builds project skeleton pragmas so all Ruby strings are frozen by default.
8
- class Pragma
9
- def self.call(...) = new(...).call
10
-
11
- def initialize configuration, client: Pragmater::Runner
12
- @configuration = configuration
13
- @client = client
14
- end
15
-
16
- def call = client.for(**attributes).call && nil
17
-
18
- private
19
-
20
- attr_reader :configuration, :client
21
-
22
- def attributes
23
- {
24
- action: :insert,
25
- root_dir: configuration.project_root,
26
- comments: configuration.builders_pragmater_comments,
27
- includes: configuration.builders_pragmater_includes
28
- }
29
- end
30
- end
31
- end
32
- end
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "rubocop"
4
- require "refinements/ios"
5
-
6
- module Rubysmith
7
- module Builders
8
- module Rubocop
9
- # Executes Rubocop auto-correct on newly generated project.
10
- class Formatter
11
- using Refinements::IOs
12
-
13
- def self.call(...) = new(...).call
14
-
15
- def initialize configuration, client: RuboCop::CLI.new
16
- @configuration = configuration
17
- @client = client
18
- end
19
-
20
- def call
21
- STDOUT.squelch { client.run ["--auto-correct", configuration.project_root.to_s] }
22
- nil
23
- end
24
-
25
- private
26
-
27
- attr_reader :configuration, :client
28
- end
29
- end
30
- end
31
- end
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Rubysmith
4
- module Builders
5
- module Rubocop
6
- # Builds project skeleton for Rubocop code quality support.
7
- class Setup
8
- def self.call(...) = new(...).call
9
-
10
- def initialize configuration, builder: Builder
11
- @configuration = configuration
12
- @builder = builder
13
- end
14
-
15
- def call
16
- return unless configuration.build_rubocop
17
-
18
- builder.call(configuration.with(template_path: "%project_name%/bin/rubocop.erb"))
19
- .render
20
- .permit 0o755
21
-
22
- builder.call(configuration.with(template_path: "%project_name%/.rubocop.yml.erb")).render
23
- end
24
-
25
- private
26
-
27
- attr_reader :configuration, :builder
28
- end
29
- end
30
- end
31
- end
@@ -1,97 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "pathname"
4
- require "refinements/strings"
5
-
6
- module Rubysmith
7
- module CLI
8
- module Configuration
9
- # Defines the common configuration content for use throughout the gem.
10
- Content = Struct.new(
11
- :action_build,
12
- :action_config,
13
- :action_help,
14
- :action_version,
15
- :author_email,
16
- :author_name,
17
- :author_url,
18
- :build_amazing_print,
19
- :build_bundler_leak,
20
- :build_changes,
21
- :build_circle_ci,
22
- :build_conduct,
23
- :build_console,
24
- :build_contributions,
25
- :build_debug,
26
- :build_git,
27
- :build_git_hub,
28
- :build_git_lint,
29
- :build_guard,
30
- :build_license,
31
- :build_maximum,
32
- :build_minimum,
33
- :build_rake,
34
- :build_readme,
35
- :build_reek,
36
- :build_refinements,
37
- :build_rspec,
38
- :build_rubocop,
39
- :build_setup,
40
- :build_simple_cov,
41
- :build_zeitwerk,
42
- :builders_pragmater_comments,
43
- :builders_pragmater_includes,
44
- :documentation_format,
45
- :documentation_license,
46
- :git_hub_user,
47
- :now,
48
- :project_name,
49
- :target_root,
50
- :template_path,
51
- :template_root,
52
- :version,
53
- keyword_init: true
54
- ) do
55
- using Refinements::Strings
56
-
57
- def initialize *arguments
58
- super
59
-
60
- self[:template_root] ||= Pathname(__dir__).join("../../templates").expand_path
61
- self[:target_root] ||= Pathname.pwd
62
- end
63
-
64
- def with(attributes) = self.class.new(to_h.merge(attributes))
65
-
66
- def maximize = update_build_options(true)
67
-
68
- def minimize = update_build_options(false)
69
-
70
- def project_label = project_name.titleize
71
-
72
- def project_class = project_name.camelcase
73
-
74
- def project_root = target_root.join(project_name)
75
-
76
- def project_path = project_name.snakecase
77
-
78
- def ascii_doc? = documentation_format == "adoc"
79
-
80
- def markdown? = documentation_format == "md"
81
-
82
- def to_pathway
83
- Pathway[start_root: template_root, start_path: template_path, end_root: target_root]
84
- end
85
-
86
- private
87
-
88
- def update_build_options value
89
- to_h.except(:build_minimum)
90
- .select { |key, _value| key.start_with? "build_" }
91
- .each { |key, _value| self[key] = value }
92
- .then { self }
93
- end
94
- end
95
- end
96
- end
97
- end
@@ -1,46 +0,0 @@
1
- :author:
2
- :name:
3
- :email:
4
- :url:
5
- :build:
6
- :amazing_print: true
7
- :bundler_leak: true
8
- :changes: true
9
- :circle_ci: false
10
- :conduct: true
11
- :console: true
12
- :contributions: true
13
- :debug: true
14
- :git: true
15
- :git_hub: false
16
- :git_lint: true
17
- :guard: true
18
- :license: true
19
- :maximum: false
20
- :minimum: false
21
- :rake: true
22
- :readme: true
23
- :reek: true
24
- :refinements: true
25
- :rspec: true
26
- :rubocop: true
27
- :setup: true
28
- :simple_cov: true
29
- :zeitwerk: true
30
- :builders:
31
- :pragmater:
32
- :comments:
33
- - "# frozen_string_literal: true"
34
- :includes:
35
- - "**/*.rb"
36
- - "**/*bin/console"
37
- - "**/*bin/guard"
38
- - "**/*bin/rubocop"
39
- - "**/*Gemfile"
40
- - "**/*Guardfile"
41
- - "**/*Rakefile"
42
- :documentation:
43
- :format: "md"
44
- :license: "mit"
45
- :git_hub:
46
- :user:
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "refinements/structs"
4
-
5
- module Rubysmith
6
- module CLI
7
- module Configuration
8
- module Enhancers
9
- # Adds current time to content.
10
- class CurrentTime
11
- using Refinements::Structs
12
-
13
- def initialize now = Time.now
14
- @now = now
15
- end
16
-
17
- def call(content) = content.merge(now: now)
18
-
19
- private
20
-
21
- attr_reader :now
22
- end
23
- end
24
- end
25
- end
26
- end
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "git_plus"
4
- require "refinements/strings"
5
- require "refinements/structs"
6
-
7
- module Rubysmith
8
- module CLI
9
- module Configuration
10
- module Enhancers
11
- # Dynamically adds GitHub user if user is defined.
12
- class GitHubUser
13
- using Refinements::Strings
14
- using Refinements::Structs
15
-
16
- def initialize repository: GitPlus::Repository.new
17
- @repository = repository
18
- end
19
-
20
- def call content
21
- String(content.git_hub_user).blank? ? content.merge(git_hub_user: user) : content
22
- end
23
-
24
- private
25
-
26
- attr_reader :repository
27
-
28
- def user = repository.config_get("github.user")
29
- end
30
- end
31
- end
32
- end
33
- end
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "refinements/structs"
4
-
5
- module Rubysmith
6
- module CLI
7
- module Configuration
8
- module Enhancers
9
- # Adds this gem's version to content.
10
- class Version
11
- using Refinements::Structs
12
-
13
- def initialize version = Identity::VERSION_LABEL
14
- @version = version
15
- end
16
-
17
- def call(content) = content.merge(version: version)
18
-
19
- private
20
-
21
- attr_reader :version
22
- end
23
- end
24
- end
25
- end
26
- end
@@ -1,46 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "pathname"
4
- require "refinements/hashes"
5
- require "refinements/structs"
6
- require "runcom"
7
- require "yaml"
8
-
9
- module Rubysmith
10
- module CLI
11
- module Configuration
12
- # Represents the fully assembled Command Line Interface (CLI) configuration.
13
- class Loader
14
- using Refinements::Hashes
15
- using Refinements::Structs
16
-
17
- DEFAULTS = YAML.load_file(Pathname(__dir__).join("defaults.yml")).freeze
18
- CLIENT = Runcom::Config.new "#{Identity::NAME}/configuration.yml", defaults: DEFAULTS
19
-
20
- ENHANCERS = [
21
- Enhancers::GitHubUser.new,
22
- Enhancers::CurrentTime.new,
23
- Enhancers::Version.new
24
- ].freeze
25
-
26
- def self.call(...) = new(...).call
27
-
28
- def self.with_defaults = new(client: DEFAULTS, enhancers: [])
29
-
30
- def initialize content: Content.new, client: CLIENT, enhancers: ENHANCERS
31
- @content = content
32
- @client = client
33
- @enhancers = enhancers
34
- end
35
-
36
- def call = enhancers.reduce(preload_content) { |preload, enhancer| enhancer.call preload }
37
-
38
- private
39
-
40
- attr_reader :content, :client, :enhancers
41
-
42
- def preload_content = content.merge(**client.to_h.flatten_keys)
43
- end
44
- end
45
- end
46
- end
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Rubysmith
4
- module CLI
5
- module Parsers
6
- # Assembles and parses all Command Line Interface (CLI) options.
7
- class Assembler
8
- SECTIONS = [Core, Build].freeze # Order is important.
9
-
10
- def initialize sections: SECTIONS, client: CLIENT, container: Container
11
- @sections = sections
12
- @client = client
13
- @container = container
14
- end
15
-
16
- def call arguments = []
17
- sections.each { |parser| parser.call client: client }
18
- client.parse! arguments
19
- configuration
20
- end
21
-
22
- def to_s = client.to_s
23
-
24
- private
25
-
26
- attr_reader :sections, :client, :container
27
-
28
- def configuration = container[__method__]
29
- end
30
- end
31
- end
32
- end