class Fontist::Font

Public Class Methods

all() click to toggle source
# File lib/fontist/font.rb, line 25
def self.all
  new.all
end
find(name) click to toggle source
# File lib/fontist/font.rb, line 29
def self.find(name)
  new(name: name).find
end
install(name, options = {}) click to toggle source
# File lib/fontist/font.rb, line 33
def self.install(name, options = {})
  new(options.merge(name: name)).install
end
list(name) click to toggle source
# File lib/fontist/font.rb, line 45
def self.list(name)
  new(name: name).list
end
new(options = {}) click to toggle source
# File lib/fontist/font.rb, line 9
def initialize(options = {})
  @name = options[:name]
  @confirmation = options[:confirmation] || "no"
  @hide_licenses = options[:hide_licenses]
  @no_progress = options[:no_progress] || false
  @force = options[:force] || false
  @version = options[:version]
  @smallest = options[:smallest]
  @newest = options[:newest]
  @size_limit = options[:size_limit]
  @by_formula = options[:formula]
  @update_fontconfig = options[:update_fontconfig]

  check_or_create_fontist_path!
end
status(name) click to toggle source
# File lib/fontist/font.rb, line 41
def self.status(name)
  new(name: name).status
end
uninstall(name) click to toggle source
# File lib/fontist/font.rb, line 37
def self.uninstall(name)
  new(name: name).uninstall
end

Public Instance Methods

all() click to toggle source
# File lib/fontist/font.rb, line 79
def all
  all_formulas.map(&:fonts).flatten
end
find() click to toggle source
# File lib/fontist/font.rb, line 49
def find
  find_system_font || downloadable_font || manual_font ||
    raise_non_supported_font
end
install() click to toggle source
# File lib/fontist/font.rb, line 54
def install
  return install_formula if @by_formula

  (find_system_font unless @force) || download_font || manual_font ||
    raise_non_supported_font
end
list() click to toggle source
# File lib/fontist/font.rb, line 73
def list
  return all_list unless @name

  font_list || raise_non_supported_font
end
status() click to toggle source
# File lib/fontist/font.rb, line 66
def status
  return installed_paths unless @name

  find_system_font || downloadable_font || manual_font ||
    raise_non_supported_font
end
uninstall() click to toggle source
# File lib/fontist/font.rb, line 61
def uninstall
  uninstall_font || downloadable_font || manual_font ||
    raise_non_supported_font
end