user_space 3.0.0 → 3.0.3
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.
- checksums.yaml +5 -5
- data/README.md +61 -0
- data/lib/user_space.rb +12 -13
- metadata +8 -12
- data/README.rdoc +0 -60
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1dfcc971479291e90e318bd01ba58aa13ebfd8879b8cea95e308b37530933393
|
4
|
+
data.tar.gz: c0bccd867a3a6aa2ab2a6af9280391e6e6c0393b1f9df9664dd9f0ac7f0ccdc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a22b5d23502cb1216d444510f1fe0474125a9d5b9ce3bfd87908516071f1efc59290ce367eda718bfb259bc5f1306796cb4e41f075f7b9b6b7623eee7a457fab
|
7
|
+
data.tar.gz: 210fad38ba6a7c41852176660b59ee0301eec0ad193cf04b9cc7273c8de0601942a6b2a9415990379ed59515e933c4cc576c4072a7a9aa52f28e290fa0180403
|
data/README.md
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# UserSpace
|
2
|
+
|
3
|
+
* [VERSION 3.0.3](https://github.com/carlosjhr64/user_space/releases)
|
4
|
+
* [github](https://www.github.com/carlosjhr64/user_space)
|
5
|
+
* [rubygems](https://rubygems.org/gems/user_space)
|
6
|
+
|
7
|
+
## DESCRIPTION:
|
8
|
+
|
9
|
+
Maintains the app's XDG features: app's cache, config, and data directories.
|
10
|
+
|
11
|
+
## SYNOPSIS:
|
12
|
+
|
13
|
+
require 'json' # Using JSON parser for the config file.
|
14
|
+
require 'user_space'
|
15
|
+
# APP::CONFIG is your app's configuration.
|
16
|
+
# Perhaps like...
|
17
|
+
APP::CONFIG = {:tts=>'espeak', }
|
18
|
+
USERSPACE = UserSpace.new(JSON)
|
19
|
+
# Unless this version has been installed,
|
20
|
+
# we copy over our data and cache directories.
|
21
|
+
USERSPACE.install unless USERSPACE.version == APP::VERSION
|
22
|
+
if USERSPACE.config?
|
23
|
+
# Because JSON hashes by String, converting to Symbol.
|
24
|
+
# We pad up APP::CONFIG with user's preferences:
|
25
|
+
USERSPACE.config.each{|opt, value| APP::CONFIG[opt.to_sym] = value}
|
26
|
+
else
|
27
|
+
# We initialize user preferences with our initial APP::CONFIG
|
28
|
+
STDERR.puts "Writting '#{USERSPACE.config_file_name}'"
|
29
|
+
USERSPACE.config = APP::CONFIG
|
30
|
+
end
|
31
|
+
# To do the same thing, you can also say:
|
32
|
+
# USERSPACE.configures(APP::CONFIG)
|
33
|
+
|
34
|
+
## INSTALL:
|
35
|
+
|
36
|
+
sudo gem install user_space
|
37
|
+
|
38
|
+
## LICENSE:
|
39
|
+
|
40
|
+
(The MIT License)
|
41
|
+
|
42
|
+
Copyright (c) 2020 CarlosJHR64
|
43
|
+
|
44
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
45
|
+
a copy of this software and associated documentation files (the
|
46
|
+
'Software'), to deal in the Software without restriction, including
|
47
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
48
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
49
|
+
permit persons to whom the Software is furnished to do so, subject to
|
50
|
+
the following conditions:
|
51
|
+
|
52
|
+
The above copyright notice and this permission notice shall be
|
53
|
+
included in all copies or substantial portions of the Software.
|
54
|
+
|
55
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
56
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
57
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
58
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
59
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
60
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
61
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/lib/user_space.rb
CHANGED
@@ -3,19 +3,8 @@ require 'xdg'
|
|
3
3
|
# Requires:
|
4
4
|
#`ruby`
|
5
5
|
|
6
|
-
module FileUtils
|
7
|
-
class << self
|
8
|
-
def user_space_cpr(src, dest)
|
9
|
-
fu_each_src_dest(src, dest) do |s, d|
|
10
|
-
copy_entry(s, d)
|
11
|
-
chmod('u+rwX,go-rwx', d)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
6
|
class UserSpace
|
18
|
-
VERSION = '3.0.
|
7
|
+
VERSION = '3.0.3'
|
19
8
|
|
20
9
|
def self.appdir
|
21
10
|
appdir = File.dirname File.dirname caller_locations(1,1)[0].path
|
@@ -60,7 +49,17 @@ class UserSpace
|
|
60
49
|
else
|
61
50
|
Dir.mkdir(userdir, 0700)
|
62
51
|
end
|
63
|
-
|
52
|
+
if File.directory? basedir
|
53
|
+
Dir.glob("#{basedir}/**/*").each do |src|
|
54
|
+
dest = src.sub(basedir, userdir)
|
55
|
+
if File.directory? src
|
56
|
+
Dir.mkdir dest unless File.exist? dest
|
57
|
+
else
|
58
|
+
FileUtils.cp src, dest
|
59
|
+
end
|
60
|
+
FileUtils.chmod('u+rwX,go-rwx', dest)
|
61
|
+
end
|
62
|
+
end
|
64
63
|
end
|
65
64
|
end
|
66
65
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: user_space
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- carlosjhr64
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xdg
|
@@ -26,23 +26,20 @@ dependencies:
|
|
26
26
|
version: 2.2.3
|
27
27
|
description: 'Maintains the app''s XDG features: app''s cache, config, and data directories.
|
28
28
|
|
29
|
-
'
|
29
|
+
'
|
30
30
|
email: carlosjhr64@gmail.com
|
31
31
|
executables: []
|
32
32
|
extensions: []
|
33
|
-
extra_rdoc_files:
|
34
|
-
- README.rdoc
|
33
|
+
extra_rdoc_files: []
|
35
34
|
files:
|
36
|
-
- README.
|
35
|
+
- README.md
|
37
36
|
- lib/user_space.rb
|
38
37
|
homepage: https://github.com/carlosjhr64/user_space
|
39
38
|
licenses:
|
40
39
|
- MIT
|
41
40
|
metadata: {}
|
42
41
|
post_install_message:
|
43
|
-
rdoc_options:
|
44
|
-
- "--main"
|
45
|
-
- README.rdoc
|
42
|
+
rdoc_options: []
|
46
43
|
require_paths:
|
47
44
|
- lib
|
48
45
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -56,9 +53,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
56
53
|
- !ruby/object:Gem::Version
|
57
54
|
version: '0'
|
58
55
|
requirements:
|
59
|
-
- 'ruby: ruby 2.
|
60
|
-
|
61
|
-
rubygems_version: 2.6.13
|
56
|
+
- 'ruby: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]'
|
57
|
+
rubygems_version: 3.1.2
|
62
58
|
signing_key:
|
63
59
|
specification_version: 4
|
64
60
|
summary: 'Maintains the app''s XDG features: app''s cache, config, and data directories.'
|
data/README.rdoc
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
= user_space
|
2
|
-
|
3
|
-
github :: https://www.github.com/carlosjhr64/user_space
|
4
|
-
rubygems :: https://rubygems.org/gems/user_space
|
5
|
-
|
6
|
-
== DESCRIPTION:
|
7
|
-
|
8
|
-
Maintains the app's XDG features: app's cache, config, and data directories.
|
9
|
-
|
10
|
-
== SYNOPSIS:
|
11
|
-
|
12
|
-
require 'json' # Using JSON parser for the config file.
|
13
|
-
require 'user_space'
|
14
|
-
# APP::CONFIG is your app's configuration.
|
15
|
-
# Perhaps like...
|
16
|
-
APP::CONFIG = {:tts=>'espeak', }
|
17
|
-
USERSPACE = UserSpace.new(JSON)
|
18
|
-
# Unless this version has been installed,
|
19
|
-
# we copy over our data and cache directories.
|
20
|
-
USERSPACE.install unless USERSPACE.version == APP::VERSION
|
21
|
-
if USERSPACE.config?
|
22
|
-
# Because JSON hashes by String, converting to Symbol.
|
23
|
-
# We pad up APP::CONFIG with user's preferences:
|
24
|
-
USERSPACE.config.each{|opt, value| APP::CONFIG[opt.to_sym] = value}
|
25
|
-
else
|
26
|
-
# We initialize user preferences with our initial APP::CONFIG
|
27
|
-
STDERR.puts "Writting '#{USERSPACE.config_file_name}'"
|
28
|
-
USERSPACE.config = APP::CONFIG
|
29
|
-
end
|
30
|
-
# To do the same thing, you can also say:
|
31
|
-
# USERSPACE.configures(APP::CONFIG)
|
32
|
-
|
33
|
-
== INSTALL:
|
34
|
-
|
35
|
-
sudo gem install user_space
|
36
|
-
|
37
|
-
== LICENSE:
|
38
|
-
|
39
|
-
(The MIT License)
|
40
|
-
|
41
|
-
Copyright (c) 2017 CarlosJHR64
|
42
|
-
|
43
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
44
|
-
a copy of this software and associated documentation files (the
|
45
|
-
'Software'), to deal in the Software without restriction, including
|
46
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
47
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
48
|
-
permit persons to whom the Software is furnished to do so, subject to
|
49
|
-
the following conditions:
|
50
|
-
|
51
|
-
The above copyright notice and this permission notice shall be
|
52
|
-
included in all copies or substantial portions of the Software.
|
53
|
-
|
54
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
55
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
56
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
57
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
58
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
59
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
60
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|