hiera-regex 0.1.0 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 61c26987dfaa056721bfae4e3165462615537da6
4
- data.tar.gz: f177917513cab76e8f5cf4ad92ebf8059b00c039
3
+ metadata.gz: 5d286162380af7f3bbb1051642ed77d586b7fe9e
4
+ data.tar.gz: b4c6f1a17f057b77cdb107a4feae8b8f45ec8524
5
5
  SHA512:
6
- metadata.gz: 4793110d130fc07d5d2ebd0afab6146cb3b7748d3a8093f27b3bb4f4ca3de6d2c1f2b30bc2f02dc87691a6a38f3af799ae86dc15145bdb98f31624a6594371a8
7
- data.tar.gz: a696ac951712c304a2b6d0ec5d39e47edbb3b74dfda41a3cd539993557a5ad526952906a238134d2761db09897cd4809ba6f97b8655e2449d76d662176674d55
6
+ metadata.gz: 6ec5acdede3e7110c9fcb61f40d3a4c329142ba8d53986c3c5d6e81160e77993225376e9f2a3da50c674b7f0f122202d9747b3cba1956795a19e52fca3f33852
7
+ data.tar.gz: 5cc8e4f28eff0bb1d04032ea0ba6764fb496f90ad98bc9789b9dfa8a204558578a0a3e830d795fe538ec7a698e21338a4a7dadcccd7fc8758f5b2c4d0bd2c9f4
@@ -1,10 +1,13 @@
1
+ require 'hiera/filecache'
2
+
1
3
  class Hiera
2
4
  module Backend
3
5
  class Regex_backend
4
6
 
5
7
  # TODO: Support JSON or YAML format and initialize accordingly
6
- def initialize
8
+ def initialize(cache=nil)
7
9
  require 'yaml'
10
+ @cache = cache || Filecache.new
8
11
  end
9
12
 
10
13
  # TODO: Support multiple resolution_types, currently only supports :priority
@@ -18,8 +21,10 @@ class Hiera
18
21
  next
19
22
  end
20
23
  Hiera.debug("Checking #{source} for #{scope_key} regex matching #{scope[scope_key]}")
24
+
21
25
  # TODO: Add support for more than just YAML format
22
- data = YAML.load_file(source)
26
+ data = YAML.load(@cache.read(source))
27
+
23
28
  next if ! data
24
29
  next if data.empty?
25
30
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiera-regex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Julien
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-09 00:00:00.000000000 Z
11
+ date: 2014-07-30 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Hiera backend for looking up keys using the power of regular expressions
14
14
  email: