rubysmith 0.16.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/LICENSE.adoc +207 -155
  4. data/README.adoc +360 -104
  5. data/exe/rubysmith +0 -1
  6. data/lib/rubysmith/builder.rb +1 -2
  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 +14 -4
  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 +5 -3
  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/builders/version.rb +28 -0
  27. data/lib/rubysmith/cli/actions/build.rb +12 -12
  28. data/lib/rubysmith/cli/actions/config.rb +4 -2
  29. data/lib/rubysmith/cli/actions/publish.rb +21 -0
  30. data/lib/rubysmith/cli/parser.rb +31 -0
  31. data/lib/rubysmith/cli/parsers/build.rb +98 -45
  32. data/lib/rubysmith/cli/parsers/core.rb +18 -9
  33. data/lib/rubysmith/cli/shell.rb +23 -14
  34. data/lib/rubysmith/configuration/content.rb +174 -0
  35. data/lib/rubysmith/configuration/defaults.yml +91 -0
  36. data/lib/rubysmith/configuration/enhancers/current_time.rb +24 -0
  37. data/lib/rubysmith/configuration/enhancers/git_email.rb +31 -0
  38. data/lib/rubysmith/configuration/enhancers/git_hub_user.rb +31 -0
  39. data/lib/rubysmith/configuration/enhancers/git_user.rb +33 -0
  40. data/lib/rubysmith/configuration/loader.rb +48 -0
  41. data/lib/rubysmith/container.rb +4 -1
  42. data/lib/rubysmith/extensions/bundler.rb +30 -0
  43. data/lib/rubysmith/extensions/milestoner.rb +37 -0
  44. data/lib/rubysmith/extensions/pragmater.rb +36 -0
  45. data/lib/rubysmith/extensions/rubocop.rb +29 -0
  46. data/lib/rubysmith/extensions/tocer.rb +39 -0
  47. data/lib/rubysmith/renderers/erb.rb +9 -1
  48. data/lib/rubysmith/templates/%project_name%/.github/ISSUE_TEMPLATE.md.erb +1 -4
  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/lib/rubysmith/templates/%project_name%/lib/%project_path%.rb.erb +4 -4
  62. data/rubysmith.gemspec +42 -0
  63. data.tar.gz.sig +0 -0
  64. metadata +59 -39
  65. metadata.gz.sig +0 -0
  66. data/lib/rubysmith/builders/documentation/conduct.rb +0 -32
  67. data/lib/rubysmith/builders/pragma.rb +0 -32
  68. data/lib/rubysmith/builders/rubocop/formatter.rb +0 -31
  69. data/lib/rubysmith/cli/configuration/content.rb +0 -97
  70. data/lib/rubysmith/cli/configuration/defaults.yml +0 -46
  71. data/lib/rubysmith/cli/configuration/enhancers/current_time.rb +0 -26
  72. data/lib/rubysmith/cli/configuration/enhancers/git_hub_user.rb +0 -33
  73. data/lib/rubysmith/cli/configuration/enhancers/version.rb +0 -26
  74. data/lib/rubysmith/cli/configuration/loader.rb +0 -46
  75. data/lib/rubysmith/cli/parsers/assembler.rb +0 -32
  76. data/lib/rubysmith/cli/parsers.rb +0 -11
  77. data/lib/rubysmith/identity.rb +0 -11
  78. data/lib/rubysmith/templates/%project_name%/CHANGES.adoc.erb +0 -5
  79. data/lib/rubysmith/templates/%project_name%/CHANGES.md.erb +0 -5
  80. data/lib/rubysmith/templates/%project_name%/CODE_OF_CONDUCT.adoc.erb +0 -114
  81. data/lib/rubysmith/templates/%project_name%/CODE_OF_CONDUCT.md.erb +0 -115
  82. data/lib/rubysmith/templates/%project_name%/CONTRIBUTING.adoc.erb +0 -22
  83. 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
 
@@ -1,12 +1,12 @@
1
1
  <% if configuration.build_zeitwerk %>
2
2
  require "zeitwerk"
3
3
  <% if configuration.project_path.include? "/" %>
4
- Zeitwerk::Loader.new
5
- .tap { |loader| loader.push_dir "#{__dir__}/.." }
6
- .setup
4
+ Zeitwerk::Loader.new.then do |loader|
5
+ loader.push_dir "#{__dir__}/.."
6
+ loader.setup
7
+ end
7
8
  <% else %>
8
9
  Zeitwerk::Loader.for_gem.setup
9
10
  <% end %>
10
11
  <% end %>
11
- # Main namespace.
12
12
  <% namespace %>
