eac_ruby_base0 0.7.1 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/eac_ruby_base0/application.rb +13 -10
- data/lib/eac_ruby_base0/application_xdg.rb +34 -0
- data/lib/eac_ruby_base0/jobs_runner.rb +2 -2
- data/lib/eac_ruby_base0/runner.rb +15 -8
- data/lib/eac_ruby_base0/runner_with/confirmation.rb +8 -1
- data/lib/eac_ruby_base0/version.rb +1 -1
- metadata +7 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '008e9cbb4617f1f4a8afb5df6cd5755e2f3769b7f4bdbf5588d2701e9e4f1740'
|
4
|
+
data.tar.gz: 37dfcd421a873889ca71f37f3b91631efa26ff08e2cc2b5432147e5efdf8c10c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef9c43054582e18422e6923c244ad26affb913c474562249aeb418dcbb63bf53ec40a323e6163d78c08f77c5ca89d7ec93ba8514a90db54ec1cf5dbcb09e8985
|
7
|
+
data.tar.gz: f4be0c6d512c623be7a77da217c29ddb17cfcd29f8d7fc85b86bfbddf578f56c3bd70bd01b90aee2459b6d33346c42309d2c10be9823c955a8039f6d5773bd50
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'eac_cli/old_configs_bridge'
|
4
|
+
require 'eac_ruby_base0/application_xdg'
|
3
5
|
require 'eac_ruby_gems_utils/gem'
|
4
6
|
require 'eac_ruby_utils/core_ext'
|
5
7
|
require 'eac_ruby_utils/filesystem_cache'
|
@@ -21,16 +23,13 @@ module EacRubyBase0
|
|
21
23
|
vendor_gems + [self_gem]
|
22
24
|
end
|
23
25
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
ENV["XDG_#{item.upcase}_HOME"].if_present(&:to_pathname)
|
29
|
-
end
|
26
|
+
# @return [EacCli::OldConfigsBridge]
|
27
|
+
def build_config(path = nil)
|
28
|
+
::EacCli::OldConfigsBridge.new(name, path.if_present({}) { |v| { storage_path: v } })
|
29
|
+
end
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
end
|
31
|
+
::EacRubyBase0::ApplicationXdg::DIRECTORIES.each_key do |item|
|
32
|
+
delegate "#{item}_xdg_env", "#{item}_dir", to: :app_xdg
|
34
33
|
end
|
35
34
|
|
36
35
|
def fs_cache
|
@@ -40,7 +39,7 @@ module EacRubyBase0
|
|
40
39
|
end
|
41
40
|
|
42
41
|
def home_dir
|
43
|
-
|
42
|
+
app_xdg.user_home_dir
|
44
43
|
end
|
45
44
|
|
46
45
|
def name
|
@@ -53,6 +52,10 @@ module EacRubyBase0
|
|
53
52
|
|
54
53
|
private
|
55
54
|
|
55
|
+
def app_xdg_uncached
|
56
|
+
::EacRubyBase0::ApplicationXdg.new(name, options[OPTION_HOME_DIR])
|
57
|
+
end
|
58
|
+
|
56
59
|
def self_gem_uncached
|
57
60
|
::EacRubyGemsUtils::Gem.new(gemspec_dir)
|
58
61
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EacRubyBase0
|
6
|
+
# https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
7
|
+
class ApplicationXdg
|
8
|
+
class << self
|
9
|
+
# @return [Pathname]
|
10
|
+
def user_home_dir_from_env
|
11
|
+
ENV.fetch('HOME').to_pathname
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
DIRECTORIES = { cache: '.cache', config: '.config', data: '.local/share',
|
16
|
+
state: '.local/state' }.freeze
|
17
|
+
|
18
|
+
common_constructor :app_name, :user_home_dir, default: [nil] do
|
19
|
+
self.user_home_dir ||= self.class.user_home_dir_from_env
|
20
|
+
end
|
21
|
+
|
22
|
+
DIRECTORIES.each do |item, subpath|
|
23
|
+
xdg_env_method_name = "#{item}_xdg_env"
|
24
|
+
|
25
|
+
define_method xdg_env_method_name do
|
26
|
+
ENV["XDG_#{item.upcase}_HOME"].if_present(&:to_pathname)
|
27
|
+
end
|
28
|
+
|
29
|
+
define_method "#{item}_dir" do
|
30
|
+
(send(xdg_env_method_name) || user_home_dir.join(subpath)).join(app_name)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'eac_ruby_utils/
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
4
|
require 'eac_ruby_utils/settings_provider'
|
5
5
|
|
6
6
|
module EacRubyBase0
|
7
7
|
module JobsRunner
|
8
8
|
common_concern do
|
9
|
-
|
9
|
+
enable_speaker
|
10
10
|
include ::EacRubyUtils::SettingsProvider
|
11
11
|
end
|
12
12
|
|
@@ -1,13 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'eac_cli/
|
4
|
-
require 'eac_cli/
|
5
|
-
require 'eac_ruby_utils/
|
3
|
+
require 'eac_cli/core_ext'
|
4
|
+
require 'eac_cli/speaker'
|
5
|
+
require 'eac_ruby_utils/speaker'
|
6
6
|
|
7
7
|
module EacRubyBase0
|
8
8
|
module Runner
|
9
9
|
require_sub __FILE__
|
10
|
-
|
10
|
+
enable_speaker
|
11
11
|
common_concern do
|
12
12
|
include ::EacCli::RunnerWith::Help
|
13
13
|
include ::EacCli::RunnerWith::Subcommands
|
@@ -22,9 +22,7 @@ module EacRubyBase0
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def run
|
25
|
-
|
26
|
-
node.stderr = ::StringIO.new if parsed.quiet?
|
27
|
-
node.stdin = FailIfRequestInput.new if parsed.no_input?
|
25
|
+
::EacRubyUtils::Speaker.context.on(build_speaker) do
|
28
26
|
if parsed.version?
|
29
27
|
show_version
|
30
28
|
else
|
@@ -42,7 +40,7 @@ module EacRubyBase0
|
|
42
40
|
end
|
43
41
|
|
44
42
|
class FailIfRequestInput
|
45
|
-
|
43
|
+
enable_speaker
|
46
44
|
|
47
45
|
%w[gets noecho].each do |method|
|
48
46
|
define_method(method) do
|
@@ -50,5 +48,14 @@ module EacRubyBase0
|
|
50
48
|
end
|
51
49
|
end
|
52
50
|
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def build_speaker
|
55
|
+
options = {}
|
56
|
+
options[:err_out] = ::StringIO.new if parsed.quiet?
|
57
|
+
options[:in_in] = FailIfRequestInput.new if parsed.no_input?
|
58
|
+
::EacCli::Speaker.new(options)
|
59
|
+
end
|
53
60
|
end
|
54
61
|
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.'
|
@@ -22,7 +23,7 @@ module EacRubyBase0
|
|
22
23
|
return false if parsed.no?
|
23
24
|
return true if parsed.yes?
|
24
25
|
|
25
|
-
|
26
|
+
input(
|
26
27
|
message || setting_value(:confirm_question_text, default: DEFAULT_CONFIRM_QUESTION_TEXT),
|
27
28
|
bool: true
|
28
29
|
)
|
@@ -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.9.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-
|
11
|
+
date: 2021-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eac_cli
|
@@ -16,20 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
20
|
-
- - ">="
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 0.15.1
|
19
|
+
version: '0.20'
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
24
|
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: '0.
|
30
|
-
- - ">="
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 0.15.1
|
26
|
+
version: '0.20'
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: eac_ruby_gems_utils
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -50,14 +44,14 @@ dependencies:
|
|
50
44
|
requirements:
|
51
45
|
- - "~>"
|
52
46
|
- !ruby/object:Gem::Version
|
53
|
-
version: '0.
|
47
|
+
version: '0.67'
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
51
|
requirements:
|
58
52
|
- - "~>"
|
59
53
|
- !ruby/object:Gem::Version
|
60
|
-
version: '0.
|
54
|
+
version: '0.67'
|
61
55
|
- !ruby/object:Gem::Dependency
|
62
56
|
name: eac_ruby_gem_support
|
63
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +74,7 @@ extra_rdoc_files: []
|
|
80
74
|
files:
|
81
75
|
- lib/eac_ruby_base0.rb
|
82
76
|
- lib/eac_ruby_base0/application.rb
|
77
|
+
- lib/eac_ruby_base0/application_xdg.rb
|
83
78
|
- lib/eac_ruby_base0/core_ext.rb
|
84
79
|
- lib/eac_ruby_base0/jobs_runner.rb
|
85
80
|
- lib/eac_ruby_base0/patches.rb
|