fontist 1.15.2 → 1.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +28 -1
- data/fontist.gemspec +1 -1
- data/lib/fontist/font.rb +4 -1
- data/lib/fontist/font_installer.rb +11 -4
- data/lib/fontist/formula_picker.rb +9 -2
- data/lib/fontist/utils/cache.rb +5 -0
- data/lib/fontist/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14a836d048cc0ce0d74885f256e3d7cb48466efcadd75008207e1568927ca8cc
|
4
|
+
data.tar.gz: 468355d3c50412aef7642ad44abf204edbf827a81d3ccfe327f274a90cddedcd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62e88a6ac1766b61ffe5db70b36f9b0bb8316d80c048d8df8de57e39e3387de1fd60c3cff1094f0b235d7bfab0979d2b4e4ed01eba12125852f745327e8641b1
|
7
|
+
data.tar.gz: 97338d5eee1a8df78555281d9bc765499f30c86b98913bae5b21729745e5e983ed257e8ee51d543802e69dc734eee64f464dd8b319c534c3b06c768a65267817
|
data/README.adoc
CHANGED
@@ -123,7 +123,7 @@ for the newest version of the font among formulas with size below a limit
|
|
123
123
|
(300 MB). This behavior can be changed with options.
|
124
124
|
|
125
125
|
NOTE: If styles of a font are spread among several formulas, then all
|
126
|
-
available formulas would be installed.
|
126
|
+
available styles from all formulas would be installed.
|
127
127
|
|
128
128
|
Supported options:
|
129
129
|
|
@@ -936,6 +936,33 @@ its font location was only obtainable using the full "`Courier New`" font name.
|
|
936
936
|
From v1.10 onwards the behavior has been made consistent -- only the proper
|
937
937
|
"`Courier New`" name should be used.
|
938
938
|
|
939
|
+
[[install-font-change]]
|
940
|
+
==== To v1.16+
|
941
|
+
|
942
|
+
Fontist versions beyond v1.16 treats the `font` argument of the `install`
|
943
|
+
command differently.
|
944
|
+
After the upgrade, please ensure all required fonts are specified when using
|
945
|
+
`fontist install`, `fontist manifest-install` (and their corresponding Ruby
|
946
|
+
interface `Font.install` and `Manifest::Install`), or use the `-F, --formula`
|
947
|
+
option.
|
948
|
+
|
949
|
+
Starting from v1.16, Fontist installs only requested fonts instead of a whole
|
950
|
+
formula, unless specified explicitly.
|
951
|
+
changed now.
|
952
|
+
|
953
|
+
For example, an installation request for the "`Arial`" font prior to v1.16 will
|
954
|
+
setup all fonts found in the "`ms_truetype`" formula: "`Arial`", "`Trebuchet
|
955
|
+
MS`", "`Verdana`" and "`Times New Roman`".
|
956
|
+
|
957
|
+
From v1.16 onwards, Fontist will install _only_ the requested "`Arial`" font.
|
958
|
+
|
959
|
+
To install all fonts from a formula, the `-F, --formula` option can be used:
|
960
|
+
|
961
|
+
[source,sh]
|
962
|
+
----
|
963
|
+
$ fontist install --formula ms_truetype
|
964
|
+
----
|
965
|
+
|
939
966
|
|
940
967
|
|
941
968
|
== Maintenance (for Fontist maintainers only!)
|
data/fontist.gemspec
CHANGED
@@ -46,7 +46,7 @@ Gem::Specification.new do |spec|
|
|
46
46
|
spec.add_development_dependency "rake", "~> 13"
|
47
47
|
spec.add_development_dependency "rspec", "~> 3.0"
|
48
48
|
spec.add_development_dependency "rspec-benchmark", "~> 0.6"
|
49
|
-
spec.add_development_dependency "rubocop", "~> 1.
|
49
|
+
spec.add_development_dependency "rubocop", "~> 1.22.1"
|
50
50
|
spec.add_development_dependency "rubocop-rails", "~> 2.9"
|
51
51
|
spec.add_development_dependency "rubocop-performance", "~> 1.10"
|
52
52
|
end
|
data/lib/fontist/font.rb
CHANGED
@@ -125,7 +125,10 @@ module Fontist
|
|
125
125
|
end
|
126
126
|
|
127
127
|
def font_installer(formula)
|
128
|
-
|
128
|
+
options = { no_progress: @no_progress }
|
129
|
+
return FontInstaller.new(formula, **options) if @by_formula
|
130
|
+
|
131
|
+
FontInstaller.new(formula, font_name: @name, **options)
|
129
132
|
end
|
130
133
|
|
131
134
|
def sufficient_formulas
|
@@ -3,8 +3,9 @@ require "excavate"
|
|
3
3
|
|
4
4
|
module Fontist
|
5
5
|
class FontInstaller
|
6
|
-
def initialize(formula, no_progress: false)
|
6
|
+
def initialize(formula, font_name: nil, no_progress: false)
|
7
7
|
@formula = formula
|
8
|
+
@font_name = font_name
|
8
9
|
@no_progress = no_progress
|
9
10
|
end
|
10
11
|
|
@@ -90,9 +91,15 @@ module Fontist
|
|
90
91
|
|
91
92
|
def source_files
|
92
93
|
@source_files ||= @formula.fonts.flat_map do |font|
|
93
|
-
font.
|
94
|
-
|
95
|
-
|
94
|
+
next [] if @font_name && !font.name.casecmp?(@font_name)
|
95
|
+
|
96
|
+
font_files(font)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def font_files(font)
|
101
|
+
font.styles.map do |style|
|
102
|
+
style.source_font || style.font
|
96
103
|
end
|
97
104
|
end
|
98
105
|
|
@@ -11,7 +11,7 @@ module Fontist
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def call(formulas)
|
14
|
-
return [] if formulas.
|
14
|
+
return [] if formulas.empty?
|
15
15
|
return formulas if contain_different_styles?(formulas)
|
16
16
|
return by_version(formulas) if version_is_passed?
|
17
17
|
return newest(formulas) if newest_is_passed?
|
@@ -82,7 +82,8 @@ module Fontist
|
|
82
82
|
|
83
83
|
def filter_by_size_limit(formulas)
|
84
84
|
formulas.select do |formula|
|
85
|
-
formula.file_size.nil? || formula
|
85
|
+
formula.file_size.nil? || resources_cached?(formula) ||
|
86
|
+
formula.file_size < size_limit_in_bytes
|
86
87
|
end
|
87
88
|
end
|
88
89
|
|
@@ -122,5 +123,11 @@ module Fontist
|
|
122
123
|
formula.file_size || 0
|
123
124
|
end
|
124
125
|
end
|
126
|
+
|
127
|
+
def resources_cached?(formula)
|
128
|
+
Utils::Cache.new.already_fetched?(
|
129
|
+
formula.resources.flat_map(&:urls),
|
130
|
+
)
|
131
|
+
end
|
125
132
|
end
|
126
133
|
end
|
data/lib/fontist/utils/cache.rb
CHANGED
data/lib/fontist/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fontist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: down
|
@@ -240,14 +240,14 @@ dependencies:
|
|
240
240
|
requirements:
|
241
241
|
- - "~>"
|
242
242
|
- !ruby/object:Gem::Version
|
243
|
-
version:
|
243
|
+
version: 1.22.1
|
244
244
|
type: :development
|
245
245
|
prerelease: false
|
246
246
|
version_requirements: !ruby/object:Gem::Requirement
|
247
247
|
requirements:
|
248
248
|
- - "~>"
|
249
249
|
- !ruby/object:Gem::Version
|
250
|
-
version:
|
250
|
+
version: 1.22.1
|
251
251
|
- !ruby/object:Gem::Dependency
|
252
252
|
name: rubocop-rails
|
253
253
|
requirement: !ruby/object:Gem::Requirement
|