pennyworth 11.2.2 → 12.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/LICENSE.adoc +207 -155
  4. data/README.adoc +28 -45
  5. data/exe/pennyworth +0 -1
  6. data/lib/pennyworth/cli/actions/config.rb +1 -1
  7. data/lib/pennyworth/cli/actions/encodings.rb +1 -1
  8. data/lib/pennyworth/cli/actions/git_hub.rb +1 -1
  9. data/lib/pennyworth/cli/actions/http_statuses.rb +1 -1
  10. data/lib/pennyworth/cli/actions/ruby_gems.rb +1 -1
  11. data/lib/pennyworth/cli/actions/system/errors.rb +1 -1
  12. data/lib/pennyworth/cli/actions/system/signals.rb +1 -1
  13. data/lib/pennyworth/cli/actions/text.rb +1 -1
  14. data/lib/pennyworth/cli/parser.rb +33 -0
  15. data/lib/pennyworth/cli/parsers/core.rb +11 -5
  16. data/lib/pennyworth/cli/parsers/git_hub.rb +3 -2
  17. data/lib/pennyworth/cli/parsers/ruby_gems.rb +3 -2
  18. data/lib/pennyworth/cli/shell.rb +5 -3
  19. data/lib/pennyworth/configuration/content.rb +33 -0
  20. data/lib/pennyworth/{cli/configuration → configuration}/defaults.yml +0 -0
  21. data/lib/pennyworth/configuration/loader.rb +35 -0
  22. data/lib/pennyworth/container.rb +4 -1
  23. data/lib/pennyworth/inflector.rb +1 -1
  24. data/lib/pennyworth/integrations/git_hub/client.rb +1 -1
  25. data/lib/pennyworth/loaders/http_statuses.rb +2 -2
  26. data/lib/pennyworth/loaders/system/signals.rb +1 -1
  27. data/lib/pennyworth/presenters/gem.rb +6 -1
  28. data/lib/pennyworth/presenters/repository.rb +6 -1
  29. data/lib/pennyworth/serializers/project.rb +2 -2
  30. data/pennyworth.gemspec +39 -0
  31. data.tar.gz.sig +0 -0
  32. metadata +16 -16
  33. metadata.gz.sig +0 -0
  34. data/lib/pennyworth/cli/configuration/content.rb +0 -28
  35. data/lib/pennyworth/cli/configuration/loader.rb +0 -37
  36. data/lib/pennyworth/cli/parsers/assembler.rb +0 -32
  37. data/lib/pennyworth/cli/parsers.rb +0 -11
  38. data/lib/pennyworth/identity.rb +0 -12
@@ -5,7 +5,7 @@ module Pennyworth
5
5
  module Actions
6
6
  # Handles the configuration action.
7
7
  class Config
8
- def initialize configuration: Configuration::Loader::HANDLER, container: Container
8
+ def initialize configuration: Configuration::Loader::CLIENT, container: Container
9
9
  @configuration = configuration
10
10
  @container = container
11
11
  end
@@ -10,7 +10,7 @@ module Pennyworth
10
10
  @container = container
11
11
  end
12
12
 
13
- def call = processor.call.to_json.then { |json| logger.info json }
13
+ def call = processor.call.to_json.then { |json| logger.info { json } }
14
14
 
15
15
  private
16
16
 
@@ -13,7 +13,7 @@ module Pennyworth
13
13
  def call endpoint
14
14
  processor.call(endpoint)
15
15
  .to_json
16
- .then { |json| logger.info json }
16
+ .then { |json| logger.info { json } }
17
17
  end
18
18
 
19
19
  private
@@ -10,7 +10,7 @@ module Pennyworth
10
10
  @container = container
11
11
  end
12
12
 
13
- def call = processor.call.to_json.then { |json| logger.info json }
13
+ def call = processor.call.to_json.then { |json| logger.info { json } }
14
14
 
15
15
  private
16
16
 
@@ -13,7 +13,7 @@ module Pennyworth
13
13
  def call endpoint
14
14
  processor.call(endpoint)
15
15
  .to_json
16
- .then { |json| logger.info json }
16
+ .then { |json| logger.info { json } }
17
17
  end
