Module: Fontist

Defined in:
lib/fontist.rb,
lib/fontist/cli.rb,
lib/fontist/font.rb,
lib/fontist/repo.rb,
lib/fontist/index.rb,
lib/fontist/utils.rb,
lib/fontist/config.rb,
lib/fontist/errors.rb,
lib/fontist/import.rb,
lib/fontist/update.rb,
lib/fontist/extract.rb,
lib/fontist/formula.rb,
lib/fontist/helpers.rb,
lib/fontist/version.rb,
lib/fontist/manifest.rb,
lib/fontist/repo_cli.rb,
lib/fontist/utils/ui.rb,
lib/fontist/cache_cli.rb,
lib/fontist/font_file.rb,
lib/fontist/font_path.rb,
lib/fontist/config_cli.rb,
lib/fontist/font_model.rb,
lib/fontist/font_style.rb,
lib/fontist/fontconfig.rb,
lib/fontist/import_cli.rb,
lib/fontist/system_font.rb,
lib/fontist/utils/cache.rb,
lib/fontist/cli/thor_ext.rb,
lib/fontist/import/macos.rb,
lib/fontist/system_index.rb,
lib/fontist/utils/system.rb,
lib/fontist/import/google.rb,
lib/fontist/style_version.rb,
lib/fontist/utils/locking.rb,
lib/fontist/font_installer.rb,
lib/fontist/fontconfig_cli.rb,
lib/fontist/formula_picker.rb,
lib/fontist/collection_file.rb,
lib/fontist/font_collection.rb,
lib/fontist/import/otf_style.rb,
lib/fontist/manifest_request.rb,
lib/fontist/utils/downloader.rb,
lib/fontist/utils/file_magic.rb,
lib/fontist/cli/class_options.rb,
lib/fontist/import/font_style.rb,
lib/fontist/import/google/api.rb,
lib/fontist/import/otf_parser.rb,
lib/fontist/import/sil_import.rb,
lib/fontist/manifest_response.rb,
lib/fontist/formula_suggestion.rb,
lib/fontist/import/text_helper.rb,
lib/fontist/indexes/font_index.rb,
lib/fontist/indexes/index_mixin.rb,
lib/fontist/import/google_import.rb,
lib/fontist/import/otf/font_file.rb,
lib/fontist/import/create_formula.rb,
lib/fontist/import/formula_builder.rb,
lib/fontist/import/template_helper.rb,
lib/fontist/indexes/filename_index.rb,
lib/fontist/import/convert_formulas.rb,
lib/fontist/import/otfinfo_generate.rb,
lib/fontist/import/formula_serializer.rb,
lib/fontist/resources/google_resource.rb,
lib/fontist/import/files/font_detector.rb,
lib/fontist/import/helpers/hash_helper.rb,
lib/fontist/resources/archive_resource.rb,
lib/fontist/import/recursive_extraction.rb,
lib/fontist/indexes/formula_key_to_path.rb,
lib/fontist/import/files/collection_file.rb,
lib/fontist/import/helpers/system_helper.rb,
lib/fontist/import/files/file_requirement.rb,
lib/fontist/import/manual_formula_builder.rb,
lib/fontist/indexes/default_family_font_index.rb,
lib/fontist/import/otfinfo/otfinfo_requirement.rb,
lib/fontist/import/google/create_google_formula.rb,
lib/fontist/indexes/preferred_family_font_index.rb

Defined Under Namespace

Modules: Errors, Helpers, Import, Indexes, Resources, ThorExt, Utils Classes: CLI, CacheCLI, CollectionFile, Config, ConfigCLI, Extract, ExtractOptions, Font, FontCollection, FontFile, FontInstaller, FontModel, FontPath, FontStyle, Fontconfig, FontconfigCLI, Formula, FormulaCollection, FormulaPicker, FormulaSuggestion, ImportCLI, Index, IndexEntry, Info, Manifest, ManifestFont, ManifestRequest, ManifestRequestFont, ManifestResponse, ManifestResponseFont, ManifestResponseFontStyle, Repo, RepoCLI, Resource, ResourceCollection, StyleVersion, SystemFont, SystemIndex, SystemIndexFont, SystemIndexFontCollection, Update

Constant Summary collapse

VERSION =
"2.0.3".freeze

Class Method Summary collapse

Class Method Details

.configObject



125
126
127
# File 'lib/fontist.rb', line 125

def self.config
  Fontist::Config.instance.values
end

.config_pathObject



129
130
131
# File 'lib/fontist.rb', line 129

def self.config_path
  Fontist.fontist_path.join("config.yml")
end

.default_fontist_pathObject



25
26
27
# File 'lib/fontist.rb', line 25

def self.default_fontist_path
  Pathname.new(File.join(Dir.home, ".fontist"))
end

.downloads_pathObject



61
62
63
# File 'lib/fontist.rb', line 61

def self.downloads_path
  Fontist.fontist_path.join("downloads")
end

.excluded_fonts_pathObject



69
70
71
# File 'lib/fontist.rb', line 69

def self.excluded_fonts_path
  Fontist.lib_path.join("fontist", "exclude.yml")
end

.fontist_index_pathObject



81
82
83
# File 'lib/fontist.rb', line 81

def self.fontist_index_path
  Fontist.fontist_path.join("fontist_index.default_family.yml")
end

.fontist_pathObject



21
22
23
# File 'lib/fontist.rb', line 21

def self.fontist_path
  Pathname.new(ENV["FONTIST_PATH"] || default_fontist_path)
