Sha256: 04ff3b62b586288b90020edef370476dbe73fb096bdae55330a5b7e6ee9f91cc

Contents?: true

Size: 840 Bytes

Versions: 13

Compression:

Stored size: 840 Bytes

Contents

module Fontist
  module Import
    module Google
      def self.metadata_name(path)
        metadata_path = File.join(path, "METADATA.pb")
        return unless File.exists?(metadata_path)

        File.foreach(metadata_path) do |line|
          name = line.match(/^name: "(.+)"/)
          return name[1] if name
        end
      end

      def self.formula_path(name)
        filename = name.downcase.gsub(" ", "_") + ".yml"
        Fontist.formulas_path.join("google", filename)
      end

      def self.digest(path)
        checksums = Dir.glob(File.join(path, "*.{ttf,otf,ttc}"))
          .sort
          .map { |x| Digest::SHA256.file(x).to_s }

        Digest::SHA256.hexdigest(checksums.to_s)
      end

      def self.style_version(text)
        return unless text

        text.gsub("Version ", "")
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
fontist-1.14.3 lib/fontist/import/google.rb
fontist-1.14.2 lib/fontist/import/google.rb
fontist-1.14.1 lib/fontist/import/google.rb
fontist-1.14.0 lib/fontist/import/google.rb
fontist-1.13.2 lib/fontist/import/google.rb
fontist-1.13.1 lib/fontist/import/google.rb
fontist-1.13.0 lib/fontist/import/google.rb
fontist-1.12.0 lib/fontist/import/google.rb
fontist-1.11.7 lib/fontist/import/google.rb
fontist-1.11.6 lib/fontist/import/google.rb
fontist-1.11.5 lib/fontist/import/google.rb
fontist-1.11.3 lib/fontist/import/google.rb
fontist-1.11.2 lib/fontist/import/google.rb