Class: Shellfie::ReproducibilityManifest
- Inherits:
-
Object
- Object
- Shellfie::ReproducibilityManifest
- Defined in:
- lib/shellfie/reproducibility_manifest.rb
Class Method Summary collapse
Class Method Details
.build(config, output_path:, format:) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/shellfie/reproducibility_manifest.rb', line 9 def self.build(config, output_path:, format:) renderer = Renderer.new(config) { schema: 1, config_sha256: Digest::SHA256.hexdigest(JSON.generate(config.to_h)), output: output_path, output_sha256: output_digest(output_path), format: format, ruby: RUBY_DESCRIPTION, platform: RbConfig::CONFIG["host_os"], unicode: { version: TextMetrics::UNICODE_VERSION, width_table: TextMetrics::WIDTH_TABLE_VERSION, ambiguous_width: config.window[:ambiguous_width] }, imagemagick: DependencyChecker.imagemagick_details[:version], ffmpeg: DependencyChecker.ffmpeg_version, fonts: renderer.font_info } end |
.output_digest(path) ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/shellfie/reproducibility_manifest.rb', line 30 def self.output_digest(path) return Digest::SHA256.file(path).hexdigest if File.file?(path) return unless File.directory?(path) digest = Digest::SHA256.new Dir.glob(File.join(path, "**", "*"), File::FNM_DOTMATCH).select { |entry| File.file?(entry) }.sort.each do |entry| digest << entry.delete_prefix("#{path}#{File::SEPARATOR}") << "\0" << Digest::SHA256.file(entry).digest end digest.hexdigest end |