fontist 1.21.3 → 2.0.1

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.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +4 -0
  3. data/Gemfile +11 -0
  4. data/README.adoc +8 -8
  5. data/docs/guide/api-ruby.md +8 -9
  6. data/docs/reference/index.md +4 -4
  7. data/fontist.gemspec +14 -24
  8. data/formula_filename_index.yml +6210 -0
  9. data/formula_index.yml +2568 -0
  10. data/lib/fontist/cli.rb +14 -14
  11. data/lib/fontist/config.rb +77 -16
  12. data/lib/fontist/errors.rb +2 -0
  13. data/lib/fontist/extract.rb +25 -0
  14. data/lib/fontist/font.rb +6 -8
  15. data/lib/fontist/font_collection.rb +16 -0
  16. data/lib/fontist/font_installer.rb +4 -4
  17. data/lib/fontist/font_model.rb +15 -0
  18. data/lib/fontist/font_path.rb +1 -1
  19. data/lib/fontist/font_style.rb +37 -0
  20. data/lib/fontist/formula.rb +169 -112
  21. data/lib/fontist/import/formula_serializer.rb +4 -4
  22. data/lib/fontist/import/google_import.rb +1 -1
  23. data/lib/fontist/index.rb +47 -8
  24. data/lib/fontist/indexes/default_family_font_index.rb +28 -9
  25. data/lib/fontist/indexes/filename_index.rb +45 -8
  26. data/lib/fontist/indexes/font_index.rb +3 -3
  27. data/lib/fontist/indexes/formula_key_to_path.rb +35 -0
  28. data/lib/fontist/indexes/index_mixin.rb +109 -0
  29. data/lib/fontist/indexes/preferred_family_font_index.rb +28 -9
  30. data/lib/fontist/manifest.rb +144 -2
  31. data/lib/fontist/manifest_request.rb +64 -0
  32. data/lib/fontist/manifest_response.rb +66 -0
  33. data/lib/fontist/repo.rb +1 -1
  34. data/lib/fontist/system_font.rb +7 -25
  35. data/lib/fontist/system_index.rb +137 -126
  36. data/lib/fontist/utils/cache.rb +54 -4
  37. data/lib/fontist/version.rb +1 -1
  38. data/lib/fontist.rb +33 -13
  39. metadata +16 -136
  40. data/lib/fontist/indexes/base_index.rb +0 -92
  41. data/lib/fontist/indexes/index_formula.rb +0 -36
  42. data/lib/fontist/manifest/install.rb +0 -35
  43. data/lib/fontist/manifest/locations.rb +0 -84
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1f643e0f29ca1df23bf363fbac476a18eac1f7d94a5531ba57c3e067b257510
4
- data.tar.gz: e1c1b437145c267b8eab870bc201af9be5c4b0f6cafb8fd5fd87c15232b7a0f9
3
+ metadata.gz: 722a298384ffed9d696e836b150d354e874211c9927ff3482e68a6e0a26367fc
4
+ data.tar.gz: d8b57e7f9223bc56f0b83e0a4ef1b48db4a35e8a8fd41e9af2fe109e0ffda152
5
5
  SHA512:
6
- metadata.gz: 8a0f1a24057b83018f2d7ea44b5e4026a1b22759eecc900c9854cb72c51ead62faa0b6250bc79dc0bb04c6a4929f000b99ace89d20e617b480da54b589dcd354
7
- data.tar.gz: 0f90c437007d9493a8d4e3fd2949c2532ba7dd2e0a9d10deb7960d0ff88481a21e43a485261db755b25a4a61730afbbfdf952f97f9e52816c168d24daeb9e20b
6
+ metadata.gz: 63aed7061e821c6cc0d30f73de923f1dcf2badcee91855bd99e3618ab6bb859bb6a33935e77ed586be49ae640c97457bdaa148482f02a04fd5694e7c93bc1dfc
7
+ data.tar.gz: f682fc64dafb10898e5d6d676f35f7e2208f46c3fab1d58ddaf95b047fb9c94feacaffe293cdbb6cab951d47dfc28dc738e207d0eaa48b19ce1aac41be858c6a
@@ -4,7 +4,11 @@ on:
4
4
  push:
5
5
  branches: [ main ]
6
6
  tags: [ 'v*' ]
7
+ paths-ignore:
8
+ - '**.adoc'
7
9
  pull_request:
10
+ paths-ignore:
11
+ - '**.adoc'
8
12
 
9
13
  concurrency:
10
14
  group: '${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.ref_name }}'
data/Gemfile CHANGED
@@ -2,3 +2,14 @@ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in fontist.gemspec
4
4
  gemspec
