rubysmith 0.12.0 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/README.adoc +101 -33
  4. data/lib/rubysmith/builder.rb +7 -13
  5. data/lib/rubysmith/builders/bundler.rb +1 -1
  6. data/lib/rubysmith/builders/circle_ci.rb +26 -0
  7. data/lib/rubysmith/builders/core.rb +3 -1
  8. data/lib/rubysmith/builders/documentation/change.rb +32 -0
  9. data/lib/rubysmith/builders/documentation/conduct.rb +32 -0
  10. data/lib/rubysmith/builders/documentation/contribution.rb +32 -0
  11. data/lib/rubysmith/builders/documentation/license.rb +36 -0
  12. data/lib/rubysmith/builders/documentation/readme.rb +44 -0
  13. data/lib/rubysmith/builders/git_hub.rb +34 -0
  14. data/lib/rubysmith/cli/actions/build.rb +48 -0
  15. data/lib/rubysmith/cli/actions/config.rb +33 -0
  16. data/lib/rubysmith/cli/configuration/content.rb +43 -17
  17. data/lib/rubysmith/cli/configuration/defaults.yml +14 -7
  18. data/lib/rubysmith/cli/configuration/enhancers/current_time.rb +26 -0
  19. data/lib/rubysmith/cli/configuration/enhancers/git_hub_user.rb +33 -0
  20. data/lib/rubysmith/cli/configuration/enhancers/version.rb +26 -0
  21. data/lib/rubysmith/cli/configuration/loader.rb +15 -4
  22. data/lib/rubysmith/cli/parsers/assembler.rb +7 -9
  23. data/lib/rubysmith/cli/parsers/build.rb +168 -42
  24. data/lib/rubysmith/cli/parsers/core.rb +13 -8
  25. data/lib/rubysmith/cli/shell.rb +16 -27
  26. data/lib/rubysmith/container.rb +37 -0
  27. data/lib/rubysmith/identity.rb +1 -1
  28. data/lib/rubysmith/templates/%project_name%/.circleci/config.yml.erb +31 -0
  29. data/lib/rubysmith/templates/%project_name%/.github/ISSUE_TEMPLATE.md.erb +14 -0
  30. data/lib/rubysmith/templates/%project_name%/.github/PULL_REQUEST_TEMPLATE.md.erb +8 -0
  31. data/lib/rubysmith/templates/%project_name%/Gemfile.erb +49 -49
  32. data/lib/rubysmith/templates/%project_name%/README.adoc.erb +4 -0
  33. data/lib/rubysmith/templates/%project_name%/README.md.erb +3 -0
  34. data/lib/rubysmith/templates/%project_name%/lib/%project_path%.rb.erb +4 -5
  35. data/lib/rubysmith/templates/%project_name%/spec/spec_helper.rb.erb +0 -3
  36. data/lib/rubysmith.rb +7 -3
  37. data.tar.gz.sig +0 -0
  38. metadata +79 -10
  39. metadata.gz.sig +0 -0
  40. data/lib/rubysmith/builders/documentation.rb +0 -57
  41. data/lib/rubysmith/cli/processors/build.rb +0 -56
  42. data/lib/rubysmith/cli/processors/config.rb +0 -31
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 628bf912ecce44ded950cf18f54d54a3a8ca13430ccc300f7db53062da718716
4
- data.tar.gz: cbefec98da88d0e1b6198789805eeed82ea6b5238bee41ca9341c7d6114ed84c
3
+ metadata.gz: f9a0a688a7aac995bdcecc7153253eadb06a4b0c883583c6793b5a4a29232fec
4
+ data.tar.gz: 87eaca3e036a5609b5d5a6525ea05d3e3527095be792f23976899967f13c93a2
5
5
  SHA512:
