tiller 0.1.3 → 0.1.4

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: 07e3b43a954c568746d1b2e987616ee2c02bac87
4
- data.tar.gz: 04bba1376ebe4e065e69c6d7ce7a97b97e324d55
3
+ metadata.gz: cf773d678bba89ec6157521d7bddf05d22681e74
4
+ data.tar.gz: 5546392bad1250d0747fc4fc93aa7659af25dc03
5
5
  SHA512:
6
- metadata.gz: d431b978f3ae55d9cc9e0e24ad265440a0e2c8e806b88767d61a1c054c2779e7baca9ee796359351b191ff930dd709c0c9790d0965199504301f486eab2441c1
7
- data.tar.gz: 9165c94883002d36df0020e211be9771a20b28e1a82054c1a8073615d1e3a29a5f516071e126f49bd363f26632916d87dfa07c39f0af21b3f63149027755a648
6
+ metadata.gz: e1c32ea6fd357a09ecf9d56cee9cd245d81941e0094241fec971da01b3ee98dee1b7fd76073a00dd403a8dad76a94e62d8832e1beed9ebffa5c38f1e16dee5af
7
+ data.tar.gz: 36a15edabd7c35851f8b8e49d834b00910e5fc1d60b5b9b8f440fb51ecbf7896001cfa0d16716367a904685f790f2242977f8058539efb66865965341d2f8b71
data/bin/tiller CHANGED
@@ -4,7 +4,7 @@
4
4
  # didn't have an existing gem named after it!
5
5
  # Mark Round <github@markround.com>
6
6
 
7
- VERSION = '0.1.3'
7
+ VERSION = '0.1.4'
8
8
 
9
9
  require 'erb'
10
10
  require 'ostruct'
@@ -13,7 +13,7 @@ require 'fileutils'
13
13
  require 'optparse'
14
14
  require 'pp'
15
15
 
16
- # This is needed so we can enumarate all the loaded plugins later
16
+ # This is needed so we can enumerate all the loaded plugins later
17
17
  class Class
18
18
  def subclasses
19
19
  ObjectSpace.each_object(Class).select { |c| c < self }
@@ -49,9 +49,20 @@ module Tiller
49
49
  opts.on('-v', '--verbose', 'Display verbose output') do
50
50
  config[:verbose] = true
51
51
  end
52
+ opts.on('-b', '--base-dir [BASE_DIR]', 'Override the tiller_base environment variable') do |base_dir|
53
+ config[:tiller_base] = base_dir
54
+ end
55
+ opts.on('-l', '--lib-dir [LIB_DIR]', 'Override the tiller_lib environment variable') do |lib_dir|
56
+ config[:tiller_lib] = lib_dir
57
+ end
58
+ opts.on('-e', '--environment [ENV]', 'Override the \'environment\' environment variable') do |environment|
59
+ config[:environment] = environment
60
+ end
61
+
52
62
  opts.on('-h', '--help', 'Display this screen') do
53
63
  puts opts
54
- puts 'Tiller also uses the environment variables tiller_base and tiller_lib.'
64
+ puts 'Tiller also uses the environment variables tiller_base, environment'
65
+ puts 'and tiller_lib (or they can be provided using the arguments shown above).'
55
66
  puts 'See https://github.com/markround/tiller for documentation and usage.'
56
67
  puts 'Current configuration hash follows :'
57
68
  pp config
@@ -0,0 +1,5 @@
1
+ data_sources:
2
+ - environment_json
3
+ - file
4
+ template_sources:
5
+ - file
@@ -0,0 +1,4 @@
1
+ array.erb:
2
+ target: /tmp/array.txt
3
+ config:
4
+ default_value: 'This may be overridden by the JSON data source'
@@ -0,0 +1,4 @@
1
+ simple_keys.erb:
2
+ target: /tmp/simple_keys.txt
3
+ config:
4
+ default_value: 'This may be overridden by the JSON data source'
@@ -0,0 +1,3 @@
1
+ This is a list of all servers:
2
+ <% servers.each do |server| %>
3
+ Server : <%= server %><% end %>
@@ -0,0 +1,4 @@
1
+ Default value : <%= default_value %>
2
+
3
+ * Key 1 is : <%= key1 %>
4
+ * Key 2 is : <%= key2 %>
@@ -28,6 +28,7 @@ data_sources:
28
28
  - environment
29
29
  - network
30
30
 
31
+
31
32
  # template_sources: Sources of templates, in priority order (first takes precendence). Again using the provided
32
33
  # FileTemplateSource (uses templates under <tiller_base>/templates), and also because we set tiller_lib, we can use
33
34
  # DummyTemplateSource which creates a single "dummy.erb" template.
File without changes
@@ -0,0 +1,24 @@
1
+ # Environment JSON datasource for Tiller. This extracts all JSON from the
2
+ # tiller_json environment variable and merges the resulting hash data
3
+ # structure into the global_values available to templates.
4
+
5
+ require 'json'
6
+ require 'pp'
7
+
8
+ class EnvironmentJsonDataSource < Tiller::DataSource
9
+ def global_values
10
+
11
+ if ENV.has_key?('tiller_json')
12
+ begin
13
+ json_structure = JSON.parse(ENV['tiller_json'])
14
+ json_structure if json_structure.is_a?(Hash)
15
+ rescue JSON::ParserError
16
+ puts "Warning : Error parsing tiller_json environment variable"
17
+ Hash.new
18
+ end
19
+ else
20
+ Hash.new
21
+ end
22
+
23
+ end
24
+ end
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.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Round
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-19 00:00:00.000000000 Z
11
+ date: 2014-10-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A tool to create configuration files in Docker containers from a variety
14
14
  of sources. See https://github.com/markround/tiller for examples and documentation.
@@ -19,14 +19,20 @@ extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
21
  - bin/tiller
22
- - examples/etc/tiller/common.yaml
23
- - examples/etc/tiller/environments/production.yaml
24
- - examples/etc/tiller/environments/staging.yaml
25
- - examples/etc/tiller/templates/sensu_client.erb
26
- - examples/lib/tiller/data/dummy.rb
27
- - examples/lib/tiller/data/network.rb
28
- - examples/lib/tiller/template/dummy.rb
22
+ - examples/json/common.yaml
23
+ - examples/json/environments/array.yaml
24
+ - examples/json/environments/simple_keys.yaml
25
+ - examples/json/templates/array.erb
26
+ - examples/json/templates/simple_keys.erb
27
+ - examples/plugins/etc/tiller/common.yaml
28
+ - examples/plugins/etc/tiller/environments/production.yaml
29
+ - examples/plugins/etc/tiller/environments/staging.yaml
30
+ - examples/plugins/etc/tiller/templates/sensu_client.erb
31
+ - examples/plugins/lib/tiller/data/dummy.rb
32
+ - examples/plugins/lib/tiller/data/network.rb
33
+ - examples/plugins/lib/tiller/template/dummy.rb
29
34
  - lib/tiller/data/environment.rb
35
+ - lib/tiller/data/environment_json.rb
30
36
  - lib/tiller/data/file.rb
31
37
  - lib/tiller/data/random.rb
32
38
  - lib/tiller/datasource.rb