momo 0.3.5 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/momo/momoscope.rb +19 -1
- data/lib/momo/resource.rb +10 -5
- data/lib/momo/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce74a879ad8df4b3d48702def1cb718e45dda190
|
4
|
+
data.tar.gz: 62828aafe7ab0bfc8fd39afe531cbea90de01b7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38e7b5d7fa785d067b48d89296ceca77c7cfda6193c69673cd7559a472f532d0b47c02c79293aa418c6d8379cfc8ba51be1e84b97216de844ab4f54ac39e2f07
|
7
|
+
data.tar.gz: e04f44afe9fa6db008a34fdd5c74b5c2a73428a5a5e8c7e122e69b3c7019d980678cf88aa9aa17729b8acbc3a8d7558caeee4d53f0895f7e745151ad290ee14c
|
data/lib/momo/momoscope.rb
CHANGED
@@ -2,7 +2,23 @@ require "momo/funccall"
|
|
2
2
|
|
3
3
|
module Momo
|
4
4
|
|
5
|
-
|
5
|
+
class BlockHash
|
6
|
+
attr_accessor :props
|
7
|
+
def initialize(options, &block)
|
8
|
+
@options = options
|
9
|
+
@props = {}
|
10
|
+
instance_eval(&block)
|
11
|
+
end
|
12
|
+
|
13
|
+
def method_missing(name, *args, &block)
|
14
|
+
if /^[[:upper:]]/.match(name) == nil
|
15
|
+
raise "Invalid property name: #{name}"
|
16
|
+
end
|
17
|
+
@props[name] = Momo.resolve(args[0], @options, &block)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def Momo.resolve(something, options={}, &block)
|
6
22
|
|
7
23
|
if something.is_a? String or
|
8
24
|
something.is_a? TrueClass or
|
@@ -31,6 +47,8 @@ module Momo
|
|
31
47
|
return something.representation
|
32
48
|
elsif something.is_a? Parameter
|
33
49
|
return { "Ref" => something.name }
|
50
|
+
elsif something == nil && block
|
51
|
+
return result = BlockHash.new(options, &block).props
|
34
52
|
else
|
35
53
|
raise "Invalid var: #{something.inspect} in #{options[:resource]}"
|
36
54
|
end
|
data/lib/momo/resource.rb
CHANGED
@@ -20,13 +20,18 @@ module Momo
|
|
20
20
|
|
21
21
|
def method_missing(name, *args, &block)
|
22
22
|
|
23
|
-
if /^[[:upper:]]/.match(name) == nil
|
24
|
-
raise "Invalid resource name: #{name}"
|
25
|
-
end
|
26
|
-
|
27
23
|
if !@complete
|
28
|
-
|
24
|
+
if /^[[:upper:]]/.match(name) == nil
|
25
|
+
raise "Invalid property name: #{name}"
|
26
|
+
end
|
27
|
+
@props[name] = Momo.resolve(args[0], resource: name, stack: @stack, &block)
|
28
|
+
|
29
29
|
else
|
30
|
+
if /^[[:upper:]]/.match(name) == nil
|
31
|
+
raise "Invalid attribute name: #{name}"
|
32
|
+
end
|
33
|
+
# For get attributes when the resource is completed
|
34
|
+
# TODO: should instead instance eval with a different class
|
30
35
|
MemberReference.new @name, name, @stack
|
31
36
|
end
|
32
37
|
end
|
data/lib/momo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: momo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Siaw
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
156
|
version: '0'
|
157
157
|
requirements: []
|
158
158
|
rubyforge_project:
|
159
|
-
rubygems_version: 2.
|
159
|
+
rubygems_version: 2.4.8
|
160
160
|
signing_key:
|
161
161
|
specification_version: 4
|
162
162
|
summary: Momo template maker for AWS
|