rubysmith 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/README.adoc +11 -6
  4. data/lib/rubysmith/builder.rb +5 -2
  5. data/lib/rubysmith/builders/bundler.rb +2 -2
  6. data/lib/rubysmith/builders/console.rb +1 -1
  7. data/lib/rubysmith/builders/core.rb +4 -2
  8. data/lib/rubysmith/builders/documentation.rb +1 -1
  9. data/lib/rubysmith/builders/git/commit.rb +1 -1
  10. data/lib/rubysmith/builders/git/setup.rb +1 -1
  11. data/lib/rubysmith/builders/guard.rb +1 -1
  12. data/lib/rubysmith/builders/pragma.rb +1 -1
  13. data/lib/rubysmith/builders/rake.rb +3 -1
  14. data/lib/rubysmith/builders/reek.rb +1 -1
  15. data/lib/rubysmith/builders/rspec/context.rb +1 -1
  16. data/lib/rubysmith/builders/rspec/helper.rb +1 -1
  17. data/lib/rubysmith/builders/rubocop/formatter.rb +1 -1
  18. data/lib/rubysmith/builders/rubocop/setup.rb +1 -1
  19. data/lib/rubysmith/builders/setup.rb +1 -1
  20. data/lib/rubysmith/cli/configuration/content.rb +4 -1
  21. data/lib/rubysmith/cli/configuration/defaults.yml +2 -1
  22. data/lib/rubysmith/cli/parsers/build.rb +13 -8
  23. data/lib/rubysmith/cli/parsers/core.rb +1 -1
  24. data/lib/rubysmith/cli/processors/build.rb +0 -1
  25. data/lib/rubysmith/identity.rb +2 -2
  26. data/lib/rubysmith/renderers/erb.rb +1 -1
  27. data/lib/rubysmith/renderers/namespace.rb +2 -2
  28. data/lib/rubysmith/templates/%project_name%/Gemfile.erb +13 -11
  29. data/lib/rubysmith/templates/%project_name%/Rakefile.erb +1 -7
  30. data/lib/rubysmith/templates/%project_name%/bin/console.erb +1 -1
  31. data/lib/rubysmith/templates/%project_name%/lib/%project_path%.rb.erb +13 -0
  32. data/lib/rubysmith/templates/%project_name%/spec/spec_helper.rb.erb +1 -1
  33. data/lib/rubysmith.rb +9 -31
  34. data.tar.gz.sig +0 -0
  35. metadata +20 -8
  36. metadata.gz.sig +0 -0
  37. data/lib/rubysmith/builders/ruby_critic.rb +0 -25
  38. data/lib/rubysmith/templates/%project_name%/.rubycritic.yml.erb +0 -3
  39. data/lib/rubysmith/templates/%project_name%/lib/%project_name%.rb.erb +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae1f7e375e5e5d37e378cb82620d52dead76d846f2ea22cbbd32b76f714fc076
4
- data.tar.gz: c2fb2727fd8af69b4cbbc35e55b9ff3dc1cdc96f0d05609d505ffaf10ba2e444
3
+ metadata.gz: 628bf912ecce44ded950cf18f54d54a3a8ca13430ccc300f7db53062da718716
4
+ data.tar.gz: cbefec98da88d0e1b6198789805eeed82ea6b5238bee41ca9341c7d6114ed84c
5
5
  SHA512:
6
- metadata.gz: 8ee1ad6e82cac22883971e4cf1ff46c606173385f507908be37cc2839fe9c4b9fd8104c1354a74fb7784c592f2cf0bcae44ae5feee71f4db12892c4a971b9fef
7
- data.tar.gz: e29e0e144ca76fe0819bfceb8ca936171b0267c67c144acfd6c5aebc6cca8d84f3ecb165cd9f7f69f142a6c28685d2be20c45b68f605d741dfaec25e782eb459
6
+ metadata.gz: 4b7bb2b58f60f60057c12e9f9358d720a10fe4825eefcefb8231d4998647c1d44523a550a05a2938b8d16536954ba2cb6f9fa3a4d5a484a0536f24420cb51991
7
+ data.tar.gz: 315a9e28cd8231629bb17fce77051f0fb42b86c25d1fb04245437333b20171c5b5dc40b1e3cbca33cce6c611761fea3ec31493a6dad2e34c56982a598e66785d
checksums.yaml.gz.sig CHANGED
Binary file
data/README.adoc CHANGED
@@ -15,8 +15,11 @@ Rubysmith is a command line interface for smithing Ruby projects.
15
15
 
