pennyworth 13.1.0 → 13.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c24c98e02da39dee6f713ef1b1253734352d176af5ee399ec430ab4b40ee24bb
4
- data.tar.gz: 816ed741049d3923a606eebb7400c54d706d7a4a8dc77a79ca1681e4025611ba
3
+ metadata.gz: b3cebd285e4000aba774c716d9bc944fb6a836bf55170f0c33d9395497934f53
4
+ data.tar.gz: 8c5a01d3f6c905f48a87a1b8a493d8c6c5a3e1acf6a8ac9bfb4dec3bd6852b63
5
5
  SHA512:
6
- metadata.gz: 9ec4dd5f71c8070a688b9f8cbe6014cd1e5541ab62a0a0238df07387ce09da2f197d028ec567cf17900cfc38b72d23b26898125f82a9c11884f40f053058681a
7
- data.tar.gz: 1511e46c67c7e757f64bc8618753dd54a1971aa4f7af3d598eea32b74947fb06c9166d78408c426389be355c64980b82dc952e4a4ef0cba85e7820f394a7300d
6
+ metadata.gz: 6ec8f05dc8a522a668727544ae256c206479c9fb6066b93823f47a5c07d64fb83955377da0ee6bc5c487e173d3b86ecd9680a034efb1f90427df3fe3bf42f21e
7
+ data.tar.gz: 932346b9d5607c23daa7baf0fcb85bc7bc5e8afd4c4aed24d3f7dd5162ef795ff402fa83dd79c78ae75e1710c94efdd638fa49590eeab3f56fb648e021e30207
checksums.yaml.gz.sig CHANGED
Binary file
data/README.adoc CHANGED
@@ -351,6 +351,23 @@ This keyword allows you to generate a repeating sequence of the same character(s
351
351
  Type `repeat` to activate and `ENTER` generate. You must supply the character(s) you want to repeat
352
352
  followed by a number indicating how many times you want the character(s) to repeat.
353
353
 
354
+ ===== Standard Errors
355
+
356
+ image:https://www.alchemists.io/images/projects/pennyworth/screenshots/ruby-standard_errors.png[Standard Errors,width=706,height=632,role=focal_point]
357
+
358
+ This keyword allows you to list all subclasses of `StandardError`. Due to the dynamic nature of how
359
+ these subclasses are loaded, they are influenced by this gem's environment and dependencies which
360
+ can be either too narrow or too verbose. This list also includes system errors which have a
361
+ specialized workflow as described below. While this list can be long, it is alphabetically sorted
362
+ for quick filtering when fuzzy typing.
363
+
364
+ Type `stderr` to activate. Use `ENTER` to copy the subclass to clipboard, `CONTROL` to copy the
365
+ error name, or `OPTION` to copy the source path.
366
+
367
+ 💡 The subclass source path might not always be available because not all subclasses are written in
368
+ Ruby but C instead. That said, when the source path does exist, you'll get the full path plus line
369
+ number in the format of `<source path>:<line number>` for easy loading within your editor of choice.
370
+
354
371
  ===== System Errors
355
372
 
356
373
  image:https://www.alchemists.io/images/projects/pennyworth/screenshots/ruby-system_errors.png[System Errors,width=706,height=632,role=focal_point]
@@ -18,6 +18,7 @@ module Pennyworth
18
18
  register(:git_hub) { GitHub.new }
19
19
  register(:http_statuses) { HTTPStatuses.new }
20
20
  register(:ruby_gems) { RubyGems.new }
21
+ register(:standard_errors) { StandardErrors.new }
21
22
  register(:system_errors) { System::Errors.new }
22
23
  register(:system_signals) { System::Signals.new }
23
24
  register(:text) { Text.new }
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pennyworth
4
+ module CLI
5
+ module Actions
6
+ # Handles the system errors action.
7
+ class StandardErrors
8
+ include Pennyworth::Import[:logger]
9
+
10
+ def initialize processor: Processor.for_standard_errors, **dependencies
11
+ super(**dependencies)
12
+ @processor = processor
13
+ end
14
+
15
+ def call = processor.call.to_json.then { |json| logger.info { json } }
16
+
17
+ private
18
+
19
+ attr_reader :processor
20
+ end
21
+ end
22
+ end
23
+ end
@@ -71,6 +71,12 @@ module Pennyworth
71
71
  end
72
72
  end
73
73
 
74
+ def add_standard_errors
75
+ client.on "--standard_errors", "Render Alfred standard errors script filter." do
76
+ configuration.action_standard_errors = true
77
+ end
78
+ end
79
+
74
80
  def add_system_errors
75
81
  client.on "--system_errors", "Render Alfred system errors script filter." do
76
82
  configuration.action_system_errors = true
@@ -10,6 +10,7 @@ module Pennyworth
10
10
  :git_hub,
11
11
  :http_statuses,
12
12
  :ruby_gems,
13
+ :standard_errors,
13
14
  :system_errors,
14
15
  :system_signals,
15
16
  :text,
@@ -42,8 +43,9 @@ module Pennyworth
42
43
  in action_http_statuses: true then http_statuses.call
43
44
  in action_ruby_gems: true
44
45
  ruby_gems.call "owners/#{configuration.ruby_gems_owner}/gems.json"
45
- in action_system_signals: true then system_signals.call
46
+ in action_standard_errors: true then standard_errors.call
46
47
  in action_system_errors: true then system_errors.call
48
+ in action_system_signals: true then system_signals.call
47
49
  in action_text: String => content then text.call content
48
50
  in action_version: true then logger.info { specification.labeled_version }
49
51
  else logger.any { parser.to_s }
@@ -8,6 +8,7 @@ module Pennyworth
8
8
  :action_git_hub,
9
9
  :action_http_statuses,
10
10
  :action_ruby_gems,
11
+ :action_standard_errors,
11
12
  :action_system_errors,
12
13
  :action_system_signals,
13
14
  :action_text,
@@ -6,6 +6,7 @@
6
6
  - "Dry Cli": "Dry CLI"
7
7
  - "Flacsmith": "FLACsmith"
8
8
  - "Git Plus": "Git+"
9
+ - "Http Fake": "HTTP Fake"
9
10
  - "Mac Os Config": "macOS Configuration"
10
11
  - "Mac Os": "MacOS"
11
12
  - "Prawn Plus": "Prawn+"
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pennyworth
4
+ module Loaders
5
+ # Loads an array of standard error records.
6
+ class StandardErrors
7
+ def initialize root: StandardError, model: Models::StandardError
8
+ @root = root
9
+ @model = model
10
+ end
11
+
12
+ def call _omit = nil
13
+ ObjectSpace.each_object(Class)
14
+ .select { |klass| klass < root }
15
+ .sort_by(&:name)
16
+ .map do |error|
17
+ file_path, line_number = Object.const_source_location error.name
18
+ model[name: error, file_path:, line_number:]
19
+ end
20
+ end
21
+
22
+ private
23
+
24
+ attr_reader :root, :model
25
+ end
26
+ end
27
+ end
@@ -1,14 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "refinements/arrays"
4
-
5
3
  module Pennyworth
6
4
  module Loaders
7
5
  module System
8
6
  # Loads an array of system error records.
9
7
  class Errors
10
- using Refinements::Arrays
11
-
12
8
  def initialize errno: Errno, model: Models::System::Error
13
9
  @errno = errno
14
10
  @model = model
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pennyworth
4
+ module Models
5
+ # Defines a standard error.
6
+ StandardError = Struct.new :name, :file_path, :line_number, keyword_init: true
7
+ end
8
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "refinements/arrays"
4
+
5
+ module Pennyworth
6
+ module Presenters
7
+ # Renders a standard error into a compatible format for use in Alfred script filters.
8
+ class StandardError
9
+ using Refinements::Arrays
10
+
11
+ def initialize record
12
+ @record = record
13
+ end
14
+
15
+ def id = label
16
+
17
+ def label = record.name.to_s
18
+
19
+ def path = file_path.empty? ? "" : [file_path, record.line_number].compress!.join(":")
20
+
21
+ private
22
+
23
+ attr_reader :record
24
+
25
+ def file_path = record.file_path.to_s
26
+ end
27
+ end
28
+ end
@@ -27,10 +27,10 @@ module Pennyworth
27
27
  serializer: Serializers::Project
28
28
  end
29
29
 
30
- def self.for_system_signals
31
- new loader: Loaders::System::Signals.new,
32
- presenter: Presenters::System::Signal,
33
- serializer: Serializers::System::Signal
30
+ def self.for_standard_errors
31
+ new loader: Loaders::StandardErrors.new,
32
+ presenter: Presenters::StandardError,
33
+ serializer: Serializers::StandardError
34
34
  end
35
35
 
36
36
  def self.for_system_errors
@@ -39,6 +39,12 @@ module Pennyworth
39
39
  serializer: Serializers::System::Error
40
40
  end
41
41
 
42
+ def self.for_system_signals
43
+ new loader: Loaders::System::Signals.new,
44
+ presenter: Presenters::System::Signal,
45
+ serializer: Serializers::System::Signal
46
+ end
47
+
42
48
  def self.for_text
43
49
  new loader: Loaders::Text.new, presenter: Presenters::Text, serializer: Serializers::Text
44
50
  end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pennyworth
4
+ module Serializers
5
+ # Serializes a standard error into a compatible format for parsing within Alfred script filters.
6
+ class StandardError
7
+ def initialize presenter
8
+ @presenter = presenter
9
+ end
10
+
11
+ def to_h
12
+ {
13
+ uid: id,
14
+ title: id,
15
+ arg: label,
16
+ mods: modifications,
17
+ text: {copy: label, largetype: label}
18
+ }
19
+ end
20
+
21
+ private
22
+
23
+ attr_reader :presenter
24
+
25
+ def id = presenter.id
26
+
27
+ def label = presenter.label
28
+
29
+ def description = presenter.description
30
+
31
+ def modifications
32
+ {
33
+ control: {subtitle: "Copy label.", arg: label},
34
+ alt: {subtitle: "Copy path.", arg: path}
35
+ }
36
+ end
37
+
38
+ def path = presenter.path
39
+ end
40
+ end
41
+ 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 = "13.1.0"
5
+ spec.version = "13.2.0"
6
6
  spec.authors = ["Brooke Kuhlmann"]
7
7
  spec.email = ["brooke@alchemists.io"]
8
8
  spec.homepage = "https://www.alchemists.io/projects/pennyworth"
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: 13.1.0
4
+ version: 13.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -28,7 +28,7 @@ cert_chain:
28
28
  CxDe2+VuChj4I1nvIHdu+E6XoEVlanUPKmSg6nddhkKn2gC45Kyzh6FZqnzH/CRp
29
29
  RFE=
30
30
  -----END CERTIFICATE-----
31
- date: 2022-05-07 00:00:00.000000000 Z
31
+ date: 2022-05-15 00:00:00.000000000 Z
32
32
  dependencies:
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: auto_injector
@@ -177,6 +177,7 @@ files:
177
177
  - lib/pennyworth/cli/actions/http_statuses.rb
178
178
  - lib/pennyworth/cli/actions/import.rb
179
179
  - lib/pennyworth/cli/actions/ruby_gems.rb
180
+ - lib/pennyworth/cli/actions/standard_errors.rb
180
181
  - lib/pennyworth/cli/actions/system/errors.rb
181
182
  - lib/pennyworth/cli/actions/system/signals.rb
182
183
  - lib/pennyworth/cli/actions/text.rb
@@ -197,11 +198,13 @@ files:
197
198
  - lib/pennyworth/loaders/encodings.rb
198
199
  - lib/pennyworth/loaders/http_statuses.rb
199
200
  - lib/pennyworth/loaders/projects.rb
201
+ - lib/pennyworth/loaders/standard_errors.rb
200
202
  - lib/pennyworth/loaders/system/errors.rb
201
203
  - lib/pennyworth/loaders/system/signals.rb
202
204
  - lib/pennyworth/loaders/text.rb
203
205
  - lib/pennyworth/models/encoding.rb
204
206
  - lib/pennyworth/models/http_status.rb
207
+ - lib/pennyworth/models/standard_error.rb
205
208
  - lib/pennyworth/models/system/error.rb
206
209
  - lib/pennyworth/models/system/signal.rb
207
210
  - lib/pennyworth/models/text.rb
@@ -209,6 +212,7 @@ files:
209
212
  - lib/pennyworth/presenters/gem.rb
210
213
  - lib/pennyworth/presenters/http_status.rb
211
214
  - lib/pennyworth/presenters/repository.rb
215
+ - lib/pennyworth/presenters/standard_error.rb
212
216
  - lib/pennyworth/presenters/system/error.rb
213
217
  - lib/pennyworth/presenters/system/signal.rb
214
218
  - lib/pennyworth/presenters/text.rb
@@ -216,6 +220,7 @@ files:
216
220
  - lib/pennyworth/serializers/encoding.rb
217
221
  - lib/pennyworth/serializers/http_status.rb
218
222
  - lib/pennyworth/serializers/project.rb
223
+ - lib/pennyworth/serializers/standard_error.rb
219
224
  - lib/pennyworth/serializers/system/error.rb
220
225
  - lib/pennyworth/serializers/system/signal.rb
221
226
  - lib/pennyworth/serializers/text.rb
metadata.gz.sig CHANGED
Binary file