class Fontist::CLI
Constants
- ERROR_TO_STATUS
- STATUS_FONTCONFIG_FILE_NOT_FOUND
- STATUS_FONTCONFIG_NOT_FOUND
- STATUS_FONTIST_VERSION_ERROR
- STATUS_FONT_INDEX_CORRUPTED
- STATUS_FORMULA_NOT_FOUND
- STATUS_INVALID_CONFIG_ATTRIBUTE
- STATUS_LICENSING_ERROR
- STATUS_MAIN_REPO_NOT_FOUND
- STATUS_MANIFEST_COULD_NOT_BE_FOUND_ERROR
- STATUS_MANIFEST_COULD_NOT_BE_READ_ERROR
- STATUS_MANUAL_FONT_ERROR
- STATUS_MISSING_FONT_ERROR
- STATUS_NON_SUPPORTED_FONT_ERROR
- STATUS_REPO_COULD_NOT_BE_UPDATED
- STATUS_REPO_NOT_FOUND
- STATUS_SIZE_LIMIT_ERROR
- STATUS_SUCCESS
- STATUS_UNKNOWN_ERROR
Public Class Methods
exit_on_failure?()
click to toggle source
# File lib/fontist/cli.rb, line 61 def self.exit_on_failure? false end
Public Instance Methods
create_formula(url)
click to toggle source
# File lib/fontist/cli.rb, line 181 def create_formula(url) handle_class_options(options) require "fontist/import/create_formula" name = Fontist::Import::CreateFormula.new(url, options).call Fontist.ui.say("#{name} formula has been successfully created") success end
install(font)
click to toggle source
# File lib/fontist/cli.rb, line 89 def install(font) handle_class_options(options) confirmation = options[:accept_all_licenses] ? "yes" : "no" Fontist::Font.install(font, options.merge(confirmation: confirmation)) success rescue Fontist::Errors::GeneralError => e handle_error(e) end
list(font = nil)
click to toggle source
# File lib/fontist/cli.rb, line 122 def list(font = nil) handle_class_options(options) formulas = Fontist::Font.list(font) print_list(formulas) success rescue Fontist::Errors::GeneralError => e handle_error(e) end
manifest_install(manifest)
click to toggle source
# File lib/fontist/cli.rb, line 160 def manifest_install(manifest) handle_class_options(options) paths = Fontist::Manifest::Install.from_file( manifest, confirmation: options[:accept_all_licenses] ? "yes" : "no", hide_licenses: options[:hide_licenses] ) print_yaml(paths) success rescue Fontist::Errors::GeneralError => e handle_error(e) end
manifest_locations(manifest)
click to toggle source
# File lib/fontist/cli.rb, line 144 def manifest_locations(manifest) handle_class_options(options) paths = Fontist::Manifest::Locations.from_file(manifest) print_yaml(paths) success rescue Fontist::Errors::GeneralError => e handle_error(e) end
rebuild_index()
click to toggle source
# File lib/fontist/cli.rb, line 196 def rebuild_index handle_class_options(options) Fontist::Index.rebuild Fontist.ui.say("Formula index has been rebuilt.") STATUS_SUCCESS end
status(font = nil)
click to toggle source
# File lib/fontist/cli.rb, line 111 def status(font = nil) handle_class_options(options) paths = Fontist::Font.status(font) return error("No font is installed.", STATUS_MISSING_FONT_ERROR) if paths.empty? success rescue Fontist::Errors::GeneralError => e handle_error(e) end
uninstall(font)
click to toggle source
# File lib/fontist/cli.rb, line 99 def uninstall(font) handle_class_options(options) fonts_paths = Fontist::Font.uninstall(font) Fontist.ui.success("These fonts are removed:") Fontist.ui.success(fonts_paths.join("\n")) success rescue Fontist::Errors::GeneralError => e handle_error(e) end
update()
click to toggle source
# File lib/fontist/cli.rb, line 132 def update handle_class_options(options) Formula.update_formulas_repo Fontist.ui.success("Formulas have been successfully updated.") success rescue Fontist::Errors::RepoCouldNotBeUpdatedError => e Fontist.ui.error(e.message) STATUS_REPO_COULD_NOT_BE_UPDATED end