Sha256: 178a06d8b46121bae0c97041bfb3c4a9c54117e32dc079dc3598076d1419df9b
Contents?: true
Size: 1.13 KB
Versions: 3
Compression:
Stored size: 1.13 KB
Contents
require 'sparkle_formation' require 'sfn' module Sfn class Command # Print command class Print < Command include Sfn::CommandModule::Base include Sfn::CommandModule::Template include Sfn::CommandModule::Stack # Print the requested template def execute! config[:print_only] = true file = load_template_file output_content = parameter_scrub!(template_content(file)) if(config[:yaml]) require 'yaml' output_content = YAML.dump(output_content) else output_content = format_json(output_content) end if(config[:write_to_file]) unless(File.directory?(File.dirname(config[:write_to_file]))) run_action 'Creating parent directory' do FileUtils.mkdir_p(File.dirname(config[:write_to_file])) nil end end run_action "Writing template to file - #{config[:write_to_file]}" do File.write(config[:write_to_file], output_content) nil end else ui.puts output_content end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sfn-3.0.28 | lib/sfn/command/print.rb |
sfn-3.0.26 | lib/sfn/command/print.rb |
sfn-3.0.24 | lib/sfn/command/print.rb |