Class: Lono::Cfn::Preview::Codediff
- Includes:
- AwsServices, DiffViewer
- Defined in:
- lib/lono/cfn/preview/codediff.rb
Instance Method Summary collapse
- #download_existing_cfn_template ⇒ Object
- #existing_template_path ⇒ Object
-
#new_cfn_template ⇒ Object
for clarity.
- #run ⇒ Object
Methods included from AwsServices
#cfn, #ec2, #iam, #s3, #s3_presigner, #s3_resource, #sts
Methods included from AwsServices::Util
#find_stack, #rollback_complete?, #stack_exists?, #testing_update?
Methods included from DiffViewer
Methods inherited from Base
#build_files, #build_scripts, #capabilities, #check_files, #check_for_errors, #command_with_iam, #continue_update_rollback, #continue_update_rollback_sure?, #delete_rollback_stack, #ensure_s3_bucket_exist, #exit_unless_updatable!, #generate_all, #generate_templates, #initialize, #param_generator, #post_process_templates, #pretty_path, #prompt_for_iam, #quit, #rerun_with_iam?, #set_template_body!, #show_parameters, #stack_status, #starting_message, #status, #tags, #upload_files, #upload_scripts, #upload_templates
Methods included from Util
#are_you_sure?, #switch_current
Methods included from Suffix
#allow_suffix?, #append_suffix, #random_suffix, #remove_suffix, #stack_name_suffix
Methods included from Lono::Conventions
Methods included from Blueprint::Root
#bundler_groups, #find_blueprint_root, #require_bundle_gems, #set_blueprint_root
Constructor Details
This class inherits a constructor from Lono::Cfn::Base
Instance Method Details
#download_existing_cfn_template ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/lono/cfn/preview/codediff.rb', line 24 def download_existing_cfn_template resp = cfn.get_template( stack_name: @stack_name, template_stage: "Original" ) resp.template_body IO.write(existing_template_path, resp.template_body) end |
#existing_template_path ⇒ Object
38 39 40 |
# File 'lib/lono/cfn/preview/codediff.rb', line 38 def existing_template_path "/tmp/existing_cfn_template.yml" end |
#new_cfn_template ⇒ Object
for clarity
34 35 36 |
# File 'lib/lono/cfn/preview/codediff.rb', line 34 def new_cfn_template @template_path end |
#run ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/lono/cfn/preview/codediff.rb', line 6 def run puts "Code Diff Preview:".color(:green) unless stack_exists?(@stack_name) puts "WARN: Cannot create a diff for the stack because the #{@stack_name} does not exists.".color(:yellow) return end if @options[:noop] puts "NOOP Generating CloudFormation source code diff..." else generate_all # from Base superclass. Generates the output lono teplates puts "Generating CloudFormation source code diff..." download_existing_cfn_template show_diff(existing_template_path, new_cfn_template) end end |