end

.fontist_preferred_family_index_pathObject



85
86
87
# File 'lib/fontist.rb', line 85

def self.fontist_preferred_family_index_path
  Fontist.fontist_path.join("fontist_index.preferred_family.yml")
end

.fontist_version_pathObject



37
38
39
# File 'lib/fontist.rb', line 37

def self.fontist_version_path
  Fontist.fontist_path.join("versions", formulas_version)
end

.fonts_pathObject



29
30
31
# File 'lib/fontist.rb', line 29

def self.fonts_path
  Pathname.new(config[:fonts_path])
end

.formula_filename_index_pathObject



97
98
99
# File 'lib/fontist.rb', line 97

def self.formula_filename_index_path
  Fontist.formula_index_dir.join("filename_index.yml")
end

.formula_index_dirObject



101
102
103
# File 'lib/fontist.rb', line 101

def self.formula_index_dir
  Fontist.fontist_version_path
end

.formula_index_pathObject



89
90
91
# File 'lib/fontist.rb', line 89

def self.formula_index_path
  Fontist.formula_index_dir.join("formula_index.default_family.yml")
end

.formula_preferred_family_index_pathObject



93
94
95
# File 'lib/fontist.rb', line 93

def self.formula_preferred_family_index_path
  Fontist.formula_index_dir.join("formula_index.preferred_family.yml")
end

.formula_size_limit_in_megabytesObject



105
106
107
# File 'lib/fontist.rb', line 105

def self.formula_size_limit_in_megabytes
  300
end

.formulas_pathObject



49
50
51
# File 'lib/fontist.rb', line 49

def self.formulas_path
  @formulas_path || Fontist.formulas_repo_path.join("Formulas")
end

.formulas_path=(path) ⇒ Object



53
54
55
# File 'lib/fontist.rb', line 53

def self.formulas_path=(path)
  @formulas_path = path
end

.formulas_repo_pathObject



33
34
35
# File 'lib/fontist.rb', line 33

def self.formulas_repo_path
  Fontist.fontist_version_path.join("formulas")
end

.formulas_repo_path_exists!Object



157
158
159
160
161
162
163
# File 'lib/fontist.rb', line 157

def self.formulas_repo_path_exists!
  return true if Dir.exist?(Fontist.formulas_repo_path)

  raise Errors::MainRepoNotFoundError.new(
    "Please fetch formulas with `fontist update`.",
  )
end

.formulas_repo_urlObject



45
46
47
# File 'lib/fontist.rb', line 45

def self.formulas_repo_url
  "https://github.com/fontist/formulas.git"
end

.formulas_versionObject



41
42
43
# File 'lib/fontist.rb', line 41

def self.formulas_version
  "v4"
end

.google_fonts_keyObject



153
154
155
# File 'lib/fontist.rb', line 153

def self.google_fonts_key
  ENV["GOOGLE_FONTS_API_KEY"] || config[:google_fonts_key]
end

.interactive=(bool) ⇒ Object



149
150
151
# File 'lib/fontist.rb', line 149

def self.interactive=(bool)
  @interactive = bool
end

.interactive?Boolean



145
146
147
# File 'lib/fontist.rb', line 145

def self.interactive?
  @interactive || false
end

.lib_pathObject



13
14
15
# File 'lib/fontist.rb', line 13

def self.lib_path
  Fontist.root_path.join("lib")
end

.log_level=(level) ⇒ Object



141
142
143
# File 'lib/fontist.rb', line 141

def self.log_level=(level)
  Fontist.ui.level = level
end

.open_timeoutObject



117
118
119
# File 'lib/fontist.rb', line 117

def self.open_timeout
  config[:open_timeout]
end

.preferred_family=(bool) ⇒ Object



113
114
115
# File 'lib/fontist.rb', line 113

def self.preferred_family=(bool)
  @preferred_family = bool
end

.preferred_family?Boolean



109
110
111
# File 'lib/fontist.rb', line 109

def self.preferred_family?
  !!@preferred_family
end

.private_formulas_pathObject



57
58
59
# File 'lib/fontist.rb', line 57

def self.private_formulas_path
  Fontist.formulas_path.join("private")
end

.read_timeoutObject



121
122
123
# File 'lib/fontist.rb', line 121

def self.read_timeout
  config[:read_timeout]
end

.root_pathObject



17
18
19
# File 'lib/fontist.rb', line 17

def self.root_path
  Pathname.new(File.dirname(__dir__))
end

.system_file_pathObject



65
66
67
# File 'lib/fontist.rb', line 65

def self.system_file_path
  Fontist.lib_path.join("fontist", "system.yml")
end

.system_index_pathObject



73
74
75
# File 'lib/fontist.rb', line 73

def self.system_index_path
  Fontist.fontist_path.join("system_index.default_family.yml")
end

.system_preferred_family_index_pathObject



77
78
79
# File 'lib/fontist.rb', line 77

def self.system_preferred_family_index_path
  Fontist.fontist_path.join("system_index.preferred_family.yml")
end

.uiObject



9
10
11
# File 'lib/fontist.rb', line 9

def self.ui
  Fontist::Utils::UI
end

.use_cache=(bool) ⇒ Object



137
138
139
# File 'lib/fontist.rb', line 137

def self.use_cache=(bool)
  @use_cache = bool
end

.use_cache?Boolean



133
134
135
# File 'lib/fontist.rb', line 133

def self.use_cache?
  instance_variable_defined?(:@use_cache) ? @use_cache : true
end