Module: Fontist::Import::Google
- Defined in:
- lib/fontist/import/google.rb,
lib/fontist/import/google/api.rb,
lib/fontist/import/google/create_google_formula.rb
Defined Under Namespace
Classes: Api, CreateGoogleFormula
Constant Summary
collapse
- DEFAULT_MAX_COUNT =
100
Class Method Summary
collapse
Class Method Details
.digest(path) ⇒ Object
21
22
23
24
25
26
27
28
|
# File 'lib/fontist/import/google.rb', line 21
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
|
16
17
18
19
|
# File 'lib/fontist/import/google.rb', line 16
def self.formula_path(name)
filename = name.downcase.gsub(" ", "_") + ".yml"
Fontist.formulas_path.join("google", filename)
end
|
6
7
8
9
10
11
12
13
14
|
# File 'lib/fontist/import/google.rb', line 6
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
|
.style_version(text) ⇒ Object
30
31
32
33
34
|
# File 'lib/fontist/import/google.rb', line 30
def self.style_version(text)
return unless text
text.gsub("Version ", "")
end
|