16
16
  This gem is useful in situations in which you need something more sophisticated than a
17
17
  link:https://bundler.io/guides/bundler_in_a_single_file_ruby_script.html[Bundler Inline] script but
18
- less complicated than a Ruby Gem as provided by
19
- link:https://www.alchemists.io/projects/gemsmith[Gemsmith].
18
+ less complicated than a link:https://www.alchemists.io/projects/gemsmith[Gemsmith] gem. Rubysmith is
19
+ the foundation of Gemsmith and provides a lot of the same functionality as Gemsmith but solely
20
+ tailored for pure Ruby projects. Again, this is a great tool for spiking quick Ruby implementations,
21
+ sharing code snippets with others, or building full blown Ruby projects for collaboration with
22
+ others.
20
23
 
21
24
  toc::[]
22
25
 
@@ -31,6 +34,7 @@ toc::[]
31
34
  * Supports link:https://www.alchemists.io/projects/git-lint[Git Lint].
32
35
  * Supports link:https://github.com/guard/guard[Guard].
33
36
  * Supports link:http://pryrepl.org[Pry].
37
+ * Supports link:https://github.com/ruby/rake[Rake].
34
38
  * Supports link:https://github.com/troessner/reek[Reek].
35
39
  * Supports link:https://www.alchemists.io/projects/refinements[Refinements].
36
40
  * Supports link:https://rspec.info[RSpec].
@@ -38,7 +42,6 @@ toc::[]
38
42
  * Supports link:https://docs.rubocop.org/rubocop-performance[Rubocop Performance].
39
43
  * Supports link:https://github.com/rubocop-hq/rubocop-rake[Rubocop Rake].
40
44
  * Supports link:https://github.com/rubocop-hq/rubocop-rspec[Rubocop RSpec].
41
- * Supports link:https://github.com/whitesmith/RubyCritic[RubyCritic].
42
45
  * Supports link:https://github.com/simplecov-ruby/simplecov[SimpleCov].
43
46
  * Supports common settings and a structured layout for building projects.
44
47
  * Provides common documentation:
@@ -90,15 +93,16 @@ BUILD OPTIONS:
90
93
  --[no-]git Add Git.
91
94
  --[no-]git-lint Add Git Lint.
92
95
  --[no-]guard Add Guard.
96
+ --min Use minimum/no options.
93
97
  --[no-]pry Add Pry.
98
+ --[no-]rake Add Rake.
94
99
  --[no-]reek Add Reek.
95
100
  --[no-]refinements Add Refinements.
96
101
  --[no-]rspec Add RSpec.
97
102
  --[no-]rubocop Add Rubocop.
98
- --[no-]ruby_critic Add RubyCritic.
99
103
  --[no-]setup Add setup script.
100
104
  --[no-]simple_cov Add SimpleCov.
101
- --min Use minimum/no options.
105
+ --[no-]zeitwerk Add Zeitwerk.
102
106
  ....
103
107
 
104
108
  === Building
@@ -167,13 +171,14 @@ The default configuration is as follows:
167
171
  :guard: true
168
172
  :minimum: false
169
173
  :pry: true
174
+ :rake: true
170
175
  :reek: true
171
176
  :refinements: true
172
177
  :rspec: true
173
178
  :rubocop: true
174
- :ruby_critic: true
175
179
  :setup: true
176
180
  :simple_cov: true
181
+ :zeitwerk: true
177
182
  :builders:
178
183
  :pragmater:
179
184
  :comments:
@@ -19,7 +19,7 @@ module Rubysmith
19
19
  logger: LOGGER
