pennyworth 9.4.0 → 11.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/README.adoc +327 -31
  5. data/bin/pennyworth +1 -3
  6. data/lib/pennyworth.rb +11 -2
  7. data/lib/pennyworth/cli/actions/config.rb +35 -0
  8. data/lib/pennyworth/cli/actions/encodings.rb +23 -0
  9. data/lib/pennyworth/cli/actions/git_hub.rb +27 -0
  10. data/lib/pennyworth/cli/actions/http_statuses.rb +23 -0
  11. data/lib/pennyworth/cli/actions/ruby_gems.rb +27 -0
  12. data/lib/pennyworth/cli/actions/system/errors.rb +25 -0
  13. data/lib/pennyworth/cli/actions/system/signals.rb +25 -0
  14. data/lib/pennyworth/cli/actions/text.rb +23 -0
  15. data/lib/pennyworth/cli/configuration/content.rb +28 -0
  16. data/lib/pennyworth/cli/configuration/defaults.yml +25 -0
  17. data/lib/pennyworth/cli/configuration/loader.rb +37 -0
  18. data/lib/pennyworth/cli/parsers.rb +11 -0
  19. data/lib/pennyworth/cli/parsers/assembler.rb +32 -0
  20. data/lib/pennyworth/cli/parsers/core.rb +100 -0
  21. data/lib/pennyworth/cli/parsers/git_hub.rb +51 -0
  22. data/lib/pennyworth/cli/parsers/ruby_gems.rb +35 -0
  23. data/lib/pennyworth/cli/shell.rb +82 -0
  24. data/lib/pennyworth/container.rb +40 -0
  25. data/lib/pennyworth/identity.rb +2 -1
  26. data/lib/pennyworth/inflector.rb +18 -0
  27. data/lib/pennyworth/integrations/git_hub/client.rb +59 -0
  28. data/lib/pennyworth/integrations/git_hub/response.rb +33 -0
  29. data/lib/pennyworth/integrations/ruby_gems/client.rb +29 -0
  30. data/lib/pennyworth/loaders/encodings.rb +31 -0
  31. data/lib/pennyworth/loaders/http_statuses.rb +28 -0
  32. data/lib/pennyworth/loaders/projects.rb +22 -0
  33. data/lib/pennyworth/loaders/system/errors.rb +33 -0
  34. data/lib/pennyworth/loaders/system/signals.rb +21 -0
  35. data/lib/pennyworth/loaders/text.rb +27 -0
  36. data/lib/pennyworth/models/encoding.rb +8 -0
  37. data/lib/pennyworth/models/http_status.rb +8 -0
  38. data/lib/pennyworth/models/system/error.rb +10 -0
  39. data/lib/pennyworth/models/system/signal.rb +10 -0
  40. data/lib/pennyworth/models/text.rb +8 -0
  41. data/lib/pennyworth/presenters/encoding.rb +22 -0
  42. data/lib/pennyworth/presenters/gem.rb +48 -0
  43. data/lib/pennyworth/presenters/http_status.rb +41 -0
  44. data/lib/pennyworth/presenters/repository.rb +35 -0
  45. data/lib/pennyworth/presenters/system/error.rb +28 -0
  46. data/lib/pennyworth/presenters/system/signal.rb +22 -0
  47. data/lib/pennyworth/presenters/text.rb +25 -0
  48. data/lib/pennyworth/processor.rb +68 -0
  49. data/lib/pennyworth/serializers/encoding.rb +33 -0
  50. data/lib/pennyworth/serializers/http_status.rb +41 -0
  51. data/lib/pennyworth/serializers/project.rb +52 -0
  52. data/lib/pennyworth/serializers/system/error.rb +46 -0
  53. data/lib/pennyworth/serializers/system/signal.rb +40 -0
  54. data/lib/pennyworth/serializers/text.rb +31 -0
  55. metadata +87 -206
  56. metadata.gz.sig +0 -0
  57. data/lib/pennyworth/cli.rb +0 -140
  58. data/lib/pennyworth/templates/workflows/user.workflow.B59B22A2-1880-4765-9358-412791BE9202/icon.png +0 -0
  59. data/lib/pennyworth/templates/workflows/user.workflow.B59B22A2-1880-4765-9358-412791BE9202/info.plist +0 -159
  60. data/lib/pennyworth/templates/workflows/user.workflow.C431E56A-0EC2-47EE-94D5-D67D9FE323BE/icon.png +0 -0
  61. data/lib/pennyworth/templates/workflows/user.workflow.C431E56A-0EC2-47EE-94D5-D67D9FE323BE/info.plist +0 -272
  62. data/lib/pennyworth/templates/workflows/user.workflow.C431E56A-0EC2-47EE-94D5-D67D9FE323BE/string-camelcase.png +0 -0
  63. data/lib/pennyworth/templates/workflows/user.workflow.C431E56A-0EC2-47EE-94D5-D67D9FE323BE/string-capitalize.png +0 -0
  64. data/lib/pennyworth/templates/workflows/user.workflow.C431E56A-0EC2-47EE-94D5-D67D9FE323BE/string-lowercase.png +0 -0
  65. data/lib/pennyworth/templates/workflows/user.workflow.C431E56A-0EC2-47EE-94D5-D67D9FE323BE/string-size.png +0 -0
  66. data/lib/pennyworth/templates/workflows/user.workflow.C431E56A-0EC2-47EE-94D5-D67D9FE323BE/string-snakecase.png +0 -0
  67. data/lib/pennyworth/templates/workflows/user.workflow.C431E56A-0EC2-47EE-94D5-D67D9FE323BE/string-titleize.png +0 -0
  68. 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: 5a736916583036fbd20ca8071597dea11b2f2f89ca24a7dcc792d978d2356b8d
