aws-must 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -5
  3. data/bin/aws-must.rb +42 -2
  4. data/demo/1/root.mustache +3 -0
  5. data/demo/2/resources.mustache +7 -3
  6. data/demo/2/root.mustache +41 -5
  7. data/demo/3/resource.mustache +6 -7
  8. data/demo/3/resourceInstance.mustache +6 -7
  9. data/demo/3/resources.mustache +7 -2
  10. data/demo/3/root.mustache +42 -17
  11. data/demo/4/output.mustache +6 -10
  12. data/demo/4/resource.mustache +6 -8
  13. data/demo/4/resourceInstance.mustache +6 -11
  14. data/demo/4/resourceSecurityGroup.mustache +6 -8
  15. data/demo/4/resources.mustache +8 -4
  16. data/demo/4/root.mustache +44 -17
  17. data/demo/5/mappings.mustache +5 -2
  18. data/demo/5/output.mustache +5 -11
  19. data/demo/5/resource.mustache +6 -10
  20. data/demo/5/resourceInstance.mustache +7 -9
  21. data/demo/5/resources.mustache +8 -5
  22. data/demo/5/root.mustache +44 -10
  23. data/demo/6/mappings.mustache +6 -3
  24. data/demo/6/output.mustache +8 -11
  25. data/demo/6/parameter.mustache +7 -11
  26. data/demo/6/resource.mustache +7 -17
  27. data/demo/6/resourceInstance.mustache +8 -16
  28. data/demo/6/resourceSecurityGroup.mustache +7 -8
  29. data/demo/6/resources.mustache +11 -5
  30. data/demo/6/root.mustache +53 -25
  31. data/demo/6/tag.mustache +6 -12
  32. data/demo/7/mappings.mustache +6 -3
  33. data/demo/7/output.mustache +8 -13
  34. data/demo/7/parameter.mustache +7 -11
  35. data/demo/7/resource.mustache +8 -17
  36. data/demo/7/resourceInstance.mustache +8 -16
  37. data/demo/7/resourceInstanceChef.mustache +6 -10
  38. data/demo/7/resourceSecurityGroup.mustache +8 -8
  39. data/demo/7/resources.mustache +10 -5
  40. data/demo/7/root.mustache +51 -25
  41. data/demo/7/tag.mustache +6 -10
  42. data/lib/aws-must/docu.rb +31 -7
  43. data/lib/aws-must/template.rb +23 -0
  44. data/lib/utils/hasher.rb +3 -1
  45. metadata +2 -2
data/demo/4/root.mustache CHANGED
@@ -6,7 +6,7 @@
6
6
  STYLE section
7
7
  ==================================================================
8
8
 
9
- ++start++
9
+ +++start+++
10
10
 
11
11
  <style>
12
12
  h1 {
@@ -24,16 +24,32 @@ h3 {
24
24
  body {
25
25
  background-color: #b0c4de;
26
26
  }
27
+ /* Support fold-on/fold-off toggle */
28
+ div.fold {
29
+ width: 90%; padding: .42rem; border-radius: 5px; margin: 1rem;
30
+
31
+ }
32
+ div.fold div {
33
+ height: 0px; margin: .2rem; overflow: hidden;
34
+ }
35
+ div.toggle ~ div { height: 0px; margin: .2rem; overflow: hidden; }
36
+ input.toggle:checked ~ div {
37
+ height: auto;
38
+ color: white;
39
+ background: #c6a24b;
40
+ font-family: monospace;
41
+ white-space: pre;
42
+ }
27
43
  </style>
28
44
 
29
- ++close++
45
+ +++close+++
30
46
 
31
47
 
32
48
  ==================================================================
33
49
  CONTENT section
34
50
  ==================================================================
35
51
 
36
- ++start++
52
+ +++start+++
37
53
 
38
54
  # <a id="top">aws-must demo 4 template</a>
39
55
 
@@ -67,8 +83,7 @@ each template, it
67
83
  * documents the attribute context e.g. `.` or `./resources/Instance`,
68
84
  and attributes references of the template
69
85
 
70
- * lists template actions, i.e. output from template, or template
71
- inclusion
86
+ * checkbox to show template implementation
72
87
 
73
88
 
74
89
  ## <a id="root.mustache"></a>root.mustache <a class='navigator' href='#top'">[top]</a>
@@ -79,22 +94,13 @@ Starting point of template rendering.
79
94
 
80
95
  * `description`: description for the CF template
81
96
 
82
- **Actions**:
83
97
 
84
- * **Description**: `description`
85
- * **include** <a href="#resources.mustache">resources.mustache</a>
86
- * **for** `resource` **in** `resource` **include** <a href="#resource.mustache">resource.mustache</a>
87
- * **for** `output` **in** `outputs` **include** <a href="#output.mustache">output.mustache</a>
88
-
89
-
90
- > resources
91
- > resource
92
- > output
93
-
94
- ++close++
98
+ +++close+++
95
99
 
96
100
  }}