20
20
  }.freeze
21
21
 
22
- def self.call(configuration, helpers: HELPERS) = new(configuration, helpers: helpers)
22
+ def self.call(...) = new(...)
23
23
 
24
24
  def initialize configuration, helpers: HELPERS
25
25
  @configuration = configuration
@@ -119,7 +119,10 @@ module Rubysmith
119
119
  def relative_build_path = build_path.relative_path_from(configuration.build_root)
120
120
 
121
121
  def build_path
122
- pathway.end_path.gsub("%project_name%", configuration.project_name).sub ".erb", ""
122
+ pathway.end_path
123
+ .gsub("%project_name%", configuration.project_name)
124
+ .sub("%project_path%", configuration.project_path)
125
+ .sub ".erb", ""
123
126
  end
124
127
 
125
128
  def pathway = configuration.to_pathway
@@ -10,7 +10,7 @@ module Rubysmith
10
10
  class Bundler
11
11
  using Refinements::Pathnames
12
12
 
13
- def self.call(configuration, builder: Builder) = new(configuration, builder: builder).call
13
+ def self.call(...) = new(...).call
14
14
 
15
15
  def initialize configuration, builder: Builder, client: ::Bundler::CLI
16
16
  @configuration = configuration
@@ -23,7 +23,7 @@ module Rubysmith
23
23
  .render
24
24
  .replace(/\n\s+group/, "\n\ngroup")
25
25
  .replace(/\n\s+gem/, "\n gem")
26
- .replace(/ (?=.+refinements)/, "")
26
+ .replace(/ (?=.+(refinements|zeitwerk))/, "")
27
27
  .replace(/(\n+|\s+)end/, "\nend")
28
28
  .replace(/\n\ngroup :(code_quality|test|tools) do\nend/, "")
29
29
  .replace(/org"\n+/, "org\"\n\n")
@@ -4,7 +4,7 @@ module Rubysmith
4
4
  module Builders
5
5
  # Builds project skeleton console for object inspection and exploration.
6
6
  class Console
7
- def self.call(configuration, builder: Builder) = new(configuration, builder: builder).call
7
+ def self.call(...) = new(...).call
8
8
 
9
9
  def initialize configuration, builder: Builder
10
10
  @configuration = configuration
@@ -4,7 +4,7 @@ module Rubysmith
4
4
  module Builders
5
5
  # Builds project skeleton core structure and minimum file support.
6
6
  class Core
7
- def self.call(configuration, builder: Builder) = new(configuration, builder: builder).call
7
+ def self.call(...) = new(...).call
8
8
 
9
9
  def initialize configuration, builder: Builder
10
10
  @configuration = configuration
@@ -12,8 +12,10 @@ module Rubysmith
12
12
  end
13
13
 
14
14
  def call
15
- builder.call(configuration.with(template_path: "%project_name%/lib/%project_name%.rb.erb"))
15
+ builder.call(configuration.with(template_path: "%project_name%/lib/%project_path%.rb.erb"))
16
16
  .render
17
+ .replace(/ (?!(module|end))/, "")
18
+
17
19
  builder.call(configuration.with(template_path: "%project_name%/.ruby-version.erb")).render
18
20
  nil
19
21
  end
@@ -4,7 +4,7 @@ module Rubysmith
4
4
  module Builders
5
5
  # Builds project skeleton documentation.
6
6
  class Documentation
7
- def self.call(configuration, builder: Builder) = new(configuration, builder: builder).call
7
+ def self.call(...) = new(...).call
8
8
 
9
9
  def initialize configuration, builder: Builder
10
10
  @configuration = configuration
@@ -5,7 +5,7 @@ module Rubysmith
5
5
  module Git
6
6
  # Builds project skeleton initial Git commit message.
7
7
  class Commit
8
- def self.call(configuration, builder: Builder) = new(configuration, builder: builder).call
8
+ def self.call(...) = new(...).call
9
9
 
10
10
  def initialize configuration, builder: Builder
11
11
  @configuration = configuration
@@ -5,7 +5,7 @@ module Rubysmith
5
5
  module Git
