rubysmith 0.15.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/LICENSE.adoc +207 -155
  4. data/README.adoc +352 -93
  5. data/{bin → exe}/rubysmith +0 -0
  6. data/lib/rubysmith/builder.rb +2 -3
  7. data/lib/rubysmith/builders/bundler.rb +7 -11
  8. data/lib/rubysmith/builders/circle_ci.rb +8 -2
  9. data/lib/rubysmith/builders/console.rb +8 -2
  10. data/lib/rubysmith/builders/core.rb +7 -3
  11. data/lib/rubysmith/builders/documentation/{change.rb → citation.rb} +8 -8
  12. data/lib/rubysmith/builders/documentation/license.rb +9 -4
  13. data/lib/rubysmith/builders/documentation/readme.rb +12 -18
  14. data/lib/rubysmith/builders/documentation/{contribution.rb → version.rb} +10 -5
  15. data/lib/rubysmith/builders/git/commit.rb +3 -1
  16. data/lib/rubysmith/builders/{rubocop/setup.rb → git/ignore.rb} +11 -7
  17. data/lib/rubysmith/builders/git/setup.rb +2 -1
  18. data/lib/rubysmith/builders/git_hub.rb +8 -3
  19. data/lib/rubysmith/builders/guard.rb +9 -3
  20. data/lib/rubysmith/builders/rake.rb +9 -3
  21. data/lib/rubysmith/builders/reek.rb +7 -2
  22. data/lib/rubysmith/builders/rspec/context.rb +8 -2
  23. data/lib/rubysmith/builders/rspec/helper.rb +8 -2
  24. data/lib/rubysmith/builders/rubocop.rb +34 -0
  25. data/lib/rubysmith/builders/setup.rb +8 -2
  26. data/lib/rubysmith/cli/actions/build.rb +11 -12
  27. data/lib/rubysmith/cli/actions/config.rb +4 -2
  28. data/lib/rubysmith/cli/actions/publish.rb +21 -0
  29. data/lib/rubysmith/cli/parser.rb +31 -0
  30. data/lib/rubysmith/cli/parsers/build.rb +89 -45
  31. data/lib/rubysmith/cli/parsers/core.rb +14 -10
  32. data/lib/rubysmith/cli/shell.rb +22 -15
  33. data/lib/rubysmith/configuration/content.rb +174 -0
  34. data/lib/rubysmith/configuration/defaults.yml +89 -0
  35. data/lib/rubysmith/configuration/enhancers/current_time.rb +24 -0
  36. data/lib/rubysmith/configuration/enhancers/git_email.rb +31 -0
  37. data/lib/rubysmith/configuration/enhancers/git_hub_user.rb +31 -0
  38. data/lib/rubysmith/configuration/enhancers/git_user.rb +33 -0
  39. data/lib/rubysmith/configuration/loader.rb +48 -0
  40. data/lib/rubysmith/container.rb +1 -1
  41. data/lib/rubysmith/extensions/bundler.rb +30 -0
  42. data/lib/rubysmith/extensions/milestoner.rb +35 -0
  43. data/lib/rubysmith/extensions/pragmater.rb +35 -0
  44. data/lib/rubysmith/extensions/rubocop.rb +29 -0
  45. data/lib/rubysmith/extensions/tocer.rb +37 -0
  46. data/lib/rubysmith/identity.rb +1 -1
  47. data/lib/rubysmith/templates/%project_name%/.github/ISSUE_TEMPLATE.md.erb +1 -4
  48. data/lib/rubysmith/templates/%project_name%/.github/PULL_REQUEST_TEMPLATE.md.erb +0 -3
  49. data/lib/rubysmith/templates/%project_name%/.gitignore.erb +11 -0
  50. data/lib/rubysmith/templates/%project_name%/.rubocop.yml.erb +2 -0
  51. data/lib/rubysmith/templates/%project_name%/CITATION.cff.erb +16 -0
  52. data/lib/rubysmith/templates/%project_name%/Gemfile.erb +19 -10
  53. data/lib/rubysmith/templates/%project_name%/LICENSE-hippocratic.adoc.erb +214 -0
  54. data/lib/rubysmith/templates/%project_name%/LICENSE-hippocratic.md.erb +214 -0
  55. data/lib/rubysmith/templates/%project_name%/README.adoc.erb +20 -21
  56. data/lib/rubysmith/templates/%project_name%/README.md.erb +20 -21
  57. data/lib/rubysmith/templates/%project_name%/Rakefile.erb +9 -0
  58. data/lib/rubysmith/templates/%project_name%/VERSIONS.adoc.erb +5 -0
  59. data/lib/rubysmith/templates/%project_name%/VERSIONS.md.erb +5 -0
  60. data/lib/rubysmith/templates/%project_name%/bin/rubocop.erb +0 -1
  61. data.tar.gz.sig +0 -0
  62. metadata +61 -42
  63. metadata.gz.sig +0 -0
  64. data/lib/rubysmith/builders/documentation/conduct.rb +0 -32
  65. data/lib/rubysmith/builders/pragma.rb +0 -32
  66. data/lib/rubysmith/builders/rubocop/formatter.rb +0 -31
  67. data/lib/rubysmith/cli/configuration/content.rb +0 -97
  68. data/lib/rubysmith/cli/configuration/defaults.yml +0 -46
  69. data/lib/rubysmith/cli/configuration/enhancers/current_time.rb +0 -26
  70. data/lib/rubysmith/cli/configuration/enhancers/git_hub_user.rb +0 -33
  71. data/lib/rubysmith/cli/configuration/enhancers/version.rb +0 -26
  72. data/lib/rubysmith/cli/configuration/loader.rb +0 -46
  73. data/lib/rubysmith/cli/parsers/assembler.rb +0 -32
  74. data/lib/rubysmith/cli/parsers.rb +0 -11
  75. data/lib/rubysmith/templates/%project_name%/CHANGES.adoc.erb +0 -5
  76. data/lib/rubysmith/templates/%project_name%/CHANGES.md.erb +0 -5
  77. data/lib/rubysmith/templates/%project_name%/CODE_OF_CONDUCT.adoc.erb +0 -114
  78. data/lib/rubysmith/templates/%project_name%/CODE_OF_CONDUCT.md.erb +0 -115
  79. data/lib/rubysmith/templates/%project_name%/CONTRIBUTING.adoc.erb +0 -22
  80. data/lib/rubysmith/templates/%project_name%/CONTRIBUTING.md.erb +0 -22