97
101
 
102
+ {{! +++fold-on+++ }}
103
+
98
104
  {
99
105
  "AWSTemplateFormatVersion" : "2010-09-09",
100
106
 
@@ -114,3 +120,24 @@ Starting point of template rendering.
114
120
  }
115
121
 
116
122
  }
123
+
124
+ {{! +++fold-off+++ }}
125
+
126
+
127
+ {{!
128
+
129
+ ==================================================================
130
+ INCLUDED templates
131
+ ==================================================================
132
+
133
+ +++start+++
134
+
135
+ > resources
136
+ > resource
137
+ > resourceInstance
138
+ > resourceSecurityGroup
139
+ > output
140
+
141
+ +++close+++
142
+
143
+ }}
@@ -1,6 +1,6 @@
1
1
  {{!
2
2
 
3
- ++start++
3
+ +++start+++
4
4
 
5
5
  ## <a id="mappings.mustache"></a>mappings.mustache <a class='navigator' href='#top'">[top]</a>
6
6
 
@@ -37,7 +37,7 @@ us-west-2 trusty 14.04 LTS amd64 hvm:ebs-ssd 20150528 ami
37
37
  architectures only for **64bits**
38
38
 
39
39
 
40
- ++close++
40
+ +++close+++
41
41
 
42
42
 
43
43
  ==================================================================
@@ -46,6 +46,7 @@ The template
46
46
 
47
47
  }}
48
48
 
49
+ {{! +++fold-on+++ }}
49
50
 
50
51
 
51
52
  "AWSInstanceType2Arch" : {
@@ -65,3 +66,5 @@ The template
65
66
  "us-west-2" : { "64" : "ami-57e8d767" }
66
67
  }
67
68
 
69
+
70
+ {{! +++fold-off+++ }}
@@ -1,7 +1,7 @@
1
1
  {{!
2
2
 
3
3
 
4
- ++start++
4
+ +++start+++
5
5
 
6
6
  ## <a id="output.mustache"></a>output.mustache <a class='navigator' href='#top'">[top]</a>
7
7
 
@@ -18,19 +18,11 @@ Create one output entry to CloudFormation JSON output section
18
18
 
19
19
 
20
20
 
21
- **Actions**:
22
-
23
- * **Name**: `Name`
24
- * **Description**: `Description`
25
- * **Value**: **Ref** if `Ref`
26
- * **Value**: `Attr.Ref`, `Attr.Name` if `Attr`
27
-
28
-
29
-
30
- ++close++
21
+ +++close+++
31
22
 
32
23
  }}
33
24
 
25
+ {{! +++fold-on+++ }}
34
26
 
35
27
  "{{Name}}": {
36
28
  "Description" : "{{Description}}"
@@ -38,3 +30,5 @@ Create one output entry to CloudFormation JSON output section
38
30
  {{#Attr}}, "Value" : { "Fn::GetAtt" : [ "{{Ref}}", "{{Name}}" ] }{{/Attr}}
39
31
  }{{_comma}}
40
32
 
33
+
34
+ {{! +++fold-off+++ }}
@@ -2,7 +2,7 @@
2
2
 
3
3
  resource.mustache
4
4
 
5
- ++start++
5
+ +++start+++
6
6
 
7
7
  ## <a id="resource.mustache"></a>resource.mustache <a class='navigator' href='#top'">[top]</a>
8
8
 
@@ -14,16 +14,12 @@ Dispatches resource sub-type templates based resource Type propertys
14
14
  * `Instance`: sub-document defining an EC instance
15
15
 
16
16
 
17
- **Actions**:
18
-
19
- * include <a href="#resourceInstance.mustache">resourceInstance.mustache</a> if `Instance`
20
-
21
- > resourceInstance
22
-
23
- ++close++
24
-
25
-
17
+ +++close+++
26
18
 
27
19
  }}
