Sha256: af8eb61539caf3c1611c0432aeca97bfb1fec2d004411949f856b7ab8a652f76
Contents?: true
Size: 1022 Bytes
Versions: 12
Compression:
Stored size: 1022 Bytes
Contents
require "yaml" module Jack class Config < Command # Class does very specific formatting for the eb config files: # # * Makes sure that the keys are sorted so we can compare them # * It also scripts out the generated DateModified and DateCreated Metadata class YamlFormatter def process(file) data = YAML.load_file(file) data = strip_metadata_dates(data) dump = YAML.dump(data).gsub("!ruby/object:Hash", '') lines = dump.split("\n") lines = lines.map { |l| l.rstrip } # strip trailing whitespace dump = lines[1..-1].join("\n") + "\n" # strip first line outfile = "#{file}.sorted" File.open(outfile, 'w') { |f| f.write(dump) } FileUtils.mv(outfile, file) end def strip_metadata_dates(data) metadata = data['EnvironmentConfigurationMetadata'] if metadata metadata.delete('DateModified') metadata.delete('DateCreated') end data end end end end
Version data entries
12 entries across 12 versions & 1 rubygems