rubysmith 5.4.0 → 5.6.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6ca20956e5827addc7ea3c38045c599e3d19ad99ef215a7315ea1eef5466a8f3
4
- data.tar.gz: 26564d4ba7f197f7e1be21bed743909cf165e1d3d73891a93a44af0fa5594900
3
+ metadata.gz: d2bdc94b13e74451e18224bdfff1cf41e744a4b9c75813d590b2fb9cd37b3a10
4
+ data.tar.gz: bd1d1451951971227e8883b0871b02906b675148c0cec20483f7b77da4a2b9ac
5
5
  SHA512:
6
- metadata.gz: 5cc50e74678c032abbc0f2cf9dd1f1a8428e74f07bf270805b8d986976496ffff4f5dd51756f599153ebe7df07ccaef29b34ea882f4c132501568ca161c414a2
7
- data.tar.gz: 653349bb0b747094bb2b66558e592419a6236c753acb547210383e4a89a4f9d3260a6f9c9d3f34030205984454fc79660729c310d8413696e5692bb483fa8280
6
+ metadata.gz: 788dbee80b7f0028f0cc597b470be7255d4cfb30f7cbdb5845f49534d4ee0bfe6d74124b8cbd4d0c3274808b0dc33e33047d47fb80afcc224d32850c18eb8c76
7
+ data.tar.gz: c0c6bb8ae504209f8552614e9bdaaef4765d3e35e0c7007bde8acfc49b9b40a871b3cd47cd21e8185b9cd8160eb5ca1472b87b394f47f1ef75798beb5d18ac9d
checksums.yaml.gz.sig CHANGED
Binary file
data/README.adoc CHANGED
@@ -76,21 +76,7 @@ gem install rubysmith
76
76
 
77
77
  From the command line, type: `rubysmith --help`
78
78
 
79
- ....
80
- USAGE
81
- rubysmith [OPTIONS]
82
- rubysmith COMMAND [OPTIONS]
83
-
84
- OPTIONS
85
- -p, --publish VERSION Publish project.
86
- -v, --version Show version.
87
- -h, --help [COMMAND] Show this message.
88
-
89
- COMMANDS
90
- config Manage configuration.
91
- Path is dynamic per current directory.
92
- build Build new project.
93
- ....
79
+ image:https://alchemists.io/images/projects/rubysmith/screenshots/usage.png[Usage,width=588,height=345,role=focal_point]
94
80
 
95
81
  ==== Build
96
82
 