@@ -15,6 +15,9 @@ require "bundler/setup"
15
15
  <% if configuration.build_rubocop %>
16
16
  require "rubocop/rake_task"
17
17
  <% end %>
18
+ <% if configuration.build_yard %>
19
+ require "yard"
20
+ <% end %>
18
21
 
19
22
  <% if configuration.build_bundler_leak %>
20
23
  Bundler::Plumber::Task.new
@@ -29,6 +32,12 @@ require "bundler/setup"
29
32
  RuboCop::RakeTask.new
30
33
  <% end %>
31
34
 
35
+ <% if configuration.build_yard %>
36
+ YARD::Rake::YardocTask.new do |task|
37
+ task.options = ["--title", "<%= configuration.project_label %>", "--output-dir", "doc/yard"]
38
+ end
39
+ <% end %>
40
+
32
41
  desc "Run code quality checks"
33
42
  task code_quality: %i[<% 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 %>]
34
43
 
@@ -0,0 +1,5 @@
1
+ = Versions
2
+
3
+ == <%= configuration.project_version %> (<%= configuration.now.strftime "%Y-%m-%d" %>)
4
+
5
+ * Added initial implementation.
@@ -0,0 +1,5 @@
1
+ # Versions
2
+
3
+ ## <%= configuration.project_version %> (<%= configuration.now.strftime "%Y-%m-%d" %>)
4
+
5
+ - Added initial implementation.
@@ -1,5 +1,4 @@
1
1
  #! /usr/bin/env ruby
