pennyworth 20.1.0 → 21.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/README.adoc +16 -3
- data/lib/pennyworth/cli/actions/htmx/pattern.rb +22 -0
- data/lib/pennyworth/cli/actions/rfc.rb +20 -0
- data/lib/pennyworth/cli/shell.rb +2 -1
- data/lib/pennyworth/configuration/contract.rb +3 -1
- data/lib/pennyworth/configuration/defaults.yml +5 -2
- data/lib/pennyworth/configuration/model.rb +3 -1
- data/lib/pennyworth/container.rb +8 -6
- data/lib/pennyworth/loaders/htmx.rb +19 -34
- data/lib/pennyworth/loaders/http_status.rb +1 -3
- data/lib/pennyworth/loaders/rfc.rb +55 -0
- data/lib/pennyworth/loaders/rodauth.rb +18 -17
- data/lib/pennyworth/models/rfc.rb +8 -0
- data/lib/pennyworth/presenters/htmx.rb +1 -1
- data/lib/pennyworth/presenters/http_status.rb +1 -1
- data/lib/pennyworth/presenters/rfc.rb +26 -0
- data/lib/pennyworth/presenters/rodauth.rb +1 -1
- data/lib/pennyworth/presenters/system/error.rb +2 -2
- data/lib/pennyworth/presenters/text.rb +1 -1
- data/lib/pennyworth/serializers/rfc.rb +52 -0
- data/lib/pennyworth.rb +2 -1
- data/pennyworth.gemspec +2 -2
- data.tar.gz.sig +0 -0
- metadata +11 -6
- metadata.gz.sig +0 -0
- data/lib/pennyworth/cli/actions/htmx/example.rb +0 -22
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fd5a9bee54b2e0b04b957ab8bad00881d798fcad5accd6156806e32172d633fc
|
|
4
|
+
data.tar.gz: 3814834f7b85212965de3536cbfc406f7fb4765bc27e793eda909067bb0979da
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7af812e43ccaa359727026b6d5bcb14f5534d029c71dc049d4883422cdc28fa2ebebe3d13ad2fce599f965fe87a7c6a13bec6020ae2e256f59be5d1abeffa89f
|
|
7
|
+
data.tar.gz: 6304b028aadeaf56723d489d1c3bfe9271be534a90711dc593d2f2fe4dba521ccc7c0484d896c3373c74d4d6a0529d08feb321f4d27f8371959df562c7022c2c
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/README.adoc
CHANGED
|
@@ -82,7 +82,7 @@ with others.
|
|
|
82
82
|
|
|
83
83
|
From the command line, type `pennyworth` to view usage:
|
|
84
84
|
|
|
85
|
-
image:https://alchemists.io/images/projects/pennyworth/screenshots/usage.
|
|
85
|
+
image:https://alchemists.io/images/projects/pennyworth/screenshots/usage.wepb[Usage,width=719,height=516,role=focal_point]
|
|
86
86
|
|
|
87
87
|
While the command line options are nice, the real power comes from using Pennyworth in conjunction
|
|
88
88
|
with link:https://www.alfredapp.com/help/workflows/inputs/script-filter/json[Alfred Script Filters].
|
|
@@ -182,10 +182,13 @@ http:
|
|
|
182
182
|
statuses:
|
|
183
183
|
uri: "https://developer.mozilla.org/docs/Web/HTTP/Status"
|
|
184
184
|
htmx:
|
|
185
|
-
examples_uri: "%<htmx_site_uri>s/examples"
|
|
186
185
|
extensions_uri: "%<htmx_site_uri>s/extensions"
|
|
186
|
+
patterns_uri: "%<htmx_site_uri>s/patterns"
|
|
187
187
|
references_uri: "%<htmx_site_uri>s/reference"
|
|
188
|
-
site_uri: "https://htmx.org"
|
|
188
|
+
site_uri: "https://four.htmx.org"
|
|
189
|
+
rfc:
|
|
190
|
+
index_uri: "%<rfc_site_uri>s/rfc-index"
|
|
191
|
+
site_uri: "https://www.rfc-editor.org"
|
|
189
192
|
rodauth:
|
|
190
193
|
site_uri: "https://rodauth.jeremyevans.net"
|
|
191
194
|
documentation_uri: "%<rodauth_site_uri>s/documentation.html"
|
|
@@ -272,6 +275,16 @@ Provides quick access to the {htmx_link} JavaScript library.
|
|
|
272
275
|
double click to install.
|
|
273
276
|
2. Click on _Configure Workflow_ to view documentation.
|
|
274
277
|
|
|
278
|
+
===== RFC
|
|
279
|
+
|
|
280
|
+
image:https://alchemists.io/images/projects/pennyworth/screenshots/rfc.png[RFC workflow screenshot.,width=706,height=631,role=focal_point]
|
|
281
|
+
|
|
282
|
+
Provides quick access to link:https://www.rfc-editor.org[RFCs] which are foundational to the internet.
|
|
283
|
+
|
|
284
|
+
1. link:https://alchemists.io/public/alfred/workflows/rfc.alfredworkflow[Download] and double
|
|
285
|
+
click to install.
|
|
286
|
+
2. Click on _Configure Workflow_ to view documentation.
|
|
287
|
+
|
|
275
288
|
===== Rodauth
|
|
276
289
|
|
|
277
290
|
image:https://alchemists.io/images/projects/pennyworth/screenshots/rodauth.webp[Rodauth workflow screenshot.,width=706,height=631,role=focal_point]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "sod"
|
|
4
|
+
|
|
5
|
+
module Pennyworth
|
|
6
|
+
module CLI
|
|
7
|
+
module Actions
|
|
8
|
+
module HTMX
|
|
9
|
+
# Handles pattern documentation action.
|
|
10
|
+
class Pattern < Sod::Action
|
|
11
|
+
include Dependencies[:settings, :io, processor: "processors.htmx"]
|
|
12
|
+
|
|
13
|
+
description "Render Alfred patterns script filter."
|
|
14
|
+
|
|
15
|
+
on "--patterns"
|
|
16
|
+
|
|
17
|
+
def call(*) = io.puts processor.call(settings.htmx_patterns_uri).to_json
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "sod"
|
|
4
|
+
|
|
5
|
+
module Pennyworth
|
|
6
|
+
module CLI
|
|
7
|
+
module Actions
|
|
8
|
+
# Handles RFC feature action.
|
|
9
|
+
class RFC < Sod::Action
|
|
10
|
+
include Dependencies[:settings, :io, processor: "processors.rfc"]
|
|
11
|
+
|
|
12
|
+
description "Render Alfred RFC script filter."
|
|
13
|
+
|
|
14
|
+
on "--rfc"
|
|
15
|
+
|
|
16
|
+
def call(*) = io.puts processor.call(settings.rfc_index_uri).to_json
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
data/lib/pennyworth/cli/shell.rb
CHANGED
|
@@ -32,14 +32,15 @@ module Pennyworth
|
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
on "htmx", "Render htmx script filters" do
|
|
35
|
-
on Actions::HTMX::Example
|
|
36
35
|
on Actions::HTMX::Extension
|
|
36
|
+
on Actions::HTMX::Pattern
|
|
37
37
|
on Actions::HTMX::Reference
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
on Actions::Encoding
|
|
41
41
|
on Actions::HTTPStatus
|
|
42
42
|
on Actions::Gem
|
|
43
|
+
on Actions::RFC
|
|
43
44
|
on Actions::Rodauth
|
|
44
45
|
on Actions::StandardGem
|
|
45
46
|
on Actions::StandardError
|
|
@@ -13,10 +13,12 @@ module Pennyworth
|
|
|
13
13
|
optional(:git_hub_organization).filled :string
|
|
14
14
|
optional(:git_hub_user).filled :string
|
|
15
15
|
required(:http_statuses_uri).filled :string
|
|
16
|
-
required(:htmx_examples_uri).filled :string
|
|
17
16
|
required(:htmx_extensions_uri).filled :string
|
|
17
|
+
required(:htmx_patterns_uri).filled :string
|
|
18
18
|
required(:htmx_references_uri).filled :string
|
|
19
19
|
required(:htmx_site_uri).filled :string
|
|
20
|
+
required(:rfc_index_uri).filled :string
|
|
21
|
+
required(:rfc_site_uri).filled :string
|
|
20
22
|
required(:rodauth_site_uri).filled :string
|
|
21
23
|
required(:rodauth_documentation_uri).filled :string
|
|
22
24
|
required(:ruby_gems_api_uri).filled :string
|
|
@@ -76,10 +76,13 @@ http:
|
|
|
76
76
|
statuses:
|
|
77
77
|
uri: "https://developer.mozilla.org/docs/Web/HTTP/Status"
|
|
78
78
|
htmx:
|
|
79
|
-
examples_uri: "%<htmx_site_uri>s/examples"
|
|
80
79
|
extensions_uri: "%<htmx_site_uri>s/extensions"
|
|
80
|
+
patterns_uri: "%<htmx_site_uri>s/patterns"
|
|
81
81
|
references_uri: "%<htmx_site_uri>s/reference"
|
|
82
|
-
site_uri: "https://htmx.org"
|
|
82
|
+
site_uri: "https://four.htmx.org"
|
|
83
|
+
rfc:
|
|
84
|
+
index_uri: "%<rfc_site_uri>s/rfc-index"
|
|
85
|
+
site_uri: "https://www.rfc-editor.org"
|
|
83
86
|
rodauth:
|
|
84
87
|
site_uri: "https://rodauth.jeremyevans.net"
|
|
85
88
|
documentation_uri: "%<rodauth_site_uri>s/documentation.html"
|
|
@@ -9,10 +9,12 @@ module Pennyworth
|
|
|
9
9
|
:git_hub_organization,
|
|
10
10
|
:git_hub_user,
|
|
11
11
|
:http_statuses_uri,
|
|
12
|
-
:htmx_examples_uri,
|
|
13
12
|
:htmx_extensions_uri,
|
|
13
|
+
:htmx_patterns_uri,
|
|
14
14
|
:htmx_references_uri,
|
|
15
15
|
:htmx_site_uri,
|
|
16
|
+
:rfc_index_uri,
|
|
17
|
+
:rfc_site_uri,
|
|
16
18
|
:rodauth_site_uri,
|
|
17
19
|
:rodauth_documentation_uri,
|
|
18
20
|
:ruby_gems_api_uri,
|
data/lib/pennyworth/container.rb
CHANGED
|
@@ -4,7 +4,6 @@ require "cogger"
|
|
|
4
4
|
require "containable"
|
|
5
5
|
require "etcher"
|
|
6
6
|
require "http"
|
|
7
|
-
require "ox"
|
|
8
7
|
require "runcom"
|
|
9
8
|
require "spek"
|
|
10
9
|
|
|
@@ -17,9 +16,10 @@ module Pennyworth
|
|
|
17
16
|
Etcher::Registry.new(contract: Configuration::Contract, model: Configuration::Model)
|
|
18
17
|
.add_loader(:yaml, self[:defaults_path])
|
|
19
18
|
.add_loader(:yaml, self[:xdg_config].active)
|
|
20
|
-
.add_transformer(:format, :htmx_examples_uri)
|
|
21
19
|
.add_transformer(:format, :htmx_extensions_uri)
|
|
20
|
+
.add_transformer(:format, :htmx_patterns_uri)
|
|
22
21
|
.add_transformer(:format, :htmx_references_uri)
|
|
22
|
+
.add_transformer(:format, :rfc_index_uri)
|
|
23
23
|
.add_transformer(:format, :rodauth_documentation_uri)
|
|
24
24
|
end
|
|
25
25
|
|
|
@@ -54,6 +54,12 @@ module Pennyworth
|
|
|
54
54
|
serializer: Serializers::Project
|
|
55
55
|
end
|
|
56
56
|
|
|
57
|
+
register :rfc do
|
|
58
|
+
Processor.new loader: Loaders::RFC.new,
|
|
59
|
+
presenter: Presenters::RFC,
|
|
60
|
+
serializer: Serializers::RFC
|
|
61
|
+
end
|
|
62
|
+
|
|
57
63
|
register :rodauth do
|
|
58
64
|
Processor.new loader: Loaders::Rodauth.new,
|
|
59
65
|
presenter: Presenters::Rodauth,
|
|
@@ -91,10 +97,6 @@ module Pennyworth
|
|
|
91
97
|
end
|
|
92
98
|
end
|
|
93
99
|
|
|
94
|
-
register :ox do
|
|
95
|
-
Ox.tap { |ox| ox.default_options = {mode: :generic, effort: :tolerant, smart: true} }
|
|
96
|
-
end
|
|
97
|
-
|
|
98
100
|
register(:settings) { Etcher.call(self[:registry]).dup }
|
|
99
101
|
register(:specification) { Spek::Loader.call "#{__dir__}/../../pennyworth.gemspec" }
|
|
100
102
|
register(:defaults_path) { Pathname(__dir__).join("configuration/defaults.yml") }
|
|
@@ -1,61 +1,46 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "core"
|
|
4
|
-
require "
|
|
4
|
+
require "nokogiri"
|
|
5
5
|
|
|
6
6
|
module Pennyworth
|
|
7
7
|
module Loaders
|
|
8
|
-
# Loads htmx
|
|
8
|
+
# Loads htmx records by scraping web page.
|
|
9
9
|
class HTMX
|
|
10
|
-
include Dependencies[:http, :settings
|
|
10
|
+
include Dependencies[:http, :settings]
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def self.text_for element
|
|
15
|
-
parts = element.each.with_object [] do |item, content|
|
|
16
|
-
text = if item.is_a? Ox::Element
|
|
17
|
-
"`#{item.text}`"
|
|
18
|
-
else
|
|
19
|
-
item.encode ::Encoding::UTF_8, replace: Core::EMPTY_STRING
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
content.append text
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
parts.join.up.delete_suffix "."
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def initialize(model: Models::HTMX, **)
|
|
12
|
+
def initialize(parser: Nokogiri::HTML5, model: Models::HTMX, **)
|
|
13
|
+
@parser = parser
|
|
29
14
|
@model = model
|
|
30
15
|
super(**)
|
|
31
16
|
end
|
|
32
17
|
|
|
33
18
|
def call uri
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
19
|
+
fetch(uri).then { parse_rows it }
|
|
20
|
+
.each
|
|
21
|
+
.with_object [] do |row, entries|
|
|
22
|
+
row.children in Nokogiri::XML::Element => item, Nokogiri::XML::Element => description
|
|
23
|
+
entries.append build_record(item, description) unless item.text.include? "Soon"
|
|
38
24
|
end
|
|
39
25
|
end
|
|
40
26
|
|
|
41
27
|
private
|
|
42
28
|
|
|
43
|
-
attr_reader :model
|
|
29
|
+
attr_reader :parser, :model
|
|
44
30
|
|
|
45
|
-
def
|
|
31
|
+
def fetch uri
|
|
46
32
|
http.follow.get(uri).then do |response|
|
|
47
|
-
[200, 301].include?(response.status) ?
|
|
33
|
+
[200, 301].include?(response.status) ? response.body.to_s : Core::EMPTY_STRING
|
|
48
34
|
end
|
|
49
35
|
end
|
|
50
36
|
|
|
51
|
-
def parse_rows(
|
|
37
|
+
def parse_rows(page) = parser.parse(page).xpath "//tbody/tr"
|
|
38
|
+
|
|
39
|
+
def build_record item, description
|
|
40
|
+
link = item.at_css "a"
|
|
41
|
+
uri = %(#{settings.htmx_site_uri}#{link["href"]})
|
|
52
42
|
|
|
53
|
-
|
|
54
|
-
model[
|
|
55
|
-
label: (item.locate("*/code").first || item.locate("a").first).text,
|
|
56
|
-
description: "#{self.class.text_for description}.",
|
|
57
|
-
uri: (item.locate("*/@href").first || uri).sub(%r(\A(?=/)), settings.htmx_site_uri)
|
|
58
|
-
]
|
|
43
|
+
model[label: link.text, description: "#{description.text}.", uri:]
|
|
59
44
|
end
|
|
60
45
|
end
|
|
61
46
|
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "core"
|
|
4
|
+
require "nokogiri"
|
|
5
|
+
|
|
6
|
+
module Pennyworth
|
|
7
|
+
module Loaders
|
|
8
|
+
# Loads RFC records by scraping web page.
|
|
9
|
+
class RFC
|
|
10
|
+
include Dependencies[:http, :settings]
|
|
11
|
+
|
|
12
|
+
def initialize(parser: Nokogiri::HTML5, model: Models::RFC, **)
|
|
13
|
+
@parser = parser
|
|
14
|
+
@model = model
|
|
15
|
+
super(**)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def call uri
|
|
19
|
+
fetch(uri).then { parse_rows it }
|
|
20
|
+
.each
|
|
21
|
+
.with_object [] do |row, entries|
|
|
22
|
+
row.children in Nokogiri::XML::Element => label,
|
|
23
|
+
Nokogiri::XML::Element => description,
|
|
24
|
+
Nokogiri::XML::Element => published
|
|
25
|
+
entries.append build_record(label, description, published)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
private
|
|
30
|
+
|
|
31
|
+
attr_reader :parser, :model
|
|
32
|
+
|
|
33
|
+
def fetch uri
|
|
34
|
+
http.follow.get(uri).then do |response|
|
|
35
|
+
[200, 301].include?(response.status) ? response.body.to_s : Core::EMPTY_STRING
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def parse_rows(page) = parser.parse(page).xpath "//tbody/tr"
|
|
40
|
+
|
|
41
|
+
def build_record label, description, published
|
|
42
|
+
prefix, number = label.xpath(".//span/span").map(&:text)
|
|
43
|
+
uri = label.at_css("a")["href"]
|
|
44
|
+
|
|
45
|
+
model[
|
|
46
|
+
number: number,
|
|
47
|
+
label: "#{prefix} #{number}",
|
|
48
|
+
description: description.text,
|
|
49
|
+
published: published.text,
|
|
50
|
+
uri: "#{settings.rfc_site_uri}#{uri}"
|
|
51
|
+
]
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -1,51 +1,52 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "core"
|
|
4
|
+
require "nokogiri"
|
|
4
5
|
require "refinements/pathname"
|
|
5
|
-
require "refinements/string"
|
|
6
6
|
|
|
7
7
|
module Pennyworth
|
|
8
8
|
module Loaders
|
|
9
9
|
# Loads Rodauth documentation by scraping the web page.
|
|
10
10
|
class Rodauth
|
|
11
|
-
include Dependencies[:http, :settings
|
|
11
|
+
include Dependencies[:http, :settings]
|
|
12
12
|
|
|
13
|
-
using Refinements::String
|
|
14
13
|
using Refinements::Pathname
|
|
15
14
|
|
|
16
|
-
def initialize(model: Models::Rodauth, **)
|
|
15
|
+
def initialize(parser: Nokogiri::HTML5, model: Models::Rodauth, **)
|
|
16
|
+
@parser = parser
|
|
17
17
|
@model = model
|
|
18
18
|
super(**)
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def call uri
|
|
22
|
-
|
|
22
|
+
fetch(uri).then { parse_items it }
|
|
23
|
+
.each
|
|
24
|
+
.with_object([]) { |item, entries| entries.append build_record(item) }
|
|
23
25
|
end
|
|
24
26
|
|
|
25
27
|
private
|
|
26
28
|
|
|
27
|
-
attr_reader :model
|
|
29
|
+
attr_reader :parser, :model
|
|
28
30
|
|
|
29
|
-
def
|
|
31
|
+
def fetch uri
|
|
30
32
|
http.get(uri).then do |response|
|
|
31
|
-
[200, 301].include?(response.status) ?
|
|
33
|
+
[200, 301].include?(response.status) ? response.body.to_s : Core::EMPTY_STRING
|
|
32
34
|
end
|
|
33
35
|
end
|
|
34
36
|
|
|
35
|
-
def parse_items
|
|
36
|
-
parser.parse(
|
|
37
|
-
rescue NoMethodError
|
|
38
|
-
Core::EMPTY_ARRAY
|
|
37
|
+
def parse_items page
|
|
38
|
+
parser.parse(page).xpath('//*[@id="content"]//ul/li')
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
-
def
|
|
42
|
-
link = item.a
|
|
43
|
-
|
|
41
|
+
def build_record item
|
|
42
|
+
link = item.at_css "a"
|
|
43
|
+
label = link.text
|
|
44
|
+
uri = %(#{settings.rodauth_site_uri}/#{link["href"]})
|
|
44
45
|
|
|
45
46
|
model[
|
|
46
47
|
name: Pathname(uri).name.to_s.delete_suffix("_rdoc"),
|
|
47
|
-
label
|
|
48
|
-
description: item.text.delete_prefix(": "),
|
|
48
|
+
label:,
|
|
49
|
+
description: item.text.delete_prefix("#{label}: "),
|
|
49
50
|
uri:
|
|
50
51
|
]
|
|
51
52
|
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "forwardable"
|
|
4
|
+
|
|
5
|
+
module Pennyworth
|
|
6
|
+
module Presenters
|
|
7
|
+
# Shapes a RFC record for serialization.
|
|
8
|
+
class RFC
|
|
9
|
+
extend Forwardable
|
|
10
|
+
|
|
11
|
+
delegate Models::RFC.members => :record
|
|
12
|
+
|
|
13
|
+
def initialize record
|
|
14
|
+
@record = record
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
alias id number
|
|
18
|
+
|
|
19
|
+
def subtitle = "#{description}. Published: #{published}."
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
attr_reader :record
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -9,13 +9,13 @@ module Pennyworth
|
|
|
9
9
|
class Error
|
|
10
10
|
extend Forwardable
|
|
11
11
|
|
|
12
|
-
delegate
|
|
12
|
+
delegate Models::System::Error.members => :record
|
|
13
13
|
|
|
14
14
|
def initialize record
|
|
15
15
|
@record = record
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
alias label name
|
|
19
19
|
|
|
20
20
|
def subtitle = "#{label}: #{description}."
|
|
21
21
|
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pennyworth
|
|
4
|
+
module Serializers
|
|
5
|
+
# Serializes a RFC presenter for parsing by Alfred script filters.
|
|
6
|
+
class RFC
|
|
7
|
+
def initialize presenter
|
|
8
|
+
@presenter = presenter
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def to_h
|
|
12
|
+
{
|
|
13
|
+
uid: presenter.id,
|
|
14
|
+
title: presenter.label,
|
|
15
|
+
subtitle: presenter.subtitle,
|
|
16
|
+
arg: site_uri,
|
|
17
|
+
quicklookurl: site_uri,
|
|
18
|
+
mods: modifications,
|
|
19
|
+
text:
|
|
20
|
+
}
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
attr_reader :presenter
|
|
26
|
+
|
|
27
|
+
def modifications
|
|
28
|
+
{
|
|
29
|
+
alt: modification(presenter.label, "Copy label."),
|
|
30
|
+
cmd: modification(presenter.description, "Copy description."),
|
|
31
|
+
control: modification(presenter.number, "Copy number.")
|
|
32
|
+
}
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def modification argument, subtitle
|
|
36
|
+
{
|
|
37
|
+
subtitle:,
|
|
38
|
+
arg: argument
|
|
39
|
+
}
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def text
|
|
43
|
+
{
|
|
44
|
+
copy: site_uri,
|
|
45
|
+
largetype: site_uri
|
|
46
|
+
}
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def site_uri = presenter.uri
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
data/lib/pennyworth.rb
CHANGED
|
@@ -6,7 +6,8 @@ Zeitwerk::Loader.new.then do |loader|
|
|
|
6
6
|
loader.inflector.inflect "cli" => "CLI",
|
|
7
7
|
"http_status" => "HTTPStatus",
|
|
8
8
|
"http_statuses" => "HTTPStatuses",
|
|
9
|
-
"htmx" => "HTMX"
|
|
9
|
+
"htmx" => "HTMX",
|
|
10
|
+
"rfc" => "RFC"
|
|
10
11
|
loader.tag = File.basename __FILE__, ".rb"
|
|
11
12
|
loader.push_dir __dir__
|
|
12
13
|
loader.setup
|
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 = "21.0.0"
|
|
6
6
|
spec.authors = ["Brooke Kuhlmann"]
|
|
7
7
|
spec.email = ["brooke@alchemists.io"]
|
|
8
8
|
spec.homepage = "https://alchemists.io/projects/pennyworth"
|
|
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
|
|
|
31
31
|
spec.add_dependency "ghub", "~> 2.0"
|
|
32
32
|
spec.add_dependency "http", "~> 6.0"
|
|
33
33
|
spec.add_dependency "infusible", "~> 5.0"
|
|
34
|
-
spec.add_dependency "
|
|
34
|
+
spec.add_dependency "nokogiri", "~> 1.19.4"
|
|
35
35
|
spec.add_dependency "rack", "~> 3.1"
|
|
36
36
|
spec.add_dependency "refinements", "~> 14.0"
|
|
37
37
|
spec.add_dependency "runcom", "~> 13.0"
|
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: 21.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Brooke Kuhlmann
|
|
@@ -134,19 +134,19 @@ dependencies:
|
|
|
134
134
|
- !ruby/object:Gem::Version
|
|
135
135
|
version: '5.0'
|
|
136
136
|
- !ruby/object:Gem::Dependency
|
|
137
|
-
name:
|
|
137
|
+
name: nokogiri
|
|
138
138
|
requirement: !ruby/object:Gem::Requirement
|
|
139
139
|
requirements:
|
|
140
140
|
- - "~>"
|
|
141
141
|
- !ruby/object:Gem::Version
|
|
142
|
-
version:
|
|
142
|
+
version: 1.19.4
|
|
143
143
|
type: :runtime
|
|
144
144
|
prerelease: false
|
|
145
145
|
version_requirements: !ruby/object:Gem::Requirement
|
|
146
146
|
requirements:
|
|
147
147
|
- - "~>"
|
|
148
148
|
- !ruby/object:Gem::Version
|
|
149
|
-
version:
|
|
149
|
+
version: 1.19.4
|
|
150
150
|
- !ruby/object:Gem::Dependency
|
|
151
151
|
name: rack
|
|
152
152
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -248,10 +248,11 @@ files:
|
|
|
248
248
|
- lib/pennyworth/cli/actions/gem.rb
|
|
249
249
|
- lib/pennyworth/cli/actions/git_hub/organization.rb
|
|
250
250
|
- lib/pennyworth/cli/actions/git_hub/user.rb
|
|
251
|
-
- lib/pennyworth/cli/actions/htmx/example.rb
|
|
252
251
|
- lib/pennyworth/cli/actions/htmx/extension.rb
|
|
252
|
+
- lib/pennyworth/cli/actions/htmx/pattern.rb
|
|
253
253
|
- lib/pennyworth/cli/actions/htmx/reference.rb
|
|
254
254
|
- lib/pennyworth/cli/actions/http_status.rb
|
|
255
|
+
- lib/pennyworth/cli/actions/rfc.rb
|
|
255
256
|
- lib/pennyworth/cli/actions/rodauth.rb
|
|
256
257
|
- lib/pennyworth/cli/actions/standard_error.rb
|
|
257
258
|
- lib/pennyworth/cli/actions/standard_gem.rb
|
|
@@ -270,6 +271,7 @@ files:
|
|
|
270
271
|
- lib/pennyworth/loaders/git_hub.rb
|
|
271
272
|
- lib/pennyworth/loaders/htmx.rb
|
|
272
273
|
- lib/pennyworth/loaders/http_status.rb
|
|
274
|
+
- lib/pennyworth/loaders/rfc.rb
|
|
273
275
|
- lib/pennyworth/loaders/rodauth.rb
|
|
274
276
|
- lib/pennyworth/loaders/standard_error.rb
|
|
275
277
|
- lib/pennyworth/loaders/standard_gem.rb
|
|
@@ -279,6 +281,7 @@ files:
|
|
|
279
281
|
- lib/pennyworth/models/encoding.rb
|
|
280
282
|
- lib/pennyworth/models/htmx.rb
|
|
281
283
|
- lib/pennyworth/models/http_status.rb
|
|
284
|
+
- lib/pennyworth/models/rfc.rb
|
|
282
285
|
- lib/pennyworth/models/rodauth.rb
|
|
283
286
|
- lib/pennyworth/models/standard_error.rb
|
|
284
287
|
- lib/pennyworth/models/system/error.rb
|
|
@@ -289,6 +292,7 @@ files:
|
|
|
289
292
|
- lib/pennyworth/presenters/htmx.rb
|
|
290
293
|
- lib/pennyworth/presenters/http_status.rb
|
|
291
294
|
- lib/pennyworth/presenters/repository.rb
|
|
295
|
+
- lib/pennyworth/presenters/rfc.rb
|
|
292
296
|
- lib/pennyworth/presenters/rodauth.rb
|
|
293
297
|
- lib/pennyworth/presenters/standard_error.rb
|
|
294
298
|
- lib/pennyworth/presenters/standard_gem.rb
|
|
@@ -300,6 +304,7 @@ files:
|
|
|
300
304
|
- lib/pennyworth/serializers/htmx.rb
|
|
301
305
|
- lib/pennyworth/serializers/http_status.rb
|
|
302
306
|
- lib/pennyworth/serializers/project.rb
|
|
307
|
+
- lib/pennyworth/serializers/rfc.rb
|
|
303
308
|
- lib/pennyworth/serializers/rodauth.rb
|
|
304
309
|
- lib/pennyworth/serializers/standard_error.rb
|
|
305
310
|
- lib/pennyworth/serializers/system/error.rb
|
|
@@ -331,7 +336,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
331
336
|
- !ruby/object:Gem::Version
|
|
332
337
|
version: '0'
|
|
333
338
|
requirements: []
|
|
334
|
-
rubygems_version: 4.0.
|
|
339
|
+
rubygems_version: 4.0.18
|
|
335
340
|
specification_version: 4
|
|
336
341
|
summary: A command line interface for augmented Alfred workflows.
|
|
337
342
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "sod"
|
|
4
|
-
|
|
5
|
-
module Pennyworth
|
|
6
|
-
module CLI
|
|
7
|
-
module Actions
|
|
8
|
-
module HTMX
|
|
9
|
-
# Handles examples documentation action.
|
|
10
|
-
class Example < Sod::Action
|
|
11
|
-
include Dependencies[:settings, :io, processor: "processors.htmx"]
|
|
12
|
-
|
|
13
|
-
description "Render Alfred examples script filter."
|
|
14
|
-
|
|
15
|
-
on "--examples"
|
|
16
|
-
|
|
17
|
-
def call(*) = io.puts processor.call(settings.htmx_examples_uri).to_json
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|