cfhighlander 0.5.0.alpha.1535961316 → 0.5.0.alpha.1535961584

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d3f2fc2c0753578e7d988f09119fc32dd44f898b8a73629730a09085f1fddc5
4
- data.tar.gz: 006d4985a78560abaac2dbdbf751c6cc1a1f7ec46eb4852eca97698ca0b8d81a
3
+ metadata.gz: 2fffe7543ac877cf4a564748bc368730b6d3f494ec2fbb144d92ebefa30152b7
4
+ data.tar.gz: d7d6f214ae8af483055cc723f07c494e1155f924283f04bc51baa11157369716
5
5
  SHA512:
6
- metadata.gz: 32c21c1e1b80b2cb54d2927ceed810835e6cb79cf89be3c79fa12957422717739cee583820da324d6e390dd9832a18564b536ef4ba2b08a8b9181ad5ca5e97f4
7
- data.tar.gz: 5f97f28dc17688fd9565f9ef604fe9755db3d814b6907f3bf2ee858f265ed94b7b2667c63cacec8bf60e78371752c223de16fe7264e736d32f4b9a1880552696
6
+ metadata.gz: 463ccebc895cb0aa7551356604a58ceef5421eb92442d267ec8dc2b386295264903a38c75185365eb0e71310e26722130c7947c0a48104ff4298f1c41262c362
7
+ data.tar.gz: 2542890fbad5d9df0291823552a3e5f9bcb1ca8050fee5bcd188869caa3b42a2f13a8c94505f5d075c76332a29eb9168cf5877188eb132eccc1683988812f870
@@ -84,7 +84,7 @@ module Cfhighlander
84
84
  component_cfndsl.gsub!("\n", "\n\t")
85
85
  component_cfndsl.gsub!("\r\n", "\r\n\t")
86
86
  # render cfndsl
87
- renderer = ERB.new(File.read("#{__dir__}/../templates/cfndsl.component.template.erb"))
87
+ renderer = ERB.new(File.read("#{__dir__}/../templates/cfndsl.component.template.erb"), nil, '-')
88
88
  cfn_template = renderer.result(OpenStruct.new({
89
89
  'dsl' => dsl,
90
90
  'component_cfndsl' => component_cfndsl,
@@ -35,15 +35,34 @@ module Cfhighlander
35
35
  param.provided_value = "#{component}.#{name}"
36
36
  end
37
37
 
38
- def ComponentParam(name, defaultValue = '', isGlobal: false, noEcho: false, type: 'String', allowedValues: nil)
39
- param = Parameter.new(name, type, defaultValue, noEcho, isGlobal, allowedValues)
38
+ def ComponentParam(name, defaultValue = '', isGlobal: false, noEcho: false, type: 'String', allowedValues: nil, allowedPattern: nil,
39
+ maxLength: nil, maxValue: nil, minLength: nil, minValue: nil, description: nil, constraintDescription: nil)
40
+ param = Parameter.new(
41
+ name: name,
42
+ type: type,
43
+ defaultValue: defaultValue,
44
+ noEcho: noEcho,
45
+ isGlobal: isGlobal,
46
+ allowedValues: allowedValues,
47
+ allowedPattern: allowedPattern,
48
+ maxLength: maxLength,
49
+ maxValue: maxValue,
50
+ minLength: minLength,
51
+ minValue: minValue,
52
+ description: description,
53
+ constraintDescription: constraintDescription
54
+ )
40
55
  param.config = @config
41
56
  addParam param
42
57
  return param
43
58
  end
44
59
 
45
60
  def MappingParam(name, defaultValue = '', &block)
46
- param = MappingParam.new(name, 'String', defaultValue)
61
+ param = MappingParam.new(
62
+ name: name,
63
+ type: 'String',
64
+ defaultValue: defaultValue
65
+ )
47
66
  param.config = @config
48
67
  param.instance_eval(&block)
49
68
  addParam param
@@ -60,16 +79,30 @@ module Cfhighlander
60
79
  :no_echo,
61
80
  :is_global,
62
81
  :provided_value,
63
- :allowed_values
64
-
65
- def initialize(name, type, defaultValue, noEcho = false, isGlobal = false, allowed_values = nil)
66
- @no_echo = noEcho
67
- @name = name
68
- @type = type
69
- @default_value = defaultValue
70
- @is_global = isGlobal
71
- @allowed_values = allowed_values
72
- @provided_value = nil
82
+ :allowed_values,
83
+ :allowed_pattern,
84
+ :max_length,
85
+ :max_value,
86
+ :min_length,
87
+ :min_value,
88
+ :description,
89
+ :constraint_description
90
+
91
+ def initialize(params = {})
92
+ @no_echo = params.fetch(:noEcho, false)
93
+ @name = params.fetch(:name)
94
+ @type = params.fetch(:type)
95
+ @default_value = params.fetch(:defaultValue)
96
+ @is_global = params.fetch(:isGlobal, false)
97
+ @allowed_values = params.fetch(:allowedValues, nil)
98
+ @provided_value = params.fetch(:providedValue, nil)
99
+ @allowed_pattern = params.fetch(:allowedPattern, nil)
100
+ @max_length = params.fetch(:maxLength, nil)
101
+ @max_value = params.fetch(:maxValue, nil)
102
+ @min_length = params.fetch(:minLength, nil)
103
+ @min_value = params.fetch(:minValue, nil)
104
+ @description = params.fetch(:description, nil)
105
+ @constraint_description = params.fetch(:constraintDescription, nil)
73
106
  end
74
107
 
75
108
  end
@@ -35,8 +35,33 @@ CloudFormation do
35
35
  Parameter('<%= @param.name %>') do
36
36
  Type '<%= @param.type %>'
37
37
  Default '<%= @param.default_value %>'
38
- <% unless @param.no_echo.nil? %>NoEcho <%= @param.no_echo.to_s %> <% end %>
39
- <% unless @param.allowed_values.nil? %>AllowedValues <%= @param.allowed_values.to_s %> <% end %>
38
+ <%- unless @param.no_echo.nil? -%>
39
+ NoEcho <%= @param.no_echo %>
40
+ <%- end -%>
41
+ <%- unless @param.allowed_values.nil? -%>
42
+ AllowedValues <%= @param.allowed_values %>
43
+ <%- end -%>
44
+ <%- unless @param.allowed_pattern.nil? -%>
45
+ AllowedPattern <%= @param.allowed_pattern %>
46
+ <%- end -%>
47
+ <%- unless @param.max_length.nil? -%>
48
+ MaxLength <%= @param.max_length %>
49
+ <%- end -%>
50
+ <%- unless @param.max_value.nil? -%>
51
+ MaxValue <%= @param.max_value %>
52
+ <%- end -%>
53
+ <%- unless @param.min_length.nil? -%>
54
+ MinLength <%= @param.min_length %>
55
+ <%- end -%>
56
+ <%- unless @param.min_value.nil? -%>
57
+ MinValue <%= @param.min_value %>
58
+ <%- end -%>
59
+ <%- unless @param.description.nil? -%>
60
+ Description '<%= @param.description %>'
61
+ <%- end -%>
62
+ <%- unless @param.constraint_description.nil? -%>
63
+ ConstraintDescription '<%= @param.constraint_description %>'
64
+ <%- end -%>
40
65
  end
41
66
  <% end %>
42
67
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cfhighlander
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0.alpha.1535961316
4
+ version: 0.5.0.alpha.1535961584
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nikola Tosic