Module: Fontist::Import::Google
- Defined in:
- lib/fontist/import/google.rb,
lib/fontist/import/google/api.rb,
lib/fontist/import/google/models.rb,
lib/fontist/import/google/models/axis.rb,
lib/fontist/import/google/data_sources.rb,
lib/fontist/import/google/font_database.rb,
lib/fontist/import/google/data_sources/vf.rb,
lib/fontist/import/google/formula_builder.rb,
lib/fontist/import/google/metadata_parser.rb,
lib/fontist/import/google/models/metadata.rb,
lib/fontist/import/google/data_sources/ttf.rb,
lib/fontist/import/google/metadata_adapter.rb,
lib/fontist/import/google/data_sources/base.rb,
lib/fontist/import/google/data_sources/woff2.rb,
lib/fontist/import/google/models/font_family.rb,
lib/fontist/import/google/data_sources/github.rb,
lib/fontist/import/google/models/font_variant.rb,
lib/fontist/import/google/models/axis_metadata.rb,
lib/fontist/import/google/models/file_metadata.rb,
lib/fontist/import/google/models/source_metadata.rb,
lib/fontist/import/google/models/font_file_metadata.rb,
lib/fontist/import/google/formula_builders/formula_builder_v4.rb,
lib/fontist/import/google/formula_builders/formula_builder_v5.rb,
lib/fontist/import/google/formula_builders/base_formula_builder.rb
Defined Under Namespace
Modules: DataSources, FormulaBuilder, FormulaBuilders, Models
Classes: Api, FontDatabase, MetadataAdapter, MetadataParser
Constant Summary
collapse
- DEFAULT_MAX_COUNT =
100
Class Method Summary
collapse
Class Method Details
.digest(path) ⇒ Object
28
29
30
31
32
33
34
35
|
# File 'lib/fontist/import/google.rb', line 28
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
|
23
24
25
26
|
# File 'lib/fontist/import/google.rb', line 23
def self.formula_path(name)
filename = "#{name.downcase.gsub(' ', '_')}.yml"
Fontist.formulas_path.join("google", filename)
end
|
13
14
15
16
17
18
19
20
21
|
# File 'lib/fontist/import/google.rb', line 13
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
37
38
39
40
41
|
# File 'lib/fontist/import/google.rb', line 37
def self.style_version(text)
return unless text
text.gsub("Version ", "")
end
|