5
+
6
+ gem "pry"
7
+ gem "bundler"
8
+ gem "rake"
9
+ gem "rspec"
10
+ gem "rspec-benchmark"
11
+ gem "rubocop"
12
+ gem "rubocop-rails"
13
+ gem "rubocop-performance"
14
+ gem "vcr"
15
+ gem "webmock"
data/README.adoc CHANGED
@@ -331,10 +331,10 @@ Fontist supports system-wide settings for the following parameters:
331
331
  `fonts_path`:: Sets path where to install fonts (default: `~/.fontist/fonts`)
332
332
 
333
333
  `open_timeout`:: Sets timeout for opening a connection during download
334
- (default: `10`)
334
+ (default: `60`)
335
335
 
336
336
  `read_timeout`:: Sets timeout for reading the opened connection during download
337
- (default: `10`)
337
+ (default: `60`)
338
338
 
339
339
  Show current attributes in the config:
340
340
 
@@ -534,7 +534,7 @@ Fontist.preferred_family = true
534
534
  ----
535
535
 
536
536
  [[fontist-locations]]
537
- ==== `Fontist::Manifest::Locations`
537
+ ==== Locations
538
538
 
539
539
  Fontist lets you find font locations from a defined manifest Hash in the
540
540
  following format:
@@ -552,7 +552,7 @@ Font name is useful to choose a specific font in a font collection file (TTC).
552
552
 
553
553
  [source,ruby]
554
554
  ----
555
- Fontist::Manifest::Locations.from_hash(manifest)
555
+ Fontist::Manifest.from_hash(manifest, locations: true)
556
556
  ----
557
557
 
558
558
  [source,ruby]
@@ -578,14 +578,14 @@ Fontist::Manifest::Locations.from_hash(manifest)
578
578
  ----
579
579
 
580
580
  [[fontist-install]]
581
- ==== `Fontist::Manifest::Install`
581
+ ==== Install
582
582
 
583
583
  Fontist lets you not only to obtain font locations but also to install fonts
584
584
  from the manifest:
585
585
 
586
586
  [source,ruby]
587
587
  ----
588
- Fontist::Manifest::Install.from_hash(manifest, confirmation: "yes")
588
+ manifest.install(confirmation: "yes")
589
589
  ----
590
590
 
591
591
  It will install fonts and return their locations:
@@ -631,8 +631,8 @@ Then the following calls would return font names and paths, as from the
631
631
 
632
632
  [source,ruby]
633
633
  ----
634
- Fontist::Manifest::Locations.from_file("manifest.yml")
635
- Fontist::Manifest::Install.from_file("manifest.yml", confirmation: "yes")
634
+ manifest = Fontist::Manifest.from_file("manifest.yml")
635
+ manifest.install(confirmation: "yes")
636
636
  ----
637
637
 
638
638
  === `Fontist::Fontconfig`
@@ -91,7 +91,7 @@ Fontist can be switched to use the preferred family names. This format was used
91
91
  Fontist.preferred_family = true
92
92
  ```
93
93
 
94
- ### Fontist::Manifest::Locations
94
+ ### Manifest from YAML file or Hash
95
95
 
96
96
  Fontist lets you find font locations from a defined manifest Hash in the following format:
97
97
 
@@ -105,7 +105,8 @@ Fontist lets you find font locations from a defined manifest Hash in the followi
105
105
  Calling the following code returns a nested Hash with font paths and names. Font name is useful to choose a specific font in a font collection file (TTC).
106
106
 
107
107
  ```ruby
108
- Fontist::Manifest::Locations.from_hash(manifest)
108
+ Fontist::Manifest.from_yaml(manifest)
109
+ Fontist::Manifest.from_hash(manifest)
109
110
  ```
110
111
 
111
112
  ```ruby
@@ -129,12 +130,10 @@ Fontist::Manifest::Locations.from_hash(manifest)
129
130
  }
130
131
  ```
131
132
 
132
- ### Fontist::Manifest::Install
133
-
134
133
  Fontist lets you not only obtain font locations but also install fonts from the manifest:
135
134
 
136
135
  ```ruby
137
- Fontist::Manifest::Install.from_hash(manifest, confirmation: "yes")
136
+ manifest.install(confirmation: "yes")
138
137
  ```
139
138
 
140
139
  It will install fonts and return their locations:
@@ -159,7 +158,7 @@ It will install fonts and return their locations:
159
158
  }
160
159
  ```
161
160
 
162
- ### Support of YAML format
161
+ #### Support of YAML format
163
162
 
164
163
  Both commands support a YAML file as an input with a `from_file` method. For example, if there is a `manifest.yml` file containing:
165
164
 
@@ -172,11 +171,11 @@ Roboto Mono:
172
171
  - Regular