18
18
 
19
19
  private
@@ -11,7 +11,7 @@ module Pennyworth
11
11
  @container = container
12
12
  end
13
13
 
14
- def call = processor.call.to_json.then { |json| logger.info json }
14
+ def call = processor.call.to_json.then { |json| logger.info { json } }
15
15
 
16
16
  private
17
17
 
@@ -11,7 +11,7 @@ module Pennyworth
11
11
  @container = container
12
12
  end
13
13
 
14
- def call = processor.call.to_json.then { |json| logger.info json }
14
+ def call = processor.call.to_json.then { |json| logger.info { json } }
15
15
 
16
16
  private
17
17
 
@@ -10,7 +10,7 @@ module Pennyworth
10
10
  @container = container
11
11
  end
12
12
 
13
- def call(content) = processor.call(content).to_json.then { |json| logger.info json }
13
+ def call(content) = processor.call(content).to_json.then { |json| logger.info { json } }
14
14
 
15
15
  private
16
16
 
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "optparse"
4
+
5
+ module Pennyworth
6
+ module CLI
7
+ # Assembles and parses all Command Line Interface (CLI) options.
8
+ class Parser
9
+ CLIENT = OptionParser.new nil, 40, " "
10
+ SECTIONS = [Parsers::Core, Parsers::GitHub, Parsers::RubyGems].freeze # Order is important.
11
+
12
+ def initialize configuration = Configuration::Loader.call,
13
+ sections: SECTIONS,
14
+ client: CLIENT
15
+ @configuration = configuration.dup
16
+ @sections = sections
17
+ @client = client
18
+ end
19
+
20
+ def call arguments = []
21
+ sections.each { |parser| parser.call configuration, client: }
22
+ client.parse arguments
23
+ configuration.freeze
24
+ end
25
+
26
+ def to_s = client.to_s
27
+
28
+ private
29
+
30
+ attr_reader :configuration, :client, :sections
31
+ end
32
+ end
33
+ end
@@ -12,21 +12,25 @@ module Pennyworth
12
12
  class Core
13
13
  def self.call(...) = new(...).call
14
14
 
15
- def initialize configuration = Configuration::Loader.call, client: CLIENT
15
+ def initialize configuration = Configuration::Loader.call,
16
+ client: Parser::CLIENT,
17
+ container: Container
16
18
  @configuration = configuration
17
19
  @client = client
20
+ @container = container
18
21
  end
19
22
 
20
23
  def call arguments = []
21
- client.banner = "#{Identity::LABEL} - #{Identity::SUMMARY}"
24
+ client.banner = "Pennyworth - #{specification.summary}"
22
25
  client.separator "\nUSAGE:\n"
23
26
  collate
24
- arguments.empty? ? arguments : client.parse!(arguments)
27
+ client.parse arguments
28
+ configuration
25
29
  end
26
30
 
27
31
  private
28
32
 
29
- attr_reader :configuration, :client
33
+ attr_reader :configuration, :client, :container
30
34
 
31
35
  def collate = private_methods.sort.grep(/add_/).each { |method| __send__ method }
32
36
 
@@ -85,7 +89,7 @@ module Pennyworth
85
89
 
86
90
  def add_version
87
91
  client.on "-v", "--version", "Show gem version." do
88
- configuration.action_version = Identity::VERSION_LABEL
92
+ configuration.action_version = true
89
93
  end
90
94
  end
91
95
 
@@ -94,6 +98,8 @@ module Pennyworth
94
98
  configuration.action_help = true
95
99
  end
96
100
  end
101
+
102
+ def specification = container[__method__]
97
103
  end
98
104
  end
99
105
  end
@@ -11,7 +11,7 @@ module Pennyworth
11
11
 
12
12
  def self.call(...) = new(...).call
13
13
 
14
- def initialize configuration = Configuration::Loader.call, client: CLIENT
14
+ def initialize configuration = Configuration::Loader.call, client: Parser::CLIENT
15
15
  @configuration = configuration
16
16
  @client = client
17
17
  end
@@ -19,7 +19,8 @@ module Pennyworth
19
19
  def call arguments = []
20
20
  client.separator "\nGITHUB OPTIONS:\n"
