xdg 2.1.0 → 2.2.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 CHANGED
@@ -1,36 +1,36 @@
1
1
  ---
2
- name: xdg
3
- version: 2.1.0
4
- title: XDG
5
- summary: XDG provides an interface for using XDG directory standard.
6
- description: XDG provides a module for supporting the XDG Base Directory Standard. See http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html
2
+ spec_version: 1.0.0
3
+ replaces: []
4
+
7
5
  loadpath:
8
6
  - lib
9
- manifest: Manifest.txt
10
- requires:
11
- - name: qed
12
- version: 0+
13
- group:
14
- - test
15
- conflicts: []
7
+ name: xdg
8
+ repositories: {}
16
9
 
17
- replaces: []
10
+ conflicts: []
18
11
 
19
12
  engine_check: []
20
13
 
21
- organization: RubyWorks
14
+ title: XDG
22
15
  contact: Thomas Sawyer <transfire@gmail.com>
23
- created: 2008-09-27
24
- copyright: Copyright (c) 2008,2011 Thomas Sawyer
16
+ resources:
17
+ code: http://github.com/rubyworks/xdg
18
+ home: http://rubyworks.github.com/xdg
19
+ maintainers: []
20
+
21
+ requires:
22
+ - group:
23
+ - test
24
+ name: qed
25
+ version: 0+
26
+ manifest: Manifest.txt
27
+ version: 2.2.0
25
28
  licenses:
26
29
  - Apache 2.0
30
+ copyright: Copyright (c) 2008,2011 Thomas Sawyer
27
31
  authors:
28
32
  - Thomas Sawyer
29
- maintainers: []
30
-
31
- resources:
32
- home: http://rubyworks.github.com/xdg
33
- code: http://github.com/rubyworks/xdg
34
- repositories: {}
35
-
36
- spec_version: 1.0.0
33
+ organization: RubyWorks
34
+ description: XDG provides a module for supporting the XDG Base Directory Standard. See http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html
35
+ summary: XDG provides an interface for using XDG directory standard.
36
+ created: 2008-09-27
data/HISTORY.rdoc CHANGED
@@ -1,5 +1,18 @@
1
1
  = RELEASE HISTORY
2
2
 
3
+ == 2.2.0 / 2011-06-11
4
+
5
+ This release changes BaseDir#to_s to return the first directory
6
+ entry, and moves the old #to_s to #environment_with_defaults
7
+ with an alias of #env. The old #env now being called #environment.
8
+
9
+ Changes:
10
+
11
+ * Rename #env to #environment.
12
+ * Rename #to_s to #environment_with_defaults.
13
+ * Modify #to_s to return first directory.
14
+
15
+
3
16
  == 2.1.0 / 2011-06-10
4
17
 
5
18
  This release changes the BaseDir#list method, where as it used
@@ -14,7 +14,7 @@ module XDG
14
14
  #
15
15
  # c = MyAppConfig.new
16
16
  #
17
- # c.config.home.to_s #=> '~/.config/myapp'
17
+ # c.config.home.list #=> ['~/.config/myapp']
18
18
  #
19
19
  module Mixin
20
20
 
data/lib/xdg/base_dir.rb CHANGED
@@ -48,13 +48,24 @@ module XDG
48
48
  @environment_variables
49
49
  end
50
50
 
51
- # The equivalent environment setting.
51
+ # The environment setting, or it's equivalent when the BaseDir
52
+ # is a combination of environment variables.
52
53
  #
53
54
  # @return [String] evnironment vsetting
54
- def env
55
+ def environment
55
56
  environment_variables.map{ |v| ENV[v] }.join(':')
56
57
  end
57
58
 
59
+ # This is same as #environment, but also includes default values.
60
+ #
61
+ # @return [String] envinronment value.
62
+ def environment_with_defaults
63
+ environment_variables.map{ |v| ENV[v] || DEFAULTS[v] }.join(':')
64
+ end
65
+
66
+ # Shortcut for #environment_with_defaults.
67
+ alias :env, :environment_with_defaults
68
+
58
69
  # Returns a complete list of expanded directories.
59
70
  #
60
71
  # @return [Array<String>] expanded directory list
@@ -107,27 +118,33 @@ module XDG
107
118
  map{ |dir| Pathname.new(dir) }
108
119
  end
109
120
 
110
- # This is same as #env, but also includes default values.
121
+ # Returns the first directory expanded. Since a environment settings
122
+ # like `*_HOME` will only have one directory entry, this definition
123
+ # of #to_s makes utilizing those more convenient.
111
124
  #
112
- # @return [String] envinronment value.
125
+ # @return [String] directory
113
126
  def to_s
114
- environment_variables.map{ |v| ENV[v] || DEFAULTS[v] }.join(':')
127
+ to_a.first
115
128
  end
116
129
 
130
+ # The first directory converted to a Pathname object.
131
+ #
117
132
  # @return [Pathname] pathname of first directory
118
133
  def to_path
119
134
  Pathname.new(to_a.first)
120
135
  end
121
136
 
122
- #
137
+ # The common subdirectory.
123
138
  attr :subdirectory
124
139
 
125
- #
140
+ # Set subdirectory to be applied to all paths.
126
141
  def subdirectory=(path)
127
142
  @subdirectory = path.to_s
128
143
  end
129
144
 
145
+ # Set subdirectory to be applied to all paths and return `self`.
130
146
  #
147
+ # @return [BaseDir] self
131
148
  def with_subdirectory(path)
132
149
  @subdirectory = path if path
133
150
  self
data/lib/xdg/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module XDG
2
- VERSION = '2.1.0'
2
+ VERSION = '2.2.0'
3
3
  end
metadata CHANGED
@@ -1,8 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xdg
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 7
4
5
  prerelease:
5
- version: 2.1.0
6
+ segments:
7
+ - 2
8
+ - 2
9
+ - 0
10
+ version: 2.2.0
6
11
  platform: ruby
7
12
  authors:
8
13
  - Thomas Sawyer
@@ -10,7 +15,7 @@ autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
17
 
13
- date: 2011-06-09 00:00:00 Z
18
+ date: 2011-06-10 00:00:00 Z
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: qed
@@ -20,6 +25,9 @@ dependencies:
20
25
  requirements:
21
26
  - - ">="
22
27
  - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
23
31
  version: "0"
24
32
  type: :development
25
33
  version_requirements: *id001
@@ -77,12 +85,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
77
85
  requirements:
78
86
  - - ">="
79
87
  - !ruby/object:Gem::Version
88
+ hash: 3
89
+ segments:
90
+ - 0
80
91
  version: "0"
81
92
  required_rubygems_version: !ruby/object:Gem::Requirement
82
93
  none: false
83
94
  requirements:
84
95
  - - ">="
85
96
  - !ruby/object:Gem::Version
97
+ hash: 3
98
+ segments:
99
+ - 0
86
100
  version: "0"
87
101
  requirements: []
88
102