6
6
  # Initializes project skeleton as a Git repository.
7
7
  class Setup
8
- def self.call(configuration, builder: Builder) = new(configuration, builder: builder).call
8
+ def self.call(...) = new(...).call
9
9
 
10
10
  def initialize configuration, builder: Builder
11
11
  @configuration = configuration
@@ -4,7 +4,7 @@ module Rubysmith
4
4
  module Builders
5
5
  # Builds project skeleton Guard support for a red, green, refactor loop.
6
6
  class Guard
7
- def self.call(configuration, builder: Builder) = new(configuration, builder: builder).call
7
+ def self.call(...) = new(...).call
8
8
 
9
9
  def initialize configuration, builder: Builder
10
10
  @configuration = configuration
@@ -6,7 +6,7 @@ module Rubysmith
6
6
  module Builders
7
7
  # Builds project skeleton pragmas so all Ruby strings are frozen by default.
8
8
  class Pragma
9
- def self.call(configuration) = new(configuration).call
9
+ def self.call(...) = new(...).call
10
10
 
11
11
  def initialize configuration, client: Pragmater::Runner
12
12
  @configuration = configuration
@@ -4,7 +4,7 @@ module Rubysmith
4
4
  module Builders
5
5
  # Builds project skeleton Rake support.
6
6
  class Rake
7
- def self.call(configuration, builder: Builder) = new(configuration, builder: builder).call
7
+ def self.call(...) = new(...).call
8
8
 
9
9
  def initialize configuration, builder: Builder
10
10
  @configuration = configuration
@@ -12,6 +12,8 @@ module Rubysmith
12
12
  end
13
13
 
14
14
  def call
15
+ return unless configuration.build_rake
16
+
15
17
  builder.call(configuration.with(template_path: "%project_name%/Rakefile.erb"))
16
18
  .render