21
21
  private_methods.sort.grep(/add_/).each { |method| __send__ method }
22
- arguments.empty? ? arguments : client.parse!(arguments)
22
+ client.parse arguments
23
+ configuration
23
24
  end
24
25
 
25
26
  private
@@ -7,7 +7,7 @@ module Pennyworth
7
7
  class RubyGems
8
8
  def self.call(...) = new(...).call
9
9
 
10
- def initialize configuration = Configuration::Loader.call, client: CLIENT
10
+ def initialize configuration = Configuration::Loader.call, client: Parser::CLIENT
11
11
  @configuration = configuration
12
12
  @client = client
13
13
  end
@@ -15,7 +15,8 @@ module Pennyworth
15
15
  def call arguments = []
16
16
  client.separator "\nRUBYGEMS OPTIONS:\n"
17
17
  add_owner
18
- arguments.empty? ? arguments : client.parse!(arguments)
18
+ client.parse arguments
19
+ configuration
19
20
  end
20
21
 
21
22
  private
@@ -15,7 +15,7 @@ module Pennyworth
15
15
  text: Actions::Text.new
16
16
  }.freeze
17
17
 
18
- def initialize parser: Parsers::Assembler.new, actions: ACTIONS, container: Container
18
+ def initialize parser: Parser.new, actions: ACTIONS, container: Container
19
19
  @parser = parser
20
20
  @actions = actions
21
21
  @container = container
@@ -24,7 +24,7 @@ module Pennyworth
24
24
  def call arguments = []
25
25
  perform parser.call(arguments)
26
26
  rescue OptionParser::ParseError, KeyError => error
27
- logger.error error.message
27
+ logger.error { error.message }
28
28
  end
29
29
 
30
30
  private
@@ -43,7 +43,7 @@ module Pennyworth
43
43
  in action_system_signals: true then system_signals
44
44
  in action_system_errors: true then system_errors
45
45
  in action_text: String => content then text content
46
- in action_version: String => version then logger.info version
46
+ in action_version: true then logger.info { "Pennyworth #{specification.version}" }
47
47
  else usage
48
48
  end
49
49
  end
@@ -75,6 +75,8 @@ module Pennyworth
75
75
 
76
76
  def usage = logger.unknown { parser.to_s }
77
77
 
78
+ def specification = container[__method__]
79
+
78
80
  def logger = container[__method__]
79
81
  end
80
82
  end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pennyworth
4
+ module Configuration
5
+ # Defines configuration content as the primary source of truth for use throughout the gem.
6
+ Content = Struct.new(
7
+ :action_encodings,
8
+ :action_git_hub,
9
+ :action_http_statuses,
10
+ :action_ruby_gems,
11
+ :action_system_errors,
12
+ :action_system_signals,
13
+ :action_text,
14
+ :action_config,
15
+ :action_version,
16
+ :action_help,
17
+ :alfred_preferences,
18
+ :inflections,
19
+ :git_hub_api_url,
20
+ :git_hub_organization,
21
+ :git_hub_user,
22
+ :http_statuses_url,
23
+ :ruby_gems_api_url,
24
+ :ruby_gems_owner,
25
+ keyword_init: true
26
+ ) do
27
+ def initialize *arguments
28
+ super
29
+ freeze
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "pathname"
4
+ require "refinements/hashes"
5
+ require "refinements/structs"
6
+ require "runcom"
7
+ require "yaml"
8
+
9
+ module Pennyworth
10
+ module Configuration
11
+ # Represents the fully assembled Command Line Interface (CLI) configuration.
12
+ class Loader
13
+ using Refinements::Hashes
14
+ using Refinements::Structs
15
+
16
+ DEFAULTS = YAML.load_file(Pathname(__dir__).join("defaults.yml")).freeze
17
+ CLIENT = Runcom::Config.new "pennyworth/configuration.yml", defaults: DEFAULTS
18
+
19
+ def self.call = new.call
20
+
21
+ def self.with_defaults = new(client: DEFAULTS)
22
+
23
+ def initialize content: Content.new, client: CLIENT
24
+ @content = content
25
+ @client = client
26
+ end
27
+
28
+ def call = content.merge(**client.to_h.flatten_keys)
29
+
30
+ private
31
+
32
+ attr_reader :content, :client
33
+ end
34
+ end
35
+ end
@@ -10,7 +10,10 @@ module Pennyworth
10
10
  module Container