6
- metadata.gz: 4b7bb2b58f60f60057c12e9f9358d720a10fe4825eefcefb8231d4998647c1d44523a550a05a2938b8d16536954ba2cb6f9fa3a4d5a484a0536f24420cb51991
7
- data.tar.gz: 315a9e28cd8231629bb17fce77051f0fb42b86c25d1fb04245437333b20171c5b5dc40b1e3cbca33cce6c611761fea3ec31493a6dad2e34c56982a598e66785d
6
+ metadata.gz: b3c6fa39d2d40c8465a9652ea0679d20d886e27d18657c4d218d67d4849106721fe527c4e26fd8b91382de04a61277f5ad500ad361e40e3560a6dbceb3bdd5e3
7
+ data.tar.gz: 402d7063461dc2a4d5fdedbd2a17e18d7158988785089e16ff5d7bfce47e63a60679cb78297748668e7fdf9bd5855e064ddc59528ecc34625b09e7a552af8951
checksums.yaml.gz.sig CHANGED
Binary file
data/README.adoc CHANGED
@@ -30,10 +30,12 @@ toc::[]
30
30
  * Uses link:https://www.alchemists.io/projects/pragmater[Pragmater] for Ruby source pragma directives.
31
31
  * Supports link:https://github.com/amazing-print/amazing_print[Amazing Print].
32
32
  * Supports link:https://github.com/rubymem/bundler-leak[Bundler Leak].
33
+ * Supports link:https://circleci.com[Circle CI].
34
+ * Supports link:https://github.com/ruby/debug[Debug].
33
35
  * Supports link:https://git-scm.com[Git].
36
+ * Supports link:https://github.com[GitHub].
34
37
  * Supports link:https://www.alchemists.io/projects/git-lint[Git Lint].
35
38
  * Supports link:https://github.com/guard/guard[Guard].
36
- * Supports link:http://pryrepl.org[Pry].
37
39
  * Supports link:https://github.com/ruby/rake[Rake].
38
40
  * Supports link:https://github.com/troessner/reek[Reek].
39
41
  * Supports link:https://www.alchemists.io/projects/refinements[Refinements].
@@ -43,12 +45,13 @@ toc::[]
43
45
  * Supports link:https://github.com/rubocop-hq/rubocop-rake[Rubocop Rake].
44
46
  * Supports link:https://github.com/rubocop-hq/rubocop-rspec[Rubocop RSpec].
45
47
  * Supports link:https://github.com/simplecov-ruby/simplecov[SimpleCov].
48
+ * Supports link:https://github.com/fxn/zeitwerk[Zeitwerk].
46
49
  * Supports common settings and a structured layout for building projects.
47
50
  * Provides common documentation:
48
51
  ** README
49
52
  ** CHANGES
50
- ** CONTRIBUTING
51
53
  ** CODE OF CONDUCT
54
+ ** CONTRIBUTING
52
55
  ** LICENSE
53
56
 
54
57
  // == Screencasts
@@ -86,23 +89,30 @@ USAGE:
86
89
  -v, --version Show gem version.
87
90
 
88
91
  BUILD OPTIONS:
89
- --[no-]amazing_print Add Amazing Print.
90
- --[no-]bundler-leak Add Bundler Leak.
91
- --[no-]console Add console script.
92
- --[no-]documentation Add documentation.
93
- --[no-]git Add Git.
94
- --[no-]git-lint Add Git Lint.
95
- --[no-]guard Add Guard.
96
- --min Use minimum/no options.
97
- --[no-]pry Add Pry.
98
- --[no-]rake Add Rake.
99
- --[no-]reek Add Reek.
100
- --[no-]refinements Add Refinements.
101
- --[no-]rspec Add RSpec.
102
- --[no-]rubocop Add Rubocop.
103
- --[no-]setup Add setup script.
104
- --[no-]simple_cov Add SimpleCov.
105
- --[no-]zeitwerk Add Zeitwerk.
92
+ --[no-]amazing_print Add Amazing Print gem. Default: true.
93
+ --[no-]bundler-leak Add Bundler Leak gem. Default: true.
94
+ --[no-]changes Add CHANGES documentation. Default: true.
95
+ --[no-]circle_ci Add Circle CI configuration and badge. Default: false.
96
+ --[no-]conduct Add CODE_OF_CONDUCT documentation. Default: true.
97
+ --[no-]console Add console script. Default: true.
98
+ --[no-]contributions Add CONTRIBUTING documentation. Default: true.
99
+ --[no-]debug Add Debug gem. Default: true.
100
+ --[no-]git Add Git. Default: true.
101
+ --[no-]git_hub Add GitHub templates. Default: false.
102
+ --[no-]git-lint Add Git Lint gem. Default: true.
103
+ --[no-]guard Add Guard gem. Default: true.
104
+ --[no-]license Add LICENSE documentation. Default: true.
105
+ --max Use maximum/enabled options. Default: false.
106
+ --min Use minimum/disabled options. Default: false.
107
+ --[no-]rake Add Rake gem. Default: true.
108
+ --[no-]readme Add README documentation. Default: true.
109
+ --[no-]reek Add Reek gem. Default: true.
110
+ --[no-]refinements Add Refinements gem. Default: true.
111
+ --[no-]rspec Add RSpec gem. Default: true.
112
+ --[no-]rubocop Add Rubocop gems. Default: true.
113
+ --[no-]setup Add setup script. Default: true.
114
+ --[no-]simple_cov Add SimpleCov gem. Default: true.
115
+ --[no-]zeitwerk Add Zeitwerk gem. Default: true.
106
116
  ....