17
19
  .replace(/\[\s+/, "[")
@@ -4,7 +4,7 @@ module Rubysmith
4
4
  module Builders
5
5
  # Builds project skeleton Reek code quality support.
6
6
  class Reek
7
- def self.call(configuration, builder: Builder) = new(configuration, builder: builder).call
7
+ def self.call(...) = new(...).call
8
8
 
9
9
  def initialize configuration, builder: Builder
10
10
  @configuration = configuration
@@ -5,7 +5,7 @@ module Rubysmith
5
5
  module RSpec
6
6
  # Builds RSpec shared context for temporary directories.
7
7
  class Context
8
- def self.call(configuration, builder: Builder) = new(configuration, builder: builder).call
8
+ def self.call(...) = new(...).call
9
9
 
10
10
  def initialize configuration, builder: Builder
11
11
  @configuration = configuration
@@ -5,7 +5,7 @@ module Rubysmith
5
5
  module RSpec
6
6
  # Builds RSpec spec helper for project skeleton.
7
7
  class Helper
8
- def self.call(configuration, builder: Builder) = new(configuration, builder: builder).call
8
+ def self.call(...) = new(...).call
9
9
 
10
10
  def initialize configuration, builder: Builder
11
11
  @configuration = configuration
@@ -10,7 +10,7 @@ module Rubysmith
10
10
  class Formatter
11
11
  using Refinements::IOs
12
12
 
13
- def self.call(configuration) = new(configuration).call
13
+ def self.call(...) = new(...).call
14
14
 
15
15
  def initialize configuration, client: RuboCop::CLI.new
16
16
  @configuration = configuration
@@ -5,7 +5,7 @@ module Rubysmith
5
5
  module Rubocop
6
6
  # Builds project skeleton for Rubocop code quality support.
7
7
  class Setup
8
- def self.call(configuration, builder: Builder) = new(configuration, builder: builder).call
8
+ def self.call(...) = new(...).call
9
9
 
10
10
  def initialize configuration, builder: Builder
11
11
  @configuration = configuration
@@ -4,7 +4,7 @@ module Rubysmith
4
4
  module Builders
5
5
  # Builds project skeleton setup script.
6
6
  class Setup
7
- def self.call(configuration, builder: Builder) = new(configuration, builder: builder).call
7
+ def self.call(...) = new(...).call
8
8
 
9
9
  def initialize configuration, builder: Builder
10
10
  @configuration = configuration
@@ -28,13 +28,14 @@ module Rubysmith
28
28
  :build_git_lint,
29
29
  :build_guard,
30
30
  :build_pry,
31
+ :build_rake,
31
32
  :build_reek,
32
33
  :build_refinements,
33
34
  :build_rspec,
34
35
  :build_rubocop,
35
- :build_ruby_critic,
36
36
  :build_setup,
37
37
  :build_simple_cov,
38
+ :build_zeitwerk,
38
39
  :builders_pragmater_comments,
39
40
  :builders_pragmater_includes,
40
41
  :version,
@@ -59,6 +60,8 @@ module Rubysmith
59
60
 
60
61
  def project_root = build_root.join(project_name)
61
62
 
63
+ def project_path = project_name.snakecase
64
+
62
65
  def to_pathway
63
66
  Pathway[start_root: template_root, start_path: template_path, end_root: build_root]
64
67
  end
@@ -17,13 +17,14 @@
17
17
  :guard: true
18
18
  :minimum: false
19
19
  :pry: true
20
+ :rake: true
20
21
  :reek: true
21
22
  :refinements: true
22
23
  :rspec: true
23
24
  :rubocop: true
24
- :ruby_critic: true
25
25
  :setup: true
26
26
  :simple_cov: true
27
+ :zeitwerk: true
27
28
  :builders:
28
29
  :pragmater:
29
30
  :comments:
@@ -4,9 +4,8 @@ module Rubysmith
4
4
  module CLI
5
5
  module Parsers
6
6
  # Handles parsing of Command Line Interface (CLI) build options.
7
- # :reek:TooManyMethods
8
7
  class Build
9
- def self.call(options: {}, client: CLIENT) = new(options: options, client: client).call
8
+ def self.call(...) = new(...).call
10
9
 
11
10
  def initialize options: {}, client: CLIENT
12
11
  @options = options
@@ -77,6 +76,12 @@ module Rubysmith
77
76
  end
78
77
  end
79
78
 
79
+ def add_rake
80
+ client.on "--[no-]rake", "Add Rake." do |value|
81
+ options[:build_rake] = value
82
+ end
83
+ end
84
+
80
85
  def add_reek
81
86
  client.on "--[no-]reek", "Add Reek." do |value|
82
87
  options[:build_reek] = value
@@ -101,12 +106,6 @@ module Rubysmith
101
106
  end
102
107
  end
103
108
 
104
- def add_ruby_critic
105
- client.on "--[no-]ruby_critic", "Add RubyCritic." do |value|
106
- options[:build_ruby_critic] = value
107
- end
108
- end
109
-
110
109
  def add_setup
111
110
  client.on "--[no-]setup", "Add setup script." do |value|
112
111
  options[:build_setup] = value
@@ -118,6 +117,12 @@ module Rubysmith
118
117
  options[:build_simple_cov] = value
119
118
  end
120
119
  end
120
+
121
+ def add_zeitwerk
122
+ client.on "--[no-]zeitwerk", "Add Zeitwerk." do |value|
123
+ options[:build_zeitwerk] = value
124
+ end
125
+ end
121
126
  end
122
127
  end
123
128
  end
@@ -7,7 +7,7 @@ module Rubysmith
7
7
  module Parsers
8
8
  # Handles parsing of Command Line Interface (CLI) core options.
9
9
  class Core
10
- def self.call(options: {}, client: CLIENT) = new(options: options, client: client).call
10
+ def self.call(...) = new(...).call
11
11
 
12
12
  def initialize options: {}, client: CLIENT
13
13
  @options = options
@@ -33,7 +33,6 @@ module Rubysmith
33
33
  Builders::Pragma,
34
34
  Builders::Rubocop::Setup,
35
35
  Builders::Rubocop::Formatter,
36
- Builders::RubyCritic,
37
36
  Builders::Git::Commit
38
37
  ].freeze
