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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 48a0ec7cf52eb8b2aa5dcd93804be7bc14f03a938f74bd0b6517b4431402c459
4
- data.tar.gz: 2d0cd06e4be834238ddc3f87bf6c39af5beaf22628fa7ca3e4014a0ceb2e5cde
3
+ metadata.gz: 5193818f92e1b8682d957066eeea509bbab7c5b3d57efaaffa86d4ef3e484a9c
4
+ data.tar.gz: '058c8ef7b5ab0a202a66853eb56c4f78764a738eccf75452f425d5d6a444df27'
5
5
  SHA512:
6
- metadata.gz: 3d752e1245019c88e97f6845e521c750d7f17b4a30e369de49708ae9eb41434a437cd522fe69141ed69e517ee18f5cac97712bead85045a5958e59b2eec09a3d
7
- data.tar.gz: 2acb4ffc475b300814ae09a9a44acc8aae6b82bf9034f1810db9edd6a0ca2f72f29f6387d7cc2faa2234b89644653c04dd2d71eeb770c335fbf0846ed0fa4fbb
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
- common_constructor :gemspec_dir do
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyBase0
4
- VERSION = '0.2.0'
4
+ VERSION = '0.3.0'
5
5
  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.2.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-10-20 00:00:00.000000000 Z
11
+ date: 2020-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eac_cli