107
117
 
108
118
  === Building
@@ -120,12 +130,12 @@ to disable specific options, you can use the `--no-*` prefix. Example:
120
130
 
121
131
  [source,bash]
122
132
  ----
123
- rubysmith --build demo --no-pry --no-guard
133
+ rubysmith --build demo --no-debug --no-guard
124
134
  ----
125
135
 
126
- With the above example, both Pry and Guard support would have been disabled when building the `demo`
127
- project. Taking this a step further, you can also use the `--min` option to generate a project with
128
- bare minimum of options. Example:
136
+ With the above example, both Debug and Guard support would have been disabled when building the
137
+ `demo` project. Taking this a step further, you can also use the `--min` option to generate a
138
+ project with bare minimum of options. Example:
129
139
 
130
140
  [source,bash]
131
141
  ----
@@ -136,8 +146,20 @@ The above is essentially the same as building with _all_ options disabled. This
136
146
  situations where you need to quickly script something up for sharing with others yet still want to
137
147
  avoid using a Bundler Inline script so gem dependencies are not installed each time the code is run.
138
148
 
139
- To have specific options enabled/disabled _every time_ you build a new Ruby project, you can edit
140
- your global configuration for making these settings permanent (see below for details).
149
+ As shown earlier, you can combine options but be aware that order matters. Take the following, for
150
+ example, where both minimum and maximum options are used in conjunction with other options:
151
+
152
+ [source,bash]
153
+ ----
154
+ rubysmith --build demo --min --zeitwerk
155
+ rubysmith --build demo --max --no-debug
156
+ ----
157
+
158
+ With the above examples, the first line will _disable_ all options except for Zeitwerk while the
159
+ second line will _enable_ all options except for Debug. This can be a handy way to build a new
160
+ project with all options either disabled or enabled with only a few select options modified. To have
161
+ specific options enabled/disabled _every time_ you build a new Ruby project, you can edit your
162
+ global configuration for making these settings permanent (see below for details).
141
163
 
142
164
  === Configuration
143
165
 
@@ -148,9 +170,7 @@ $HOME/.config/rubysmith/configuration.yml
148
170
  ....
149
171
 
150
172
  It can also be configured via link:https://www.alchemists.io/projects/xdg[XDG] environment
151
- variables.
152
-
153
- The default configuration is as follows:
173
+ variables. The default configuration is as follows:
154
174
 
155
175
  [source,yaml]
156
176
  ----
@@ -158,20 +178,24 @@ The default configuration is as follows:
158
178
  :name:
159
179
  :email:
160
180
  :url:
161
- :documentation:
162
- :format: "md"
163
- :license: "mit"
164
181
  :build:
165
182
  :amazing_print: true
166
183
  :bundler_leak: true
184
+ :changes: true
185
+ :circle_ci: false
186
+ :conduct: true
167
187
  :console: true