39
38
 
@@ -4,8 +4,8 @@ module Rubysmith
4
4
  module Identity
5
5
  NAME = "rubysmith"
6
6
  LABEL = "Rubysmith"
7
- VERSION = "0.11.0"
8
- VERSION_LABEL = "#{LABEL} #{VERSION}"
7
+ VERSION = "0.12.0"
8
+ VERSION_LABEL = "#{LABEL} #{VERSION}".freeze
9
9
  SUMMARY = "A command line interface for smithing Ruby projects."
10
10
  end
11
11
  end
@@ -21,7 +21,7 @@ module Rubysmith
21
21
  attr_accessor :buffer
22
22
  attr_reader :configuration, :scope, :client
23
23
 
24
- def namespace = self.buffer = scope.call(yield)
24
+ def namespace = self.buffer = block_given? ? scope.call(yield) : buffer + scope.call
25
25
  end
26
26
  end
27
27
  end
@@ -14,7 +14,7 @@ module Rubysmith
14
14
  @depth = namespace.scan("::").length
15
15
  end
16
16
 
17
- def call(content) = "#{prefix}#{body content}#{suffix.chomp}"
17
+ def call(content = nil) = "#{prefix}#{body content}#{suffix}"
18
18
 
19
19
  private
20
20
 
@@ -28,7 +28,7 @@ module Rubysmith
28
28
 
29
29
  # :reek:FeatureEnvy
30
30
  def body content
31
- content.lstrip.split("\n").reduce "" do |snippet, line|
31
+ String(content).lstrip.split("\n").reduce "" do |snippet, line|
32
32
  next "#{snippet}\n" if line.blank?
33
33
 
34
34
  "#{snippet}#{line.gsub(/^\s{2}/, "").indent depth + 1}\n"
@@ -6,6 +6,9 @@ source "https://rubygems.org"
6
6
  <% if configuration.build_refinements %>
7
7
  gem "refinements", "~> 8.0"
8
8
  <% end %>
9
+ <% if configuration.build_zeitwerk %>
10
+ gem "zeitwerk", "~> 2.4"
11
+ <% end %>
9
12
 
10
13
  group :code_quality do
11
14
  <% if configuration.build_bundler_leak %>
@@ -18,24 +21,23 @@ source "https://rubygems.org"
18
21
  gem "reek", "~> 6.0"
19
22
  <% end %>
20
23
  <% if configuration.build_rubocop %>
21
- gem "rubocop", "~> 1.14"
22
- gem "rubocop-performance", "~> 1.9"
23
- gem "rubocop-rake", "~> 0.5"
24
+ gem "rubocop", "~> 1.20"
25
+ gem "rubocop-performance", "~> 1.11"
26
+ gem "rubocop-rake", "~> 0.6"
24
27
  <% end %>
25
28
  <% if configuration.build_rspec && configuration.build_rubocop %>
26
- gem "rubocop-rspec", "~> 2.0"
27
- <% end %>
28
- <% if configuration.build_ruby_critic %>
29
- gem "rubycritic", "~> 4.5", require: false
29
+ gem "rubocop-rspec", "~> 2.4"
30
30
  <% end %>
31
31
  <% if configuration.build_simple_cov %>
32
32
  gem "simplecov", "~> 0.20"
33
33
  <% end %>
34
34
  end
35
35
 
36
- group :development do
37
- gem "rake", "~> 13.0"
38
- end
36
+ <% if configuration.build_rake %>
37
+ group :development do
38
+ gem "rake", "~> 13.0"
39
+ end
40
+ <% end %>
39
41
 
40
42
  group :test do
41
43
  <% if configuration.build_guard %>
@@ -48,7 +50,7 @@ source "https://rubygems.org"
48
50
 
49
51
  group :tools do
50
52
  <% if configuration.build_amazing_print %>
51
- gem "amazing_print", "~> 1.2"
53
+ gem "amazing_print", "~> 1.3"
52
54
  <% end %>
53
55
  <% if configuration.build_pry %>
