fontist 1.7.2 → 1.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +38 -0
- data/.github/workflows/rspec.yml +58 -0
- data/README.md +77 -14
- data/{bin → exe}/fontist +0 -0
- data/fontist.gemspec +10 -7
- data/lib/fontist.rb +5 -2
- data/lib/fontist/cli.rb +65 -41
- data/lib/fontist/errors.rb +63 -12
- data/lib/fontist/font.rb +23 -37
- data/lib/fontist/font_installer.rb +118 -0
- data/lib/fontist/fontist_font.rb +3 -49
- data/lib/fontist/formula.rb +101 -35
- data/lib/fontist/formula_paths.rb +43 -0
- data/lib/fontist/helpers.rb +7 -0
- data/lib/fontist/import/create_formula.rb +3 -2
- data/lib/fontist/import/extractors.rb +4 -0
- data/lib/fontist/import/extractors/cpio_extractor.rb +39 -0
- data/lib/fontist/import/extractors/gzip_extractor.rb +27 -0
- data/lib/fontist/import/extractors/rpm_extractor.rb +45 -0
- data/lib/fontist/import/extractors/tar_extractor.rb +47 -0
- data/lib/fontist/import/google/skiplist.yml +3 -0
- data/lib/fontist/import/google_check.rb +1 -1
- data/lib/fontist/import/google_import.rb +3 -4
- data/lib/fontist/import/otfinfo_generate.rb +1 -1
- data/lib/fontist/import/recursive_extraction.rb +26 -8
- data/lib/fontist/import/sil_import.rb +99 -0
- data/lib/fontist/index.rb +72 -0
- data/lib/fontist/index_formula.rb +30 -0
- data/lib/fontist/manifest/install.rb +4 -9
- data/lib/fontist/manifest/locations.rb +28 -20
- data/lib/fontist/system_font.rb +32 -62
- data/lib/fontist/system_index.rb +47 -5
- data/lib/fontist/utils.rb +5 -0
- data/lib/fontist/utils/cache.rb +12 -4
- data/lib/fontist/utils/cpio/cpio.rb +199 -0
- data/lib/fontist/utils/cpio_extractor.rb +47 -0
- data/lib/fontist/utils/exe_extractor.rb +1 -1
- data/lib/fontist/utils/gzip_extractor.rb +24 -0
- data/lib/fontist/utils/locking.rb +17 -0
- data/lib/fontist/utils/rpm_extractor.rb +37 -0
- data/lib/fontist/utils/tar_extractor.rb +61 -0
- data/lib/fontist/utils/zip_extractor.rb +1 -1
- data/lib/fontist/version.rb +1 -1
- metadata +68 -24
- data/.github/workflows/macosx.yml +0 -33
- data/.github/workflows/ubuntu.yml +0 -30
- data/.github/workflows/windows.yml +0 -32
- data/bin/check_google +0 -8
- data/bin/console +0 -11
- data/bin/convert_formulas +0 -8
- data/bin/generate_otfinfo +0 -8
- data/bin/import_google +0 -8
- data/bin/rspec +0 -29
- data/bin/setup +0 -7
- data/lib/fontist/font_formula.rb +0 -169
- data/lib/fontist/formula_template.rb +0 -122
- data/lib/fontist/formulas.rb +0 -56
- data/lib/fontist/registry.rb +0 -43
data/lib/fontist/formulas.rb
DELETED
@@ -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
|
data/lib/fontist/registry.rb
DELETED
@@ -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
|