pennyworth 10.0.1 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/README.adoc +209 -30
- data/bin/pennyworth +1 -3
- data/lib/pennyworth.rb +11 -2
- data/lib/pennyworth/cli/actions/config.rb +35 -0
- data/lib/pennyworth/cli/actions/encodings.rb +23 -0
- data/lib/pennyworth/cli/actions/git_hub.rb +27 -0
- data/lib/pennyworth/cli/actions/http_statuses.rb +23 -0
- data/lib/pennyworth/cli/actions/ruby_gems.rb +27 -0
- data/lib/pennyworth/cli/actions/system/errors.rb +25 -0
- data/lib/pennyworth/cli/actions/system/signals.rb +25 -0
- data/lib/pennyworth/cli/actions/text.rb +23 -0
- data/lib/pennyworth/cli/configuration/content.rb +28 -0
- data/lib/pennyworth/cli/configuration/defaults.yml +25 -0
- data/lib/pennyworth/cli/configuration/loader.rb +37 -0
- data/lib/pennyworth/cli/parsers.rb +11 -0
- data/lib/pennyworth/cli/parsers/assembler.rb +32 -0
- data/lib/pennyworth/cli/parsers/core.rb +100 -0
- data/lib/pennyworth/cli/parsers/git_hub.rb +51 -0
- data/lib/pennyworth/cli/parsers/ruby_gems.rb +35 -0
- data/lib/pennyworth/cli/shell.rb +82 -0
- data/lib/pennyworth/container.rb +40 -0
- data/lib/pennyworth/identity.rb +2 -1
- data/lib/pennyworth/inflector.rb +18 -0
- data/lib/pennyworth/integrations/git_hub/client.rb +59 -0
- data/lib/pennyworth/integrations/git_hub/response.rb +33 -0
- data/lib/pennyworth/integrations/ruby_gems/client.rb +29 -0
- data/lib/pennyworth/loaders/encodings.rb +31 -0
- data/lib/pennyworth/loaders/http_statuses.rb +28 -0
- data/lib/pennyworth/loaders/projects.rb +22 -0
- data/lib/pennyworth/loaders/system/errors.rb +33 -0
- data/lib/pennyworth/loaders/system/signals.rb +21 -0
- data/lib/pennyworth/loaders/text.rb +27 -0
- data/lib/pennyworth/models/encoding.rb +8 -0
- data/lib/pennyworth/models/http_status.rb +8 -0
- data/lib/pennyworth/models/system/error.rb +10 -0
- data/lib/pennyworth/models/system/signal.rb +10 -0
- data/lib/pennyworth/models/text.rb +8 -0
- data/lib/pennyworth/presenters/encoding.rb +22 -0
- data/lib/pennyworth/presenters/gem.rb +48 -0
- data/lib/pennyworth/presenters/http_status.rb +41 -0
- data/lib/pennyworth/presenters/repository.rb +35 -0
- data/lib/pennyworth/presenters/system/error.rb +28 -0
- data/lib/pennyworth/presenters/system/signal.rb +22 -0
- data/lib/pennyworth/presenters/text.rb +25 -0
- data/lib/pennyworth/processor.rb +68 -0
- data/lib/pennyworth/serializers/encoding.rb +33 -0
- data/lib/pennyworth/serializers/http_status.rb +41 -0
- data/lib/pennyworth/serializers/project.rb +52 -0
- data/lib/pennyworth/serializers/system/error.rb +46 -0
- data/lib/pennyworth/serializers/system/signal.rb +40 -0
- data/lib/pennyworth/serializers/text.rb +31 -0
- metadata +110 -19
- metadata.gz.sig +2 -2
- data/lib/pennyworth/cli.rb +0 -140
- data/lib/pennyworth/templates/workflows/user.workflow.B59B22A2-1880-4765-9358-412791BE9202/icon.png +0 -0
- data/lib/pennyworth/templates/workflows/user.workflow.B59B22A2-1880-4765-9358-412791BE9202/info.plist +0 -159
- data/lib/pennyworth/templates/workflows/user.workflow.C431E56A-0EC2-47EE-94D5-D67D9FE323BE/icon.png +0 -0
- data/lib/pennyworth/templates/workflows/user.workflow.C431E56A-0EC2-47EE-94D5-D67D9FE323BE/info.plist +0 -272
- data/lib/pennyworth/templates/workflows/user.workflow.C431E56A-0EC2-47EE-94D5-D67D9FE323BE/string-camelcase.png +0 -0
- data/lib/pennyworth/templates/workflows/user.workflow.C431E56A-0EC2-47EE-94D5-D67D9FE323BE/string-capitalize.png +0 -0
- data/lib/pennyworth/templates/workflows/user.workflow.C431E56A-0EC2-47EE-94D5-D67D9FE323BE/string-lowercase.png +0 -0
- data/lib/pennyworth/templates/workflows/user.workflow.C431E56A-0EC2-47EE-94D5-D67D9FE323BE/string-size.png +0 -0
- data/lib/pennyworth/templates/workflows/user.workflow.C431E56A-0EC2-47EE-94D5-D67D9FE323BE/string-snakecase.png +0 -0
- data/lib/pennyworth/templates/workflows/user.workflow.C431E56A-0EC2-47EE-94D5-D67D9FE323BE/string-titleize.png +0 -0
- data/lib/pennyworth/templates/workflows/user.workflow.C431E56A-0EC2-47EE-94D5-D67D9FE323BE/string-uppercase.png +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5fc1a6cb19af609e74dced40b61f98d7a26477ecf50702a791dcea8a050e13d
|
4
|
+
data.tar.gz: e1e72f140d6cc607ec607ce8169bab8c2f6f479bedf499ab9915ae03c439e499
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a492fede34dfcee4cdf2477d42d7618985cf6c6747b13eed6bd3af91d79e26ce438babaa1ae97e8e093c8ff3842920aad4e9e31374afff2a4c286a1329dbeb80
|
7
|
+
data.tar.gz: 97678ce94c0d140b61cee8601e2a1e399e46e8f3d6265dd73f44c6684df4ff22f302d29b4b7a0ac9eb42e6b01c6aa93903b631c3a132439851b4113e73115c33
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/README.adoc
CHANGED
@@ -17,19 +17,20 @@ toc::[]
|
|
17
17
|
|
18
18
|
== Features
|
19
19
|
|
20
|
-
* Adds Ruby support to Alfred.
|
21
|
-
* Adds Alfred Workflow:
|
20
|
+
* Adds Ruby support to link:https://www.alfredapp.com/help/workflows/inputs/script-filter/json[Alfred].
|
22
21
|
|
23
|
-
|
24
|
-
|
22
|
+
== Screencast
|
23
|
+
|
24
|
+
video::https://www.alchemists.io/videos/projects/pennyworth/demo.mp4[width=1062,height=1194,role=focal_point]
|
25
25
|
|
26
26
|
== Requirements
|
27
27
|
|
28
|
-
. https://www.apple.com/macos[macOS]
|
29
|
-
. https://www.alfredapp.com[Alfred]
|
30
|
-
. https://www.alfredapp.com/purchase[Alfred Powerpack]
|
31
|
-
. https://
|
32
|
-
. https://
|
28
|
+
. link:https://www.apple.com/macos[macOS]
|
29
|
+
. link:https://www.alfredapp.com[Alfred]
|
30
|
+
. link:https://www.alfredapp.com/purchase[Alfred Powerpack]
|
31
|
+
. link:https://www.gnu.org/software/bash[Bash]
|
32
|
+
. link:https://github.com/postmodern/chruby[chruby]
|
33
|
+
. link:https://www.ruby-lang.org[Ruby]
|
33
34
|
|
34
35
|
== Setup
|
35
36
|
|
@@ -40,36 +41,71 @@ To install, run:
|
|
40
41
|
gem install pennyworth
|
41
42
|
----
|
42
43
|
|
44
|
+
When using the `-\-git_hub` CLI option, you'll want to supply your login and personal access token
|
45
|
+
with at least _read_ access via the following environment variables:
|
46
|
+
|
47
|
+
[source,bash]
|
48
|
+
----
|
49
|
+
GITHUB_API_LOGIN=
|
50
|
+
GITHUB_API_TOKEN=
|
51
|
+
----
|
52
|
+
|
53
|
+
You can configure these environment variables via link:https://direnv.net[direnv] if using the CLI
|
54
|
+
or through the link:https://www.alfredapp.com/help/workflows/advanced/variables/#environment[Alfred
|
55
|
+
Workflow Environment].
|
56
|
+
|
43
57
|
== Usage
|
44
58
|
|
45
59
|
=== Command Line Interface (CLI)
|
46
60
|
|
47
|
-
From the command line, type
|
61
|
+
From the command line, type `pennyworth` to render usage:
|
48
62
|
|
49
63
|
....
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
64
|
+
USAGE:
|
65
|
+
-c, --config ACTION Manage gem configuration. Actions: edit || view.
|
66
|
+
--encodings Render Alfred encodings script filter.
|
67
|
+
--git_hub Render Alfred GitHub repositories script filter.
|
68
|
+
-h, --help Show this message.
|
69
|
+
--http_statuses Render Alfred HTTP statuses script filter.
|
70
|
+
--ruby_gems Render Alfred RubyGems script filter.
|
71
|
+
--system_errors Render Alfred system errors script filter.
|
72
|
+
--system_signals Render Alfred system signals script filter.
|
73
|
+
--text CONTENT Render Alfred text script filter.
|
74
|
+
-v, --version Show gem version.
|
75
|
+
|
76
|
+
GITHUB OPTIONS:
|
77
|
+
--organization [HANDLE] Set organization. Default: "".
|
78
|
+
--user [HANDLE] Set user. Default: "".
|
79
|
+
|
80
|
+
RUBYGEMS OPTIONS:
|
81
|
+
--owner [HANDLE] Set owner. Default: "".
|
55
82
|
....
|
56
83
|
|
57
|
-
|
84
|
+
The following demonstrates how to use Pennyworth from the CLI or within an Alfred script filter:
|
58
85
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
86
|
+
[source,bash]
|
87
|
+
----
|
88
|
+
pennyworth --config edit
|
89
|
+
pennyworth --config view
|
90
|
+
|
91
|
+
pennyworth --encodings
|
92
|
+
|
93
|
+
pennyworth --git_hub --organization alchemists
|
94
|
+
pennyworth --git_hub --user bkuhlmann
|
95
|
+
|
96
|
+
pennyworth --http_statuses
|
97
|
+
pennyworth --ruby_gems --owner bkuhlmann
|
98
|
+
pennyworth --system_errors
|
99
|
+
pennyworth --system_signals
|
100
|
+
|
101
|
+
pennyworth --text demo
|
102
|
+
pennyworth --text "An Example"
|
103
|
+
----
|
67
104
|
|
68
|
-
While the command line options are nice, the real power comes from
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
with this gem is prefixed with _Pennyworth_.
|
105
|
+
While the command line options are nice, the real power comes from using Pennyworth in conjunction
|
106
|
+
with link:https://www.alfredapp.com/help/workflows/inputs/script-filter/json[Alfred Script Filters].
|
107
|
+
Without having Alfred wired up to consume the CLI output, you'll only get a JSON in your console. To
|
108
|
+
explain better, continue reading or skip ahead to the _Workflows_ section.
|
73
109
|
|
74
110
|
=== Customization
|
75
111
|
|
@@ -86,12 +122,155 @@ The default configuration is as follows:
|
|
86
122
|
|
87
123
|
[source,yaml]
|
88
124
|
----
|
89
|
-
:
|
125
|
+
:alfred:
|
126
|
+
:preferences:
|
127
|
+
:inflections:
|
128
|
+
- "Bkuhlmann": "bkuhlmann"
|
129
|
+
- "Dry Auto Inject": "Dry AutoInject"
|
130
|
+
- "Dry Cli": "Dry CLI"
|
131
|
+
- "Flacsmith": "FLACsmith"
|
132
|
+
- "Git Plus": "Git+"
|
133
|
+
- "Mac Os Config": "macOS Configuration"
|
134
|
+
- "Mac Os": "MacOS"
|
135
|
+
- "Prawn Plus": "Prawn+"
|
136
|
+
- "Rubocop Ast": "Rubocop AST"
|
137
|
+
- "Rubocop Md": "Rubocop Markdown"
|
138
|
+
- "Rubocop Rspec": "Rubocop RSpec"
|
139
|
+
- "Xdg": "XDG"
|
140
|
+
:git_hub:
|
141
|
+
:api_url: "https://api.github.com"
|
142
|
+
:organization:
|
143
|
+
:user:
|
144
|
+
:http:
|
145
|
+
:statuses:
|
146
|
+
:url: "https://httpstatuses.com"
|
147
|
+
:ruby_gems:
|
148
|
+
:api_url: "https://rubygems.org/api/v1"
|
149
|
+
:owner:
|
90
150
|
----
|
91
151
|
|
92
152
|
Feel free to take this default configuration, modify, and save as your own custom
|
93
153
|
`configuration.yml`.
|
94
154
|
|
155
|
+
=== Themes
|
156
|
+
|
157
|
+
image:https://www.alchemists.io/images/projects/pennyworth/screenshots/alfred/alchemists-theme.png[Alchemists Theme,width=634,height=121,role=focal_point]
|
158
|
+
|
159
|
+
To use the
|
160
|
+
link:https://www.alchemists.io/public/aflred/themes/alchemists.alfredappearance[Alchemists Theme],
|
161
|
+
used for all screenshots, follow these steps:
|
162
|
+
|
163
|
+
1. link:https://www.alchemists.io/public/aflred/themes/alchemists.alfredappearance[Download] (right
|
164
|
+
click) theme.
|
165
|
+
1. Double click to install.
|
166
|
+
|
167
|
+
=== Workflows
|
168
|
+
|
169
|
+
Not all workflows require Pennyworth to run properly. For the workflows that _do_ require Pennyworth
|
170
|
+
support, the following assumptions are made:
|
171
|
+
|
172
|
+
1. Your link:https://www.alchemists.io/projects/dotfiles[Dotfiles] are configured to use Bash and
|
173
|
+
load your environment appropriately.
|
174
|
+
1. You have the latest version of Ruby and Pennyworth installed.
|
175
|
+
|
176
|
+
With the above requirements in mind, you should only need to build an Alfred Script Filter that
|
177
|
+
looks something like this:
|
178
|
+
|
179
|
+
image:https://www.alchemists.io/images/projects/pennyworth/screenshots/alfred/script_filter.png[Script Filter,width=776,height=635,role=focal_point]
|
180
|
+
|
181
|
+
That's all it takes to use Pennyworth as an Alfred script filter. 🎉 You don't have to do any of this
|
182
|
+
work yourself. I've already built the corresponding workflows. The following sections will allow you
|
183
|
+
to download and use the corresponding Alfred Workflows that are powered by Pennyworth.
|
184
|
+
|
185
|
+
Before diving into each workflow, the following capabilties are mostly available to all workflows
|
186
|
+
depending on what kind of item is selected in the script filter:
|
187
|
+
|
188
|
+
* `SHIFT` or `COMMAND + y` will launch quick look for any URL based workflow.
|
189
|
+
* `ENTER` or `COMMAND + c` will copy non-URL selections to clipboard.
|
190
|
+
* `COMMAND + l` will launch large type of current selection.
|
191
|
+
* `ENTER` Will either copy selection to clipboard or launch URL in default web browser.
|
192
|
+
|
193
|
+
==== Alchemists
|
194
|
+
|
195
|
+
image:https://www.alchemists.io/images/projects/pennyworth/screenshots/alfred/alchemists-projects.png[Alchemists Projects,width=706,height=622,role=focal_point]
|
196
|
+
|
197
|
+
1. link:https://www.alchemists.io/public/aflred/workflows/alchemists.alfredworkflow[Download] (right
|
198
|
+
click).
|
199
|
+
1. Type `ax` to activate.
|
200
|
+
|
201
|
+
💡 Use `ENTER` to view site, `CONTROL` to view changes, `OPTION` to view source, and `COMMAND` to
|
202
|
+
view issues.
|
203
|
+
|
204
|
+
==== Dry RB
|
205
|
+
|
206
|
+
image:https://www.alchemists.io/images/projects/pennyworth/screenshots/alfred/dry-gems.png[Dry Gems,width=706,height=622,role=focal_point]
|
207
|
+
|
208
|
+
1. link:https://www.alchemists.io/public/aflred/workflows/dry.alfredworkflow[Download] (right click).
|
209
|
+
1. Type `dry` to activate.
|
210
|
+
|
211
|
+
💡 Use `ENTER` to visit site, `CONTROL` to view changes, `OPTION` to view source, and `COMMAND` to
|
212
|
+
view issues.
|
213
|
+
|
214
|
+
==== Encodings
|
215
|
+
|
216
|
+
image:https://www.alchemists.io/images/projects/pennyworth/screenshots/alfred/encodings.png[Encodings,width=706,height=622,role=focal_point]
|
217
|
+
|
218
|
+
1. link:https://www.alchemists.io/public/aflred/workflows/ruby.alfredworkflow[Download] (right click).
|
219
|
+
1. Type `encodings` to activate.
|
220
|
+
|
221
|
+
💡 Use `ENTER` to copy label and `OPTION` to copy aliases to clipboard.
|
222
|
+
|
223
|
+
==== HTTP Statuses
|
224
|
+
|
225
|
+
image:https://www.alchemists.io/images/projects/pennyworth/screenshots/alfred/http_statuses.png[HTTP Statuses,width=706,height=622,role=focal_point]
|
226
|
+
|
227
|
+
1. link:https://www.alchemists.io/public/aflred/workflows/ruby.alfredworkflow[Download] (right click).
|
228
|
+
1. Type `https` to activate.
|
229
|
+
|
230
|
+
💡 Use `ENTER` to copy symbol, `CONTROL` to copy code, `OPTION` to copy label, and `COMMAND` to view
|
231
|
+
documentation.
|
232
|
+
|
233
|
+
==== Rubocop
|
234
|
+
|
235
|
+
image:https://www.alchemists.io/images/projects/pennyworth/screenshots/alfred/rubocop-projects.png[Rubocop Projects,width=706,height=622,role=focal_point]
|
236
|
+
|
237
|
+
1. link:https://www.alchemists.io/public/aflred/workflows/rubocop.alfredworkflow[Download] (right
|
238
|
+
click).
|
239
|
+
1. Type `cop` to activate.
|
240
|
+
|
241
|
+
💡 Use `ENTER` to view site, `CONTROL` to view changes, `OPTION` to view source, and `COMMAND` to
|
242
|
+
view issues.
|
243
|
+
|
244
|
+
==== System Errors
|
245
|
+
|
246
|
+
image:https://www.alchemists.io/images/projects/pennyworth/screenshots/alfred/system_errors.png[System Errors,width=706,height=622,role=focal_point]
|
247
|
+
|
248
|
+
1. link:https://www.alchemists.io/public/aflred/workflows/ruby.alfredworkflow[Download] (right click).
|
249
|
+
1. Type `syserr` to activate.
|
250
|
+
|
251
|
+
💡 Use `ENTER` to copy constant/class, `CONTROL` to copy ID, `OPTION` to copy description, and
|
252
|
+
`COMMAND` to copy ID, name, and description.
|
253
|
+
|
254
|
+
==== System Signals
|
255
|
+
|
256
|
+
image:https://www.alchemists.io/images/projects/pennyworth/screenshots/alfred/system_signals.png[System Signals,width=706,height=622,role=focal_point]
|
257
|
+
|
258
|
+
1. link:https://www.alchemists.io/public/aflred/workflows/ruby.alfredworkflow[Download] (right
|
259
|
+
click).
|
260
|
+
1. Type `signals` to activate.
|
261
|
+
|
262
|
+
💡 Use `ENTER` to copy name, `OPTION` to copy ID, and `COMMAND` to copy ID and name.
|
263
|
+
|
264
|
+
==== Text
|
265
|
+
|
266
|
+
image:https://www.alchemists.io/images/projects/pennyworth/screenshots/alfred/text.png[Text,width=706,height=622,role=focal_point]
|
267
|
+
|
268
|
+
1. link:https://www.alchemists.io/public/aflred/workflows/ruby.alfredworkflow[Download] (right
|
269
|
+
click).
|
270
|
+
1. Type `text` plus your text to transform to activate.
|
271
|
+
|
272
|
+
💡 Use `ENTER` to copy text to clipboard.
|
273
|
+
|
95
274
|
== Development
|
96
275
|
|
97
276
|
To contribute, run:
|
data/bin/pennyworth
CHANGED
data/lib/pennyworth.rb
CHANGED
@@ -1,4 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "
|
4
|
-
|
3
|
+
require "zeitwerk"
|
4
|
+
|
5
|
+
loader = Zeitwerk::Loader.for_gem
|
6
|
+
loader.inflector.inflect "cli" => "CLI",
|
7
|
+
"http_status" => "HTTPStatus",
|
8
|
+
"http_statuses" => "HTTPStatuses"
|
9
|
+
loader.setup
|
10
|
+
|
11
|
+
# Main namespace.
|
12
|
+
module Pennyworth
|
13
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Pennyworth
|
4
|
+
module CLI
|
5
|
+
module Actions
|
6
|
+
# Handles the configuration action.
|
7
|
+
class Config
|
8
|
+
def initialize configuration: Configuration::Loader::HANDLER, container: Container
|
9
|
+
@configuration = configuration
|
10
|
+
@container = container
|
11
|
+
end
|
12
|
+
|
13
|
+
def call action
|
14
|
+
case action
|
15
|
+
when :edit then edit
|
16
|
+
when :view then view
|
17
|
+
else logger.error { "Invalid configuration action: #{action}." }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
attr_reader :configuration, :container
|
24
|
+
|
25
|
+
def edit = kernel.system("$EDITOR #{configuration.current}")
|
26
|
+
|
27
|
+
def view = kernel.system("cat #{configuration.current}")
|
28
|
+
|
29
|
+
def kernel = container[__method__]
|
30
|
+
|
31
|
+
def logger = container[__method__]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Pennyworth
|
4
|
+
module CLI
|
5
|
+
module Actions
|
6
|
+
# Handles the encodings action.
|
7
|
+
class Encodings
|
8
|
+
def initialize processor: Processor.for_encodings, container: Container
|
9
|
+
@processor = processor
|
10
|
+
@container = container
|
11
|
+
end
|
12
|
+
|
13
|
+
def call = processor.call.to_json.then { |json| logger.info json }
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
attr_reader :processor, :container
|
18
|
+
|
19
|
+
def logger = container[__method__]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Pennyworth
|
4
|
+
module CLI
|
5
|
+
module Actions
|
6
|
+
# Handles the GitHub action.
|
7
|
+
class GitHub
|
8
|
+
def initialize processor: Processor.for_projects, container: Container
|
9
|
+
@processor = processor
|
10
|
+
@container = container
|
11
|
+
end
|
12
|
+
|
13
|
+
def call endpoint
|
14
|
+
processor.call(endpoint)
|
15
|
+
.to_json
|
16
|
+
.then { |json| logger.info json }
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
attr_reader :processor, :container
|
22
|
+
|
23
|
+
def logger = container[__method__]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Pennyworth
|
4
|
+
module CLI
|
5
|
+
module Actions
|
6
|
+
# Handles the HTTP statuses action.
|
7
|
+
class HTTPStatuses
|
8
|
+
def initialize processor: Processor.for_http_statuses, container: Container
|
9
|
+
@processor = processor
|
10
|
+
@container = container
|
11
|
+
end
|
12
|
+
|
13
|
+
def call = processor.call.to_json.then { |json| logger.info json }
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
attr_reader :processor, :container
|
18
|
+
|
19
|
+
def logger = container[__method__]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Pennyworth
|
4
|
+
module CLI
|
5
|
+
module Actions
|
6
|
+
# Handles the RubyGems action.
|
7
|
+
class RubyGems
|
8
|
+
def initialize processor: Processor.for_gems, container: Container
|
9
|
+
@processor = processor
|
10
|
+
@container = container
|
11
|
+
end
|
12
|
+
|
13
|
+
def call endpoint
|
14
|
+
processor.call(endpoint)
|
15
|
+
.to_json
|
16
|
+
.then { |json| logger.info json }
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
attr_reader :processor, :container
|
22
|
+
|
23
|
+
def logger = container[__method__]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|