Sha256: 9c553b8044c1df33c67219b3dbca0a445dfb53eb040b055612228d66ef8b9b42

Contents?: true

Size: 905 Bytes

Versions: 3

Compression:

Stored size: 905 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,
                             "*.{[t|T][t|T][f|F],[o|O][t|T][f|F],[t|T][t|T][c|C]}"))
          .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

3 entries across 3 versions & 1 rubygems

Version Path
fontist-1.14.6 lib/fontist/import/google.rb
fontist-1.14.5 lib/fontist/import/google.rb
fontist-1.14.4 lib/fontist/import/google.rb