Module: Fontist::Import::Google
- Defined in:
- lib/fontist/import/google.rb,
lib/fontist/import/google/new_fonts_fetcher.rb
Defined Under Namespace
Classes: NewFontsFetcher
Class Method Summary collapse
- .digest(path) ⇒ Object
- .formula_path(name) ⇒ Object
- .metadata_name(path) ⇒ Object
- .style_version(text) ⇒ Object
Class Method Details
.digest(path) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/fontist/import/google.rb', line 19 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 |
.formula_path(name) ⇒ Object
14 15 16 17 |
# File 'lib/fontist/import/google.rb', line 14 def self.formula_path(name) filename = name.downcase.gsub(" ", "_") + ".yml" Fontist.formulas_path.join("google", filename) end |
.metadata_name(path) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/fontist/import/google.rb', line 4 def self.(path) = File.join(path, "METADATA.pb") return unless File.exists?() File.foreach() do |line| name = line.match(/^name: "(.+)"/) return name[1] if name end end |
.style_version(text) ⇒ Object
28 29 30 31 32 |
# File 'lib/fontist/import/google.rb', line 28 def self.style_version(text) return unless text text.gsub("Version ", "") end |