lib/fontist/import/formula_builder.rb in fontist-1.11.1 vs lib/fontist/import/formula_builder.rb in fontist-1.11.2

- old
+ new

@@ -4,11 +4,11 @@ module Fontist module Import class FormulaBuilder FORMULA_ATTRIBUTES = %i[name description homepage resources font_collections fonts extract copyright - license_url open_license command].freeze + license_url open_license digest command].freeze attr_accessor :archive, :url, :extractor, :options, @@ -58,10 +58,22 @@ { filename => resource_options } end def resource_options + if @options[:skip_sha] + resource_options_without_sha + else + resource_options_with_sha + end + end + + def resource_options_without_sha + { urls: [@url] + mirrors } + end + + def resource_options_with_sha urls = [] sha = [] downloads do |url, path| urls << url sha << Digest::SHA256.file(path).to_s @@ -163,9 +175,13 @@ Fontist.ui.error("WARN: ensure it's an open license, otherwise " \ "change the 'open_license' attribute to " \ "'requires_license_agreement'") TextHelper.cleanup(@license_text) + end + + def digest + @options[:digest] end def command Shellwords.shelljoin(ARGV) end