168
- :documentation: true
188
+ :contributions: true
189
+ :debug: true
169
190
  :git: true
191
+ :git_hub: false
170
192
  :git_lint: true
171
193
  :guard: true
194
+ :license: true
195
+ :maximum: false
172
196
  :minimum: false
173
- :pry: true
174
197
  :rake: true
198
+ :readme: true
175
199
  :reek: true
176
200
  :refinements: true
177
201
  :rspec: true
@@ -191,11 +215,55 @@ The default configuration is as follows:
191
215
  - "**/*Gemfile"
192
216
  - "**/*Guardfile"
193
217
  - "**/*Rakefile"
218
+ :documentation:
219
+ :format: "md"
220
+ :license: "mit"
221
+ :git_hub:
222
+ :user:
194
223
  ----
195
224
 
196
225
  Feel free to take this default configuration, modify, and save as your own custom
197
226
  `configuration.yml`.
198
227
 
228
+ ==== Author
229
+
230
+ Author information is used when generating project documentation and is recommended you fill this
231
+ information in before building a project. Example:
232
+
233
+ :author:
234
+ :name: Jill Smith
235
+ :email: jsmith@example.com
236
+ :url: https://www.exmaple.com/team/jsmith
237
+
238
+ ==== Build
239
+
240
+ Build options are booleans so can only be `true` or `false` by default. Should you want a different
241
+ configuration than what is enabled/disabled by default, you'll want to customize these options as
242
+ you see fit. When changing build options, they will dynamically show up when viewing usage (i.e.
243
+ `rubysmith --help`).
244
+
245
+ ==== Builders
246
+
247
+ Builders are additional tooling which can be configured specifically for Rubysmith. At the moment,
248
+ only link:https://www.alchemists.io/projects/pragmater[Pragmater] is supported so view the Pragmater
249
+ project page to learn more.
250
+
251
+ ==== Documentation
252
+
253
+ Documentation can be configured as follows:
254
+
255
+ * *Format*: Use `md` for Markdown or `adoc` for ASCCI Doc.
256
+ * *License*: Use `mit` for MIT or `Apache` for Apache 2.0.0 license.
257
+
258
+ No other licenses are supported at this time but might be expanded up on in the future.
259
+
260
+ ==== GitHub
261
+
262
+ Your GitHub user is whatever handle you setup when you creating your GitHub account. This
263
+ information is used for documentation purposes and Circle CI badge association. If you don't define
264
+ this information, Rubysmith will automatically fallback to pulling this information from your Git
265
+ configuration (i.e. `github.user`). If all else fails, then nothing will be used.
266
+
199
267
  == Development
200
268
 
201
269
  To contribute, run:
@@ -10,20 +10,14 @@ module Rubysmith
10
10
  class Builder
11
11
  using Refinements::Pathnames
12
12
 
13
- LOGGER = Logger.new(STDOUT, formatter: ->(_severity, _at, _program, message) { "#{message}\n" })
14
-
15
- HELPERS = {
16
- inserter: Text::Inserter,
17
- renderer: Renderers::ERB,
18
- kernel: Open3,
19
- logger: LOGGER
20
- }.freeze
13
+ HELPERS = {inserter: Text::Inserter, renderer: Renderers::ERB, kernel: Open3}.freeze
21
14
 
22
15
  def self.call(...) = new(...)
23
16
 
24
- def initialize configuration, helpers: HELPERS
17
+ def initialize configuration, helpers: HELPERS, container: Container
25
18
  @configuration = configuration
26
19
  @helpers = helpers
20
+ @container = container
27
21
  end
28
22
 
29
23
  def append content
@@ -94,13 +88,13 @@ module Rubysmith
94
88
 
95
89
  def touch
96
90
  logger.info "Touching: #{relative_build_path}"
97
- build_path.make_ancestors.touch
91
+ build_path.deep_touch
98
92
  self
99
93
  end
100
94
 
101
95
  private
102
96
 
103
- attr_reader :configuration, :helpers
97
+ attr_reader :configuration, :helpers, :container
104
98
 
