fontist 1.8.6 → 1.8.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d13c412a0a68cdcf1845948c2f3b96c45187dc27193bae4a581d2ee1f3324201
4
- data.tar.gz: ed82b44bfc05274b749e4c4b2f2ace5e4ae115343c6ca9f99ac4fc552d71147f
3
+ metadata.gz: 69bc4225a7dac5b44f92364344568e4990ec3917631febbab1739a4980890308
4
+ data.tar.gz: b1bd65c7db74152b911375a6990cda7dd23f849291feeb00edd3fddda5b93f4d
5
5
  SHA512:
6
- metadata.gz: d8a08b20f1b2409b34749ad4f4531e2c727b3e39fa9e3b015d564d6ec14365dd9aa43274aa337845b72e4072bfcad50fe26412a69b805e7c83139934b009a6d6
7
- data.tar.gz: bb20f38a5c4c4e9714dc69b15f249636e10c76942359e10ac38dc08d98eac3cfc1c6efe879bc9e13596d38872bae75c4721ce6d3892e1ca2726bbe7f9cb50b41
6
+ metadata.gz: 298d8927f07494407568e35fea9a3ed6fc26a725df7dcd9f4a6f3e134be628bc38bc315b0d61bac63c15c92501396b04c8e59dcad59429420785fdeaf9d4ac22
7
+ data.tar.gz: 27f7bf0e155c8c3210030de3e5d1f140b4b0cee26214ca48c5cf34136eb09f8850f80178aa331b608c61583af003c8d7ca4ac071601e3fe8dbbebd25e6e15e9d
@@ -13,17 +13,17 @@ jobs:
13
13
  strategy:
14
14
  fail-fast: false
15
15
  matrix:
16
- ruby: [ '2.6', '2.5', '2.4' ]
16
+ ruby: [ '2.4', '2.5', '2.6', '2.7' ]
17
17
  os: [ ubuntu-latest, windows-latest, macos-latest ]
18
18
  experimental: [ false ]
19
19
  include:
20
- - ruby: '2.7'
20
+ - ruby: '3.0'
21
21
  os: 'ubuntu-latest'
22
22
  experimental: true
23
- - ruby: '2.7'
23
+ - ruby: '3.0'
24
24
  os: 'windows-latest'
25
25
  experimental: true
26
- - ruby: '2.7'
26
+ - ruby: '3.0'
27
27
  os: 'macos-latest'
28
28
  experimental: true
29
29
 
data/fontist.gemspec CHANGED
@@ -42,7 +42,7 @@ Gem::Specification.new do |spec|
42
42
  spec.add_development_dependency "bundler", "~> 2.0"
43
43
  spec.add_development_dependency "gem-release"
44
44
  spec.add_development_dependency "nokogiri", "~> 1.0"
45
- spec.add_development_dependency "rake", "~> 12.3.3"
45
+ spec.add_development_dependency "rake", "~> 13"
46
46
  spec.add_development_dependency "rspec", "~> 3.0"
47
47
  spec.add_development_dependency "rubocop", "0.75.0"
48
48
  spec.add_development_dependency "rubocop-rails"
data/lib/fontist/font.rb CHANGED
@@ -66,7 +66,7 @@ module Fontist
66
66
 
67
67
  private
68
68
 
69
- attr_reader :name, :confirmation
69
+ attr_reader :name
70
70
 
71
71
  def find_system_font
72
72
  paths = Fontist::SystemFont.find(name)
@@ -101,6 +101,10 @@ module Fontist
101
101
  @formula ||= Fontist::Formula.find(name)
102
102
  end
103
103
 
104
+ def formulas
105
+ @formulas ||= Fontist::Formula.find_many(name)
106
+ end
107
+
104
108
  def downloadable_font
105
109
  if formula
106
110
  raise Fontist::Errors::MissingFontError.new(name)
@@ -108,8 +112,10 @@ module Fontist
108
112
  end
109
113
 
110
114
  def download_font
111
- if formula
112
- check_and_confirm_required_license(formula)
115
+ return if formulas.empty?
116
+
117
+ formulas.flat_map do |formula|
118
+ confirmation = check_and_confirm_required_license(formula)
113
119
  paths = font_installer(formula).install(confirmation: confirmation)
114
120
 
115
121
  Fontist.ui.say("Fonts installed at:")
@@ -120,19 +126,17 @@ module Fontist
120
126
  end
121
127
 
122
128
  def check_and_confirm_required_license(formula)
123
- if formula.license_required
124
- show_license(formula.license) unless @hide_licenses
129
+ return @confirmation unless formula.license_required
125
130
 
126
- unless confirmation.casecmp?("yes")
127
- @confirmation = ask_for_agreement
131
+ show_license(formula.license) unless @hide_licenses
132
+ return @confirmation if @confirmation.casecmp?("yes")
128
133
 
129
- unless confirmation&.casecmp?("yes")
130
- raise Fontist::Errors::LicensingError.new(
131
- "Fontist will not download these fonts unless you accept the terms."
132
- )
133
- end
134
- end
135
- end
134
+ confirmation = ask_for_agreement
135
+ return confirmation if confirmation&.casecmp?("yes")
136
+
137
+ raise Fontist::Errors::LicensingError.new(
138
+ "Fontist will not download these fonts unless you accept the terms."
139
+ )
136
140
  end
137
141
 
138
142
  def show_license(license)
@@ -24,6 +24,10 @@ module Fontist
24
24
  Indexes::FontIndex.from_yaml.load_formulas(font_name).first
25
25
  end
26
26
 
27
+ def self.find_many(font_name)
28
+ Indexes::FontIndex.from_yaml.load_formulas(font_name)
29
+ end
30
+
27
31
  def self.find_fonts(font_name)
28
32
  formulas = Indexes::FontIndex.from_yaml.load_formulas(font_name)
29
33
 
@@ -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
@@ -21,6 +21,13 @@ module Fontist
21
21
  def rpm_class
22
22
  @rpm_class ||= begin
23
23
  require "arr-pm"
24
+
25
+ # fix for Ruby 3.0
26
+ unless RPM::File::Header::HEADER_MAGIC == [0x8eade801, 0x00000000].pack("NN")
27
+ RPM::File::Header.send(:remove_const, "HEADER_MAGIC")
28
+ RPM::File::Header.const_set("HEADER_MAGIC", [0x8eade801, 0x00000000].pack("NN"))
29
+ end
30
+
24
31
  RPM::File
25
32
  end
26
33
  end
@@ -1,3 +1,3 @@
1
1
  module Fontist
2
- VERSION = "1.8.6".freeze
2
+ VERSION = "1.8.7".freeze
3
3
  end
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.8.6
4
+ version: 1.8.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-05 00:00:00.000000000 Z
11
+ date: 2021-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: arr-pm
@@ -212,14 +212,14 @@ dependencies:
212
212
  requirements:
213
213
  - - "~>"
214
214
  - !ruby/object:Gem::Version
215
- version: 12.3.3
215
+ version: '13'
216
216
  type: :development
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
220
  - - "~>"
221
221
  - !ruby/object:Gem::Version
222
- version: 12.3.3
222
+ version: '13'
223
223
  - !ruby/object:Gem::Dependency
224
224
  name: rspec
225
225
  requirement: !ruby/object:Gem::Requirement