fontist 1.8.4 → 1.8.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rspec.yml +13 -13
  3. data/fontist.gemspec +3 -7
  4. data/lib/fontist.rb +4 -0
  5. data/lib/fontist/cli.rb +11 -22
  6. data/lib/fontist/font.rb +37 -42
  7. data/lib/fontist/font_installer.rb +37 -37
  8. data/lib/fontist/font_path.rb +29 -0
  9. data/lib/fontist/formula.rb +8 -4
  10. data/lib/fontist/import/recursive_extraction.rb +25 -119
  11. data/lib/fontist/index.rb +4 -65
  12. data/lib/fontist/indexes/base_index.rb +82 -0
  13. data/lib/fontist/indexes/filename_index.rb +19 -0
  14. data/lib/fontist/indexes/font_index.rb +21 -0
  15. data/lib/fontist/indexes/index_formula.rb +36 -0
  16. data/lib/fontist/manifest/install.rb +3 -2
  17. data/lib/fontist/utils.rb +0 -8
  18. data/lib/fontist/utils/downloader.rb +7 -4
  19. data/lib/fontist/version.rb +1 -1
  20. metadata +21 -92
  21. data/lib/fontist/import/extractors.rb +0 -9
  22. data/lib/fontist/import/extractors/cab_extractor.rb +0 -37
  23. data/lib/fontist/import/extractors/cpio_extractor.rb +0 -39
  24. data/lib/fontist/import/extractors/extractor.rb +0 -19
  25. data/lib/fontist/import/extractors/gzip_extractor.rb +0 -27
  26. data/lib/fontist/import/extractors/ole_extractor.rb +0 -41
  27. data/lib/fontist/import/extractors/rpm_extractor.rb +0 -45
  28. data/lib/fontist/import/extractors/seven_zip_extractor.rb +0 -44
  29. data/lib/fontist/import/extractors/tar_extractor.rb +0 -47
  30. data/lib/fontist/import/extractors/zip_extractor.rb +0 -31
  31. data/lib/fontist/index_formula.rb +0 -30
  32. data/lib/fontist/utils/cpio/cpio.rb +0 -199
  33. data/lib/fontist/utils/cpio_extractor.rb +0 -47
  34. data/lib/fontist/utils/exe_extractor.rb +0 -75
  35. data/lib/fontist/utils/gzip_extractor.rb +0 -24
  36. data/lib/fontist/utils/msi_extractor.rb +0 -31
  37. data/lib/fontist/utils/rpm_extractor.rb +0 -37
  38. data/lib/fontist/utils/seven_zip_extractor.rb +0 -41
  39. data/lib/fontist/utils/tar_extractor.rb +0 -61
  40. data/lib/fontist/utils/zip_extractor.rb +0 -52
@@ -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,14 +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
- require "fontist/utils/rpm_extractor"
13
- require "fontist/utils/gzip_extractor"
14
- require "fontist/utils/cpio_extractor"
15
- require "fontist/utils/tar_extractor"
16
8
 
17
9
  module Fontist
18
10
  module Utils
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Fontist
2
- VERSION = "1.8.4".freeze
2
+ VERSION = "1.8.9".freeze
3
3
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fontist
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.4
4
+ version: 1.8.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-10 00:00:00.000000000 Z
11
+ date: 2021-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: arr-pm
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: 0.0.1
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: 0.0.1
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: down
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -39,49 +25,21 @@ dependencies:
39
25
  - !ruby/object:Gem::Version
40
26
  version: '5.0'
41
27
  - !ruby/object:Gem::Dependency
42
- name: libmspack
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: 0.1.0
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: 0.1.0
55
- - !ruby/object:Gem::Dependency
56
- name: rubyzip
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: 2.3.0
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: 2.3.0
69
- - !ruby/object:Gem::Dependency
70
- name: seven_zip_ruby
28
+ name: thor
71
29
  requirement: !ruby/object:Gem::Requirement
72
30
  requirements:
73
31
  - - "~>"
74
32
  - !ruby/object:Gem::Version
75
- version: '1.0'
33
+ version: 1.0.1
76
34
  type: :runtime
77
35
  prerelease: false
78
36
  version_requirements: !ruby/object:Gem::Requirement