105
99
  def execute *command
106
100
  kernel.capture2e(*command).then do |result, status|
@@ -114,9 +108,9 @@ module Rubysmith
114
108
 
115
109
  def kernel = helpers.fetch(__method__)
116
110
 
117
- def logger = helpers.fetch(__method__)
111
+ def logger = container[__method__]
118
112
 
119
- def relative_build_path = build_path.relative_path_from(configuration.build_root)
113
+ def relative_build_path = build_path.relative_path_from(configuration.target_root)
120
114
 
121
115
  def build_path
122
116
  pathway.end_path
@@ -25,7 +25,7 @@ module Rubysmith
25
25
  .replace(/\n\s+gem/, "\n gem")
26
26
  .replace(/ (?=.+(refinements|zeitwerk))/, "")
27
27
  .replace(/(\n+|\s+)end/, "\nend")
28
- .replace(/\n\ngroup :(code_quality|test|tools) do\nend/, "")
28
+ .replace(/\n\ngroup :(code_quality|development|test|tools) do\nend/, "")
29
29
  .replace(/org"\n+/, "org\"\n\n")
30
30
 
31
31
  configuration.project_root.change_dir { client.start %w[install --quiet] }
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rubysmith
4
+ module Builders
5
+ # Builds project skeleton Circle CI configuration.
6
+ class CircleCI
7
+ def self.call(...) = new(...).call
8
+
9
+ def initialize configuration, builder: Builder
10
+ @configuration = configuration
11
+ @builder = builder
12
+ end
13
+
14
+ def call
15
+ return unless configuration.build_circle_ci
16
+
17
+ builder.call(configuration.with(template_path: "%project_name%/.circleci/config.yml.erb"))
18
+ .render
19
+ end
20
+
21
+ private
22
+
23
+ attr_reader :configuration, :builder
24
+ end
25
+ end
26
+ end
@@ -14,7 +14,9 @@ module Rubysmith
14
14
  def call
15
15
  builder.call(configuration.with(template_path: "%project_name%/lib/%project_path%.rb.erb"))
16
16
  .render
17
- .replace(/ (?!(module|end))/, "")
17
+ .replace(" require", "require")
18
+ .replace(/ (?=(Zeit|\.tap|\.setup))/, "")
19
+ .replace("\n \n", "\n\n")
18
20
 
19
21
  builder.call(configuration.with(template_path: "%project_name%/.ruby-version.erb")).render
