fontist 1.7.2 → 1.8.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/release.yml +38 -0
  3. data/.github/workflows/rspec.yml +58 -0
  4. data/README.md +77 -14
  5. data/{bin → exe}/fontist +0 -0
  6. data/fontist.gemspec +10 -7
  7. data/lib/fontist.rb +5 -2
  8. data/lib/fontist/cli.rb +65 -41
  9. data/lib/fontist/errors.rb +63 -12
  10. data/lib/fontist/font.rb +23 -37
  11. data/lib/fontist/font_installer.rb +118 -0
  12. data/lib/fontist/fontist_font.rb +3 -49
  13. data/lib/fontist/formula.rb +101 -35
  14. data/lib/fontist/formula_paths.rb +43 -0
  15. data/lib/fontist/helpers.rb +7 -0
  16. data/lib/fontist/import/create_formula.rb +3 -2
  17. data/lib/fontist/import/extractors.rb +4 -0
  18. data/lib/fontist/import/extractors/cpio_extractor.rb +39 -0
  19. data/lib/fontist/import/extractors/gzip_extractor.rb +27 -0
  20. data/lib/fontist/import/extractors/rpm_extractor.rb +45 -0
  21. data/lib/fontist/import/extractors/tar_extractor.rb +47 -0
  22. data/lib/fontist/import/google/skiplist.yml +3 -0
  23. data/lib/fontist/import/google_check.rb +1 -1
  24. data/lib/fontist/import/google_import.rb +3 -4
  25. data/lib/fontist/import/otfinfo_generate.rb +1 -1
  26. data/lib/fontist/import/recursive_extraction.rb +26 -8
  27. data/lib/fontist/import/sil_import.rb +99 -0
  28. data/lib/fontist/index.rb +72 -0
  29. data/lib/fontist/index_formula.rb +30 -0
  30. data/lib/fontist/manifest/install.rb +4 -9
  31. data/lib/fontist/manifest/locations.rb +28 -20
  32. data/lib/fontist/system_font.rb +32 -62
  33. data/lib/fontist/system_index.rb +47 -5
  34. data/lib/fontist/utils.rb +5 -0
  35. data/lib/fontist/utils/cache.rb +12 -4
  36. data/lib/fontist/utils/cpio/cpio.rb +199 -0
  37. data/lib/fontist/utils/cpio_extractor.rb +47 -0
  38. data/lib/fontist/utils/exe_extractor.rb +1 -1
  39. data/lib/fontist/utils/gzip_extractor.rb +24 -0
  40. data/lib/fontist/utils/locking.rb +17 -0
  41. data/lib/fontist/utils/rpm_extractor.rb +37 -0
  42. data/lib/fontist/utils/tar_extractor.rb +61 -0
  43. data/lib/fontist/utils/zip_extractor.rb +1 -1
  44. data/lib/fontist/version.rb +1 -1
  45. metadata +68 -24
  46. data/.github/workflows/macosx.yml +0 -33
  47. data/.github/workflows/ubuntu.yml +0 -30
  48. data/.github/workflows/windows.yml +0 -32
  49. data/bin/check_google +0 -8
  50. data/bin/console +0 -11
  51. data/bin/convert_formulas +0 -8
  52. data/bin/generate_otfinfo +0 -8
  53. data/bin/import_google +0 -8
  54. data/bin/rspec +0 -29
  55. data/bin/setup +0 -7
  56. data/lib/fontist/font_formula.rb +0 -169
  57. data/lib/fontist/formula_template.rb +0 -122
  58. data/lib/fontist/formulas.rb +0 -56
  59. data/lib/fontist/registry.rb +0 -43
@@ -1,56 +0,0 @@
1
- require "git"
2
- require "fontist/utils"
3
- require "fontist/font_formula"
4
- require "fontist/formula_template"
5
-
6
- module Fontist
7
- module Formulas
8
- def self.register_formulas
9
- load_formulas
10
- update_registry
11
- end
12
-
13
- def self.fetch_formulas
14
- if Dir.exist?(Fontist.formulas_repo_path)
15
- Git.open(Fontist.formulas_repo_path).pull
16
- else
17
- Git.clone(Fontist.formulas_repo_url,
18
- Fontist.formulas_repo_path,
19
- depth: 1)
20
- end
21
- end
22
-
23
- def self.load_formulas
24
- Dir[Fontist.formulas_path.join("**/*.yml").to_s].sort.each do |file|
25
- create_formula_class(file)
26
- end
27
- end
28
-
29
- def self.create_formula_class(file)
30
- formula = parse_to_object(YAML.load_file(file))
31
- class_name = name_to_classname(formula.name)
32
- return if Formulas.const_defined?(class_name)
33
-
34
- klass = FormulaTemplate.create_formula_class(formula)
35
- Formulas.const_set(class_name, klass)
36
- end
37
-
38
- def self.parse_to_object(hash)
39
- JSON.parse(hash.to_json, object_class: OpenStruct)
40
- end
41
-
42
- def self.update_registry
43
- Formulas.constants.select do |constant|
44
- if Formulas.const_get(constant).is_a?(Class)
45
- klass = "Fontist::Formulas::#{constant}"
46
- Fontist::Registry.register(Object.const_get(klass))
47
- end
48
- end
49
- end
50
-
51
- def self.name_to_classname(name)
52
- cleanname = name.gsub(/ /, "").sub(/\S/, &:upcase)
53
- "#{cleanname}Font"
54
- end
55
- end
56
- end
@@ -1,43 +0,0 @@
1
- module Fontist
2
- class Registry
3
- include Singleton
4
-
5
- def initialize
6
- @formulas ||= {}
7
- end
8
-
9
- def formulas
10
- parse_to_object(@formulas)
11
- end
12
-
13
- def self.formulas
14
- instance.formulas
15
- end
16
-
17
- def self.register(formula, key = nil)
18
- key ||= formula.instance.key || formula.to_s
19
- instance.register(formula, key)
20
- end
21
-
22
- def register(formula, key)
23
- @formulas[key] = build_formula_data(formula)
24
- end
25
-
26
- private
27
-
28
- def build_formula_data(formula)
29
- {
30
- installer: formula,
31
- fonts: formula.instance.fonts,
32
- license: formula.instance.license,
33
- homepage: formula.instance.homepage ,
34
- description: formula.instance.description,
35
- license_required: formula.instance.license_required,
36
- }
37
- end
38
-
39
- def parse_to_object(data)
40
- JSON.parse(data.to_json, object_class: OpenStruct)
41
- end
42
- end
43
- end