54
56
  gem "pry", "~> 0.13"
@@ -15,9 +15,6 @@ require "bundler/setup"
15
15
  <% if configuration.build_rubocop %>
16
16
  require "rubocop/rake_task"
17
17
  <% end %>
18
- <% if configuration.build_ruby_critic %>
19
- require "rubycritic/rake_task"
20
- <% end %>
21
18
 
22
19
  <% if configuration.build_bundler_leak %>
23
20
  Bundler::Plumber::Task.new
@@ -31,11 +28,8 @@ require "bundler/setup"
31
28
  <% if configuration.build_rubocop %>
32
29
  RuboCop::RakeTask.new
33
30
  <% end %>
34
- <% if configuration.build_ruby_critic %>
35
- RubyCritic::RakeTask.new
36
- <% end %>
37
31
 
38
32
  desc "Run code quality checks"
39
- 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 %> <% if configuration.build_ruby_critic %>rubycritic<% end %>]
33
+ 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 %>]
40
34
 
41
35
  task default: %i[code_quality <% if configuration.build_rspec %>spec<% end %>]
@@ -3,7 +3,7 @@
3
3
  require "bundler/setup"
4
4
  Bundler.require :tools
5
5
 
6
- require_relative "../lib/<%= configuration.project_name %>"
6
+ require_relative "../lib/<%= configuration.project_path %>"
7
7
  require "irb"
8
8
 
9
9
  IRB.start __FILE__
@@ -0,0 +1,13 @@
1
+ <% if configuration.build_zeitwerk %>
2
+ require "zeitwerk"
3
+ <% if configuration.project_path.include? "/" %>
4
+ loader = Zeitwerk::Loader.new
5
+ loader.push_dir "#{__dir__}/.."
6
+ loader.setup
7
+ <% else %>
8
+ loader = Zeitwerk::Loader.for_gem
9
+ loader.setup
10
+ <% end %>
11
+ <% end %>
12
+ # Main namespace.
13
+ <% namespace %>
@@ -6,7 +6,7 @@ Bundler.require :tools
6
6
  SimpleCov.start { enable_coverage :branch }
7
7
  <% end %>
8
8
 
9
- require "<%= configuration.project_name %>"
9
+ require "<%= configuration.project_path %>"
10
10
  <% if configuration.build_refinements %>
11
11
  require "refinements"
12
12
  <% end %>
data/lib/rubysmith.rb CHANGED
@@ -1,33 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "rubysmith/identity"
4
- require "rubysmith/pathway"
5
- require "rubysmith/renderers/namespace"
6
- require "rubysmith/renderers/erb"
7
- require "rubysmith/text/inserter"
8
- require "rubysmith/builder"
9
- require "rubysmith/builders/core"
10
- require "rubysmith/builders/documentation"
11
- require "rubysmith/builders/git/setup"
12
- require "rubysmith/builders/git/commit"
13
- require "rubysmith/builders/bundler"
14
- require "rubysmith/builders/rake"
15
- require "rubysmith/builders/console"
16
- require "rubysmith/builders/setup"
17
- require "rubysmith/builders/guard"
18
- require "rubysmith/builders/reek"
19
- require "rubysmith/builders/rspec/context"
20
- require "rubysmith/builders/rspec/helper"
21
- require "rubysmith/builders/pragma"
22
- require "rubysmith/builders/rubocop/setup"
23
- require "rubysmith/builders/rubocop/formatter"
24
- require "rubysmith/builders/ruby_critic"
25
- require "rubysmith/cli/configuration/content"
26
- require "rubysmith/cli/configuration/loader"
27
- require "rubysmith/cli/parsers"
28
- require "rubysmith/cli/parsers/core"
29
- require "rubysmith/cli/parsers/build"
30
- require "rubysmith/cli/parsers/assembler"
31
- require "rubysmith/cli/processors/config"
32
- require "rubysmith/cli/processors/build"
33
- require "rubysmith/cli/shell"
3
+ require "zeitwerk"
4
+
5
+ loader = Zeitwerk::Loader.for_gem
6
+ loader.inflector.inflect "cli" => "CLI", "erb" => "ERB", "rspec" => "RSpec"
7
+ loader.setup
8
+
9
+ # Main namespace.
10
+ module Rubysmith
11
+ 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.11.0
4
+ version: 0.12.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-08-08 00:00:00.000000000 Z
31
+ date: 2021-09-06 00:00:00.000000000 Z
32
32
  dependencies:
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: pragmater
@@ -64,14 +64,14 @@ dependencies:
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '1.14'
67
+ version: '1.20'
68
68
  type: :runtime
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: '1.14'
74
+ version: '1.20'
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: runcom
77
77
  requirement: !ruby/object:Gem::Requirement
