simple_xdg 0.1.1 → 0.1.2
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
- data/CHANGELOG.md +5 -0
- data/README.md +1 -1
- data/lib/simple_xdg/version.rb +1 -1
- data/lib/simple_xdg.rb +21 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e2033b305c79ff95d468ed8eb2bcb9fea640344031638af19ccebd28abb5c019
|
|
4
|
+
data.tar.gz: 126def79f3db5000139895fbd0af923e68eef454467915d1429981197cd8850d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3870bf9165d96291219e509fa3e190567d1c7108054985e62738927a7ae5fea33fd16c06237afe4491406fa9c16bd59a156067eeb3c71ade5b09e690691db2e6
|
|
7
|
+
data.tar.gz: 995dced0b643b937a71d7d8471f98cfed5548582cf41e6fc24347351c188c80ce3505319c4b83bce3cc8e09c50283476ea859f02b0fa4659a0c7964782a76ed9
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Release History
|
|
2
2
|
|
|
3
|
+
### v0.1.2 / 2026-10-05
|
|
4
|
+
|
|
5
|
+
* FIXED: Prevent an exception in home_dir in the rare case that Ruby is unable to determine the home dir
|
|
6
|
+
* DOCS: Fixed typo in the readme
|
|
7
|
+
|
|
3
8
|
### v0.1.1 / 2026-05-04
|
|
4
9
|
|
|
5
10
|
* DOCS: Fixed reference documentation generation
|
data/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# SimpleXDG
|
|
2
2
|
|
|
3
3
|
`SimpleXDG` is a no-frills Ruby class implementing the XDG Base Directory
|
|
4
|
-
Specification. This
|
|
4
|
+
Specification. This spec defines where certain user-specific application
|
|
5
5
|
files, such as configuration, cache, and saved state, should live on the user's
|
|
6
6
|
file system. It specifies environment variables that contain this information,
|
|
7
7
|
and defaults that should be used if those environment variables are unset. The
|
data/lib/simple_xdg/version.rb
CHANGED
data/lib/simple_xdg.rb
CHANGED
|
@@ -57,10 +57,16 @@ class SimpleXDG
|
|
|
57
57
|
##
|
|
58
58
|
# Returns the absolute path to the current user's home directory.
|
|
59
59
|
#
|
|
60
|
+
# Uses the value of the `$HOME` environment variable if it is an absolute
|
|
61
|
+
# path, otherwise falls back to the system's notion of the home directory.
|
|
62
|
+
# If no home directory can be determined (for example, when `$HOME` is
|
|
63
|
+
# unset and the current user has no passwd entry, as can happen in a
|
|
64
|
+
# container run under an arbitrary UID), returns the filesystem root `"/"`.
|
|
65
|
+
#
|
|
60
66
|
# @return [String]
|
|
61
67
|
#
|
|
62
68
|
def home_dir
|
|
63
|
-
@home_dir ||= validate_dir_env("HOME") ||
|
|
69
|
+
@home_dir ||= validate_dir_env("HOME") || safe_home_dir
|
|
64
70
|
end
|
|
65
71
|
|
|
66
72
|
##
|
|
@@ -362,6 +368,20 @@ class SimpleXDG
|
|
|
362
368
|
::File.absolute_path?(path) ? path : nil
|
|
363
369
|
end
|
|
364
370
|
|
|
371
|
+
##
|
|
372
|
+
# Get `Dir.home` with a fallback for the rare case where it raises due to
|
|
373
|
+
# there not being a home directory. The error case can be triggered, for
|
|
374
|
+
# example, by running a container under a UID with no passwd entry, where
|
|
375
|
+
# `$HOME` is explicitly unset. Also falls back if `Dir.home` returns a
|
|
376
|
+
# non-absolute path, which can happen if `$HOME` is empty or relative.
|
|
377
|
+
#
|
|
378
|
+
def safe_home_dir
|
|
379
|
+
home = ::Dir.home
|
|
380
|
+
::File.absolute_path?(home) ? home : "/"
|
|
381
|
+
rescue ::ArgumentError
|
|
382
|
+
"/"
|
|
383
|
+
end
|
|
384
|
+
|
|
365
385
|
##
|
|
366
386
|
# Given an environment variable name, returns nil if unset or empty,
|
|
367
387
|
# otherwise returns a (possibly empty) array of the valid paths.
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: simple_xdg
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel Azuma
|
|
@@ -45,8 +45,8 @@ licenses:
|
|
|
45
45
|
- MIT
|
|
46
46
|
metadata:
|
|
47
47
|
bug_tracker_uri: https://github.com/dazuma/simple_xdg/issues
|
|
48
|
-
changelog_uri: https://rubydoc.info/gems/simple_xdg/0.1.
|
|
49
|
-
documentation_uri: https://rubydoc.info/gems/simple_xdg/0.1.
|
|
48
|
+
changelog_uri: https://rubydoc.info/gems/simple_xdg/0.1.2/file/CHANGELOG.md
|
|
49
|
+
documentation_uri: https://rubydoc.info/gems/simple_xdg/0.1.2
|
|
50
50
|
homepage_uri: https://github.com/dazuma/simple_xdg
|
|
51
51
|
rdoc_options: []
|
|
52
52
|
require_paths:
|
|
@@ -62,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
62
62
|
- !ruby/object:Gem::Version
|
|
63
63
|
version: '0'
|
|
64
64
|
requirements: []
|
|
65
|
-
rubygems_version: 4.0.
|
|
65
|
+
rubygems_version: 4.0.20
|
|
66
66
|
specification_version: 4
|
|
67
67
|
summary: A simple implementation of the XDG Base Directory Specification.
|
|
68
68
|
test_files: []
|