yutani 0.1.12 → 0.1.15
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 +4 -4
- data/lib/yutani/cli.rb +5 -1
- data/lib/yutani/config.rb +1 -0
- data/lib/yutani/hiera.rb +4 -0
- data/lib/yutani/provider.rb +4 -2
- data/lib/yutani/resource.rb +8 -2
- data/lib/yutani/stack.rb +3 -1
- data/lib/yutani/template.rb +27 -0
- data/lib/yutani/version.rb +1 -1
- data/lib/yutani.rb +1 -1
- metadata +2 -2
- data/lib/yutani/dsl_entity.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 483c5e58654c42e69d8e7e788857ce69fd1b7e86
|
4
|
+
data.tar.gz: b54ada05a35257c53244c48c8de8875e177ecc57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68fe75b176ce425ec09c835c5156e040b46f5b3ef36f1f34d6c810af6f3ba5055da50902acdc6aafefe8246b9183352164f8f86594a3b6a8f2e4e350c2b0b931
|
7
|
+
data.tar.gz: dc0b8699b5b7269b02e6c5bee8673d667315394171f38b267ae0acc821d82ff51266aee34481bad849390b889a0bfad0ad75f5b7e55925c69d8c486a7a7034cb
|
data/lib/yutani/cli.rb
CHANGED
@@ -44,7 +44,11 @@ module Yutani
|
|
44
44
|
# * the glob - this is hardcoded to *.rb
|
45
45
|
desc 'watch', 'Run build upon changes to scripts'
|
46
46
|
def watch
|
47
|
-
Listen.to(
|
47
|
+
Listen.to(
|
48
|
+
Yutani::Config::DEFAULTS['scripts_dir'],
|
49
|
+
Yutani::Config::DEFAULTS['includes_dir']
|
50
|
+
) do |m, a, d|
|
51
|
+
|
48
52
|
Yutani.logger.info "Re-build triggered: #{m} modified" unless m.empty?
|
49
53
|
Yutani.logger.info "Re-build triggered: #{a} added" unless a.empty?
|
50
54
|
Yutani.logger.info "Re-build triggered: #{d} deleted" unless d.empty?
|
data/lib/yutani/config.rb
CHANGED
data/lib/yutani/hiera.rb
CHANGED
data/lib/yutani/provider.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
module Yutani
|
2
|
-
class Provider
|
2
|
+
class Provider
|
3
|
+
include Hiera
|
4
|
+
|
3
5
|
attr_accessor :provider_name, :fields
|
4
6
|
|
5
7
|
def initialize(provider_name, **scope, &block)
|
@@ -26,7 +28,7 @@ module Yutani
|
|
26
28
|
|
27
29
|
def method_missing(name, *args, &block)
|
28
30
|
if block_given?
|
29
|
-
raise StandardError,
|
31
|
+
raise StandardError,
|
30
32
|
"provider properties do not accept blocks as parameters"
|
31
33
|
else
|
32
34
|
@fields[name] = args.first
|
data/lib/yutani/resource.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
module Yutani
|
2
|
-
class Resource
|
2
|
+
class Resource
|
3
|
+
include Hiera
|
4
|
+
|
3
5
|
attr_accessor :resource_type, :namespace, :fields
|
4
6
|
|
5
7
|
def initialize(resource_type, *namespace, &block)
|
@@ -26,6 +28,10 @@ module Yutani
|
|
26
28
|
"${%s}" % [resource_type, namespace.join('_'), attr].join('.')
|
27
29
|
end
|
28
30
|
|
31
|
+
def template(path, **kv)
|
32
|
+
Template.new(kv).render(path)
|
33
|
+
end
|
34
|
+
|
29
35
|
def respond_to_missing?(method_name, include_private = false)
|
30
36
|
true
|
31
37
|
end
|
@@ -45,7 +51,7 @@ module Yutani
|
|
45
51
|
end
|
46
52
|
end
|
47
53
|
|
48
|
-
class SubResource < Resource
|
54
|
+
class SubResource < Resource
|
49
55
|
def initialize
|
50
56
|
@fields = {}
|
51
57
|
end
|
data/lib/yutani/stack.rb
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'erb'
|
2
|
+
|
3
|
+
module Yutani
|
4
|
+
class TemplateNotFoundError < StandardError; end
|
5
|
+
|
6
|
+
# an openstruct is useful because it lets us take a hash
|
7
|
+
# and turn its k/v's into local variables inside the tmpl
|
8
|
+
class Template < OpenStruct
|
9
|
+
include Hiera
|
10
|
+
|
11
|
+
class << self
|
12
|
+
def templates_path
|
13
|
+
Yutani.config['templates_dir']
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def render(path)
|
18
|
+
full_path = File.join(Template.templates_path, path)
|
19
|
+
|
20
|
+
unless File.exists?(full_path)
|
21
|
+
raise TemplateNotFoundError, full_path
|
22
|
+
end
|
23
|
+
|
24
|
+
ERB.new(File.read(full_path)).result binding
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/yutani/version.rb
CHANGED
data/lib/yutani.rb
CHANGED
@@ -7,11 +7,11 @@ require 'yutani/version'
|
|
7
7
|
require 'yutani/config'
|
8
8
|
require 'yutani/hiera'
|
9
9
|
require 'yutani/cli'
|
10
|
-
require 'yutani/dsl_entity'
|
11
10
|
require 'yutani/directory_tree'
|
12
11
|
require 'yutani/stack'
|
13
12
|
require 'yutani/resource'
|
14
13
|
require 'yutani/provider'
|
14
|
+
require 'yutani/template'
|
15
15
|
require 'yutani/utils'
|
16
16
|
|
17
17
|
module Yutani
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yutani
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Louis Garman
|
@@ -173,11 +173,11 @@ files:
|
|
173
173
|
- lib/yutani/cli.rb
|
174
174
|
- lib/yutani/config.rb
|
175
175
|
- lib/yutani/directory_tree.rb
|
176
|
-
- lib/yutani/dsl_entity.rb
|
177
176
|
- lib/yutani/hiera.rb
|
178
177
|
- lib/yutani/provider.rb
|
179
178
|
- lib/yutani/resource.rb
|
180
179
|
- lib/yutani/stack.rb
|
180
|
+
- lib/yutani/template.rb
|
181
181
|
- lib/yutani/utils.rb
|
182
182
|
- lib/yutani/version.rb
|
183
183
|
homepage: https://github.com/leg100/yutani
|