lono 3.5.0 → 4.0.0

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.
Files changed (186) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +15 -4
  3. data/.rspec +1 -0
  4. data/CHANGELOG.md +15 -1
  5. data/Gemfile +3 -3
  6. data/Guardfile +17 -8
  7. data/{LICENSE → LICENSE.txt} +1 -1
  8. data/README.md +20 -12
  9. data/Rakefile +1 -2
  10. data/{bin → exe}/lono +1 -0
  11. data/lib/lono.rb +12 -9
  12. data/lib/lono/cfn.rb +7 -9
  13. data/lib/lono/cfn/{aws_services.rb → aws_service.rb} +1 -1
  14. data/lib/lono/cfn/base.rb +41 -38
  15. data/lib/lono/cfn/create.rb +6 -2
  16. data/lib/lono/cfn/delete.rb +2 -2
  17. data/lib/lono/cfn/diff.rb +1 -1
  18. data/lib/lono/cfn/preview.rb +26 -15
  19. data/lib/lono/cfn/update.rb +11 -9
  20. data/lib/lono/cfn/util.rb +3 -3
  21. data/lib/lono/clean.rb +1 -1
  22. data/lib/lono/cli.rb +71 -39
  23. data/lib/lono/command.rb +42 -18
  24. data/lib/lono/completer.rb +162 -0
  25. data/lib/lono/completer/script.rb +6 -0
  26. data/lib/lono/completer/script.sh +10 -0
  27. data/lib/lono/completion.rb +15 -0
  28. data/lib/lono/core.rb +23 -9
  29. data/lib/lono/core/config.rb +20 -0
  30. data/lib/lono/default/settings.yml +33 -13
  31. data/lib/lono/help.rb +6 -79
  32. data/lib/lono/help/cfn.md +6 -0
  33. data/lib/lono/help/cfn/create.md +22 -0
  34. data/lib/lono/help/cfn/delete.md +5 -0
  35. data/lib/lono/help/cfn/diff.md +5 -0
  36. data/lib/lono/help/cfn/download.md +5 -0
  37. data/lib/lono/help/cfn/preview.md +11 -0
  38. data/lib/lono/help/cfn/update.md +21 -0
  39. data/lib/lono/help/completion.md +22 -0
  40. data/lib/lono/help/completion_script.md +3 -0
  41. data/lib/lono/help/generate.md +7 -0
  42. data/lib/lono/help/hello.md +5 -0
  43. data/lib/lono/help/import.md +7 -0
  44. data/lib/lono/help/inspect.md +4 -0
  45. data/lib/lono/help/inspect/depends.md +3 -0
  46. data/lib/lono/help/inspect/summary.md +3 -0
  47. data/lib/lono/help/new.md +8 -0
  48. data/lib/lono/help/param.md +3 -0
  49. data/lib/lono/{param/help.rb → help/param/generate.md} +1 -9
  50. data/lib/lono/help/script/build.md +5 -0
  51. data/lib/lono/help/script/upload.md +8 -0
  52. data/lib/lono/help/template.md +4 -0
  53. data/lib/lono/help/template/bashify.md +4 -0
  54. data/lib/lono/help/template/generate.md +7 -0
  55. data/lib/lono/help/user_data.md +3 -0
  56. data/lib/lono/importer.rb +43 -20
  57. data/lib/lono/inspector.rb +2 -19
  58. data/lib/lono/inspector/base.rb +2 -2
  59. data/lib/lono/inspector/{depends.rb → graph.rb} +3 -3
  60. data/lib/lono/inspector/summary.rb +1 -1
  61. data/lib/lono/new.rb +79 -26
  62. data/lib/lono/new/helper.rb +16 -0
  63. data/lib/lono/new/message.rb +35 -0
  64. data/lib/lono/param.rb +1 -2
  65. data/lib/lono/param/generator.rb +34 -86
  66. data/lib/lono/project_checker.rb +35 -40
  67. data/lib/lono/script.rb +19 -0
  68. data/lib/lono/script/base.rb +9 -0
  69. data/lib/lono/script/build.rb +73 -0
  70. data/lib/lono/script/upload.rb +81 -0
  71. data/lib/lono/sequence.rb +33 -0
  72. data/lib/lono/setting.rb +83 -0
  73. data/lib/lono/template.rb +8 -9
  74. data/lib/lono/template/{aws_services.rb → aws_service.rb} +1 -1
  75. data/lib/lono/template/context.rb +73 -0
  76. data/lib/lono/template/dsl.rb +63 -64
  77. data/lib/lono/template/helper.rb +201 -0
  78. data/lib/lono/template/template.rb +29 -221
  79. data/lib/lono/template/upload.rb +41 -33
  80. data/lib/lono/upgrade4.rb +175 -0
  81. data/lib/lono/user_data.rb +31 -0
  82. data/lib/lono/version.rb +1 -1
  83. data/lib/starter_projects/autoscaling/.gitignore +1 -0
  84. data/lib/starter_projects/{json_project → autoscaling}/Gemfile +0 -0
  85. data/lib/starter_projects/{yaml_project → autoscaling}/Guardfile +0 -0
  86. data/lib/starter_projects/autoscaling/README.md +118 -0
  87. data/lib/starter_projects/autoscaling/app/definitions/base.rb +2 -0
  88. data/lib/starter_projects/autoscaling/app/templates/autoscaling.yml +682 -0
  89. data/lib/starter_projects/autoscaling/config/params/base/autoscaling.txt +6 -0
  90. data/lib/starter_projects/autoscaling/config/settings.yml +33 -0
  91. data/lib/starter_projects/ec2/.gitignore +1 -0
  92. data/lib/starter_projects/{yaml_project → ec2}/Gemfile +0 -0
  93. data/lib/starter_projects/{json_project → ec2}/Guardfile +1 -1
  94. data/lib/starter_projects/ec2/README.md +86 -0
  95. data/lib/starter_projects/ec2/app/definitions/base.rb +2 -0
  96. data/lib/starter_projects/ec2/app/definitions/development.rb +1 -0
  97. data/lib/starter_projects/ec2/app/definitions/production.rb +1 -0
  98. data/lib/starter_projects/{yaml_project → ec2/app}/helpers/my_custom_helper.rb +0 -0
  99. data/lib/starter_projects/{json_project/templates/user_data/app.sh → ec2/app/partials/user_data/bootstrap.sh} +1 -2
  100. data/lib/starter_projects/{yaml_project → ec2/app}/templates/example.yml +0 -0
  101. data/lib/starter_projects/{json_project/params/base/api-web.txt → ec2/config/params/base/example.txt} +0 -0
  102. data/lib/starter_projects/ec2/config/params/development/example.txt +3 -0
  103. data/lib/starter_projects/ec2/config/params/production/example.txt +2 -0
  104. data/lib/starter_projects/ec2/config/settings.yml +33 -0
  105. data/lib/starter_projects/ec2/config/variables/base.rb +3 -0
  106. data/lib/starter_projects/ec2/config/variables/development.rb +2 -0
  107. data/lib/starter_projects/ec2/config/variables/production.rb +2 -0
  108. data/lib/starter_projects/ec2/welcome.txt +8 -0
  109. data/lib/starter_projects/skeleton/.gitignore +1 -0
  110. data/lib/starter_projects/skeleton/Gemfile +3 -0
  111. data/lib/starter_projects/skeleton/Guardfile +12 -0
  112. data/lib/starter_projects/skeleton/README.md +53 -0
  113. data/{spec/fixtures/my_project/templates/.gitkeep → lib/starter_projects/skeleton/app/definitions/base.rb} +0 -0
  114. data/lib/starter_projects/skeleton/config/settings.yml +33 -0
  115. data/lib/starter_projects/skeleton/welcome.txt +7 -0
  116. data/lono.gemspec +12 -10
  117. data/spec/fixtures/lono_project/.gitignore +1 -0
  118. data/spec/fixtures/lono_project/Gemfile +3 -0
  119. data/spec/fixtures/lono_project/Guardfile +12 -0
  120. data/spec/fixtures/lono_project/app/definitions/base.rb +10 -0
  121. data/spec/fixtures/lono_project/app/definitions/base/more.rb +7 -0
  122. data/spec/fixtures/lono_project/app/definitions/development.rb +1 -0
  123. data/spec/fixtures/lono_project/app/definitions/production.rb +1 -0
  124. data/spec/fixtures/lono_project/app/helpers/custom_helper.rb +5 -0
  125. data/spec/fixtures/lono_project/app/partials/security_group.yml +10 -0
  126. data/{lib/starter_projects/yaml_project/templates/partial → spec/fixtures/lono_project/app/partials}/user_data/bootstrap.sh +8 -2
  127. data/spec/fixtures/lono_project/app/templates/example.yml +50 -0
  128. data/{lib/starter_projects/yaml_project/params/base/api-web-prod.txt → spec/fixtures/lono_project/config/params/base/example.txt} +1 -0
  129. data/spec/fixtures/lono_project/config/params/development/example.txt +1 -0
  130. data/spec/fixtures/lono_project/config/params/production/example.txt +1 -0
  131. data/spec/fixtures/lono_project/config/settings.yml +31 -0
  132. data/spec/fixtures/lono_project/config/variables/base.rb +3 -0
  133. data/spec/fixtures/lono_project/config/variables/development.rb +1 -0
  134. data/spec/fixtures/lono_project/config/variables/production.rb +1 -0
  135. data/spec/fixtures/params/envonly/params/{prod → development}/network.txt +0 -0
  136. data/spec/fixtures/params/overlay/params/{prod → development}/network.txt +0 -0
  137. data/spec/fixtures/raw_templates/aws-waf-security-automations.template +2 -2
  138. data/spec/lib/lono/cfn_spec.rb +6 -9
  139. data/spec/lib/lono/cli_spec.rb +44 -0
  140. data/spec/lib/lono/completion_spec.rb +17 -0
  141. data/spec/lib/lono/inspect_spec.rb +6 -15
  142. data/spec/lib/lono/param/generator_spec.rb +45 -26
  143. data/spec/lib/lono/param_spec.rb +1 -3
  144. data/spec/lib/lono/setting_spec.rb +47 -0
  145. data/spec/lib/lono/template/dsl_spec.rb +33 -157
  146. data/spec/lib/lono/template_spec.rb +4 -16
  147. data/spec/spec_helper.rb +45 -14
  148. metadata +168 -82
  149. data/.coveralls.yml +0 -1
  150. data/lib/lono/cfn/help.rb +0 -103
  151. data/lib/lono/current_region.rb +0 -42
  152. data/lib/lono/inspector/help.rb +0 -21
  153. data/lib/lono/settings.rb +0 -45
  154. data/lib/lono/template/help.rb +0 -25
  155. data/lib/lono/template/helpers.rb +0 -136
  156. data/lib/starter_projects/json_project/.gitignore +0 -1
  157. data/lib/starter_projects/json_project/config/templates/base/blog.rb +0 -20
  158. data/lib/starter_projects/json_project/config/templates/base/stacks.rb +0 -58
  159. data/lib/starter_projects/json_project/templates/db.json +0 -212
  160. data/lib/starter_projects/json_project/templates/partial/host_record.json +0 -28
  161. data/lib/starter_projects/json_project/templates/partial/server.json +0 -45
  162. data/lib/starter_projects/json_project/templates/user_data/db.sh +0 -39
  163. data/lib/starter_projects/json_project/templates/user_data/db2.sh +0 -2
  164. data/lib/starter_projects/json_project/templates/user_data/ruby_script.rb +0 -5
  165. data/lib/starter_projects/json_project/templates/web.json +0 -386
  166. data/lib/starter_projects/yaml_project/.gitignore +0 -1
  167. data/lib/starter_projects/yaml_project/config/templates/base/blog.rb +0 -20
  168. data/lib/starter_projects/yaml_project/config/templates/base/stacks.rb +0 -56
  169. data/lib/starter_projects/yaml_project/config/templates/prod/stacks.rb +0 -1
  170. data/lib/starter_projects/yaml_project/config/templates/stag/stacks.rb +0 -1
  171. data/lib/starter_projects/yaml_project/config/variables/base/variables.rb +0 -4
  172. data/lib/starter_projects/yaml_project/config/variables/prod/variables.rb +0 -1
  173. data/lib/starter_projects/yaml_project/config/variables/stag/variables.rb +0 -1
  174. data/lib/starter_projects/yaml_project/params/base/example.txt +0 -2
  175. data/lib/starter_projects/yaml_project/params/prod/example.txt +0 -1
  176. data/lib/starter_projects/yaml_project/params/stag/example.txt +0 -1
  177. data/lib/starter_projects/yaml_project/templates/db.yml +0 -148
  178. data/lib/starter_projects/yaml_project/templates/partial/host_record.yml +0 -14
  179. data/lib/starter_projects/yaml_project/templates/partial/server.yml +0 -59
  180. data/lib/starter_projects/yaml_project/templates/web.yml +0 -206
  181. data/spec/fixtures/my_project/config/templates/base/stacks.rb +0 -3
  182. data/spec/fixtures/my_project/params/my-stack.txt +0 -3
  183. data/spec/fixtures/my_project/templates/my-stack.yml +0 -0
  184. data/spec/lib/lono/new_spec.rb +0 -59
  185. data/spec/lib/lono/template/template_spec.rb +0 -104
  186. data/spec/lib/lono_spec.rb +0 -27
