rubysmith 0.12.0 → 0.16.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 (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
@@ -1,56 +1,45 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "refinements/hashes"
4
-
5
3
  module Rubysmith
6
4
  module CLI
7
5
  # The main Command Line Interface (CLI) object.
8
6
  class Shell
9
- using Refinements::Hashes
10
-
11
- PROCESSORS = {
12
- config: Processors::Config.new,
13
- build_minimum: Processors::Build.with_minimum,
14
- build_maximum: Processors::Build.new
15
- }.freeze
7
+ ACTIONS = {config: Actions::Config.new, build: Actions::Build.new}.freeze
16
8
 
17
- def initialize parser: Parsers::Assembler.new, processors: PROCESSORS
9
+ def initialize parser: Parsers::Assembler.new, actions: ACTIONS, container: Container
18
10
  @parser = parser
19
- @processors = processors
11
+ @actions = actions
12
+ @container = container
20
13
  end
21
14
 
22
15
  def call arguments = []
23
- parse arguments
24
-
25
- case options
26
- in config: Symbol => action then process_config action
27
- in build_minimum: true then process_build :build_minimum, options
28
- in build: then process_build :build_maximum, options
29
- in version: String => version then puts version
16
+ case parse arguments
17
+ in action_config: Symbol => action then config action
18
+ in action_build: true then build
19
+ in action_version: true then logger.info configuration.version
30
20
  else usage
31
21
  end
32
22
  end
33
23
 
34
24
  private
35
25
 
36
- attr_reader :parser, :processors
26
+ attr_reader :parser, :actions, :container
37
27
 
38
28
  def parse arguments = []
39
29
  parser.call arguments
40
30
  rescue StandardError => error
41
- puts error.message
31
+ logger.error error.message
42
32
  end
43
33
 
44
- def process_config(action) = processors.fetch(:config).call(action)
34
+ def config(action) = actions.fetch(__method__).call(action)
45
35
 
46
- def process_build kind, settings
47
- processors.fetch(kind).call settings.transform_keys(build: :project_name)
48
- .merge(now: Time.now)
49
- end
36
+ def build = actions.fetch(__method__).call
37
+
38
+ def usage = logger.unknown(parser.to_s)
50
39
 
51
- def options = parser.to_h
40
+ def configuration = container[__method__]
52
41
 
53
- def usage = puts(parser.to_s)
42
+ def logger = container[__method__]
54
43
  end
55
44
  end
56
45
  end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "dry-container"
4
+ require "logger"
5
+ require "pastel"
6
+
7
+ module Rubysmith
8
+ # Provides a global gem container for injection into other objects.
9
+ module Container
10
+ extend Dry::Container::Mixin
11
+
12
+ register(:configuration, memoize: true) { CLI::Configuration::Loader.call }
13
+ register(:colorizer) { Pastel.new enabled: $stdout.tty? }
14
+ register(:kernel) { Kernel }
15
+
16
+ register :log_colors do
17
+ {
18
+ "DEBUG" => self[:colorizer].white.detach,
19
+ "INFO" => self[:colorizer].green.detach,
20
+ "WARN" => self[:colorizer].yellow.detach,
21
+ "ERROR" => self[:colorizer].red.detach,
22
+ "FATAL" => self[:colorizer].white.bold.on_red.detach,
23
+ "ANY" => self[:colorizer].white.bold.detach
24
+ }
25
+ end
26
+
27
+ register :logger do
28
+ Logger.new $stdout,
29
+ level: Logger.const_get(ENV.fetch("LOG_LEVEL", "INFO")),
30
+ formatter: (
31
+ lambda do |severity, _at, _name, message|
32
+ self[:log_colors][severity].call "#{message}\n"
33
+ end
34
+ )
35
+ end
36
+ end
37
+ end
@@ -4,7 +4,7 @@ module Rubysmith
4
4
  module Identity
5
5
  NAME = "rubysmith"
6
6
  LABEL = "Rubysmith"
7
- VERSION = "0.12.0"
7
+ VERSION = "0.16.0"
8
8
  VERSION_LABEL = "#{LABEL} #{VERSION}".freeze
9
9
  SUMMARY = "A command line interface for smithing Ruby projects."
10
10
  end
@@ -0,0 +1,31 @@
1
+ version: 2.1
2
+ jobs:
3
+ build:
4
+ working_directory: ~/project
5
+ docker:
6
+ - image: bkuhlmann/alpine-ruby:latest
7
+ steps:
8
+ - checkout
9
+
10
+ - restore_cache:
11
+ name: Bundler Restore
12
+ keys:
13
+ - gem-cache-{{.Branch}}-{{checksum "Gemfile.lock"}}
14
+ - gem-cache-
15
+
16
+ - run:
17
+ name: Bundler Install
18
+ command: |
19
+ gem update --system
20
+ bundle config set path "vendor/bundle"
21
+ bundle install
22
+
23
+ - save_cache:
24
+ name: Bundler Store
25
+ key: gem-cache-{{.Branch}}-{{checksum "Gemfile.lock"}}
26
+ paths:
27
+ - vendor/bundle
28
+
29
+ - run:
30
+ name: Build
31
+ command: bundle exec rake
@@ -0,0 +1,14 @@
1
+ ## Overview
2
+ <!-- Required. Describe, briefly, the behavior experienced. -->
3
+
4
+ ## Screenshots/Screencasts
5
+ <!-- Optional. Attach screenshot(s) and/or screencast(s) that demo the behavior. -->
6
+
7
+ ## Steps to Recreate
8
+ <!-- Required. List exact steps (numbered list) to reproduce errant behavior. -->
9
+
10
+ ## Desired Behavior
11
+ <!-- Required. Describe the behavior you'd like to see or your idea of a proposed solution. -->
12
+
13
+ ## Environment
14
+ <!-- Required. What is your operating system, software version(s), etc. -->
@@ -0,0 +1,8 @@
1
+ ## Overview
2
+ <!-- Required. Why is this important/necessary and what is the overarching architecture. -->
3
+
4
+ ## Screenshots/Screencasts
5
+ <!-- Optional. Provide supporting image/video. -->
6
+
7
+ ## Details
8
+ <!-- Optional. List the key features/highlights as bullet points. -->
@@ -2,59 +2,59 @@ ruby File.read(".ruby-version").strip
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- <% unless configuration.build_minimum %>
6
- <% if configuration.build_refinements %>
7
- gem "refinements", "~> 8.0"
5
+ <% if configuration.build_refinements %>
6
+ gem "refinements", "~> 8.5"
7
+ <% end %>
8
+ <% if configuration.build_zeitwerk %>
9
+ gem "zeitwerk", "~> 2.5"
10
+ <% end %>
11
+
12
+ group :code_quality do
13
+ <% if configuration.build_bundler_leak %>
14
+ gem "bundler-leak", "~> 0.2"
8
15
  <% end %>
9
- <% if configuration.build_zeitwerk %>
10
- gem "zeitwerk", "~> 2.4"
16
+ <% if configuration.build_git && configuration.build_git_lint %>
17
+ gem "git-lint", "~> 2.0"
11
18
  <% end %>
19
+ <% if configuration.build_reek %>
20
+ gem "reek", "~> 6.0"
21
+ <% end %>
22
+ <% if configuration.build_rubocop %>
23
+ gem "rubocop", "~> 1.20"
24
+ gem "rubocop-performance", "~> 1.11"
25
+ gem "rubocop-rake", "~> 0.6"
26
+ <% end %>
27
+ <% if configuration.build_rspec && configuration.build_rubocop %>
28
+ gem "rubocop-rspec", "~> 2.4"
29
+ <% end %>
30
+ <% if configuration.build_simple_cov %>
31
+ gem "simplecov", "~> 0.20"
32
+ <% end %>
33
+ end
12
34
 
13
- group :code_quality do
14
- <% if configuration.build_bundler_leak %>
15
- gem "bundler-leak", "~> 0.2"
16
- <% end %>
17
- <% if configuration.build_git && configuration.build_git_lint %>
18
- gem "git-lint", "~> 2.0"
19
- <% end %>
20
- <% if configuration.build_reek %>
21
- gem "reek", "~> 6.0"
22
- <% end %>
23
- <% if configuration.build_rubocop %>
24
- gem "rubocop", "~> 1.20"
25
- gem "rubocop-performance", "~> 1.11"
26
- gem "rubocop-rake", "~> 0.6"
27
- <% end %>
28
- <% if configuration.build_rspec && configuration.build_rubocop %>
29
- gem "rubocop-rspec", "~> 2.4"
30
- <% end %>
31
- <% if configuration.build_simple_cov %>
32
- gem "simplecov", "~> 0.20"
33
- <% end %>
34
- end
35
-
35
+ group :development do
36
36
  <% if configuration.build_rake %>
37
- group :development do
38
- gem "rake", "~> 13.0"
39
- end
37
+ gem "rake", "~> 13.0"
38
+ <% end %>
39
+ <% if configuration.markdown? %>
40
+ gem "tocer", "~> 12.1"
40
41
  <% end %>
42
+ end
41
43
 
42
- group :test do
43
- <% if configuration.build_guard %>
44
- gem "guard-rspec", "~> 4.7", require: false
45
- <% end %>
46
- <% if configuration.build_rspec %>
47
- gem "rspec", "~> 3.10"
48
- <% end %>
49
- end
44
+ group :test do
45
+ <% if configuration.build_guard %>
46
+ gem "guard-rspec", "~> 4.7", require: false
47
+ <% end %>
48
+ <% if configuration.build_rspec %>
49
+ gem "rspec", "~> 3.10"
50
+ <% end %>
51
+ end
50
52
 
51
- group :tools do
52
- <% if configuration.build_amazing_print %>
53
- gem "amazing_print", "~> 1.3"
54
- <% end %>
55
- <% if configuration.build_pry %>
56
- gem "pry", "~> 0.13"
57
- gem "pry-byebug", "~> 3.9"
58
- <% end %>
59
- end
60
- <% end %>
53
+ group :tools do
54
+ <% if configuration.build_amazing_print %>
55
+ gem "amazing_print", "~> 1.3"
56
+ <% end %>
57
+ <% if configuration.build_debug %>
58
+ gem "debug", "~> 1.1"
59
+ <% end %>
60
+ end
@@ -8,6 +8,10 @@
8
8
  [link=https://www.alchemists.io/projects/code_quality]
9
9
  image::https://img.shields.io/badge/code_style-alchemists-brightgreen.svg[Alchemists Style Guide]
10
10
  <% end %>
11
+ <% if configuration.build_circle_ci %>
12
+ [link=https://circleci.com/gh/<%= configuration.git_hub_user %>/<%= configuration.project_name %>]
13
+ image::https://circleci.com/gh/<%= configuration.git_hub_user %>/<%= configuration.project_name %>.svg?style=svg[Circle CI Status]
14
+ <% end %>
11
15
 
12
16
  toc::[]
13
17
 
@@ -3,6 +3,9 @@
3
3
  <% if configuration.build_rubocop %>
4
4
  [![Alchemists Style Guide](https://img.shields.io/badge/code_style-alchemists-brightgreen.svg)](https://www.alchemists.io/projects/code_quality)
5
5
  <% end %>
6
+ <% if configuration.build_circle_ci %>
7
+ [![Circle CI Status](https://circleci.com/gh/<%= configuration.git_hub_user %>/<%= configuration.project_name %>.svg?style=svg)](https://circleci.com/gh/<%= configuration.git_hub_user %>/<%= configuration.project_name %>)
8
+ <% end %>
6
9
 
7
10
  <!-- Tocer[start]: Auto-generated, don't remove. -->
8
11
  <!-- Tocer[finish]: Auto-generated, don't remove. -->
@@ -1,12 +1,11 @@
1
1
  <% if configuration.build_zeitwerk %>
2
2
  require "zeitwerk"
3
3
  <% if configuration.project_path.include? "/" %>
4
- loader = Zeitwerk::Loader.new
5
- loader.push_dir "#{__dir__}/.."
6
- loader.setup
4
+ Zeitwerk::Loader.new
5
+ .tap { |loader| loader.push_dir "#{__dir__}/.." }
6
+ .setup
7
7
  <% else %>
8
- loader = Zeitwerk::Loader.for_gem
9
- loader.setup
8
+ Zeitwerk::Loader.for_gem.setup
10
9
  <% end %>
11
10
  <% end %>
12
11
  # Main namespace.
@@ -11,9 +11,6 @@ require "<%= configuration.project_path %>"
11
11
  require "refinements"
12
12
  <% end %>
13
13
 
14
- GC.auto_compact = true
15
- GC.verify_compaction_references double_heap: true, toward: :empty
16
-
17
14
  <% if configuration.build_refinements %>
18
15
  using Refinements::Pathnames
19
16
 
data/lib/rubysmith.rb CHANGED
@@ -2,9 +2,13 @@
2
2
 
3
3
  require "zeitwerk"
4
4
 
5
- loader = Zeitwerk::Loader.for_gem
6
- loader.inflector.inflect "cli" => "CLI", "erb" => "ERB", "rspec" => "RSpec"
7
- loader.setup
5
+ Zeitwerk::Loader.for_gem.then do |loader|
6
+ loader.inflector.inflect "cli" => "CLI",
7
+ "circle_ci" => "CircleCI",
8
+ "erb" => "ERB",
9
+ "rspec" => "RSpec"
10
+ loader.setup
11
+ end
8
12
 
9
13
  # Main namespace.
10
14
  module Rubysmith
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.12.0
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -28,8 +28,50 @@ cert_chain:
28
28
  lkHilIrX69jq8wMPpBhlaw2mRmeSL50Wv5u6xVBvOHhXFSP1crXM95vfLhLyRYod
29
29
  W2A=
30
30
  -----END CERTIFICATE-----
31
- date: 2021-09-06 00:00:00.000000000 Z
31
+ date: 2021-10-21 00:00:00.000000000 Z
32
32
  dependencies:
33
+ - !ruby/object:Gem::Dependency
34
+ name: dry-container
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '0.9'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '0.9'
47
+ - !ruby/object:Gem::Dependency
48
+ name: git_plus
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '0.6'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '0.6'
61
+ - !ruby/object:Gem::Dependency
62
+ name: pastel
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '0.8'
68
+ type: :runtime
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '0.8'
33
75
  - !ruby/object:Gem::Dependency
34
76
  name: pragmater
35
77
  requirement: !ruby/object:Gem::Requirement
@@ -50,14 +92,14 @@ dependencies:
50
92
  requirements:
51
93
  - - "~>"
52
94
  - !ruby/object:Gem::Version
53
- version: '8.0'
95
+ version: '8.5'
54
96
  type: :runtime
55
97
  prerelease: false
56
98
  version_requirements: !ruby/object:Gem::Requirement
57
99
  requirements:
58
100
  - - "~>"
59
101
  - !ruby/object:Gem::Version
60
- version: '8.0'
102
+ version: '8.5'
61
103
  - !ruby/object:Gem::Dependency
62
104
  name: rubocop
63
105
  requirement: !ruby/object:Gem::Requirement
@@ -86,20 +128,34 @@ dependencies:
86
128
  - - "~>"
87
129
  - !ruby/object:Gem::Version
88
130
  version: '7.0'
131
+ - !ruby/object:Gem::Dependency
132
+ name: tocer
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - "~>"
136
+ - !ruby/object:Gem::Version
137
+ version: '12.1'
138
+ type: :runtime
139
+ prerelease: false
140
+ version_requirements: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - "~>"
143
+ - !ruby/object:Gem::Version
144
+ version: '12.1'
89
145
  - !ruby/object:Gem::Dependency
90
146
  name: zeitwerk
91
147
  requirement: !ruby/object:Gem::Requirement
92
148
  requirements:
93
149
  - - "~>"
94
150
  - !ruby/object:Gem::Version
95
- version: '2.4'
151
+ version: '2.5'
96
152
  type: :runtime
97
153
  prerelease: false
98
154
  version_requirements: !ruby/object:Gem::Requirement
99
155
  requirements:
100
156
  - - "~>"
101
157
  - !ruby/object:Gem::Version
102
- version: '2.4'
158
+ version: '2.5'
103
159
  description:
104
160
  email:
105
161
  - brooke@alchemists.io
@@ -116,11 +172,17 @@ files:
116
172
  - lib/rubysmith.rb
117
173
  - lib/rubysmith/builder.rb
118
174
  - lib/rubysmith/builders/bundler.rb
175
+ - lib/rubysmith/builders/circle_ci.rb
119
176
  - lib/rubysmith/builders/console.rb
120
177
  - lib/rubysmith/builders/core.rb
121
- - lib/rubysmith/builders/documentation.rb
178
+ - lib/rubysmith/builders/documentation/change.rb
179
+ - lib/rubysmith/builders/documentation/conduct.rb
180
+ - lib/rubysmith/builders/documentation/contribution.rb
181
+ - lib/rubysmith/builders/documentation/license.rb
182
+ - lib/rubysmith/builders/documentation/readme.rb
122
183
  - lib/rubysmith/builders/git/commit.rb
123
184
  - lib/rubysmith/builders/git/setup.rb
185
+ - lib/rubysmith/builders/git_hub.rb
124
186
  - lib/rubysmith/builders/guard.rb
125
187
  - lib/rubysmith/builders/pragma.rb
126
188
  - lib/rubysmith/builders/rake.rb
@@ -130,20 +192,27 @@ files:
130
192
  - lib/rubysmith/builders/rubocop/formatter.rb
131
193
  - lib/rubysmith/builders/rubocop/setup.rb
132
194
  - lib/rubysmith/builders/setup.rb
195
+ - lib/rubysmith/cli/actions/build.rb
196
+ - lib/rubysmith/cli/actions/config.rb
133
197
  - lib/rubysmith/cli/configuration/content.rb
134
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
135
202
  - lib/rubysmith/cli/configuration/loader.rb
136
203
  - lib/rubysmith/cli/parsers.rb
137
204
  - lib/rubysmith/cli/parsers/assembler.rb
138
205
  - lib/rubysmith/cli/parsers/build.rb
139
206
  - lib/rubysmith/cli/parsers/core.rb
140
- - lib/rubysmith/cli/processors/build.rb
141
- - lib/rubysmith/cli/processors/config.rb
142
207
  - lib/rubysmith/cli/shell.rb
208
+ - lib/rubysmith/container.rb
143
209
  - lib/rubysmith/identity.rb
144
210
  - lib/rubysmith/pathway.rb
145
211
  - lib/rubysmith/renderers/erb.rb
146
212
  - lib/rubysmith/renderers/namespace.rb
213
+ - lib/rubysmith/templates/%project_name%/.circleci/config.yml.erb
214
+ - lib/rubysmith/templates/%project_name%/.github/ISSUE_TEMPLATE.md.erb
215
+ - lib/rubysmith/templates/%project_name%/.github/PULL_REQUEST_TEMPLATE.md.erb
147
216
  - lib/rubysmith/templates/%project_name%/.reek.yml.erb
148
217
  - lib/rubysmith/templates/%project_name%/.rubocop.yml.erb
149
218
  - lib/rubysmith/templates/%project_name%/.ruby-version.erb
@@ -193,7 +262,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
262
  - !ruby/object:Gem::Version
194
263
  version: '0'
195
264
  requirements: []
196
- rubygems_version: 3.2.27
265
+ rubygems_version: 3.2.29
197
266
  signing_key:
198
267
  specification_version: 4
199
268
  summary: A command line interface for smithing Ruby projects.
metadata.gz.sig CHANGED
Binary file
@@ -1,57 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Rubysmith
4
- module Builders
5
- # Builds project skeleton documentation.
6
- class Documentation
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_documentation
16
-
17
- private_methods.sort.grep(/render_/).each { |method| __send__ method }
18
- end
19
-
20
- private
21
-
22
- attr_reader :configuration, :builder
23
-
24
- def render_changes
25
- builder.call(configuration.with(template_path: "%project_name%/CHANGES.#{kind}.erb"))
26
- .render
27
- end
28
-
29
- def render_conduct
30
- configuration.with(template_path: "%project_name%/CODE_OF_CONDUCT.#{kind}.erb")
31
- .then { |updated_configuration| builder.call(updated_configuration).render }
32
- end
33
-
34
- def render_contributions
35
- builder.call(configuration.with(template_path: "%project_name%/CONTRIBUTING.#{kind}.erb"))
36
- .render
37
- end
38
-
39
- def render_license
40
- configuration.with(template_path: "%project_name%/LICENSE-#{license}.#{kind}.erb")
41
- .then do |updated_configuration|
42
- builder.call(updated_configuration).render.rename "LICENSE.#{kind}"
43
- end
44
- end
45
-
46
- def render_readme
47
- builder.call(configuration.with(template_path: "%project_name%/README.#{kind}.erb"))
48
- .render
49
- .replace("\n\n\n", "\n\n")
50
- end
51
-
52
- def kind = configuration.documentation_format || "md"
53
-
54
- def license = configuration.documentation_license || "mit"
55
- end
56
- end
57
- end
@@ -1,56 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "refinements/structs"
4
-
5
- module Rubysmith
6
- module CLI
7
- module Processors
8
- # Handles the Command Line Interface (CLI) for building of a project skeleton.
9
- class Build
10
- using Refinements::Structs
11
-
12
- # Order is important.
13
- MINIMUM = [
14
- Builders::Core,
15
- Builders::Bundler,
16
- Builders::Pragma,
17
- Builders::Rubocop::Formatter
18
- ].freeze
19
-
20
- # Order is important.
21
- MAXIMUM = [
22
- Builders::Core,
23
- Builders::Documentation,
24
- Builders::Git::Setup,
25
- Builders::Bundler,
26
- Builders::Rake,
27
- Builders::Console,
28
- Builders::Setup,
29
- Builders::Guard,
30
- Builders::Reek,
31
- Builders::RSpec::Context,
32
- Builders::RSpec::Helper,
33
- Builders::Pragma,
34
- Builders::Rubocop::Setup,
35
- Builders::Rubocop::Formatter,
36
- Builders::Git::Commit
37
- ].freeze
38
-
39
- def self.with_minimum = new(builders: MINIMUM)
40
-
41
- def initialize configuration: Configuration::Loader.call, builders: MAXIMUM
42
- @configuration = configuration
43
- @builders = builders
44
- end
45
-
46
- def call(options) = configuration.merge(**options).then { |config| process config }
47
-
48
- private
49
-
50
- attr_reader :configuration, :builders
51
-
52
- def process(config) = builders.each { |builder| builder.call config }
53
- end
54
- end
55
- end
56
- end
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Rubysmith
4
- module CLI
5
- module Processors
6
- # Handles the Command Line Interface (CLI) configuration processing.
7
- class Config
8
- def initialize configuration: CLI::Configuration::Loader::CLIENT, kernel: Kernel
9
- @configuration = configuration
10
- @kernel = kernel
11
- end
12
-
13
- def call action
14
- case action
15
- when :edit then edit
16
- when :view then view
17
- else fail StandardError, "Invalid configuration action: #{action}."
18
- end
19
- end
20
-
21
- private
22
-
23
- attr_reader :configuration, :kernel
24
-
25
- def edit = kernel.system("$EDITOR #{configuration.current}")
26
-
27
- def view = kernel.system("cat #{configuration.current}")
28
- end
29
- end
30
- end
31
- end