Sha256: 2680d9ba04a2e7ea53cef4e3ad4760981b554e21cd4c449334cf4b8bf3ce3cd9
Contents?: true
Size: 1.59 KB
Versions: 41
Compression:
Stored size: 1.59 KB
Contents
require 'puppet/module_tool/checksums' module Puppet::ModuleTool module Applications class Checksummer < Application def initialize(path, options = {}) @path = Pathname.new(path) super(options) end def run changes = [] if metadata_file.exist? sums = Puppet::ModuleTool::Checksums.new(@path) (metadata['checksums'] || {}).each do |child_path, canonical_checksum| # Work around an issue where modules built with an older version # of PMT would include the metadata.json file in the list of files # checksummed. This causes metadata.json to always report local # changes. next if File.basename(child_path) == "metadata.json" path = @path + child_path if canonical_checksum != sums.checksum(path) changes << child_path end end else raise ArgumentError, "No metadata.json found." end # Return an Array of strings representing file paths of files that have # been modified since this module was installed. All paths are relative # to the installed module directory. This return value is used by the # module_tool face changes action, and displayed on the console. # # Example return value: # # [ "REVISION", "manifests/init.pp"] # changes end private def metadata PSON.parse(metadata_file.read) end def metadata_file (@path + 'metadata.json') end end end end
Version data entries
41 entries across 41 versions & 3 rubygems