eac_ruby_base0 0.7.4 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10ee625f182f3829966f72f31ca5a5f8fd0e3014754ae85bcb77a4e0ddff1c34
|
4
|
+
data.tar.gz: 27cc3c2e2b5b60d294eb225a67aac634774b73611ff4246d3f0929815664a407
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7764d32f1bac074a0d096f6642264b59aea8363f89b9d50c0c4402e5eccd0d0230f374a4fb57ac73a8668319b9e10dd7d026ef10cdfe0d400e08a19f15d014ec
|
7
|
+
data.tar.gz: b420f162aa98c9772b63f171f5732b8d59865d45d4858071b8ceefcd6c91492aebedf3b8a7aa36a63e73bf0d639ccb6c2f9bc7218d061f05dff66c47b36abc7a
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'eac_ruby_base0/application_xdg'
|
3
4
|
require 'eac_ruby_gems_utils/gem'
|
4
5
|
require 'eac_ruby_utils/core_ext'
|
5
6
|
require 'eac_ruby_utils/filesystem_cache'
|
@@ -21,16 +22,8 @@ module EacRubyBase0
|
|
21
22
|
vendor_gems + [self_gem]
|
22
23
|
end
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
define_method xdg_env_method_name do
|
28
|
-
ENV["XDG_#{item.upcase}_HOME"].if_present(&:to_pathname)
|
29
|
-
end
|
30
|
-
|
31
|
-
define_method "#{item}_dir" do
|
32
|
-
(send(xdg_env_method_name) || home_dir.join(subpath)).join(name)
|
33
|
-
end
|
25
|
+
::EacRubyBase0::ApplicationXdg::DIRECTORIES.each_key do |item|
|
26
|
+
delegate "#{item}_xdg_env", "#{item}_dir", to: :app_xdg
|
34
27
|
end
|
35
28
|
|
36
29
|
def fs_cache
|
@@ -40,7 +33,7 @@ module EacRubyBase0
|
|
40
33
|
end
|
41
34
|
|
42
35
|
def home_dir
|
43
|
-
|
36
|
+
app_xdg.user_home_dir
|
44
37
|
end
|
45
38
|
|
46
39
|
def name
|
@@ -53,6 +46,10 @@ module EacRubyBase0
|
|
53
46
|
|
54
47
|
private
|
55
48
|
|
49
|
+
def app_xdg_uncached
|
50
|
+
::EacRubyBase0::ApplicationXdg.new(name, options[OPTION_HOME_DIR])
|
51
|
+
end
|
52
|
+
|
56
53
|
def self_gem_uncached
|
57
54
|
::EacRubyGemsUtils::Gem.new(gemspec_dir)
|
58
55
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EacRubyBase0
|
4
|
+
# https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
5
|
+
class ApplicationXdg
|
6
|
+
class << self
|
7
|
+
# @return [Pathname]
|
8
|
+
def user_home_dir_from_env
|
9
|
+
ENV.fetch('HOME').to_pathname
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
DIRECTORIES = { cache: '.cache', config: '.config', data: '.local/share',
|
14
|
+
state: '.local/state' }.freeze
|
15
|
+
|
16
|
+
common_constructor :app_name, :user_home_dir, default: [nil] do
|
17
|
+
self.user_home_dir ||= self.class.user_home_dir_from_env
|
18
|
+
end
|
19
|
+
|
20
|
+
DIRECTORIES.each do |item, subpath|
|
21
|
+
xdg_env_method_name = "#{item}_xdg_env"
|
22
|
+
|
23
|
+
define_method xdg_env_method_name do
|
24
|
+
ENV["XDG_#{item.upcase}_HOME"].if_present(&:to_pathname)
|
25
|
+
end
|
26
|
+
|
27
|
+
define_method "#{item}_dir" do
|
28
|
+
(send(xdg_env_method_name) || user_home_dir.join(subpath)).join(app_name)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -12,6 +12,7 @@ module EacRubyBase0
|
|
12
12
|
common_concern do
|
13
13
|
include ::EacCli::Runner
|
14
14
|
enable_settings_provider
|
15
|
+
enable_simple_cache
|
15
16
|
runner_definition do
|
16
17
|
bool_opt '--no', 'Deny confirmation without question.'
|
17
18
|
bool_opt '--yes', 'Accept confirmation without question.'
|
@@ -31,6 +32,12 @@ module EacRubyBase0
|
|
31
32
|
def run_confirm(message = nil)
|
32
33
|
yield if confirm?(message)
|
33
34
|
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def cached_confirm_uncached?(message = nil)
|
39
|
+
confirm?(message)
|
40
|
+
end
|
34
41
|
end
|
35
42
|
end
|
36
43
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eac_ruby_base0
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Put here the authors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-06-
|
11
|
+
date: 2021-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eac_cli
|
@@ -74,6 +74,7 @@ extra_rdoc_files: []
|
|
74
74
|
files:
|
75
75
|
- lib/eac_ruby_base0.rb
|
76
76
|
- lib/eac_ruby_base0/application.rb
|
77
|
+
- lib/eac_ruby_base0/application_xdg.rb
|
77
78
|
- lib/eac_ruby_base0/core_ext.rb
|
78
79
|
- lib/eac_ruby_base0/jobs_runner.rb
|
79
80
|
- lib/eac_ruby_base0/patches.rb
|