kumogata2-plugin-ruby 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +34 -0
- data/kumogata2-plugin-ruby.gemspec +1 -1
- data/lib/kumogata2/plugin/ruby/context.rb +8 -5
- data/lib/kumogata2/plugin/ruby/version.rb +1 -1
- data/lib/kumogata2/plugin/ruby.rb +5 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51e8b5e2be5e26168a685aec2b274785dda1b57a
|
4
|
+
data.tar.gz: 318d4fc663ae695bba0a49b9fbe27efb8408e9a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 445b934f153d0495fdebd901c09e89aac7da20d70c8bf32eba8b941576e5fa5cf6e2ffa7467c0698ff06236e5349a0b4feb9fce62797be5a0757de794bd4035f
|
7
|
+
data.tar.gz: 59cf72d8c27378287a841141ea6d4721704d5ab859cda51619d24c9431d23f9977630b4fd05a6cba66b021a5672b33d397955a7b718f206092a7238695df2306
|
data/README.md
CHANGED
@@ -67,6 +67,40 @@ end
|
|
67
67
|
* `_path()` creates Hash that has a key of path
|
68
68
|
* `_path("/etc/passwd-s3fs") { content "..." }` => `{"/etc/passwd-s3fs": {"content": "..."}}`
|
69
69
|
|
70
|
+
### String#fn_join()
|
71
|
+
|
72
|
+
Ruby templates will be converted as follows by `String#fn_join()`:
|
73
|
+
|
74
|
+
```ruby
|
75
|
+
UserData do
|
76
|
+
Fn__Base64 (<<-EOS).fn_join
|
77
|
+
#!/bin/bash
|
78
|
+
/opt/aws/bin/cfn-init -s <%= Ref "AWS::StackName" %> -r myEC2Instance --region <%= Ref "AWS::Region" %>
|
79
|
+
EOS
|
80
|
+
end
|
81
|
+
```
|
82
|
+
|
83
|
+
```javascript
|
84
|
+
"UserData": {
|
85
|
+
"Fn::Base64": {
|
86
|
+
"Fn::Join": [
|
87
|
+
"",
|
88
|
+
[
|
89
|
+
"#!/bin/bash\n",
|
90
|
+
"/opt/aws/bin/cfn-init -s ",
|
91
|
+
{
|
92
|
+
"Ref": "AWS::StackName"
|
93
|
+
},
|
94
|
+
" -r myEC2Instance --region ",
|
95
|
+
{
|
96
|
+
"Ref": "AWS::Region"
|
97
|
+
},
|
98
|
+
"\n"
|
99
|
+
]
|
100
|
+
]
|
101
|
+
}
|
102
|
+
}
|
103
|
+
```
|
70
104
|
|
71
105
|
### Split a template file
|
72
106
|
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
|
22
22
|
spec.add_dependency 'kumogata2'
|
23
|
-
spec.add_dependency 'dslh'
|
23
|
+
spec.add_dependency 'dslh', '>= 0.3.0'
|
24
24
|
|
25
25
|
spec.add_development_dependency 'bundler'
|
26
26
|
spec.add_development_dependency 'rake'
|
@@ -1,4 +1,6 @@
|
|
1
1
|
class Kumogata2::Plugin::Ruby::Context
|
2
|
+
IGNORE_METHODS = [:system]
|
3
|
+
|
2
4
|
def initialize(options)
|
3
5
|
@options = options
|
4
6
|
end
|
@@ -19,13 +21,14 @@ class Kumogata2::Plugin::Ruby::Context
|
|
19
21
|
end
|
20
22
|
end
|
21
23
|
|
22
|
-
@_template = Dslh.eval(
|
23
|
-
:
|
24
|
-
:
|
25
|
-
:
|
24
|
+
@_template = Dslh.eval({
|
25
|
+
key_conv: key_converter,
|
26
|
+
value_conv: value_converter,
|
27
|
+
scope_hook: proc {|scope|
|
26
28
|
define_template_func(scope, @options.path_or_url)
|
27
29
|
},
|
28
|
-
:
|
30
|
+
filename: @options.path_or_url,
|
31
|
+
ignore_methods: IGNORE_METHODS,
|
29
32
|
}, &block)
|
30
33
|
end
|
31
34
|
|
@@ -62,7 +62,11 @@ class Kumogata2::Plugin::Ruby
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
-
dsl = Dslh.deval(template,
|
65
|
+
dsl = Dslh.deval(template,
|
66
|
+
key_conv: key_conv,
|
67
|
+
value_conv: value_conv,
|
68
|
+
exclude_key: exclude_key)
|
69
|
+
|
66
70
|
dsl.gsub!(/^/, ' ').strip!
|
67
71
|
|
68
72
|
<<-EOS
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kumogata2-plugin-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- winebarrel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kumogata2
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 0.3.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 0.3.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|