sxdg 1.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b18c62b0810c7f17e80eb00dc2339db9e6e0a3ea
4
+ data.tar.gz: 7208e7b87b3da84b920d467942ba1fa34dadc670
5
+ SHA512:
6
+ metadata.gz: 2d659f07e87130147db8e44a34d2c127c13d3e01ab19ece66ce5c42ec8accb35f52913c73c3b4757248185fcc336dbd0b7f653f5e0b80575265b5fdc98ff84c2
7
+ data.tar.gz: 1be57bcc681728e79c89ff76d6209f6dc929a65f8a2c8ec1975af9b9b4d728c440dd5bdad7efb5100802494d5873f1e7e51dbd07b6f4ffa12471500532129fdf
@@ -0,0 +1,8 @@
1
+ # sxdg
2
+
3
+ `sxdg` is an extremely tiny, simple library allowing for easy conformance with
4
+ the XDG Base Directory Specification.
5
+
6
+ ## License
7
+
8
+ `sxdg` is free and unencumbered software released into the public domain.
@@ -0,0 +1,24 @@
1
+ This is free and unencumbered software released into the public domain.
2
+
3
+ Anyone is free to copy, modify, publish, use, compile, sell, or
4
+ distribute this software, either in source code form or as a compiled
5
+ binary, for any purpose, commercial or non-commercial, and by any
6
+ means.
7
+
8
+ In jurisdictions that recognize copyright laws, the author or authors
9
+ of this software dedicate any and all copyright interest in the
10
+ software to the public domain. We make this dedication for the benefit
11
+ of the public at large and to the detriment of our heirs and
12
+ successors. We intend this dedication to be an overt act of
13
+ relinquishment in perpetuity of all present and future rights to this
14
+ software under copyright law.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ For more information, please refer to <http://unlicense.org/>
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+ # @!macro xdg
3
+ # Conforms to the XDG Base Directory Specification environment variable.
4
+
5
+ require_relative 'sxdg/version'
6
+
7
+ # SXDG is an extremely tiny, simple library allowing for easy conformance with
8
+ # the XDG Base Directory Specification.
9
+ module SXDG
10
+ # @private
11
+ private_class_method def self.set(env, *dirs)
12
+ value = (ENV[env] ? ENV[env].split(':') : dirs).map! do |path|
13
+ File.expand_path(path)
14
+ end
15
+ const_set(env, value)
16
+ end
17
+
18
+ # @!macro xdg
19
+ XDG_CACHE_HOME = File.expand_path(ENV['XDG_CACHE_HOME'] || '~/.cache')
20
+
21
+ # @!macro xdg
22
+ XDG_CONFIG_HOME = File.expand_path(ENV['XDG_CONFIG_HOME'] || '~/.config')
23
+
24
+ # @!macro xdg
25
+ XDG_DATA_HOME = File.expand_path(ENV['XDG_DATA_HOME'] || '~/.local/share')
26
+
27
+ # @!macro xdg
28
+ XDG_RUNTIME_DIR = File.expand_path(ENV['XDG_RUNTIME_DIR'] ||
29
+ "/var/run/user/#{ENV['USER']}")
30
+
31
+ # @!parse
32
+ # # @!macro xdg
33
+ # XDG_CONFIG_DIRS = set('XDG_CONFIG_DIRS', '/etc/xdg')
34
+ set('XDG_CONFIG_DIRS', '/etc/xdg')
35
+
36
+ # @!parse
37
+ # # @!macro xdg
38
+ # XDG_DATA_DIRS = set('XDG_DATA_DIRS', '/usr/local/share', '/usr/share')
39
+ set('XDG_DATA_DIRS', '/usr/local/share', '/usr/share')
40
+
41
+ class << self ; remove_method :set ; end
42
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../sxdg'
4
+
5
+ # @!macro as_xdg
6
+ # Conforms to the XDG Base Directory Specification environment variable if
7
+ # `sxdg/as_xdg` is required.
8
+ # @!parse
9
+ # # @!macro as_xdg
10
+ # XDG_CACHE_HOME = SXDG::XDG_CACHE_HOME
11
+ #
12
+ # # @!macro as_xdg
13
+ # XDG_CONFIG_DIRS = SXDG::XDG_CONFIG_DIRS
14
+ #
15
+ # # @!macro as_xdg
16
+ # XDG_CONFIG_HOME = SXDG::XDG_CONFIG_HOME
17
+ #
18
+ # # @!macro as_xdg
19
+ # XDG_DATA_DIRS = SXDG::XDG_DATA_DIRS
20
+ #
21
+ # # @!macro as_xdg
22
+ # XDG_DATA_HOME = SXDG::XDG_DATA_HOME
23
+ #
24
+ # # @!macro as_xdg
25
+ # XDG_RUNTIME_DIR = SXDG::XDG_RUNTIME_DIR
26
+
27
+ SXDG.constants.select { |constant| constant =~ /^XDG_/ }.each do |constant|
28
+ Object.const_set(constant, SXDG.const_get(constant))
29
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SXDG
4
+ # The semantic version of {SXDG}.
5
+ VERSION = '1.0.0'
6
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/sxdg/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'sxdg'
7
+ spec.version = SXDG::VERSION
8
+ spec.summary = 'sxdg is a simple xdg base dir library'
9
+ spec.description = spec.summary
10
+
11
+ spec.authors = ['Robin Owen']
12
+ spec.email = 'vthrenody@gmail.com'
13
+ spec.homepage = 'https://github.com/vthrenody/sxdg'
14
+
15
+ spec.files = %w(sxdg.gemspec) + Dir['*.md', 'lib/**/*.rb']
16
+ spec.require_path = 'lib'
17
+ spec.license = 'Unlicense'
18
+
19
+ spec.add_development_dependency 'sgem', '~> 1.0.0'
20
+ end
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sxdg
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Robin Owen
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-02-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sgem
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.0.0
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.0.0
27
+ description: sxdg is a simple xdg base dir library
28
+ email: vthrenody@gmail.com
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - README.md
34
+ - UNLICENSE.md
35
+ - lib/sxdg.rb
36
+ - lib/sxdg/as_xdg.rb
37
+ - lib/sxdg/version.rb
38
+ - sxdg.gemspec
39
+ homepage: https://github.com/vthrenody/sxdg
40
+ licenses:
41
+ - Unlicense
42
+ metadata: {}
43
+ post_install_message:
44
+ rdoc_options: []
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ requirements: []
58
+ rubyforge_project:
59
+ rubygems_version: 2.6.8
60
+ signing_key:
61
+ specification_version: 4
62
+ summary: sxdg is a simple xdg base dir library
63
+ test_files: []