Module: KnifeCloudformation::Knife::Template

Included in:
Chef::Knife::CloudformationCreate, Chef::Knife::CloudformationUpdate, Chef::Knife::CloudformationValidate
Defined in:
lib/knife-cloudformation/knife/template.rb

Overview

Template handling helper methods

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Constant Summary collapse

TEMPLATE_IGNORE_DIRECTORIES =

cloudformation directories that should be ignored

%w(components dynamics registry)

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object

Load methods into class and define options

Parameters:

  • klass (Class)


138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/knife-cloudformation/knife/template.rb', line 138

def self.included(klass)
  klass.class_eval do
    extend KnifeCloudformation::Knife::Template::ClassMethods
    include KnifeCloudformation::Knife::Template::InstanceMethods
    include KnifeCloudformation::Utils::PathSelector

    option(:processing,
      :long => '--[no-]processing',
      :description => 'Call the unicorns and explode the glitter bombs',
      :boolean => true,
      :default => false,
      :proc => lambda {|val| Chef::Config[:knife][:cloudformation][:processing] = val }
    )
    option(:file,
      :short => '-f PATH',
      :long => '--file PATH',
      :description => 'Path to Cloud Formation to process',
      :proc => lambda {|val|
        Chef::Config[:knife][:cloudformation][:file] = val
      }
    )
    option(:file_path_prompt,
      :long => '--[no-]file-path-prompt',
      :description => 'Interactive prompt for template path discovery',
      :boolean => true,
      :default => true,
      :proc => lambda {|val|
        Chef::Config[:knife][:cloudformation][:file_path_prompt] = val
      }
    )
    option(:base_directory,
      :long => '--cloudformation-directory PATH',
      :description => 'Path to cloudformation directory',
      :proc => lambda {|val| Chef::Config[:knife][:cloudformation][:base_directory] = val}
    )
    option(:no_base_directory,
      :long => '--no-cloudformation-directory',
      :description => 'Unset any value used for cloudformation path',
      :proc => lambda {|*val| Chef::Config[:knife][:cloudformation][:base_directory] = nil}
    )
    option(:translate,
      :long => '--translate PROVIDER',
      :description => 'Translate generated template to given provider',
      :proc => lambda {|val| Chef::Config[:knife][:cloudformation][:translate] = val}
    )
    option(:translate_chunk,
      :long => '--translate-chunk-size SIZE',
      :description => 'Chunk length for serialization',
      :proc => lambda {|val| Chef::Config[:knife][:cloudformation][:translate_chunk_size] = val}
    )
    option(:apply_nesting,
      :long => '--[no-]apply-nesting',
      :description => 'Apply stack nesting',
      :default => false,
      :boolean => true,
      :proc => lambda{|val| Chef::Config[:knife][:cloudformation][:apply_nesting] = val}
    )
    option(:nesting_bucket,
      :long => '--nesting-bucket',
      :description => 'Bucket to use for storing nested stack templates',
      :proc => lambda{|val| Chef::Config[:knife][:cloudformation][:nesting_bucket] = val}
    )

    Chef::Config[:knife][:cloudformation][:file_path_prompt] = true

  end

end