Sha256: 97534de0397591c79686abba847fe9412425ec9939387c2e3026480d5bffccd6

Contents?: true

Size: 935 Bytes

Versions: 5

Compression:

Stored size: 935 Bytes

Contents

module Fontist
  module Import
    module Google
      DEFAULT_MAX_COUNT = 100

      def self.metadata_name(path)
        metadata_path = File.join(path, "METADATA.pb")
        return unless File.exist?(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

5 entries across 5 versions & 1 rubygems

Version Path
fontist-1.21.2 lib/fontist/import/google.rb
fontist-1.21.1 lib/fontist/import/google.rb
fontist-1.20.0 lib/fontist/import/google.rb
fontist-1.19.0 lib/fontist/import/google.rb
fontist-1.18.2 lib/fontist/import/google.rb