fontist 1.8.6 → 1.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/rspec.yml +4 -4
- data/fontist.gemspec +1 -1
- data/lib/fontist/font.rb +18 -14
- data/lib/fontist/formula.rb +4 -0
- data/lib/fontist/utils/downloader.rb +7 -4
- data/lib/fontist/utils/rpm_extractor.rb +7 -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: 69bc4225a7dac5b44f92364344568e4990ec3917631febbab1739a4980890308
         | 
| 4 | 
            +
              data.tar.gz: b1bd65c7db74152b911375a6990cda7dd23f849291feeb00edd3fddda5b93f4d
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 298d8927f07494407568e35fea9a3ed6fc26a725df7dcd9f4a6f3e134be628bc38bc315b0d61bac63c15c92501396b04c8e59dcad59429420785fdeaf9d4ac22
         | 
| 7 | 
            +
              data.tar.gz: 27f7bf0e155c8c3210030de3e5d1f140b4b0cee26214ca48c5cf34136eb09f8850f80178aa331b608c61583af003c8d7ca4ac071601e3fe8dbbebd25e6e15e9d
         | 
    
        data/.github/workflows/rspec.yml
    CHANGED
    
    | @@ -13,17 +13,17 @@ jobs: | |
| 13 13 | 
             
                strategy:
         | 
| 14 14 | 
             
                  fail-fast: false
         | 
| 15 15 | 
             
                  matrix:
         | 
| 16 | 
            -
                    ruby: [ '2. | 
| 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: ' | 
| 20 | 
            +
                      - ruby: '3.0'
         | 
| 21 21 | 
             
                        os: 'ubuntu-latest'
         | 
| 22 22 | 
             
                        experimental: true
         | 
| 23 | 
            -
                      - ruby: ' | 
| 23 | 
            +
                      - ruby: '3.0'
         | 
| 24 24 | 
             
                        os: 'windows-latest'
         | 
| 25 25 | 
             
                        experimental: true
         | 
| 26 | 
            -
                      - ruby: ' | 
| 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", "~>  | 
| 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 | 
| 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  | 
| 112 | 
            -
             | 
| 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 | 
            -
                   | 
| 124 | 
            -
                    show_license(formula.license) unless @hide_licenses
         | 
| 129 | 
            +
                  return @confirmation unless formula.license_required
         | 
| 125 130 |  | 
| 126 | 
            -
             | 
| 127 | 
            -
             | 
| 131 | 
            +
                  show_license(formula.license) unless @hide_licenses
         | 
| 132 | 
            +
                  return @confirmation if @confirmation.casecmp?("yes")
         | 
| 128 133 |  | 
| 129 | 
            -
             | 
| 130 | 
            -
             | 
| 131 | 
            -
             | 
| 132 | 
            -
             | 
| 133 | 
            -
             | 
| 134 | 
            -
             | 
| 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)
         | 
    
        data/lib/fontist/formula.rb
    CHANGED
    
    | @@ -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
         | 
    
        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.8. | 
| 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- | 
| 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:  | 
| 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:  | 
| 222 | 
            +
                    version: '13'
         | 
| 223 223 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 224 224 | 
             
              name: rspec
         | 
| 225 225 | 
             
              requirement: !ruby/object:Gem::Requirement
         |