gemsmith 17.0.0 → 18.0.1

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 (45) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +3 -2
  3. data/LICENSE.adoc +134 -214
  4. data/README.adoc +71 -30
  5. data/gemsmith.gemspec +7 -6
  6. data/lib/gemsmith/builders/circle_ci.rb +4 -1
  7. data/lib/gemsmith/builders/cli.rb +15 -7
  8. data/lib/gemsmith/builders/git/commit.rb +6 -5
  9. data/lib/gemsmith/cli/actions/config.rb +6 -7
  10. data/lib/gemsmith/cli/actions/container.rb +25 -0
  11. data/lib/gemsmith/cli/actions/edit.rb +5 -7
  12. data/lib/gemsmith/cli/actions/import.rb +11 -0
  13. data/lib/gemsmith/cli/actions/install.rb +5 -5
  14. data/lib/gemsmith/cli/actions/publish.rb +5 -5
  15. data/lib/gemsmith/cli/actions/view.rb +5 -7
  16. data/lib/gemsmith/cli/parser.rb +9 -5
  17. data/lib/gemsmith/cli/parsers/build.rb +7 -5
  18. data/lib/gemsmith/cli/parsers/core.rb +6 -5
  19. data/lib/gemsmith/cli/shell.rb +21 -40
  20. data/lib/gemsmith/container.rb +1 -1
  21. data/lib/gemsmith/import.rb +7 -0
  22. data/lib/gemsmith/templates/%project_name%/%project_name%.gemspec.erb +3 -3
  23. data/lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/actions/config.rb.erb +6 -9
  24. data/lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/actions/container.rb.erb +18 -0
  25. data/lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/actions/import.rb.erb +9 -0
  26. data/lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/parser.rb.erb +9 -5
  27. data/lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/parsers/core.rb.erb +6 -5
  28. data/lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb +6 -15
  29. data/lib/gemsmith/templates/%project_name%/lib/%project_path%/container.rb.erb +3 -25
  30. data/lib/gemsmith/templates/%project_name%/lib/%project_path%/import.rb.erb +5 -0
  31. data/lib/gemsmith/templates/%project_name%/spec/lib/%project_path%/cli/actions/config_spec.rb.erb +3 -3
  32. data/lib/gemsmith/templates/%project_name%/spec/lib/%project_path%/cli/parser_spec.rb.erb +1 -1
  33. data/lib/gemsmith/templates/%project_name%/spec/lib/%project_path%/cli/parsers/core_spec.rb.erb +1 -1
  34. data/lib/gemsmith/templates/%project_name%/spec/lib/%project_path%/cli/shell_spec.rb.erb +16 -13
  35. data/lib/gemsmith/templates/%project_name%/spec/support/shared_contexts/application_dependencies.rb.erb +21 -0
  36. data/lib/gemsmith/tools/editor.rb +2 -9
  37. data/lib/gemsmith/tools/installer.rb +5 -5
  38. data/lib/gemsmith/tools/pusher.rb +23 -5
  39. data/lib/gemsmith/tools/validator.rb +1 -10
  40. data/lib/gemsmith/tools/versioner.rb +6 -6
  41. data/lib/gemsmith/tools/viewer.rb +1 -10
  42. data.tar.gz.sig +0 -0
  43. metadata +51 -31
  44. metadata.gz.sig +3 -1
  45. data/lib/gemsmith/templates/%project_name%/spec/support/shared_contexts/application_container.rb.erb +0 -22
@@ -19,7 +19,8 @@ module Gemsmith
19
19
  return configuration unless configuration.build_circle_ci
20
20
 
21
21
  builder.call(configuration.merge(template_path: "%project_name%/.circleci/config.yml.erb"))
22
- .replace("Gemfile.lock", "#{configuration.project_name}.gemspec")
22
+ .replace %({{checksum "Gemfile.lock"}}),
23
+ %({{checksum "Gemfile"}}-{{checksum "#{project_name}.gemspec"}})
23
24
 
24
25
  configuration
25
26
  end
@@ -27,6 +28,8 @@ module Gemsmith
27
28
  private
28
29
 
29
30
  attr_reader :configuration, :builder
31
+
32
+ def project_name = configuration.project_name
30
33
  end
31
34
  end
32
35
  end
@@ -47,16 +47,24 @@ module Gemsmith
47
47
  CONTENT
48
48
  end
49
49
 
