pennyworth 12.3.1 → 13.0.0
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/README.adoc +12 -2
- data/lib/pennyworth/cli/actions/config.rb +5 -7
- data/lib/pennyworth/cli/actions/container.rb +27 -0
- data/lib/pennyworth/cli/actions/encodings.rb +5 -5
- data/lib/pennyworth/cli/actions/git_hub.rb +5 -5
- data/lib/pennyworth/cli/actions/http_statuses.rb +5 -5
- data/lib/pennyworth/cli/actions/import.rb +11 -0
- data/lib/pennyworth/cli/actions/ruby_gems.rb +5 -5
- data/lib/pennyworth/cli/actions/system/errors.rb +5 -5
- data/lib/pennyworth/cli/actions/system/signals.rb +5 -5
- data/lib/pennyworth/cli/actions/text.rb +5 -5
- data/lib/pennyworth/cli/parser.rb +5 -5
- data/lib/pennyworth/cli/parsers/core.rb +6 -6
- data/lib/pennyworth/cli/parsers/git_hub.rb +1 -1
- data/lib/pennyworth/cli/parsers/ruby_gems.rb +1 -1
- data/lib/pennyworth/cli/shell.rb +28 -57
- data/lib/pennyworth/container.rb +3 -25
- data/lib/pennyworth/import.rb +7 -0
- data/lib/pennyworth/integrations/git_hub/client.rb +8 -10
- data/lib/pennyworth/integrations/ruby_gems/client.rb +2 -12
- data/lib/pennyworth/loaders/http_statuses.rb +5 -3
- data/pennyworth.gemspec +3 -2
- data.tar.gz.sig +0 -0
- metadata +37 -20
- metadata.gz.sig +1 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65ec39b7057feb66b3530a5f4ec44b1649093b871b1dcba10b783e45e2b5f181
|
4
|
+
data.tar.gz: 020e6240c268646bf6522ffc283d50fadd4ad1413126e3328d64c03098af6329
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9a74e10efac0ce02c565883d0cac022813c53ad765b4f912ab1ceee9432fc1e5c1b749180463b0413f96dac92d26838e4a2e4fdf18e50b5b1e8398507f3186f
|
7
|
+
data.tar.gz: a0f2724e65cf94370288a1f640d74c86c595a83231c30f23765799660ce92b7e4dfbb08bff0808b46b00e625ccc0c8edc2744221238e97be8e7eef27568d5bb1
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/README.adoc
CHANGED
@@ -438,7 +438,7 @@ launched.
|
|
438
438
|
|
439
439
|
===== Browsers
|
440
440
|
|
441
|
-
image:https://www.alchemists.io/images/projects/pennyworth/screenshots/browsers.png[Browsers workflow screenshot.,width=706,height=
|
441
|
+
image:https://www.alchemists.io/images/projects/pennyworth/screenshots/browsers.png[Browsers workflow screenshot.,width=706,height=308,role=focal_point]
|
442
442
|
|
443
443
|
Provides browser related utilities.
|
444
444
|
|
@@ -466,6 +466,16 @@ A link:https://elm-lang.org[Elm] workflow for quick access to Elm resources.
|
|
466
466
|
click to install.
|
467
467
|
2. Type `elm` to view general information, arrow keys to navigate, and `ENTER` to view information.
|
468
468
|
|
469
|
+
===== GitHub
|
470
|
+
|
471
|
+
image:https://www.alchemists.io/images/projects/pennyworth/screenshots/github.png[GitHub workflow screenshot.,width=706,height=632,role=focal_point]
|
472
|
+
|
473
|
+
Provides link:https://github.com[GitHub] resources.
|
474
|
+
|
475
|
+
1. link:https://www.alchemists.io/public/alfred/workflows/github.alfredworkflow[Download] and
|
476
|
+
double click to install.
|
477
|
+
2. Type `gh` to activate and then fuzzy type to filter.
|
478
|
+
|
469
479
|
===== Hanami
|
470
480
|
|
471
481
|
image:https://www.alchemists.io/images/projects/pennyworth/screenshots/hanami.png[Hanami workflow screenshot.,width=706,height=632,role=focal_point]
|
@@ -488,7 +498,7 @@ Shortens URLs using link:https://chl.li[chl.li].
|
|
488
498
|
|
489
499
|
===== Docker
|
490
500
|
|
491
|
-
image:https://www.alchemists.io/images/projects/pennyworth/screenshots/docker.png[Docker workflow screenshot.,width=706,height=
|
501
|
+
image:https://www.alchemists.io/images/projects/pennyworth/screenshots/docker.png[Docker workflow screenshot.,width=706,height=470,role=focal_point]
|
492
502
|
|
493
503
|
Provides link:https://www.docker.com[Docker] resources.
|
494
504
|
|
@@ -5,9 +5,11 @@ module Pennyworth
|
|
5
5
|
module Actions
|
6
6
|
# Handles the configuration action.
|
7
7
|
class Config
|
8
|
-
|
8
|
+
include Pennyworth::Import[:kernel, :logger]
|
9
|
+
|
10
|
+
def initialize configuration: Configuration::Loader::CLIENT, **dependencies
|
11
|
+
super(**dependencies)
|
9
12
|
@configuration = configuration
|
10
|
-
@container = container
|
11
13
|
end
|
12
14
|
|
13
15
|
def call action
|
@@ -20,15 +22,11 @@ module Pennyworth
|
|
20
22
|
|
21
23
|
private
|
22
24
|
|
23
|
-
attr_reader :configuration
|
25
|
+
attr_reader :configuration
|
24
26
|
|
25
27
|
def edit = kernel.system("$EDITOR #{configuration.current}")
|
26
28
|
|
27
29
|
def view = kernel.system("cat #{configuration.current}")
|
28
|
-
|
29
|
-
def kernel = container[__method__]
|
30
|
-
|
31
|
-
def logger = container[__method__]
|
32
30
|
end
|
33
31
|
end
|
34
32
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dry/container"
|
4
|
+
|
5
|
+
module Pennyworth
|
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 Pennyworth::Container
|
15
|
+
|
16
|
+
register(:config) { Config.new }
|
17
|
+
register(:encodings) { Encodings.new }
|
18
|
+
register(:git_hub) { GitHub.new }
|
19
|
+
register(:http_statuses) { HTTPStatuses.new }
|
20
|
+
register(:ruby_gems) { RubyGems.new }
|
21
|
+
register(:system_errors) { System::Errors.new }
|
22
|
+
register(:system_signals) { System::Signals.new }
|
23
|
+
register(:text) { Text.new }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -5,18 +5,18 @@ module Pennyworth
|
|
5
5
|
module Actions
|
6
6
|
# Handles the encodings action.
|
7
7
|
class Encodings
|
8
|
-
|
8
|
+
include Pennyworth::Import[:logger]
|
9
|
+
|
10
|
+
def initialize processor: Processor.for_encodings, **dependencies
|
11
|
+
super(**dependencies)
|
9
12
|
@processor = processor
|
10
|
-
@container = container
|
11
13
|
end
|
12
14
|
|
13
15
|
def call = processor.call.to_json.then { |json| logger.info { json } }
|
14
16
|
|
15
17
|
private
|
16
18
|
|
17
|
-
attr_reader :processor
|
18
|
-
|
19
|
-
def logger = container[__method__]
|
19
|
+
attr_reader :processor
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -5,9 +5,11 @@ module Pennyworth
|
|
5
5
|
module Actions
|
6
6
|
# Handles the GitHub action.
|
7
7
|
class GitHub
|
8
|
-
|
8
|
+
include Pennyworth::Import[:logger]
|
9
|
+
|
10
|
+
def initialize processor: Processor.for_projects, **dependencies
|
11
|
+
super(**dependencies)
|
9
12
|
@processor = processor
|
10
|
-
@container = container
|
11
13
|
end
|
12
14
|
|
13
15
|
def call endpoint
|
@@ -18,9 +20,7 @@ module Pennyworth
|
|
18
20
|
|
19
21
|
private
|
20
22
|
|
21
|
-
attr_reader :processor
|
22
|
-
|
23
|
-
def logger = container[__method__]
|
23
|
+
attr_reader :processor
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -5,18 +5,18 @@ module Pennyworth
|
|
5
5
|
module Actions
|
6
6
|
# Handles the HTTP statuses action.
|
7
7
|
class HTTPStatuses
|
8
|
-
|
8
|
+
include Pennyworth::Import[:logger]
|
9
|
+
|
10
|
+
def initialize processor: Processor.for_http_statuses, **dependencies
|
11
|
+
super(**dependencies)
|
9
12
|
@processor = processor
|
10
|
-
@container = container
|
11
13
|
end
|
12
14
|
|
13
15
|
def call = processor.call.to_json.then { |json| logger.info { json } }
|
14
16
|
|
15
17
|
private
|
16
18
|
|
17
|
-
attr_reader :processor
|
18
|
-
|
19
|
-
def logger = container[__method__]
|
19
|
+
attr_reader :processor
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -5,9 +5,11 @@ module Pennyworth
|
|
5
5
|
module Actions
|
6
6
|
# Handles the RubyGems action.
|
7
7
|
class RubyGems
|
8
|
-
|
8
|
+
include Pennyworth::Import[:logger]
|
9
|
+
|
10
|
+
def initialize processor: Processor.for_gems, **dependencies
|
11
|
+
super(**dependencies)
|
9
12
|
@processor = processor
|
10
|
-
@container = container
|
11
13
|
end
|
12
14
|
|
13
15
|
def call endpoint
|
@@ -18,9 +20,7 @@ module Pennyworth
|
|
18
20
|
|
19
21
|
private
|
20
22
|
|
21
|
-
attr_reader :processor
|
22
|
-
|
23
|
-
def logger = container[__method__]
|
23
|
+
attr_reader :processor
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -6,18 +6,18 @@ module Pennyworth
|
|
6
6
|
module System
|
7
7
|
# Handles the system errors action.
|
8
8
|
class Errors
|
9
|
-
|
9
|
+
include Pennyworth::Import[:logger]
|
10
|
+
|
11
|
+
def initialize processor: Processor.for_system_errors, **dependencies
|
12
|
+
super(**dependencies)
|
10
13
|
@processor = processor
|
11
|
-
@container = container
|
12
14
|
end
|
13
15
|
|
14
16
|
def call = processor.call.to_json.then { |json| logger.info { json } }
|
15
17
|
|
16
18
|
private
|
17
19
|
|
18
|
-
attr_reader :processor
|
19
|
-
|
20
|
-
def logger = container[__method__]
|
20
|
+
attr_reader :processor
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -6,18 +6,18 @@ module Pennyworth
|
|
6
6
|
module System
|
7
7
|
# Handles the signal action.
|
8
8
|
class Signals
|
9
|
-
|
9
|
+
include Pennyworth::Import[:logger]
|
10
|
+
|
11
|
+
def initialize processor: Processor.for_system_signals, **dependencies
|
12
|
+
super(**dependencies)
|
10
13
|
@processor = processor
|
11
|
-
@container = container
|
12
14
|
end
|
13
15
|
|
14
16
|
def call = processor.call.to_json.then { |json| logger.info { json } }
|
15
17
|
|
16
18
|
private
|
17
19
|
|
18
|
-
attr_reader :processor
|
19
|
-
|
20
|
-
def logger = container[__method__]
|
20
|
+
attr_reader :processor
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -5,18 +5,18 @@ module Pennyworth
|
|
5
5
|
module Actions
|
6
6
|
# Handles the text action.
|
7
7
|
class Text
|
8
|
-
|
8
|
+
include Pennyworth::Import[:logger]
|
9
|
+
|
10
|
+
def initialize processor: Processor.for_text, **dependencies
|
11
|
+
super(**dependencies)
|
9
12
|
@processor = processor
|
10
|
-
@container = container
|
11
13
|
end
|
12
14
|
|
13
15
|
def call(content) = processor.call(content).to_json.then { |json| logger.info { json } }
|
14
16
|
|
15
17
|
private
|
16
18
|
|
17
|
-
attr_reader :processor
|
18
|
-
|
19
|
-
def logger = container[__method__]
|
19
|
+
attr_reader :processor
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -9,25 +9,25 @@ module Pennyworth
|
|
9
9
|
CLIENT = OptionParser.new nil, 40, " "
|
10
10
|
SECTIONS = [Parsers::Core, Parsers::GitHub, Parsers::RubyGems].freeze # Order is important.
|
11
11
|
|
12
|
-
def initialize configuration =
|
12
|
+
def initialize configuration = Container[:configuration],
|
13
13
|
sections: SECTIONS,
|
14
14
|
client: CLIENT
|
15
|
-
@
|
15
|
+
@configuration_duplicate = configuration.dup
|
16
16
|
@sections = sections
|
17
17
|
@client = client
|
18
18
|
end
|
19
19
|
|
20
20
|
def call arguments = []
|
21
|
-
sections.each { |parser| parser.call
|
21
|
+
sections.each { |parser| parser.call configuration_duplicate, client: }
|
22
22
|
client.parse arguments
|
23
|
-
|
23
|
+
configuration_duplicate.freeze
|
24
24
|
end
|
25
25
|
|
26
26
|
def to_s = client.to_s
|
27
27
|
|
28
28
|
private
|
29
29
|
|
30
|
-
attr_reader :
|
30
|
+
attr_reader :configuration_duplicate, :client, :sections
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -10,14 +10,16 @@ module Pennyworth
|
|
10
10
|
|
11
11
|
# Handles parsing of Command Line Interface (CLI) core options.
|
12
12
|
class Core
|
13
|
+
include Import[:specification]
|
14
|
+
|
13
15
|
def self.call(...) = new(...).call
|
14
16
|
|
15
|
-
def initialize configuration =
|
17
|
+
def initialize configuration = Container[:configuration],
|
16
18
|
client: Parser::CLIENT,
|
17
|
-
|
19
|
+
**dependencies
|
20
|
+
super(**dependencies)
|
18
21
|
@configuration = configuration
|
19
22
|
@client = client
|
20
|
-
@container = container
|
21
23
|
end
|
22
24
|
|
23
25
|
def call arguments = []
|
@@ -30,7 +32,7 @@ module Pennyworth
|
|
30
32
|
|
31
33
|
private
|
32
34
|
|
33
|
-
attr_reader :configuration, :client
|
35
|
+
attr_reader :configuration, :client
|
34
36
|
|
35
37
|
def collate = private_methods.sort.grep(/add_/).each { |method| __send__ method }
|
36
38
|
|
@@ -98,8 +100,6 @@ module Pennyworth
|
|
98
100
|
configuration.action_help = true
|
99
101
|
end
|
100
102
|
end
|
101
|
-
|
102
|
-
def specification = container[__method__]
|
103
103
|
end
|
104
104
|
end
|
105
105
|
end
|
@@ -11,7 +11,7 @@ module Pennyworth
|
|
11
11
|
|
12
12
|
def self.call(...) = new(...).call
|
13
13
|
|
14
|
-
def initialize configuration =
|
14
|
+
def initialize configuration = Container[:configuration], client: Parser::CLIENT
|
15
15
|
@configuration = configuration
|
16
16
|
@client = client
|
17
17
|
end
|
@@ -7,7 +7,7 @@ module Pennyworth
|
|
7
7
|
class RubyGems
|
8
8
|
def self.call(...) = new(...).call
|
9
9
|
|
10
|
-
def initialize configuration =
|
10
|
+
def initialize configuration = Container[:configuration], client: Parser::CLIENT
|
11
11
|
@configuration = configuration
|
12
12
|
@client = client
|
13
13
|
end
|
data/lib/pennyworth/cli/shell.rb
CHANGED
@@ -4,21 +4,22 @@ module Pennyworth
|
|
4
4
|
module CLI
|
5
5
|
# The main Command Line Interface (CLI) object.
|
6
6
|
class Shell
|
7
|
-
|
8
|
-
config
|
9
|
-
encodings
|
10
|
-
git_hub
|
11
|
-
http_statuses
|
12
|
-
ruby_gems
|
13
|
-
system_errors
|
14
|
-
system_signals
|
15
|
-
text
|
16
|
-
|
17
|
-
|
18
|
-
|
7
|
+
include Actions::Import[
|
8
|
+
:config,
|
9
|
+
:encodings,
|
10
|
+
:git_hub,
|
11
|
+
:http_statuses,
|
12
|
+
:ruby_gems,
|
13
|
+
:system_errors,
|
14
|
+
:system_signals,
|
15
|
+
:text,
|
16
|
+
:specification,
|
17
|
+
:logger
|
18
|
+
]
|
19
|
+
|
20
|
+
def initialize parser: Parser.new, **dependencies
|
21
|
+
super(**dependencies)
|
19
22
|
@parser = parser
|
20
|
-
@actions = actions
|
21
|
-
@container = container
|
22
23
|
end
|
23
24
|
|
24
25
|
def call arguments = []
|
@@ -29,55 +30,25 @@ module Pennyworth
|
|
29
30
|
|
30
31
|
private
|
31
32
|
|
32
|
-
attr_reader :parser
|
33
|
+
attr_reader :parser
|
33
34
|
|
34
|
-
# rubocop:disable Metrics/MethodLength
|
35
35
|
def perform configuration
|
36
36
|
case configuration
|
37
|
-
in action_config: Symbol => action then config action
|
38
|
-
in action_encodings: true then encodings
|
39
|
-
in action_git_hub: :organization
|
40
|
-
|
41
|
-
in
|
42
|
-
in
|
43
|
-
in
|
44
|
-
|
45
|
-
in
|
37
|
+
in action_config: Symbol => action then config.call action
|
38
|
+
in action_encodings: true then encodings.call
|
39
|
+
in action_git_hub: :organization
|
40
|
+
git_hub.call "orgs/#{configuration.git_hub_organization}/repos"
|
41
|
+
in action_git_hub: :user then git_hub.call "users/#{configuration.git_hub_user}/repos"
|
42
|
+
in action_http_statuses: true then http_statuses.call
|
43
|
+
in action_ruby_gems: true
|
44
|
+
ruby_gems.call "owners/#{configuration.ruby_gems_owner}/gems.json"
|
45
|
+
in action_system_signals: true then system_signals.call
|
46
|
+
in action_system_errors: true then system_errors.call
|
47
|
+
in action_text: String => content then text.call content
|
46
48
|
in action_version: true then logger.info { specification.labeled_version }
|
47
|
-
else
|
49
|
+
else logger.any { parser.to_s }
|
48
50
|
end
|
49
51
|
end
|
50
|
-
# rubocop:enable Metrics/MethodLength
|
51
|
-
|
52
|
-
def config(action) = actions.fetch(__method__).call(action)
|
53
|
-
|
54
|
-
def encodings = actions.fetch(__method__).call
|
55
|
-
|
56
|
-
def git_hub_organization configuration
|
57
|
-
actions.fetch(:git_hub).call("orgs/#{configuration.git_hub_organization}/repos")
|
58
|
-
end
|
59
|
-
|
60
|
-
def git_hub_user configuration
|
61
|
-
actions.fetch(:git_hub).call("users/#{configuration.git_hub_user}/repos")
|
62
|
-
end
|
63
|
-
|
64
|
-
def http_statuses = actions.fetch(__method__).call
|
65
|
-
|
66
|
-
def ruby_gems configuration
|
67
|
-
actions.fetch(__method__).call("owners/#{configuration.ruby_gems_owner}/gems.json")
|
68
|
-
end
|
69
|
-
|
70
|
-
def system_errors = actions.fetch(__method__).call
|
71
|
-
|
72
|
-
def system_signals = actions.fetch(__method__).call
|
73
|
-
|
74
|
-
def text(content) = actions.fetch(__method__).call(content)
|
75
|
-
|
76
|
-
def usage = logger.unknown { parser.to_s }
|
77
|
-
|
78
|
-
def specification = container[__method__]
|
79
|
-
|
80
|
-
def logger = container[__method__]
|
81
52
|
end
|
82
53
|
end
|
83
54
|
end
|
data/lib/pennyworth/container.rb
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "
|
4
|
-
require "
|
3
|
+
require "cogger"
|
4
|
+
require "dry/container"
|
5
5
|
require "http"
|
6
|
-
require "pastel"
|
7
6
|
require "spek"
|
8
7
|
|
9
8
|
module Pennyworth
|
@@ -16,27 +15,6 @@ module Pennyworth
|
|
16
15
|
register(:environment) { ENV }
|
17
16
|
register(:kernel) { Kernel }
|
18
17
|
register(:http) { HTTP }
|
19
|
-
register(:
|
20
|
-
|
21
|
-
register :log_colors do
|
22
|
-
{
|
23
|
-
"DEBUG" => self[:colorizer].white.detach,
|
24
|
-
"INFO" => self[:colorizer].green.detach,
|
25
|
-
"WARN" => self[:colorizer].yellow.detach,
|
26
|
-
"ERROR" => self[:colorizer].red.detach,
|
27
|
-
"FATAL" => self[:colorizer].white.bold.on_red.detach,
|
28
|
-
"ANY" => self[:colorizer].white.bold.detach
|
29
|
-
}
|
30
|
-
end
|
31
|
-
|
32
|
-
register :logger do
|
33
|
-
Logger.new $stdout,
|
34
|
-
level: Logger.const_get(ENV.fetch("LOG_LEVEL", "INFO")),
|
35
|
-
formatter: (
|
36
|
-
lambda do |severity, _at, _name, message|
|
37
|
-
self[:log_colors][severity].call "#{message}\n"
|
38
|
-
end
|
39
|
-
)
|
40
|
-
end
|
18
|
+
register(:logger) { Cogger::Client.new }
|
41
19
|
end
|
42
20
|
end
|
@@ -7,6 +7,8 @@ module Pennyworth
|
|
7
7
|
module GitHub
|
8
8
|
# Provides low-level API access to the GitHub API.
|
9
9
|
class Client
|
10
|
+
include Import[:configuration, :http, :environment]
|
11
|
+
|
10
12
|
using Refinements::Arrays
|
11
13
|
|
12
14
|
HEADERS = {
|
@@ -14,9 +16,9 @@ module Pennyworth
|
|
14
16
|
content_type: "Content-Type: application/json; charset=utf-8"
|
15
17
|
}.freeze
|
16
18
|
|
17
|
-
def initialize headers: HEADERS,
|
19
|
+
def initialize headers: HEADERS, **dependencies
|
20
|
+
super(**dependencies)
|
18
21
|
@headers = headers
|
19
|
-
@container = container
|
20
22
|
end
|
21
23
|
|
22
24
|
def get endpoint, parameters: {}
|
@@ -25,7 +27,7 @@ module Pennyworth
|
|
25
27
|
|
26
28
|
private
|
27
29
|
|
28
|
-
attr_reader :headers
|
30
|
+
attr_reader :headers
|
29
31
|
|
30
32
|
# :reek:FeatureEnvy
|
31
33
|
def paginate request, records: [], page: 1
|
@@ -42,17 +44,13 @@ module Pennyworth
|
|
42
44
|
def sole_get endpoint, parameters: {}
|
43
45
|
http.headers(headers)
|
44
46
|
.basic_auth(user: api_login, pass: api_token)
|
45
|
-
.get("#{
|
47
|
+
.get("#{configuration.git_hub_api_url}/#{endpoint}", params: parameters)
|
46
48
|
.then { |response| Response.new response }
|
47
49
|
end
|
48
50
|
|
49
|
-
def
|
50
|
-
|
51
|
-
def api_url = container[:configuration].git_hub_api_url
|
52
|
-
|
53
|
-
def api_login = container[:environment].fetch("GITHUB_API_LOGIN")
|
51
|
+
def api_login = environment.fetch "GITHUB_API_LOGIN"
|
54
52
|
|
55
|
-
def api_token =
|
53
|
+
def api_token = environment.fetch "GITHUB_API_TOKEN"
|
56
54
|
end
|
57
55
|
end
|
58
56
|
end
|
@@ -5,24 +5,14 @@ module Pennyworth
|
|
5
5
|
module RubyGems
|
6
6
|
# Provides low-level API access to the RubyGems API.
|
7
7
|
class Client
|
8
|
-
|
9
|
-
@container = container
|
10
|
-
end
|
8
|
+
include Import[:configuration, :http]
|
11
9
|
|
12
10
|
def get endpoint
|
13
|
-
http.get("#{
|
11
|
+
http.get("#{configuration.ruby_gems_api_url}/#{endpoint}")
|
14
12
|
.then do |response|
|
15
13
|
response.status.success? ? JSON(response.body.to_s, symbolize_names: true) : {}
|
16
14
|
end
|
17
15
|
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
attr_reader :container
|
22
|
-
|
23
|
-
def http = container[__method__]
|
24
|
-
|
25
|
-
def api_url = container[:configuration].ruby_gems_api_url
|
26
16
|
end
|
27
17
|
end
|
28
18
|
end
|
@@ -6,12 +6,14 @@ module Pennyworth
|
|
6
6
|
module Loaders
|
7
7
|
# Loads an array of HTTP status records.
|
8
8
|
class HTTPStatuses
|
9
|
+
include Import[:configuration]
|
10
|
+
|
9
11
|
def initialize codes: Rack::Utils::HTTP_STATUS_CODES,
|
10
12
|
model: Models::HTTPStatus,
|
11
|
-
|
13
|
+
**dependencies
|
14
|
+
super(**dependencies)
|
12
15
|
@codes = codes
|
13
16
|
@model = model
|
14
|
-
@configuration = configuration
|
15
17
|
end
|
16
18
|
|
17
19
|
def call _omit = nil
|
@@ -20,7 +22,7 @@ module Pennyworth
|
|
20
22
|
|
21
23
|
private
|
22
24
|
|
23
|
-
attr_reader :codes, :model
|
25
|
+
attr_reader :codes, :model
|
24
26
|
|
25
27
|
def url = configuration.http_statuses_url
|
26
28
|
end
|
data/pennyworth.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "pennyworth"
|
5
|
-
spec.version = "
|
5
|
+
spec.version = "13.0.0"
|
6
6
|
spec.authors = ["Brooke Kuhlmann"]
|
7
7
|
spec.email = ["brooke@alchemists.io"]
|
8
8
|
spec.homepage = "https://www.alchemists.io/projects/pennyworth"
|
@@ -22,9 +22,10 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.cert_chain = [Gem.default_cert_path]
|
23
23
|
|
24
24
|
spec.required_ruby_version = "~> 3.1"
|
25
|
+
spec.add_dependency "auto_injector", "~> 0.4"
|
26
|
+
spec.add_dependency "cogger", "~> 0.0"
|
25
27
|
spec.add_dependency "dry-container", "~> 0.8"
|
26
28
|
spec.add_dependency "http", "~> 5.0"
|
27
|
-
spec.add_dependency "pastel", "~> 0.8"
|
28
29
|
spec.add_dependency "rack", "~> 2.2"
|
29
30
|
spec.add_dependency "refinements", "~> 9.2"
|
30
31
|
spec.add_dependency "runcom", "~> 8.2"
|
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:
|
4
|
+
version: 13.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -10,9 +10,9 @@ bindir: exe
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
MIIC/
|
14
|
-
|
15
|
-
|
13
|
+
MIIC/jCCAeagAwIBAgIBBTANBgkqhkiG9w0BAQsFADAlMSMwIQYDVQQDDBpicm9v
|
14
|
+
a2UvREM9YWxjaGVtaXN0cy9EQz1pbzAeFw0yMjAzMTkxNzI0MzJaFw0yMzAzMTkx
|
15
|
+
NzI0MzJaMCUxIzAhBgNVBAMMGmJyb29rZS9EQz1hbGNoZW1pc3RzL0RDPWlvMIIB
|
16
16
|
IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6l1qpXTiomH1RfMRloyw7MiE
|
17
17
|
xyVx/x8Yc3EupdH7uhNaTXQGyORN6aOY//1QXXMHIZ9tW74nZLhesWMSUMYy0XhB
|
18
18
|
brs+KkurHnc9FnEJAbG7ebGvl/ncqZt72nQvaxpDxvuCBHgJAz+8i5wl6FhLw+oT
|
@@ -20,46 +20,46 @@ cert_chain:
|
|
20
20
|
D5vkU0YlAm1r98BymuJlcQ1qdkVEI1d48ph4kcS0S0nv1RiuyVb6TCAR3Nu3VaVq
|
21
21
|
3fPzZKJLZBx67UvXdbdicWPiUR75elI4PXpLIic3xytaF52ZJYyKZCNZJhNwfQID
|
22
22
|
AQABozkwNzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU0nzow9vc
|
23
|
-
2CdikiiE3fJhP/
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
23
|
+
2CdikiiE3fJhP/gY4ggwDQYJKoZIhvcNAQELBQADggEBAJbbNyWzFjqUNVPPCUCo
|
24
|
+
IMrhDa9xf1xkORXNYYbmXgoxRy/KyNbUr+jgEEoWJAm9GXlcqxxWAUI6pK/i4/Qi
|
25
|
+
X6rPFEFmeObDOHNvuqy8Hd6AYsu+kP94U/KJhe9wnWGMmGoNKJNU3EkW3jM/osSl
|
26
|
+
+JRxiH5t4WtnDiVyoYl5nYC02rYdjJkG6VMxDymXTqn7u6HhYgZkGujq1UPar8x2
|
27
|
+
hNIWJblDKKSu7hA2d6+kUthuYo13o1sg1Da/AEDg0hoZSUvhqDEF5Hy232qb3pDt
|
28
|
+
CxDe2+VuChj4I1nvIHdu+E6XoEVlanUPKmSg6nddhkKn2gC45Kyzh6FZqnzH/CRp
|
29
|
+
RFE=
|
30
30
|
-----END CERTIFICATE-----
|
31
|
-
date: 2022-
|
31
|
+
date: 2022-04-09 00:00:00.000000000 Z
|
32
32
|
dependencies:
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
34
|
+
name: auto_injector
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '0.
|
39
|
+
version: '0.4'
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '0.
|
46
|
+
version: '0.4'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
48
|
+
name: cogger
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
53
|
+
version: '0.0'
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
60
|
+
version: '0.0'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
|
-
name:
|
62
|
+
name: dry-container
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
@@ -72,6 +72,20 @@ dependencies:
|
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0.8'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: http
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '5.0'
|
82
|
+
type: :runtime
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '5.0'
|
75
89
|
- !ruby/object:Gem::Dependency
|
76
90
|
name: rack
|
77
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -157,9 +171,11 @@ files:
|
|
157
171
|
- exe/pennyworth
|
158
172
|
- lib/pennyworth.rb
|
159
173
|
- lib/pennyworth/cli/actions/config.rb
|
174
|
+
- lib/pennyworth/cli/actions/container.rb
|
160
175
|
- lib/pennyworth/cli/actions/encodings.rb
|
161
176
|
- lib/pennyworth/cli/actions/git_hub.rb
|
162
177
|
- lib/pennyworth/cli/actions/http_statuses.rb
|
178
|
+
- lib/pennyworth/cli/actions/import.rb
|
163
179
|
- lib/pennyworth/cli/actions/ruby_gems.rb
|
164
180
|
- lib/pennyworth/cli/actions/system/errors.rb
|
165
181
|
- lib/pennyworth/cli/actions/system/signals.rb
|
@@ -173,6 +189,7 @@ files:
|
|
173
189
|
- lib/pennyworth/configuration/defaults.yml
|
174
190
|
- lib/pennyworth/configuration/loader.rb
|
175
191
|
- lib/pennyworth/container.rb
|
192
|
+
- lib/pennyworth/import.rb
|
176
193
|
- lib/pennyworth/inflector.rb
|
177
194
|
- lib/pennyworth/integrations/git_hub/client.rb
|
178
195
|
- lib/pennyworth/integrations/git_hub/response.rb
|
@@ -228,7 +245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
228
245
|
- !ruby/object:Gem::Version
|
229
246
|
version: '0'
|
230
247
|
requirements: []
|
231
|
-
rubygems_version: 3.3.
|
248
|
+
rubygems_version: 3.3.11
|
232
249
|
signing_key:
|
233
250
|
specification_version: 4
|
234
251
|
summary: A command line interface that augments Alfred workflows.
|
metadata.gz.sig
CHANGED