tiller 0.0.8 → 0.1.0

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: 0a1ee91c5860d98da73e05ec9e78430309dc9062
4
- data.tar.gz: 15300fffec069df95fab3cbd081ce471ee6c40d1
3
+ metadata.gz: 0faa026bbfbb368fe8d689c233cf79614e5dc9e1
4
+ data.tar.gz: 3f90927d1e6c1185fb41f70a7f543f11c36a04a0
5
5
  SHA512:
6
- metadata.gz: 6ce64fe320bff5680c8b8ed103656c267b145ea0d66b80b338e5110a2ac3eee1f938afd42fdf931c897720da7c30eca758bd292897999a67b3487fc884964564
7
- data.tar.gz: e3a55abb0cf59af863abc9752e966ea315a9c46bc4ec14e51239e0eea6a60fbd048669d69e136891c1bc44a2b56cea69f383dd9ef2288aa185c49ffc048fce0a
6
+ metadata.gz: 283636ada09058f6ecaa3c2ed1064f50d25a6354815eca4579e4d452663dcb1f576d34eb0d94f9c3f26a27866497d1aaadf64314530fcdfdcd4b1661d1dc9084
7
+ data.tar.gz: a7645f090d7eba2e112b83c2ea96996fda23e10fe5b95d7e4e9fd8fc9e601e6aebab2c8a83c7cd234a3cfc7fc6860450cb94cef9c6acc95df94a046f80617c70
data/bin/tiller CHANGED
@@ -3,7 +3,7 @@
3
3
  # Named from the first ship-building (Docker) related term I could find that didn't have an existing gem named after it!
4
4
  # Mark Round <github@markround.com>
5
5
 
6
- VERSION='0.0.8'
6
+ VERSION='0.1.0'
7
7
 
8
8
  require 'erb'
9
9
  require 'ostruct'
@@ -3,11 +3,8 @@
3
3
 
4
4
  class DummyDataSource < Tiller::DataSource
5
5
 
6
- def initialize(config)
7
- super
8
- @global_values = {
9
- 'dummy_global' => 'dummy global replacement text'
10
- }
6
+ def global_values
7
+ { 'dummy_global' => 'dummy global replacement text' }
11
8
  end
12
9
 
13
10
  def values(template_name)
@@ -6,14 +6,12 @@ require 'socket'
6
6
 
7
7
  class NetworkDataSource < Tiller::DataSource
8
8
 
9
- def initialize(config)
10
- super
9
+ def global_values
11
10
  # Note, these rely on DNS being available and configured correctly!
12
- @global_values = {
11
+ {
13
12
  'fqdn' => Socket.gethostbyname(Socket.gethostname).first,
14
13
  'ipv4_addresses' => Socket.getaddrinfo(Socket.gethostbyname(Socket.gethostname).first, nil, :INET)
15
14
  }
16
15
  end
17
16
 
18
-
19
17
  end
@@ -4,8 +4,9 @@
4
4
  class EnvironmentDataSource < Tiller::DataSource
5
5
 
6
6
  def global_values
7
- ENV.each { |k,v| @global_values["env_#{k.downcase}"] = v }
8
- @global_values
7
+ values = Hash.new
8
+ ENV.each { |k,v| values["env_#{k.downcase}"] = v }
9
+ values
9
10
  end
10
11
 
11
12
  end
@@ -1,14 +1,16 @@
1
1
  # File datasource for Tiller. This works the same way as the default behaviour in Runner.rb - it loads your
2
2
  # <environment>.yaml file and provides data from it. See examples/etc/tiller/environments/production.yaml to see
3
3
  # what this file looks like.
4
+ #
5
+ # We also don't provide any global values, just ones specific to a template.
6
+
4
7
 
5
8
  require 'yaml'
6
9
 
7
10
  class FileDataSource < Tiller::DataSource
8
11
 
9
- # We don't provide any global values, just ones specific to a template.
10
- def initialize(config)
11
- super
12
+ # Open and parse the environment file
13
+ def setup
12
14
  env_file = File.join(@@config[:tiller_base], "environments", "#{@@config[:environment]}.yaml")
13
15
  @config_hash = YAML::load(open(env_file))
14
16
  end
@@ -11,10 +11,16 @@ module Tiller
11
11
 
12
12
  def initialize(config)
13
13
  @@config = config
14
- @global_values = Hash.new
14
+ self.setup
15
15
  end
16
16
 
17
- attr_reader :global_values
17
+ # This is where any post-initialisation logic happens (connecting to a database etc.)
18
+ def setup
19
+ end
20
+
21
+ def global_values
22
+ Hash.new
23
+ end
18
24
 
19
25
  # We should always return a hash; if we have no data for the given template, just return an empty hash.
20
26
  def values(template_name)
@@ -11,6 +11,10 @@ module Tiller
11
11
  @@config = config
12
12
  end
13
13
 
14
+ # This is where any post-initialisation logic happens (connecting to a database etc.)
15
+ def setup
16
+ end
17
+
14
18
  def templates
15
19
  Hash.new
16
20
  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.0.8
4
+ version: 0.1.0
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-08-05 00:00:00.000000000 Z
11
+ date: 2014-08-08 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.