data/.coveralls.yml DELETED
@@ -1 +0,0 @@
1
- service_name: travis-ci
data/lib/lono/cfn/help.rb DELETED
@@ -1,103 +0,0 @@
1
- class Lono::Cfn::Help
2
- class << self
3
- def create
4
- <<-EOL
5
- Examples:
6
-
7
- Provided that you are in a lono project and have a `my-stack` lono template definition. To create a stack you can simply run:
8
-
9
- $ lono cfn create my-stack
10
-
11
- The above command will generate and use the template in output/my-stack.json and parameters in params/my-stack.txt. The template by convention defaults to the name of the stack. In turn, the params by convention defaults to the name of the template.
12
-
13
- Here are examples of overriding the template and params name conventions.
14
-
15
- $ lono cfn create my-stack --template different1
16
-
17
- The template used is output/different1.json and the parameters used is output/params/prod/different1.json.
18
-
19
- $ lono cfn create my-stack --params different2
20
-
21
- The template used is output/my-stack.json and the parameters used is output/params/prod/different2.json.
22
-
23
- $ lono cfn create my-stack --template different3 --params different4
24
-
25
- The template used is output/different3.json and the parameters used is output/params/prod/different4.json.
26
-
27
- EOL
28
- end
29
-
30
- def update
31
- <<-EOL
32
- Examples:
33
-
34
- Provided that you are in a lono project and have a `my-stack` lono template definition. To update a stack you can simply run:
35
-
36
- $ lono cfn update my-stack
37
-
38
- The above command will generate and use the template in output/my-stack.json and parameters in params/my-stack.txt. The template by convention defaults to the name of the stack. In turn, the params by convention defaults to the name of the template.
39
-
40
- Here are examples of overriding the template and params name conventions.
41
-
42
- $ lono cfn update my-stack --template different1
43
-
44
- The template used is output/different1.json and the parameters used is output/params/prod/different1.json.
45
-
46
- $ lono cfn update my-stack --params different2
47
-
48
- The template used is output/my-stack.json and the parameters used is output/params/prod/different2.json.
49
-
50
- $ lono cfn update my-stack --template different3 --params different4
51
-
52
- The template used is output/different3.json and the parameters used is output/params/prod/different4.json.
53
-
54
- EOL
55
- end
56
-
57
- def delete
58
- <<-EOL
59
- Examples:
60
-
61
- $ lono cfn delete my-stack
62
-
63
- The above command will delete my-stack.
64
- EOL
65
- end
66
-
67
- def preview
68
- <<-EOL
69
- Generates a CloudFormation preview. This is similar to a `terraform plan` or puppet's dry-run mode.
70
-
71
- Example output:
72
-
73
- CloudFormation preview for 'example' stack update. Changes:
74
-
75
- Remove AWS::Route53::RecordSet: DnsRecord testsubdomain.sub.tongueroo.com
76
-
77
- Examples:
78
-
79
- $ lono cfn preview my-stack
80
- EOL
81
- end
82
-
83
- def diff
84
- <<-EOL
85
- Displays code diff of the generated CloudFormation template locally vs the existing template on AWS. You can set a desired diff viewer by setting the LONO_CFN_DIFF environment variable.
86
-
87
- Examples:
88
-
89
- $ lono cfn diff my-stack
90
- EOL
91
- end
92
-
93
- def download
94
- <<-EOL
95
- Download CloudFormation template from existing template on AWS.
96
-
97
- Examples:
98
-
99
- $ lono cfn download my-stack
100
- EOL
101
- end
102
- end
103
- end
@@ -1,42 +0,0 @@
1
- require 'aws-sdk-core'
2
-
3
- module Lono::CurrentRegion
4
- def current_region
5
- region = Aws.config[:region]
6
- region ||= ENV['AWS_REGION']
7
- return region if region
8
-
9
- if ENV['AWS_PROFILE']
10
- path = "#{ENV['HOME']}/.aws/config"
11
- if File.exist?(path)
12
- lines = IO.readlines(path)
13
- capture_default, capture_current = false, false
14
- lines.each do | line|
15
- if line.include?('[default]')
16
- capture_default = true # next line
17
- next
18
- end
19
- if capture_default && line.match(/region = /)
20
- default_region = line.split(' = ').last.strip
21
- capture_default = false
22
- end
23
-
24
- md = line.match(/\[profile (.*)\]/)
25
- if md && md[1] == ENV['AWS_PROFILE']
26
- capture_current = true
27
- next
28
- end
29
- if capture_current && line.match(/region = /)
30
- region = line.split(' = ').last.strip
31
- capture_current = false
32
- end
33
- end
34
- end
35
-
36
- region ||= default_region
37
- return region if region
38
- end
39
-
40
- 'us-east-1' # default
41
- end
42
- end
@@ -1,21 +0,0 @@
1
- class Lono::Inspector::Help
2
- class << self
3
- def summary
4
- <<-EOL
5
- Example:
6
-
7
- $ lono inspect summary my-stack
8
-
9
- EOL
10
- end
11
-
12
- def depends
13
- <<-EOL
14
- Example:
15
-
16
- $ lono inspect depends my-stack
17
-
18
- EOL
19
- end
20
- end
21
- end
data/lib/lono/settings.rb DELETED
@@ -1,45 +0,0 @@
1
- class Lono::Settings
2
- # The options from the files get merged with the following precedence:
3
- #
4
- # current folder - The current folder’s config/settings.yml values take the highest precedence.
5
- # user - The user’s ~/.lono/settings.yml values take the second highest precedence.
6
- # default - The default settings bundled with the tool takes the lowest precedence.
7
- #
8
- # More info: http://lono.cloud/docs/settings/
9
- def data
10
- return @settings_yaml if @settings_yaml
11
-
12
- project_file = "#{Lono.root}/config/settings.yml"
13
- project = File.exist?(project_file) ? YAML.load_file(project_file) : {}
14
-
15
- user_file = "#{ENV['HOME']}/.lono/settings.yml"
16
- user = File.exist?(user_file) ? YAML.load_file(user_file) : {}
17
-
18
- default_file = File.expand_path("../default/settings.yml", __FILE__)
19
- default = YAML.load_file(default_file)
20
-
21
- @settings_yaml = default.merge(user.merge(project))
22
- end
23
-
24
- # Examples:
25
- #
26
- # Using the Lono.env
27
- # s3:
28
- # path:
29
- # production: s3://infrastructure-prod/cloudformation
30
- # staging: s3://infrastructure-dev/cloudformation
31
- #
32
- # Using the AWS_PROFILE
33
- # s3:
34
- # path:
35
- # my-prod-profile: s3://infrastructure-prod/cloudformation
36
- # my-stag-profile: s3://infrastructure-dev/cloudformation
37
- #
38
- def s3_path
39
- s3 = data['s3']
40
- s3_path = s3['path']
41
- # s3_path['default'] - key will always exist because of default lono/settings.yml
42
- # default value is nil though
43
- s3_path[ENV['AWS_PROFILE']] || s3_path[Lono.env] || s3_path['default']
44
- end
45
- end
@@ -1,25 +0,0 @@
1
- module Lono::Template::Help
2
- def generate
3
- <<-EOL
4
- Examples:
5
-
6
- $ lono template generate
7
-
8
- $ lono template g -c # shortcut
9
-
10
- Builds the CloudFormation templates files based on lono project and writes them to the output folder on the filesystem.
11
- EOL
12
- end
13
-
14
- def bashify
15
- <<-EOL
16
- Examples:
17
-
18
- $ lono template bashify /path/to/cloudformation-template.json
19
-
20
- $ lono template bashify https://s3.amazonaws.com/cloudformation-templates-us-east-1/EC2WebSiteSample.template
21
- EOL
22
- end
23
-
24
- extend self
25
- end
@@ -1,136 +0,0 @@
1
- module Lono::Template::Helpers
2
- def template_s3_path(template_name)
3
- format = @_detected_format.sub('yaml','yml')
4
- template_path = "#{template_name}.#{format}"
5
-
6
- # must have settings.s3_path for this to owrk
7
- settings = Lono::Settings.new
8
- if settings.s3_path
9
- # high jacking Upload for useful s3_https_url method
10
- upload = Lono::Template::Upload.new(@_options)
11
- upload.s3_https_url(template_path)
12
- else
13
- message = "template_s3_path helper called but s3.path not configured in settings.yml"
14
- puts "WARN: #{message}".colorize(:yellow)
15
- message
16
- end
17
- end
18
-
19
- def template_params(param_name)
20
- param_path = "params/#{Lono.env}/#{param_name}.txt"
21
- generator_options = {
22
- path: param_path,
23
- allow_no_file: true
24
- }.merge(@_options)
25
- generator = Lono::Param::Generator.new(param_name, generator_options)
26
- # do not generate because lono cfn calling logic already generated it we only need the values
27
- generator.params # Returns Array in underscore keys format
28
- end
29
-
30
- # Really only useful if using json format
31
- def user_data(path, vars={})
32
- path = "#{Lono.root}/templates/user_data/#{path}"
33
- template = IO.read(path)
34
- variables(vars)
35
- result = erb_result(path, template)
36
- output = []
37
- result.split("\n").each do |line|
38
- output += transform(line)
39
- end
40
- json = output.to_json
41
- json[0] = '' # remove first char: [
42
- json.chop! # remove last char: ]
43
- end
44
-
45
- def ref(name)
46
- %Q|{"Ref"=>"#{name}"}|
47
- end
48
-
49
- def find_in_map(*args)
50
- %Q|{"Fn::FindInMap" => [ #{transform_array(args)} ]}|
51
- end
52
-
53
- def base64(value)
54
- %Q|{"Fn::Base64"=>"#{value}"}|
55
- end
56
-
57
- def get_att(*args)
58
- %Q|{"Fn::GetAtt" => [ #{transform_array(args)} ]}|
59
- end
60
-
61
- def get_azs(region="AWS::Region")
62
- %Q|{"Fn::GetAZs"=>"#{region}"}|
63
- end
64
-
65
- def join(delimiter, values)
66
- %Q|{"Fn::Join" => ["#{delimiter}", [ #{transform_array(values)} ]]}|
67
- end
68
-
69
- def select(index, list)
70
- %Q|{"Fn::Select" => ["#{index}", [ #{transform_array(list)} ]]}|
71
- end
72
-
73
- def partial_exist?(path)
74
- path = partial_path_for(path)
75
- path = auto_add_format(path)
76
- path && File.exist?(path)
77
- end
78
-
79
- # The partial's path is a relative path given without the extension and
80
- #
81
- # Example:
82
- # Given: file in templates/partial/iam/docker.yml
83
- # The path should be: iam/docker
84
- #
85
- # If the user specifies the extension then use that instead of auto-adding
86
- # the detected format.
87
- def partial(path,vars={}, options={})
88
- path = partial_path_for(path)
89
- path = auto_add_format(path)
90
-
91
- template = IO.read(path)
92
- variables(vars)
93
- result = erb_result(path, template)
94
- result = indent(result, options[:indent]) if options[:indent]
95
- result
96
- end
97
-
98
- # add indentation
99
- def indent(text, indentation_amount)
100
- text.split("\n").map do |line|
101
- " " * indentation_amount + line
102
- end.join("\n")
103
- end
104
-
105
- private
106
- def partial_path_for(path)
107
- "#{Lono.root}/templates/partial/#{path}"
108
- end
109
-
110
- def auto_add_format(path)
111
- # Return immediately if user provided explicit extension
112
- extension = File.extname(path) # current extension
113
- return path if !extension.empty?
114
-
115
- # Else let's auto detect
116
- paths = Dir.glob("#{path}.*")
117
-
118
- if paths.size == 1 # non-ambiguous match
119
- return paths.first
120
- end
121
-
122
- if paths.size > 1 # ambiguous match
123
- puts "ERROR: Multiple possible partials found:".colorize(:red)
124
- paths.each do |path|
125
- puts " #{path}"
126
- end
127
- puts "Please specify an extension in the name to remove the ambiguity.".colorize(:green)
128
- exit 1
129
- end
130
-
131
- # Account for case when user wants to include a file with no extension at all
132
- return path if File.exist?(path) && !File.directory?(path)
133
-
134
- path # original path if this point is reached
135
- end
136
- end
@@ -1 +0,0 @@
1
- /output
@@ -1,20 +0,0 @@
1
- template "blog-web" do
2
- app,role,env = name.split('-')
3
- source "web"
4
- variables(
5
- env: env,
6
- app: app,
7
- role: role,
8
- ami: "ami-4836a428", # us-west-2
9
- instance_type: "t2.small",
10
- port: "80",
11
- high_threshold: "35",
12
- high_periods: "4",
13
- low_threshold: "20",
14
- low_periods: "2",
15
- max_size: "6",
16
- min_size: "3",
17
- down_adjustment: "-1",
18
- up_adjustment: "2"
19
- )
20
- end
@@ -1,58 +0,0 @@
1
- template "api-web" do
2
- source "web"
3
- variables(
4
- ami: "ami-123",
5
- instance_type: "t2.small",
6
- port: "80",
7
- high_threshold: "15",
8
- high_periods: "4",
9
- low_threshold: "5",
10
- low_periods: "10",
11
- max_size: "24",
12
- min_size: "6",
13
- down_adjustment: "-3",
14
- up_adjustment: "3",
15
- ssl_cert: "arn:aws:iam::12345:server-certificate/wildcard"
16
- )
17
- end
18
-
19
- template "api-worker" do
20
- source "web"
21
- variables(
22
- ami: "ami-123",
23
- instance_type: "t2.small",
24
- port: "80",
25
- high_threshold: "15",
26
- high_periods: "4",
27
- low_threshold: "5",
28
- low_periods: "10",
29
- max_size: "24",
30
- min_size: "6",
31
- down_adjustment: "-3",
32
- up_adjustment: "3",
33
- user_data_script: "ruby_script.rb",
34
- ssl_cert: "arn:aws:iam::12345:server-certificate/wildcard"
35
- )
36
- end
37
-
38
- template "api-redis" do
39
- source "db"
40
- variables(
41
- ami: "ami-456",
42
- instance_type: "t2.small",
43
- port: "80",
44
- volume_size: "20",
45
- availability_zone: "us-east-1e"
46
- )
47
- end
48
-
49
- template "parent/db-stack" do
50
- source "db"
51
- variables(
52
- ami: "ami-456",
53
- instance_type: "t2.small",
54
- port: "80",
55
- volume_size: "20",
56
- availability_zone: "us-east-1e"
57
- )
58
- end