50
- def render_library
50
+ def render_configuration
51
51
  [
52
- "%project_name%/lib/%project_path%/cli/actions/config.rb.erb",
53
- "%project_name%/lib/%project_path%/cli/parser.rb.erb",
54
- "%project_name%/lib/%project_path%/cli/parsers/core.rb.erb",
55
- "%project_name%/lib/%project_path%/cli/shell.rb.erb",
56
52
  "%project_name%/lib/%project_path%/configuration/content.rb.erb",
57
53
  "%project_name%/lib/%project_path%/configuration/defaults.yml.erb",
58
54
  "%project_name%/lib/%project_path%/configuration/loader.rb.erb",
59
- "%project_name%/lib/%project_path%/container.rb.erb"
55
+ "%project_name%/lib/%project_path%/container.rb.erb",
56
+ "%project_name%/lib/%project_path%/import.rb.erb"
57
+ ].each { |path| builder.call(configuration.merge(template_path: path)).render }
58
+ end
59
+
60
+ def render_cli
61
+ [
62
+ "%project_name%/lib/%project_path%/cli/actions/config.rb.erb",
63
+ "%project_name%/lib/%project_path%/cli/actions/container.rb.erb",
64
+ "%project_name%/lib/%project_path%/cli/actions/import.rb.erb",
65
+ "%project_name%/lib/%project_path%/cli/parser.rb.erb",
66
+ "%project_name%/lib/%project_path%/cli/parsers/core.rb.erb",
67
+ "%project_name%/lib/%project_path%/cli/shell.rb.erb"
60
68
  ].each { |path| builder.call(configuration.merge(template_path: path)).render }
61
69
  end
62
70
 
@@ -77,7 +85,7 @@ module Gemsmith
77
85
  return unless configuration.build_rspec
78
86
 
79
87
  [
80
- "%project_name%/spec/support/shared_contexts/application_container.rb.erb",
88
+ "%project_name%/spec/support/shared_contexts/application_dependencies.rb.erb",
81
89
  "%project_name%/spec/support/shared_examples/a_parser.rb.erb"
82
90
  ].each { |path| builder.call(configuration.merge(template_path: path)).render }
83
91
  end
@@ -5,12 +5,15 @@ module Gemsmith
5
5
  module Git
6
6
  # Builds project skeleton initial Git commit message.
7
7
  class Commit
8
+ include Import[:specification]
9
+
8
10
  def self.call(...) = new(...).call
9
11
 
10
- def initialize configuration, builder: Rubysmith::Builder, container: Container
12
+ def initialize configuration, builder: Rubysmith::Builder, **dependencies
13
+ super(**dependencies)
14
+
11
15
  @configuration = configuration
12
16
  @builder = builder
13
- @container = container
14
17
  end
15
18
 
16
19
  def call
@@ -28,7 +31,7 @@ module Gemsmith
28
31
 
29
32
  private
30
33
 
31
- attr_reader :configuration, :builder, :container
34
+ attr_reader :configuration, :builder
32
35
 
33
36
  def body
34
37
  <<~CONTENT
@@ -38,8 +41,6 @@ module Gemsmith
38
41
  end
39
42
 
40
43
  def project_name = configuration.project_name
41
-
42
- def specification = container[__method__]
43
44
  end
44
45
  end
45
46
  end
@@ -5,9 +5,12 @@ module Gemsmith
5
5
  module Actions
6
6
  # Handles the config action.
7
7
  class Config
8
- def initialize client: Configuration::Loader::CLIENT, container: Container
8
+ include Gemsmith::Import[:kernel, :logger]
9
+
10
+ def initialize client: Configuration::Loader::CLIENT, **dependencies
11
+ super(**dependencies)
12
+
9
13
  @client = client
10
- @container = container
11
14
  end
12
15
 
13
16
  def call selection
@@ -20,15 +23,11 @@ module Gemsmith
20
23
 
21
24
  private
22
25
 
23
- attr_reader :client, :container
26
+ attr_reader :client
24
27
 
25
28
  def edit = kernel.system("$EDITOR #{client.current}")
26
29
 
27
30
  def view = kernel.system("cat #{client.current}")
28
-
29
- def kernel = container[__method__]
30
-
31
- def logger = container[__method__]
32
31
  end
33
32
  end
34
33
  end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "dry/container"