28
20
 
21
+ {{! +++fold-on+++ }}
22
+
29
23
  {{# Instance }}{{> resourceInstance}}{{/ Instance }}
24
+
25
+ {{! +++fold-off+++ }}
@@ -1,7 +1,7 @@
1
1
  {{!
2
2
 
3
3
 
4
- ++start++
4
+ +++start+++
5
5
 
6
6
 
7
7
  ## <a id="resourceInstance.mustache"></a>resourceInstance.mustache <a class='navigator' href='#top'">[top]</a>
@@ -14,16 +14,12 @@ Create an EC2 instance
14
14
  * `InstanceType` : The instance type, such as t2.micro.
15
15
 
16
16
 
17
- **Actions**:
18
-
19
- * **Name**: `Name`
20
- * **Type**: 'AWS::EC2::Instance'
21
- * **ImageId**: **AWSRegionArch2AMI**( 'AWS::Region', **AWSInstanceType2Arch**(`InstanceType`))
22
-
23
- ++close++
17
+ +++close+++
24
18
 
25
19
  }}
26
20
 
21
+ {{! +++fold-on+++ }}
22
+
27
23
 
28
24
  "{{Name}}" : {
29
25
  "Type" : "AWS::EC2::Instance",
@@ -32,4 +28,6 @@ Create an EC2 instance
32
28
  { "Fn::FindInMap" : [ "AWSInstanceType2Arch", "{{InstanceType}}", "Arch" ] } ] },
33
29
  "InstanceType" : "{{InstanceType}}"
34
30
  } {{! Propertites }}
35
- }{{_comma}}
31
+ }{{_comma}}
32
+
33
+ {{! +++fold-off+++ }}
@@ -1,6 +1,6 @@
1
1
  {{!
2
2
 
3
- ++start++
3
+ +++start+++
4
4
 
5
5
  ## <a id="resources.mustache"></a>resources.mustache <a class='navigator' href='#top'">[top]</a>
6
6
 
@@ -13,13 +13,14 @@ Empty template.
13
13
 
14
14
  **Actions**:
15
15
 
16
- * no action (i.e. empty template)
16
+ * no action (i.e. template commented out)
17
17
 
18
+ +++close+++
18
19
 
19
- ++close++
20
+ }}
20
21
 
22
+ {{! +++fold-on+++ }}
21
23
 
22
- }}
23
24
  {{!
24
25
 
25
26
  Moved to YAML
@@ -32,4 +33,6 @@ Empty template.
32
33
  }
33
34
  }
34
35
 
35
- }}
36
+ }}
37
+
38
+ {{! +++fold-off+++ }}
data/demo/5/root.mustache CHANGED
@@ -6,7 +6,7 @@
6
6
  STYLE section
7
7
  ==================================================================
8
8
 
9
- ++start++
9
+ +++start+++
10
10
  <style>