2
- # frozen_string_literal: true
3
2
 
4
3
  require "bundler/setup"
5
4
 
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubysmith
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
@@ -28,7 +28,7 @@ cert_chain:
28
28
  lkHilIrX69jq8wMPpBhlaw2mRmeSL50Wv5u6xVBvOHhXFSP1crXM95vfLhLyRYod
29
29
  W2A=
30
30
  -----END CERTIFICATE-----
31
- date: 2021-10-09 00:00:00.000000000 Z
31
+ date: 2022-01-09 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,84 +92,84 @@ 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.4'
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.4'
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
148
162
  requirements:
149
163
  - - "~>"
150
164
  - !ruby/object:Gem::Version
151
- version: '2.4'
165
+ version: '2.5'
152
166
  type: :runtime
153
167
  prerelease: false
154
168
  version_requirements: !ruby/object:Gem::Requirement
155
169
  requirements:
156
170
  - - "~>"
157
171
  - !ruby/object:Gem::Version
158
- version: '2.4'
172
+ version: '2.5'
159
173
  description:
160
174
  email:
161
175
  - brooke@alchemists.io
@@ -168,44 +182,48 @@ extra_rdoc_files:
168
182
  files:
169
183
  - LICENSE.adoc
170
184
  - README.adoc
171
- - bin/rubysmith
185
+ - exe/rubysmith
172
186
  - lib/rubysmith.rb
173
187
  - lib/rubysmith/builder.rb
174
188
  - lib/rubysmith/builders/bundler.rb
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
197
+ - lib/rubysmith/builders/git/ignore.rb
184
198
  - lib/rubysmith/builders/git/setup.rb
185
199
  - lib/rubysmith/builders/git_hub.rb
186
200
  - lib/rubysmith/builders/guard.rb
187
- - lib/rubysmith/builders/pragma.rb
188
201
  - lib/rubysmith/builders/rake.rb
189
202
  - lib/rubysmith/builders/reek.rb
190
203
  - lib/rubysmith/builders/rspec/context.rb
191
204
  - lib/rubysmith/builders/rspec/helper.rb
192
- - lib/rubysmith/builders/rubocop/formatter.rb
193
- - lib/rubysmith/builders/rubocop/setup.rb
205
+ - lib/rubysmith/builders/rubocop.rb
194
206
  - lib/rubysmith/builders/setup.rb
195
207
  - lib/rubysmith/cli/actions/build.rb
196
208
  - 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
209
+ - lib/rubysmith/cli/actions/publish.rb
210
+ - lib/rubysmith/cli/parser.rb
205
211
  - lib/rubysmith/cli/parsers/build.rb
206
212
  - lib/rubysmith/cli/parsers/core.rb
207
213
  - lib/rubysmith/cli/shell.rb
214
+ - lib/rubysmith/configuration/content.rb
215
+ - lib/rubysmith/configuration/defaults.yml
216
+ - lib/rubysmith/configuration/enhancers/current_time.rb
217
+ - lib/rubysmith/configuration/enhancers/git_email.rb
218
+ - lib/rubysmith/configuration/enhancers/git_hub_user.rb
219
+ - lib/rubysmith/configuration/enhancers/git_user.rb
220
+ - lib/rubysmith/configuration/loader.rb
208
221
  - lib/rubysmith/container.rb
222
+ - lib/rubysmith/extensions/bundler.rb
223
+ - lib/rubysmith/extensions/milestoner.rb
224
+ - lib/rubysmith/extensions/pragmater.rb
225
+ - lib/rubysmith/extensions/rubocop.rb
226
+ - lib/rubysmith/extensions/tocer.rb
209
227
  - lib/rubysmith/identity.rb
