xdg 3.1.1 → 4.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e9fcb231d1885ab3ec30f7d9ee07cff012a6f9ca9e78064a10eb92ab32231527
4
- data.tar.gz: 77bda62d924c4e534bf27caadb9fa90b901eb2cbf35ecdf69c4835c6bbec09ac
3
+ metadata.gz: 0a3dc5a5dea8d55c97b02344c1cccc70e6bfc9270b43ba7076b5dc3089159d52
4
+ data.tar.gz: b50d59f72fec1dd4cd1103bc3c68adfd25cafb0344cb2588cd2543ec5be4f10e
5
5
  SHA512:
6
- metadata.gz: 620e7182b6e70a304b1e694f87df1cf3584f96d4ffd694a0ba4a37ef782e3070cbbe6848bdd5d6d112b530ebda00632900eef61b39d06b9e9774739040879fc3
7
- data.tar.gz: c927fbbd8f73410a71b350348c2649f9a131c9a0e9fa8660e7a4d58ea8eeeddb17dc446be28f03509264c495f4a36f7c253cdef275de44d0f25ee356bd5b6fa1
6
+ metadata.gz: 7cf9c15df81e64dcf6751d298735032f76f2fb2f8f68c5cecbddb22d85e35d9681b45f9c6436e73f102cdce9b71d4466cf3817dfb9a6260d30426cf6b23f6211
7
+ data.tar.gz: 903c9bf965949d3a611bb005b6a7c154fa2b23d15754a5d24a1f5a445886aa4647c0c5be186165b21e9c34cbe54888fae034ee09c94575730a13953f3f6ed510
@@ -1,2 +1,2 @@
1
- g�&�O�Ҁ�@TƱQ6h������88$>��kXR^ȟ����9�1hS��,ɶt���Z�<ۂdw
2
- ��!�&�!��� eDoʞ�_rP5H�����Sd�b��<i�e�7���&�}�Lg9
1
+ T�8���N�r��e�c1�Ҧ��6i^�C�'.�Ls�$�2�������T�Uf�Q���c� �8W��� ��_�0h�y���~;���N�@: ���E0�}���j�aj"k.�\���T3��/?8�+��N՞ %��[{3�Fr7�k�o1��7��K�|�%���sm�,���1��:���EQ�� 芙��n5Y(����
2
+ �"��U����}�bf
data.tar.gz.sig CHANGED
@@ -1,2 +1 @@
1
- ��ɐ�Ƚ,!4gA3�þ����
2
- Azt^��
1
+ O��~+[# ]�I=�>/�����n������ ����5'9�K<��A����z�;��@�|�@ _��6�%A���f}��9:Ç�8�=J���=ԞUu�����Jv��΍���J���g��m�*8a9ac`o��/$�9�q�YH���g2˯p�"P�Ps��rv�ʦ�����4�M�$].¡3܍նߥ
@@ -1,4 +1,4 @@
1
- # Apache License
1
+ = Apache License
2
2
 
3
3
  Version 2.0, January 2004
4
4
 
@@ -6,7 +6,7 @@ http://www.apache.org/licenses
6
6
 
7
7
  TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
8
 
9
- ## 1. Definitions
9
+ == 1. Definitions
10
10
 
11
11
  "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by
12
12
  Sections 1 through 9 of this document.
@@ -54,14 +54,14 @@ Contribution."
54
54
  "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a
55
55
  Contribution has been received by Licensor and subsequently incorporated within the Work.
56
56
 
57
- ## 2. Grant of Copyright License
57
+ == 2. Grant of Copyright License
58
58
 
59
59
  Subject to the terms and conditions of this License, each Contributor hereby grants to You a
60
60
  perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to
61
61
  reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and
62
62
  distribute the Work and such Derivative Works in Source or Object form.
63
63
 
64
- ## 3. Grant of Patent License
64
+ == 3. Grant of Patent License
65
65
 
66
66
  Subject to the terms and conditions of this License, each Contributor hereby grants to You a
67
67
  perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this
@@ -74,39 +74,38 @@ a Contribution incorporated within the Work constitutes direct or contributory p
74
74
  then any patent licenses granted to You under this License for that Work shall terminate as of the
75
75
  date such litigation is filed.
76
76
 
77
- ## 4. Redistribution
77
+ == 4. Redistribution
78
78
 
79
79
  You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with
80
80
  or without modifications, and in Source or Object form, provided that You meet the following
81
81
  conditions:
82
82
 
83
- 1. You must give any other recipients of the Work or Derivative Works a copy of this License; and
83
+ . You must give any other recipients of the Work or Derivative Works a copy of this License; and
84
84
 
85
- 2. You must cause any modified files to carry prominent notices stating that You changed the
86
- files; and
85
+ . You must cause any modified files to carry prominent notices stating that You changed the files;
86
+ and
87
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
88
+ . 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
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.
92
+ . If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works
93
+ that You distribute must include a readable copy of the attribution notices contained within such
94
+ NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in
95
+ at least one of the following places: within a NOTICE text file distributed as part of the
96
+ Derivative Works; within the Source form or documentation, if provided along with the Derivative
97
+ Works; or, within a display generated by the Derivative Works, if and wherever such third-party
98
+ notices normally appear. The contents of the NOTICE file are for informational purposes only and
99
+ do not modify the License. You may add Your own attribution notices within Derivative Works that
100
+ You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such
101
+ additional attribution notices cannot be construed as modifying the License.
103
102
 
104
103
  You may add Your own copyright statement to Your modifications and may provide additional or
105
104
  different license terms and conditions for use, reproduction, or distribution of Your modifications,
106
105
  or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of
107
106
  the Work otherwise complies with the conditions stated in this License.
108
107
 
109
- ## 5. Submission of Contributions
108
+ == 5. Submission of Contributions
110
109
 
111
110
  Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the
112
111
  Work by You to the Licensor shall be under the terms and conditions of this License, without any
@@ -114,13 +113,13 @@ additional terms or conditions. Notwithstanding the above, nothing herein shall
114
113
  the terms of any separate license agreement you may have executed with Licensor regarding such
115
114
  Contributions.
116
115
 
117
- ## 6. Trademarks
116
+ == 6. Trademarks
118
117
 
119
118
  This License does not grant permission to use the trade names, trademarks, service marks, or product
120
119
  names of the Licensor, except as required for reasonable and customary use in describing the origin
121
120
  of the Work and reproducing the content of the NOTICE file.
122
121
 
123
- ## 7. Disclaimer of Warranty
122
+ == 7. Disclaimer of Warranty
124
123
 
125
124
  Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each
126
125
  Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -129,7 +128,7 @@ TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. Y
129
128
  responsible for determining the appropriateness of using or redistributing the Work and assume any
130
129
  risks associated with Your exercise of permissions under this License.
131
130
 
132
- ## 8. Limitation of Liability
131
+ == 8. Limitation of Liability
133
132
 
134
133
  In no event and under no legal theory, whether in tort (including negligence), contract, or
135
134
  otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or
@@ -139,7 +138,7 @@ License or out of the use or inability to use the Work (including but not limite
139
138
  loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial
140
139
  damages or losses), even if such Contributor has been advised of the possibility of such damages.
141
140
 
142
- ## 9. Accepting Warranty or Additional Liability
141
+ == 9. Accepting Warranty or Additional Liability
143
142
 
144
143
  While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee
145
144
  for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights
@@ -151,11 +150,11 @@ additional liability.
151
150
 
152
151
  END OF TERMS AND CONDITIONS
153
152
 
154
- Copyright 2019 [Alchemists](https://www.alchemists.io).
153
+ Copyright 2019 link:https://www.alchemists.io/team/brooke_kuhlmann[Brooke Kuhlmann].
155
154
 
156
155
  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.
156
+ compliance with the License. You may obtain a link:https://www.apache.org/licenses/LICENSE-2.0[copy]
157
+ of the License.
159
158
 
160
159
  Unless required by applicable law or agreed to in writing, software distributed under the License is
161
160
  distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
@@ -0,0 +1,296 @@
1
+ :toc: macro
2
+ :toclevels: 5
3
+ :figure-caption!:
4
+
5
+ = XDG
6
+
7
+ [link=http://badge.fury.io/rb/xdg]
8
+ image::https://badge.fury.io/rb/xdg.svg[Gem Version]
9
+ [link=https://circleci.com/gh/bkuhlmann/xdg]
10
+ image::https://circleci.com/gh/bkuhlmann/xdg.svg?style=svg[Circle CI Status]
11
+
12
+ Provides a Ruby implementation of the
13
+ https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html[XDG Base Directory
14
+ Specification].
15
+
16
+ 💡 If you write a lot of Command Line Interfaces and would like additional syntactic sugar that
17
+ includes what is found in this gem, make sure to check out the
18
+ link:https://www.alchemists.io/projects/runcom[Runcom] gem too.
19
+
20
+ toc::[]
21
+
22
+ == Features
23
+
24
+ * Provides a `XDG::Environment` object that adheres to the _XDG Base Directory Specification_ with
25
+ access to the following environment settings:
26
+ ** `$XDG_CACHE_HOME`
27
+ ** `$XDG_CONFIG_HOME`
28
+ ** `$XDG_CONFIG_DIRS`
29
+ ** `$XDG_DATA_HOME`
30
+ ** `$XDG_DATA_DIRS`
31
+
32
+ == Requirements
33
+
34
+ . https://www.ruby-lang.org[Ruby]
35
+
36
+ == Setup
37
+
38
+ To install, run:
39
+
40
+ [source,bash]
41
+ ----
42
+ gem install xdg
43
+ ----
44
+
45
+ Add the following to your Gemfile:
46
+
47
+ [source,ruby]
48
+ ----
49
+ gem "xdg"
50
+ ----
51
+
52
+ == Usage
53
+
54
+ The following describes how to use this XDG implementation.
55
+
56
+ === Overview
57
+
58
+ To get up and running quickly, use `+XDG::Environment+` as follows:
59
+
60
+ [source,ruby]
61
+ ----
62
+ xdg = XDG::Environment.new
63
+ xdg.cache_home # <= Answers computed `$XDG_CACHE_HOME` value.
64
+ xdg.config_home # <= Answers computed `$XDG_CONFIG_HOME` value.
65
+ xdg.config_dirs # <= Answers computed `$XDG_CONFIG_DIRS` value.
66
+ xdg.data_home # <= Answers computed `$XDG_DATA_HOME` value.
67
+ xdg.data_dirs # <= Answers computed `$XDG_DATA_DIRS` value.
68
+ ----
69
+
70
+ The _computed_ value, in this case, is either the user-defined value of the key or the default
71
+ value, per specification, when the key is not defined or empty. For more on this, scroll down to the
72
+ _Variable Defaults_ section to learn more.
73
+
74
+ The `XDG::Environment` wraps the following objects which can be used individually if you don’t
75
+ want to load the entire environment:
76
+
77
+ [source,ruby]
78
+ ----
79
+ cache = XDG::Cache.new
80
+ config = XDG::Config.new
81
+ data = XDG::Data.new
82
+ ----
83
+
84
+ The `cache`, `config`, and `data` objects share the same API which means you can ask each the
85
+ following messages:
86
+
87
+ * `#home` - Answers the home directory as computed via the `$XDG_*_HOME` key.
88
+ * `#directories` - Answers an array directories as computed via the `$XDG_*_DIRS` key.
89
+ * `#all` - Answers an array of _all_ directories as computed from the combined `$XDG_*_HOME` and
90
+ `$XDG_*_DIRS` values (with `$XDG_*_HOME` prefixed at the start of the array).
91
+
92
+ === Examples
93
+
94
+ The following are examples of what you would see when playing around with the XDG objects within an
95
+ IRB console (taken from my own environment):
96
+
97
+ [source,ruby]
98
+ ----
99
+ require "xdg"
100
+
101
+ # Initialization
102
+ environment = XDG::Environment.new
103
+ cache = XDG::Cache.new
104
+ config = XDG::Config.new
105
+ data = XDG::Data.new
106
+
107
+ # Inspection
108
+ environment.inspect # => XDG_CACHE_HOME=/Users/bkuhlmann/.cache XDG_CONFIG_HOME=/Users/bkuhlmann/.config XDG_CONFIG_DIRS=/etc/xdg XDG_DATA_HOME=/Users/bkuhlmann/.local/share XDG_DATA_DIRS=/usr/local/share:/usr/share
109
+ cache.inspect # => "XDG_CACHE_HOME=/Users/bkuhlmann/.cache"
110
+ config.inspect # => "XDG_CONFIG_HOME=/Users/bkuhlmann/.config XDG_CONFIG_DIRS=/etc/xdg"
111
+ data.inspect # => "XDG_DATA_HOME=/Users/bkuhlmann/.local/share XDG_DATA_DIRS=/usr/local/share:/usr/share"
112
+
113
+ # Paths
114
+ environment.cache_home # => #<Pathname:/Users/bkuhlmann/.cache>
115
+ environment.config_home # => #<Pathname:/Users/bkuhlmann/.config>
116
+ environment.config_dirs # => [#<Pathname:/etc/xdg>]
117
+ environment.data_home # => #<Pathname:/Users/bkuhlmann/.local/share>
118
+ environment.data_dirs # => [#<Pathname:/usr/local/share>, #<Pathname:/usr/share>]
119
+
120
+ cache.home # => #<Pathname:/Users/bkuhlmann/.cache>
121
+ cache.directories # => []
122
+ cache.all # => [#<Pathname:/Users/bkuhlmann/.cache>]
123
+
124
+ config.home # => #<Pathname:/Users/bkuhlmann/.config>
125
+ config.directories # => [#<Pathname:/etc/xdg>]
126
+ config.all # => [#<Pathname:/Users/bkuhlmann/.config>, #<Pathname:/etc/xdg>]
127
+
128
+ data.home # => #<Pathname:/Users/bkuhlmann/.local/share>
129
+ data.directories # => [#<Pathname:/usr/local/share>, #<Pathname:/usr/share>]
130
+ data.all # => [#<Pathname:/Users/bkuhlmann/.local/share>, #<Pathname:/usr/local/share>, #<Pathname:/usr/share>]
131
+ ----
132
+
133
+ As you can see from above, each XDG object answers back a `Pathname` which means you have the full
134
+ `Pathname` API at your fingertips to build upon the output of these objects as needed.
135
+
136
+ === Variable Defaults
137
+
138
+ The _XDG Base Directory Specification_ defines environment variables and associated default values
139
+ when not defined or empty. The following defaults, per specification, are implemented by the `XDG`
140
+ objects:
141
+
142
+ * `$XDG_CACHE_HOME="$HOME/.cache"`
143
+ * `$XDG_CONFIG_HOME="$HOME/.config"`
144
+ * `$XDG_CONFIG_DIRS="/etc/xdg"`
145
+ * `$XDG_DATA_HOME="$HOME/.local/share"`
146
+ * `$XDG_DATA_DIRS="/usr/local/share/:/usr/share/"`
147
+ * `$XDG_RUNTIME_DIR`
148
+
149
+ The `$XDG_RUNTIME_DIR` deserves special mention as it’s not, _currently_, implemented as part of
150
+ this gem because it is more user/environment specific. Here is how the `$XDG_RUNTIME_DIR` is meant
151
+ to be used should you choose to use it:
152
+
153
+ * _Must_ reference user-specific non-essential runtime files and other file objects (such as
154
+ sockets, named pipes, etc.)
155
+ * _Must_ be owned by the user with _only_ the user having read and write access to it.
156
+ * _Must_ have a Unix access mode of `0700`.
157
+ * _Must_ be bound to the user when logging in.
158
+ * _Must_ be removed when the user logs out.
159
+ * _Must_ be pointed to the same directory when the user logs in more than once.
160
+ * _Must_ exist from first login to last logout on the system and not removed in between.
161
+ * _Must_ not allow files in the directory to survive reboot or a full logout/login cycle.
162
+ * _Must_ keep the directory on the local file system and not shared with any other file systems.
163
+ * _Must_ keep the directory fully-featured by the standards of the operating system. Specifically,
164
+ on Unix-like operating systems AF_UNIX sockets, symbolic links, hard links, proper permissions, file
165
+ locking, sparse files, memory mapping, file change notifications, a reliable hard link count must be
166
+ supported, and no restrictions on the file name character set should be imposed. Files in this
167
+ directory _may_ be subjected to periodic clean-up. To ensure files are not removed, they should have
168
+ their access time timestamp modified at least once every 6 hours of monotonic time or the '`sticky`'
169
+ bit should be set on the file.
170
+ * When not set, applications should fall back to a replacement directory with similar capabilities
171
+ and print a warning message. Applications should use this directory for communication and
172
+ synchronization purposes and should not place larger files in it, since it might reside in runtime
173
+ memory and cannot necessarily be swapped out to disk.
174
+
175
+ === Variable Behavior
176
+
177
+ The behavior of most XDG environment variables can be lumped into two categories:
178
+
179
+ * `$XDG_*_HOME`
180
+ * `$XDG_*_DIRS`
181
+
182
+ Each is described in detail below.
183
+
184
+ ==== `$XDG_*_DIRS`
185
+
186
+ These variables are used to define a colon (`:`) delimited list of directories. Order is important
187
+ as the first directory defined will take precedent over the following directory and so forth. For
188
+ example, here is a situation where the `XDG_CONFIG_DIRS` key has a custom value:
189
+
190
+ [source,bash]
191
+ ----
192
+ XDG_CONFIG_DIRS="/example/one/.config:/example/two/.settings:/example/three/.configuration"
193
+ ----
194
+
195
+ Yields the following, colon delimited, array:
196
+
197
+ [source,ruby]
198
+ ----
199
+ [
200
+ "/example/one/.config",
201
+ "/example/two/.settings",
202
+ "/example/three/.configuration"
203
+ ]
204
+ ----
205
+
206
+ In the above example, the `"/example/one/.config"` path takes _highest_ priority since it was
207
+ defined first.
208
+
209
+ ==== `$XDG_*_HOME`
210
+
211
+ These variables take precidence over the corresponding `$XDG_*_DIRS` environment variables. Using
212
+ a modified version of the `$XDG_*_DIRS` example, shown above, we could have the following setup:
213
+
214
+ [source,bash]
215
+ ----
216
+ XDG_CONFIG_HOME="/example/priority"
217
+ XDG_CONFIG_DIRS="/example/one/.config:/example/two/.settings"
218
+ ----
219
+
220
+ Yields the following, colon delimited, array:
221
+
222
+ [source,ruby]
223
+ ----
224
+ [
225
+ "/example/priority",
226
+ "/example/one/.config",
227
+ "/example/two/.settings"
228
+ ]
229
+ ----
230
+
231
+ Due to `XDG_CONFIG_HOME` taking precidence over the `XDG_CONFIG_DIRS`, the path with the
232
+ _highest_ priority in this example is: `"/example/priority"`.
233
+
234
+ === Variable Priority
235
+
236
+ Path precedence is determined in the following order (with the first taking highest priority):
237
+
238
+ . `$XDG_*_HOME` - Will be used if defined. Otherwise, falls back to specification default.
239
+ . `$XDG_*_DIRS` - Iterates through directories in order defined (with first taking highest
240
+ priority). Otherwise, falls back to specification default.
241
+
242
+ == Development
243
+
244
+ To contribute, run:
245
+
246
+ [source,bash]
247
+ ----
248
+ git clone https://github.com/bkuhlmann/xdg.git
249
+ cd xdg
250
+ bin/setup
251
+ ----
252
+
253
+ You can also use the IRB console for direct access to all objects:
254
+
255
+ [source,bash]
256
+ ----
257
+ bin/console
258
+ ----
259
+
260
+ == Tests
261
+
262
+ To test, run:
263
+
264
+ [source,bash]
265
+ ----
266
+ bundle exec rake
267
+ ----
268
+
269
+ == Versioning
270
+
271
+ Read link:https://semver.org[Semantic Versioning] for details. Briefly, it means:
272
+
273
+ * Major (X.y.z) - Incremented for any backwards incompatible public API changes.
274
+ * Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
275
+ * Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.
276
+
277
+ == Code of Conduct
278
+
279
+ Please note that this project is released with a link:CODE_OF_CONDUCT.adoc[CODE OF CONDUCT]. By
280
+ participating in this project you agree to abide by its terms.
281
+
282
+ == Contributions
283
+
284
+ Read link:CONTRIBUTING.adoc[CONTRIBUTING] for details.
285
+
286
+ == License
287
+
288
+ Read link:LICENSE.adoc[LICENSE] for details.
289
+
290
+ == History
291
+
292
+ Read link:CHANGES.adoc[CHANGES] for details.
293
+
294
+ == Credits
295
+
296
+ Engineered by link:https://www.alchemists.io/team/brooke_kuhlmann[Brooke Kuhlmann].
data/lib/xdg.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "xdg/identity"
4
4
  require "xdg/pair"
5
- require "xdg/paths/standard"
5
+ require "xdg/paths/home"
6
6
  require "xdg/paths/directory"
7
7
  require "xdg/paths/combined"
8
8
  require "xdg/config"
@@ -10,7 +10,7 @@ module XDG
10
10
 
11
11
  delegate %i[home directories all inspect] => :combined
12
12
 
13
- def initialize home: Paths::Standard, directories: Paths::Directory, environment: ENV
13
+ def initialize home: Paths::Home, directories: Paths::Directory, environment: ENV
14
14
  @combined = Paths::Combined.new home.new(HOME_PAIR, environment),
15
15
  directories.new(Pair.new, environment)
16
16
  end
@@ -11,7 +11,7 @@ module XDG
11
11
 
12
12
  delegate %i[home directories all inspect] => :combined
13
13
 
14
- def initialize home: Paths::Standard, directories: Paths::Directory, environment: ENV
14
+ def initialize home: Paths::Home, directories: Paths::Directory, environment: ENV
15
15
  @combined = Paths::Combined.new home.new(HOME_PAIR, environment),
16
16
  directories.new(DIRS_PAIR, environment)
17
17
  end
@@ -11,7 +11,7 @@ module XDG
11
11
 
12
12
  delegate %i[home directories all inspect] => :combined
13
13
 
14
- def initialize home: Paths::Standard, directories: Paths::Directory, environment: ENV
14
+ def initialize home: Paths::Home, directories: Paths::Directory, environment: ENV
15
15
  @combined = Paths::Combined.new home.new(HOME_PAIR, environment),
16
16
  directories.new(DIRS_PAIR, environment)
17
17
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module XDG
4
4
  class Environment
5
- def initialize home: Paths::Standard, directories: Paths::Directory, environment: ENV
5
+ def initialize home: Paths::Home, directories: Paths::Directory, environment: ENV
6
6
  @cache = Cache.new home: home, directories: directories, environment: environment
7
7
  @config = Config.new home: home, directories: directories, environment: environment
8
8
  @data = Data.new home: home, directories: directories, environment: environment
@@ -3,20 +3,9 @@
3
3
  module XDG
4
4
  # Gem identity information.
5
5
  module Identity
6
- def self.name
7
- "xdg"
8
- end
9
-
10
- def self.label
11
- "XDG"
12
- end
13
-
14
- def self.version
15
- "3.1.1"
16
- end
17
-
18
- def self.version_label
19
- "#{label} #{version}"
20
- end
6
+ NAME = "xdg"
7
+ LABEL = "XDG"
8
+ VERSION = "4.3.0"
9
+ VERSION_LABEL = "#{LABEL} #{VERSION}"
21
10
  end
22
11
  end
@@ -14,11 +14,11 @@ module XDG
14
14
  end
15
15
 
16
16
  def default
17
- paths.split(DELIMITER).map(&method(:expand))
17
+ value.split(DELIMITER).map(&method(:expand))
18
18
  end
19
19
 
20
20
  def dynamic
21
- String(environment[key]).then { |env_paths| env_paths.empty? ? paths : env_paths }
21
+ String(environment[key]).then { |env_value| env_value.empty? ? value : env_value }
22
22
  .split(DELIMITER)
23
23
  .uniq
24
24
  .map(&method(:expand))
@@ -36,7 +36,7 @@ module XDG
36
36
  String pair.key
37
37
  end
38
38
 
39
- def paths
39
+ def value
40
40
  String pair.value
41
41
  end
42
42
 
@@ -6,10 +6,10 @@ require "pathname"
6
6
  module XDG
7
7
  module Paths
8
8
  # A XDG home path.
9
- class Standard
9
+ class Home
10
10
  extend Forwardable
11
11
 
12
- HOME_KEY = "HOME"
12
+ KEY = "HOME"
13
13
 
14
14
  delegate %i[key value] => :pair
15
15
 
@@ -39,7 +39,7 @@ module XDG
39
39
  end
40
40
 
41
41
  def home
42
- Pathname environment.fetch(HOME_KEY)
42
+ Pathname environment.fetch(KEY)
43
43
  end
44
44
  end
45
45
  end
metadata CHANGED
@@ -1,18 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xdg
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 4.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIC/jCCAeagAwIBAgIBAjANBgkqhkiG9w0BAQsFADAlMSMwIQYDVQQDDBpicm9v
14
- a2UvREM9YWxjaGVtaXN0cy9EQz1pbzAeFw0xOTAyMTcxNjAxMTFaFw0yMDAyMTcx
15
- NjAxMTFaMCUxIzAhBgNVBAMMGmJyb29rZS9EQz1hbGNoZW1pc3RzL0RDPWlvMIIB
13
+ MIIC/jCCAeagAwIBAgIBAzANBgkqhkiG9w0BAQsFADAlMSMwIQYDVQQDDBpicm9v
14
+ a2UvREM9YWxjaGVtaXN0cy9EQz1pbzAeFw0yMDAzMTUxNDQ1MzJaFw0yMTAzMTUx
15
+ NDQ1MzJaMCUxIzAhBgNVBAMMGmJyb29rZS9EQz1hbGNoZW1pc3RzL0RDPWlvMIIB
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/gY4ggwDQYJKoZIhvcNAQELBQADggEBANgfX7kPZkJvsbdWMvbe
24
- DUUYxRTqTUzCDpLd2p3sQvgLMKjTNSKt6CFq/kh+98b6RCgO6DqiVfxvOEq02dvf
25
- ebMN/ylQqan2FgiAs1rpP0/D4C0MlBjoDktsT+2IyLol1KmkDB20ExJ4Sf1GRNdA
26
- hpWOtcgqHtmrc7xzgB6BuyoYufrKKUlCO3ewTM4C375D2qO7hIdKuMOO3CdPMtSk
27
- OrWpbzCL+nbbXqeoqiHgZaUvcyyQrGj5sQRxMTzuMXzzQxtHnuTuKrcz16HMTX/O
28
- dKvURM+1PwDCzC5tvRwjhUJIizau6+MtkFCvJHmaAj1aZL3odcPejHj5Hxt/0CUW
29
- y84=
23
+ 2CdikiiE3fJhP/gY4ggwDQYJKoZIhvcNAQELBQADggEBAIHhAlD3po4sTYqacXaQ
24
+ XI9jIhrfMy//2PgbHWcETtlJPBeNUbbSNBABcllUHKqYsVDlSvSmss034KSWNR8F
25
+ bF1GcloicyvcCC4y6IoW4it0COAcdeaaxkxiBSgKdQFpff9REnDlIKK4uQ9lLxIo
26
+ Y2G5xubiziKZkyfWFuSr67PIjW3Bu673D1JVBArhA1qbgQmYQcy1CkGOjo+iO8Nf
27
+ 7u/QSfBHb+r/bXhKscDgPpnKwbUmvgO2+94zJG9KsrmIydlzYfsD09aXKx0t6Xy4
28
+ 2XV8FRa7/JimI07sPLC13eLY3xd/aYTi85Z782KIA4j0G8XEEWAX0ouBhlXPocZv
29
+ QWc=
30
30
  -----END CERTIFICATE-----
31
- date: 2019-11-01 00:00:00.000000000 Z
31
+ date: 2020-10-18 00:00:00.000000000 Z
32
32
  dependencies:
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: bundler-audit
@@ -50,28 +50,28 @@ dependencies:
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '13.5'
53
+ version: '14.2'
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '13.5'
60
+ version: '14.2'
61
61
  - !ruby/object:Gem::Dependency
62
- name: git-cop
62
+ name: git-lint
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '3.5'
67
+ version: '1.0'
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: '3.5'
74
+ version: '1.0'
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: guard-rspec
77
77
  requirement: !ruby/object:Gem::Requirement
@@ -92,28 +92,28 @@ dependencies:
92
92
  requirements:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: '0.10'
95
+ version: '0.13'
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - "~>"
101
101
  - !ruby/object:Gem::Version
102
- version: '0.10'
102
+ version: '0.13'
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: pry-byebug
105
105
  requirement: !ruby/object:Gem::Requirement
106
106
  requirements:
107
107
  - - "~>"
108
108
  - !ruby/object:Gem::Version
109
- version: '3.5'
109
+ version: '3.9'
110
110
  type: :development
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - "~>"
115
115
  - !ruby/object:Gem::Version
116
- version: '3.5'
116
+ version: '3.9'
117
117
  - !ruby/object:Gem::Dependency
118
118
  name: rake
119
119
  requirement: !ruby/object:Gem::Requirement
@@ -134,14 +134,14 @@ dependencies:
134
134
  requirements:
135
135
  - - "~>"
136
136
  - !ruby/object:Gem::Version
137
- version: '5.4'
137
+ version: '6.0'
138
138
  type: :development
139
139
  prerelease: false
140
140
  version_requirements: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - "~>"
143
143
  - !ruby/object:Gem::Version
144
- version: '5.4'
144
+ version: '6.0'
145
145
  - !ruby/object:Gem::Dependency
146
146
  name: rspec
147
147
  requirement: !ruby/object:Gem::Requirement
@@ -162,81 +162,81 @@ dependencies:
162
162
  requirements:
163
163
  - - "~>"
164
164
  - !ruby/object:Gem::Version
165
- version: '0.76'
165
+ version: '0.89'
166
166
  type: :development
167
167
  prerelease: false
168
168
  version_requirements: !ruby/object:Gem::Requirement
169
169
  requirements:
170
170
  - - "~>"
171
171
  - !ruby/object:Gem::Version
172
- version: '0.76'
172
+ version: '0.89'
173
173
  - !ruby/object:Gem::Dependency
174
174
  name: rubocop-performance
175
175
  requirement: !ruby/object:Gem::Requirement
176
176
  requirements:
177
177
  - - "~>"
178
178
  - !ruby/object:Gem::Version
179
- version: '1.4'
179
+ version: '1.5'
180
180
  type: :development
181
181
  prerelease: false
182
182
  version_requirements: !ruby/object:Gem::Requirement
183
183
  requirements:
184
184
  - - "~>"
185
185
  - !ruby/object:Gem::Version
186
- version: '1.4'
186
+ version: '1.5'
187
187
  - !ruby/object:Gem::Dependency
188
188
  name: rubocop-rake
189
189
  requirement: !ruby/object:Gem::Requirement
190
190
  requirements:
191
191
  - - "~>"
192
192
  - !ruby/object:Gem::Version
193
- version: '0.3'
193
+ version: '0.5'
194
194
  type: :development
195
195
  prerelease: false
196
196
  version_requirements: !ruby/object:Gem::Requirement
197
197
  requirements:
198
198
  - - "~>"
199
199
  - !ruby/object:Gem::Version
200
- version: '0.3'
200
+ version: '0.5'
201
201
  - !ruby/object:Gem::Dependency
202
202
  name: rubocop-rspec
203
203
  requirement: !ruby/object:Gem::Requirement
204
204
  requirements:
205
205
  - - "~>"
206
206
  - !ruby/object:Gem::Version
207
- version: '1.33'
207
+ version: '1.39'
208
208
  type: :development
209
209
  prerelease: false
210
210
  version_requirements: !ruby/object:Gem::Requirement
211
211
  requirements:
212
212
  - - "~>"
213
213
  - !ruby/object:Gem::Version
214
- version: '1.33'
214
+ version: '1.39'
215
215
  - !ruby/object:Gem::Dependency
216
216
  name: simplecov
217
217
  requirement: !ruby/object:Gem::Requirement
218
218
  requirements:
219
219
  - - "~>"
220
220
  - !ruby/object:Gem::Version
221
- version: '0.13'
221
+ version: '0.19'
222
222
  type: :development
223
223
  prerelease: false
224
224
  version_requirements: !ruby/object:Gem::Requirement
225
225
  requirements:
226
226
  - - "~>"
227
227
  - !ruby/object:Gem::Version
228
- version: '0.13'
229
- description:
228
+ version: '0.19'
229
+ description:
230
230
  email:
231
231
  - brooke@alchemists.io
232
232
  executables: []
233
233
  extensions: []
234
234
  extra_rdoc_files:
235
- - README.md
236
- - LICENSE.md
235
+ - README.adoc
236
+ - LICENSE.adoc
237
237
  files:
238
- - LICENSE.md
239
- - README.md
238
+ - LICENSE.adoc
239
+ - README.adoc
240
240
  - lib/xdg.rb
241
241
  - lib/xdg/cache.rb
242
242
  - lib/xdg/config.rb
@@ -246,15 +246,16 @@ files:
246
246
  - lib/xdg/pair.rb
247
247
  - lib/xdg/paths/combined.rb
248
248
  - lib/xdg/paths/directory.rb
249
- - lib/xdg/paths/standard.rb
250
- homepage: https://github.com/bkuhlmann/xdg
249
+ - lib/xdg/paths/home.rb
250
+ homepage: https://www.alchemists.io/projects/xdg
251
251
  licenses:
252
252
  - Apache-2.0
253
253
  metadata:
254
- source_code_uri: https://github.com/bkuhlmann/xdg
255
- changelog_uri: https://github.com/bkuhlmann/xdg/blob/master/CHANGES.md
256
254
  bug_tracker_uri: https://github.com/bkuhlmann/xdg/issues
257
- post_install_message:
255
+ changelog_uri: https://www.alchemists.io/projects/xdg/changes.html
256
+ documentation_uri: https://www.alchemists.io/projects/xdg
257
+ source_code_uri: https://github.com/bkuhlmann/xdg
258
+ post_install_message:
258
259
  rdoc_options: []
259
260
  require_paths:
260
261
  - lib
@@ -262,15 +263,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
262
263
  requirements:
263
264
  - - "~>"
264
265
  - !ruby/object:Gem::Version
265
- version: '2.6'
266
+ version: '2.7'
266
267
  required_rubygems_version: !ruby/object:Gem::Requirement
267
268
  requirements:
268
269
  - - ">="
269
270
  - !ruby/object:Gem::Version
270
271
  version: '0'
271
272
  requirements: []
272
- rubygems_version: 3.0.6
273
- signing_key:
273
+ rubygems_version: 3.1.4
274
+ signing_key:
274
275
  specification_version: 4
275
276
  summary: Provides an implementation of the XDG Base Directory Specification.
276
277
  test_files: []
metadata.gz.sig CHANGED
Binary file
data/README.md DELETED
@@ -1,271 +0,0 @@
1
- <p align="center">
2
- <img src="xdg.png" alt="XDG Icon"/>
3
- </p>
4
-
5
- # XDG
6
-
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)
11
-
12
- Provides a Ruby implementation of the [XDG Base Directory
13
- Specification](https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html).
14
-
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.
18
-
19
- <!-- Tocer[start]: Auto-generated, don't remove. -->
20
-
21
- ## Table of Contents
22
-
23
- - [Features](#features)
24
- - [Requirements](#requirements)
25
- - [Setup](#setup)
26
- - [Usage](#usage)
27
- - [Overview](#overview)
28
- - [Examples](#examples)
29
- - [Variable Defaults](#variable-defaults)
30
- - [Variable Behavior](#variable-behavior)
31
- - [`$XDG_*_DIRS`](#xdg__dirs)
32
- - [`$XDG_*_HOME`](#xdg__home)
33
- - [Variable Priority](#variable-priority)
34
- - [Tests](#tests)
35
- - [Versioning](#versioning)
36
- - [Code of Conduct](#code-of-conduct)
37
- - [Contributions](#contributions)
38
- - [License](#license)
39
- - [History](#history)
40
- - [Credits](#credits)
41
-
42
- <!-- Tocer[finish]: Auto-generated, don't remove. -->
43
-
44
- ## Features
45
-
46
- - Provides a `XDG::Environment` object that adheres to the *XDG Base Directory Specification* with
47
- access to the following environment settings:
48
- - `$XDG_CACHE_HOME`
49
- - `$XDG_CONFIG_HOME`
50
- - `$XDG_CONFIG_DIRS`
51
- - `$XDG_DATA_HOME`
52
- - `$XDG_DATA_DIRS`
53
-
54
- ## Requirements
55
-
56
- 1. [Ruby 2.6.4](https://www.ruby-lang.org)
57
-
58
- ## Setup
59
-
60
- To install, run:
61
-
62
- gem install xdg
63
-
64
- Add the following to your Gemfile:
65
-
66
- gem "xdg"
67
-
68
- ## Usage
69
-
70
- The following describes how to use this XDG implementation.
71
-
72
- #### Overview
73
-
74
- To get up and running quickly, use `XDG::Environment` as follows:
75
-
76
- xdg = XDG::Environment.new
77
- xdg.cache_home # <= Answers computed `$XDG_CACHE_HOME` value.
78
- xdg.config_home # <= Answers computed `$XDG_CONFIG_HOME` value.
79
- xdg.config_dirs # <= Answers computed `$XDG_CONFIG_DIRS` value.
80
- xdg.data_home # <= Answers computed `$XDG_DATA_HOME` value.
81
- xdg.data_dirs # <= Answers computed `$XDG_DATA_DIRS` value.
82
-
83
- The *computed* value, in this case, is either the user-defined value of the key or the default
84
- value, per specification, when the key is not defined or empty. For more on this, scroll down to the
85
- *Variable Defaults* section to learn more.
86
-
87
- The `XDG::Environment` wraps the following objects which can be used individually if you
88
- don't want to load the entire environment:
89
-
90
- cache = XDG::Cache.new
91
- config = XDG::Config.new
92
- data = XDG::Data.new
93
-
94
- The `cache`, `config`, and `data` objects share the same API which means you can ask each the
95
- following messages:
96
-
97
- - `#home` - Answers the home directory as computed via the `$XDG_*_HOME` key.
98
- - `#directories` - Answers an array directories as computed via the `$XDG_*_DIRS` key.
99
- - `#all` - Answers an array of *all* directories as computed from the combined `$XDG_*_HOME` and
100
- `$XDG_*_DIRS` values (with `$XDG_*_HOME` prefixed at the start of the array).
101
-
102
- #### Examples
103
-
104
- The following are examples of what you would see when playing around with the XDG objects within an
105
- IRB console (taken from my own environment):
106
-
107
- require "xdg"
108
-
109
- # Initialization
110
- environment = XDG::Environment.new
111
- cache = XDG::Cache.new
112
- config = XDG::Config.new
113
- data = XDG::Data.new
114
-
115
- # Inspection
116
- environment.inspect # => XDG_CACHE_HOME=/Users/bkuhlmann/.cache XDG_CONFIG_HOME=/Users/bkuhlmann/.config XDG_CONFIG_DIRS=/etc/xdg XDG_DATA_HOME=/Users/bkuhlmann/.local/share XDG_DATA_DIRS=/usr/local/share:/usr/share
117
- cache.inspect # => "XDG_CACHE_HOME=/Users/bkuhlmann/.cache"
118
- config.inspect # => "XDG_CONFIG_HOME=/Users/bkuhlmann/.config XDG_CONFIG_DIRS=/etc/xdg"
119
- data.inspect # => "XDG_DATA_HOME=/Users/bkuhlmann/.local/share XDG_DATA_DIRS=/usr/local/share:/usr/share"
120
-
121
- # Paths
122
- environment.cache_home # => #<Pathname:/Users/bkuhlmann/.cache>
123
- environment.config_home # => #<Pathname:/Users/bkuhlmann/.config>
124
- environment.config_dirs # => [#<Pathname:/etc/xdg>]
125
- environment.data_home # => #<Pathname:/Users/bkuhlmann/.local/share>
126
- environment.data_dirs # => [#<Pathname:/usr/local/share>, #<Pathname:/usr/share>]
127
-
128
- cache.home # => #<Pathname:/Users/bkuhlmann/.cache>
129
- cache.directories # => []
130
- cache.all # => [#<Pathname:/Users/bkuhlmann/.cache>]
131
-
132
- config.home # => #<Pathname:/Users/bkuhlmann/.config>
133
- config.directories # => [#<Pathname:/etc/xdg>]
134
- config.all # => [#<Pathname:/Users/bkuhlmann/.config>, #<Pathname:/etc/xdg>]
135
-
136
- data.home # => #<Pathname:/Users/bkuhlmann/.local/share>
137
- data.directories # => [#<Pathname:/usr/local/share>, #<Pathname:/usr/share>]
138
- data.all # => [#<Pathname:/Users/bkuhlmann/.local/share>, #<Pathname:/usr/local/share>, #<Pathname:/usr/share>]
139
-
140
- As you can see from above, each XDG object answers back a `Pathname` which means you have the
141
- full `Pathname` API at your fingertips to build upon the output of these objects as needed.
142
-
143
- #### Variable Defaults
144
-
145
- The *XDG Base Directory Specification* defines environment variables and associated default values
146
- when not defined or empty. The following defaults, per specification, are implemented by the
147
- `XDG` objects:
148
-
149
- - `$XDG_CACHE_HOME="$HOME/.cache"`
150
- - `$XDG_CONFIG_HOME="$HOME/.config"`
151
- - `$XDG_CONFIG_DIRS="/etc/xdg"`
152
- - `$XDG_DATA_HOME="$HOME/.local/share"`
153
- - `$XDG_DATA_DIRS="/usr/local/share/:/usr/share/"`
154
- - `$XDG_RUNTIME_DIR`
155
-
156
- The `$XDG_RUNTIME_DIR` deserves special mention as it's not, *currently*, implemented as part of
157
- this gem because it is more user/environment specific. Here is how the `$XDG_RUNTIME_DIR` is meant
158
- to be used should you choose to use it:
159
-
160
- - *Must* reference user-specific non-essential runtime files and other file objects (such as
161
- sockets, named pipes, etc.)
162
- - *Must* be owned by the user with *only* the user having read and write access to it.
163
- - *Must* have a Unix access mode of `0700`.
164
- - *Must* be bound to the user when logging in.
165
- - *Must* be removed when the user logs out.
166
- - *Must* be pointed to the same directory when the user logs in more than once.
167
- - *Must* exist from first login to last logout on the system and not removed in between.
168
- - *Must* not allow files in the directory to survive reboot or a full logout/login cycle.
169
- - *Must* keep the directory on the local file system and not shared with any other file systems.
170
- - *Must* keep the directory fully-featured by the standards of the operating system. Specifically,
171
- on Unix-like operating systems AF_UNIX sockets, symbolic links, hard links, proper permissions,
172
- file locking, sparse files, memory mapping, file change notifications, a reliable hard link count
173
- must be supported, and no restrictions on the file name character set should be imposed. Files in
174
- this directory *may* be subjected to periodic clean-up. To ensure files are not removed,
175
- they should have their access time timestamp modified at least once every 6 hours of monotonic
176
- time or the 'sticky' bit should be set on the file.
177
- - When not set, applications should fall back to a replacement directory with similar capabilities
178
- and print a warning message. Applications should use this directory for communication and
179
- synchronization purposes and should not place larger files in it, since it might reside in runtime
180
- memory and cannot necessarily be swapped out to disk.
181
-
182
- #### Variable Behavior
183
-
184
- The behavior of most XDG environment variables can be lumped into two categories:
185
-
186
- - `$XDG_*_HOME`
187
- - `$XDG_*_DIRS`
188
-
189
- Each is described in detail below.
190
-
191
- ##### `$XDG_*_DIRS`
192
-
193
- These variables are used to define a colon (`:`) delimited list of directories. Order is important
194
- as the first directory defined will take precedent over the following directory and so forth. For
195
- example, here is a situation where the `XDG_CONFIG_DIRS` key has a custom value:
196
-
197
- XDG_CONFIG_DIRS="/example/one/.config:/example/two/.settings:/example/three/.configuration"
198
-
199
- # Yields the following, colon delimited, array:
200
- [
201
- "/example/one/.config",
202
- "/example/two/.settings",
203
- "/example/three/.configuration"
204
- ]
205
-
206
- In the above example, the `"/example/one/.config"` path takes *highest* priority since it was
207
- defined first.
208
-
209
- ##### `$XDG_*_HOME`
210
-
211
- These variables take precidence over the corresponding `$XDG_*_DIRS` environment variables. Using a
212
- modified version of the `$XDG_*_DIRS` example, shown above, we could have the following setup:
213
-
214
- XDG_CONFIG_HOME="/example/priority"
215
- XDG_CONFIG_DIRS="/example/one/.config:/example/two/.settings"
216
-
217
- # Yields the following, colon delimited, array:
218
- [
219
- "/example/priority",
220
- "/example/one/.config",
221
- "/example/two/.settings"
222
- ]
223
-
224
- Due to `XDG_CONFIG_HOME` taking precidence over the `XDG_CONFIG_DIRS`, the path with the *highest*
225
- priority in this example is: `"/example/priority"`.
226
-
227
- #### Variable Priority
228
-
229
- Path precedence is determined in the following order (with the first taking highest priority):
230
-
231
- 1. `$XDG_*_HOME` - Will be used if defined. Otherwise, falls back to specification default.
232
- 1. `$XDG_*_DIRS` - Iterates through directories in order defined (with first taking highest
233
- priority). Otherwise, falls back to specification default.
234
-
235
- ## Tests
236
-
237
- To test, run:
238
-
239
- bundle exec rake
240
-
241
- ## Versioning
242
-
243
- Read [Semantic Versioning](https://semver.org) for details. Briefly, it means:
244
-
245
- - Major (X.y.z) - Incremented for any backwards incompatible public API changes.
246
- - Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
247
- - Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.
248
-
249
- ## Code of Conduct
250
-
251
- Please note that this project is released with a [CODE OF CONDUCT](CODE_OF_CONDUCT.md). By
252
- participating in this project you agree to abide by its terms.
253
-
254
- ## Contributions
255
-
256
- Read [CONTRIBUTING](CONTRIBUTING.md) for details.
257
-
258
- ## License
259
-
260
- Copyright 2019 [Alchemists](https://www.alchemists.io).
261
- Read [LICENSE](LICENSE.md) for details.
262
-
263
- ## History
264
-
265
- Read [CHANGES](CHANGES.md) for details.
266
- Built with [Gemsmith](https://github.com/bkuhlmann/gemsmith).
267
-
268
- ## Credits
269
-
270
- Developed by [Brooke Kuhlmann](https://www.alchemists.io) at
271
- [Alchemists](https://www.alchemists.io).