pennyworth 15.1.1 → 15.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 971fe9d524ccf38e76891e073299abc8654030a4c713c667d225f9226309a062
4
- data.tar.gz: 5924413ffd75a28c2dc794436bae7efef3e513b6835618fc0336f6b72a445d23
3
+ metadata.gz: 4e65fbbdb88e730217a71906173573bbf137e1fe8b8daf70dd4c2bb7daa36ca2
4
+ data.tar.gz: 37fa572dbfe7ddb99c2eb6010b2609062b5c29f010b87f724c92d4dd2c2587c4
5
5
  SHA512:
6
- metadata.gz: 2db31bb1bec8438e56766e3d45a77e56d4e09d5ea90f102e068798047fb4e0f4feb16762fd4af49d59a4014862afd165000fa5174371fbf0f42c2ab0bc397644
7
- data.tar.gz: 03ab4d8d702bf72158313cf027f18c547943e0e234fcd3d2d9f57ca47da808c915958bc530cb0de27287591c716e50a770342ef332928ee6765a63c44f1effa7
6
+ metadata.gz: 9a2f683c94c546e9b2534cb4f3e56915068afe08bb98c4b64fac20541b7116b62d94fe94a9fd7419695f4b76f482c25261af8d2db13aca229b0caec07e9f5120
7
+ data.tar.gz: 9e5bb8c8d8ca05c89c8aab97797c80a398c434a42fe663d8c9468a42144250b449f48317dd8f044b5d8b76d70c18857d877d4eea1a979578b7d6fda2d0b6c24f
checksums.yaml.gz.sig CHANGED
Binary file
data/README.adoc CHANGED
@@ -78,7 +78,7 @@ with others.
78
78
 
79
79
  From the command line, type `pennyworth` to view usage:
80
80
 
81
- image:https://alchemists.io/images/projects/pennyworth/screenshots/usage.png[Usage,width=651,height=484,role=focal_point]
81
+ image:https://alchemists.io/images/projects/pennyworth/screenshots/usage.png[Usage,width=668,height=499,role=focal_point]
82
82
 
83
83
  While the command line options are nice, the real power comes from using Pennyworth in conjunction
84
84
  with link:https://www.alfredapp.com/help/workflows/inputs/script-filter/json[Alfred Script Filters].
@@ -222,7 +222,7 @@ to all workflows depending on what kind of item is currently selected within the
222
222
 
223
223
  ==== Alchemists
224
224
 
225
- image:https://alchemists.io/images/projects/pennyworth/screenshots/alchemists-projects.png[Alchemists Projects,width=706,height=632,role=focal_point]
225
+ image:https://alchemists.io/images/projects/pennyworth/screenshots/alchemists-projects.png[Alchemists Projects,width=706,height=631,role=focal_point]
226
226
 
227
227
  Provides quick access to link:https://alchemists.io[Alchemists] resources.
228
228
 
@@ -232,7 +232,7 @@ Provides quick access to link:https://alchemists.io[Alchemists] resources.
232
232
 
233
233
  ==== Dry RB
234
234
 
235
- image:https://alchemists.io/images/projects/pennyworth/screenshots/dry-gems.png[Dry Gems,width=706,height=632,role=focal_point]
235
+ image:https://alchemists.io/images/projects/pennyworth/screenshots/dry.png[Dry Gems,width=706,height=631,role=focal_point]
236
236
 
237
237
  Provides quick access to link:https://dry-rb.org[Dry RB] resources.
238
238
 
@@ -317,7 +317,7 @@ Provides biographical calculations and information.
317
317
 
318
318
  ===== Browsers
319
319
 
320
- image:https://alchemists.io/images/projects/pennyworth/screenshots/browsers.png[Browsers workflow screenshot.,width=706,height=308,role=focal_point]
320
+ image:https://alchemists.io/images/projects/pennyworth/screenshots/browsers.png[Browsers workflow screenshot.,width=706,height=307,role=focal_point]
321
321
 
322
322
  Provides quick access to browser resources.
323
323
 
@@ -9,23 +9,27 @@ module Pennyworth
9
9
  class StandardGems < Sod::Action
10
10
  include Import[:kernel]
11
11
 
12
+ ENDPOINTS = {
13
+ "all" => "stdgems.json",
14
+ "default" => "default_gems.json",
15
+ "bundled" => "bundled_gems.json"
16
+ }.freeze
17
+
12
18
  description "Render Alfred Standard Gems script filter."
13
19
 
14
20
  on "--standard_gems", argument: "[KIND]", allow: %w[all default bundled], default: "all"
15
21
 
16
- def initialize(processor: Processor.for_standard_gems, **)
22
+ def initialize(processor: Processor.for_standard_gems, endpoints: ENDPOINTS, **)
17
23
  super(**)
18
24
  @processor = processor
25
+ @endpoints = endpoints
19
26
  end
20
27
 
21
- def call kind = nil
22
- endpoint = "#{kind || default}_gems.json"
23
- kernel.puts processor.call(endpoint).to_json
24
- end
28
+ def call(kind = nil) = kernel.puts processor.call(endpoints.fetch(kind || default)).to_json
25
29
 
26
30
  private
27
31
 
28
- attr_reader :processor
32
+ attr_reader :processor, :endpoints
29
33
  end