data/rubysmith.gemspec ADDED
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "rubysmith"
5
+ spec.version = "1.2.0"
6
+ spec.platform = Gem::Platform::RUBY
7
+ spec.authors = ["Brooke Kuhlmann"]
8
+ spec.email = ["brooke@alchemists.io"]
9
+ spec.homepage = "https://github.com/bkuhlmann/rubysmith"
10
+ spec.summary = "A command line interface for smithing Ruby projects."
11
+ spec.license = "Hippocratic-3.0"
12
+
13
+ spec.metadata = {
14
+ "bug_tracker_uri" => "https://github.com/bkuhlmann/rubysmith/issues",
15
+ "changelog_uri" => "https://www.alchemists.io/projects/rubysmith/versions",
16
+ "documentation_uri" => "https://www.alchemists.io/projects/rubysmith",
17
+ "label" => "Rubysmith",
18
+ "rubygems_mfa_required" => "true",
19
+ "source_code_uri" => "https://github.com/bkuhlmann/rubysmith"
20
+ }
21
+
22
+ spec.signing_key = Gem.default_key_path
23
+ spec.cert_chain = [Gem.default_cert_path]
24
+
25
+ spec.required_ruby_version = "~> 3.1"
26
+ spec.add_dependency "dry-container", "~> 0.9"
27
+ spec.add_dependency "git_plus", "~> 1.1"
28
+ spec.add_dependency "milestoner", "~> 13.0"
29
+ spec.add_dependency "pastel", "~> 0.8"
30
+ spec.add_dependency "pragmater", "~> 10.0"
31
+ spec.add_dependency "refinements", "~> 9.1"
32
+ spec.add_dependency "rubocop", "~> 1.25"
33
+ spec.add_dependency "runcom", "~> 8.0"
34
+ spec.add_dependency "tocer", "~> 13.0"
35
+ spec.add_dependency "zeitwerk", "~> 2.5"
36
+
37
+ spec.bindir = "exe"
38
+ spec.executables << "rubysmith"
39
+ spec.extra_rdoc_files = Dir["README*", "LICENSE*"]
40
+ spec.files = Dir.glob ["*.gemspec", "lib/**/*"], File::FNM_DOTMATCH
41
+ spec.require_paths = ["lib"]
42
+ end
data.tar.gz.sig CHANGED
Binary file
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.2.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-23 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.1'
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.1'
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.1'
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.1'
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.25'
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.25'
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,62 +189,66 @@ 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
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
207
+ - lib/rubysmith/builders/version.rb
195
208
  - lib/rubysmith/cli/actions/build.rb
196
209
  - 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
210
+ - lib/rubysmith/cli/actions/publish.rb
211
+ - lib/rubysmith/cli/parser.rb
205
212
  - lib/rubysmith/cli/parsers/build.rb
206
213
  - lib/rubysmith/cli/parsers/core.rb
207
214
  - lib/rubysmith/cli/shell.rb
215
+ - lib/rubysmith/configuration/content.rb
216
+ - lib/rubysmith/configuration/defaults.yml
217
+ - lib/rubysmith/configuration/enhancers/current_time.rb
218
+ - lib/rubysmith/configuration/enhancers/git_email.rb
219
+ - lib/rubysmith/configuration/enhancers/git_hub_user.rb
220
+ - lib/rubysmith/configuration/enhancers/git_user.rb
221
+ - lib/rubysmith/configuration/loader.rb
208
222
  - lib/rubysmith/container.rb
209
- - lib/rubysmith/identity.rb
223
+ - lib/rubysmith/extensions/bundler.rb
224
+ - lib/rubysmith/extensions/milestoner.rb
225
+ - lib/rubysmith/extensions/pragmater.rb
226
+ - lib/rubysmith/extensions/rubocop.rb
227
+ - lib/rubysmith/extensions/tocer.rb
210
228
  - lib/rubysmith/pathway.rb
211
229
  - lib/rubysmith/renderers/erb.rb
212
230
  - lib/rubysmith/renderers/namespace.rb
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
@@ -239,13 +257,15 @@ files:
239
257
  - lib/rubysmith/templates/%project_name%/spec/spec_helper.rb.erb
240
258
  - lib/rubysmith/templates/%project_name%/spec/support/shared_contexts/temp_dir.rb.erb
241
259
  - lib/rubysmith/text/inserter.rb
260
+ - rubysmith.gemspec
242
261
  homepage: https://github.com/bkuhlmann/rubysmith
243
262
  licenses:
244
- - Apache-2.0
263
+ - Hippocratic-3.0
245
264
  metadata:
246
265
  bug_tracker_uri: https://github.com/bkuhlmann/rubysmith/issues
247
- changelog_uri: https://www.alchemists.io/projects/rubysmith/changes.html
266
+ changelog_uri: https://www.alchemists.io/projects/rubysmith/versions
248
267
  documentation_uri: https://www.alchemists.io/projects/rubysmith
268
+ label: Rubysmith
249
269
  rubygems_mfa_required: 'true'
250
270
  source_code_uri: https://github.com/bkuhlmann/rubysmith
251
271
  post_install_message:
@@ -256,14 +276,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
256
276
  requirements:
257
277
  - - "~>"
258
278
  - !ruby/object:Gem::Version
259
- version: '3.0'
279
+ version: '3.1'
260
280
  required_rubygems_version: !ruby/object:Gem::Requirement
261
281
  requirements:
262
282
  - - ">="
263
283
  - !ruby/object:Gem::Version
264
284
  version: '0'
265
285
  requirements: []
266
- rubygems_version: 3.2.31
286
+ rubygems_version: 3.3.5
267
287
  signing_key:
268
288
  specification_version: 4
269
289
  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