4
+
5
+ module Gemsmith
6
+ module CLI
7
+ module Actions
8
+ # Provides a single container with application and action specific dependencies.
9
+ module Container
10
+ extend Dry::Container::Mixin
11
+
12
+ config.registry = ->(container, key, value, _options) { container[key.to_s] = value }
13
+
14
+ merge Gemsmith::Container
15
+
16
+ register(:config) { Config.new }
17
+ register(:build) { Build.new }
18
+ register(:install) { Install.new }
19
+ register(:publish) { Publish.new }
20
+ register(:edit) { Edit.new }
21
+ register(:view) { View.new }
22
+ end
23
+ end
24
+ end
25
+ end
@@ -8,12 +8,14 @@ module Gemsmith
8
8
  module Actions
9
9
  # Handles the edit action for editing an installed gem.
10
10
  class Edit
11
+ include Gemsmith::Import[:kernel, :logger]
11
12
  include Dry::Monads[:result]
12
13
 
13
- def initialize picker: Spek::Picker, editor: Tools::Editor.new, container: Container
14
+ def initialize picker: Spek::Picker, editor: Tools::Editor.new, **dependencies
15
+ super(**dependencies)
16
+
14
17
  @picker = picker
15
18
  @editor = editor
16
- @container = container
17
19
  end
18
20
 
19
21
  def call gem_name
@@ -26,13 +28,9 @@ module Gemsmith
26
28
 
27
29
  private
28
30
 
29
- attr_reader :picker, :editor, :container
31
+ attr_reader :picker, :editor
30
32
 
31
33
  def error(&) = logger.error(&)
32
-
33
- def kernel = container[__method__]
34
-
35
- def logger = container[__method__]
36
34
  end
37
35
  end
38
36
  end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "auto_injector"
4
+
5
+ module Gemsmith
6
+ module CLI
7
+ module Actions
8
+ Import = AutoInjector[Container]
9
+ end
10
+ end
11
+ end
@@ -8,12 +8,14 @@ module Gemsmith
8
8
  module Actions
9
9
  # Handles the install action.
10
10
  class Install
11
+ include Gemsmith::Import[:logger]
11
12
  include Dry::Monads[:result]
12
13
 
13
- def initialize installer: Tools::Installer.new, loader: Spek::Loader, container: Container
14
+ def initialize installer: Tools::Installer.new, loader: Spek::Loader, **dependencies
15
+ super(**dependencies)
16
+
14
17
  @installer = installer
15
18
  @loader = loader
16
- @container = container
17
19
  end
18
20
 
19
21
  def call configuration
@@ -26,11 +28,9 @@ module Gemsmith
26
28
 
27
29
  private
28
30
 
29
- attr_reader :installer, :loader, :container
31
+ attr_reader :installer, :loader
30
32
 
31
33
  def error(&) = logger.error(&)
32
-
33
- def logger = container[__method__]
34
34
  end
35
35
  end
36
36
  end
@@ -8,12 +8,14 @@ module Gemsmith
8
8
  module Actions
9
9
  # Handles the publish action.
10
10
  class Publish
11
+ include Gemsmith::Import[:logger]
11
12
  include Dry::Monads[:result]
12
13
 
13
- def initialize publisher: Tools::Publisher.new, loader: Spek::Loader, container: Container
14
+ def initialize publisher: Tools::Publisher.new, loader: Spek::Loader, **dependencies
15
+ super(**dependencies)
16
+
14
17
  @publisher = publisher
15
18
  @loader = loader
16
- @container = container
17
19
  end
18
20
 
19
21
  def call configuration
@@ -26,11 +28,9 @@ module Gemsmith
26
28
 
27
29
  private
28
30
 
29
- attr_reader :publisher, :loader, :container
31
+ attr_reader :publisher, :loader
30
32
 
31
33
  def error(&) = logger.error(&)
32
-
33
- def logger = container[__method__]
34
34
  end
35
35
  end
36
36
  end
@@ -8,12 +8,14 @@ module Gemsmith
8
8
  module Actions
9
9
  # Handles the view action for viewing an installed gem in default browser.
10
10
  class View
11
+ include Gemsmith::Import[:kernel, :logger]
11
12
  include Dry::Monads[:result]
12
13
 
13
- def initialize picker: Spek::Picker, viewer: Tools::Viewer.new, container: Container
14
+ def initialize picker: Spek::Picker, viewer: Tools::Viewer.new, **dependencies
15
+ super(**dependencies)
16
+
14
17
  @picker = picker
