chefdepartie 0.0.8 → 0.0.9
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/chefdepartie/cache.rb +12 -3
- data/lib/chefdepartie/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d91234d420b3fb17603697514eb85b1ca4fa0419
|
4
|
+
data.tar.gz: 4e5a62c84653ba89ee71feb1916b22cf6a811431
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27fb254f00e799079c61f8038bd624d1420efb5c5e9a52a5b279ea883e17f541623ece0715753ba4e0a3f50d023c8e16d81a44c119c9c24181e6bcafff0f34ff
|
7
|
+
data.tar.gz: f1fa0f7ace17652d631aa068cfae4b7f4a5ad0f1894d26329792dac4beb13d1352f3339a459e5ca4c4d80ccf0adf5026276ed650d54e24463ea3423610787b9e
|
data/lib/chefdepartie/cache.rb
CHANGED
@@ -8,8 +8,9 @@ module Chefdepartie
|
|
8
8
|
module Cache
|
9
9
|
extend self
|
10
10
|
def setup(path)
|
11
|
-
|
11
|
+
@storage = File.join(path, 'organizations', 'chef')
|
12
12
|
@path = File.join(path, 'cache.dat')
|
13
|
+
FileUtils.mkdir_p(@storage)
|
13
14
|
if File.exist?(@path) then restore else @cache = {} end
|
14
15
|
ds = ChefZero::DataStore::RawFileStore.new(File.join(path))
|
15
16
|
ChefZero::DataStore::DefaultFacade.new(ds, false, false)
|
@@ -19,6 +20,7 @@ module Chefdepartie
|
|
19
20
|
return false unless cache?
|
20
21
|
hash = File.file?(path) ? CityHash.hash128(File.read(path)) : hashdir(path)
|
21
22
|
hit = @cache[to_key(path)] == hash
|
23
|
+
hit = false unless File.exists?(File.join(@storage, to_key(path)))
|
22
24
|
unless hit
|
23
25
|
@cache[to_key(path)] = hash
|
24
26
|
dump
|
@@ -53,8 +55,15 @@ module Chefdepartie
|
|
53
55
|
File.binwrite(@path, Marshal.dump(@cache))
|
54
56
|
end
|
55
57
|
|
56
|
-
def to_key(
|
57
|
-
|
58
|
+
def to_key(path)
|
59
|
+
case path
|
60
|
+
when /\/data_bags\//
|
61
|
+
path.gsub(/.*data_bags/, 'data').gsub('.json', '')
|
62
|
+
when /\/roles\//
|
63
|
+
File.join('roles', path.gsub(/.*roles\//, '').gsub('/', '--').gsub('.rb', ''))
|
64
|
+
when /cookbooks\//
|
65
|
+
path.gsub(/.*cookbooks/, 'cookbooks')
|
66
|
+
end
|
58
67
|
end
|
59
68
|
end
|
60
69
|
end
|
data/lib/chefdepartie/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chefdepartie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dale Hamel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef
|