11
11
  extend Dry::Container::Mixin
12
12
 
13
- register(:configuration) { CLI::Configuration::Loader.call }
13
+ SPEC_PATH = "#{__dir__}/../../pennyworth.gemspec".freeze
14
+
15
+ register(:configuration) { Configuration::Loader.call }
16
+ register(:specification) { Gem::Specification.load SPEC_PATH }
14
17
  register(:environment) { ENV }
15
18
  register(:kernel) { Kernel }
16
19
  register(:http) { HTTP }
@@ -3,7 +3,7 @@
3
3
  module Pennyworth
4
4
  # Overrides any string to desired form if matched, otherwise answers the original string.
5
5
  class Inflector
6
- DEFAULTS = Array(CLI::Configuration::Loader.call.inflections).reduce({}, :merge)
6
+ DEFAULTS = Array(Configuration::Loader.call.inflections).reduce({}, :merge)
7
7
 
8
8
  def initialize overrides = DEFAULTS
9
9
  @overrides = overrides
@@ -20,7 +20,7 @@ module Pennyworth
20
20
  end
21
21
 
22
22
  def get endpoint, parameters: {}
23
- paginate ->(page) { sole_get endpoint, parameters: parameters.merge(page: page) }
23
+ paginate ->(page) { sole_get endpoint, parameters: parameters.merge(page:) }
24
24
  end
25
25
 
26
26
  private
@@ -8,14 +8,14 @@ module Pennyworth
8
8
  class HTTPStatuses
9
9
  def initialize codes: Rack::Utils::HTTP_STATUS_CODES,
10
10
  model: Models::HTTPStatus,
11
- configuration: CLI::Configuration::Loader.call
11
+ configuration: Configuration::Loader.call
12
12
  @codes = codes
13
13
  @model = model
14
14
  @configuration = configuration
15
15
  end
16
16
 
17
17
  def call _omit = nil
18
- codes.map { |(code, label)| model[code: code, label: label, url: "#{url}/#{code}"] }
18
+ codes.map { |(code, label)| model[code:, label:, url: "#{url}/#{code}"] }
19
19
  end
20
20
 
21
21
  private
@@ -10,7 +10,7 @@ module Pennyworth
10
10
  @model = model
11
11
  end
12
12
 
13
- def call(_omit = nil) = list.map { |name, number| model[number: number, name: name] }
13
+ def call(_omit = nil) = list.map { |name, number| model[number:, name:] }
14
14
 
15
15
  private
16
16
 
@@ -34,10 +34,15 @@ module Pennyworth
34
34
 
35
35
  def source_url = record.fetch(:source_code_uri)
36
36
 
37
- def changes_url = record.fetch(:changelog_uri)
37
+ def changes_url
38
+ warn "[DEPRECATION]: #changes_url is deprecated, use #versions_url instead."
39
+ versions_url
40
+ end
38
41
 
39
42
  def issues_url = record.fetch(:bug_tracker_uri)
40
43
 
44
+ def versions_url = record.fetch(:changelog_uri)
45
+
41
46
  def updated_at = record.fetch(:version_created_at)
42
47
 
43
48
  private
@@ -23,10 +23,15 @@ module Pennyworth
23
23
 
24
24
  def source_url = record.fetch(:html_url)
25
25
 
26
- def changes_url = "#{site_url}/changes.html"
26
+ def changes_url
27
+ warn "[DEPRECATION]: #changes_url is deprecated, use #versions_url instead."
28
+ versions_url
29
+ end
27
30
 
28
31
  def issues_url = "#{source_url}/issues"
29
32
 
33
+ def versions_url = "#{site_url}/versions"
34
+
30
35
  private
31
36
 
32
37
  attr_reader :record, :inflector
@@ -26,9 +26,9 @@ module Pennyworth
26
26
 
27
27
  def modifications
