Sha256: 50fa822c56f6e498a00ddd5f2344a0ff344dbe1263f60f69f09fac5c0c6acfd0

Contents?: true

Size: 872 Bytes

Versions: 3

Compression:

Stored size: 872 Bytes

Contents

require_relative "common"

module Fontist
  module Manifest
    class Install < Common
      def initialize(manifest, confirmation: "no")
        @manifest = manifest
        @confirmation = confirmation
      end

      def self.call(manifest, confirmation: "no")
        new(manifest, confirmation: confirmation).call
      end

      private

      def file_paths(font, style)
        paths = find_installed_font(font, style)
        return paths unless paths.empty?

        install_font(font)
        find_installed_font(font, style)
      end

      def find_installed_font(font, style)
        Fontist::SystemFont.find_with_style(font, style)
      end

      def install_font(font)
        Fontist::Font.try_install(font, confirmation: @confirmation)
      rescue Fontist::Errors::LicensingError
        [] # try to install other fonts
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fontist-1.6.0 lib/fontist/manifest/install.rb
fontist-1.5.1 lib/fontist/manifest/install.rb
fontist-1.5.0 lib/fontist/manifest/install.rb