xdg 5.1.0 → 5.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.adoc +7 -5
- data/lib/xdg/environment.rb +6 -18
- data/lib/xdg/identity.rb +2 -2
- data/lib/xdg/pair.rb +4 -12
- data/lib/xdg/paths/combined.rb +4 -12
- data/lib/xdg/paths/directory.rb +5 -15
- data/lib/xdg/paths/home.rb +5 -15
- data.tar.gz.sig +0 -0
- metadata +13 -13
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a57cc9c66035a391d56faa8f30752bcbebb7f05336f4a5c31a25443eff825c4c
|
4
|
+
data.tar.gz: 053bbcefe4bafaddeab073dc8cca00095b01f886df219cf2c8a3883288392046
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd06c616421025550d5323277af642cb3a60374376fdd7f8822aa672fe7860134fda507587a2b00e876ed38dd9e7f8e975d612934b5563bd36ffa7a131e7702f
|
7
|
+
data.tar.gz: 2cd8988089936c2c7c47c8a2941d40a0fe7015201ade29c2d9ffc0430558f289c2765811a26346b185815dbd8b48ba441b07cdb77bedefa8ff3eebed05c1fa7d
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/README.adoc
CHANGED
@@ -13,10 +13,12 @@ image::https://circleci.com/gh/bkuhlmann/xdg.svg?style=svg[Circle CI Status]
|
|
13
13
|
|
14
14
|
Provides a Ruby implementation of the
|
15
15
|
https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html[XDG Base Directory
|
16
|
-
Specification].
|
16
|
+
Specification] for managing common configurations without polluting your dotfiles. XDG is great for
|
17
|
+
command line interfaces or any application that needs a common configuration, cache, data, or
|
18
|
+
runtime.
|
17
19
|
|
18
|
-
💡 If you write a lot of Command Line Interfaces and would like additional syntactic sugar
|
19
|
-
includes what is found in this gem, make sure to check out the
|
20
|
+
💡 If you write a lot of Command Line Interfaces and would like additional/advanced syntactic sugar
|
21
|
+
that includes what is found in this gem, make sure to check out the
|
20
22
|
link:https://www.alchemists.io/projects/runcom[Runcom] gem too.
|
21
23
|
|
22
24
|
toc::[]
|
@@ -210,7 +212,7 @@ defined first.
|
|
210
212
|
|
211
213
|
==== `$XDG_*_HOME`
|
212
214
|
|
213
|
-
These variables take
|
215
|
+
These variables take precedence over the corresponding `$XDG_*_DIRS` environment variables. Using
|
214
216
|
a modified version of the `$XDG_*_DIRS` example, shown above, we could have the following setup:
|
215
217
|
|
216
218
|
[source,bash]
|
@@ -230,7 +232,7 @@ Yields the following, colon delimited, array:
|
|
230
232
|
]
|
231
233
|
----
|
232
234
|
|
233
|
-
Due to `XDG_CONFIG_HOME` taking
|
235
|
+
Due to `XDG_CONFIG_HOME` taking precedence over the `XDG_CONFIG_DIRS`, the path with the
|
234
236
|
_highest_ priority in this example is: `"/example/priority"`.
|
235
237
|
|
236
238
|
=== Variable Priority
|
data/lib/xdg/environment.rb
CHANGED
@@ -8,29 +8,17 @@ module XDG
|
|
8
8
|
@data = Data.new home: home, directories: directories, environment: environment
|
9
9
|
end
|
10
10
|
|
11
|
-
def cache_home
|
12
|
-
cache.home
|
13
|
-
end
|
11
|
+
def cache_home = cache.home
|
14
12
|
|
15
|
-
def config_home
|
16
|
-
config.home
|
17
|
-
end
|
13
|
+
def config_home = config.home
|
18
14
|
|
19
|
-
def config_dirs
|
20
|
-
config.directories
|
21
|
-
end
|
15
|
+
def config_dirs = config.directories
|
22
16
|
|
23
|
-
def data_home
|
24
|
-
data.home
|
25
|
-
end
|
17
|
+
def data_home = data.home
|
26
18
|
|
27
|
-
def data_dirs
|
28
|
-
data.directories
|
29
|
-
end
|
19
|
+
def data_dirs = data.directories
|
30
20
|
|
31
|
-
def inspect
|
32
|
-
"#{cache.inspect} #{config.inspect} #{data.inspect}"
|
33
|
-
end
|
21
|
+
def inspect = "#{cache.inspect} #{config.inspect} #{data.inspect}"
|
34
22
|
|
35
23
|
private
|
36
24
|
|
data/lib/xdg/identity.rb
CHANGED
data/lib/xdg/pair.rb
CHANGED
@@ -5,21 +5,13 @@ module XDG
|
|
5
5
|
|
6
6
|
# A generic key-value pair (KVP).
|
7
7
|
Pair = Struct.new :key, :value do
|
8
|
-
def to_env
|
9
|
-
Hash[*values]
|
10
|
-
end
|
8
|
+
def to_env = Hash[*values]
|
11
9
|
|
12
|
-
def key?
|
13
|
-
key.to_s.size.positive?
|
14
|
-
end
|
10
|
+
def key? = key.to_s.size.positive?
|
15
11
|
|
16
|
-
def value?
|
17
|
-
value.to_s.size.positive?
|
18
|
-
end
|
12
|
+
def value? = value.to_s.size.positive?
|
19
13
|
|
20
|
-
def empty?
|
21
|
-
!(key? && value?)
|
22
|
-
end
|
14
|
+
def empty? = !(key? && value?)
|
23
15
|
|
24
16
|
def inspect
|
25
17
|
return "" unless key? || value?
|
data/lib/xdg/paths/combined.rb
CHANGED
@@ -11,21 +11,13 @@ module XDG
|
|
11
11
|
@initial_directories = initial_directories
|
12
12
|
end
|
13
13
|
|
14
|
-
def home
|
15
|
-
initial_home.dynamic
|
16
|
-
end
|
14
|
+
def home = initial_home.dynamic
|
17
15
|
|
18
|
-
def directories
|
19
|
-
initial_directories.dynamic
|
20
|
-
end
|
16
|
+
def directories = initial_directories.dynamic
|
21
17
|
|
22
|
-
def all
|
23
|
-
directories.prepend home
|
24
|
-
end
|
18
|
+
def all = directories.prepend(home)
|
25
19
|
|
26
|
-
def inspect
|
27
|
-
[initial_home.inspect, initial_directories.inspect].reject(&:empty?).join " "
|
28
|
-
end
|
20
|
+
def inspect = [initial_home.inspect, initial_directories.inspect].reject(&:empty?).join(" ")
|
29
21
|
|
30
22
|
private
|
31
23
|
|
data/lib/xdg/paths/directory.rb
CHANGED
@@ -13,9 +13,7 @@ module XDG
|
|
13
13
|
@environment = environment
|
14
14
|
end
|
15
15
|
|
16
|
-
def default
|
17
|
-
value.split(DELIMITER).map { |path| expand path }
|
18
|
-
end
|
16
|
+
def default = value.split(DELIMITER).map { |path| expand path }
|
19
17
|
|
20
18
|
def dynamic
|
21
19
|
String(environment[key]).then { |env_value| env_value.empty? ? value : env_value }
|
@@ -24,25 +22,17 @@ module XDG
|
|
24
22
|
.map { |path| expand path }
|
25
23
|
end
|
26
24
|
|
27
|
-
def inspect
|
28
|
-
[key, dynamic.join(DELIMITER)].reject(&:empty?).join XDG::PAIR_DELIMITER
|
29
|
-
end
|
25
|
+
def inspect = [key, dynamic.join(DELIMITER)].reject(&:empty?).join(XDG::PAIR_DELIMITER)
|
30
26
|
|
31
27
|
private
|
32
28
|
|
33
29
|
attr_reader :pair, :environment
|
34
30
|
|
35
|
-
def key
|
36
|
-
String pair.key
|
37
|
-
end
|
31
|
+
def key = String(pair.key)
|
38
32
|
|
39
|
-
def value
|
40
|
-
String pair.value
|
41
|
-
end
|
33
|
+
def value = String(pair.value)
|
42
34
|
|
43
|
-
def expand path
|
44
|
-
Pathname(path).expand_path
|
45
|
-
end
|
35
|
+
def expand(path) = Pathname(path).expand_path
|
46
36
|
end
|
47
37
|
end
|
48
38
|
end
|
data/lib/xdg/paths/home.rb
CHANGED
@@ -18,29 +18,19 @@ module XDG
|
|
18
18
|
@environment = environment
|
19
19
|
end
|
20
20
|
|
21
|
-
def default
|
22
|
-
expand String(value)
|
23
|
-
end
|
21
|
+
def default = expand(String(value))
|
24
22
|
|
25
|
-
def dynamic
|
26
|
-
String(environment[key]).then { |path| path.empty? ? default : expand(path) }
|
27
|
-
end
|
23
|
+
def dynamic = String(environment[key]).then { |path| path.empty? ? default : expand(path) }
|
28
24
|
|
29
|
-
def inspect
|
30
|
-
[pair.key, dynamic].compact.join XDG::PAIR_DELIMITER
|
31
|
-
end
|
25
|
+
def inspect = [pair.key, dynamic].compact.join(XDG::PAIR_DELIMITER)
|
32
26
|
|
33
27
|
private
|
34
28
|
|
35
29
|
attr_reader :pair, :environment
|
36
30
|
|
37
|
-
def expand path
|
38
|
-
home.join(path).expand_path
|
39
|
-
end
|
31
|
+
def expand(path) = home.join(path).expand_path
|
40
32
|
|
41
|
-
def home
|
42
|
-
Pathname environment.fetch(KEY)
|
43
|
-
end
|
33
|
+
def home = Pathname(environment.fetch(KEY))
|
44
34
|
end
|
45
35
|
end
|
46
36
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xdg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -10,9 +10,9 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
MIIC/
|
14
|
-
|
15
|
-
|
13
|
+
MIIC/jCCAeagAwIBAgIBBDANBgkqhkiG9w0BAQsFADAlMSMwIQYDVQQDDBpicm9v
|
14
|
+
a2UvREM9YWxjaGVtaXN0cy9EQz1pbzAeFw0yMTAzMTkxMjQ4MDZaFw0yMjAzMTkx
|
15
|
+
MjQ4MDZaMCUxIzAhBgNVBAMMGmJyb29rZS9EQz1hbGNoZW1pc3RzL0RDPWlvMIIB
|
16
16
|
IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6l1qpXTiomH1RfMRloyw7MiE
|
17
17
|
xyVx/x8Yc3EupdH7uhNaTXQGyORN6aOY//1QXXMHIZ9tW74nZLhesWMSUMYy0XhB
|
18
18
|
brs+KkurHnc9FnEJAbG7ebGvl/ncqZt72nQvaxpDxvuCBHgJAz+8i5wl6FhLw+oT
|
@@ -20,15 +20,15 @@ cert_chain:
|
|
20
20
|
D5vkU0YlAm1r98BymuJlcQ1qdkVEI1d48ph4kcS0S0nv1RiuyVb6TCAR3Nu3VaVq
|
21
21
|
3fPzZKJLZBx67UvXdbdicWPiUR75elI4PXpLIic3xytaF52ZJYyKZCNZJhNwfQID
|
22
22
|
AQABozkwNzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU0nzow9vc
|
23
|
-
2CdikiiE3fJhP/
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
23
|
+
2CdikiiE3fJhP/gY4ggwDQYJKoZIhvcNAQELBQADggEBAEjpaOXHHp8s/7GL2qCb
|
24
|
+
YAs7urOLv9VHSPfQWAwaTMVnSsIf3Sw4xzISOP/mmfEPBPXtz61K5esrE/uTFtgb
|
25
|
+
FyjxQk2H0sEWgrRXGGNHBWQRhhEs7LP/TByoC15A0br++xLxRz4r7HBLGAWQQDpg
|
26
|
+
66BJ2TBVjxS6K64tKbq7+ACyrOZGgTfNHACh4M076y0x0oRf/rwBrU39/KRfuhbb
|
27
|
+
cm+nNCEtO35gTmZ2bVDHLGvWazi3gJt6+huQjfXTCUUG2YYBxwhu+GPdAGQPxpf9
|
28
|
+
lkHilIrX69jq8wMPpBhlaw2mRmeSL50Wv5u6xVBvOHhXFSP1crXM95vfLhLyRYod
|
29
|
+
W2A=
|
30
30
|
-----END CERTIFICATE-----
|
31
|
-
date: 2021-
|
31
|
+
date: 2021-10-09 00:00:00.000000000 Z
|
32
32
|
dependencies: []
|
33
33
|
description:
|
34
34
|
email:
|
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
requirements: []
|
77
|
-
rubygems_version: 3.2.
|
77
|
+
rubygems_version: 3.2.28
|
78
78
|
signing_key:
|
79
79
|
specification_version: 4
|
80
80
|
summary: Provides an implementation of the XDG Base Directory Specification.
|
metadata.gz.sig
CHANGED
Binary file
|