chefdepartie 0.0.8 → 0.0.9

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
  SHA1:
3
- metadata.gz: 1b49985d4d70bd3f0067ed31dc9d75ec9c8220cf
4
- data.tar.gz: f1fb9344fd63f8497408e608e41e0f073374364f
3
+ metadata.gz: d91234d420b3fb17603697514eb85b1ca4fa0419
4
+ data.tar.gz: 4e5a62c84653ba89ee71feb1916b22cf6a811431
5
5
  SHA512:
6
- metadata.gz: f88b865fc447cc0a77c08e597efafe3ee794210a584f8d0838518fb9d8ab4be3f310aa633e3e2dd70d166864c95e16e98f5d84b32f5d3a49987873d21ab01cc2
7
- data.tar.gz: 571d757f003dd84ee1327aa602b14d634e8892ae609fa2c20db56ff196f62839a096cf96eda863f924298cf0eb43ec7d12c494a17684cac674c67056e6c6ee85
6
+ metadata.gz: 27fb254f00e799079c61f8038bd624d1420efb5c5e9a52a5b279ea883e17f541623ece0715753ba4e0a3f50d023c8e16d81a44c119c9c24181e6bcafff0f34ff
7
+ data.tar.gz: f1fa0f7ace17652d631aa068cfae4b7f4a5ad0f1894d26329792dac4beb13d1352f3339a459e5ca4c4d80ccf0adf5026276ed650d54e24463ea3423610787b9e
@@ -8,8 +8,9 @@ module Chefdepartie
8
8
  module Cache
9
9
  extend self
10
10
  def setup(path)
11
- FileUtils.mkdir_p(File.join(path, 'organizations', 'chef'))
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(file)
57
- file.gsub(/^#{File.dirname(Chef::Config[:cookbook_path])}/, '')
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
@@ -1,4 +1,4 @@
1
1
  # Store version info
2
2
  module Chefdepartie
3
- VERSION = '0.0.8'
3
+ VERSION = '0.0.9'
4
4
  end
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.8
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: 2015-12-17 00:00:00.000000000 Z
11
+ date: 2016-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef