pennyworth 10.0.1 → 11.1.1
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 +352 -31
- 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 +81 -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 +0 -0
- 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
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Pennyworth
|
4
|
+
module Serializers
|
5
|
+
# Serializes a HTTP status into a compatible format for parsing within Alfred script filters.
|
6
|
+
class HTTPStatus
|
7
|
+
def initialize presenter
|
8
|
+
@presenter = presenter
|
9
|
+
end
|
10
|
+
|
11
|
+
def to_h
|
12
|
+
{
|
13
|
+
uid: id,
|
14
|
+
title: code,
|
15
|
+
subtitle: label,
|
16
|
+
arg: presenter.symbol,
|
17
|
+
mods: modifications,
|
18
|
+
text: {copy: "#{code} #{label}", largetype: "#{code} #{label}"}
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
attr_reader :presenter
|
25
|
+
|
26
|
+
def id = presenter.id
|
27
|
+
|
28
|
+
def code = presenter.code
|
29
|
+
|
30
|
+
def label = presenter.label
|
31
|
+
|
32
|
+
def modifications
|
33
|
+
{
|
34
|
+
control: {subtitle: "Copy code.", arg: id},
|
35
|
+
alt: {subtitle: "Copy label.", arg: label},
|
36
|
+
cmd: {subtitle: "View documentation.", arg: presenter.url}
|
37
|
+
}
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Pennyworth
|
4
|
+
module Serializers
|
5
|
+
# Serializes a project into a compatible format for parsing within Alfred script filters.
|
6
|
+
class Project
|
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_url,
|
17
|
+
quicklookurl: site_url,
|
18
|
+
mods: modifications,
|
19
|
+
text: text
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
attr_reader :presenter
|
26
|
+
|
27
|
+
def modifications
|
28
|
+
{
|
29
|
+
control: modification(presenter.changes_url, "View changes."),
|
30
|
+
alt: modification(presenter.source_url, "View source."),
|
31
|
+
cmd: modification(presenter.issues_url, "View issues.")
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
def modification argument, subtitle
|
36
|
+
{
|
37
|
+
subtitle: subtitle,
|
38
|
+
arg: argument
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
def text
|
43
|
+
{
|
44
|
+
copy: site_url,
|
45
|
+
largetype: site_url
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
def site_url = presenter.site_url
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Pennyworth
|
4
|
+
module Serializers
|
5
|
+
module System
|
6
|
+
# Serializes a system error into a compatible format for parsing within Alfred script filters.
|
7
|
+
class Error
|
8
|
+
def initialize presenter
|
9
|
+
@presenter = presenter
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_h
|
13
|
+
{
|
14
|
+
uid: id,
|
15
|
+
title: id,
|
16
|
+
subtitle: presenter.subtitle,
|
17
|
+
arg: label,
|
18
|
+
mods: modifications,
|
19
|
+
text: {copy: label, largetype: label}
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
attr_reader :presenter
|
26
|
+
|
27
|
+
def id = presenter.id
|
28
|
+
|
29
|
+
def label = presenter.label
|
30
|
+
|
31
|
+
def description = presenter.description
|
32
|
+
|
33
|
+
def modifications
|
34
|
+
{
|
35
|
+
control: {subtitle: "Copy ID.", arg: id},
|
36
|
+
alt: {subtitle: "Copy description.", arg: description},
|
37
|
+
cmd: {
|
38
|
+
subtitle: "Copy ID, name, and description.",
|
39
|
+
arg: "#{id}, #{label}, #{description}"
|
40
|
+
}
|
41
|
+
}
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Pennyworth
|
4
|
+
module Serializers
|
5
|
+
module System
|
6
|
+
# Serializes a signal into a compatible format for parsing within Alfred script filters.
|
7
|
+
class Signal
|
8
|
+
def initialize presenter
|
9
|
+
@presenter = presenter
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_h
|
13
|
+
{
|
14
|
+
uid: id,
|
15
|
+
title: label,
|
16
|
+
subtitle: id,
|
17
|
+
arg: label,
|
18
|
+
mods: modifications,
|
19
|
+
text: {copy: label, largetype: label}
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
attr_reader :presenter
|
26
|
+
|
27
|
+
def id = presenter.id
|
28
|
+
|
29
|
+
def label = presenter.label
|
30
|
+
|
31
|
+
def modifications
|
32
|
+
{
|
33
|
+
alt: {subtitle: "Copy ID.", arg: id},
|
34
|
+
cmd: {subtitle: "Copy ID and name.", arg: "#{id}, #{label}"}
|
35
|
+
}
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Pennyworth
|
4
|
+
module Serializers
|
5
|
+
# Serializes a text into a compatible format for parsing within Alfred script filters.
|
6
|
+
class Text
|
7
|
+
def initialize presenter
|
8
|
+
@presenter = presenter
|
9
|
+
end
|
10
|
+
|
11
|
+
def to_h
|
12
|
+
{
|
13
|
+
uid: id,
|
14
|
+
title: presenter.label,
|
15
|
+
subtitle: id.capitalize,
|
16
|
+
arg: content,
|
17
|
+
icon: {path: "text/#{id}.png"},
|
18
|
+
text: {copy: content, largetype: content}
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
attr_reader :presenter
|
25
|
+
|
26
|
+
def id = presenter.id
|
27
|
+
|
28
|
+
def content = presenter.content
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
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: 11.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -28,8 +28,64 @@ cert_chain:
|
|
28
28
|
lkHilIrX69jq8wMPpBhlaw2mRmeSL50Wv5u6xVBvOHhXFSP1crXM95vfLhLyRYod
|
29
29
|
W2A=
|
30
30
|
-----END CERTIFICATE-----
|
31
|
-
date: 2021-
|
31
|
+
date: 2021-07-24 00:00:00.000000000 Z
|
32
32
|
dependencies:
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: dry-container
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0.8'
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0.8'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: http
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '5.0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '5.0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: pastel
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0.8'
|
68
|
+
type: :runtime
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0.8'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: rack
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '2.2'
|
82
|
+
type: :runtime
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '2.2'
|
33
89
|
- !ruby/object:Gem::Dependency
|
34
90
|
name: refinements
|
35
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,19 +115,19 @@ dependencies:
|
|
59
115
|
- !ruby/object:Gem::Version
|
60
116
|
version: '7.0'
|
61
117
|
- !ruby/object:Gem::Dependency
|
62
|
-
name:
|
118
|
+
name: zeitwerk
|
63
119
|
requirement: !ruby/object:Gem::Requirement
|
64
120
|
requirements:
|
65
121
|
- - "~>"
|
66
122
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
123
|
+
version: '2.4'
|
68
124
|
type: :runtime
|
69
125
|
prerelease: false
|
70
126
|
version_requirements: !ruby/object:Gem::Requirement
|
71
127
|
requirements:
|
72
128
|
- - "~>"
|
73
129
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
130
|
+
version: '2.4'
|
75
131
|
description:
|
76
132
|
email:
|
77
133
|
- brooke@alchemists.io
|
@@ -86,19 +142,54 @@ files:
|
|
86
142
|
- README.adoc
|
87
143
|
- bin/pennyworth
|
88
144
|
- lib/pennyworth.rb
|
89
|
-
- lib/pennyworth/cli.rb
|
145
|
+
- lib/pennyworth/cli/actions/config.rb
|
146
|
+
- lib/pennyworth/cli/actions/encodings.rb
|
147
|
+
- lib/pennyworth/cli/actions/git_hub.rb
|
148
|
+
- lib/pennyworth/cli/actions/http_statuses.rb
|
149
|
+
- lib/pennyworth/cli/actions/ruby_gems.rb
|
150
|
+
- lib/pennyworth/cli/actions/system/errors.rb
|
151
|
+
- lib/pennyworth/cli/actions/system/signals.rb
|
152
|
+
- lib/pennyworth/cli/actions/text.rb
|
153
|
+
- lib/pennyworth/cli/configuration/content.rb
|
154
|
+
- lib/pennyworth/cli/configuration/defaults.yml
|
155
|
+
- lib/pennyworth/cli/configuration/loader.rb
|
156
|
+
- lib/pennyworth/cli/parsers.rb
|
157
|
+
- lib/pennyworth/cli/parsers/assembler.rb
|
158
|
+
- lib/pennyworth/cli/parsers/core.rb
|
159
|
+
- lib/pennyworth/cli/parsers/git_hub.rb
|
160
|
+
- lib/pennyworth/cli/parsers/ruby_gems.rb
|
161
|
+
- lib/pennyworth/cli/shell.rb
|
162
|
+
- lib/pennyworth/container.rb
|
90
163
|
- lib/pennyworth/identity.rb
|
91
|
-
- lib/pennyworth/
|
92
|
-
- lib/pennyworth/
|
93
|
-
- lib/pennyworth/
|
94
|
-
- lib/pennyworth/
|
95
|
-
- lib/pennyworth/
|
96
|
-
- lib/pennyworth/
|
97
|
-
- lib/pennyworth/
|
98
|
-
- lib/pennyworth/
|
99
|
-
- lib/pennyworth/
|
100
|
-
- lib/pennyworth/
|
101
|
-
- lib/pennyworth/
|
164
|
+
- lib/pennyworth/inflector.rb
|
165
|
+
- lib/pennyworth/integrations/git_hub/client.rb
|
166
|
+
- lib/pennyworth/integrations/git_hub/response.rb
|
167
|
+
- lib/pennyworth/integrations/ruby_gems/client.rb
|
168
|
+
- lib/pennyworth/loaders/encodings.rb
|
169
|
+
- lib/pennyworth/loaders/http_statuses.rb
|
170
|
+
- lib/pennyworth/loaders/projects.rb
|
171
|
+
- lib/pennyworth/loaders/system/errors.rb
|
172
|
+
- lib/pennyworth/loaders/system/signals.rb
|
173
|
+
- lib/pennyworth/loaders/text.rb
|
174
|
+
- lib/pennyworth/models/encoding.rb
|
175
|
+
- lib/pennyworth/models/http_status.rb
|
176
|
+
- lib/pennyworth/models/system/error.rb
|
177
|
+
- lib/pennyworth/models/system/signal.rb
|
178
|
+
- lib/pennyworth/models/text.rb
|
179
|
+
- lib/pennyworth/presenters/encoding.rb
|
180
|
+
- lib/pennyworth/presenters/gem.rb
|
181
|
+
- lib/pennyworth/presenters/http_status.rb
|
182
|
+
- lib/pennyworth/presenters/repository.rb
|
183
|
+
- lib/pennyworth/presenters/system/error.rb
|
184
|
+
- lib/pennyworth/presenters/system/signal.rb
|
185
|
+
- lib/pennyworth/presenters/text.rb
|
186
|
+
- lib/pennyworth/processor.rb
|
187
|
+
- lib/pennyworth/serializers/encoding.rb
|
188
|
+
- lib/pennyworth/serializers/http_status.rb
|
189
|
+
- lib/pennyworth/serializers/project.rb
|
190
|
+
- lib/pennyworth/serializers/system/error.rb
|
191
|
+
- lib/pennyworth/serializers/system/signal.rb
|
192
|
+
- lib/pennyworth/serializers/text.rb
|
102
193
|
homepage: https://www.alchemists.io/projects/pennyworth
|
103
194
|
licenses:
|
104
195
|
- Apache-2.0
|
@@ -122,8 +213,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
213
|
- !ruby/object:Gem::Version
|
123
214
|
version: '0'
|
124
215
|
requirements: []
|
125
|
-
rubygems_version: 3.2.
|
216
|
+
rubygems_version: 3.2.24
|
126
217
|
signing_key:
|
127
218
|
specification_version: 4
|
128
|
-
summary: A command line interface that
|
219
|
+
summary: A command line interface that augments Alfred workflows.
|
129
220
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|
data/lib/pennyworth/cli.rb
DELETED
@@ -1,140 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "thor"
|
4
|
-
require "thor/actions"
|
5
|
-
require "refinements/strings"
|
6
|
-
require "runcom"
|
7
|
-
|
8
|
-
module Pennyworth
|
9
|
-
# The Command Line Interface (CLI) for the gem.
|
10
|
-
# rubocop:disable Metrics/ClassLength
|
11
|
-
class CLI < Thor
|
12
|
-
include Thor::Actions
|
13
|
-
using Refinements::Strings
|
14
|
-
|
15
|
-
package_name Identity::VERSION_LABEL
|
16
|
-
|
17
|
-
def self.source_root
|
18
|
-
File.expand_path File.join(File.dirname(__FILE__), "templates")
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.configuration
|
22
|
-
Runcom::Config.new "#{Identity::NAME}/configuration.yml"
|
23
|
-
end
|
24
|
-
|
25
|
-
def initialize args = [], options = {}, config = {}
|
26
|
-
super args, options, config
|
27
|
-
end
|
28
|
-
|
29
|
-
desc "-s, [--string=VALUE]", "Manipulate strings."
|
30
|
-
map %w[-s --string] => :string
|
31
|
-
method_option :downcase,
|
32
|
-
aliases: "-d",
|
33
|
-
desc: "Downcase string.",
|
34
|
-
type: :boolean,
|
35
|
-
default: false
|
36
|
-
method_option :upcase,
|
37
|
-
aliases: "-u",
|
38
|
-
desc: "Upcase string.",
|
39
|
-
type: :boolean,
|
40
|
-
default: false
|
41
|
-
method_option :titleize,
|
42
|
-
aliases: "-t",
|
43
|
-
desc: "Capitalize each word and delimit with space or forward slash.",
|
44
|
-
type: :boolean,
|
45
|
-
default: false
|
46
|
-
method_option :camelcase,
|
47
|
-
aliases: "-c",
|
48
|
-
desc: "Capitalize each word and delimit with nothing or double colon.",
|
49
|
-
type: :boolean,
|
50
|
-
default: false
|
51
|
-
method_option :snakecase,
|
52
|
-
aliases: "-s",
|
53
|
-
desc: "Downcase each word and delimit with underscore or forward slash.",
|
54
|
-
type: :boolean,
|
55
|
-
default: false
|
56
|
-
method_option :size,
|
57
|
-
aliases: "-s",
|
58
|
-
desc: "Calculate string size.",
|
59
|
-
type: :boolean,
|
60
|
-
default: false
|
61
|
-
def string value
|
62
|
-
if options.downcase? then say value.downcase
|
63
|
-
elsif options.upcase? then say value.upcase
|
64
|
-
elsif options.titleize? then say value.titleize
|
65
|
-
elsif options.camelcase? then say value.camelcase
|
66
|
-
elsif options.snakecase? then say value.snakecase
|
67
|
-
elsif options.size? then say value.size
|
68
|
-
else say "Type 'pennyworth help string' for usage."
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
desc "-i, [--install]", "Install Alfred Workflows."
|
73
|
-
map %w[-i --install] => :install
|
74
|
-
def install
|
75
|
-
say
|
76
|
-
|
77
|
-
alfred_settings_root = self.class.configuration.to_h[:alfred_settings_root]
|
78
|
-
|
79
|
-
if valid_file? alfred_settings_root, "Invalid directory for Alfred settings root"
|
80
|
-
if yes? "Installing Alfred Workflows will destroy exiting, identical, workflows. " \
|
81
|
-
"Continue (y/n)?"
|
82
|
-
|
83
|
-
say_status :info, "Installing Alfred Workflows...", :green
|
84
|
-
|
85
|
-
workflows = Dir.glob File.join(self.class.source_root, "workflows", "**")
|
86
|
-
alfred_workflows_root = File.join alfred_settings_root, "workflows"
|
87
|
-
workflows.each do |workflow|
|
88
|
-
name = File.basename workflow
|
89
|
-
destination = File.join alfred_workflows_root, name
|
90
|
-
remove_file destination
|
91
|
-
directory File.join("workflows", name), destination
|
92
|
-
end
|
93
|
-
|
94
|
-
say_status :info, "Alfred Workflows installed.", :green
|
95
|
-
else
|
96
|
-
say_status :info, "Alfred Workflows installation cancelled.", :green
|
97
|
-
end
|
98
|
-
else
|
99
|
-
say_status :error, "Invalid Alfred settings directory: #{alfred_settings_root}", :red
|
100
|
-
end
|
101
|
-
|
102
|
-
say
|
103
|
-
end
|
104
|
-
|
105
|
-
desc "-c, [--config]", "Manage gem configuration."
|
106
|
-
map %w[-c --config] => :config
|
107
|
-
method_option :edit,
|
108
|
-
aliases: "-e",
|
109
|
-
desc: "Edit gem configuration.",
|
110
|
-
type: :boolean,
|
111
|
-
default: false
|
112
|
-
method_option :info,
|
113
|
-
aliases: "-i",
|
114
|
-
desc: "Print gem configuration.",
|
115
|
-
type: :boolean,
|
116
|
-
default: false
|
117
|
-
def config
|
118
|
-
path = self.class.configuration.current
|
119
|
-
|
120
|
-
if options.edit? then `#{ENV["EDITOR"]} #{path}`
|
121
|
-
elsif options.info?
|
122
|
-
path ? say(path) : say("Configuration doesn't exist.")
|
123
|
-
else help :config
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
desc "-v, [--version]", "Show gem version."
|
128
|
-
map %w[-v --version] => :version
|
129
|
-
def version
|
130
|
-
say Identity::VERSION_LABEL
|
131
|
-
end
|
132
|
-
|
133
|
-
desc "-h, [--help=COMMAND]", "Show this message or get help for a command."
|
134
|
-
map %w[-h --help] => :help
|
135
|
-
def help task = nil
|
136
|
-
say and super
|
137
|
-
end
|
138
|
-
end
|
139
|
-
# rubocop:enable Metrics/ClassLength
|
140
|
-
end
|