79
37
  requirements:
80
38
  - - "~>"
81
39
  - !ruby/object:Gem::Version
82
- version: '1.0'
40
+ version: 1.0.1
83
41
  - !ruby/object:Gem::Dependency
84
- name: ruby-ole
42
+ name: git
85
43
  requirement: !ruby/object:Gem::Requirement
86
44
  requirements:
87
45
  - - "~>"
@@ -95,47 +53,33 @@ dependencies:
95
53
  - !ruby/object:Gem::Version
96
54
  version: '1.0'
97
55
  - !ruby/object:Gem::Dependency
98
- name: thor
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: 1.0.1
104
- type: :runtime
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: 1.0.1
111
- - !ruby/object:Gem::Dependency
112
- name: git
56
+ name: ttfunk
113
57
  requirement: !ruby/object:Gem::Requirement
114
58
  requirements:
115
59
  - - "~>"
116
60
  - !ruby/object:Gem::Version
117
- version: '1.0'
61
+ version: 1.6.2
118
62
  type: :runtime
119
63
  prerelease: false
120
64
  version_requirements: !ruby/object:Gem::Requirement
121
65
  requirements:
122
66
  - - "~>"
123
67
  - !ruby/object:Gem::Version
124
- version: '1.0'
68
+ version: 1.6.2
125
69
  - !ruby/object:Gem::Dependency
126
- name: ttfunk
70
+ name: excavate
127
71
  requirement: !ruby/object:Gem::Requirement
128
72
  requirements:
129
73
  - - "~>"
130
74
  - !ruby/object:Gem::Version
131
- version: '1.0'
75
+ version: '0.1'
132
76
  type: :runtime
133
77
  prerelease: false
134
78
  version_requirements: !ruby/object:Gem::Requirement
135
79
  requirements:
136
80
  - - "~>"
137
81
  - !ruby/object:Gem::Version
138
- version: '1.0'
82
+ version: '0.1'
139
83
  - !ruby/object:Gem::Dependency
140
84
  name: extract_ttc
141
85
  requirement: !ruby/object:Gem::Requirement
@@ -212,14 +156,14 @@ dependencies:
212
156
  requirements:
213
157
  - - "~>"
214
158
  - !ruby/object:Gem::Version
215
- version: 12.3.3
159
+ version: '13'
216
160
  type: :development
217
161
  prerelease: false
218
162
  version_requirements: !ruby/object:Gem::Requirement
219
163
  requirements:
220
164
  - - "~>"
221
165
  - !ruby/object:Gem::Version
222
- version: 12.3.3
166
+ version: '13'
223
167
  - !ruby/object:Gem::Dependency
224
168
  name: rspec
225
169
  requirement: !ruby/object:Gem::Requirement
@@ -316,6 +260,7 @@ files:
316
260
  - lib/fontist/errors.rb
317
261
  - lib/fontist/font.rb
318
262
  - lib/fontist/font_installer.rb
263
+ - lib/fontist/font_path.rb
319
264
  - lib/fontist/fontist_font.rb
320
265
  - lib/fontist/formula.rb
321
266
  - lib/fontist/formula_paths.rb
@@ -323,16 +268,6 @@ files:
323
268
  - lib/fontist/import.rb
324
269
  - lib/fontist/import/convert_formulas.rb
325
270
  - lib/fontist/import/create_formula.rb
326
- - lib/fontist/import/extractors.rb
327
- - lib/fontist/import/extractors/cab_extractor.rb
328
- - lib/fontist/import/extractors/cpio_extractor.rb
329
- - lib/fontist/import/extractors/extractor.rb
330
- - lib/fontist/import/extractors/gzip_extractor.rb
331
- - lib/fontist/import/extractors/ole_extractor.rb
332
- - lib/fontist/import/extractors/rpm_extractor.rb
333
- - lib/fontist/import/extractors/seven_zip_extractor.rb
334
- - lib/fontist/import/extractors/tar_extractor.rb
335
- - lib/fontist/import/extractors/zip_extractor.rb
336
271
  - lib/fontist/import/files/collection_file.rb
337
272
  - lib/fontist/import/files/file_requirement.rb
338
273
  - lib/fontist/import/files/font_detector.rb
