chef_cached_app_info 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/chef_cached_app_info.rb +4 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0c4a142716d9ffc765f92c86f2ba043f4b2c2e213b3365248ca408e7087b8b4
|
4
|
+
data.tar.gz: a4d1cd2354426832f79038ddb01c8aefb0cdb71903ba41637c675599919e61c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 889351e3467e2e6523e3aa5bd8788f4c4fa668ed44e4b23b90e7420e36c1926ee927b2c0e8a5fea3f11f268f1acca59c2a422864502cb79ed774b3fce867f55b
|
7
|
+
data.tar.gz: c686b4f7b0eabeb2265e017cab25433f5ea353a8592e40719cddc363f8eace88c179f7cef71e4111164dc12009e12edf53f1b9bd1a8e7f8b66a2a8ccf4bca43e
|
data/lib/chef_cached_app_info.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'json'
|
2
2
|
|
3
|
+
# Provides a common interface for caching and accessing cached cookbook data
|
3
4
|
class AppCache
|
4
5
|
def self.for(cookbook_path, cache_file = nil)
|
5
6
|
AppCache.new(cookbook_path, cache_file)
|
@@ -12,12 +13,12 @@ class AppCache
|
|
12
13
|
|
13
14
|
def cache_versions(origin_file)
|
14
15
|
cached_app_info('app_version', origin_file)
|
15
|
-
cached_app_info('cookbook_version', origin_file,
|
16
|
+
cached_app_info('cookbook_version', origin_file, ->(x) { x.gsub(/[^0-9.]/i, '') })
|
16
17
|
end
|
17
18
|
|
18
|
-
def cached_app_info(key, origin_file = nil, content_lambda =
|
19
|
+
def cached_app_info(key, origin_file = nil, content_lambda = ->(x) { x })
|
19
20
|
# Cache the original piece of info generated when building the app, so we have it when the app & infra are separated.
|
20
|
-
write_info(key, content_lambda.call(IO.read(origin_file).strip)) if origin_file
|
21
|
+
write_info(key, content_lambda.call(IO.read(origin_file).strip)) if !origin_file.nil? && File.exist?(origin_file)
|
21
22
|
# Cached version must always exist
|
22
23
|
value = cached_app_info_object[key]
|
23
24
|
raise "The cached app information stored by #{key} could not be found." if value.nil?
|