11
11
  h1 {
12
12
  color:blue;
@@ -26,16 +26,32 @@ h3 {
26
26
  body {
27
27
  background-color: #b0c4de;
28
28
  }
29
+ /* Support fold-on/fold-off toggle */
30
+ div.fold {
31
+ width: 90%; padding: .42rem; border-radius: 5px; margin: 1rem;
32
+
33
+ }
34
+ div.fold div {
35
+ height: 0px; margin: .2rem; overflow: hidden;
36
+ }
37
+ div.toggle ~ div { height: 0px; margin: .2rem; overflow: hidden; }
38
+ input.toggle:checked ~ div {
39
+ height: auto;
40
+ color: white;
41
+ background: #c6a24b;
42
+ font-family: monospace;
43
+ white-space: pre;
44
+ }
29
45
  </style>
30
46
 
31
- ++close++
47
+ +++close+++
32
48
 
33
49
 
34
50
  ==================================================================
35
51
  CONTENT section
36
52
  ==================================================================
37
53
 
38
- ++start++
54
+ +++start+++
39
55
 
40
56
  # <a id="top">aws-must demo 5 template</a>
41
57
 
@@ -70,8 +86,7 @@ each template, it
70
86
  * documents the attribute context e.g. `.` or `./resources/Instance`,
71
87
  and attributes references of the template
72
88
 
73
- * lists template actions, i.e. output from template, or template
74
- inclusion
89
+ * checkbox to show template implementation
75
90
 
76
91
  ### Table of contents
77
92
  <ul>
@@ -115,16 +130,14 @@ Starting point of template rendering.
115
130
  * **for** `output` **in** `outputs` **include** <a href="#output.mustache">output.mustache</a>
116
131
 
117
132
 
118
- > mappings
119
- > resources
120
- > resource
121
- > output
122
133
 
123
134
 
124
- ++close++
135
+ +++close+++
125
136
 
126
137
  }}
127
138
 
139
+ {{! +++fold-on+++ }}
140
+
128
141
  {
129
142
  "AWSTemplateFormatVersion" : "2010-09-09",
130
143
 
@@ -148,3 +161,24 @@ Starting point of template rendering.
148
161
  }
149
162
 
150
163
  }
164
+
165
+ {{! +++fold-off+++ }}
166
+
167
+ {{!
168
+
169
+ ==================================================================
170
+ INCLUDED templates
171
+ ==================================================================
172
+
173
+ +++start+++
174
+
175
+ > mappings
176
+ > resources
177
+ > resource
178
+ > resourceInstance
179
+ > resourceSecurityGroup
180
+ > output
181
+
182
+ +++close+++
183
+
184
+ }}
@@ -1,8 +1,8 @@
1
1
  {{!
2
2
 
3
- ++start++
3
+ +++start+++
4
4
 
5
- ## <a id="mappings.mustache"></a>mappings.mustache <a class='navigator' href='#top'">[top]</a>
5
+ ## <a id="mappings.mustache"></a>mappings.mustache <a class='navigator' href='#top'>[top]</a>
6
6
 
7
7
 
8
8
  Create fixed lookup tables `AWSInstanceType2Arch` and
@@ -37,7 +37,7 @@ us-west-2 trusty 14.04 LTS amd64 hvm:ebs-ssd 20150528 ami
37
37
  architectures only for **64bits**
38
38
 
39
39
 
40
- ++close++
40
+ +++close+++
41
41
 
42
42
 
43
43
  ==================================================================
@@ -46,6 +46,7 @@ The template
46
46
 
47
47
  }}
48
48
 
49
+ {{! +++fold-on+++ }}
49
50
 
50
51
 
51
52
  "AWSInstanceType2Arch" : {
@@ -65,3 +66,5 @@ The template
65
66
  "us-west-2" : { "64" : "ami-57e8d767" }
66
67
  }
67
68
 
69
+
70
+ {{! +++fold-off+++ }}
@@ -1,9 +1,9 @@
1
1
  {{!
2
2
 
3
3
 
4
- ++start++
4
+ +++start+++
5
5
 
6
- ## <a id="output.mustache"></a>output.mustache <a class='navigator' href='#top'">[top]</a>
6
+ ## <a id="output.mustache"></a>output.mustache <a class='navigator' href='#top'>[top]</a>
7
7
 
8
8
  Create one output entry to CloudFormation JSON output section
9
9
 
@@ -18,18 +18,12 @@ Create one output entry to CloudFormation JSON output section
18
18
 
19
19
 
20
20
 
21
- **Actions**:
22
-
23
- * **Name**: `Name`
24
- * **Description**: `Description`
25
- * **Value**: **Ref** if `Ref`
26
- * **Value**: `Attr.Ref`, `Attr.Name` if `Attr`
27
-
21
+ +++close+++
28
22
 
23
+ }}
29
24
 
