xdg 1.0.0 → 2.0.0
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/.ruby +33 -0
- data/APACHE2.txt +204 -0
- data/{HISTORY → HISTORY.rdoc} +14 -0
- data/README.rdoc +149 -0
- data/lib/xdg.rb +16 -228
- data/lib/xdg/base_dir.rb +220 -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/qed/01_base_dir.rdoc +77 -0
- data/qed/02_base_dir_extended.rb +39 -0
- data/qed/03_base_dir_mixin.rb +19 -0
- data/qed/applique/fakeroot.rb +15 -0
- data/qed/fixtures/fakeroot/etc/xdg/bar.config +1 -0
- data/qed/fixtures/fakeroot/home/.cache/foo.cache +1 -0
- data/qed/fixtures/fakeroot/home/.config/foo.config +1 -0
- data/qed/fixtures/fakeroot/home/.local/share/foo.dat +1 -0
- data/qed/fixtures/fakeroot/home/joe/foo.txt +1 -0
- data/qed/fixtures/fakeroot/usr/share/bar.dat +1 -0
- data/test/{test_xdg.rb → test_xdg_legacy.rb} +6 -4
- metadata +49 -41
- data/COPYING +0 -789
- data/MANIFEST +0 -24
- data/README +0 -97
- data/lib/xdg/compat.rb +0 -66
- data/lib/xdg/extended.rb +0 -84
- data/meta/authors +0 -1
- data/meta/collection +0 -1
- data/meta/contact +0 -1
- data/meta/description +0 -2
- data/meta/homepage +0 -1
- data/meta/name +0 -1
- data/meta/repository +0 -1
- data/meta/summary +0 -1
- data/meta/title +0 -1
- data/meta/version +0 -1
- data/script/test +0 -4
data/MANIFEST
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
#!mast bin lib meta script test [A-Z]*
|
2
|
-
lib/xdg/compat.rb
|
3
|
-
lib/xdg/extended.rb
|
4
|
-
lib/xdg.rb
|
5
|
-
meta/authors
|
6
|
-
meta/collection
|
7
|
-
meta/contact
|
8
|
-
meta/description
|
9
|
-
meta/homepage
|
10
|
-
meta/name
|
11
|
-
meta/repository
|
12
|
-
meta/summary
|
13
|
-
meta/title
|
14
|
-
meta/version
|
15
|
-
script/test
|
16
|
-
test/fakeroot/etc/xdg/bar.config
|
17
|
-
test/fakeroot/home/.cache/foo.cache
|
18
|
-
test/fakeroot/home/.config/foo.config
|
19
|
-
test/fakeroot/home/.local/share/foo.dat
|
20
|
-
test/fakeroot/usr/share/bar.dat
|
21
|
-
test/test_xdg.rb
|
22
|
-
README
|
23
|
-
HISTORY
|
24
|
-
COPYING
|
data/README
DELETED
@@ -1,97 +0,0 @@
|
|
1
|
-
= XDG Base Directory Standard for Ruby
|
2
|
-
|
3
|
-
* http://rubyworks.github.com/xdg
|
4
|
-
* http://github.com/rubyworks/xdg
|
5
|
-
|
6
|
-
== Introduction
|
7
|
-
|
8
|
-
XDG provides an easy to use module for utilizing the XDG Base
|
9
|
-
Directory Standard[1].
|
10
|
-
|
11
|
-
If your program utilizes user or system-wide support files
|
12
|
-
(eg. configuration files), you owe it to yourself to checkout
|
13
|
-
the XDG standard.
|
14
|
-
|
15
|
-
[1]http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html
|
16
|
-
|
17
|
-
|
18
|
-
== HOW TO USE
|
19
|
-
|
20
|
-
XDG consists of a small set of modules, one for each XDG directory. Each of
|
21
|
-
these has a small base set of easy to use methods.
|
22
|
-
|
23
|
-
XDG::Config.home
|
24
|
-
XDG::Config.dirs
|
25
|
-
XDG::Config.find(pattern){ |path| ... }
|
26
|
-
XDG::Config.search(pattern){ |path| ... }
|
27
|
-
|
28
|
-
XDG::Data.home
|
29
|
-
XDG::Data.dirs
|
30
|
-
XDG::Data.find(pattern){ |path| ... }
|
31
|
-
XDG::Data.search(pattern){ |path| ... }
|
32
|
-
|
33
|
-
XDG::Cache.home
|
34
|
-
XDG::Cache.find(pattern){ |path| ... }
|
35
|
-
XDG::Cache.search(pattern){ |path| ... }
|
36
|
-
|
37
|
-
XDG can also access these modules via methods.
|
38
|
-
|
39
|
-
XDG.config.home
|
40
|
-
XDG.config.dirs
|
41
|
-
XDG.config.find(pattern){ |path| ... }
|
42
|
-
XDG.config.search(pattern){ |path| ... }
|
43
|
-
|
44
|
-
XDG.data.home
|
45
|
-
XDG.data.dirs
|
46
|
-
XDG.data.find(pattern){ |path| ... }
|
47
|
-
XDG.data.search(pattern){ |path| ... }
|
48
|
-
|
49
|
-
XDG.cache.home
|
50
|
-
XDG.cache.find(pattern){ |path| ... }
|
51
|
-
XDG.cache.search(pattern){ |path| ... }
|
52
|
-
|
53
|
-
If you know XDG these are pretty much self-explanitory.
|
54
|
-
But see the RDocs for specifics.
|
55
|
-
|
56
|
-
=== Extended Functionality
|
57
|
-
|
58
|
-
The Ruby XDG module also provides extended functionality
|
59
|
-
not part of the standard specification. These extensions are
|
60
|
-
simply add-on funcitonality deemed useful, or implementations
|
61
|
-
of proposals being discussed for a possible future version of
|
62
|
-
the standard.
|
63
|
-
|
64
|
-
require 'xdg/extended'
|
65
|
-
|
66
|
-
XDG.config.work
|
67
|
-
XDG.cache.work
|
68
|
-
|
69
|
-
See the API for the extended.rb, to learn more. Note that
|
70
|
-
the extended modules are subject to great change of change
|
71
|
-
as they are still being designed.
|
72
|
-
|
73
|
-
|
74
|
-
== HOW TO INSTALL
|
75
|
-
|
76
|
-
Using RubyGems:
|
77
|
-
|
78
|
-
$ sudo gem install xdg
|
79
|
-
|
80
|
-
Installing the tarball requires Ruby Setup (see http://proutils.github.com/setup).
|
81
|
-
|
82
|
-
$ tar -xvzf xdg-0.5.2
|
83
|
-
$ cd xdg-0.5.2
|
84
|
-
$ sudo setup.rb all
|
85
|
-
|
86
|
-
|
87
|
-
== DEVELOPMENT
|
88
|
-
|
89
|
-
Visit http://github.com/proutils/xdg
|
90
|
-
|
91
|
-
|
92
|
-
== COPYRIGHT
|
93
|
-
|
94
|
-
Copyright (c) 2008, 2009 Thomas Sawyer
|
95
|
-
Distributed under the terms of the LGPL v3 license.
|
96
|
-
See COPYING file for details.
|
97
|
-
|
data/lib/xdg/compat.rb
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
module XDG
|
2
|
-
|
3
|
-
def data_home
|
4
|
-
data.home
|
5
|
-
end
|
6
|
-
|
7
|
-
def config_home
|
8
|
-
config.home
|
9
|
-
end
|
10
|
-
|
11
|
-
def cache_home
|
12
|
-
cache.home
|
13
|
-
end
|
14
|
-
|
15
|
-
|
16
|
-
def data_dirs
|
17
|
-
data.home
|
18
|
-
end
|
19
|
-
|
20
|
-
def config_dirs
|
21
|
-
config.dirs
|
22
|
-
end
|
23
|
-
|
24
|
-
#def cache_dirs
|
25
|
-
# cache.dirs
|
26
|
-
#end
|
27
|
-
|
28
|
-
|
29
|
-
def data_select(*args, &block)
|
30
|
-
data.select(*args, &block)
|
31
|
-
end
|
32
|
-
|
33
|
-
def config_select(*args, &block)
|
34
|
-
config.select(*args, &block)
|
35
|
-
end
|
36
|
-
|
37
|
-
def cache_select(*args, &block)
|
38
|
-
cache.select(*args, &block)
|
39
|
-
end
|
40
|
-
|
41
|
-
|
42
|
-
def data_find(*args, &block)
|
43
|
-
data.find(*args, &block)
|
44
|
-
end
|
45
|
-
|
46
|
-
def config_find(*args, &block)
|
47
|
-
config.find(*args, &block)
|
48
|
-
end
|
49
|
-
|
50
|
-
def cache_find(*args, &block)
|
51
|
-
cache.find(*args, &block)
|
52
|
-
end
|
53
|
-
|
54
|
-
|
55
|
-
def config_work
|
56
|
-
config.work
|
57
|
-
end
|
58
|
-
|
59
|
-
def cache_work
|
60
|
-
cache.work
|
61
|
-
end
|
62
|
-
|
63
|
-
end
|
64
|
-
|
65
|
-
# Copyright (c) 2008,2009 Thomas Sawyer
|
66
|
-
# Distributed under the terms of the LGPL v3.
|
data/lib/xdg/extended.rb
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
require 'xdg'
|
2
|
-
|
3
|
-
module XDG
|
4
|
-
|
5
|
-
# Access to resource locations.
|
6
|
-
#
|
7
|
-
# XDG.resource.each{ |dir| ... }
|
8
|
-
#
|
9
|
-
def resource(*glob_and_flags, &block)
|
10
|
-
if !glob_and_flags.empty? or block_given?
|
11
|
-
Resource.select(*glob_and_flags, &block)
|
12
|
-
else
|
13
|
-
Resource
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
# = USER RESOURCES
|
18
|
-
#
|
19
|
-
module Resource
|
20
|
-
include Common
|
21
|
-
|
22
|
-
# Location of personal resource directory.
|
23
|
-
def home
|
24
|
-
@home ||= (
|
25
|
-
File.expand_path(
|
26
|
-
ENV['XDG_RESOURCE_HOME'] || File.join(XDG.home, '.local')
|
27
|
-
)
|
28
|
-
)
|
29
|
-
end
|
30
|
-
|
31
|
-
# List of common user directores.
|
32
|
-
def dirs
|
33
|
-
@dirs ||= (
|
34
|
-
dirs = ENV['XDG_RESOURCE_DIRS'].split(/[:;]/)
|
35
|
-
if dirs.empty?
|
36
|
-
dirs = ['/usr/local', '/usr']
|
37
|
-
end
|
38
|
-
dirs = dirs.map{ |d| File.expand_path(d) }.uniq
|
39
|
-
dirs = dirs.select{ |d| File.directory?(d) }
|
40
|
-
dirs
|
41
|
-
)
|
42
|
-
end
|
43
|
-
|
44
|
-
extend self
|
45
|
-
end
|
46
|
-
|
47
|
-
module Config
|
48
|
-
|
49
|
-
# Location of working config directory.
|
50
|
-
#
|
51
|
-
# This is not not strictly XDG spec, but it
|
52
|
-
# can be useful in an analogous respect.
|
53
|
-
#
|
54
|
-
def work
|
55
|
-
@work ||= (
|
56
|
-
File.expand_path(
|
57
|
-
File.join(Dir.pwd, '.config')
|
58
|
-
)
|
59
|
-
)
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
63
|
-
|
64
|
-
module Cache
|
65
|
-
|
66
|
-
# Location of working cache directory.
|
67
|
-
#
|
68
|
-
# This is not strictly XDG spec, but it
|
69
|
-
# can be useful in an analogous respect.
|
70
|
-
#
|
71
|
-
def work
|
72
|
-
@work ||= (
|
73
|
-
File.expand_path(
|
74
|
-
File.join(Dir.pwd, '.cache')
|
75
|
-
)
|
76
|
-
)
|
77
|
-
end
|
78
|
-
|
79
|
-
end
|
80
|
-
|
81
|
-
end
|
82
|
-
|
83
|
-
# Copyright (c) 2008,2009 Thomas Sawyer
|
84
|
-
# Distributed under the terms of the LGPL v3.
|
data/meta/authors
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Thomas Sawyer
|
data/meta/collection
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rubyworks
|
data/meta/contact
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rubyworks-mailinglist@googlegroups.com
|
data/meta/description
DELETED
data/meta/homepage
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
http://xdg.rubyforge.org
|
data/meta/name
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
xdg
|
data/meta/repository
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
http://github.com/rubyworks/xdg.git
|
data/meta/summary
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
XDG provides an interface for using XDG directory standard.
|
data/meta/title
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
XDG
|
data/meta/version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
1.0.0
|
data/script/test
DELETED