173
172
  ```
174
173
 
175
- Then the following calls would return font names and paths, as from the `from_hash` method (see Fontist::Manifest::Install and Fontist::Manifest::Locations).
174
+ Then the following calls would return font names and paths, as from the `from_hash` method (see Fontist::Manifest).
176
175
 
177
176
  ```ruby
178
- Fontist::Manifest::Locations.from_file("manifest.yml")
179
- Fontist::Manifest::Install.from_file("manifest.yml", confirmation: "yes")
177
+ manifest = Fontist::Manifest.from_file("manifest.yml")
178
+ manifest.install(confirmation: "yes")
180
179
  ```
181
180
 
182
181
  ## Fontist::Fontconfig
@@ -36,8 +36,8 @@ fontist config show
36
36
  $ fontist config keys
37
37
  Available keys:
38
38
  fonts_path (default: /home/octocat/.fontist/fonts)
39
- open_timeout (default: 10)
40
- read_timeout (default: 10)
39
+ open_timeout (default: 60)
40
+ read_timeout (default: 60)
41
41
 
42
42
  $ fontist config set fonts_path /var/myfonts
43
43
  'fonts_path' set to '/var/myfonts'.
@@ -55,9 +55,9 @@ Config is empty.
55
55
 
56
56
  - **`fonts_path`:** Where to put the `.ttf` files. Defaults to `~/.fontist/fonts`
57
57
 
58
- - **`open_timeout`:** Defaults to 10.
58
+ - **`open_timeout`:** Defaults to 60.
59
59
 
60
- - **`read_timeout`:** Defaults to 10.
60
+ - **`read_timeout`:** Defaults to 60.
61
61
 
62
62
  ## `fontist status [font-name]`
63
63
 
data/fontist.gemspec CHANGED
@@ -29,28 +29,18 @@ Gem::Specification.new do |spec|
29
29
  spec.executables = ["fontist"]
30
30
  spec.test_files = `git ls-files -- {spec}/*`.split("\n")
31
31
 
32
- spec.add_runtime_dependency "down", "~> 5.0"
33
- spec.add_runtime_dependency "extract_ttc", "~> 0.1"
34
- spec.add_runtime_dependency "fuzzy_match", "~> 2.1"
35
- spec.add_runtime_dependency "json", "~> 2.0"
36
- spec.add_runtime_dependency "nokogiri", "~> 1.0"
37
- spec.add_runtime_dependency "mime-types", "~> 3.0"
38
- spec.add_runtime_dependency "sys-uname", "~> 1.2"
39
- spec.add_runtime_dependency "thor", "~> 1.2", ">= 1.2.1"
40
- spec.add_runtime_dependency "git", "~> 1.0"
41
- spec.add_runtime_dependency "ttfunk", "~> 1.6"
42
- spec.add_runtime_dependency "plist", "~> 3.0"
43
- spec.add_runtime_dependency "excavate", "~> 0.3", '>= 0.3.4'
44
- spec.add_runtime_dependency "socksify", "~> 1.7"
45
-
46
- spec.add_development_dependency "pry", "~> 0.14"
47
- spec.add_development_dependency "bundler", "~> 2.3"
48
- spec.add_development_dependency "rake", "~> 13"
49
- spec.add_development_dependency "rspec", "~> 3.0"
50
- spec.add_development_dependency "rspec-benchmark", "~> 0.6"
51
- spec.add_development_dependency "rubocop", "~> 1.22.1"
52
- spec.add_development_dependency "rubocop-rails", "~> 2.9"
53
- spec.add_development_dependency "rubocop-performance", "~> 1.10"
54
- spec.add_development_dependency "vcr"
55
- spec.add_development_dependency "webmock"
32
+ spec.add_dependency "down", "~> 5.0"
33
+ spec.add_dependency "extract_ttc", "~> 0.1"
34
+ spec.add_dependency "fuzzy_match", "~> 2.1"
35
+ spec.add_dependency "json", "~> 2.0"
36
+ spec.add_dependency "nokogiri", "~> 1.0"
37
+ spec.add_dependency "mime-types", "~> 3.0"
38
+ spec.add_dependency "sys-uname", "~> 1.2"
39
+ spec.add_dependency "thor", "~> 1.2", ">= 1.2.1"
40
+ spec.add_dependency "git", "~> 1.0"
41
+ spec.add_dependency "ttfunk", "~> 1.6"
42
+ spec.add_dependency "plist", "~> 3.0"
43
+ spec.add_dependency "excavate", "~> 0.3", '>= 0.3.4'
44
+ spec.add_dependency "socksify", "~> 1.7"
45
+ spec.add_dependency "lutaml-model", "~> 0.7"
56
46
  end