30
- ++close++
31
25
 
32
- }}
26
+ {{! +++fold-on+++ }}
33
27
 
34
28
 
35
29
  "{{Name}}": {
@@ -38,3 +32,6 @@ Create one output entry to CloudFormation JSON output section
38
32
  {{#Attr}}, "Value" : { "Fn::GetAtt" : [ "{{Ref}}", "{{Name}}" ] }{{/Attr}}
39
33
  }{{_comma}}
40
34
 
35
+
36
+
37
+ {{! +++fold-off+++ }}
@@ -1,9 +1,9 @@
1
1
  {{!
2
2
 
3
3
 
4
- ++start++
4
+ +++start+++
5
5
 
6
- ## <a id="parameter.mustache"></a>parameter.mustache <a class='navigator' href='#top'">[top]</a>
6
+ ## <a id="parameter.mustache"></a>parameter.mustache <a class='navigator' href='#top'>[top]</a>
7
7
 
8
8
  Create one parameter entry to CloudFormation JSON parameter section
9
9
 
@@ -17,22 +17,18 @@ Create one parameter entry to CloudFormation JSON parameter section
17
17
  * `Value`: value of the parameter
18
18
 
19
19
 
20
- **Actions**:
21
-
22
- * **Name**: `Name`
23
- * **Description**: `Description`
24
- * **Type**: `Type`
25
- * **Default**: `Value`
26
-
27
- ++close++
20
+ +++close+++
28
21
 
29
22
  }}
30
23
 
31
24
 
25
+ {{! +++fold-on+++ }}
32
26
 
33
27
 
34
28
  "{{Name}}": {
35
29
  "Description" : "{{Description}}{{^Description}}No description given{{/Description}}",
36
30
  "Type": "{{Type}}",
37
31
  "Default" : "{{Value}}"
38
- }{{_comma}}
32
+ }{{_comma}}
33
+
34
+ {{! +++fold-off+++ }}
@@ -2,9 +2,9 @@
2
2
 
3
3
  resource.mustache
4
4
 
5
- ++start++
5
+ +++start+++
6
6
 
7
- ## <a id="resource.mustache"></a>resource.mustache <a class='navigator' href='#top'">[top]</a>
7
+ ## <a id="resource.mustache"></a>resource.mustache <a class='navigator' href='#top'>[top]</a>
8
8
 
9
9
 
10
10
  Dispatches resource sub-type templates based resource Type propertys
@@ -15,24 +15,14 @@ Dispatches resource sub-type templates based resource Type propertys
15
15
  * `SecurityGroup`: sub-document defining an <a href="http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html">AWS::EC2::SecurityGroup</a>
16
16
 
17
17
 
18
- **Actions**:
19
-
20
- * **include** <a href="#resourceInstance.mustache">resourceInstance.mustache</a> **if** `Instance`
21
- * **include** <a href="#resourceSecurityGroup.mustache">resourceSecurityGroup.mustache</a> **if** `SecurityGroup`
22
-
23
-
24
- **Included resources**
25
-
26
- * `resourceInstance`
27
-
28
- > resourceInstance
29
- > resourceSecurityGroup.mustache
30
-
31
- ++close++
32
-
18
+ +++close+++
33
19
 
34
20
 
35
21
  }}
36
22
 