4
- data.tar.gz: aba79434d95c9cd3d91dd20c921cc2c9cbb36af67eac39404a82582c78259b36
3
+ metadata.gz: 281ec69b0fdefb5e3a26b1f97876641fcc42fe23da87d363c9249c5e64d04d8c
4
+ data.tar.gz: d971ee1204c17d7eb211275458394a2f930ae7cf7cec83a4efd3f06fcde33abf
5
5
  SHA512:
6
- metadata.gz: 6c22f24cef1b04e74d5caf9f988bc0c95bbae2b77e10abc4046cba8565a6349d15289532ae147da336f5e0c9f567fe92cc1b7e3c546bbb4911cf124197638005
7
- data.tar.gz: 1e4cfce02ad288724809d976bd4536c750c71a4a348efbbd0dff19261d1f1d974e79169395889eb50caaf4a659418f7e2009f9ce90b33cdd04dd3af1101e583d
6
+ metadata.gz: da76fbccc61b57f3959cd9d8bec3c990df95104dd48c8630ec9d4cab5534644ad87438ab308ecb57c8fdf0251f2c8b635ab06d1140ef50edc28a079c1d187d26
7
+ data.tar.gz: 020116b2219d45c1b7e3d5b8eb0804ce177520afe41cf47db219c07e2701415bd81b2e80559ae54eb7eaeec8c388da3253b4f8b65e003d28221dc1c170daac39
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/README.adoc CHANGED
@@ -11,25 +11,30 @@ image::https://img.shields.io/badge/code_style-alchemists-brightgreen.svg[Alchem
11
11
  [link=https://circleci.com/gh/bkuhlmann/pennyworth]
12
12
  image::https://circleci.com/gh/bkuhlmann/pennyworth.svg?style=svg[Circle CI Status]
13
13
 
14
- A command line interface that enhances Alfred with Ruby support.
14
+ A command line interface that augments link:https://www.alfredapp.com[Alfred] workflows.
15
+
16
+
15
17
 
16
18
  toc::[]
17
19
 
18
20
  == Features
19
21
 
20
- * Adds Ruby support to Alfred.
21
- * Adds Alfred Workflow:
22
+ * Adds Ruby support to link:https://www.alfredapp.com[Alfred].
23
+ * Supports building advanced link:https://www.alfredapp.com/help/workflows[Workflows] for personal
24
+ augmentation.
25
+
26
+ == Screencast
22
27
 
23
- image:https://www.alchemists.io/images/projects/pennyworth/screenshots/alfred_workflow.png[Alfred
24
- Workflow]
28
+ video::https://www.alchemists.io/videos/projects/pennyworth/demo.mp4[poster=https://www.alchemists.io/images/projects/pennyworth/demo.png,width=1062,height=1194,role=focal_point]
25
29
 
