pennyworth 11.2.0 → 12.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/LICENSE.adoc +207 -155
- data/README.adoc +38 -39
- data/{bin → exe}/pennyworth +0 -0
- data/lib/pennyworth/cli/actions/config.rb +1 -1
- data/lib/pennyworth/cli/actions/encodings.rb +1 -1
- data/lib/pennyworth/cli/actions/git_hub.rb +1 -1
- data/lib/pennyworth/cli/actions/http_statuses.rb +1 -1
- data/lib/pennyworth/cli/actions/ruby_gems.rb +1 -1
- data/lib/pennyworth/cli/actions/system/errors.rb +1 -1
- data/lib/pennyworth/cli/actions/system/signals.rb +1 -1
- data/lib/pennyworth/cli/actions/text.rb +1 -1
- data/lib/pennyworth/cli/parser.rb +33 -0
- data/lib/pennyworth/cli/parsers/core.rb +4 -3
- data/lib/pennyworth/cli/parsers/git_hub.rb +3 -2
- data/lib/pennyworth/cli/parsers/ruby_gems.rb +3 -2
- data/lib/pennyworth/cli/shell.rb +3 -3
- data/lib/pennyworth/configuration/content.rb +33 -0
- data/lib/pennyworth/{cli/configuration → configuration}/defaults.yml +0 -0
- data/lib/pennyworth/configuration/loader.rb +35 -0
- data/lib/pennyworth/container.rb +1 -1
- data/lib/pennyworth/identity.rb +1 -1
- data/lib/pennyworth/inflector.rb +1 -1
- data/lib/pennyworth/integrations/git_hub/client.rb +1 -1
- data/lib/pennyworth/loaders/http_statuses.rb +2 -2
- data/lib/pennyworth/loaders/system/signals.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +19 -19
- metadata.gz.sig +0 -0
- data/lib/pennyworth/cli/configuration/content.rb +0 -28
- data/lib/pennyworth/cli/configuration/loader.rb +0 -37
- data/lib/pennyworth/cli/parsers/assembler.rb +0 -32
- data/lib/pennyworth/cli/parsers.rb +0 -11
data/README.adoc
CHANGED
@@ -16,7 +16,7 @@ image::https://circleci.com/gh/bkuhlmann/pennyworth.svg?style=svg[Circle CI Stat
|
|
16
16
|
Pennyworth is a command line interface and the perfect companion to
|
17
17
|
link:https://www.alfredapp.com[Alfred]. With Pennyworth, you can unlock the full potential of the
|
18
18
|
Ruby language by leveraging modern versions of Ruby through Alfred Workflows. Perfect for when you
|
19
|
-
want to advance beyond the
|
19
|
+
want to advance beyond the basic workflows Alfred provides by default.
|
20
20
|
|
21
21
|
toc::[]
|
22
22
|
|
@@ -36,9 +36,18 @@ video::https://www.alchemists.io/videos/projects/pennyworth/demo.mp4[poster=http
|
|
36
36
|
. link:https://www.gnu.org/software/bash[Bash]
|
37
37
|
. link:https://www.alfredapp.com[Alfred]
|
38
38
|
. link:https://www.alfredapp.com/purchase[Alfred Powerpack]
|
39
|
-
. {frum_link}
|
40
39
|
. link:https://www.ruby-lang.org[Ruby]
|
41
40
|
|
41
|
+
While using a Ruby version manager -- like {frum_link} -- is not a hard requirement, it is strongly
|
42
|
+
encouraged since a version manager will give you the freedom to toggle between different Ruby
|
43
|
+
versions since this gem has strict Ruby version requirements (especially in regards to using a
|
44
|
+
modern version of Ruby).
|
45
|
+
|
46
|
+
I would also like to point out that all of the workflows, scripts, examples for this gem use Bash
|
47
|
+
syntax. That said, if you are comfortable with translating Bash syntax to your shell syntax of
|
48
|
+
choice, you can make this gem work in different shells too. That is beyond the scope of this
|
49
|
+
document, though, so leave that exercise up to you.
|
50
|
+
|
42
51
|
== Setup
|
43
52
|
|
44
53
|
To install, run:
|
@@ -207,6 +216,8 @@ For the workflows that _do_ require Pennyworth support, the following assumption
|
|
207
216
|
Alfred to load your development environment before running the Alfred Workflow.
|
208
217
|
2. You have the latest version of Alfred, Ruby, and Pennyworth installed.
|
209
218
|
3. You are using a Ruby version manager, like {frum_link}, which ensures Ruby is on your load path.
|
219
|
+
As mentioned in the _Requirements_ section above, this is not a hard requirement so if you have
|
220
|
+
the correct version of Ruby required by this gem on your path, that'll work too.
|
210
221
|
|
211
222
|
With the above requirements in mind, the following sections document how to download and install all
|
212
223
|
Pennyworth workflows that are compatible with Alfred. Should you want to tweak any of these
|
@@ -230,7 +241,7 @@ image:https://www.alchemists.io/images/projects/pennyworth/screenshots/alchemist
|
|
230
241
|
|
231
242
|
The official link:https://www.alchemists.io[Alchemists] workflow for site navigation.
|
232
243
|
|
233
|
-
1. link:https://www.alchemists.io/public/
|
244
|
+
1. link:https://www.alchemists.io/public/alfred/workflows/alchemists.alfredworkflow[Download] and
|
234
245
|
double click to install.
|
235
246
|
2. Type `ax` to activate.
|
236
247
|
|
@@ -243,7 +254,7 @@ image:https://www.alchemists.io/images/projects/pennyworth/screenshots/dry-gems.
|
|
243
254
|
|
244
255
|
A link:https://dry-rb.org[Dry RB] workflow for navigating all of the Dry RB site.
|
245
256
|
|
246
|
-
1. link:https://www.alchemists.io/public/
|
257
|
+
1. link:https://www.alchemists.io/public/alfred/workflows/dry.alfredworkflow[Download] and double
|
247
258
|
click to install.
|
248
259
|
2. Type `dry` to activate general information and `dryx` for project list.
|
249
260
|
|
@@ -257,7 +268,7 @@ image:https://www.alchemists.io/images/projects/pennyworth/screenshots/rubocop-p
|
|
257
268
|
A link:https://docs.rubocop.org/rubocop[Rubocop] workflow for quick access to documentation,
|
258
269
|
learning about project changes, viewing source code, etc.
|
259
270
|
|
260
|
-
1. link:https://www.alchemists.io/public/
|
271
|
+
1. link:https://www.alchemists.io/public/alfred/workflows/rubocop.alfredworkflow[Download] and
|
261
272
|
double click to install.
|
262
273
|
2. Type `cop` to activate.
|
263
274
|
|
@@ -267,7 +278,7 @@ view issues.
|
|
267
278
|
==== Ruby
|
268
279
|
|
269
280
|
This workflow is feature packed and only requires a
|
270
|
-
link:https://www.alchemists.io/public/
|
281
|
+
link:https://www.alchemists.io/public/alfred/workflows/ruby.alfredworkflow[single download]. Once
|
271
282
|
downloaded, double click to install, and then continue reading to learn all of the
|
272
283
|
capabilities this single workflow provides.
|
273
284
|
|
@@ -406,7 +417,7 @@ they are of interest/aid to your own productivity.
|
|
406
417
|
Expands acronyms so you can think and type in terms of an acronym but appear as if you typed out the
|
407
418
|
full definition each time.
|
408
419
|
|
409
|
-
1. link:https://www.alchemists.io/public/
|
420
|
+
1. link:https://www.alchemists.io/public/alfred/workflows/acronyms.alfredworkflow[Download] and
|
410
421
|
double click to install.
|
411
422
|
2. Use any of the macros provided by the workflow to expand acronyms for legibility.
|
412
423
|
|
@@ -416,7 +427,7 @@ image:https://www.alchemists.io/images/projects/pennyworth/screenshots/alpine.pn
|
|
416
427
|
|
417
428
|
Provides link:https://www.alpinelinux.org[Alpine Linux] resources.
|
418
429
|
|
419
|
-
1. link:https://www.alchemists.io/public/
|
430
|
+
1. link:https://www.alchemists.io/public/alfred/workflows/alpine.alfredworkflow[Download] and double
|
420
431
|
click to install.
|
421
432
|
2. Type `al` to activate.
|
422
433
|
|
@@ -428,7 +439,7 @@ Launches development environment but can be tweaked for your preferences. Using
|
|
428
439
|
manner ensures your machine boots or restarts quickly and gives you more control over what is
|
429
440
|
launched.
|
430
441
|
|
431
|
-
1. link:https://www.alchemists.io/public/
|
442
|
+
1. link:https://www.alchemists.io/public/alfred/workflows/applications.alfredworkflow[Download] and
|
432
443
|
double click to install.
|
433
444
|
2. Type `work` to activate.
|
434
445
|
|
@@ -438,7 +449,7 @@ image:https://www.alchemists.io/images/projects/pennyworth/screenshots/browsers.
|
|
438
449
|
|
439
450
|
Provides browser related utilities.
|
440
451
|
|
441
|
-
1. link:https://www.alchemists.io/public/
|
452
|
+
1. link:https://www.alchemists.io/public/alfred/workflows/browsers.alfredworkflow[Download] and
|
442
453
|
double click to install.
|
443
454
|
2. Type `open` to activate.
|
444
455
|
|
@@ -448,7 +459,7 @@ image:https://www.alchemists.io/images/projects/pennyworth/screenshots/bundler.p
|
|
448
459
|
|
449
460
|
Provides quick access to link:https://bundler.io[Bundler] related resources.
|
450
461
|
|
451
|
-
1. link:https://www.alchemists.io/public/
|
462
|
+
1. link:https://www.alchemists.io/public/alfred/workflows/bundler.alfredworkflow[Download] and
|
452
463
|
double click to install.
|
453
464
|
2. Type `bundler` to activate.
|
454
465
|
|
@@ -458,7 +469,7 @@ image:https://www.alchemists.io/images/projects/pennyworth/screenshots/elm.png[E
|
|
458
469
|
|
459
470
|
A link:https://elm-lang.org[Elm] workflow for quick access to Elm resources.
|
460
471
|
|
461
|
-
1. link:https://www.alchemists.io/public/
|
472
|
+
1. link:https://www.alchemists.io/public/alfred/workflows/elm.alfredworkflow[Download] and double
|
462
473
|
click to install.
|
463
474
|
2. Type `elm` to view general information, arrow keys to navigate, and `ENTER` to view information.
|
464
475
|
|
@@ -468,7 +479,7 @@ image:https://www.alchemists.io/images/projects/pennyworth/screenshots/hanami.pn
|
|
468
479
|
|
469
480
|
Provides link:https://hanamirb.org[Hanami] resources.
|
470
481
|
|
471
|
-
1. link:https://www.alchemists.io/public/
|
482
|
+
1. link:https://www.alchemists.io/public/alfred/workflows/hanami.alfredworkflow[Download] and
|
472
483
|
double click to install.
|
473
484
|
2. Type `h` to activate.
|
474
485
|
|
@@ -478,7 +489,7 @@ image:https://www.alchemists.io/images/projects/pennyworth/screenshots/chili.png
|
|
478
489
|
|
479
490
|
Shortens URLs using link:https://chl.li[chl.li].
|
480
491
|
|
481
|
-
1. link:https://www.alchemists.io/public/
|
492
|
+
1. link:https://www.alchemists.io/public/alfred/workflows/chlli.alfredworkflow[Download] and
|
482
493
|
double click to install.
|
483
494
|
2. Type `surl` to activate.
|
484
495
|
|
@@ -488,7 +499,7 @@ image:https://www.alchemists.io/images/projects/pennyworth/screenshots/docker.pn
|
|
488
499
|
|
489
500
|
Provides link:https://www.docker.com[Docker] resources.
|
490
501
|
|
491
|
-
1. link:https://www.alchemists.io/public/
|
502
|
+
1. link:https://www.alchemists.io/public/alfred/workflows/docker.alfredworkflow[Download] and
|
492
503
|
double click to install.
|
493
504
|
2. Type `dr` to activate.
|
494
505
|
|
@@ -496,17 +507,17 @@ Provides link:https://www.docker.com[Docker] resources.
|
|
496
507
|
|
497
508
|
Provides macOS utilities.
|
498
509
|
|
499
|
-
1. link:https://www.alchemists.io/public/
|
510
|
+
1. link:https://www.alchemists.io/public/alfred/workflows/mac_os.alfredworkflow[Download] and
|
500
511
|
double click to install.
|
501
512
|
2. Open the workflow to see all available keywords.
|
502
513
|
|
503
514
|
===== Terraform
|
504
515
|
|
505
|
-
image:https://www.alchemists.io/images/projects/pennyworth/screenshots/terraform.png[Terraform workflow screenshot.,width=
|
516
|
+
image:https://www.alchemists.io/images/projects/pennyworth/screenshots/terraform.png[Terraform workflow screenshot.,width=706,height=632,role=focal_point]
|
506
517
|
|
507
518
|
Provides link:https://www.terraform.io[Terraform] resources.
|
508
519
|
|
509
|
-
1. link:https://www.alchemists.io/public/
|
520
|
+
1. link:https://www.alchemists.io/public/alfred/workflows/terraform.alfredworkflow[Download] and
|
510
521
|
double click to install.
|
511
522
|
2. Type `tf` to activate.
|
512
523
|
|
@@ -515,7 +526,7 @@ Provides link:https://www.terraform.io[Terraform] resources.
|
|
515
526
|
Provides general text manipulation utilities beyond the Pennyworth powered _text_ keyword (mentioned
|
516
527
|
earlier).
|
517
528
|
|
518
|
-
1. link:https://www.alchemists.io/public/
|
529
|
+
1. link:https://www.alchemists.io/public/alfred/workflows/text.alfredworkflow[Download] and
|
519
530
|
double click to install.
|
520
531
|
2. Use any of the following global hotkeys to activate:
|
521
532
|
** `CONTROL + OPTION + COMMAND + o` - Open selected URL in default browser.
|
@@ -568,31 +579,19 @@ To test, run:
|
|
568
579
|
bundle exec rake
|
569
580
|
----
|
570
581
|
|
571
|
-
==
|
572
|
-
|
573
|
-
Read link:https://semver.org[Semantic Versioning] for details. Briefly, it means:
|
574
|
-
|
575
|
-
* Major (X.y.z) - Incremented for any backwards incompatible public API changes.
|
576
|
-
* Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
|
577
|
-
* Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.
|
578
|
-
|
579
|
-
== Code of Conduct
|
580
|
-
|
581
|
-
Please note that this project is released with a link:CODE_OF_CONDUCT.adoc[CODE OF CONDUCT]. By
|
582
|
-
participating in this project you agree to abide by its terms.
|
583
|
-
|
584
|
-
== Contributions
|
582
|
+
== link:https://www.alchemists.io/policies/license[License]
|
585
583
|
|
586
|
-
|
584
|
+
== link:https://www.alchemists.io/policies/security[Security]
|
587
585
|
|
588
|
-
==
|
586
|
+
== link:https://www.alchemists.io/policies/code_of_conduct[Code of Conduct]
|
589
587
|
|
590
|
-
|
588
|
+
== link:https://www.alchemists.io/policies/contributions[Contributions]
|
591
589
|
|
592
|
-
==
|
590
|
+
== link:https://www.alchemists.io/projects/pennyworth/versions[Versions]
|
593
591
|
|
594
|
-
|
592
|
+
== link:https://www.alchemists.io/community[Community]
|
595
593
|
|
596
594
|
== Credits
|
597
595
|
|
598
|
-
|
596
|
+
* Built with link:https://www.alchemists.io/projects/gemsmith[Gemsmith].
|
597
|
+
* Engineered by link:https://www.alchemists.io/team/brooke_kuhlmann[Brooke Kuhlmann].
|
data/{bin → exe}/pennyworth
RENAMED
File without changes
|
@@ -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::
|
8
|
+
def initialize configuration: Configuration::Loader::CLIENT, container: Container
|
9
9
|
@configuration = configuration
|
10
10
|
@container = container
|
11
11
|
end
|
@@ -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,7 +12,7 @@ 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, client: Parser::CLIENT
|
16
16
|
@configuration = configuration
|
17
17
|
@client = client
|
18
18
|
end
|
@@ -21,7 +21,8 @@ module Pennyworth
|
|
21
21
|
client.banner = "#{Identity::LABEL} - #{Identity::SUMMARY}"
|
22
22
|
client.separator "\nUSAGE:\n"
|
23
23
|
collate
|
24
|
-
|
24
|
+
client.parse arguments
|
25
|
+
configuration
|
25
26
|
end
|
26
27
|
|
27
28
|
private
|
@@ -85,7 +86,7 @@ module Pennyworth
|
|
85
86
|
|
86
87
|
def add_version
|
87
88
|
client.on "-v", "--version", "Show gem version." do
|
88
|
-
configuration.action_version =
|
89
|
+
configuration.action_version = true
|
89
90
|
end
|
90
91
|
end
|
91
92
|
|
@@ -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
|
-
|
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
|
-
|
18
|
+
client.parse arguments
|
19
|
+
configuration
|
19
20
|
end
|
20
21
|
|
21
22
|
private
|
data/lib/pennyworth/cli/shell.rb
CHANGED
@@ -15,7 +15,7 @@ module Pennyworth
|
|
15
15
|
text: Actions::Text.new
|
16
16
|
}.freeze
|
17
17
|
|
18
|
-
def initialize parser:
|
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:
|
46
|
+
in action_version: true then logger.info { Identity::VERSION_LABEL }
|
47
47
|
else usage
|
48
48
|
end
|
49
49
|
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
|
File without changes
|
@@ -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 "#{Identity::NAME}/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
|
data/lib/pennyworth/container.rb
CHANGED
@@ -10,7 +10,7 @@ module Pennyworth
|
|
10
10
|
module Container
|
11
11
|
extend Dry::Container::Mixin
|
12
12
|
|
13
|
-
register(:configuration) {
|
13
|
+
register(:configuration) { Configuration::Loader.call }
|
14
14
|
register(:environment) { ENV }
|
15
15
|
register(:kernel) { Kernel }
|
16
16
|
register(:http) { HTTP }
|
data/lib/pennyworth/identity.rb
CHANGED
data/lib/pennyworth/inflector.rb
CHANGED
@@ -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(
|
6
|
+
DEFAULTS = Array(Configuration::Loader.call.inflections).reduce({}, :merge)
|
7
7
|
|
8
8
|
def initialize overrides = DEFAULTS
|
9
9
|
@overrides = overrides
|
@@ -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:
|
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
|
18
|
+
codes.map { |(code, label)| model[code:, label:, url: "#{url}/#{code}"] }
|
19
19
|
end
|
20
20
|
|
21
21
|
private
|
data.tar.gz.sig
CHANGED
Binary file
|