tiller 0.7.8 → 0.7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d8dc77227116ed298ac33995aa6b389192d6917b
4
- data.tar.gz: 50e4cc6c12c7f1ba0844ea776f180136b75640fa
3
+ metadata.gz: bbefc0c67cf35c7423c6305a42b5d54d6f22c073
4
+ data.tar.gz: 05f48fecc05a436549e0b133331de3eddb05517b
5
5
  SHA512:
6
- metadata.gz: 721d43464aaec3feab28f9647005cc50dbfeba1f5e816d03982e35f1bce8287e3cda45d898bc3ec163513a59f371e913456efcabc1e06d1bec102cf6337f9294
7
- data.tar.gz: 5802b4722771fa28f172383516ece84de346f1b6b54132c5d79d9317788d0d95604a559efa8a59e79931a655ef38c0672d683393d05f035954a54630f2fc2a12
6
+ metadata.gz: cc2d6e760b5ceb022b421f09aea7fc90ea68490184a07ea0e24c4f6fa5a0a42d25ca24545ea226cd21df43168d32e8256c5b329aee22773dbf34f4f108842739
7
+ data.tar.gz: 9eb6ea7b23a1fbecd87265aa7389fd2daae9a47e86fbda398ba066af956900324215e5b4cc2ab93ed49e09b032754b48dfa3b1e0e7b4484da58d1987a7b045d6
data/bin/tiller CHANGED
@@ -8,7 +8,7 @@
8
8
  #
9
9
  # Mark Dastmalchi-Round <github@markround.com>
10
10
 
11
- VERSION = '0.7.8'
11
+ VERSION = '0.7.9'
12
12
 
13
13
  require 'erb'
14
14
  require 'ostruct'
@@ -0,0 +1,56 @@
1
+ require 'pp'
2
+ require 'yaml'
3
+ require 'json'
4
+ require 'tiller/util'
5
+
6
+ class ExternalFileDataSource < Tiller::DataSource
7
+
8
+ def setup
9
+ @merged_values = Hash.new
10
+ if @config.has_key?('external_files')
11
+ files = @config['external_files']
12
+ files.each do |file|
13
+ @merged_values.merge!(parse_file(file)) do |key, old, new|
14
+ warn_merge(key, old, new, 'external file data', file)
15
+ end
16
+ end
17
+ end
18
+ end
19
+
20
+ def global_values
21
+ return @merged_values
22
+ end
23
+
24
+ def parse_file(filename)
25
+ raise("External file '#{filename}' could not be loaded") unless File.file?(filename)
26
+ @log.debug("#{self} : Loading #{filename}")
27
+ parse = nil
28
+
29
+ # First try to load it as JSON
30
+ if ! parse
31
+ begin
32
+ parse = JSON.parse(File.read(filename))
33
+ @log.debug("#{self} : #{filename} is in JSON format")
34
+ rescue JSON::ParserError
35
+ end
36
+ end
37
+
38
+ # Then YAML
39
+ if ! parse
40
+ begin
41
+ parse = YAML.load(File.read(filename))
42
+ @log.debug("#{self} : #{filename} is in YAML format")
43
+ rescue Psych::SyntaxError
44
+ end
45
+ end
46
+
47
+ # Unknown / unparsable format, bail out...
48
+ if ! parse
49
+ raise("External file '#{filename}' is in an unknown format")
50
+ end
51
+
52
+ return parse
53
+ end
54
+
55
+ end
56
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiller
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.8
4
+ version: 0.7.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Dastmalchi-Round
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-13 00:00:00.000000000 Z
11
+ date: 2016-05-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A tool to create configuration files from a variety of sources, particularly
14
14
  useful for Docker containers. See https://github.com/markround/tiller for examples
@@ -32,6 +32,7 @@ files:
32
32
  - lib/tiller/data/defaults.rb
33
33
  - lib/tiller/data/environment.rb
34
34
  - lib/tiller/data/environment_json.rb
35
+ - lib/tiller/data/external_file.rb
35
36
  - lib/tiller/data/file.rb
36
37
  - lib/tiller/data/http.rb
37
38
  - lib/tiller/data/random.rb