23
+ {{! +++fold-on+++ }}
24
+
37
25
  {{# Instance }}{{> resourceInstance}}{{/ Instance }}
38
26
  {{# InstanceSecurityGroup }}{{> resourceSecurityGroup}}{{/ InstanceSecurityGroup }}
27
+
28
+ {{! +++fold-off+++ }}
@@ -1,10 +1,10 @@
1
1
  {{!
2
2
 
3
3
 
4
- ++start++
4
+ +++start+++
5
5
 
6
6
 
7
- ## <a id="resourceInstance.mustache"></a>resourceInstance.mustache <a class='navigator' href='#top'">[top]</a>
7
+ ## <a id="resourceInstance.mustache"></a>resourceInstance.mustache <a class='navigator' href='#top'>[top]</a>
8
8
 
9
9
  Create an EC2 instance
10
10
 
@@ -15,22 +15,12 @@ Create an EC2 instance
15
15
  * `tags` : array of tag sub-documents for EC2 instance
16
16
 
17
17
 
18
- **Actions**:
19
-
20
- * **Name**: `Name`
21
- * **Type**: 'AWS::EC2::Instance'
22
- * **for** `tag` **in** `tags` **include** <a href="#tag.mustache">tag.mustache</a>
23
- * **SecurityGroups.Ref**: `SecurityGroup` if `SecurityGroup`
24
- * **ImageId**: **AWSRegionArch2AMI**( 'AWS::Region', **AWSInstanceType2Arch**(`InstanceType`))
25
- * **KeyName**: `KeyName` if `KeyName`
26
-
27
- > tag
28
-
29
-
30
- ++close++
18
+ +++close+++
31
19
 
32
20
  }}
33
21
 
22
+ {{! +++fold-on+++ }}
23
+
34
24
 
35
25
  "{{Name}}" : {
36
26
  "Type" : "AWS::EC2::Instance",
@@ -42,4 +32,6 @@ Create an EC2 instance
42
32
  {{#SecurityGroup}}, "SecurityGroups" : [ { "Ref" : "{{SecurityGroup}}" } ]{{/SecurityGroup}}
43
33
  {{#KeyName}}, "KeyName" : { "Ref" : "{{KeyName}}" }{{/KeyName}}
44
34
  }
45
- }{{_comma}}
35
+ }{{_comma}}
36
+
37
+ {{! +++fold-off+++ }}
@@ -1,10 +1,10 @@
1
1
  {{!
2
2
 
3
3
 
4
- ++start++
4
+ +++start+++
5
5
 
6
6
 
7
- ## <a id="resourceSecurityGroup.mustache"></a>resourceSecurityGroup.mustache <a class='navigator' href='#top'">[top]</a>
7
+ ## <a id="resourceSecurityGroup.mustache"></a>resourceSecurityGroup.mustache <a class='navigator' href='#top'>[top]</a>
8
8
 
9
9
  Create an EC2 Security Group
10
10
 
@@ -13,15 +13,12 @@ Create an EC2 Security Group
13
13
  * `Name` : of the security group
14
14
  * `IngressRef`: A refernce to parameter, which defined CIDR for to inbound traffic (ingress)
15
15
 
16
- **Actions**:
16
+ +++close+++
17
17
 
18
- * **Name**: `Name`
19
- * **Type**: "AWS::EC2::SecurityGroup"
20
- * **Properties.SecurityGroupIngress[0].CidrIp**: `IngressRef`
18
+ }}
21
19
 
22
- ++close++
20
+ {{! +++fold-on+++ }}
23
21
 
24
- }}
25
22
 
26
23
  "{{Name}}" : {
27
24
  "Type" : "AWS::EC2::SecurityGroup",
@@ -35,3 +32,5 @@ Create an EC2 Security Group
35
32
  } ]
36
33
  }
37
34
  }{{_comma}}
35
+
36
+ {{! +++fold-off+++ }}
@@ -1,8 +1,8 @@
1
1
  {{!
2
2
 
3
- ++start++
3
+ +++start+++
4
4
 
5
- ## <a id="resources.mustache"></a>resources.mustache <a class='navigator' href='#top'">[top]</a>
5
+ ## <a id="resources.mustache"></a>resources.mustache <a class='navigator' href='#top'>[top]</a>
6
6
 
7
7
  Empty template.
8
8
 
@@ -13,13 +13,16 @@ Empty template.
13
13
 
14
14
  **Actions**:
15
15
 
16
- * no action (i.e. empty template)
16
+ * no action (i.e. template commented out)
17
17
 
18
18
 
19
- ++close++
19
+ +++close+++
20
20
 
21
21
 
22
22
  }}
23
+
24
+ {{! +++fold-on+++ }}
25
+
23
26
  {{!
24
27
 
25
28
  Moved to YAML
@@ -32,4 +35,7 @@ Empty template.
32
35
  }
33
36
  }
34
37
 
35
- }}
38
+ }}
39
+
40
+
41
+ {{! +++fold-off+++ }}