Sha256: df26eb5a8930e877f28c46950a2cff3e73e29a923daa40a4e80031ccf22f23fe

Contents?: true

Size: 773 Bytes

Versions: 4

Compression:

Stored size: 773 Bytes

Contents

module Puppet::Module::Tool
  module Applications

    class Checksummer < Application

      def initialize(path, options = {})
        @path = Pathname.new(path)
        super(options)
      end
      
      def run
        if metadata_file.exist?
          sums = Checksums.new(@path)
          (metadata['checksums'] || {}).each do |child_path, canonical_checksum|
            path = @path + child_path
            if canonical_checksum != sums.checksum(path)
              say child_path
            end
          end
        else
          abort "No metadata.json found."
        end
      end

      private

      def metadata
        PSON.parse(metadata_file.read)
      end

      def metadata_file
        (@path + 'metadata.json')
      end

    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
puppet-module-0.3.4 lib/puppet/module/tool/applications/checksummer.rb
puppet-module-0.3.3 lib/puppet/module/tool/applications/checksummer.rb
puppet-module-0.3.2 lib/puppet/module/tool/applications/checksummer.rb
puppet-module-0.3.0 lib/puppet/module/tool/applications/checksummer.rb