@@ -287,9 +273,9 @@ Additional customization is possible via the YARD Rake task as found in the `Rak
287
273
 
288
274
  ===== Zeitwerk
289
275
 
290
- The `--zeitwerk` option allows you add the link:https://github.com/fxn/zeitwerk[Zeitwerk] gem to
291
- your project so you can reduce the maintence burden of managing requirements when adding new objects
292
- to your project.
276
+ The `--zeitwerk` option allows you add the link:https://github.com/fxn/zeitwerk[Zeitwerk] gem to your project so you can reduce the maintenance burden of managing requirements when adding new objects to your project.
277
+
278
+ This includes having access to your project's Zeitwerk loader for inspection and debugging purposes. This means if you built a `Demo` project, you'd immediately have access to your project's loader via `Demo.loader` when using the project console (i.e. `bin/console`, assuming you built your project with the `--console` flag enabled which is default behavior).
293
279
 
294
280
  ==== Publish
295
281
 
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "refinements/structs"
4
- require "tocer"
5
4
 
6
5
  module Rubysmith
7
6
  module Builders
@@ -8,9 +8,9 @@ module Rubysmith
8
8
  module Transformers
9
9
  include Dry::Monads[:result]
10
10
 
11
- CurrentTime = lambda do |content, at: Time.now|
12
- content.fetch(:now) { at }
13
- .then { |now| content.merge! now: }
11
+ CurrentTime = lambda do |content, key = :now, at: Time.now|
12
+ content.fetch(key) { at }
13
+ .then { |value| content.merge! key => value }
14
14
  .then { |updated_content| Dry::Monads::Success updated_content }
15
15
  end
16
16
  end
@@ -10,13 +10,20 @@ module Rubysmith
10
10
  include Import[:git]
11
11
  include Dry::Monads[:result]
12
12
 
13
- def call(content) = content[:author_email] ? Success(content) : email_or(content)
13
+ def initialize(key = :author_email, **)
14
+ @key = key
15
+ super(**)
16
+ end
17
+
18
+ def call(content) = content[key] ? Success(content) : email_or(content)
14
19
 
15
20
  private
16
21
 
22
+ attr_reader :key
23
+
17
24
  def email_or content
18
25
  git.get("user.email", nil)
19
- .fmap { |email| email ? content.merge!(author_email: email) : content }
26
+ .fmap { |value| value ? content.merge!(key => value) : content }
20
27
  .or { Success content }
21
28
  end
22
29
  end
@@ -10,13 +10,20 @@ module Rubysmith
10
10
  include Import[:git]
11
11
  include Dry::Monads[:result]
12
12
 
13
- def call(content) = content[:git_hub_user] ? Success(content) : user_or(content)
13
+ def initialize(key = :git_hub_user, **)
14
+ @key = key
15
+ super(**)
16
+ end
17
+
18
+ def call(content) = content[key] ? Success(content) : user_or(content)
14
19
 
15
20
  private
16
21
 
22
+ attr_reader :key
23
+
17
24
  def user_or content
18
25
  git.get("github.user", nil)
19
- .fmap { |user| user ? content.merge!(git_hub_user: user) : content }
26
+ .fmap { |value| value ? content.merge!(key => value) : content }
20
27
  .or { Success content }
21
28
  end
22
29
  end
@@ -8,9 +8,9 @@ module Rubysmith
8
8
  module Transformers
9
9
  include Dry::Monads[:result]
10
10
 
11
- TargetRoot = lambda do |content, path: Pathname.pwd|
11
+ TargetRoot = lambda do |content, key = :target_root, path: Pathname.pwd|
12
12
  content.fetch(:target_root) { path }
13
- .then { |root| content.merge! target_root: root }
13
+ .then { |value| content.merge! key => value }
14
14
  .then { |updated_content| Dry::Monads::Success updated_content }
15
15
  end
16
16
  end
@@ -12,20 +12,21 @@ module Rubysmith
12
12
 
13
13
  using Refinements::Arrays
14
14
 
15
- def initialize default = Pathname(__dir__).join("../../templates")
15
+ def initialize key = :template_roots, default: Pathname(__dir__).join("../../templates")
16
+ @key = key
16
17
  @default = default
17
18
  end
18
19
 
19
20
  def call content
20
21
  Array(default).map { |path| Pathname path }
21
- .including(content[:template_roots])
22
+ .including(content[key])
22
23
  .compact
23
- .then { |paths| Success content.merge!(template_roots: paths) }
24
+ .then { |value| Success content.merge!(key => value) }
24
25
  end
25
26
 
26
27
  private
27
28
 
28
- attr_reader :default
29
+ attr_reader :key, :default
29
30
  end
30
31
  end
31
32
  end
@@ -12,12 +12,12 @@ module Rubysmith
12
12
  module Container
13
13
  extend Dry::Container::Mixin
14
14
 
15
- register :configuration do
15
+ register :configuration, memoize: true do
16
16
  self[:defaults].add_loader(Etcher::Loaders::YAML.new(self[:xdg_config].active))
17
17
  .then { |registry| Etcher.call registry }
18
18
  end
19
19
 
20
- register :defaults do
20
+ register :defaults, memoize: true do
21
21
  Etcher::Registry.new(contract: Configuration::Contract, model: Configuration::Model)
22
22
  .add_loader(Etcher::Loaders::YAML.new(self[:defaults_path]))
23
23
  .add_transformer(Configuration::Transformers::CurrentTime)
@@ -28,12 +28,15 @@ module Rubysmith
28
28
  .add_transformer(Configuration::Transformers::TargetRoot)
29
29
  end
30
30
 
31
+ register :specification, memoize: true do
32
+ Spek::Loader.call "#{__dir__}/../../rubysmith.gemspec"
33
+ end
34
+
31
35
  register(:input, memoize: true) { self[:configuration].dup }
32
- register(:defaults_path) { Pathname(__dir__).join("configuration/defaults.yml") }
33
- register(:xdg_config) { Runcom::Config.new "rubysmith/configuration.yml" }
34
- register(:specification) { Spek::Loader.call "#{__dir__}/../../rubysmith.gemspec" }
35
- register(:git) { Gitt::Repository.new }
36
- register(:kernel) { Kernel }
37
- register(:logger) { Cogger.new formatter: :emoji }
36
+ register(:defaults_path, memoize: true) { Pathname(__dir__).join("configuration/defaults.yml") }
37
+ register(:xdg_config, memoize: true) { Runcom::Config.new "rubysmith/configuration.yml" }
38
+ register(:git, memoize: true) { Gitt::Repository.new }
39
+ register(:logger, memoize: true) { Cogger.new formatter: :emoji }
40
+ register :kernel, Kernel
38
41
  end
39
42
  end
@@ -1,11 +1,8 @@
1
- ## Overview
2
- <!-- Required. Describe, briefly, the behavior experienced and desired. -->
1
+ ## Why
2
+ <!-- Required. Describe, briefly, why this issue is important. -->
3
3
 
4
- ## Screenshots/Screencasts
5
- <!-- Optional. Attach screenshot(s) and/or screencast(s) that demo the behavior. -->
4
+ ## How
5
+ <!-- Optional. List exact steps (numbered) to implement or reproduce behavior. Screen shots/casts are welcome. -->
6
6
 
7
- ## Steps to Recreate
8
- <!-- Required. List exact steps (numbered list) to reproduce errant behavior. -->
9
-
10
- ## Environment
11
- <!-- Required. What is your operating system, software version(s), etc. -->
7
+ ## Notes
8
+ <!-- Optional. Provide additional details (i.e operating system, software version(s), stack dump, etc.) -->
@@ -3,7 +3,7 @@
3
3
  require "bundler/setup"
4
4
  Bundler.require :tools
5
5
 
6
- require "<%= configuration.project_path %>"
6
+ require Bundler.root.join("lib/<%= configuration.project_path %>").to_s
7
7
  require "irb"
8
8
 
9
9
  IRB.start __FILE__
@@ -2,11 +2,22 @@
2
2
  require "zeitwerk"
3
3
  <% if configuration.project_levels.positive? %>
4
4
  Zeitwerk::Loader.new.then do |loader|
5
+ loader.tag = "<%= configuration.project_name %>"
5
6
  loader.push_dir "#{__dir__}<%= Array.new(configuration.project_levels, "/..").join %>"
6
7
  loader.setup
7
8
  end
8
9
  <% else %>
9
- Zeitwerk::Loader.for_gem.setup
10
+ Zeitwerk::Loader.new.then do |loader|
11
+ loader.tag = File.basename __FILE__, ".rb"
12
+ loader.push_dir __dir__
13
+ loader.setup
14
+ end
10
15
  <% end %>
11
16
  <% end %>
17
+ <% if configuration.build_zeitwerk %>
18
+ <% namespace do %>
19
+ def self.loader(registry = Zeitwerk::Registry) = registry.loader_for __FILE__
20
+ <% end %>
21
+ <% else %>
12
22
  <% namespace %>
23
+ <% end %>
data/lib/rubysmith.rb CHANGED
@@ -2,15 +2,18 @@
2
2
 
3
3
  require "zeitwerk"
4
4
 
5
- Zeitwerk::Loader.for_gem.then do |loader|
5
+ Zeitwerk::Loader.new.then do |loader|
6
6
  loader.inflector.inflect "cli" => "CLI",
7
7
  "circle_ci" => "CircleCI",
8
8
  "erb" => "ERB",
9
9
  "git_hub_ci" => "GitHubCI",
10
10
  "rspec" => "RSpec"
11
+ loader.tag = File.basename __FILE__, ".rb"
12
+ loader.push_dir __dir__
11
13
  loader.setup
12
14
  end
13
15
 
14
16
  # Main namespace.
15
17
  module Rubysmith
18
+ def self.loader(registry = Zeitwerk::Registry) = registry.loader_for __FILE__
16
19
  end
data/rubysmith.gemspec CHANGED
@@ -2,10 +2,10 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "rubysmith"
5
- spec.version = "5.4.0"
5
+ spec.version = "5.6.0"
6
6
  spec.authors = ["Brooke Kuhlmann"]
7
7
  spec.email = ["brooke@alchemists.io"]
8
- spec.homepage = "https://github.com/bkuhlmann/rubysmith"
8
+ spec.homepage = "https://alchemists.io/projects/rubysmith"
9
9
  spec.summary = "A command line interface for smithing Ruby projects."
10
10
  spec.license = "Hippocratic-2.1"
11
11
 
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.add_dependency "milestoner", "~> 16.0"
34
34
  spec.add_dependency "pragmater", "~> 13.0"
35
35
  spec.add_dependency "refinements", "~> 11.0"
36
- spec.add_dependency "rubocop", "~> 1.52"
36
+ spec.add_dependency "rubocop", "~> 1.55"
37
37
  spec.add_dependency "runcom", "~> 10.0"
38
38
  spec.add_dependency "sod", "~> 0.0"
39
39
  spec.add_dependency "spek", "~> 2.0"
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: 5.4.0
4
+ version: 5.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -35,7 +35,7 @@ cert_chain:
35
35
  3n5C8/6Zh9DYTkpcwPSuIfAga6wf4nXc9m6JAw8AuMLaiWN/r/2s4zJsUHYERJEu
36
36
  gZGm4JqtuSg8pYjPeIJxS960owq+SfuC+jxqmRA54BisFCv/0VOJi7tiJVY=
37
37
  -----END CERTIFICATE-----
38
- date: 2023-07-15 00:00:00.000000000 Z
38
+ date: 2023-10-01 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: cogger
@@ -183,14 +183,14 @@ dependencies:
183
183
  requirements:
184
184
  - - "~>"
185
185
  - !ruby/object:Gem::Version
186
- version: '1.52'
186
+ version: '1.55'
187
187
  type: :runtime
188
188
  prerelease: false
189
189
  version_requirements: !ruby/object:Gem::Requirement
190
190
  requirements:
191
191
  - - "~>"
192
192
  - !ruby/object:Gem::Version
193
- version: '1.52'
193
+ version: '1.55'
194
194
  - !ruby/object:Gem::Dependency
195
195
  name: runcom
196
196
  requirement: !ruby/object:Gem::Requirement
@@ -400,7 +400,7 @@ files:
400
400
  - lib/rubysmith/templates/%project_name%/spec/support/shared_contexts/temp_dir.rb.erb
401
401
  - lib/rubysmith/text/inserter.rb
402
402
  - rubysmith.gemspec
403
- homepage: https://github.com/bkuhlmann/rubysmith
403
+ homepage: https://alchemists.io/projects/rubysmith
404
404
  licenses:
405
405
  - Hippocratic-2.1
406
406
  metadata:
@@ -426,7 +426,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
426
426
  - !ruby/object:Gem::Version
427
427
  version: '0'
428
428
  requirements: []
429
- rubygems_version: 3.4.17
429
+ rubygems_version: 3.4.20
430
430
  signing_key:
431
431
  specification_version: 4
432
432
  summary: A command line interface for smithing Ruby projects.
metadata.gz.sig CHANGED
Binary file