26
30
  == Requirements
27
31
 
28
- . https://www.apple.com/macos[macOS]
29
- . https://www.alfredapp.com[Alfred]
30
- . https://www.alfredapp.com/purchase[Alfred Powerpack]
31
- . https://github.com/postmodern/chruby[chruby]
32
- . https://www.ruby-lang.org[Ruby]
32
+ . link:https://www.apple.com/macos[macOS]
33
+ . link:https://www.gnu.org/software/bash[Bash]
34
+ . link:https://www.alfredapp.com[Alfred]
35
+ . link:https://www.alfredapp.com/purchase[Alfred Powerpack]
36
+ . link:https://github.com/postmodern/chruby[chruby]
37
+ . link:https://www.ruby-lang.org[Ruby]
33
38
 
34
39
  == Setup
35
40
 
@@ -40,36 +45,76 @@ To install, run:
40
45
  gem install pennyworth
41
46
  ----
42
47
 
48
+ When using the `--git_hub` CLI option, you'll want to supply your GitHub login and
49
+ link:https://github.com/settings/tokens[Personal Access Token] with at least _read_ access via the
50
+ following environment variables:
51
+
52
+ [source,bash]
53
+ ----
54
+ GITHUB_API_LOGIN=
55
+ GITHUB_API_TOKEN=
56
+ ----
57
+
58
+ You can configure these environment variables via link:https://direnv.net[direnv] if using the CLI
59
+ or through the link:https://www.alfredapp.com/help/workflows/advanced/variables/#environment[Alfred
60
+ Workflow Environment].
61
+
62
+ ⚠️ When using Alfred Workflow environment variables, please ensure you check the _Don't Export_
63
+ option for these variables so you don't expose your credentials when exporting/sharing workflows
64
+ with others.
65
+
43
66
  == Usage
44
67
 
45
68
  === Command Line Interface (CLI)
46
69
 
47
- From the command line, type: pennyworth
70
+ From the command line, type `pennyworth` to view usage:
48
71
 
49
72
  ....
50
- pennyworth -c, [--config] # Manage gem configuration.
51
- pennyworth -h, [--help=COMMAND] # Show this message or get help for a command.
52
- pennyworth -i, [--install] # Install Alfred Workflows.
53
- pennyworth -s, [--string=VALUE] # Manipulate strings.
54
- pennyworth -v, [--version] # Show gem version.
73
+ USAGE:
74
+ -c, --config ACTION Manage gem configuration. Actions: edit || view.
75
+ --encodings Render Alfred encodings script filter.
76
+ --git_hub Render Alfred GitHub repositories script filter.
77
+ -h, --help Show this message.
78
+ --http_statuses Render Alfred HTTP statuses script filter.
79
+ --ruby_gems Render Alfred RubyGems script filter.
80
+ --system_errors Render Alfred system errors script filter.
81
+ --system_signals Render Alfred system signals script filter.
82
+ --text CONTENT Render Alfred text script filter.
83
+ -v, --version Show gem version.
84
+
85
+ GITHUB OPTIONS:
86
+ --organization [HANDLE] Set organization. Default: "".
87
+ --user [HANDLE] Set user. Default: "".
88
+
89
+ RUBYGEMS OPTIONS:
90
+ --owner [HANDLE] Set owner. Default: "".
55
91
  ....
56
92
 
57
- For string options, type: pennyworth help string
93
+ The following demonstrates how to use Pennyworth from the CLI or within an Alfred Script Filter:
58
94
 
