eac_ruby_utils 0.75.0 → 0.76.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_utils/version.rb +1 -1
- metadata +2 -4
- data/lib/eac_ruby_utils/filesystem_cache.rb +0 -59
- data/lib/eac_ruby_utils/fs_cache.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09b73f3a93332bc0d9ef7963c51ab545d9f40de9ffa6df3c09beaab2f788cc14'
|
4
|
+
data.tar.gz: 6574b30b1407c63bb3ff51fcda661c05622d663deabbd7032b5ad32635376902
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7afb496fd00e1ed22f567673dce53a2a678dee0c95a06c664a5155ee19bdb2f4208a37cfd97ec26492ff78663558ead8be6c9e1f36cba36868a2319e326e8c1
|
7
|
+
data.tar.gz: 7378232e47c0b748669c68dd4e8125765a60b59628aba6c795061fc3c20a3609dff96fd80cbcbaa0e40a28b76e8c9aecbbd54436d039a0d7e419c37fdb491d08
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eac_ruby_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.76.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esquilo Azul Company
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -127,7 +127,6 @@ files:
|
|
127
127
|
- lib/eac_ruby_utils/envs/ssh_env/identity_file.rb
|
128
128
|
- lib/eac_ruby_utils/envs/ssh_env/quiet.rb
|
129
129
|
- lib/eac_ruby_utils/envs/ssh_env/terminal.rb
|
130
|
-
- lib/eac_ruby_utils/filesystem_cache.rb
|
131
130
|
- lib/eac_ruby_utils/fs.rb
|
132
131
|
- lib/eac_ruby_utils/fs/clearable_directory.rb
|
133
132
|
- lib/eac_ruby_utils/fs/extname.rb
|
@@ -137,7 +136,6 @@ files:
|
|
137
136
|
- lib/eac_ruby_utils/fs/temp/file.rb
|
138
137
|
- lib/eac_ruby_utils/fs/traversable.rb
|
139
138
|
- lib/eac_ruby_utils/fs/traverser.rb
|
140
|
-
- lib/eac_ruby_utils/fs_cache.rb
|
141
139
|
- lib/eac_ruby_utils/gems_registry.rb
|
142
140
|
- lib/eac_ruby_utils/gems_registry/gem.rb
|
143
141
|
- lib/eac_ruby_utils/immutable.rb
|
@@ -1,59 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module EacRubyUtils
|
4
|
-
class FilesystemCache
|
5
|
-
CONTENT_FILE_NAME = '__content__'
|
6
|
-
|
7
|
-
attr_reader :path
|
8
|
-
|
9
|
-
def initialize(*path_parts)
|
10
|
-
raise ArgumentError, "\"#{path_parts}\" is empty" if path_parts.empty?
|
11
|
-
|
12
|
-
@path = ::File.expand_path(::File.join(*path_parts.map(&:to_s)))
|
13
|
-
end
|
14
|
-
|
15
|
-
def clear
|
16
|
-
return unless cached?
|
17
|
-
|
18
|
-
::File.unlink(content_path)
|
19
|
-
end
|
20
|
-
|
21
|
-
def read
|
22
|
-
return nil unless cached?
|
23
|
-
|
24
|
-
::File.read(content_path)
|
25
|
-
end
|
26
|
-
|
27
|
-
def read_or_cache
|
28
|
-
write(yield) unless cached?
|
29
|
-
|
30
|
-
read
|
31
|
-
end
|
32
|
-
|
33
|
-
def write(value)
|
34
|
-
assert_directory_on_path
|
35
|
-
::File.write(content_path, value)
|
36
|
-
value
|
37
|
-
end
|
38
|
-
|
39
|
-
def child(*child_path_parts)
|
40
|
-
self.class.new(path, *child_path_parts)
|
41
|
-
end
|
42
|
-
|
43
|
-
def cached?
|
44
|
-
::File.exist?(content_path)
|
45
|
-
end
|
46
|
-
|
47
|
-
def content_path
|
48
|
-
::File.join(path, CONTENT_FILE_NAME)
|
49
|
-
end
|
50
|
-
|
51
|
-
private
|
52
|
-
|
53
|
-
def assert_directory_on_path
|
54
|
-
raise "#{path} is a file" if ::File.file?(path)
|
55
|
-
|
56
|
-
::FileUtils.mkdir_p(path)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/filesystem_cache'
|
4
|
-
require 'tmpdir'
|
5
|
-
|
6
|
-
module EacRubyUtils
|
7
|
-
class << self
|
8
|
-
def fs_cache
|
9
|
-
@fs_cache ||= ::EacRubyUtils::FilesystemCache.new(::Dir.tmpdir, 'eac_ruby_utils_fs_cache')
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|