maid-xdg 2.2.1.1 → 2.2.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.
- data/.gitignore +17 -0
- data/.travis.yml +11 -0
- data/.yardopts +6 -0
- data/Assembly +39 -0
- data/COPYING.rdoc +31 -0
- data/DEMO.rdoc +144 -0
- data/Gemfile +2 -0
- data/HISTORY.rdoc +138 -0
- data/LICENSE.txt +5 -0
- data/MANIFEST +29 -0
- data/README.rdoc +146 -0
- data/Rakefile +40 -0
- data/demo/01_base_dir.rdoc +77 -0
- data/demo/02_base_dir_extended.rdoc +47 -0
- data/demo/03_base_dir_mixin.rdoc +17 -0
- data/demo/applique/ae.rb +1 -0
- data/demo/applique/fakeroot.rb +17 -0
- data/demo/applique/xdg.rb +1 -0
- data/demo/fixtures/fakeroot/.cache/DUMMY.txt +1 -0
- data/demo/fixtures/fakeroot/etc/xdg/bar.config +1 -0
- data/demo/fixtures/fakeroot/home/.cache/foo.cache +1 -0
- data/demo/fixtures/fakeroot/home/.local/share/foo.dat +1 -0
- data/demo/fixtures/fakeroot/home/joe/foo.txt +1 -0
- data/demo/fixtures/fakeroot/usr/share/bar.dat +1 -0
- data/lib/xdg.rb +46 -0
- data/lib/xdg/base_dir.rb +256 -0
- data/lib/xdg/base_dir/extended.rb +20 -0
- data/lib/xdg/base_dir/global_variables.rb +18 -0
- data/lib/xdg/base_dir/legacy.rb +72 -0
- data/lib/xdg/base_dir/mixin.rb +84 -0
- data/lib/xdg/version.rb +3 -0
- data/test/fakeroot/.cache/DUMMY.txt +1 -0
- data/test/fakeroot/etc/xdg/bar.config +1 -0
- data/test/fakeroot/home/.cache/foo.cache +1 -0
- data/test/fakeroot/home/.local/share/foo.dat +1 -0
- data/test/fakeroot/usr/share/bar.dat +1 -0
- data/test/test_xdg_legacy.rb +117 -0
- data/xdg.gemspec +22 -0
- metadata +52 -8
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/.yardopts
ADDED
data/Assembly
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
---
|
2
|
+
email:
|
3
|
+
mailto:
|
4
|
+
- ruby-talk@ruby-lang.org
|
5
|
+
- rubyworks-mailinglist@googlegroups.com
|
6
|
+
|
7
|
+
qed:
|
8
|
+
files: demo
|
9
|
+
|
10
|
+
qedoc:
|
11
|
+
files: demo
|
12
|
+
title: XDG Demonstrations
|
13
|
+
output: DEMO.rdoc
|
14
|
+
|
15
|
+
gem:
|
16
|
+
active: true
|
17
|
+
|
18
|
+
github:
|
19
|
+
gh_pages: web
|
20
|
+
|
21
|
+
yard:
|
22
|
+
active: true
|
23
|
+
|
24
|
+
dnote:
|
25
|
+
output: log/notes.html
|
26
|
+
|
27
|
+
vclog:
|
28
|
+
output:
|
29
|
+
- log/history.html
|
30
|
+
- log/changes.html
|
31
|
+
|
32
|
+
|
33
|
+
# boy is this outdated ;)
|
34
|
+
#rubyforge:
|
35
|
+
# service : Rubyforge
|
36
|
+
# unixname : xdg
|
37
|
+
# groupid : 7077
|
38
|
+
# active : false
|
39
|
+
|
data/COPYING.rdoc
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
= COPYRIGHT NOTICES
|
2
|
+
|
3
|
+
== XDG
|
4
|
+
|
5
|
+
Copyright:: (c) 2008 Rubyworks
|
6
|
+
License:: BSD-2-Clause
|
7
|
+
Website:: http://rubyworks.github.com/xdg
|
8
|
+
|
9
|
+
Copyright 2008 Rubyworks. All rights reserved.
|
10
|
+
|
11
|
+
Redistribution and use in source and binary forms, with or without
|
12
|
+
modification, are permitted provided that the following conditions are met:
|
13
|
+
|
14
|
+
1. Redistributions of source code must retain the above copyright notice,
|
15
|
+
this list of conditions and the following disclaimer.
|
16
|
+
|
17
|
+
2. Redistributions in binary form must reproduce the above copyright
|
18
|
+
notice, this list of conditions and the following disclaimer in the
|
19
|
+
documentation and/or other materials provided with the distribution.
|
20
|
+
|
21
|
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
22
|
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
23
|
+
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
24
|
+
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
25
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
26
|
+
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
27
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
28
|
+
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
29
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
30
|
+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
+
|
data/DEMO.rdoc
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
= XDG Base Directory Standard
|
2
|
+
|
3
|
+
The 2.0 API is much a great deal more concise than the original
|
4
|
+
0.0+ and 1.0+ APIs. It consists primarily of a single
|
5
|
+
interface method `XDG[]`. Yet all the functionality of the older
|
6
|
+
API remain and then some.
|
7
|
+
|
8
|
+
First we need to require the library.
|
9
|
+
|
10
|
+
require 'xdg'
|
11
|
+
|
12
|
+
In the applique we have setup a fake root directory with
|
13
|
+
coorepsonding environment settings to use as test fixtures.
|
14
|
+
|
15
|
+
== Data Paths
|
16
|
+
|
17
|
+
=== Home
|
18
|
+
|
19
|
+
XDG['DATA_HOME'].environment.assert == ENV['XDG_DATA_HOME'].to_s
|
20
|
+
XDG['DATA_HOME'].environment_variables.assert == ['XDG_DATA_HOME']
|
21
|
+
|
22
|
+
Looking at the data home location by default it should be point to
|
23
|
+
our joe user's home directory under `.local/share`.
|
24
|
+
|
25
|
+
XDG['DATA_HOME'].to_a.assert == [$froot + 'home/joe/.local/share']
|
26
|
+
|
27
|
+
=== Dirs
|
28
|
+
|
29
|
+
XDG['DATA_DIRS'].environment.assert == ENV['XDG_DATA_DIRS'].to_s
|
30
|
+
XDG['DATA_DIRS'].environment_variables.assert == ['XDG_DATA_DIRS']
|
31
|
+
|
32
|
+
Looking at the system data locations
|
33
|
+
|
34
|
+
XDG['DATA_DIRS'].to_a.assert == [$froot + 'usr/share']
|
35
|
+
|
36
|
+
=== Combined
|
37
|
+
|
38
|
+
XDG['DATA'].environment_variables.assert == ['XDG_DATA_HOME', 'XDG_DATA_DIRS']
|
39
|
+
|
40
|
+
Lookking at both data location combined
|
41
|
+
|
42
|
+
XDG['DATA'].to_a.assert == [$froot + 'home/joe/.local/share', $froot + 'usr/share']
|
43
|
+
|
44
|
+
|
45
|
+
== Config Paths
|
46
|
+
|
47
|
+
=== Home
|
48
|
+
|
49
|
+
XDG['CONFIG_HOME'].environment.assert == ENV['XDG_CONFIG_HOME'].to_s
|
50
|
+
XDG['CONFIG_HOME'].to_a.assert == [$froot + 'home/joe/.config']
|
51
|
+
|
52
|
+
=== Dirs
|
53
|
+
|
54
|
+
XDG['CONFIG_DIRS'].environment.assert == ENV['XDG_CONFIG_DIRS'].to_s
|
55
|
+
XDG['CONFIG_DIRS'].to_a.assert == [$froot + 'etc/xdg', $froot + 'etc']
|
56
|
+
|
57
|
+
=== Combined
|
58
|
+
|
59
|
+
XDG['CONFIG'].to_a.assert == [$froot + 'home/joe/.config', $froot + 'etc/xdg', $froot + 'etc']
|
60
|
+
|
61
|
+
|
62
|
+
== Cache Paths
|
63
|
+
|
64
|
+
=== Home
|
65
|
+
|
66
|
+
XDG['CACHE_HOME'].environment.assert == ENV['XDG_CACHE_HOME'].to_s
|
67
|
+
XDG['CACHE_HOME'].to_a.assert == [$froot + 'home/joe/.cache']
|
68
|
+
|
69
|
+
=== Dirs
|
70
|
+
|
71
|
+
XDG['CACHE_DIRS'].environment.assert == ENV['XDG_CACHE_DIRS'].to_s
|
72
|
+
XDG['CACHE_DIRS'].to_a.assert == [$froot + 'tmp']
|
73
|
+
|
74
|
+
=== Combined
|
75
|
+
|
76
|
+
XDG['CACHE'].to_a.assert == [$froot + 'home/joe/.cache', $froot + 'tmp']
|
77
|
+
|
78
|
+
|
79
|
+
= Extended Base Directory Standard
|
80
|
+
|
81
|
+
The extended base directory standard provides additional locations
|
82
|
+
not apart the offical standard. These are somewhat experimental.
|
83
|
+
|
84
|
+
== Resource
|
85
|
+
|
86
|
+
XDG['RESOURCE_HOME'].environment.assert == ENV['XDG_RESOURCE_HOME'].to_s
|
87
|
+
|
88
|
+
XDG['RESOURCE_HOME'].environment_variables.assert == ['XDG_RESOURCE_HOME']
|
89
|
+
|
90
|
+
Looking at the data home location by default it should be pointing to
|
91
|
+
our joe users home directory under `.local`.
|
92
|
+
|
93
|
+
XDG['RESOURCE_HOME'].list.assert == ['~/.local']
|
94
|
+
|
95
|
+
XDG['RESOURCE_HOME'].to_a.assert == [$froot + 'home/joe/.local']
|
96
|
+
|
97
|
+
|
98
|
+
== Work
|
99
|
+
|
100
|
+
The working configuration directory
|
101
|
+
|
102
|
+
XDG['CONFIG_WORK'].environment.assert == ENV['XDG_CONFIG_WORK'].to_s
|
103
|
+
|
104
|
+
XDG['CONFIG_WORK'].environment_variables.assert == ['XDG_CONFIG_WORK']
|
105
|
+
|
106
|
+
Looking at the config work location, by default it should be pointing to
|
107
|
+
the current working directorys `.config` or `config` directory.
|
108
|
+
|
109
|
+
XDG['CONFIG_WORK'].list.assert == ['.config', 'config']
|
110
|
+
|
111
|
+
XDG['CONFIG_WORK'].to_a.assert == [Dir.pwd + '/.config', Dir.pwd + '/config']
|
112
|
+
|
113
|
+
The working cache directory
|
114
|
+
|
115
|
+
XDG['CACHE_WORK'].environment.assert == ENV['XDG_CACHE_WORK'].to_s
|
116
|
+
|
117
|
+
XDG['CACHE_WORK'].environment_variables.assert == ['XDG_CACHE_WORK']
|
118
|
+
|
119
|
+
Looking at the cache work location, by default it should be pointing to
|
120
|
+
the current working directorys `.tmp` or `tmp` directory.
|
121
|
+
|
122
|
+
XDG['CACHE_WORK'].list.assert == ['.tmp', 'tmp']
|
123
|
+
|
124
|
+
XDG['CACHE_WORK'].to_a.assert == [Dir.pwd + '/.tmp', Dir.pwd + '/tmp']
|
125
|
+
|
126
|
+
|
127
|
+
= Base Directory Mixin
|
128
|
+
|
129
|
+
The base directory mixin is used to easy augment a class for
|
130
|
+
access to a named subdirectory of the XDG directories.
|
131
|
+
|
132
|
+
class MyAppConfig
|
133
|
+
include XDG::BaseDir::Mixin
|
134
|
+
|
135
|
+
def subdirectory
|
136
|
+
'myapp'
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
c = MyAppConfig.new
|
141
|
+
|
142
|
+
c.config.home.to_a #=> [$froot + 'home/joe/.config/myapp']
|
143
|
+
|
144
|
+
|
data/Gemfile
ADDED
data/HISTORY.rdoc
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
= RELEASE HISTORY
|
2
|
+
|
3
|
+
== 2.2.2 / 2011-10-30
|
4
|
+
|
5
|
+
Just a maintenance release to bring the build configuration
|
6
|
+
up to date. Also, change license to BSD-2-Clause.
|
7
|
+
|
8
|
+
Changes:
|
9
|
+
|
10
|
+
* Modernize build configuration
|
11
|
+
* Switch to BSD-2-Clause license.
|
12
|
+
|
13
|
+
|
14
|
+
== 2.2.1 / 2011-06-11
|
15
|
+
|
16
|
+
This release changes BaseDir#to_s to return the first directory
|
17
|
+
entry, and moves the old #to_s to #environment_with_defaults
|
18
|
+
with an alias of #env. The old #env now being called #environment.
|
19
|
+
|
20
|
+
Changes:
|
21
|
+
|
22
|
+
* Rename #env to #environment.
|
23
|
+
* Rename #to_s to #environment_with_defaults.
|
24
|
+
* Modify #to_s to return first directory.
|
25
|
+
|
26
|
+
|
27
|
+
== 2.1.0 / 2011-06-09
|
28
|
+
|
29
|
+
This release changes the BaseDir#list method, where as it used
|
30
|
+
to be an alias for #to_a, it now differs in that it does not
|
31
|
+
expand the paths. In addtion a few tests were fixed and version
|
32
|
+
number properly updated int hte version.rb file.
|
33
|
+
|
34
|
+
Changes:
|
35
|
+
|
36
|
+
* Change BaseDir#list to not expand paths.
|
37
|
+
* Properly assign VERSION constant.
|
38
|
+
* Fix broken qed tests.
|
39
|
+
|
40
|
+
|
41
|
+
== 2.0.0 / 2011-06-09
|
42
|
+
|
43
|
+
Major new release is full rewrite of the API, with an eye out for
|
44
|
+
support future XDG standards beyond the base directories. The
|
45
|
+
new API uses a single point of entry `XDG[]` (a shortcut for
|
46
|
+
`XDG::BaseDir[]`).
|
47
|
+
|
48
|
+
Changes:
|
49
|
+
|
50
|
+
* Complete rewrite of API.
|
51
|
+
* Utilize single point of entry interface.
|
52
|
+
* Structure project for future support of more of XDG.
|
53
|
+
|
54
|
+
|
55
|
+
== 1.0.0 / 2009-12-01
|
56
|
+
|
57
|
+
This is major reimplementation of the XDG API to be more flexiable
|
58
|
+
and object-oriented. Instead of a single module with every
|
59
|
+
needed method, the system is devided up into sub-modules, one for
|
60
|
+
each set of XDG locations. So, for example, instead of "XDG.data_dirs"
|
61
|
+
you use "XDG::Data.dirs" or "XDG.data.dirs".
|
62
|
+
|
63
|
+
Changes:
|
64
|
+
|
65
|
+
* Reworked API and underlying implementation to be more OOP-style.
|
66
|
+
* Began work on xdg/extended.rb, exploring future proposals.
|
67
|
+
* Provides xdg/compat.rb, for backward compatabilty (temporary).
|
68
|
+
|
69
|
+
|
70
|
+
== 0.5.2 / 2009-05-30
|
71
|
+
|
72
|
+
This release requires rbconfig.rb and uses system entries in place of
|
73
|
+
some hardcoded FHS locations.
|
74
|
+
|
75
|
+
Changes:
|
76
|
+
|
77
|
+
* Replaced hardcoded system directories with rbconfig entries.
|
78
|
+
|
79
|
+
|
80
|
+
== 0.5.1 / 2008-11-17
|
81
|
+
|
82
|
+
Changes:
|
83
|
+
|
84
|
+
* Fixed data work directory is '.local', not '.share'
|
85
|
+
* Deprecated #data_work
|
86
|
+
|
87
|
+
|
88
|
+
== 0.5.0 / 2008-10-28
|
89
|
+
|
90
|
+
Changes:
|
91
|
+
|
92
|
+
* Changed _glob to _select
|
93
|
+
|
94
|
+
|
95
|
+
== 0.4.0 / 2008-10-26
|
96
|
+
|
97
|
+
This release removes the xdg_ prefix from the instance-level
|
98
|
+
method names. Now module and instance levels are the same.
|
99
|
+
|
100
|
+
Also, data_file, config_file and cache_file have been replaced with
|
101
|
+
data_find, config_find, cache_find, data_glob, config_glob and
|
102
|
+
cache_glob.
|
103
|
+
|
104
|
+
What's next? Well, I can't say I'm fond of the term 'glob', so I
|
105
|
+
may rename that to 'map' or 'collect' (or 'select'?) and then
|
106
|
+
add the ability to use blocks for matching too.
|
107
|
+
|
108
|
+
Changes:
|
109
|
+
|
110
|
+
* Renamed instance level methods without 'xdg_' prefix.
|
111
|
+
* Replace _file methods with _find and _glob methods.
|
112
|
+
* Prepare for v0.4 release
|
113
|
+
* Remove some old commented-out code
|
114
|
+
* Fixed data_find and data_glob
|
115
|
+
* Update RELEASE file
|
116
|
+
* Updated documentation for 0.4 release
|
117
|
+
* Added MANIFEST to .gitignore
|
118
|
+
* Correction or RELEASE
|
119
|
+
* Fixed plural in RELEASE file
|
120
|
+
|
121
|
+
|
122
|
+
== 0.3.0 / 2008-10-11
|
123
|
+
|
124
|
+
Changes:
|
125
|
+
|
126
|
+
* Removed xdg_ prefix from module methods
|
127
|
+
* Moved web/index.html to doc directory
|
128
|
+
* Updated reap serives
|
129
|
+
* Prepare for next release
|
130
|
+
* Fixed issue of xdg_ prefix still being used internally
|
131
|
+
|
132
|
+
|
133
|
+
== 0.1.0 / 2008-09-27
|
134
|
+
|
135
|
+
Changes:
|
136
|
+
|
137
|
+
* Started project
|
138
|
+
|
data/LICENSE.txt
ADDED
data/MANIFEST
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!mast .ruby .yardopts bin lib man qed spec test [A-Z]*.*
|
2
|
+
.ruby
|
3
|
+
lib/xdg/base_dir/extended.rb
|
4
|
+
lib/xdg/base_dir/global_variables.rb
|
5
|
+
lib/xdg/base_dir/legacy.rb
|
6
|
+
lib/xdg/base_dir/mixin.rb
|
7
|
+
lib/xdg/base_dir.rb
|
8
|
+
lib/xdg/version.rb
|
9
|
+
lib/xdg.rb
|
10
|
+
qed/01_base_dir.rdoc
|
11
|
+
qed/02_base_dir_extended.rdoc
|
12
|
+
qed/03_base_dir_mixin.rdoc
|
13
|
+
qed/applique/ae.rb
|
14
|
+
qed/applique/fakeroot.rb
|
15
|
+
qed/fixtures/fakeroot/etc/xdg/bar.config
|
16
|
+
qed/fixtures/fakeroot/home/.cache/foo.cache
|
17
|
+
qed/fixtures/fakeroot/home/.config/foo.config
|
18
|
+
qed/fixtures/fakeroot/home/.local/share/foo.dat
|
19
|
+
qed/fixtures/fakeroot/home/joe/foo.txt
|
20
|
+
qed/fixtures/fakeroot/usr/share/bar.dat
|
21
|
+
test/fakeroot/etc/xdg/bar.config
|
22
|
+
test/fakeroot/home/.cache/foo.cache
|
23
|
+
test/fakeroot/home/.config/foo.config
|
24
|
+
test/fakeroot/home/.local/share/foo.dat
|
25
|
+
test/fakeroot/usr/share/bar.dat
|
26
|
+
test/test_xdg_legacy.rb
|
27
|
+
HISTORY.rdoc
|
28
|
+
APACHE2.txt
|
29
|
+
README.rdoc
|
data/README.rdoc
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
= XDG Standards for Ruby
|
2
|
+
|
3
|
+
{Homepage}[http://rubyworks.github.com/xdg] |
|
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]
|
8
|
+
|
9
|
+
{<img src="http://travis-ci.org/rubyworks/xdg.png" />}[http://travis-ci.org/rubyworks/xdg]
|
10
|
+
|
11
|
+
|
12
|
+
== Introduction
|
13
|
+
|
14
|
+
XDG provides an easy to use Ruby library for working with XDG standards.
|
15
|
+
|
16
|
+
Presently, it only supports the XDG Base Directory Standard.
|
17
|
+
|
18
|
+
If your program utilizes user or system-wide support files
|
19
|
+
(e.g. configuration files), you owe it to yourself to checkout
|
20
|
+
the XDG base directory standard.
|
21
|
+
|
22
|
+
You can learn more about the standard at:
|
23
|
+
http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
24
|
+
|
25
|
+
|
26
|
+
== How to Use
|
27
|
+
|
28
|
+
For working with XDG base directories, XDG provides a very simple
|
29
|
+
yet flexible interface, `XDG[]`. Let's say you want to work
|
30
|
+
with the $XDG_CONFIG_HOME directory. Simply use:
|
31
|
+
|
32
|
+
XDG['CONFIG_HOME']
|
33
|
+
|
34
|
+
This will give you access to a number of useful methods all tied
|
35
|
+
into the user's personal configuration directory. Some examples:
|
36
|
+
|
37
|
+
XDG['CONFIG_HOME'].glob(pattern)
|
38
|
+
XDG['CONFIG_HOME'].select(pattern){ |path| ... }
|
39
|
+
XDG['CONFIG_HOME'].find(pattern){ |path| ... }
|
40
|
+
|
41
|
+
The same holds true for the other base directories.
|
42
|
+
|
43
|
+
XDG['DATA_HOME']
|
44
|
+
XDG['DATA_DIRS']
|
45
|
+
|
46
|
+
XDG['CACHE_HOME']
|
47
|
+
XDG['CACHE_DIRS']
|
48
|
+
|
49
|
+
By leaving out the last qualifier, XDG will provide an interface
|
50
|
+
that ties into both the `HOME` and `DIRS` paths.
|
51
|
+
|
52
|
+
XDG['DATA']
|
53
|
+
XDG['CONFIG']
|
54
|
+
XDG['CACHE']
|
55
|
+
|
56
|
+
If you know XDG these are pretty much self-explanatory.
|
57
|
+
But see the YARD-based API documentation for further specifics.
|
58
|
+
|
59
|
+
=== Extended Functionality
|
60
|
+
|
61
|
+
The Ruby XDG module also provides extended functionality
|
62
|
+
not part of the standard specification. These extensions are
|
63
|
+
simply add-on functionality deemed useful, or implementations
|
64
|
+
of proposals being discussed for a possible future version of
|
65
|
+
the standard.
|
66
|
+
|
67
|
+
XDG['CONFIG_WORK']
|
68
|
+
XDG['CACHE_WORK']
|
69
|
+
|
70
|
+
See the API documentation to learn more. Note that the extended modules
|
71
|
+
are subject to greater potential for change as they are still being refined.
|
72
|
+
|
73
|
+
=== Base Directory Mixin
|
74
|
+
|
75
|
+
XDG provides a convenient base directory mixin that can provide handy a
|
76
|
+
interface to a classes.
|
77
|
+
|
78
|
+
class MyAppConfig
|
79
|
+
include XDG::BaseDir::Mixin
|
80
|
+
|
81
|
+
def subdirectory
|
82
|
+
'myapp'
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
c = MyAppConfig.new
|
87
|
+
|
88
|
+
c.config.home.to_s #=> '~/.config/myapp'
|
89
|
+
|
90
|
+
|
91
|
+
=== Legacy API
|
92
|
+
|
93
|
+
Version 2.0+ of library marks a major departure from the earlier
|
94
|
+
"fluid" notation of previous releases. Where as one used to do:
|
95
|
+
|
96
|
+
XDG.data.home
|
97
|
+
|
98
|
+
With the new API one now does:
|
99
|
+
|
100
|
+
XDG['DATA_HOME']
|
101
|
+
|
102
|
+
This was done for a few reasons, but primarily because it reflects more
|
103
|
+
closely Ruby's interface to the environment variables themselves, e.g.
|
104
|
+
|
105
|
+
ENV['XDG_DATA_HOME']
|
106
|
+
|
107
|
+
If you prefer the older style, a compatibility layer is provided. You will
|
108
|
+
need to load:
|
109
|
+
|
110
|
+
require 'xdg/base_dir/legacy'
|
111
|
+
|
112
|
+
However we STRONGLY RECOMMEND that you do not use the legacy API --use it only
|
113
|
+
if you need to keep some old code working and don't have time to update it at
|
114
|
+
the moment. Sometime in the future the legacy API will be deprecated.
|
115
|
+
|
116
|
+
|
117
|
+
== How to Install
|
118
|
+
|
119
|
+
Using RubyGems:
|
120
|
+
|
121
|
+
$ sudo gem install xdg
|
122
|
+
|
123
|
+
Installing the tarball requires Ruby Setup (see http://rubyworks.github.com/setup).
|
124
|
+
|
125
|
+
$ tar -xvzf xdg-0.5.2
|
126
|
+
$ cd xdg-0.5.2
|
127
|
+
$ sudo setup.rb all
|
128
|
+
|
129
|
+
|
130
|
+
== Development
|
131
|
+
|
132
|
+
GitHub[http://github.com] hosts our {source code}[http://github.com/rubyworks/xdg]
|
133
|
+
and {issue ticket system}[http://github.com/rubyworks/xdg/issues].
|
134
|
+
|
135
|
+
To contribute to the project please fork the repository, ideally, create a new
|
136
|
+
topic branch for your work, and submit a pull request.
|
137
|
+
|
138
|
+
|
139
|
+
== Copyright & License
|
140
|
+
|
141
|
+
Copyright (c) 2008 Rubyworks
|
142
|
+
|
143
|
+
Distributed under the terms of the *FreeBSD* license.
|
144
|
+
|
145
|
+
See COPYING.rdoc file for details.
|
146
|
+
|