user_space 5.0.210123 → 5.2.230101

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/lib/user_space.rb +12 -7
  4. metadata +8 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d7d345bdf4350375456747427362e151414f4e2eac1e62e890ef7692db500f4
4
- data.tar.gz: f0cf7bf35d981425f444630a22e68348a829863dc5a9eba9728368fac959af99
3
+ metadata.gz: 15bcbcaf8c33f6b4617fc2e741d1a92a76ec853c5c84d4fe1af2275eeb38c182
4
+ data.tar.gz: db186a8bb9e973a67a2bc7c60e45892f199b0b4f1f8a66f1429dc9bd9eb04a62
5
5
  SHA512:
6
- metadata.gz: c91c634ae02ab53e00108491be15b8cf077caf62bc796bc275f6e1fc548940a55b0a3f87760b61dd02a15561b1098a026dc88c9097c252583c3746957c323c0a
7
- data.tar.gz: '095f378b67969f6628f56bce47c12fcdd0d9b8596a434c4effd21239853e0fbd962c3e36ada329f4abd24ec62ec0e59ec11159a3e55df0bedd866db8ec2facc2'
6
+ metadata.gz: 6e63e0fed526746c8a0d3b5c9c3871c07bf14cc60aa58420cdaa615199dc7ee4c3d2a03371edda251908f707de43e1053302870beaadf81171cb30397a34f041
7
+ data.tar.gz: c25f00f3e448e3d5ad0f68b2190e351d8dc8767cb8f6d834657c4db70279b1910ef08c0e5732d58cfa4477b51430e9f59919f596138d0f4c1b99a4cf8d642044
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # UserSpace
2
2
 
3
- * [VERSION 5.0.210123](https://github.com/carlosjhr64/user_space/releases)
3
+ * [VERSION 5.2.230101](https://github.com/carlosjhr64/user_space/releases)
4
4
  * [github](https://www.github.com/carlosjhr64/user_space)
5
5
  * [rubygems](https://rubygems.org/gems/user_space)
6
6
 
@@ -52,7 +52,7 @@ $ gem install user_space
52
52
 
53
53
  (The MIT License)
54
54
 
55
- Copyright (c) 2021 CarlosJHR64
55
+ Copyright (c) 2023 CarlosJHR64
56
56
 
57
57
  Permission is hereby granted, free of charge, to any person obtaining
58
58
  a copy of this software and associated documentation files (the
data/lib/user_space.rb CHANGED
@@ -3,25 +3,29 @@ require 'fileutils'
3
3
  #`ruby`
4
4
 
5
5
  class UserSpace
6
- VERSION = '5.0.210123'
6
+ VERSION = '5.2.230101'
7
7
  XDG = {
8
8
  'cache' => ENV['XDG_CACHE_HOME'] || File.expand_path('~/.cache'),
9
9
  'config' => ENV['XDG_CONFIG_HOME'] || File.expand_path('~/.config'),
10
10
  'data' => ENV['XDG_DATA_HOME'] || File.expand_path('~/.local/share'),
11
11
  }
12
12
 
13
- def self.appdir(lib='/lib')
14
- (_ = caller(1..2)[-1]&.split(':',2)&.fetch(0)) and File.dirname(File.dirname(File.expand_path(_)))&.chomp(lib)
13
+ APPDIR = lambda{
14
+ File.dirname(File.expand_path(_1)).sub(%r([/\\]lib$),'')}
15
+
16
+ def UserSpace.appdir(dir=File.dirname(caller(1..2)[-1].split(':',2).fetch(0)))
17
+ APPDIR[dir]
15
18
  end
16
19
 
17
- attr_reader :parser,:ext,:appname,:xdgbases,:appdir,:config
20
+ attr_reader :parser,:ext,:appname,:xdgbases,:appdir,:cfg
18
21
  def initialize( parser:,
19
22
  appdir: UserSpace.appdir,
20
23
  ext: parser.to_s.downcase,
21
24
  appname: File.basename($0),
22
25
  xdgbases: ['cache', 'config', 'data'],
23
26
  config: 'config')
24
- @parser,@ext,@appname,@xdgbases,@appdir,@config = parser,ext,appname,xdgbases,appdir,config
27
+ @parser,@ext,@appname,@xdgbases,@appdir,@cfg =
28
+ parser,ext,appname,xdgbases,appdir,config
25
29
  install
26
30
  end
27
31
 
@@ -75,7 +79,7 @@ class UserSpace
75
79
  end
76
80
 
77
81
  def config_file_name
78
- File.join XDG['config'], @appname, "#{@config}.#{@ext}"
82
+ File.join XDG['config'], @appname, "#{@cfg}.#{@ext}"
79
83
  end
80
84
 
81
85
  def config?
@@ -93,7 +97,8 @@ class UserSpace
93
97
 
94
98
  # Saves config
95
99
  def config=(obj)
96
- dump = (@parser.respond_to?(:pretty_generate))? @parser.pretty_generate(obj) : @parser.dump(obj)
100
+ dump = (@parser.respond_to?(:pretty_generate))?
101
+ @parser.pretty_generate(obj) : @parser.dump(obj)
97
102
  File.open(config_file_name, 'w', 0600){|fh|fh.puts dump}
98
103
  end
99
104
 
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: 5.0.210123
4
+ version: 5.2.230101
5
5
  platform: ruby
6
6
  authors:
7
- - carlosjhr64
8
- autorequire:
7
+ - CarlosJHR64
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-23 00:00:00.000000000 Z
11
+ date: 2023-01-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  Maintains the user's cache, config, and data directories
@@ -24,7 +24,7 @@ homepage: https://github.com/carlosjhr64/user_space
24
24
  licenses:
25
25
  - MIT
26
26
  metadata: {}
27
- post_install_message:
27
+ post_install_message:
28
28
  rdoc_options: []
29
29
  require_paths:
30
30
  - lib
@@ -39,9 +39,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  requirements:
42
- - 'ruby: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]'
43
- rubygems_version: 3.2.3
44
- signing_key:
42
+ - 'ruby: ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [aarch64-linux]'
43
+ rubygems_version: 3.3.7
44
+ signing_key:
45
45
  specification_version: 4
46
46
  summary: Maintains the user's cache, config, and data directories with the gem-apps
47
47
  cache, config, and data files.