@@ -86,6 +86,20 @@ dependencies:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
88
  version: '7.0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: zeitwerk
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '2.4'
96
+ type: :runtime
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '2.4'
89
103
  description:
90
104
  email:
91
105
  - brooke@alchemists.io
@@ -115,7 +129,6 @@ files:
115
129
  - lib/rubysmith/builders/rspec/helper.rb
116
130
  - lib/rubysmith/builders/rubocop/formatter.rb
117
131
  - lib/rubysmith/builders/rubocop/setup.rb
118
- - lib/rubysmith/builders/ruby_critic.rb
119
132
  - lib/rubysmith/builders/setup.rb
120
133
  - lib/rubysmith/cli/configuration/content.rb
121
134
  - lib/rubysmith/cli/configuration/defaults.yml
@@ -134,7 +147,6 @@ files:
134
147
  - lib/rubysmith/templates/%project_name%/.reek.yml.erb
135
148
  - lib/rubysmith/templates/%project_name%/.rubocop.yml.erb
136
149
  - lib/rubysmith/templates/%project_name%/.ruby-version.erb
137
- - lib/rubysmith/templates/%project_name%/.rubycritic.yml.erb
138
150
  - lib/rubysmith/templates/%project_name%/CHANGES.adoc.erb
139
151
  - lib/rubysmith/templates/%project_name%/CHANGES.md.erb
140
152
  - lib/rubysmith/templates/%project_name%/CODE_OF_CONDUCT.adoc.erb
@@ -154,7 +166,7 @@ files:
154
166
  - lib/rubysmith/templates/%project_name%/bin/guard.erb
155
167
  - lib/rubysmith/templates/%project_name%/bin/rubocop.erb
156
168
  - lib/rubysmith/templates/%project_name%/bin/setup.erb
157
- - lib/rubysmith/templates/%project_name%/lib/%project_name%.rb.erb
169
+ - lib/rubysmith/templates/%project_name%/lib/%project_path%.rb.erb
158
170
  - lib/rubysmith/templates/%project_name%/spec/spec_helper.rb.erb
159
171
  - lib/rubysmith/templates/%project_name%/spec/support/shared_contexts/temp_dir.rb.erb
160
172
  - lib/rubysmith/text/inserter.rb
@@ -181,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
193
  - !ruby/object:Gem::Version
182
194
  version: '0'
183
195
  requirements: []
184
- rubygems_version: 3.2.25
196
+ rubygems_version: 3.2.27
185
197
  signing_key:
186
198
  specification_version: 4
187
199
  summary: A command line interface for smithing Ruby projects.
metadata.gz.sig CHANGED
Binary file
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Rubysmith
4
- module Builders
5
- # Builds project skeleton RubyCritic code quality support.
6
- class RubyCritic
7
- def self.call(configuration, builder: Builder) = new(configuration, builder: builder).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_ruby_critic
16
-
17
- builder.call(configuration.with(template_path: "%project_name%/.rubycritic.yml.erb")).render
18
- end
19
-
20
- private
21
-
22
- attr_reader :configuration, :builder
23
- end
24
- end
25
- end
@@ -1,3 +0,0 @@
1
- paths:
2
- - "lib"
3
- no_browser: true
@@ -1,3 +0,0 @@
1
- # The project namespace.
2
- module <%= configuration.project_class %>
3
- end