15
18
  @viewer = viewer
16
- @container = container
17
19
  end
18
20
 
19
21
  def call gem_name
@@ -26,13 +28,9 @@ module Gemsmith
26
28
 
27
29
  private
28
30
 
29
- attr_reader :picker, :viewer, :container
31
+ attr_reader :picker, :viewer
30
32
 
31
33
  def error(&) = logger.error(&)
32
-
33
- def kernel = container[__method__]
34
-
35
- def logger = container[__method__]
36
34
  end
37
35
  end
38
36
  end
@@ -6,28 +6,32 @@ module Gemsmith
6
6
  module CLI
7
7
  # Assembles and parses all Command Line Interface (CLI) options.
8
8
  class Parser
9
+ include Import[:configuration]
10
+
9
11
  CLIENT = OptionParser.new nil, 40, " "
10
12
 
11
13
  # Order is important.
12
14
  SECTIONS = [Parsers::Core, Rubysmith::CLI::Parsers::Build, Parsers::Build].freeze
13
15
 
14
- def initialize sections: SECTIONS, client: CLIENT, container: Container
16
+ def initialize sections: SECTIONS, client: CLIENT, **dependencies
17
+ super(**dependencies)
18
+
15
19
  @sections = sections
16
20
  @client = client
17
- @configuration = container[:configuration].dup
21
+ @configuration_duplicate = configuration.dup
18
22
  end
19
23
 
20
24
  def call arguments = []
21
- sections.each { |section| section.call configuration, client: }
25
+ sections.each { |section| section.call configuration_duplicate, client: }
22
26
  client.parse arguments
23
- configuration.freeze
27
+ configuration_duplicate.freeze
24
28
  end
25
29
 
26
30
  def to_s = client.to_s
27
31
 
28
32
  private
29
33
 
30
- attr_reader :sections, :client, :configuration
34
+ attr_reader :sections, :client, :configuration_duplicate
31
35
  end
32
36
  end
33
37
  end
@@ -7,16 +7,20 @@ module Gemsmith
7
7
  module Parsers
8
8
  # Handles parsing of Command Line Interface (CLI) build options.
9
9
  class Build
10
+ include Import[:colorizer]
11
+
10
12
  using Refinements::Structs
11
13
 
12
14
  def self.call(...) = new(...).call
13
15
 
14
16
  def initialize configuration = Container[:configuration],
15
17
  client: Parser::CLIENT,
16
- container: Container
18
+ **dependencies
19
+
20
+ super(**dependencies)
21
+
17
22
  @configuration = configuration
18
23
  @client = client
19
- @container = container
20
24
  end
21
25
 
22
26
  def call arguments = []
@@ -27,7 +31,7 @@ module Gemsmith
27
31
 
28
32
  private
29
33
 
30
- attr_reader :configuration, :client, :container
34
+ attr_reader :configuration, :client
31
35
 
32
36
  def add_cli