30
34
  end
31
35
  end
@@ -9,46 +9,15 @@ module Pennyworth
9
9
  class Client
10
10
  include Import[:configuration, :http]
11
11
 
12
- # Order matters.
13
- ENDPOINTS = %w[bundled_gems.json default_gems.json].freeze
14
-
15
- def initialize(endpoints: ENDPOINTS, **)
16
- @endpoints = endpoints
17
- super(**)
18
- end
19
-
20
12
  def get endpoint
21
- if endpoints.include? endpoint then load_category endpoint
22
- elsif endpoint == "all_gems.json" then all
23
- else Core::EMPTY_ARRAY
24
- end
25
- end
26
-
27
- private
28
-
29
- attr_reader :endpoints
30
-
31
- # :reek:FeatureEnvy
32
- # :reek:DuplicateMethodCall
33
- def all
34
- load_all.sort_by! { |element| element[:gem] }
35
- .uniq! { |element| element[:gem] }
36
- .then { |collection| collection || Core::EMPTY_ARRAY }
37
- end
38
-
39
- def load_all
40
- endpoints.reduce [] do |collection, endpoint|
41
- collection.append(*load_category(endpoint))
42
- end
43
- end
44
-
45
- def load_category endpoint
46
13
  http.get("#{configuration.standard_gems_api_url}/#{endpoint}")
47
14
  .then do |response|
48
15
  response.status.success? ? records(response.body.to_s) : Core::EMPTY_HASH
49
16
  end
50
17
  end
51
18
 
19
+ private
20
+
52
21
  def records(body) = JSON(body, symbolize_names: true).fetch :gems, Core::EMPTY_ARRAY
53
22
  end
54
23
  end
@@ -21,11 +21,15 @@ module Pennyworth
21
21
 
22
22
  def subtitle = record.fetch :description
23
23
 
24
- def version = record.fetch(:versions, Core::EMPTY_HASH).values.first
24
+ # :reek:FeatureEnvy
25
+ def version
26
+ versions = record.fetch :versions, Core::EMPTY_HASH
27
+ (versions[:bundled] || versions[:default] || versions).values.first
28
+ end
25
29
 
26
- def site_url = record.fetch(:sourceRepository)
30
+ def site_url = record.fetch(:sourceRepository, Core::EMPTY_STRING)
27
31
 
28
- def source_url = record.fetch(:sourceRepository)
32
+ def source_url = record.fetch(:sourceRepository, Core::EMPTY_STRING)
29
33
 
30
34
  def issues_url = "https://github.com/ruby/#{id}/issues"
31
35
 
data/lib/pennyworth.rb CHANGED
@@ -2,13 +2,16 @@
2
2
 
3
3
  require "zeitwerk"
4
4
 
5
- Zeitwerk::Loader.for_gem.then do |loader|
5
+ Zeitwerk::Loader.new.then do |loader|
6
6
  loader.inflector.inflect "cli" => "CLI",
7
7
  "http_status" => "HTTPStatus",
8
8
  "http_statuses" => "HTTPStatuses"
9
+ loader.tag = File.basename __FILE__, ".rb"
10
+ loader.push_dir __dir__
9
11
  loader.setup
10
12
  end
11
13
 
12
14
  # Main namespace.
13
15
  module Pennyworth
16
+ def self.loader(registry = Zeitwerk::Registry) = registry.loader_for __FILE__
14
17
  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 = "15.1.1"
5
+ spec.version = "15.3.0"
6
6
  spec.authors = ["Brooke Kuhlmann"]
7
7
  spec.email = ["brooke@alchemists.io"]
8
8
  spec.homepage = "https://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: 15.1.1
4
+ version: 15.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -35,7 +35,7 @@ cert_chain:
35
35
  3n5C8/6Zh9DYTkpcwPSuIfAga6wf4nXc9m6JAw8AuMLaiWN/r/2s4zJsUHYERJEu
36
36
  gZGm4JqtuSg8pYjPeIJxS960owq+SfuC+jxqmRA54BisFCv/0VOJi7tiJVY=
37
37
  -----END CERTIFICATE-----
38
- date: 2023-07-27 00:00:00.000000000 Z
38
+ date: 2023-10-01 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: cogger
@@ -310,7 +310,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
310
310
  - !ruby/object:Gem::Version
311
311
  version: '0'
312
312
  requirements: []
313
- rubygems_version: 3.4.17
313
+ rubygems_version: 3.4.20
314
314
  signing_key:
315
315
  specification_version: 4
316
316
  summary: A command line interface for augmenting Alfred workflows.
metadata.gz.sig CHANGED
@@ -1,3 +1 @@
1
- R��e���L n��*E����&!�`h5hX8�u��\�r|�r��5E)
2
- �.�8O�(y��i���x�տا[?%�&�
3
- �VĦpپ=�0Y��Xã��J ��v�d��|��H��b�Su�.9��V�ˊ�����)K�� ƛ�|4�P=����]֛wM�ʖx�XVwD�d]��u��ќ������]��<��?=Sj��#����8�eTb^�$�����Š� �
1
+ M"}���OڷѢ��E mZ�I�-����u�D����$ x�SjA���|y�B���j��|����t��#��p�E�����PT�s��EU�/?�>cVk9G��/�ϗV���+/7zU�(