fontist 1.8.3 → 1.8.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rspec.yml +6 -6
- data/fontist.gemspec +7 -10
- data/lib/fontist.rb +4 -0
- data/lib/fontist/cli.rb +11 -22
- data/lib/fontist/errors.rb +1 -0
- data/lib/fontist/font.rb +37 -42
- data/lib/fontist/font_installer.rb +37 -33
- data/lib/fontist/font_path.rb +29 -0
- data/lib/fontist/formula.rb +8 -4
- data/lib/fontist/import/recursive_extraction.rb +30 -110
- data/lib/fontist/index.rb +4 -65
- data/lib/fontist/indexes/base_index.rb +82 -0
- data/lib/fontist/indexes/filename_index.rb +19 -0
- data/lib/fontist/indexes/font_index.rb +21 -0
- data/lib/fontist/indexes/index_formula.rb +36 -0
- data/lib/fontist/manifest/install.rb +3 -2
- data/lib/fontist/utils.rb +0 -4
- data/lib/fontist/utils/cache.rb +1 -1
- data/lib/fontist/utils/downloader.rb +7 -4
- data/lib/fontist/version.rb +1 -1
- metadata +21 -71
- data/lib/fontist/import/extractors.rb +0 -5
- data/lib/fontist/import/extractors/cab_extractor.rb +0 -37
- data/lib/fontist/import/extractors/extractor.rb +0 -19
- data/lib/fontist/import/extractors/ole_extractor.rb +0 -41
- data/lib/fontist/import/extractors/seven_zip_extractor.rb +0 -44
- data/lib/fontist/import/extractors/zip_extractor.rb +0 -31
- data/lib/fontist/index_formula.rb +0 -30
- data/lib/fontist/utils/exe_extractor.rb +0 -75
- data/lib/fontist/utils/msi_extractor.rb +0 -31
- data/lib/fontist/utils/seven_zip_extractor.rb +0 -41
- data/lib/fontist/utils/zip_extractor.rb +0 -52
@@ -0,0 +1,36 @@
|
|
1
|
+
module Fontist
|
2
|
+
module Indexes
|
3
|
+
class IndexFormula
|
4
|
+
def initialize(path)
|
5
|
+
@path = path
|
6
|
+
end
|
7
|
+
|
8
|
+
def name
|
9
|
+
normalized.sub(/\.yml$/, "")
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_s
|
13
|
+
normalized
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_full
|
17
|
+
Formula.new_from_file(full_path)
|
18
|
+
end
|
19
|
+
|
20
|
+
def ==(other)
|
21
|
+
to_s == other.to_s
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def normalized
|
27
|
+
escaped = Regexp.escape(Fontist.formulas_path.to_s + "/")
|
28
|
+
@path.sub(Regexp.new("^" + escaped), "")
|
29
|
+
end
|
30
|
+
|
31
|
+
def full_path
|
32
|
+
Fontist.formulas_path.join(normalized).to_s
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -3,9 +3,10 @@ require_relative "locations"
|
|
3
3
|
module Fontist
|
4
4
|
module Manifest
|
5
5
|
class Install < Locations
|
6
|
-
def initialize(manifest, confirmation: "no")
|
6
|
+
def initialize(manifest, confirmation: "no", hide_licenses: false)
|
7
7
|
@manifest = manifest
|
8
8
|
@confirmation = confirmation
|
9
|
+
@hide_licenses = hide_licenses
|
9
10
|
end
|
10
11
|
|
11
12
|
private
|
@@ -20,7 +21,7 @@ module Fontist
|
|
20
21
|
end
|
21
22
|
|
22
23
|
def install_font(font)
|
23
|
-
Fontist::Font.install(font, force: true, confirmation: @confirmation)
|
24
|
+
Fontist::Font.install(font, force: true, confirmation: @confirmation, hide_licenses: @hide_licenses)
|
24
25
|
end
|
25
26
|
end
|
26
27
|
end
|
data/lib/fontist/utils.rb
CHANGED
@@ -5,10 +5,6 @@ require "fontist/utils/dsl"
|
|
5
5
|
require "fontist/utils/dsl/font"
|
6
6
|
require "fontist/utils/dsl/collection_font"
|
7
7
|
require "fontist/utils/downloader"
|
8
|
-
require "fontist/utils/zip_extractor"
|
9
|
-
require "fontist/utils/exe_extractor"
|
10
|
-
require "fontist/utils/msi_extractor"
|
11
|
-
require "fontist/utils/seven_zip_extractor"
|
12
8
|
|
13
9
|
module Fontist
|
14
10
|
module Utils
|
data/lib/fontist/utils/cache.rb
CHANGED
@@ -3,6 +3,13 @@ require_relative "cache"
|
|
3
3
|
module Fontist
|
4
4
|
module Utils
|
5
5
|
class Downloader
|
6
|
+
class << self
|
7
|
+
def download(*args)
|
8
|
+
new(*args).download
|
9
|
+
end
|
10
|
+
ruby2_keywords :download if respond_to?(:ruby2_keywords, true)
|
11
|
+
end
|
12
|
+
|
6
13
|
def initialize(file, file_size: nil, sha: nil, progress_bar: nil)
|
7
14
|
# TODO: If the first mirror fails, try the second one
|
8
15
|
@file = file
|
@@ -27,10 +34,6 @@ module Fontist
|
|
27
34
|
file
|
28
35
|
end
|
29
36
|
|
30
|
-
def self.download(file, options = {})
|
31
|
-
new(file, options).download
|
32
|
-
end
|
33
|
-
|
34
37
|
private
|
35
38
|
|
36
39
|
attr_reader :file, :sha, :file_size
|
data/lib/fontist/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fontist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
|
-
- Abu Nashir
|
9
8
|
autorequire:
|
10
9
|
bindir: exe
|
11
10
|
cert_chain: []
|
12
|
-
date: 2021-
|
11
|
+
date: 2021-02-26 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: down
|
@@ -26,49 +25,21 @@ dependencies:
|
|
26
25
|
- !ruby/object:Gem::Version
|
27
26
|
version: '5.0'
|
28
27
|
- !ruby/object:Gem::Dependency
|
29
|
-
name:
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - "~>"
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: 0.1.0
|
35
|
-
type: :runtime
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - "~>"
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: 0.1.0
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: rubyzip
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
46
|
-
- - "~>"
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: 2.3.0
|
49
|
-
type: :runtime
|
50
|
-
prerelease: false
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - "~>"
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: 2.3.0
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
name: seven_zip_ruby
|
28
|
+
name: thor
|
58
29
|
requirement: !ruby/object:Gem::Requirement
|
59
30
|
requirements:
|
60
31
|
- - "~>"
|
61
32
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
33
|
+
version: 1.0.1
|
63
34
|
type: :runtime
|
64
35
|
prerelease: false
|
65
36
|
version_requirements: !ruby/object:Gem::Requirement
|
66
37
|
requirements:
|
67
38
|
- - "~>"
|
68
39
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
40
|
+
version: 1.0.1
|
70
41
|
- !ruby/object:Gem::Dependency
|
71
|
-
name:
|
42
|
+
name: git
|
72
43
|
requirement: !ruby/object:Gem::Requirement
|
73
44
|
requirements:
|
74
45
|
- - "~>"
|
@@ -82,21 +53,7 @@ dependencies:
|
|
82
53
|
- !ruby/object:Gem::Version
|
83
54
|
version: '1.0'
|
84
55
|
- !ruby/object:Gem::Dependency
|
85
|
-
name:
|
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
|
56
|
+
name: ttfunk
|
100
57
|
requirement: !ruby/object:Gem::Requirement
|
101
58
|
requirements:
|
102
59
|
- - "~>"
|
@@ -110,19 +67,19 @@ dependencies:
|
|
110
67
|
- !ruby/object:Gem::Version
|
111
68
|
version: '1.0'
|
112
69
|
- !ruby/object:Gem::Dependency
|
113
|
-
name:
|
70
|
+
name: excavate
|
114
71
|
requirement: !ruby/object:Gem::Requirement
|
115
72
|
requirements:
|
116
73
|
- - "~>"
|
117
74
|
- !ruby/object:Gem::Version
|
118
|
-
version: '1
|
75
|
+
version: '0.1'
|
119
76
|
type: :runtime
|
120
77
|
prerelease: false
|
121
78
|
version_requirements: !ruby/object:Gem::Requirement
|
122
79
|
requirements:
|
123
80
|
- - "~>"
|
124
81
|
- !ruby/object:Gem::Version
|
125
|
-
version: '1
|
82
|
+
version: '0.1'
|
126
83
|
- !ruby/object:Gem::Dependency
|
127
84
|
name: extract_ttc
|
128
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -199,14 +156,14 @@ dependencies:
|
|
199
156
|
requirements:
|
200
157
|
- - "~>"
|
201
158
|
- !ruby/object:Gem::Version
|
202
|
-
version:
|
159
|
+
version: '13'
|
203
160
|
type: :development
|
204
161
|
prerelease: false
|
205
162
|
version_requirements: !ruby/object:Gem::Requirement
|
206
163
|
requirements:
|
207
164
|
- - "~>"
|
208
165
|
- !ruby/object:Gem::Version
|
209
|
-
version:
|
166
|
+
version: '13'
|
210
167
|
- !ruby/object:Gem::Dependency
|
211
168
|
name: rspec
|
212
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -277,10 +234,9 @@ dependencies:
|
|
277
234
|
- - "~>"
|
278
235
|
- !ruby/object:Gem::Version
|
279
236
|
version: '1.0'
|
280
|
-
description:
|
237
|
+
description: Install openly-licensed fonts on Windows, Linux and Mac!
|
281
238
|
email:
|
282
|
-
-
|
283
|
-
- abunashir@gmail.com
|
239
|
+
- open.source@ribose.com
|
284
240
|
executables:
|
285
241
|
- fontist
|
286
242
|
extensions: []
|
@@ -304,6 +260,7 @@ files:
|
|
304
260
|
- lib/fontist/errors.rb
|
305
261
|
- lib/fontist/font.rb
|
306
262
|
- lib/fontist/font_installer.rb
|
263
|
+
- lib/fontist/font_path.rb
|
307
264
|
- lib/fontist/fontist_font.rb
|
308
265
|
- lib/fontist/formula.rb
|
309
266
|
- lib/fontist/formula_paths.rb
|
@@ -311,12 +268,6 @@ files:
|
|
311
268
|
- lib/fontist/import.rb
|
312
269
|
- lib/fontist/import/convert_formulas.rb
|
313
270
|
- lib/fontist/import/create_formula.rb
|
314
|
-
- lib/fontist/import/extractors.rb
|
315
|
-
- lib/fontist/import/extractors/cab_extractor.rb
|
316
|
-
- lib/fontist/import/extractors/extractor.rb
|
317
|
-
- lib/fontist/import/extractors/ole_extractor.rb
|
318
|
-
- lib/fontist/import/extractors/seven_zip_extractor.rb
|
319
|
-
- lib/fontist/import/extractors/zip_extractor.rb
|
320
271
|
- lib/fontist/import/files/collection_file.rb
|
321
272
|
- lib/fontist/import/files/file_requirement.rb
|
322
273
|
- lib/fontist/import/files/font_detector.rb
|
@@ -343,7 +294,10 @@ files:
|
|
343
294
|
- lib/fontist/import/template_helper.rb
|
344
295
|
- lib/fontist/import/text_helper.rb
|
345
296
|
- lib/fontist/index.rb
|
346
|
-
- lib/fontist/
|
297
|
+
- lib/fontist/indexes/base_index.rb
|
298
|
+
- lib/fontist/indexes/filename_index.rb
|
299
|
+
- lib/fontist/indexes/font_index.rb
|
300
|
+
- lib/fontist/indexes/index_formula.rb
|
347
301
|
- lib/fontist/manifest.rb
|
348
302
|
- lib/fontist/manifest/install.rb
|
349
303
|
- lib/fontist/manifest/locations.rb
|
@@ -356,13 +310,9 @@ files:
|
|
356
310
|
- lib/fontist/utils/dsl.rb
|
357
311
|
- lib/fontist/utils/dsl/collection_font.rb
|
358
312
|
- lib/fontist/utils/dsl/font.rb
|
359
|
-
- lib/fontist/utils/exe_extractor.rb
|
360
313
|
- lib/fontist/utils/locking.rb
|
361
|
-
- lib/fontist/utils/msi_extractor.rb
|
362
|
-
- lib/fontist/utils/seven_zip_extractor.rb
|
363
314
|
- lib/fontist/utils/system.rb
|
364
315
|
- lib/fontist/utils/ui.rb
|
365
|
-
- lib/fontist/utils/zip_extractor.rb
|
366
316
|
- lib/fontist/version.rb
|
367
317
|
homepage: https://github.com/fontist/fontist
|
368
318
|
licenses:
|
@@ -371,7 +321,7 @@ metadata:
|
|
371
321
|
homepage_uri: https://github.com/fontist/fontist
|
372
322
|
source_code_uri: https://github.com/fontist/fontist
|
373
323
|
changelog_uri: https://github.com/fontist/fontist
|
374
|
-
post_install_message: Please run `fontist update` to fetch formulas
|
324
|
+
post_install_message: Please run `fontist update` to fetch formulas.
|
375
325
|
rdoc_options: []
|
376
326
|
require_paths:
|
377
327
|
- lib
|
@@ -389,5 +339,5 @@ requirements: []
|
|
389
339
|
rubygems_version: 3.0.3
|
390
340
|
signing_key:
|
391
341
|
specification_version: 4
|
392
|
-
summary:
|
342
|
+
summary: Install openly-licensed fonts on Windows, Linux and Mac!
|
393
343
|
test_files: []
|
@@ -1,37 +0,0 @@
|
|
1
|
-
module Fontist
|
2
|
-
module Import
|
3
|
-
module Extractors
|
4
|
-
class CabExtractor < Extractor
|
5
|
-
def extract
|
6
|
-
dir = Dir.mktmpdir
|
7
|
-
extract_exe(@archive, dir)
|
8
|
-
dir
|
9
|
-
end
|
10
|
-
|
11
|
-
def format
|
12
|
-
File.extname(@archive) == ".exe" ? "exe" : "cab"
|
13
|
-
end
|
14
|
-
|
15
|
-
private
|
16
|
-
|
17
|
-
def extract_exe(archive, dir)
|
18
|
-
opened = decompressor.search(archive)
|
19
|
-
file = opened.files
|
20
|
-
|
21
|
-
while file
|
22
|
-
path = File.join(dir, file.filename)
|
23
|
-
decompressor.extract(file, path)
|
24
|
-
file = file.next
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def decompressor
|
29
|
-
@decompressor ||= begin
|
30
|
-
require "libmspack"
|
31
|
-
LibMsPack::CabDecompressor.new
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module Fontist
|
2
|
-
module Import
|
3
|
-
module Extractors
|
4
|
-
class Extractor
|
5
|
-
def initialize(archive)
|
6
|
-
@archive = archive
|
7
|
-
end
|
8
|
-
|
9
|
-
def extract
|
10
|
-
raise NotImplementedError.new("You must implement this method")
|
11
|
-
end
|
12
|
-
|
13
|
-
def format
|
14
|
-
raise NotImplementedError.new("You must implement this method")
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
module Fontist
|
2
|
-
module Import
|
3
|
-
module Extractors
|
4
|
-
class OleExtractor < Extractor
|
5
|
-
def extract
|
6
|
-
dir = Dir.mktmpdir
|
7
|
-
extract_ole(@archive, dir)
|
8
|
-
dir
|
9
|
-
end
|
10
|
-
|
11
|
-
def format
|
12
|
-
"msi"
|
13
|
-
end
|
14
|
-
|
15
|
-
private
|
16
|
-
|
17
|
-
def extract_ole(archive, dir)
|
18
|
-
ole = storage.open(archive)
|
19
|
-
file = the_largest_file(ole)
|
20
|
-
|
21
|
-
content = ole.file.read(file)
|
22
|
-
path = File.join(dir, "data.cab")
|
23
|
-
File.open(path, "wb") { |f| f.write(content) }
|
24
|
-
end
|
25
|
-
|
26
|
-
def storage
|
27
|
-
@storage ||= begin
|
28
|
-
require "ole/storage"
|
29
|
-
Ole::Storage
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def the_largest_file(ole)
|
34
|
-
ole.dir.entries(".").max_by do |x|
|
35
|
-
ole.file.size(x)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
module Fontist
|
2
|
-
module Import
|
3
|
-
module Extractors
|
4
|
-
class SevenZipExtractor < Extractor
|
5
|
-
def extract
|
6
|
-
dir = Dir.mktmpdir
|
7
|
-
extract_7z(@archive, dir)
|
8
|
-
dir
|
9
|
-
end
|
10
|
-
|
11
|
-
def try
|
12
|
-
File.open(@archive, "rb") do |file|
|
13
|
-
reader.open(file)
|
14
|
-
end
|
15
|
-
|
16
|
-
true
|
17
|
-
rescue StandardError => e
|
18
|
-
return false if e.message.start_with?("Invalid file format")
|
19
|
-
|
20
|
-
raise
|
21
|
-
end
|
22
|
-
|
23
|
-
def format
|
24
|
-
"seven_zip"
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def extract_7z(archive, dir)
|
30
|
-
File.open(archive, "rb") do |file|
|
31
|
-
reader.extract_all(file, dir)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def reader
|
36
|
-
@reader ||= begin
|
37
|
-
require "seven_zip_ruby"
|
38
|
-
SevenZipRuby::Reader
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|