Sha256: 4d4dd21ef7a46db1669ddbad0b42280fa82ddeeceb95539766d8d854539a892c

Contents?: true

Size: 904 Bytes

Versions: 6

Compression:

Stored size: 904 Bytes

Contents

module Fontist
  module Import
    module Google
      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

6 entries across 6 versions & 1 rubygems

Version Path
fontist-1.17.1 lib/fontist/import/google.rb
fontist-1.17.0 lib/fontist/import/google.rb
fontist-1.16.0 lib/fontist/import/google.rb
fontist-1.15.2 lib/fontist/import/google.rb
fontist-1.15.1 lib/fontist/import/google.rb
fontist-1.15.0 lib/fontist/import/google.rb