eac_ruby_base0 0.2.0 → 0.3.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 +32 -1
- data/lib/eac_ruby_base0/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5193818f92e1b8682d957066eeea509bbab7c5b3d57efaaffa86d4ef3e484a9c
|
4
|
+
data.tar.gz: '058c8ef7b5ab0a202a66853eb56c4f78764a738eccf75452f425d5d6a444df27'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f99e58f564fabfa9ff33d722d180c2c4811da27f3f728a0e975d7394472d329c4c0eaecf08bd556a2c148a0ccc4d2673054a836ddefd2734fa18e646a7a001b
|
7
|
+
data.tar.gz: 75b9fe14d67c575c1ff5d58e9e9380339897731addf0bb6d230e31cb528633a2c9c99ce262c36773ce7e6859c8305c0aac885e4696310da79ddd54948882491c
|
@@ -1,12 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'eac_ruby_utils/filesystem_cache'
|
4
5
|
|
5
6
|
module EacRubyBase0
|
6
7
|
class Application
|
7
8
|
enable_simple_cache
|
8
|
-
|
9
|
+
enable_listable
|
10
|
+
lists.add_symbol :option, :name, :home_dir
|
11
|
+
|
12
|
+
common_constructor :gemspec_dir, :options, default: [{}] do
|
9
13
|
self.gemspec_dir = gemspec_dir.to_pathname
|
14
|
+
self.options = options.symbolize_keys.assert_valid_keys(self.class.lists.option.values).freeze
|
10
15
|
end
|
11
16
|
|
12
17
|
delegate :version, to: :self_gem
|
@@ -15,6 +20,32 @@ module EacRubyBase0
|
|
15
20
|
vendor_gems + [self_gem]
|
16
21
|
end
|
17
22
|
|
23
|
+
{ cache: '.cache', config: '.config', data: '.local/share' }.each do |item, subpath|
|
24
|
+
xdg_env_method_name = "#{item}_xdg_env"
|
25
|
+
|
26
|
+
define_method xdg_env_method_name do
|
27
|
+
ENV["XDG_#{item.upcase}_HOME"].if_present(&:to_pathname)
|
28
|
+
end
|
29
|
+
|
30
|
+
define_method "#{item}_dir" do
|
31
|
+
(send(xdg_env_method_name) || home_dir.join(subpath)).join(name)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def fs_cache
|
36
|
+
@fs_cache ||= ::EacRubyUtils::FilesystemCache.new(
|
37
|
+
cache_dir.join(::EacRubyUtils::FilesystemCache.name.parameterize)
|
38
|
+
)
|
39
|
+
end
|
40
|
+
|
41
|
+
def home_dir
|
42
|
+
@home_dir ||= (options[OPTION_HOME_DIR] || ENV.fetch('HOME')).to_pathname
|
43
|
+
end
|
44
|
+
|
45
|
+
def name
|
46
|
+
options[OPTION_NAME] || self_gem.name
|
47
|
+
end
|
48
|
+
|
18
49
|
def vendor_dir
|
19
50
|
gemspec_dir.join('vendor')
|
20
51
|
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.3.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: 2020-
|
11
|
+
date: 2020-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eac_cli
|