59
- ....
60
- -d, [--downcase], [--no-downcase] # Downcase string.
61
- -u, [--upcase], [--no-upcase] # Upcase string.
62
- -t, [--titleize], [--no-titleize] # Capitalize each word and delimit with space or forward slash.
63
- -c, [--camelcase], [--no-camelcase] # Capitalize each word and delimit with nothing or double colon.
64
- -s, [--snakecase], [--no-snakecase] # Downcase each word and delimit with underscore or forward slash.
65
- -s, [--size], [--no-size] # Calculate string size.
66
- ....
95
+ [source,bash]
96
+ ----
97
+ pennyworth --config edit
98
+ pennyworth --config view
99
+
100
+ pennyworth --encodings
67
101
 
68
- While the command line options are nice, the real power comes from running the following command:
69
- `pennyworth -i`. This command installs the Alfred Workflows to support this gem. You can use the
70
- Alfred commands provided by each workflow instead of the CLI. Check each workflows documentation for
71
- details by opening Alfred preferences and clicking on the _Workflows_ tab. Each workflow associated
72
- with this gem is prefixed with _Pennyworth_.
102
+ pennyworth --git_hub --organization alchemists
103
+ pennyworth --git_hub --user bkuhlmann
104
+
105
+ pennyworth --http_statuses
106
+ pennyworth --ruby_gems --owner bkuhlmann
107
+ pennyworth --system_errors
108
+ pennyworth --system_signals
109
+
110
+ pennyworth --text demo
111
+ pennyworth --text "An Example"
112
+ ----
113
+
114
+ While the command line options are nice, the real power comes from using Pennyworth in conjunction
115
+ with link:https://www.alfredapp.com/help/workflows/inputs/script-filter/json[Alfred Script Filters].
116
+ Without having Alfred wired up to consume the CLI output, you'll only get a JSON in your console. To
117
+ explain better, continue reading or skip ahead to the _Workflows_ section.
73
118
 
74
119
  === Customization
75
120
 
@@ -86,12 +131,263 @@ The default configuration is as follows:
86
131
 
87
132
  [source,yaml]
88
133
  ----
89
- :alfred_settings_root: "/Users/bkuhlmann/Dropbox/Cache/Alfred/Alfred.alfredpreferences"
134
+ :alfred:
135
+ :preferences:
136
+ :inflections:
137
+ - "Bkuhlmann": "bkuhlmann"
138
+ - "Dry Auto Inject": "Dry AutoInject"
139
+ - "Dry Cli": "Dry CLI"
140
+ - "Flacsmith": "FLACsmith"
141
+ - "Git Plus": "Git+"
142
+ - "Mac Os Config": "macOS Configuration"
143
+ - "Mac Os": "MacOS"
144
+ - "Prawn Plus": "Prawn+"
145
+ - "Rubocop Ast": "Rubocop AST"
146
+ - "Rubocop Md": "Rubocop Markdown"
147
+ - "Rubocop Rspec": "Rubocop RSpec"
148
+ - "Xdg": "XDG"
149
+ :git_hub:
150
+ :api_url: "https://api.github.com"
151
+ :organization:
152
+ :user:
153
+ :http:
154
+ :statuses:
155
+ :url: "https://httpstatuses.com"
156
+ :ruby_gems:
157
+ :api_url: "https://rubygems.org/api/v1"
158
+ :owner:
90
159
  ----
91
160
 
92
161
  Feel free to take this default configuration, modify, and save as your own custom
93
162
  `configuration.yml`.
94
163
 
