xdg 2.2.5 → 3.0.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.tar.gz.sig +0 -0
- data/LICENSE.md +163 -0
- data/README.md +172 -89
- data/lib/xdg.rb +10 -44
- data/lib/xdg/cache.rb +22 -0
- data/lib/xdg/config.rb +23 -0
- data/lib/xdg/data.rb +23 -0
- data/lib/xdg/environment.rb +35 -0
- data/lib/xdg/identity.rb +22 -0
- data/lib/xdg/pair.rb +10 -0
- data/lib/xdg/paths/combined.rb +31 -0
- data/lib/xdg/paths/directory.rb +37 -0
- data/lib/xdg/paths/standard.rb +42 -0
- metadata +205 -39
- metadata.gz.sig +0 -0
- data/.index +0 -54
- data/.yardopts +0 -7
- data/DEMO.md +0 -144
- data/HISTORY.md +0 -148
- data/LICENSE.txt +0 -23
- data/demo/01_base_dir.md +0 -77
- data/demo/02_base_dir_extended.md +0 -47
- data/demo/03_base_dir_mixin.md +0 -17
- data/demo/applique/ae.rb +0 -2
- data/demo/applique/fakeroot.rb +0 -17
- data/demo/applique/xdg.rb +0 -1
- data/demo/fixtures/fakeroot/etc/xdg/bar.config +0 -1
- data/demo/fixtures/fakeroot/home/joe/foo.txt +0 -1
- data/demo/fixtures/fakeroot/usr/share/bar.dat +0 -1
- data/lib/xdg/base_dir.rb +0 -255
- data/lib/xdg/base_dir/extended.rb +0 -19
- data/lib/xdg/base_dir/global_variables.rb +0 -19
- data/lib/xdg/base_dir/legacy.rb +0 -74
- data/lib/xdg/base_dir/mixin.rb +0 -86
- data/lib/xdg/version.rb +0 -3
- data/test/fakeroot/etc/xdg/bar.config +0 -1
- data/test/fakeroot/usr/share/bar.dat +0 -1
- data/test/test_xdg_legacy.rb +0 -117
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9dd4bd211b8f542935dc160abaf263a15bc21db3f15e0f7b37939bc0e3f9a80
|
4
|
+
data.tar.gz: 84a2b790092dd687f031ccdc9631b5d1db0ec0f44847a14677b593274fbddfce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70594ce6e1448354f736104f4bbef83529342cbb12667089a0e36d7c9c12cb6780237134a48fdb6302b599ed553a14041a77a24dcbfe3c5fc7f0f0550bf54c97
|
7
|
+
data.tar.gz: 9adb7c577b93ab720a0928bca5dac158d95dcae3e14054cf86f3f013cd1bda38ae4d4852b62cdfbf7507dad5b1b64ccc827358d431dc95a8eacd4934442eaf90
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/LICENSE.md
ADDED
@@ -0,0 +1,163 @@
|
|
1
|
+
# Apache License
|
2
|
+
|
3
|
+
Version 2.0, January 2004
|
4
|
+
|
5
|
+
http://www.apache.org/licenses
|
6
|
+
|
7
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
8
|
+
|
9
|
+
## 1. Definitions
|
10
|
+
|
11
|
+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by
|
12
|
+
Sections 1 through 9 of this document.
|
13
|
+
|
14
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is
|
15
|
+
granting the License.
|
16
|
+
|
17
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are
|
18
|
+
controlled by, or are under common control with that entity. For the purposes of this definition,
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the direction or management of such
|
20
|
+
entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this
|
24
|
+
License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications, including but not limited to
|
27
|
+
software source code, documentation source, and configuration files.
|
28
|
+
|
29
|
+
"Object" form shall mean any form resulting from mechanical transformation or translation of a
|
30
|
+
Source form, including but not limited to compiled object code, generated documentation, and
|
31
|
+
conversions to other media types.
|
32
|
+
|
33
|
+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the
|
34
|
+
License, as indicated by a copyright notice that is included in or attached to the work (an example
|
35
|
+
is provided in the Appendix below).
|
36
|
+
|
37
|
+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or
|
38
|
+
derived from) the Work and for which the editorial revisions, annotations, elaborations, or other
|
39
|
+
modifications represent, as a whole, an original work of authorship. For the purposes of this
|
40
|
+
License, Derivative Works shall not include works that remain separable from, or merely link (or
|
41
|
+
bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
42
|
+
|
43
|
+
"Contribution" shall mean any work of authorship, including the original version of the Work and any
|
44
|
+
modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted
|
45
|
+
to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity
|
46
|
+
authorized to submit on behalf of the copyright owner. For the purposes of this definition,
|
47
|
+
"submitted" means any form of electronic, verbal, or written communication sent to the Licensor or
|
48
|
+
its representatives, including but not limited to communication on electronic mailing lists, source
|
49
|
+
code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor
|
50
|
+
for the purpose of discussing and improving the Work, but excluding communication that is
|
51
|
+
conspicuously marked or otherwise designated in writing by the copyright owner as "Not a
|
52
|
+
Contribution."
|
53
|
+
|
54
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a
|
55
|
+
Contribution has been received by Licensor and subsequently incorporated within the Work.
|
56
|
+
|
57
|
+
## 2. Grant of Copyright License
|
58
|
+
|
59
|
+
Subject to the terms and conditions of this License, each Contributor hereby grants to You a
|
60
|
+
perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to
|
61
|
+
reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and
|
62
|
+
distribute the Work and such Derivative Works in Source or Object form.
|
63
|
+
|
64
|
+
## 3. Grant of Patent License
|
65
|
+
|
66
|
+
Subject to the terms and conditions of this License, each Contributor hereby grants to You a
|
67
|
+
perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this
|
68
|
+
section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer
|
69
|
+
the Work, where such license applies only to those patent claims licensable by such Contributor that
|
70
|
+
are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s)
|
71
|
+
with the Work to which such Contribution(s) was submitted. If You institute patent litigation
|
72
|
+
against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or
|
73
|
+
a Contribution incorporated within the Work constitutes direct or contributory patent infringement,
|
74
|
+
then any patent licenses granted to You under this License for that Work shall terminate as of the
|
75
|
+
date such litigation is filed.
|
76
|
+
|
77
|
+
## 4. Redistribution
|
78
|
+
|
79
|
+
You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with
|
80
|
+
or without modifications, and in Source or Object form, provided that You meet the following
|
81
|
+
conditions:
|
82
|
+
|
83
|
+
1. You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
84
|
+
|
85
|
+
2. You must cause any modified files to carry prominent notices stating that You changed the
|
86
|
+
files; and
|
87
|
+
|
88
|
+
3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright,
|
89
|
+
patent, trademark, and attribution notices from the Source form of the Work, excluding those
|
90
|
+
notices that do not pertain to any part of the Derivative Works; and
|
91
|
+
|
92
|
+
4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative
|
93
|
+
Works that You distribute must include a readable copy of the attribution notices contained
|
94
|
+
within such NOTICE file, excluding those notices that do not pertain to any part of the
|
95
|
+
Derivative Works, in at least one of the following places: within a NOTICE text file
|
96
|
+
distributed as part of the Derivative Works; within the Source form or documentation, if
|
97
|
+
provided along with the Derivative Works; or, within a display generated by the Derivative
|
98
|
+
Works, if and wherever such third-party notices normally appear. The contents of the NOTICE
|
99
|
+
file are for informational purposes only and do not modify the License. You may add Your own
|
100
|
+
attribution notices within Derivative Works that You distribute, alongside or as an addendum to
|
101
|
+
the NOTICE text from the Work, provided that such additional attribution notices cannot be
|
102
|
+
construed as modifying the License.
|
103
|
+
|
104
|
+
You may add Your own copyright statement to Your modifications and may provide additional or
|
105
|
+
different license terms and conditions for use, reproduction, or distribution of Your modifications,
|
106
|
+
or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of
|
107
|
+
the Work otherwise complies with the conditions stated in this License.
|
108
|
+
|
109
|
+
## 5. Submission of Contributions
|
110
|
+
|
111
|
+
Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the
|
112
|
+
Work by You to the Licensor shall be under the terms and conditions of this License, without any
|
113
|
+
additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify
|
114
|
+
the terms of any separate license agreement you may have executed with Licensor regarding such
|
115
|
+
Contributions.
|
116
|
+
|
117
|
+
## 6. Trademarks
|
118
|
+
|
119
|
+
This License does not grant permission to use the trade names, trademarks, service marks, or product
|
120
|
+
names of the Licensor, except as required for reasonable and customary use in describing the origin
|
121
|
+
of the Work and reproducing the content of the NOTICE file.
|
122
|
+
|
123
|
+
## 7. Disclaimer of Warranty
|
124
|
+
|
125
|
+
Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each
|
126
|
+
Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
127
|
+
KIND, either express or implied, including, without limitation, any warranties or conditions of
|
128
|
+
TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely
|
129
|
+
responsible for determining the appropriateness of using or redistributing the Work and assume any
|
130
|
+
risks associated with Your exercise of permissions under this License.
|
131
|
+
|
132
|
+
## 8. Limitation of Liability
|
133
|
+
|
134
|
+
In no event and under no legal theory, whether in tort (including negligence), contract, or
|
135
|
+
otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or
|
136
|
+
agreed to in writing, shall any Contributor be liable to You for damages, including any direct,
|
137
|
+
indirect, special, incidental, or consequential damages of any character arising as a result of this
|
138
|
+
License or out of the use or inability to use the Work (including but not limited to damages for
|
139
|
+
loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial
|
140
|
+
damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
141
|
+
|
142
|
+
## 9. Accepting Warranty or Additional Liability
|
143
|
+
|
144
|
+
While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee
|
145
|
+
for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights
|
146
|
+
consistent with this License. However, in accepting such obligations, You may act only on Your own
|
147
|
+
behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You
|
148
|
+
agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or
|
149
|
+
claims asserted against, such Contributor by reason of your accepting any such warranty or
|
150
|
+
additional liability.
|
151
|
+
|
152
|
+
END OF TERMS AND CONDITIONS
|
153
|
+
|
154
|
+
Copyright 2019 [Alchemists](https://www.alchemists.io).
|
155
|
+
|
156
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
|
157
|
+
compliance with the License. You may obtain a [copy](http://www.apache.org/licenses/LICENSE-2.0) of
|
158
|
+
the License.
|
159
|
+
|
160
|
+
Unless required by applicable law or agreed to in writing, software distributed under the License is
|
161
|
+
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
162
|
+
implied. See the License for the specific language governing permissions and limitations under the
|
163
|
+
License.
|
data/README.md
CHANGED
@@ -1,146 +1,229 @@
|
|
1
|
-
|
1
|
+
<p align="center">
|
2
|
+
<img src="xdg.png" alt="XDG Icon"/>
|
3
|
+
</p>
|
2
4
|
|
3
|
-
|
4
|
-
[Source Code](http://github.com/rubyworks/xdg) |
|
5
|
-
[Report Issue](http://github.com/rubyworks/xdg/issues) |
|
6
|
-
[Mailing List](http://googlegroups.com/group.rubyworks-mailinglist) |
|
7
|
-
[Chat Room](irc://irc.freenode.net/rubyworks)
|
5
|
+
# XDG
|
8
6
|
|
9
|
-
[![
|
7
|
+
[![Gem Version](https://badge.fury.io/rb/xdg.svg)](http://badge.fury.io/rb/xdg)
|
8
|
+
[![Code Climate Maintainability](https://api.codeclimate.com/v1/badges/73c8f06ae65cbe663e1c/maintainability)](https://codeclimate.com/github/bkuhlmann/xdg/maintainability)
|
9
|
+
[![Code Climate Test Coverage](https://api.codeclimate.com/v1/badges/73c8f06ae65cbe663e1c/test_coverage)](https://codeclimate.com/github/bkuhlmann/xdg/test_coverage)
|
10
|
+
[![Circle CI Status](https://circleci.com/gh/bkuhlmann/xdg.svg?style=svg)](https://circleci.com/gh/bkuhlmann/xdg)
|
10
11
|
|
12
|
+
Provides a Ruby implementation of the [XDG Base Directory
|
13
|
+
Specification](https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html).
|
11
14
|
|
12
|
-
|
15
|
+
:bulb: If you write a lot of Command Line Interfaces and would like additional syntactic
|
16
|
+
sugar that includes what is found in this gem, make sure to check out the
|
17
|
+
[Runcom](https://github.com/bkuhlmann/runcom) gem too.
|
13
18
|
|
14
|
-
|
19
|
+
<!-- Tocer[start]: Auto-generated, don't remove. -->
|
15
20
|
|
16
|
-
|
21
|
+
## Table of Contents
|
17
22
|
|
18
|
-
|
19
|
-
(
|
20
|
-
|
23
|
+
- [Features](#features)
|
24
|
+
- [Requirements](#requirements)
|
25
|
+
- [Setup](#setup)
|
26
|
+
- [Usage](#usage)
|
27
|
+
- [Overview](#overview)
|
28
|
+
- [Variable Defaults](#variable-defaults)
|
29
|
+
- [Variable Behavior](#variable-behavior)
|
30
|
+
- [`$XDG_*_DIRS`](#xdg__dirs)
|
31
|
+
- [`$XDG_*_HOME`](#xdg__home)
|
32
|
+
- [Variable Priority](#variable-priority)
|
33
|
+
- [Tests](#tests)
|
34
|
+
- [Versioning](#versioning)
|
35
|
+
- [Code of Conduct](#code-of-conduct)
|
36
|
+
- [Contributions](#contributions)
|
37
|
+
- [License](#license)
|
38
|
+
- [History](#history)
|
39
|
+
- [Credits](#credits)
|
40
|
+
|
41
|
+
<!-- Tocer[finish]: Auto-generated, don't remove. -->
|
42
|
+
|
43
|
+
## Features
|
44
|
+
|
45
|
+
- Provides a `XDG::Environment` object that adheres to the *XDG Base Directory Specification* with
|
46
|
+
access to the following environment settings:
|
47
|
+
- `$XDG_CACHE_HOME`
|
48
|
+
- `$XDG_CONFIG_HOME`
|
49
|
+
- `$XDG_CONFIG_DIRS`
|
50
|
+
- `$XDG_DATA_HOME`
|
51
|
+
- `$XDG_DATA_DIRS`
|
21
52
|
|
22
|
-
|
23
|
-
http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
53
|
+
## Requirements
|
24
54
|
|
55
|
+
1. [Ruby 2.6.3](https://www.ruby-lang.org)
|
25
56
|
|
26
|
-
##
|
57
|
+
## Setup
|
27
58
|
|
28
|
-
|
29
|
-
yet flexible interface, `XDG[]`. Let's say you want to work
|
30
|
-
with the $XDG_CONFIG_HOME directory. Simply use:
|
59
|
+
To install, run:
|
31
60
|
|
32
|
-
|
61
|
+
gem install xdg
|
33
62
|
|
34
|
-
|
35
|
-
into the user's personal configuration directory. Some examples:
|
63
|
+
Add the following to your Gemfile:
|
36
64
|
|
37
|
-
|
38
|
-
XDG['CONFIG_HOME'].select(pattern){ |path| ... }
|
39
|
-
XDG['CONFIG_HOME'].find(pattern){ |path| ... }
|
65
|
+
gem "xdg"
|
40
66
|
|
41
|
-
|
67
|
+
## Usage
|
42
68
|
|
43
|
-
|
44
|
-
XDG['DATA_DIRS']
|
69
|
+
The following describes how to use this XDG implementation.
|
45
70
|
|
46
|
-
|
47
|
-
XDG['CACHE_DIRS']
|
71
|
+
#### Overview
|
48
72
|
|
49
|
-
|
50
|
-
that ties into both the `HOME` and `DIRS` paths.
|
73
|
+
To get up and running quickly, use `XDG::Environment` as follows:
|
51
74
|
|
52
|
-
XDG
|
53
|
-
|
54
|
-
|
75
|
+
xdg = XDG::Environment.new
|
76
|
+
xdg.cache_home # <= Answers computed `$XDG_CACHE_HOME` value.
|
77
|
+
xdg.config_home # <= Answers computed `$XDG_CONFIG_HOME` value.
|
78
|
+
xdg.config_dirs # <= Answers computed `$XDG_CONFIG_DIRS` value.
|
79
|
+
xdg.data_home # <= Answers computed `$XDG_DATA_HOME` value.
|
80
|
+
xdg.data_dirs # <= Answers computed `$XDG_DATA_DIRS` value.
|
55
81
|
|
56
|
-
|
57
|
-
|
82
|
+
The *computed* value, in this case, is either the user-defined value of the key or the default
|
83
|
+
value, per specification, when the key is not defined or empty. For more on this, scroll down to the
|
84
|
+
*Variable Defaults* section to learn more.
|
58
85
|
|
59
|
-
|
86
|
+
The `XDG::Environment` wraps the following objects which can be used individually if you
|
87
|
+
don't want to load the entire environment:
|
60
88
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
of proposals being discussed for a possible future version of
|
65
|
-
the standard.
|
89
|
+
cache = XDG::Cache.new
|
90
|
+
config = XDG::Config.new
|
91
|
+
data = XDG::Data.new
|
66
92
|
|
67
|
-
|
68
|
-
|
93
|
+
The `cache`, `config`, and `data` objects share the same API which means you can ask each the
|
94
|
+
following messages:
|
69
95
|
|
70
|
-
|
71
|
-
|
96
|
+
- `#home` - Answers the home directory as computed via the `$XDG_*_HOME` key.
|
97
|
+
- `#directories` - Answers an array directories as computed via the `$XDG_*_DIRS` key.
|
98
|
+
- `#all` - Answers an array of *all* directories as computed from the combined `$XDG_*_HOME` and
|
99
|
+
`$XDG_*_DIRS` values (with `$XDG_*_HOME` prefixed at the start of the array).
|
72
100
|
|
73
|
-
|
101
|
+
#### Variable Defaults
|
74
102
|
|
75
|
-
XDG
|
76
|
-
|
103
|
+
The *XDG Base Directory Specification* defines environment variables and associated default values
|
104
|
+
when not defined or empty. The following defaults, per specification, are implemented by the
|
105
|
+
`XDG` objects:
|
77
106
|
|
78
|
-
|
79
|
-
|
107
|
+
- `$XDG_CACHE_HOME="$HOME/.cache"`
|
108
|
+
- `$XDG_CONFIG_HOME="$HOME/.config"`
|
109
|
+
- `$XDG_CONFIG_DIRS="/etc/xdg"`
|
110
|
+
- `$XDG_DATA_HOME="$HOME/.local/share"`
|
111
|
+
- `$XDG_DATA_DIRS="/usr/local/share/:/usr/share/"`
|
112
|
+
- `$XDG_RUNTIME_DIR`
|
80
113
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
end
|
114
|
+
The `$XDG_RUNTIME_DIR` deserves special mention as it's not, *currently*, implemented as part of
|
115
|
+
this gem because it is more user/environment specific. Here is how the `$XDG_RUNTIME_DIR` is meant
|
116
|
+
to be used should you choose to use it:
|
85
117
|
|
86
|
-
|
118
|
+
- *Must* reference user-specific non-essential runtime files and other file objects (such as
|
119
|
+
sockets, named pipes, etc.)
|
120
|
+
- *Must* be owned by the user with *only* the user having read and write access to it.
|
121
|
+
- *Must* have a Unix access mode of `0700`.
|
122
|
+
- *Must* be bound to the user when logging in.
|
123
|
+
- *Must* be removed when the user logs out.
|
124
|
+
- *Must* be pointed to the same directory when the user logs in more than once.
|
125
|
+
- *Must* exist from first login to last logout on the system and not removed in between.
|
126
|
+
- *Must* not allow files in the directory to survive reboot or a full logout/login cycle.
|
127
|
+
- *Must* keep the directory on the local file system and not shared with any other file systems.
|
128
|
+
- *Must* keep the directory fully-featured by the standards of the operating system. Specifically,
|
129
|
+
on Unix-like operating systems AF_UNIX sockets, symbolic links, hard links, proper permissions,
|
130
|
+
file locking, sparse files, memory mapping, file change notifications, a reliable hard link count
|
131
|
+
must be supported, and no restrictions on the file name character set should be imposed. Files in
|
132
|
+
this directory *may* be subjected to periodic clean-up. To ensure files are not removed,
|
133
|
+
they should have their access time timestamp modified at least once every 6 hours of monotonic
|
134
|
+
time or the 'sticky' bit should be set on the file.
|
135
|
+
- When not set, applications should fall back to a replacement directory with similar capabilities
|
136
|
+
and print a warning message. Applications should use this directory for communication and
|
137
|
+
synchronization purposes and should not place larger files in it, since it might reside in runtime
|
138
|
+
memory and cannot necessarily be swapped out to disk.
|
87
139
|
|
88
|
-
|
140
|
+
#### Variable Behavior
|
89
141
|
|
142
|
+
The behavior of most XDG environment variables can be lumped into two categories:
|
90
143
|
|
91
|
-
|
144
|
+
- `$XDG_*_HOME`
|
145
|
+
- `$XDG_*_DIRS`
|
92
146
|
|
93
|
-
|
94
|
-
"fluid" notation of previous releases. Where as one used to do:
|
147
|
+
Each is described in detail below.
|
95
148
|
|
96
|
-
|
149
|
+
##### `$XDG_*_DIRS`
|
97
150
|
|
98
|
-
|
151
|
+
These variables are used to define a colon (`:`) delimited list of directories. Order is important
|
152
|
+
as the first directory defined will take precedent over the following directory and so forth. For
|
153
|
+
example, here is a situation where the `XDG_CONFIG_DIRS` key has a custom value:
|
99
154
|
|
100
|
-
|
155
|
+
XDG_CONFIG_DIRS="/example/one/.config:/example/two/.settings:/example/three/.configuration"
|
101
156
|
|
102
|
-
|
103
|
-
|
157
|
+
# Yields the following, colon delimited, array:
|
158
|
+
[
|
159
|
+
"/example/one/.config",
|
160
|
+
"/example/two/.settings",
|
161
|
+
"/example/three/.configuration"
|
162
|
+
]
|
104
163
|
|
105
|
-
|
164
|
+
In the above example, the `"/example/one/.config"` path takes *highest* priority since it was
|
165
|
+
defined first.
|
106
166
|
|
107
|
-
|
108
|
-
need to load:
|
167
|
+
##### `$XDG_*_HOME`
|
109
168
|
|
110
|
-
|
169
|
+
These variables take precidence over the corresponding `$XDG_*_DIRS` environment variables. Using a
|
170
|
+
modified version of the `$XDG_*_DIRS` example, shown above, we could have the following setup:
|
111
171
|
|
112
|
-
|
113
|
-
|
114
|
-
the moment. Sometime in the future the legacy API will be deprecated.
|
172
|
+
XDG_CONFIG_HOME="/example/priority"
|
173
|
+
XDG_CONFIG_DIRS="/example/one/.config:/example/two/.settings"
|
115
174
|
|
175
|
+
# Yields the following, colon delimited, array:
|
176
|
+
[
|
177
|
+
"/example/priority",
|
178
|
+
"/example/one/.config",
|
179
|
+
"/example/two/.settings"
|
180
|
+
]
|
116
181
|
|
117
|
-
|
182
|
+
Due to `XDG_CONFIG_HOME` taking precidence over the `XDG_CONFIG_DIRS`, the path with the *highest*
|
183
|
+
priority in this example is: `"/example/priority"`.
|
118
184
|
|
119
|
-
|
185
|
+
#### Variable Priority
|
120
186
|
|
121
|
-
|
187
|
+
Path precedence is determined in the following order (with the first taking highest priority):
|
122
188
|
|
123
|
-
|
189
|
+
1. `$XDG_*_HOME` - Will be used if defined. Otherwise, falls back to specification default.
|
190
|
+
1. `$XDG_*_DIRS` - Iterates through directories in order defined (with first taking highest
|
191
|
+
priority). Otherwise, falls back to specification default.
|
124
192
|
|
125
|
-
|
126
|
-
$ cd xdg-0.5.2
|
127
|
-
$ sudo setup.rb all
|
193
|
+
## Tests
|
128
194
|
|
195
|
+
To test, run:
|
129
196
|
|
130
|
-
|
197
|
+
bundle exec rake
|
131
198
|
|
132
|
-
|
133
|
-
and [issue ticket system](http://github.com/rubyworks/xdg/issues).
|
199
|
+
## Versioning
|
134
200
|
|
135
|
-
|
136
|
-
topic branch for your work, and submit a pull request.
|
201
|
+
Read [Semantic Versioning](https://semver.org) for details. Briefly, it means:
|
137
202
|
|
203
|
+
- Major (X.y.z) - Incremented for any backwards incompatible public API changes.
|
204
|
+
- Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
|
205
|
+
- Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.
|
138
206
|
|
139
|
-
##
|
207
|
+
## Code of Conduct
|
140
208
|
|
141
|
-
|
209
|
+
Please note that this project is released with a [CODE OF CONDUCT](CODE_OF_CONDUCT.md). By
|
210
|
+
participating in this project you agree to abide by its terms.
|
142
211
|
|
143
|
-
|
212
|
+
## Contributions
|
144
213
|
|
145
|
-
|
214
|
+
Read [CONTRIBUTING](CONTRIBUTING.md) for details.
|
146
215
|
|
216
|
+
## License
|
217
|
+
|
218
|
+
Copyright 2019 [Alchemists](https://www.alchemists.io).
|
219
|
+
Read [LICENSE](LICENSE.md) for details.
|
220
|
+
|
221
|
+
## History
|
222
|
+
|
223
|
+
Read [CHANGES](CHANGES.md) for details.
|
224
|
+
Built with [Gemsmith](https://github.com/bkuhlmann/gemsmith).
|
225
|
+
|
226
|
+
## Credits
|
227
|
+
|
228
|
+
Developed by [Brooke Kuhlmann](https://www.alchemists.io) at
|
229
|
+
[Alchemists](https://www.alchemists.io).
|