28
28
  {
29
- control: modification(presenter.changes_url, "View changes."),
30
29
  alt: modification(presenter.source_url, "View source."),
31
- cmd: modification(presenter.issues_url, "View issues.")
30
+ cmd: modification(presenter.issues_url, "View issues."),
31
+ control: modification(presenter.versions_url, "View versions.")
32
32
  }
33
33
  end
34
34
 
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "pennyworth"
5
+ spec.version = "12.1.0"
6
+ spec.platform = Gem::Platform::RUBY
7
+ spec.authors = ["Brooke Kuhlmann"]
8
+ spec.email = ["brooke@alchemists.io"]
9
+ spec.homepage = "https://www.alchemists.io/projects/pennyworth"
10
+ spec.summary = "A command line interface that augments Alfred workflows."
11
+ spec.license = "Hippocratic-3.0"
12
+
13
+ spec.metadata = {
14
+ "bug_tracker_uri" => "https://github.com/bkuhlmann/pennyworth/issues",
15
+ "changelog_uri" => "https://www.alchemists.io/projects/pennyworth/versions",
16
+ "documentation_uri" => "https://www.alchemists.io/projects/pennyworth",
17
+ "label" => "Pennyworth",
18
+ "rubygems_mfa_required" => "true",
19
+ "source_code_uri" => "https://github.com/bkuhlmann/pennyworth"
20
+ }
21
+
22
+ spec.signing_key = Gem.default_key_path
23
+ spec.cert_chain = [Gem.default_cert_path]
24
+
25
+ spec.required_ruby_version = "~> 3.1"
26
+ spec.add_dependency "dry-container", "~> 0.8"
27
+ spec.add_dependency "http", "~> 5.0"
28
+ spec.add_dependency "pastel", "~> 0.8"
29
+ spec.add_dependency "rack", "~> 2.2"
30
+ spec.add_dependency "refinements", "~> 9.1"
31
+ spec.add_dependency "runcom", "~> 8.0"
32
+ spec.add_dependency "zeitwerk", "~> 2.5"
33
+
34
+ spec.bindir = "exe"
35
+ spec.executables << "pennyworth"
36
+ spec.extra_rdoc_files = Dir["README*", "LICENSE*"]
37
+ spec.files = Dir["*.gemspec", "lib/**/*"]
38
+ spec.require_paths = ["lib"]
39
+ end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pennyworth
3
3
  version: !ruby/object:Gem::Version
4
- version: 11.2.2
4
+ version: 12.1.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-11-20 00:00:00.000000000 Z
31
+ date: 2022-01-23 00:00:00.000000000 Z
32
32
  dependencies:
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: dry-container
@@ -92,28 +92,28 @@ dependencies:
92
92
  requirements:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: '8.5'
95
+ version: '9.1'
96
96
  type: :runtime
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - "~>"
101
101
  - !ruby/object:Gem::Version
102
- version: '8.5'
102
+ version: '9.1'
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: runcom
105
105
  requirement: !ruby/object:Gem::Requirement
106
106
  requirements:
107
107
  - - "~>"
108
108
  - !ruby/object:Gem::Version
109
- version: '7.0'
109
+ version: '8.0'
110
110
  type: :runtime
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - "~>"
115
115
  - !ruby/object:Gem::Version
116
- version: '7.0'
116
+ version: '8.0'
117
117
  - !ruby/object:Gem::Dependency
118
118
  name: zeitwerk
119
119
  requirement: !ruby/object:Gem::Requirement
@@ -150,17 +150,15 @@ files:
150
150
  - lib/pennyworth/cli/actions/system/errors.rb
151
151
  - lib/pennyworth/cli/actions/system/signals.rb
152
152
  - lib/pennyworth/cli/actions/text.rb
153
- - lib/pennyworth/cli/configuration/content.rb
154
- - lib/pennyworth/cli/configuration/defaults.yml
155
- - lib/pennyworth/cli/configuration/loader.rb
156
- - lib/pennyworth/cli/parsers.rb
157
- - lib/pennyworth/cli/parsers/assembler.rb
153
+ - lib/pennyworth/cli/parser.rb
158
154
  - lib/pennyworth/cli/parsers/core.rb
159
155
  - lib/pennyworth/cli/parsers/git_hub.rb
