class Puppet::ModuleTool::Applications::Checksummer
Public Class Methods
new(path, options = {})
click to toggle source
Calls superclass method
Puppet::ModuleTool::Applications::Application::new
# File lib/puppet/module_tool/applications/checksummer.rb 8 def initialize(path, options = {}) 9 @path = Pathname.new(path) 10 super(options) 11 end
Public Instance Methods
run()
click to toggle source
# File lib/puppet/module_tool/applications/checksummer.rb 13 def run 14 changes = [] 15 sums = Puppet::ModuleTool::Checksums.new(@path) 16 checksums.each do |child_path, canonical_checksum| 17 18 # Avoid checksumming the checksums.json file 19 next if File.basename(child_path) == "checksums.json" 20 21 path = @path + child_path 22 unless path.exist? && canonical_checksum == sums.checksum(path) 23 changes << child_path 24 end 25 end 26 27 # Return an Array of strings representing file paths of files that have 28 # been modified since this module was installed. All paths are relative 29 # to the installed module directory. This return value is used by the 30 # module_tool face changes action, and displayed on the console. 31 # 32 # Example return value: 33 # 34 # [ "REVISION", "manifests/init.pp"] 35 # 36 changes 37 end
Private Instance Methods
checksums()
click to toggle source
# File lib/puppet/module_tool/applications/checksummer.rb 41 def checksums 42 if checksums_file.exist? 43 Puppet::Util::Json.load(checksums_file.read) 44 elsif metadata_file.exist? 45 # Check metadata.json too; legacy modules store their checksums there. 46 Puppet::Util::Json.load(metadata_file.read)['checksums'] or 47 raise ArgumentError, _("No file containing checksums found.") 48 else 49 raise ArgumentError, _("No file containing checksums found.") 50 end 51 end
checksums_file()
click to toggle source
# File lib/puppet/module_tool/applications/checksummer.rb 57 def checksums_file 58 @path + 'checksums.json' 59 end
metadata_file()
click to toggle source
# File lib/puppet/module_tool/applications/checksummer.rb 53 def metadata_file 54 @path + 'metadata.json' 55 end