Sha256: 4900b32fa8f4fd6110fbc7921c17120f47b41e0726dfedbcd6ba89877aeb8514
Contents?: true
Size: 738 Bytes
Versions: 11
Compression:
Stored size: 738 Bytes
Contents
require "yaml" class TerraspaceBundler::Lockfile class Yamler def initialize(mods) @mods = mods.sort_by(&:name) end def dump YAML.dump(data.deep_stringify_keys) end def data @mods.inject({}) do |acc, mod| acc.merge(item(mod)) end end def item(mod) props = mod.props.dup # passthrough: name, url, version, ref, tag, branch etc props.delete(:name) # different structure in Terrafile.lock YAML props[:sha] ||= mod.latest_sha props.delete_if { |k,v| v.nil? } { mod.name => props } end def write IO.write(TB.config.lockfile, dump) end class << self def write(mods) new(mods).write end end end end
Version data entries
11 entries across 11 versions & 1 rubygems