160
156
  - lib/pennyworth/cli/parsers/ruby_gems.rb
161
157
  - lib/pennyworth/cli/shell.rb
158
+ - lib/pennyworth/configuration/content.rb
159
+ - lib/pennyworth/configuration/defaults.yml
160
+ - lib/pennyworth/configuration/loader.rb
162
161
  - lib/pennyworth/container.rb
163
- - lib/pennyworth/identity.rb
164
162
  - lib/pennyworth/inflector.rb
165
163
  - lib/pennyworth/integrations/git_hub/client.rb
166
164
  - lib/pennyworth/integrations/git_hub/response.rb
@@ -190,13 +188,15 @@ files:
190
188
  - lib/pennyworth/serializers/system/error.rb
191
189
  - lib/pennyworth/serializers/system/signal.rb
192
190
  - lib/pennyworth/serializers/text.rb
191
+ - pennyworth.gemspec
193
192
  homepage: https://www.alchemists.io/projects/pennyworth
194
193
  licenses:
195
- - Apache-2.0
194
+ - Hippocratic-3.0
196
195
  metadata:
197
196
  bug_tracker_uri: https://github.com/bkuhlmann/pennyworth/issues
198
- changelog_uri: https://www.alchemists.io/projects/pennyworth/changes.html
197
+ changelog_uri: https://www.alchemists.io/projects/pennyworth/versions
199
198
  documentation_uri: https://www.alchemists.io/projects/pennyworth
199
+ label: Pennyworth
200
200
  rubygems_mfa_required: 'true'
201
201
  source_code_uri: https://github.com/bkuhlmann/pennyworth
202
202
  post_install_message:
@@ -207,14 +207,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
207
207
  requirements:
208
208
  - - "~>"
209
209
  - !ruby/object:Gem::Version
210
- version: '3.0'
210
+ version: '3.1'
211
211
  required_rubygems_version: !ruby/object:Gem::Requirement
212
212
  requirements:
213
213
  - - ">="
214
214
  - !ruby/object:Gem::Version
215
215
  version: '0'
216
216
  requirements: []
217
- rubygems_version: 3.2.31
217
+ rubygems_version: 3.3.5
218
218
  signing_key:
219
219
  specification_version: 4
220
220
  summary: A command line interface that augments Alfred workflows.
metadata.gz.sig CHANGED
Binary file
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Pennyworth
4
- module CLI
5
- module Configuration
6
- # Defines configuration content as the primary source of truth for use throughout the gem.
7
- Content = Struct.new :action_encodings,
8
- :action_git_hub,
9
- :action_http_statuses,
10
- :action_ruby_gems,
11
- :action_system_errors,
12
- :action_system_signals,
13
- :action_text,
14
- :action_config,
15
- :action_version,
16
- :action_help,
17
- :alfred_preferences,
18
- :inflections,
19
- :git_hub_api_url,
20
- :git_hub_organization,
21
- :git_hub_user,
22
- :http_statuses_url,
23
- :ruby_gems_api_url,
24
- :ruby_gems_owner,
25
- keyword_init: true
26
- end
27
- end
28
- end
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "pathname"
4
- require "refinements/hashes"
5
- require "refinements/structs"
6
- require "runcom"
7
- require "yaml"
8
-
9
- module Pennyworth
10
- module CLI
11
- module Configuration
12
- # Represents the fully assembled Command Line Interface (CLI) configuration.
13
- class Loader
14
- using Refinements::Hashes
15
- using Refinements::Structs
16
-
17
- DEFAULTS = YAML.load_file(Pathname(__dir__).join("defaults.yml")).freeze
18
- HANDLER = Runcom::Config.new "#{Identity::NAME}/configuration.yml", defaults: DEFAULTS
19
-
20
- def self.call = new.call
21
-
22
- def self.with_defaults = new(handler: DEFAULTS)
23
-
24
- def initialize content: Content.new, handler: HANDLER
25
- @content = content
26
- @handler = handler
27
- end
28
-
29
- def call = content.merge(**handler.to_h.flatten_keys)
30
-
31
- private
32
-
33
- attr_reader :content, :handler
34
- end
35
- end
36
- end
37
- end