164
+ === Themes
165
+
166
+ image:https://www.alchemists.io/images/projects/pennyworth/screenshots/alchemists-theme.png[Alchemists Theme,width=634,height=121,role=focal_point]
167
+
168
+ The above is shared as the link:https://www.alfredapp.com/extras/theme/FSz9kjN1wX[Alchemists Alfred
169
+ Theme] which can be
170
+ link:alfred://theme/?t=eyJhbGZyZWR0aGVtZSI6eyJyZXN1bHQiOnsidGV4dFNwYWNpbmciOjEwLCJzdWJ0ZXh0Ijp7InNpemUiOjEyLCJjb2xvclNlbGVjdGVkIjoiI0Q2RDZENkZGIiwiZm9udCI6IkhlbHZldGljYSIsImNvbG9yIjoiI0Q2RDZENkZGIn0sInNob3J0Y3V0Ijp7InNpemUiOjE2LCJjb2xvclNlbGVjdGVkIjoiI0ZGRkZGRkZGIiwiZm9udCI6IkhlbHZldGljYSIsImNvbG9yIjoiI0ZFRkNGRkZGIn0sImJhY2tncm91bmRTZWxlY3RlZCI6IiNBMDI2MThGRiIsInRleHQiOnsic2l6ZSI6MTYsImNvbG9yU2VsZWN0ZWQiOiIjRkZGRkZGRkYiLCJmb250IjoiSGVsdmV0aWNhIiwiY29sb3IiOiIjRTFERURFRkYifSwiaWNvblBhZGRpbmdIb3Jpem9udGFsIjo1LCJyb3VuZG5lc3MiOjAsInBhZGRpbmdWZXJ0aWNhbCI6NiwiaWNvblNpemUiOjQwfSwic2VhcmNoIjp7ImJhY2tncm91bmRTZWxlY3RlZCI6IiNCMkQ3RkZGRiIsInBhZGRpbmdIb3Jpem9udGFsIjo4LCJzcGFjaW5nIjoxMCwidGV4dCI6eyJzaXplIjozNiwiY29sb3JTZWxlY3RlZCI6IiMwMDAwMDBGRiIsImZvbnQiOiJIZWx2ZXRpY2EiLCJjb2xvciI6IiNGRkZGRkZGRiJ9LCJiYWNrZ3JvdW5kIjoiIzEyMTIxMkZGIiwicm91bmRuZXNzIjowLCJwYWRkaW5nVmVydGljYWwiOjJ9LCJ3aW5kb3ciOnsiY29sb3IiOiIjNzAwQTAwRkYiLCJwYWRkaW5nSG9yaXpvbnRhbCI6MTAsIndpZHRoIjo2MjAsImJvcmRlclBhZGRpbmciOjEwLCJib3JkZXJDb2xvciI6IiMwMDAwMDAzRiIsImJsdXIiOjAsInJvdW5kbmVzcyI6MTIsInBhZGRpbmdWZXJ0aWNhbCI6MTB9LCJjcmVkaXQiOiJCcm9va2UgS3VobG1hbm4iLCJzZXBhcmF0b3IiOnsiY29sb3IiOiIjMDAwMDAwNjYiLCJ0aGlja25lc3MiOjJ9LCJzY3JvbGxiYXIiOnsiY29sb3IiOiIjMDAwMDAwNjYiLCJ0aGlja25lc3MiOjJ9LCJuYW1lIjoiQWxjaGVtaXN0cyJ9fQ==[installed
171
+ directly].
172
+
173
+ === Workflows
174
+
175
+ Not all workflows require Pennyworth to run properly. For the workflows that _do_ require Pennyworth
176
+ support, the following assumptions are made:
177
+
178
+ 1. Your link:https://www.alchemists.io/projects/dotfiles[Dotfiles] are configured to use
179
+ link:https://www.gnu.org/software/bash[Bash] and load your environment appropriately. Bash is not
180
+ a hard requirement, though. You can use _any shell_ you are comfortable with as long as you teach
181
+ Alfred to load your development environment before running the Alfred Workflow.
182
+ 2. You have the latest version of Alfred, Ruby, and Pennyworth installed.
183
+ 3. You are using a Ruby version manager, like link:https://github.com/postmodern/chruby[chruby],
184
+ which ensures Ruby is on your load path.
185
+
186
+ With the above requirements in mind, the following sections document how to download and install all
187
+ Pennyworth workflows that are compatible with Alfred. Should you want to tweak any of these
188
+ workflows, you'd only need to edit an existing workflow or build your own with these settings:
189
+
190
+ image:https://www.alchemists.io/images/projects/pennyworth/screenshots/script_filter.png[Script Filter,width=776,height=635,role=focal_point]
191
+
192
+ Before diving into each workflow, I want to highlight that the following capabilities are available
193
+ to all workflows depending on what kind of item is currently selected within the Alfred UI:
194
+
195
+ * `SHIFT` or `COMMAND + y` will launch
196
+ link:https://www.alfredapp.com/help/features/previews[Quicklook] for any URL based workflow.
197
+ * `ENTER` or `COMMAND + c` will copy selections to clipboard (depends on context, though).
198
+ * `COMMAND + l` will launch link:https://www.alfredapp.com/help/features/large-type[Large Type] of
199
+ current selection.
200
+ * `ENTER` Will either copy selection to clipboard or launch URL in default web browser.
201
+
202
+ ==== Alchemists
203
+
204
+ image:https://www.alchemists.io/images/projects/pennyworth/screenshots/alchemists-projects.png[Alchemists Projects,width=706,height=632,role=focal_point]
205
+
206
+ The official link:https://www.alchemists.io[Alchemists] workflow for site navigation.
207
+
208
+ 1. link:https://www.alchemists.io/public/aflred/workflows/alchemists.alfredworkflow[Download] and
209
+ double click to install.
210
+ 2. Type `ax` to activate.
211
+
212
+ 💡 Use `ENTER` to view site, `CONTROL` to view changes, `OPTION` to view source, or `COMMAND` to
213
+ view issues.
214
+
215
+ ==== Dry RB
216
+
217
+ image:https://www.alchemists.io/images/projects/pennyworth/screenshots/dry-gems.png[Dry Gems,width=706,height=632,role=focal_point]
218
+
219
+ A link:https://dry-rb.org[Dry RB] workflow for navigating all of the Dry RB site.
220
+
221
+ 1. link:https://www.alchemists.io/public/aflred/workflows/dry.alfredworkflow[Download] and double
222
+ click to install.
223
+ 2. Type `dry` to activate.
224
+
225
+ 💡 Use `ENTER` to visit site, `CONTROL` to view changes, `OPTION` to view source, or `COMMAND` to
226
+ view issues.
227
+
228
+ ==== Rubocop
229
+
230
+ image:https://www.alchemists.io/images/projects/pennyworth/screenshots/rubocop-projects.png[Rubocop Projects,width=706,height=632,role=focal_point]
231
+
232
+ A link:https://docs.rubocop.org/rubocop[Rubocop] workflow for quick access to documentation,
233
+ learning about project changes, viewing source code, etc.
234
+
235
+ 1. link:https://www.alchemists.io/public/aflred/workflows/rubocop.alfredworkflow[Download] and
236
+ double click to install.
237
+ 2. Type `cop` to activate.
238
+
239
+ 💡 Use `ENTER` to view site, `CONTROL` to view changes, `OPTION` to view source, or `COMMAND` to
240
+ view issues.
241
+
242
+ ==== Ruby
243
+
244
+ This workflow is feature packed and only requires a
245
+ link:https://www.alchemists.io/public/aflred/workflows/ruby.alfredworkflow[single download]. Once
246
+ downloaded, double click to install, and then continue reading to learn all of the
247
+ capabilities this single workflow provides.
248
+
249
+ ===== Bytes
250
+
251
+ image:https://www.alchemists.io/images/projects/pennyworth/screenshots/ruby-bytes.png[Bytes,width=706,height=200,role=focal_point]
252
+
253
+ This keyword allows you to generate random bytes.
254
+
255
+ Type `bytes` to activate and `ENTER` generate. You can supply an optional number for specific
256
+ length.
257
+
258
+ ===== Encodings
259
+
260
+ image:https://www.alchemists.io/images/projects/pennyworth/screenshots/ruby-encodings.png[Encodings,width=706,height=632,role=focal_point]
261
+
262
+ This keyword allows you to quickly search for various encodings and/or their associated aliases to
263
+ use in your own code.
264
+
265
+ Type `encodings` to activate. Use `ENTER` to copy label or `OPTION` to copy associated aliases to
266
+ clipboard.
267
+
268
+ ===== Hex
269
+
270
+ image:https://www.alchemists.io/images/projects/pennyworth/screenshots/ruby-hex.png[Hex,width=706,height=200,role=focal_point]
271
+
272
+ This keyword allows you to generate a random hex string.
273
+
274
+ Type `hex` to activate and `ENTER` generate. You can supply an optional number for specific length.
275
+
276
+ ===== HTTP Statuses
277
+
278
+ image:https://www.alchemists.io/images/projects/pennyworth/screenshots/ruby-http_statuses.png[HTTP Statuses,width=706,height=632,role=focal_point]
279
+
280
+ This keyword allows you to look up statuses by code with quick access to the associated symbol for
281
+ use in your own code. Includes associated documentation for sharing or learning more. All HTTP
282
+ statuses are sourced from `Rack::Utils::HTTP_STATUS_CODES` which is why
283
+ link:https://rubygems.org/gems/rack[Rack] is a dependency of this gem and also why some codes might
284
+ not be present like these
285
+ link:https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#Unofficial_codes[unofficial codes].
286
+
287
+ Type `https` to activate. Use `ENTER` to copy symbol, `CONTROL` to copy code, `OPTION` to copy
288
+ label, or `COMMAND` to view documentation.
289
+
290
+ ===== Number
291
+
292
+ image:https://www.alchemists.io/images/projects/pennyworth/screenshots/ruby-number.png[Hex,width=706,height=200,role=focal_point]
293
+
294
+ This keyword allows you to generate a random number.
295
+
296
+ Type `number` to activate and `ENTER` generate. You can supply an optional number for specific
297
+ length.
298
+
299
+ ===== Repeat
300
+
301
+ image:https://www.alchemists.io/images/projects/pennyworth/screenshots/ruby-repeat.png[Hex,width=706,height=200,role=focal_point]
302
+
303
+ This keyword allows you to generate a repeating sequence of the same character(s).
304
+
305
+ Type `repeat` to activate and `ENTER` generate. You must supply the character(s) you want to repeat
306
+ followed by a number indicating how many times you want the character(s) to repeat.
307
+
308
+ ===== System Errors
309
+
310
+ image:https://www.alchemists.io/images/projects/pennyworth/screenshots/ruby-system_errors.png[System Errors,width=706,height=632,role=focal_point]
311
+
312
+ This keyword allows you to search low-level system errors. Depending on which operating system you
313
+ are on, these errors will differ. Error IDs are provided for fuzzy searching since they are what
314
+ you'll most likely see in your stack dumps. The associated constant can be copied to clipboard for
315
+ use in your Ruby code.
316
+
317
+ Type `syserr` to activate. Use `ENTER` to copy constant, `CONTROL` to copy ID, `OPTION` to copy
318
+ description, or `COMMAND` to copy ID, name, and description.
319
+
320
+ ===== System Signals
321
+
322
+ image:https://www.alchemists.io/images/projects/pennyworth/screenshots/ruby-system_signals.png[System Signals,width=706,height=632,role=focal_point]
323
+
324
+ This keyword is for searching and acquiring the system signal you want to `trap` in your Ruby code.
325
+
326
+ Type `signals` to activate. Use `ENTER` to copy name, `OPTION` to copy ID, or `COMMAND` to copy ID
327
+ and name.
328
+
329
+ ===== Text
330
+
331
+ image:https://www.alchemists.io/images/projects/pennyworth/screenshots/ruby-text.png[Text,width=706,height=632,role=focal_point]
332
+
333
+ This keyword is for is for basic text manipulation. Supply a string, phrase, or sentence and let
334
+ Pennyworth calculate all transformations and information you might need.
335
+
336
+ Type `text` to activate plus andy string or phrase to transform. Use `ENTER` to copy text to
337
+ clipboard.
338
+
339
+ ===== UUID
340
+
341
+ image:https://www.alchemists.io/images/projects/pennyworth/screenshots/ruby-uuid.png[Hex,width=706,height=200,role=focal_point]
342
+
343
+ This keyword allows you to generate a random Universally Unique IDentifier (UUID).
344
+
345
+ Type `uuid` to activate and `ENTER` generate.
346
+
347
+ ==== Other
348
+
349
+ The following workflows don't require Pennyworth support but are provided for convenience in case
350
+ they are of interest/aid to your own productivity. Click each link to download and then double click
351
+ to install:
352
+
353
+ * link:https://www.alchemists.io/public/aflred/workflows/acronyms.alfredworkflow[Acronyms] - Expands
354
+ acronyms into full explanations so you can think and type in terms of an acronym but appear as if
355
+ you typed out the full definition each time.
356
+ * https://www.alchemists.io/public/aflred/workflows/alpine.alfredworkflow[Alpine] - Provides
357
+ link:https://www.alpinelinux.org[Alpine Linux] resources.
358
+ * link:https://www.alchemists.io/public/aflred/workflows/applications.alfredworkflow[Applications] -
359
+ Launches development environment but can be tweaked for your preferences. Using Alfred in this
360
+ manner ensures your machine boots or restarts quickly and gives you more control over what is
361
+ launched.
362
+ * link:https://www.alchemists.io/public/aflred/workflows/browsers.alfredworkflow[Browsers] -
363
+ Provides browser related utilities.
364
+ * link:https://www.alchemists.io/public/aflred/workflows/hanami.alfredworkflow[Hanami] - Provides
365
+ link:https://hanamirb.org[Hanami] resources.
366
+ * link:https://www.alchemists.io/public/aflred/workflows/chlli.alfredworkflow[chi.li] - Shortens
367
+ URLs.
368
+ * link:https://www.alchemists.io/public/aflred/workflows/docker.alfredworkflow[Docker] - Provides
369
+ link:https://www.docker.com[Docker] resources.
370
+ * link:https://www.alchemists.io/public/aflred/workflows/mac_os.alfredworkflow[macOS] - Provides
371
+ macOS utilities.
372
+ * link:https://www.alchemists.io/public/aflred/workflows/terraform.alfredworkflow[Terraform] -
373
+ Provides link:https://www.terraform.io[Terraform] resources.
374
+ * link:https://www.alchemists.io/public/aflred/workflows/text.alfredworkflow[Text] - Provides
375
+ general text manipulation utilities beyond the Pennyworth powered _text_ keyword (mentioned
376
+ earlier).
377
+
378
+ == Troubleshooting
379
+
380
+ * link:https://github.com/ruby/psych[Psych] 4.0.0 has a
381
+ link:https://github.com/ruby/psych/issues/490[bug] which prevents loading of YAML configurations
382
+ that use symbols as keys. If you get caught by this, uninstall Psych 4.0.0 and fall back to 3.x.x
383
+ instead.
384
+ * When your Alfred Workflow yields no output, you might want to open the
385
+ link:https://www.alfredapp.com/help/workflows/utilities/debug[Alfred Debugger], rerun your
386
+ workflow, and check for errors. You can also jump to the CLI and run Pennyworth directly.
387
+ * If you get GitHub authorization errors, make sure you have defined the appropriate credentials
388
+ (mentioned earlier) for both within your shell where you are running Pennyworth or within the
389
+ Alfred Workflow environment.
390
+
95
391
  == Development
96
392
 
97
393
  To contribute, run:
data/bin/pennyworth CHANGED
@@ -2,8 +2,6 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require "pennyworth"
5
- require "pennyworth/cli"
6
- require "pennyworth/identity"
7
5
 
8
6
  Process.setproctitle Pennyworth::Identity::VERSION_LABEL
9
- Pennyworth::CLI.start
7
+ Pennyworth::CLI::Shell.new.call ARGV
data/lib/pennyworth.rb CHANGED
@@ -1,4 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "pennyworth/identity"
4
- require "pennyworth/cli"
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