@@ -359,7 +294,10 @@ files:
359
294
  - lib/fontist/import/template_helper.rb
360
295
  - lib/fontist/import/text_helper.rb
361
296
  - lib/fontist/index.rb
362
- - lib/fontist/index_formula.rb
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
363
301
  - lib/fontist/manifest.rb
364
302
  - lib/fontist/manifest/install.rb
365
303
  - lib/fontist/manifest/locations.rb
@@ -368,22 +306,13 @@ files:
368
306
  - lib/fontist/system_index.rb
369
307
  - lib/fontist/utils.rb
370
308
  - lib/fontist/utils/cache.rb
371
- - lib/fontist/utils/cpio/cpio.rb
372
- - lib/fontist/utils/cpio_extractor.rb
373
309
  - lib/fontist/utils/downloader.rb
374
310
  - lib/fontist/utils/dsl.rb
375
311
  - lib/fontist/utils/dsl/collection_font.rb
376
312
  - lib/fontist/utils/dsl/font.rb
377
- - lib/fontist/utils/exe_extractor.rb
378
- - lib/fontist/utils/gzip_extractor.rb
379
313
  - lib/fontist/utils/locking.rb
380
- - lib/fontist/utils/msi_extractor.rb
381
- - lib/fontist/utils/rpm_extractor.rb
382
- - lib/fontist/utils/seven_zip_extractor.rb
383
314
  - lib/fontist/utils/system.rb
384
- - lib/fontist/utils/tar_extractor.rb
385
315
  - lib/fontist/utils/ui.rb
386
- - lib/fontist/utils/zip_extractor.rb
387
316
  - lib/fontist/version.rb
388
317
  homepage: https://github.com/fontist/fontist
389
318
  licenses:
@@ -408,7 +337,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
408
337
  version: '0'
409
338
  requirements: []
410
339
  rubygems_version: 3.0.3
411
- signing_key:
340
+ signing_key:
412
341
  specification_version: 4
413
342
  summary: Install openly-licensed fonts on Windows, Linux and Mac!
414
343
  test_files: []
@@ -1,9 +0,0 @@
1
- require_relative "extractors/extractor"
2
- require_relative "extractors/zip_extractor"
3
- require_relative "extractors/ole_extractor"
4
- require_relative "extractors/seven_zip_extractor"
5
- require_relative "extractors/cab_extractor"
6
- require_relative "extractors/rpm_extractor"
7
- require_relative "extractors/gzip_extractor"
8
- require_relative "extractors/cpio_extractor"
9
- require_relative "extractors/tar_extractor"
@@ -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,39 +0,0 @@
1
- module Fontist
2
- module Import
3
- module Extractors
4
- class CpioExtractor < Extractor
5
- def extract
6
- dir = Dir.mktmpdir
7
- extract_cpio(@archive, dir)
8
- dir
9
- end
10
-
11
- def format
12
- "cpio"
13
- end
14
-
15
- private
16
-
17
- def extract_cpio(archive, dir)
18
- archive_file = File.open(archive, "rb")
19
-
20
- reader_class.new(archive_file).each do |entry, file|
21
- path = File.join(dir, entry.name)
22
- if entry.directory?
23
- FileUtils.mkdir_p(path)
24
- else
25
- File.write(path, file.read)
26
- end
27
- end
28
- end
29
-
30
- def reader_class
31
- @reader_class ||= begin
32
- require "fontist/utils/cpio/cpio"
33
- CPIO::ASCIIReader
34
- end
35
- end
36
- end
37
- end
38
- end
39
- 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,27 +0,0 @@
1
- module Fontist
2
- module Import
3
- module Extractors
4
- class GzipExtractor < Extractor
5
- def extract
6
- dir = Dir.mktmpdir
7
- extract_gzip(@archive, dir)
8
- dir
9
- end
10
-
11
- def format
12
- "gzip"
13
- end
14
-
15
- private
16
-
17
- def extract_gzip(archive, dir)
18
- Zlib::GzipReader.open(archive) do |gz|
19
- basename = File.basename(archive, ".*")
20
- path = File.join(dir, basename)
21
- File.write(path, gz.read)
22
- end
23
- end
24
- end
25
- end
26
- end
27
- 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