fontist 1.0.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/check_google.yml +28 -0
- data/.github/workflows/macosx.yml +3 -0
- data/.github/workflows/ubuntu.yml +1 -1
- data/.github/workflows/windows.yml +1 -1
- data/.gitignore +6 -0
- data/.hound.yml +2 -0
- data/.rubocop.yml +22 -0
- data/README.md +54 -0
- data/bin/check_google +8 -0
- data/bin/convert_formulas +8 -0
- data/bin/fontist +8 -0
- data/bin/generate_otfinfo +8 -0
- data/bin/import_google +8 -0
- data/bin/stripttc +0 -0
- data/fontist.gemspec +15 -1
- data/lib/fontist.rb +22 -15
- data/lib/fontist/cli.rb +118 -0
- data/lib/fontist/errors.rb +5 -1
- data/lib/fontist/font.rb +153 -3
- data/lib/fontist/font_formula.rb +17 -6
- data/lib/fontist/fontist_font.rb +70 -0
- data/lib/fontist/formula.rb +11 -8
- data/lib/fontist/formula_template.rb +103 -0
- data/lib/fontist/formulas.rb +41 -0
- data/lib/fontist/import.rb +9 -0
- data/lib/fontist/import/convert_formulas.rb +65 -0
- data/lib/fontist/import/create_formula.rb +74 -0
- data/lib/fontist/import/extractors.rb +5 -0
- data/lib/fontist/import/extractors/cab_extractor.rb +37 -0
- data/lib/fontist/import/extractors/extractor.rb +19 -0
- data/lib/fontist/import/extractors/ole_extractor.rb +41 -0
- data/lib/fontist/import/extractors/seven_zip_extractor.rb +44 -0
- data/lib/fontist/import/extractors/zip_extractor.rb +31 -0
- data/lib/fontist/import/files/collection_file.rb +48 -0
- data/lib/fontist/import/formula_builder.rb +115 -0
- data/lib/fontist/import/formula_serializer.rb +133 -0
- data/lib/fontist/import/google.rb +16 -0
- data/lib/fontist/import/google/fonts_public.md +10 -0
- data/lib/fontist/import/google/fonts_public.pb.rb +71 -0
- data/lib/fontist/import/google/fonts_public.proto +46 -0
- data/lib/fontist/import/google/new_fonts_fetcher.rb +121 -0
- data/lib/fontist/import/google/skiplist.yml +6 -0
- data/lib/fontist/import/google_check.rb +34 -0
- data/lib/fontist/import/google_import.rb +180 -0
- data/lib/fontist/import/helpers/hash_helper.rb +13 -0
- data/lib/fontist/import/helpers/system_helper.rb +20 -0
- data/lib/fontist/import/otf/font_file.rb +89 -0
- data/lib/fontist/import/otf_parser.rb +25 -0
- data/lib/fontist/import/otf_style.rb +29 -0
- data/lib/fontist/import/otfinfo/otfinfo_requirement.rb +22 -0
- data/lib/fontist/import/otfinfo/template.erb +20 -0
- data/lib/fontist/import/otfinfo_generate.rb +45 -0
- data/lib/fontist/import/recursive_extraction.rb +101 -0
- data/lib/fontist/import/template_helper.rb +19 -0
- data/lib/fontist/import/text_helper.rb +30 -0
- data/lib/fontist/registry.rb +1 -0
- data/lib/fontist/system.yml +5 -1
- data/lib/fontist/system_font.rb +23 -20
- data/lib/fontist/utils.rb +6 -0
- data/lib/fontist/utils/cache.rb +69 -0
- data/lib/fontist/utils/downloader.rb +92 -0
- data/lib/fontist/utils/dsl.rb +8 -0
- data/lib/fontist/utils/dsl/font.rb +37 -0
- data/lib/fontist/utils/exe_extractor.rb +12 -19
- data/lib/fontist/utils/msi_extractor.rb +31 -0
- data/lib/fontist/utils/seven_zip_extractor.rb +41 -0
- data/lib/fontist/utils/system.rb +23 -0
- data/lib/fontist/utils/ui.rb +23 -0
- data/lib/fontist/utils/zip_extractor.rb +9 -4
- data/lib/fontist/version.rb +1 -1
- metadata +170 -50
- data/lib/fontist/downloader.rb +0 -70
- data/lib/fontist/formulas/andale_font.rb +0 -79
- data/lib/fontist/formulas/arial_black_font.rb +0 -78
- data/lib/fontist/formulas/cleartype_fonts.rb +0 -225
- data/lib/fontist/formulas/comic_font.rb +0 -77
- data/lib/fontist/formulas/courier_font.rb +0 -80
- data/lib/fontist/formulas/euphemia_font.rb +0 -85
- data/lib/fontist/formulas/georgia_font.rb +0 -79
- data/lib/fontist/formulas/impact_font.rb +0 -77
- data/lib/fontist/formulas/montserrat_font.rb +0 -132
- data/lib/fontist/formulas/ms_truetype_fonts.rb +0 -124
- data/lib/fontist/formulas/open_sans_fonts.rb +0 -263
- data/lib/fontist/formulas/overpass_font.rb +0 -73
- data/lib/fontist/formulas/source_fonts.rb +0 -109
- data/lib/fontist/formulas/stix_fonts.rb +0 -108
- data/lib/fontist/formulas/tahoma_font.rb +0 -147
- data/lib/fontist/formulas/webding_font.rb +0 -77
- data/spec/fontist/downloader_spec.rb +0 -35
- data/spec/fontist/font_formula_spec.rb +0 -67
- data/spec/fontist/font_spec.rb +0 -87
- data/spec/fontist/formula_spec.rb +0 -67
- data/spec/fontist/formulas/andale_font_spec.rb +0 -29
- data/spec/fontist/formulas/arial_black_font_spec.rb +0 -29
- data/spec/fontist/formulas/cleartype_fonts_spec.rb +0 -38
- data/spec/fontist/formulas/comic_font_spec.rb +0 -29
- data/spec/fontist/formulas/courier_font_spec.rb +0 -29
- data/spec/fontist/formulas/euphemia_font_spec.rb +0 -29
- data/spec/fontist/formulas/georgia_font_spec.rb +0 -29
- data/spec/fontist/formulas/impact_font_spec.rb +0 -29
- data/spec/fontist/formulas/montserrat_font_spec.rb +0 -29
- data/spec/fontist/formulas/ms_truetype_fonts_spec.rb +0 -29
- data/spec/fontist/formulas/open_sans_fonts_spec.rb +0 -29
- data/spec/fontist/formulas/overpass_font_spec.rb +0 -29
- data/spec/fontist/formulas/source_fonts_spec.rb +0 -31
- data/spec/fontist/formulas/stix_fonts_spec.rb +0 -29
- data/spec/fontist/formulas/tahoma_font_spec.rb +0 -29
- data/spec/fontist/formulas/webding_font_spec.rb +0 -29
- data/spec/fontist/registry_spec.rb +0 -47
- data/spec/fontist/system_font_spec.rb +0 -39
- data/spec/fontist_spec.rb +0 -5
- data/spec/spec_helper.rb +0 -22
- data/spec/support/fontist_helper.rb +0 -10
@@ -0,0 +1,23 @@
|
|
1
|
+
require "thor"
|
2
|
+
|
3
|
+
module Fontist
|
4
|
+
module Utils
|
5
|
+
class UI < Thor
|
6
|
+
def self.success(message)
|
7
|
+
new.say(message, :green)
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.error(message)
|
11
|
+
new.say(message, :red)
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.say(message)
|
15
|
+
new.say(message)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.ask(message, options = {})
|
19
|
+
new.ask(message, options)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -4,24 +4,28 @@ require "pathname"
|
|
4
4
|
module Fontist
|
5
5
|
module Utils
|
6
6
|
module ZipExtractor
|
7
|
+
# fonts_sub_dir is unused now, but formulas have this option
|
8
|
+
# rubocop:disable Lint/UnusedMethodArgument
|
7
9
|
def zip_extract(resource, download: true, fonts_sub_dir: "")
|
8
10
|
zip_file = download_file(resource) if download
|
9
11
|
zip_file ||= resource.urls.first
|
10
12
|
|
11
|
-
fonts_paths = unzip_fonts(zip_file
|
13
|
+
fonts_paths = unzip_fonts(zip_file)
|
12
14
|
block_given? ? yield(fonts_paths) : fonts_paths
|
13
15
|
end
|
16
|
+
# rubocop:enable Lint/UnusedMethodArgument
|
14
17
|
|
15
18
|
alias_method :unzip, :zip_extract
|
16
19
|
|
17
20
|
private
|
18
21
|
|
19
|
-
|
22
|
+
# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
23
|
+
def unzip_fonts(file)
|
20
24
|
Zip.on_exists_proc = true
|
21
|
-
Array.new.tap do |fonts|
|
22
25
|
|
26
|
+
Array.new.tap do |fonts|
|
23
27
|
Zip::File.open(file) do |zip_file|
|
24
|
-
zip_file.glob("
|
28
|
+
zip_file.glob("**/*.{ttf,ttc,otf}").each do |entry|
|
25
29
|
if entry.name
|
26
30
|
filename = Pathname.new(entry.name).basename
|
27
31
|
font_path = fonts_path.join(filename.to_s)
|
@@ -33,6 +37,7 @@ module Fontist
|
|
33
37
|
end
|
34
38
|
end
|
35
39
|
end
|
40
|
+
# rubocop:enable Metrics/MethodLength, Metrics/AbcSize
|
36
41
|
end
|
37
42
|
end
|
38
43
|
end
|
data/lib/fontist/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fontist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
- Abu Nashir
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-10-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: down
|
@@ -53,6 +53,62 @@ dependencies:
|
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: 2.3.0
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: seven_zip_ruby
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '1.0'
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '1.0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: ruby-ole
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '1.0'
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '1.0'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: thor
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - "~>"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 1.0.1
|
91
|
+
type: :runtime
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: 1.0.1
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: git
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - "~>"
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '1.0'
|
105
|
+
type: :runtime
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - "~>"
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '1.0'
|
56
112
|
- !ruby/object:Gem::Dependency
|
57
113
|
name: pry
|
58
114
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,84 +165,148 @@ dependencies:
|
|
109
165
|
- - "~>"
|
110
166
|
- !ruby/object:Gem::Version
|
111
167
|
version: '3.0'
|
168
|
+
- !ruby/object:Gem::Dependency
|
169
|
+
name: rubocop
|
170
|
+
requirement: !ruby/object:Gem::Requirement
|
171
|
+
requirements:
|
172
|
+
- - '='
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: 0.75.0
|
175
|
+
type: :development
|
176
|
+
prerelease: false
|
177
|
+
version_requirements: !ruby/object:Gem::Requirement
|
178
|
+
requirements:
|
179
|
+
- - '='
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: 0.75.0
|
182
|
+
- !ruby/object:Gem::Dependency
|
183
|
+
name: rubocop-rails
|
184
|
+
requirement: !ruby/object:Gem::Requirement
|
185
|
+
requirements:
|
186
|
+
- - ">="
|
187
|
+
- !ruby/object:Gem::Version
|
188
|
+
version: '0'
|
189
|
+
type: :development
|
190
|
+
prerelease: false
|
191
|
+
version_requirements: !ruby/object:Gem::Requirement
|
192
|
+
requirements:
|
193
|
+
- - ">="
|
194
|
+
- !ruby/object:Gem::Version
|
195
|
+
version: '0'
|
196
|
+
- !ruby/object:Gem::Dependency
|
197
|
+
name: rubocop-performance
|
198
|
+
requirement: !ruby/object:Gem::Requirement
|
199
|
+
requirements:
|
200
|
+
- - ">="
|
201
|
+
- !ruby/object:Gem::Version
|
202
|
+
version: '0'
|
203
|
+
type: :development
|
204
|
+
prerelease: false
|
205
|
+
version_requirements: !ruby/object:Gem::Requirement
|
206
|
+
requirements:
|
207
|
+
- - ">="
|
208
|
+
- !ruby/object:Gem::Version
|
209
|
+
version: '0'
|
210
|
+
- !ruby/object:Gem::Dependency
|
211
|
+
name: ruby-protocol-buffers
|
212
|
+
requirement: !ruby/object:Gem::Requirement
|
213
|
+
requirements:
|
214
|
+
- - "~>"
|
215
|
+
- !ruby/object:Gem::Version
|
216
|
+
version: '1.0'
|
217
|
+
type: :development
|
218
|
+
prerelease: false
|
219
|
+
version_requirements: !ruby/object:Gem::Requirement
|
220
|
+
requirements:
|
221
|
+
- - "~>"
|
222
|
+
- !ruby/object:Gem::Version
|
223
|
+
version: '1.0'
|
112
224
|
description: A libarary find or download fonts
|
113
225
|
email:
|
114
226
|
- operations@ribose.com
|
115
227
|
- abunashir@gmail.com
|
116
|
-
executables:
|
228
|
+
executables:
|
229
|
+
- fontist
|
117
230
|
extensions: []
|
118
231
|
extra_rdoc_files: []
|
119
232
|
files:
|
233
|
+
- ".github/workflows/check_google.yml"
|
120
234
|
- ".github/workflows/macosx.yml"
|
121
235
|
- ".github/workflows/ubuntu.yml"
|
122
236
|
- ".github/workflows/windows.yml"
|
123
237
|
- ".gitignore"
|
238
|
+
- ".hound.yml"
|
124
239
|
- ".rspec"
|
240
|
+
- ".rubocop.yml"
|
125
241
|
- Gemfile
|
126
242
|
- LICENSE.txt
|
127
243
|
- README.md
|
128
244
|
- Rakefile
|
245
|
+
- bin/check_google
|
129
246
|
- bin/console
|
247
|
+
- bin/convert_formulas
|
248
|
+
- bin/fontist
|
249
|
+
- bin/generate_otfinfo
|
250
|
+
- bin/import_google
|
130
251
|
- bin/rspec
|
131
252
|
- bin/setup
|
253
|
+
- bin/stripttc
|
132
254
|
- fontist.gemspec
|
133
255
|
- lib/fontist.rb
|
134
|
-
- lib/fontist/
|
256
|
+
- lib/fontist/cli.rb
|
135
257
|
- lib/fontist/errors.rb
|
136
258
|
- lib/fontist/font.rb
|
137
259
|
- lib/fontist/font_formula.rb
|
260
|
+
- lib/fontist/fontist_font.rb
|
138
261
|
- lib/fontist/formula.rb
|
262
|
+
- lib/fontist/formula_template.rb
|
139
263
|
- lib/fontist/formulas.rb
|
140
|
-
- lib/fontist/
|
141
|
-
- lib/fontist/
|
142
|
-
- lib/fontist/
|
143
|
-
- lib/fontist/
|
144
|
-
- lib/fontist/
|
145
|
-
- lib/fontist/
|
146
|
-
- lib/fontist/
|
147
|
-
- lib/fontist/
|
148
|
-
- lib/fontist/
|
149
|
-
- lib/fontist/
|
150
|
-
- lib/fontist/
|
151
|
-
- lib/fontist/
|
152
|
-
- lib/fontist/
|
153
|
-
- lib/fontist/
|
154
|
-
- lib/fontist/
|
155
|
-
- lib/fontist/
|
264
|
+
- lib/fontist/import.rb
|
265
|
+
- lib/fontist/import/convert_formulas.rb
|
266
|
+
- lib/fontist/import/create_formula.rb
|
267
|
+
- lib/fontist/import/extractors.rb
|
268
|
+
- lib/fontist/import/extractors/cab_extractor.rb
|
269
|
+
- lib/fontist/import/extractors/extractor.rb
|
270
|
+
- lib/fontist/import/extractors/ole_extractor.rb
|
271
|
+
- lib/fontist/import/extractors/seven_zip_extractor.rb
|
272
|
+
- lib/fontist/import/extractors/zip_extractor.rb
|
273
|
+
- lib/fontist/import/files/collection_file.rb
|
274
|
+
- lib/fontist/import/formula_builder.rb
|
275
|
+
- lib/fontist/import/formula_serializer.rb
|
276
|
+
- lib/fontist/import/google.rb
|
277
|
+
- lib/fontist/import/google/fonts_public.md
|
278
|
+
- lib/fontist/import/google/fonts_public.pb.rb
|
279
|
+
- lib/fontist/import/google/fonts_public.proto
|
280
|
+
- lib/fontist/import/google/new_fonts_fetcher.rb
|
281
|
+
- lib/fontist/import/google/skiplist.yml
|
282
|
+
- lib/fontist/import/google_check.rb
|
283
|
+
- lib/fontist/import/google_import.rb
|
284
|
+
- lib/fontist/import/helpers/hash_helper.rb
|
285
|
+
- lib/fontist/import/helpers/system_helper.rb
|
286
|
+
- lib/fontist/import/otf/font_file.rb
|
287
|
+
- lib/fontist/import/otf_parser.rb
|
288
|
+
- lib/fontist/import/otf_style.rb
|
289
|
+
- lib/fontist/import/otfinfo/otfinfo_requirement.rb
|
290
|
+
- lib/fontist/import/otfinfo/template.erb
|
291
|
+
- lib/fontist/import/otfinfo_generate.rb
|
292
|
+
- lib/fontist/import/recursive_extraction.rb
|
293
|
+
- lib/fontist/import/template_helper.rb
|
294
|
+
- lib/fontist/import/text_helper.rb
|
156
295
|
- lib/fontist/registry.rb
|
157
296
|
- lib/fontist/system.yml
|
158
297
|
- lib/fontist/system_font.rb
|
159
298
|
- lib/fontist/utils.rb
|
299
|
+
- lib/fontist/utils/cache.rb
|
300
|
+
- lib/fontist/utils/downloader.rb
|
160
301
|
- lib/fontist/utils/dsl.rb
|
302
|
+
- lib/fontist/utils/dsl/font.rb
|
161
303
|
- lib/fontist/utils/exe_extractor.rb
|
304
|
+
- lib/fontist/utils/msi_extractor.rb
|
305
|
+
- lib/fontist/utils/seven_zip_extractor.rb
|
306
|
+
- lib/fontist/utils/system.rb
|
307
|
+
- lib/fontist/utils/ui.rb
|
162
308
|
- lib/fontist/utils/zip_extractor.rb
|
163
309
|
- lib/fontist/version.rb
|
164
|
-
- spec/fixtures/fonts/DejaVuSerif.ttf
|
165
|
-
- spec/fontist/downloader_spec.rb
|
166
|
-
- spec/fontist/font_formula_spec.rb
|
167
|
-
- spec/fontist/font_spec.rb
|
168
|
-
- spec/fontist/formula_spec.rb
|
169
|
-
- spec/fontist/formulas/andale_font_spec.rb
|
170
|
-
- spec/fontist/formulas/arial_black_font_spec.rb
|
171
|
-
- spec/fontist/formulas/cleartype_fonts_spec.rb
|
172
|
-
- spec/fontist/formulas/comic_font_spec.rb
|
173
|
-
- spec/fontist/formulas/courier_font_spec.rb
|
174
|
-
- spec/fontist/formulas/euphemia_font_spec.rb
|
175
|
-
- spec/fontist/formulas/georgia_font_spec.rb
|
176
|
-
- spec/fontist/formulas/impact_font_spec.rb
|
177
|
-
- spec/fontist/formulas/montserrat_font_spec.rb
|
178
|
-
- spec/fontist/formulas/ms_truetype_fonts_spec.rb
|
179
|
-
- spec/fontist/formulas/open_sans_fonts_spec.rb
|
180
|
-
- spec/fontist/formulas/overpass_font_spec.rb
|
181
|
-
- spec/fontist/formulas/source_fonts_spec.rb
|
182
|
-
- spec/fontist/formulas/stix_fonts_spec.rb
|
183
|
-
- spec/fontist/formulas/tahoma_font_spec.rb
|
184
|
-
- spec/fontist/formulas/webding_font_spec.rb
|
185
|
-
- spec/fontist/registry_spec.rb
|
186
|
-
- spec/fontist/system_font_spec.rb
|
187
|
-
- spec/fontist_spec.rb
|
188
|
-
- spec/spec_helper.rb
|
189
|
-
- spec/support/fontist_helper.rb
|
190
310
|
homepage: https://github.com/fontist/fontist
|
191
311
|
licenses:
|
192
312
|
- BSD-2-Clause
|
@@ -194,7 +314,7 @@ metadata:
|
|
194
314
|
homepage_uri: https://github.com/fontist/fontist
|
195
315
|
source_code_uri: https://github.com/fontist/fontist
|
196
316
|
changelog_uri: https://github.com/fontist/fontist
|
197
|
-
post_install_message:
|
317
|
+
post_install_message: Please run `fontist update` to fetch formulas
|
198
318
|
rdoc_options: []
|
199
319
|
require_paths:
|
200
320
|
- lib
|
@@ -209,8 +329,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
209
329
|
- !ruby/object:Gem::Version
|
210
330
|
version: '0'
|
211
331
|
requirements: []
|
212
|
-
rubygems_version: 3.0.
|
213
|
-
signing_key:
|
332
|
+
rubygems_version: 3.0.3
|
333
|
+
signing_key:
|
214
334
|
specification_version: 4
|
215
335
|
summary: A libarary find or download fonts
|
216
336
|
test_files: []
|
data/lib/fontist/downloader.rb
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
module Fontist
|
2
|
-
class Downloader
|
3
|
-
def initialize(file, file_size: nil, sha: nil, progress: nil)
|
4
|
-
@file = file
|
5
|
-
@progress = progress
|
6
|
-
@sha = [sha].flatten.compact
|
7
|
-
@file_size = (file_size || default_file_size).to_i
|
8
|
-
end
|
9
|
-
|
10
|
-
def download
|
11
|
-
file = download_file
|
12
|
-
|
13
|
-
if !sha.empty? && !sha.include?(Digest::SHA256.file(file).to_s)
|
14
|
-
raise(Fontist::Errors::TemparedFileError.new(
|
15
|
-
"The downloaded file from #{@file} doesn't " \
|
16
|
-
"match with the expected sha256 checksum!"
|
17
|
-
))
|
18
|
-
end
|
19
|
-
|
20
|
-
file
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.download(file, options = {})
|
24
|
-
new(file, options).download
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
attr_reader :file, :sha, :file_size
|
30
|
-
|
31
|
-
def default_file_size
|
32
|
-
5 * byte_to_megabyte
|
33
|
-
end
|
34
|
-
|
35
|
-
def byte_to_megabyte
|
36
|
-
@byte_to_megabyte ||= 1024 * 1024
|
37
|
-
end
|
38
|
-
|
39
|
-
def download_path
|
40
|
-
options[:download_path] || Fontist.root_path.join("tmp")
|
41
|
-
end
|
42
|
-
|
43
|
-
def download_file
|
44
|
-
bar = ProgressBar.new(file_size / byte_to_megabyte)
|
45
|
-
|
46
|
-
Down.download(
|
47
|
-
@file,
|
48
|
-
progress_proc: -> (progress) {
|
49
|
-
bar.increment(progress / byte_to_megabyte) if @progress === true
|
50
|
-
}
|
51
|
-
)
|
52
|
-
|
53
|
-
rescue Down::NotFound
|
54
|
-
raise(Fontist::Errors::InvalidResourceError.new("Invalid URL: #{@file}"))
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
class ProgressBar
|
59
|
-
def initialize(total)
|
60
|
-
@counter = 1
|
61
|
-
@total = total
|
62
|
-
end
|
63
|
-
|
64
|
-
def increment(progress)
|
65
|
-
complete = sprintf("%#.2f%%", ((@counter.to_f / @total.to_f) * 100))
|
66
|
-
print "\r\e[0KDownloads: #{@counter}MB/#{@total}MB (#{complete})"
|
67
|
-
@counter = progress
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
@@ -1,79 +0,0 @@
|
|
1
|
-
module Fontist
|
2
|
-
module Formulas
|
3
|
-
class AndaleFont < FontFormula
|
4
|
-
key :andale_font
|
5
|
-
desc "Microsoft TrueType Core fonts for the Web"
|
6
|
-
homepage "https://www.microsoft.com"
|
7
|
-
|
8
|
-
resource "andale32.exe" do
|
9
|
-
urls [
|
10
|
-
"https://nchc.dl.sourceforge.net/project/corefonts/the%20fonts/final/andale32.exe",
|
11
|
-
"http://sft.if.usp.br/msttcorefonts/andale32.exe"
|
12
|
-
]
|
13
|
-
sha256 "0524fe42951adc3a7eb870e32f0920313c71f170c859b5f770d82b4ee111e970"
|
14
|
-
end
|
15
|
-
|
16
|
-
provides_font("Andale Mono", match_styles_from_file: {
|
17
|
-
"Regular" => "AndaleMo.TTF"
|
18
|
-
})
|
19
|
-
|
20
|
-
def extract
|
21
|
-
resource "andale32.exe" do |resource|
|
22
|
-
cab_extract(resource) do |dir|
|
23
|
-
match_fonts(dir, "Andale Mono")
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
def install
|
30
|
-
case platform
|
31
|
-
when :macos
|
32
|
-
install_matched_fonts "$HOME/Library/Fonts/Microsoft"
|
33
|
-
when :linux
|
34
|
-
install_matched_fonts "/usr/share/fonts/truetype/vista"
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
test do
|
39
|
-
case platform
|
40
|
-
when :macos
|
41
|
-
assert_predicate "$HOME/Library/Fonts/Microsoft/AndaleMo.ttf", :exist?
|
42
|
-
when :linux
|
43
|
-
assert_predicate "/usr/share/fonts/truetype/vista/AndaleMo.ttf", :exist?
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
requires_license_agreement <<~EOS
|
48
|
-
(from http://web.archive.org/web/20011222020409/http://www.microsoft.com/typography/fontpack/eula.htm)
|
49
|
-
TrueType core fonts for the Web EULA
|
50
|
-
END-USER LICENSE AGREEMENT FOR
|
51
|
-
MICROSOFT SOFTWARE
|
52
|
-
IMPORTANT-READ CAREFULLY: This Microsoft End-User License Agreement ("EULA") is a legal agreement between you (either an individual or a single entity) and Microsoft Corporation for the Microsoft software accompanying this EULA, which includes computer software and may include associated media, printed materials, and "on-line" or electronic documentation ("SOFTWARE PRODUCT" or "SOFTWARE"). By exercising your rights to make and use copies of the SOFTWARE PRODUCT, you agree to be bound by the terms of this EULA. If you do not agree to the terms of this EULA, you may not use the SOFTWARE PRODUCT.
|
53
|
-
SOFTWARE PRODUCT LICENSE
|
54
|
-
The SOFTWARE PRODUCT is protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties. The SOFTWARE PRODUCT is licensed, not sold.
|
55
|
-
1. GRANT OF LICENSE. This EULA grants you the following rights:
|
56
|
-
* Installation and Use. You may install and use an unlimited number of copies of the SOFTWARE PRODUCT.
|
57
|
-
* Reproduction and Distribution. You may reproduce and distribute an unlimited number of copies of the SOFTWARE PRODUCT; provided that each copy shall be a true and complete copy, including all copyright and trademark notices, and shall be accompanied by a copy of this EULA. Copies of the SOFTWARE PRODUCT may not be distributed for profit either on a standalone basis or included as part of your own product.
|
58
|
-
2. DESCRIPTION OF OTHER RIGHTS AND LIMITATIONS.
|
59
|
-
* Limitations on Reverse Engineering, Decompilation, and Disassembly. You may not reverse engineer, decompile, or disassemble the SOFTWARE PRODUCT, except and only to the extent that such activity is expressly permitted by applicable law notwithstanding this limitation.
|
60
|
-
* Restrictions on Alteration. You may not rename, edit or create any derivative works from the SOFTWARE PRODUCT, other than subsetting when embedding them in documents.
|
61
|
-
* Software Transfer. You may permanently transfer all of your rights under this EULA, provided the recipient agrees to the terms of this EULA.
|
62
|
-
* Termination. Without prejudice to any other rights, Microsoft may terminate this EULA if you fail to comply with the terms and conditions of this EULA. In such event, you must destroy all copies of the SOFTWARE PRODUCT and all of its component parts.
|
63
|
-
3. COPYRIGHT. All title and copyrights in and to the SOFTWARE PRODUCT (including but not limited to any images, text, and "applets" incorporated into the SOFTWARE PRODUCT), the accompanying printed materials, and any copies of the SOFTWARE PRODUCT are owned by Microsoft or its suppliers. The SOFTWARE PRODUCT is protected by copyright laws and international treaty provisions. Therefore, you must treat the SOFTWARE PRODUCT like any other copyrighted material.
|
64
|
-
4. U.S. GOVERNMENT RESTRICTED RIGHTS. The SOFTWARE PRODUCT and documentation are provided with RESTRICTED RIGHTS. Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013 or subparagraphs (c)(1) and (2) of the Commercial Computer Software - Restricted Rights at 48 CFR 52.227-19, as applicable. Manufacturer is Microsoft Corporation/One Microsoft Way/Redmond, WA 98052-6399.
|
65
|
-
LIMITED WARRANTY
|
66
|
-
NO WARRANTIES. Microsoft expressly disclaims any warranty for the SOFTWARE PRODUCT. The SOFTWARE PRODUCT and any related documentation is provided "as is" without warranty of any kind, either express or implied, including, without limitation, the implied warranties or merchantability, fitness for a particular purpose, or noninfringement. The entire risk arising out of use or performance of the SOFTWARE PRODUCT remains with you.
|
67
|
-
NO LIABILITY FOR CONSEQUENTIAL DAMAGES. In no event shall Microsoft or its suppliers be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or any other pecuniary loss) arising out of the use of or inability to use this Microsoft product, even if Microsoft has been advised of the possibility of such damages. Because some states/jurisdictions do not allow the exclusion or limitation of liability for consequential or incidental damages, the above limitation may not apply to you.
|
68
|
-
MISCELLANEOUS
|
69
|
-
If you acquired this product in the United States, this EULA is governed by the laws of the State of Washington.
|
70
|
-
If this product was acquired outside the United States, then local laws may apply.
|
71
|
-
Should you have any questions concerning this EULA, or if you desire to contact Microsoft for any reason, please contact the Microsoft subsidiary serving your country, or write: Microsoft Sales Information Center/One Microsoft Way/Redmond, WA 98052-6399.
|
72
|
-
this page was last updated 28 July 1998
|
73
|
-
© 1997 Microsoft Corporation. All rights reserved. Terms of use.
|
74
|
-
comments to the MST group: ttwsite@microsoft.com
|
75
|
-
EOS
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
end
|