210
228
  - lib/rubysmith/pathway.rb
211
229
  - lib/rubysmith/renderers/erb.rb
@@ -213,24 +231,24 @@ files:
213
231
  - lib/rubysmith/templates/%project_name%/.circleci/config.yml.erb
214
232
  - lib/rubysmith/templates/%project_name%/.github/ISSUE_TEMPLATE.md.erb
215
233
  - lib/rubysmith/templates/%project_name%/.github/PULL_REQUEST_TEMPLATE.md.erb
234
+ - lib/rubysmith/templates/%project_name%/.gitignore.erb
216
235
  - lib/rubysmith/templates/%project_name%/.reek.yml.erb
217
236
  - lib/rubysmith/templates/%project_name%/.rubocop.yml.erb
218
237
  - 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
238
+ - lib/rubysmith/templates/%project_name%/CITATION.cff.erb
225
239
  - lib/rubysmith/templates/%project_name%/Gemfile.erb
226
240
  - lib/rubysmith/templates/%project_name%/Guardfile.erb
227
241
  - lib/rubysmith/templates/%project_name%/LICENSE-apache.adoc.erb
228
242
  - lib/rubysmith/templates/%project_name%/LICENSE-apache.md.erb
243
+ - lib/rubysmith/templates/%project_name%/LICENSE-hippocratic.adoc.erb
244
+ - lib/rubysmith/templates/%project_name%/LICENSE-hippocratic.md.erb
229
245
  - lib/rubysmith/templates/%project_name%/LICENSE-mit.adoc.erb
230
246
  - lib/rubysmith/templates/%project_name%/LICENSE-mit.md.erb
231
247
  - lib/rubysmith/templates/%project_name%/README.adoc.erb
232
248
  - lib/rubysmith/templates/%project_name%/README.md.erb
233
249
  - lib/rubysmith/templates/%project_name%/Rakefile.erb
250
+ - lib/rubysmith/templates/%project_name%/VERSIONS.adoc.erb
251
+ - lib/rubysmith/templates/%project_name%/VERSIONS.md.erb
234
252
  - lib/rubysmith/templates/%project_name%/bin/console.erb
235
253
  - lib/rubysmith/templates/%project_name%/bin/guard.erb
236
254
  - lib/rubysmith/templates/%project_name%/bin/rubocop.erb
@@ -241,11 +259,12 @@ files:
241
259
  - lib/rubysmith/text/inserter.rb
242
260
  homepage: https://github.com/bkuhlmann/rubysmith
243
261
  licenses:
244
- - Apache-2.0
262
+ - Hippocratic-3.0
245
263
  metadata:
246
264
  bug_tracker_uri: https://github.com/bkuhlmann/rubysmith/issues
247
- changelog_uri: https://www.alchemists.io/projects/rubysmith/changes.html
265
+ changelog_uri: https://www.alchemists.io/projects/rubysmith/versions
248
266
  documentation_uri: https://www.alchemists.io/projects/rubysmith
267
+ rubygems_mfa_required: 'true'
249
268
  source_code_uri: https://github.com/bkuhlmann/rubysmith
250
269
  post_install_message:
251
270
  rdoc_options: []
@@ -255,14 +274,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
255
274
  requirements:
256
275
  - - "~>"
257
276
  - !ruby/object:Gem::Version
258
- version: '3.0'
277
+ version: '3.1'
259
278
  required_rubygems_version: !ruby/object:Gem::Requirement
260
279
  requirements:
261
280
  - - ">="
262
281
  - !ruby/object:Gem::Version
263
282
  version: '0'
264
283
  requirements: []
265
- rubygems_version: 3.2.28
284
+ rubygems_version: 3.3.4
266
285
  signing_key:
267
286
  specification_version: 4
268
287
  summary: A command line interface for smithing Ruby projects.
metadata.gz.sig CHANGED
Binary file
@@ -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,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