20
22
  nil
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "tocer"
4
+
5
+ module Rubysmith
6
+ module Builders
7
+ module Documentation
8
+ # Builds project skeleton CHANGES documentation.
9
+ class Change
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_changes
19
+
20
+ builder.call(configuration.with(template_path: "%project_name%/CHANGES.#{kind}.erb"))
21
+ .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
@@ -0,0 +1,32 @@
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
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "tocer"
4
+
5
+ module Rubysmith
6
+ module Builders
7
+ module Documentation
8
+ # Builds project skeleton CONTRIBUTING documentation.
9
+ class Contribution
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_contributions
19
+
20
+ builder.call(configuration.with(template_path: "%project_name%/CONTRIBUTING.#{kind}.erb"))
21
+ .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
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "tocer"
4
+
5
+ module Rubysmith
6
+ module Builders
7
+ module Documentation
8
+ # Builds project skeleton LICENSE documentation.
9
+ class License
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_license
19
+
20
+ configuration.with(template_path: "%project_name%/LICENSE-#{license}.#{kind}.erb")
21
+ .then do |updated_configuration|
22
+ builder.call(updated_configuration).render.rename "LICENSE.#{kind}"
23
+ end
24
+ end
25
+
26
+ private
27
+
28
+ attr_reader :configuration, :builder
29
+
30
+ def kind = configuration.documentation_format || "md"
31
+
32
+ def license = configuration.documentation_license || "mit"
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "tocer"
4
+
5
+ module Rubysmith
6
+ module Builders
7
+ module Documentation
8
+ # Builds project skeleton README documentation.
9
+ class Readme
10
+ def self.call(...) = new(...).call
11
+
12
+ def initialize configuration, builder: Builder, tocer: Tocer::Writer.new
13
+ @configuration = configuration
14
+ @builder = builder
15
+ @tocer = tocer
16
+ end
17
+
18
+ def call
19
+ return unless configuration.build_readme
20
+
21
+ private_methods.sort.grep(/render_/).each { |method| __send__ method }
22
+ end
23
+
24
+ private
25
+
26
+ attr_reader :configuration, :builder, :tocer
27
+
28
+ def render_content
29
+ builder.call(configuration.with(template_path: "%project_name%/README.#{kind}.erb"))
30
+ .render
31
+ .replace("\n\n\n", "\n\n")
32
+ end
33
+
34
+ def render_table_of_contents
35
+ configuration.project_root
36
+ .join("README.md")
37
+ .then { |path| tocer.call path if path.exist? }
38
+ end
39
+
40
+ def kind = configuration.documentation_format || "md"
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rubysmith
4
+ module Builders
5
+ # Builds project skeleton GitHub templates.
6
+ class GitHub
7
+ def self.call(...) = new(...).call
8
+
9
+ def initialize configuration, builder: Builder
10
+ @configuration = configuration
11
+ @builder = builder
12
+ end
13
+
14
+ def call
15
+ return unless configuration.build_git_hub
16
+
17
+ builder.call(with_issue_template).render
18
+ builder.call(with_pull_request_template).render
19
+ end
20
+
21
+ private
22
+
23
+ attr_reader :configuration, :builder
24
+
25
+ def with_issue_template
26
+ configuration.with template_path: "%project_name%/.github/ISSUE_TEMPLATE.md.erb"
27
+ end
28
+
29
+ def with_pull_request_template
30
+ configuration.with template_path: "%project_name%/.github/PULL_REQUEST_TEMPLATE.md.erb"
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rubysmith
4
+ module CLI
5
+ module Actions
6
+ # Handles the build action.
7
+ class Build
8
+ # Order is important.
9
+ BUILDERS = [
10
+ Builders::Core,
11
+ Builders::Documentation::Readme,
12
+ Builders::Documentation::Change,
13
+ Builders::Documentation::Conduct,
14
+ Builders::Documentation::Contribution,
15
+ Builders::Documentation::License,
16
+ Builders::Git::Setup,
17
+ Builders::Bundler,
18
+ Builders::Rake,
19
+ Builders::Console,
20
+ Builders::CircleCI,
21
+ Builders::Setup,
22
+ Builders::GitHub,
23
+ Builders::Guard,
24
+ Builders::Reek,
25
+ Builders::RSpec::Context,
26
+ Builders::RSpec::Helper,
27
+ Builders::Pragma,
28
+ Builders::Rubocop::Setup,
29
+ Builders::Rubocop::Formatter,
30
+ Builders::Git::Commit
31
+ ].freeze
32
+
33
+ def initialize builders: BUILDERS, container: Container
34
+ @builders = builders
35
+ @container = container
36
+ end
37
+
38
+ def call = builders.each { |builder| builder.call configuration }
39
+
40
+ private
41
+
42
+ attr_reader :builders, :container
43
+
44
+ def configuration = container[__method__]
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rubysmith
4
+ module CLI
5
+ module Actions
6
+ # Handles the config action.
7
+ class Config
8
+ def initialize client: CLI::Configuration::Loader::CLIENT, container: Container
9
+ @client = client
10
+ @container = container
11
+ end
12
+
13
+ def call selection
14
+ case selection
15
+ when :edit then edit
16
+ when :view then view
17
+ else fail StandardError, "Invalid configuration selection: #{selection}."
18
+ end
19
+ end
20
+
21
+ private
22
+
23
+ attr_reader :client, :container
24
+
25
+ def edit = kernel.system("$EDITOR #{client.current}")
26
+
27
+ def view = kernel.system("cat #{client.current}")
28
+
29
+ def kernel = container[__method__]
30
+ end
31
+ end
32
+ end
33
+ end