33
37
  client.on(
@@ -46,8 +50,6 @@ module Gemsmith
46
50
  .then { |boolean| boolean ? colorizer.green(boolean) : colorizer.red(boolean) }
47
51
  .then { |colored_boolean| "Default: #{colored_boolean}" }
48
52
  end
49
-
50
- def colorizer = container[__method__]
51
53
  end
52
54
  end
53
55
  end
@@ -8,16 +8,19 @@ module Gemsmith
8
8
  module Parsers
9
9
  # Handles parsing of Command Line Interface (CLI) core options.
10
10
  class Core
11
+ include Import[:specification]
12
+
11
13
  using Refinements::Structs
12
14
 
13
15
  def self.call(...) = new(...).call
14
16
 
15
17
  def initialize configuration = Container[:configuration],
16
18
  client: Parser::CLIENT,
17
- container: Container
19
+ **dependencies
20
+ super(**dependencies)
21
+
18
22
  @configuration = configuration
19
23
  @client = client
20
- @container = container
21
24
  end
22
25
 
23
26
  def call arguments = []
@@ -30,7 +33,7 @@ module Gemsmith
30
33
 
31
34
  private
32
35
 
33
- attr_reader :configuration, :client, :container
36
+ attr_reader :configuration, :client
34
37
 
35
38
  def collate = private_methods.sort.grep(/add_/).each { |method| __send__ method }
36
39
 
@@ -86,8 +89,6 @@ module Gemsmith
86
89
  configuration.merge! action_help: true
87
90
  end
88
91
  end
89
-
90
- def specification = container[__method__]
91
92
  end
92
93
  end
93
94
  end
@@ -4,19 +4,20 @@ module Gemsmith
4
4
  module CLI
5
5
  # The main Command Line Interface (CLI) object.
6
6
  class Shell
7
- ACTIONS = {
8
- config: Actions::Config.new,
9
- build: Actions::Build.new,
10
- install: Actions::Install.new,
11
- publish: Actions::Publish.new,
12
- edit: Actions::Edit.new,
13
- view: Actions::View.new
14
- }.freeze
15
-
16
- def initialize parser: Parser.new, actions: ACTIONS, container: Container
7
+ include Actions::Import[
8
+ :config,
9
+ :build,
10
+ :install,
11
+ :publish,
12
+ :edit,
13
+ :view,
14
+ :specification,
15
+ :logger
16
+ ]
17
+
18
+ def initialize parser: Parser.new, **dependencies
19
+ super(**dependencies)
17
20
  @parser = parser
18
- @actions = actions
19
- @container = container
20
21
  end
21
22
 
22
23
  def call arguments = []
@@ -27,40 +28,20 @@ module Gemsmith
27
28
 
28
29
  private
29
30
 
30
- attr_reader :parser, :actions, :container
31
+ attr_reader :parser
31
32
 
32
33
  def perform configuration
33
34
  case configuration
34
- in action_config: Symbol => action then config action
35
- in action_build: true then build configuration
36
- in action_install: true then install configuration
37
- in action_publish: true then publish configuration
38
- in action_edit: String => gem_name then edit gem_name
39
- in action_view: String => gem_name then view gem_name
35
+ in action_config: Symbol => action then config.call action
36
+ in action_build: true then build.call configuration
37
+ in action_install: true then install.call configuration
38
+ in action_publish: true then publish.call configuration
39
+ in action_edit: String => gem_name then edit.call gem_name
40
+ in action_view: String => gem_name then view.call gem_name
40
41
  in action_version: true then logger.info { specification.labeled_version }
41
- else usage
42
+ else logger.any { parser.to_s }
42
43
  end
43
44
  end
44
-
45
- def config(action) = actions.fetch(__method__).call(action)
46
-
47
- def build(configuration) = actions.fetch(__method__).call(configuration)
48
-
49
- def install(configuration) = actions.fetch(__method__).call(configuration)
50
-
51
- def publish(configuration) = actions.fetch(__method__).call(configuration)
52
-
53
- def edit(gem_name) = actions.fetch(__method__).call(gem_name)
54
-
55
- def view(gem_name) = actions.fetch(__method__).call(gem_name)
56
-
57
- def usage = logger.unknown { parser.to_s }
58
-
59
- def logger = container[__method__]
60
-
61
- def specification = container[__method__]
62
-
63
- def process = container[__method__]
64
45
  end
65
46
  end
66
47
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "dry-container"
3
+ require "dry/container"
4
4
  require "open3"
5
5
  require "spek"
6
6
 
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "auto_injector"
4
+
5
+ module Gemsmith
6
+ Import = AutoInjector[Container]
7
+ end
@@ -23,10 +23,10 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  spec.required_ruby_version = "~> <%= RUBY_VERSION[/\d+\.\d+/] %>"
25
25
  <% if configuration.build_cli %>
26
- spec.add_dependency "dry-container", "~> 0.9"
26
+ spec.add_dependency "auto_injector", "~> 0.4"
27
27
  <% end %>
28
28
  <% if configuration.build_cli %>
29
- spec.add_dependency "pastel", "~> 0.8"
29
+ spec.add_dependency "dry-container", "~> 0.9"
30
30
  <% end %>
31
31
  <% if configuration.build_refinements %>
32
32
  spec.add_dependency "refinements", "~> 9.2"
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
35
35
  spec.add_dependency "runcom", "~> 8.2"
36
36
  <% end %>
37
37
  <% if configuration.build_cli %>
38
- spec.add_dependency "spek", "~> 0.0"
38
+ spec.add_dependency "spek", "~> 0.2"
39
39
  <% end %>
40
40
  <% if configuration.build_zeitwerk %>
41
41
  spec.add_dependency "zeitwerk", "~> 2.5"
@@ -1,13 +1,14 @@
1
- # frozen_string_literal: true
2
-
3
1
  <% namespace do %>
4
2
  module CLI
5
3
  module Actions
6
4
  # Handles the config action.
7
5
  class Config
8
- def initialize client: Configuration::Loader::CLIENT, container: Container
6
+ include <%= configuration.project_class %>::Import[:kernel, :logger]
7
+
8
+ def initialize client: Configuration::Loader::CLIENT, **dependencies
9
+ super(**dependencies)
10
+
9
11
  @client = client
10
- @container = container
11
12
  end
12
13
 
13
14
  def call selection
@@ -20,15 +21,11 @@
20
21
 
21
22
  private
22
23
 
23
- attr_reader :client, :container
24
+ attr_reader :client
24
25
 
25
26
  def edit = kernel.system("$EDITOR #{client.current}")
26
27
 
27
28
  def view = kernel.system("cat #{client.current}")
28
-
29
- def kernel = container[__method__]
30
-
31
- def logger = container[__method__]
32
29
  end
33
30
  end
34
31
  end
@@ -0,0 +1,18 @@
1
+ require "dry/container"
2
+
3
+ <% namespace do %>
4
+ module CLI
5
+ module Actions
6
+ # Provides a single container of application and action specific dependencies.
7
+ module Container
8
+ extend Dry::Container::Mixin
9
+
10
+ config.registry = ->(container, key, value, _options) { container[key.to_s] = value }
11
+
12
+ merge <%= configuration.project_namespaced_class %>::Container
13
+
14
+ register(:config) { Config.new }
15
+ end
16
+ end
17
+ end
18
+ <% end %>
@@ -0,0 +1,9 @@
1
+ require "auto_injector"
2
+
3
+ <% namespace do %>
4
+ module CLI
5
+ module Actions
6
+ Import = AutoInjector[Container]
7
+ end
8
+ end
9
+ <% end %>
@@ -4,28 +4,32 @@ require "optparse"
4
4
  module CLI
5
5
  # Assembles and parses all Command Line Interface (CLI) options.
6
6
  class Parser
7
+ include Import[:configuration]
8
+
7
9
  CLIENT = OptionParser.new nil, 40, " "
8
10
 
9
11
  # Order is important.
10
12
  SECTIONS = [Parsers::Core].freeze
11
13
 
12
- def initialize sections: SECTIONS, client: CLIENT, container: Container
14
+ def initialize sections: SECTIONS, client: CLIENT, **dependencies
15
+ super(**dependencies)
16
+
13
17
  @sections = sections
14
18
  @client = client
15
- @configuration = container[:configuration].dup
19
+ @configuration_duplicate = configuration.dup
16
20
  end
17
21
 
18
22
  def call arguments = []
19
- sections.each { |section| section.call configuration, client: }
23
+ sections.each { |section| section.call configuration_duplicate, client: }
20
24
  client.parse arguments
21
- configuration.freeze
25
+ configuration_duplicate.freeze
22
26
  end
23
27
 
24
28
  def to_s = client.to_s
25
29
 
26
30
  private
27
31
 
28
- attr_reader :sections, :client, :configuration
32
+ attr_reader :sections, :client, :configuration_duplicate
29
33
  end
30
34
  end
31
35
  <% end %>
@@ -5,16 +5,19 @@ require "refinements/structs"
5
5
  module Parsers
6
6
  # Handles parsing of Command Line Interface (CLI) core options.
7
7
  class Core
8
+ include Import[:specification]
9
+
8
10
  using Refinements::Structs
9
11
 
10
12
  def self.call(...) = new(...).call
11
13
 
12
14
  def initialize configuration = Container[:configuration],
13
15
  client: Parser::CLIENT,
14
- container: Container
16
+ **dependencies
17
+
18
+ super(**dependencies)
15
19
  @configuration = configuration
16
20
  @client = client
17
- @container = container
18
21
  end
19
22
 
20
23
  def call arguments = []
@@ -27,7 +30,7 @@ require "refinements/structs"
27
30
 
28
31
  private
29
32
 
30
- attr_reader :configuration, :client, :container
33
+ attr_reader :configuration, :client
31
34
 
32
35
  def collate = private_methods.sort.grep(/add_/).each { |method| __send__ method }
33
36
 
@@ -51,8 +54,6 @@ require "refinements/structs"
51
54
  configuration.merge! action_help: true
52
55
  end
53
56
  end
54
-
55
- def specification = container[__method__]
56
57
  end
57
58
  end
58
59
  end