fontist 1.7.3 → 1.8.5
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/release.yml +38 -0
- data/.github/workflows/rspec.yml +58 -0
- data/README.md +48 -4
- data/{bin → exe}/fontist +0 -0
- data/fontist.gemspec +10 -7
- data/lib/fontist.rb +9 -2
- data/lib/fontist/cli.rb +64 -55
- data/lib/fontist/errors.rb +63 -12
- data/lib/fontist/font.rb +33 -64
- data/lib/fontist/font_installer.rb +118 -0
- data/lib/fontist/font_path.rb +29 -0
- data/lib/fontist/fontist_font.rb +3 -49
- data/lib/fontist/formula.rb +101 -35
- data/lib/fontist/formula_paths.rb +43 -0
- data/lib/fontist/helpers.rb +7 -0
- data/lib/fontist/import/create_formula.rb +3 -2
- data/lib/fontist/import/extractors.rb +4 -0
- data/lib/fontist/import/extractors/cpio_extractor.rb +39 -0
- data/lib/fontist/import/extractors/gzip_extractor.rb +27 -0
- data/lib/fontist/import/extractors/rpm_extractor.rb +45 -0
- data/lib/fontist/import/extractors/tar_extractor.rb +47 -0
- data/lib/fontist/import/google/skiplist.yml +3 -0
- data/lib/fontist/import/google_check.rb +1 -1
- data/lib/fontist/import/google_import.rb +3 -4
- data/lib/fontist/import/otfinfo_generate.rb +1 -1
- data/lib/fontist/import/recursive_extraction.rb +26 -8
- data/lib/fontist/import/sil_import.rb +99 -0
- data/lib/fontist/index.rb +11 -0
- data/lib/fontist/indexes/base_index.rb +82 -0
- data/lib/fontist/indexes/filename_index.rb +19 -0
- data/lib/fontist/indexes/font_index.rb +21 -0
- data/lib/fontist/indexes/index_formula.rb +36 -0
- data/lib/fontist/manifest/install.rb +4 -5
- data/lib/fontist/manifest/locations.rb +9 -1
- data/lib/fontist/system_font.rb +32 -62
- data/lib/fontist/system_index.rb +47 -5
- data/lib/fontist/utils.rb +5 -0
- data/lib/fontist/utils/cache.rb +12 -4
- data/lib/fontist/utils/cpio/cpio.rb +199 -0
- data/lib/fontist/utils/cpio_extractor.rb +47 -0
- data/lib/fontist/utils/exe_extractor.rb +1 -1
- data/lib/fontist/utils/gzip_extractor.rb +24 -0
- data/lib/fontist/utils/locking.rb +17 -0
- data/lib/fontist/utils/rpm_extractor.rb +37 -0
- data/lib/fontist/utils/tar_extractor.rb +61 -0
- data/lib/fontist/utils/zip_extractor.rb +1 -1
- data/lib/fontist/version.rb +1 -1
- metadata +74 -26
- data/.github/workflows/macosx.yml +0 -33
- data/.github/workflows/ubuntu.yml +0 -30
- data/.github/workflows/windows.yml +0 -32
- data/bin/check_google +0 -8
- data/bin/console +0 -11
- data/bin/convert_formulas +0 -8
- data/bin/generate_otfinfo +0 -8
- data/bin/import_google +0 -8
- data/bin/rspec +0 -29
- data/bin/setup +0 -7
- data/lib/fontist/font_formula.rb +0 -169
- data/lib/fontist/formula_template.rb +0 -122
- data/lib/fontist/formulas.rb +0 -56
- data/lib/fontist/registry.rb +0 -43
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b392969d430a5af69c38a73069d5a98cf90a6ef1c246f8cca215a7cd4c1202c
|
4
|
+
data.tar.gz: 97ca59729bf50acefa0bfe5ab23b82050eed8fd6ba4782a6d814a77e44939b4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5911d154187149d2d8ebc81e776b7c4b12e0a8eddf4f2540f3914b41fd29c582a29287b5ed1d3d7cccbe696aeb40908f5039bf350c281e315ac08fffe76e110
|
7
|
+
data.tar.gz: 49a7e53eff6d6b750248141a608cb3e92c03c19130f75f4ff8806c7e55ca0d478cec376ed9eaa273dedff3e05b31057892c0c47367a48f1a3eadd5599ecaf968
|
@@ -0,0 +1,38 @@
|
|
1
|
+
name: release
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- 'v*'
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
release:
|
10
|
+
runs-on: ubuntu-18.04
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@v1
|
13
|
+
|
14
|
+
- uses: ruby/setup-ruby@v1
|
15
|
+
with:
|
16
|
+
ruby-version: '2.6'
|
17
|
+
|
18
|
+
- run: bundle config set path 'vendor/bundle'
|
19
|
+
|
20
|
+
- run: bundle install --jobs 4 --retry 3
|
21
|
+
|
22
|
+
- run: bundle exec rspec --tag ~dev
|
23
|
+
env:
|
24
|
+
TEST_ENV: CI
|
25
|
+
|
26
|
+
- name: Publish to rubygems.org
|
27
|
+
env:
|
28
|
+
RUBYGEMS_API_KEY: ${{secrets.FONTIST_CI_RUBYGEMS_API_KEY}}
|
29
|
+
run: |
|
30
|
+
gem install gem-release
|
31
|
+
touch ~/.gem/credentials
|
32
|
+
cat > ~/.gem/credentials << EOF
|
33
|
+
---
|
34
|
+
:rubygems_api_key: ${RUBYGEMS_API_KEY}
|
35
|
+
EOF
|
36
|
+
chmod 0600 ~/.gem/credentials
|
37
|
+
git status
|
38
|
+
gem release
|
@@ -0,0 +1,58 @@
|
|
1
|
+
name: rspec
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
build:
|
10
|
+
name: Test on Ruby ${{ matrix.ruby }} ${{ matrix.os }}
|
11
|
+
runs-on: ${{ matrix.os }}
|
12
|
+
continue-on-error: ${{ matrix.experimental }}
|
13
|
+
strategy:
|
14
|
+
fail-fast: false
|
15
|
+
matrix:
|
16
|
+
ruby: [ '2.6', '2.5', '2.4' ]
|
17
|
+
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
18
|
+
experimental: [ false ]
|
19
|
+
include:
|
20
|
+
- ruby: '2.7'
|
21
|
+
os: 'ubuntu-latest'
|
22
|
+
experimental: true
|
23
|
+
- ruby: '2.7'
|
24
|
+
os: 'windows-latest'
|
25
|
+
experimental: true
|
26
|
+
- ruby: '2.7'
|
27
|
+
os: 'macos-latest'
|
28
|
+
experimental: true
|
29
|
+
|
30
|
+
steps:
|
31
|
+
- uses: actions/checkout@master
|
32
|
+
|
33
|
+
- uses: ruby/setup-ruby@v1
|
34
|
+
with:
|
35
|
+
ruby-version: ${{ matrix.ruby }}
|
36
|
+
|
37
|
+
- uses: actions/cache@v1
|
38
|
+
with:
|
39
|
+
path: vendor/bundle
|
40
|
+
key: bundle-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}
|
41
|
+
restore-keys: bundle-${{ matrix.os }}-${{ matrix.ruby }}
|
42
|
+
|
43
|
+
- if: matrix.os == 'macos-latest'
|
44
|
+
run: brew install lcdf-typetools
|
45
|
+
|
46
|
+
- run: bundle config set path 'vendor/bundle'
|
47
|
+
|
48
|
+
- run: bundle install --jobs 4 --retry 3
|
49
|
+
|
50
|
+
- if: matrix.os == 'macos-latest'
|
51
|
+
run: bundle exec rspec
|
52
|
+
env:
|
53
|
+
TEST_ENV: CI
|
54
|
+
|
55
|
+
- if: matrix.os != 'macos-latest'
|
56
|
+
run: bundle exec rspec --tag ~dev
|
57
|
+
env:
|
58
|
+
TEST_ENV: CI
|
data/README.md
CHANGED
@@ -44,7 +44,7 @@ can we find a font in your system.
|
|
44
44
|
|
45
45
|
#### Finding a font
|
46
46
|
|
47
|
-
The `Fontist::
|
47
|
+
The `Fontist::Font.find` interface can be used a find a font in your system.
|
48
48
|
It will look into the operating system specific font directories, and also the
|
49
49
|
fontist specific `~/.fontist` directory.
|
50
50
|
|
@@ -249,7 +249,7 @@ Prints installed font paths grouped by formula and font.
|
|
249
249
|
|
250
250
|
```
|
251
251
|
$ fontist status "segoe ui"
|
252
|
-
|
252
|
+
segoe_ui
|
253
253
|
Segoe UI
|
254
254
|
Regular (/Users/user/.fontist/fonts/SEGOEUI.TTF)
|
255
255
|
Bold (/Users/user/.fontist/fonts/SEGOEUIB.TTF)
|
@@ -263,7 +263,7 @@ Lists installation status of fonts supported by Fontist.
|
|
263
263
|
|
264
264
|
```
|
265
265
|
$ fontist list "segoe ui"
|
266
|
-
|
266
|
+
segoe_ui
|
267
267
|
Segoe UI
|
268
268
|
Regular (installed)
|
269
269
|
Bold (installed)
|
@@ -273,7 +273,7 @@ Fontist::Formulas::SegoeUIFont
|
|
273
273
|
|
274
274
|
```
|
275
275
|
$ fontist list "roboto mono"
|
276
|
-
|
276
|
+
google/roboto_mono
|
277
277
|
Roboto Mono
|
278
278
|
Regular (uninstalled)
|
279
279
|
Italic (uninstalled)
|
@@ -395,8 +395,22 @@ archive:
|
|
395
395
|
```sh
|
396
396
|
fontist create-formula https://www.latofonts.com/download/lato2ofl-zip/
|
397
397
|
cp lato.yml ~/.fontist/formulas/Formulas/
|
398
|
+
```
|
399
|
+
|
400
|
+
A formula index should be rebuild, when a new formula is generated or an
|
401
|
+
existing one changed:
|
402
|
+
|
403
|
+
```sh
|
404
|
+
fontist rebuild-index
|
405
|
+
```
|
406
|
+
|
407
|
+
Then, both the formula and the updated index should be commited and pushed to
|
408
|
+
the formula repository:
|
409
|
+
|
410
|
+
```sh
|
398
411
|
cd ~/.fontist/formulas
|
399
412
|
git add Formulas/lato.yml
|
413
|
+
git add index.yml
|
400
414
|
git commit -m "Add Lato formula"
|
401
415
|
```
|
402
416
|
|
@@ -420,6 +434,36 @@ git commit -m "Google Fonts update"
|
|
420
434
|
git push
|
421
435
|
```
|
422
436
|
|
437
|
+
### Import of SIL fonts
|
438
|
+
|
439
|
+
Fontist contains formulas of [SIL fonts](https://software.sil.org/fonts/). They
|
440
|
+
can be updated with:
|
441
|
+
|
442
|
+
```sh
|
443
|
+
fontist import-sil
|
444
|
+
cd ~/.fontist/formulas
|
445
|
+
git add Formulas/sil
|
446
|
+
git add index.yml
|
447
|
+
git commit -m "SIL fonts update"
|
448
|
+
git push
|
449
|
+
```
|
450
|
+
|
451
|
+
### Releasing
|
452
|
+
|
453
|
+
Releasing is done automatically with GitHub Action. Just bump and tag with `gem-release`.
|
454
|
+
|
455
|
+
For a patch release (0.0.x) use:
|
456
|
+
|
457
|
+
```sh
|
458
|
+
gem bump --version patch --tag --push
|
459
|
+
```
|
460
|
+
|
461
|
+
For a minor release (0.x.0) use:
|
462
|
+
|
463
|
+
```sh
|
464
|
+
gem bump --version minor --tag --push
|
465
|
+
```
|
466
|
+
|
423
467
|
## Contributing
|
424
468
|
|
425
469
|
First, thank you for contributing! We love pull requests from everyone. By
|
data/{bin → exe}/fontist
RENAMED
File without changes
|
data/fontist.gemspec
CHANGED
@@ -5,15 +5,15 @@ require "fontist/version"
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "fontist"
|
7
7
|
spec.version = Fontist::VERSION
|
8
|
-
spec.authors = ["Ribose Inc."
|
9
|
-
spec.email = ["
|
8
|
+
spec.authors = ["Ribose Inc."]
|
9
|
+
spec.email = ["open.source@ribose.com"]
|
10
10
|
|
11
|
-
spec.summary = %q{
|
12
|
-
spec.description = %q{
|
11
|
+
spec.summary = %q{Install openly-licensed fonts on Windows, Linux and Mac!}
|
12
|
+
spec.description = %q{Install openly-licensed fonts on Windows, Linux and Mac!}
|
13
13
|
spec.homepage = "https://github.com/fontist/fontist"
|
14
14
|
spec.license = "BSD-2-Clause"
|
15
15
|
|
16
|
-
spec.post_install_message = "Please run `fontist update` to fetch formulas"
|
16
|
+
spec.post_install_message = "Please run `fontist update` to fetch formulas."
|
17
17
|
|
18
18
|
spec.metadata["homepage_uri"] = spec.homepage
|
19
19
|
spec.metadata["source_code_uri"] = "https://github.com/fontist/fontist"
|
@@ -21,12 +21,13 @@ Gem::Specification.new do |spec|
|
|
21
21
|
|
22
22
|
spec.require_paths = ["lib"]
|
23
23
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
24
|
-
f.match(%r{^(test|spec|features)/})
|
24
|
+
f.match(%r{^(bin|test|spec|features)/})
|
25
25
|
end
|
26
|
-
spec.bindir = "
|
26
|
+
spec.bindir = "exe"
|
27
27
|
spec.executables = ["fontist"]
|
28
28
|
spec.test_files = `git ls-files -- {spec}/*`.split("\n")
|
29
29
|
|
30
|
+
spec.add_runtime_dependency "arr-pm", "~> 0.0.1"
|
30
31
|
spec.add_runtime_dependency "down", "~> 5.0"
|
31
32
|
spec.add_runtime_dependency "libmspack", "~> 0.1.0"
|
32
33
|
spec.add_runtime_dependency "rubyzip", "~> 2.3.0"
|
@@ -39,6 +40,8 @@ Gem::Specification.new do |spec|
|
|
39
40
|
spec.add_development_dependency "extract_ttc", "~> 0.1"
|
40
41
|
spec.add_development_dependency "pry"
|
41
42
|
spec.add_development_dependency "bundler", "~> 2.0"
|
43
|
+
spec.add_development_dependency "gem-release"
|
44
|
+
spec.add_development_dependency "nokogiri", "~> 1.0"
|
42
45
|
spec.add_development_dependency "rake", "~> 12.3.3"
|
43
46
|
spec.add_development_dependency "rspec", "~> 3.0"
|
44
47
|
spec.add_development_dependency "rubocop", "0.75.0"
|
data/lib/fontist.rb
CHANGED
@@ -8,12 +8,11 @@ require "fontist/errors"
|
|
8
8
|
require "fontist/version"
|
9
9
|
|
10
10
|
require "fontist/font"
|
11
|
-
require "fontist/registry"
|
12
|
-
require "fontist/formulas"
|
13
11
|
require "fontist/formula"
|
14
12
|
require "fontist/system_font"
|
15
13
|
require "fontist/fontist_font"
|
16
14
|
require "fontist/manifest"
|
15
|
+
require "fontist/helpers"
|
17
16
|
|
18
17
|
module Fontist
|
19
18
|
def self.ui
|
@@ -59,4 +58,12 @@ module Fontist
|
|
59
58
|
def self.system_index_path
|
60
59
|
Fontist.fontist_path.join("system_index.yml")
|
61
60
|
end
|
61
|
+
|
62
|
+
def self.formula_index_path
|
63
|
+
Fontist.formulas_repo_path.join("index.yml")
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.formula_filename_index_path
|
67
|
+
Fontist.formulas_repo_path.join("filename_index.yml")
|
68
|
+
end
|
62
69
|
end
|
data/lib/fontist/cli.rb
CHANGED
@@ -3,7 +3,24 @@ require "thor"
|
|
3
3
|
module Fontist
|
4
4
|
class CLI < Thor
|
5
5
|
STATUS_SUCCESS = 0
|
6
|
-
|
6
|
+
STATUS_UNKNOWN_ERROR = 1
|
7
|
+
STATUS_NON_SUPPORTED_FONT_ERROR = 2
|
8
|
+
STATUS_MISSING_FONT_ERROR = 3
|
9
|
+
STATUS_LICENSING_ERROR = 4
|
10
|
+
STATUS_MANIFEST_COULD_NOT_BE_FOUND_ERROR = 5
|
11
|
+
STATUS_MANIFEST_COULD_NOT_BE_READ_ERROR = 6
|
12
|
+
STATUS_FONT_INDEX_CORRUPTED = 7
|
13
|
+
|
14
|
+
ERROR_TO_STATUS = {
|
15
|
+
Fontist::Errors::UnsupportedFontError => [STATUS_NON_SUPPORTED_FONT_ERROR],
|
16
|
+
Fontist::Errors::MissingFontError => [STATUS_MISSING_FONT_ERROR],
|
17
|
+
Fontist::Errors::LicensingError => [STATUS_LICENSING_ERROR],
|
18
|
+
Fontist::Errors::ManifestCouldNotBeFoundError => [STATUS_MANIFEST_COULD_NOT_BE_FOUND_ERROR,
|
19
|
+
"Manifest could not be found."],
|
20
|
+
Fontist::Errors::ManifestCouldNotBeReadError => [STATUS_MANIFEST_COULD_NOT_BE_READ_ERROR,
|
21
|
+
"Manifest could not be read."],
|
22
|
+
Fontist::Errors::FontIndexCorrupted => [STATUS_FONT_INDEX_CORRUPTED],
|
23
|
+
}.freeze
|
7
24
|
|
8
25
|
def self.exit_on_failure?
|
9
26
|
false
|
@@ -19,9 +36,9 @@ module Fontist
|
|
19
36
|
force: options[:force],
|
20
37
|
confirmation: options[:confirm_license] ? "yes" : "no"
|
21
38
|
)
|
22
|
-
|
23
|
-
rescue Fontist::Errors::
|
24
|
-
|
39
|
+
success
|
40
|
+
rescue Fontist::Errors::GeneralError => e
|
41
|
+
handle_error(e)
|
25
42
|
end
|
26
43
|
|
27
44
|
desc "uninstall/remove FONT", "Uninstall font by font or formula"
|
@@ -29,26 +46,20 @@ module Fontist
|
|
29
46
|
fonts_paths = Fontist::Font.uninstall(font)
|
30
47
|
Fontist.ui.success("These fonts are removed:")
|
31
48
|
Fontist.ui.success(fonts_paths.join("\n"))
|
32
|
-
|
33
|
-
rescue Fontist::Errors::
|
34
|
-
|
35
|
-
STATUS_ERROR
|
36
|
-
rescue Fontist::Errors::NonSupportedFontError
|
37
|
-
could_not_find_font(font)
|
49
|
+
success
|
50
|
+
rescue Fontist::Errors::GeneralError => e
|
51
|
+
handle_error(e)
|
38
52
|
end
|
39
53
|
map remove: :uninstall
|
40
54
|
|
41
|
-
desc "status [FONT]", "Show
|
55
|
+
desc "status [FONT]", "Show paths of FONT or all fonts"
|
42
56
|
def status(font = nil)
|
43
|
-
|
44
|
-
return error("No font is installed.") if
|
57
|
+
paths = Fontist::Font.status(font)
|
58
|
+
return error("No font is installed.", STATUS_MISSING_FONT_ERROR) if paths.empty?
|
45
59
|
|
46
|
-
print_formulas(formulas)
|
47
60
|
success
|
48
|
-
rescue Fontist::Errors::
|
49
|
-
|
50
|
-
rescue Fontist::Errors::NonSupportedFontError
|
51
|
-
could_not_find_font(font)
|
61
|
+
rescue Fontist::Errors::GeneralError => e
|
62
|
+
handle_error(e)
|
52
63
|
end
|
53
64
|
|
54
65
|
desc "list [FONT]", "List installation status of FONT or fonts in fontist"
|
@@ -56,15 +67,15 @@ module Fontist
|
|
56
67
|
formulas = Fontist::Font.list(font)
|
57
68
|
print_list(formulas)
|
58
69
|
success
|
59
|
-
rescue Fontist::Errors::
|
60
|
-
|
70
|
+
rescue Fontist::Errors::GeneralError => e
|
71
|
+
handle_error(e)
|
61
72
|
end
|
62
73
|
|
63
74
|
desc "update", "Update formulas"
|
64
75
|
def update
|
65
|
-
|
76
|
+
Formula.update_formulas_repo
|
66
77
|
Fontist.ui.say("Formulas have been successfully updated")
|
67
|
-
|
78
|
+
success
|
68
79
|
end
|
69
80
|
|
70
81
|
desc "manifest-locations MANIFEST",
|
@@ -73,10 +84,8 @@ module Fontist
|
|
73
84
|
paths = Fontist::Manifest::Locations.from_file(manifest)
|
74
85
|
print_yaml(paths)
|
75
86
|
success
|
76
|
-
rescue Fontist::Errors::
|
77
|
-
|
78
|
-
rescue Fontist::Errors::ManifestCouldNotBeReadError
|
79
|
-
error("Manifest could not be read.")
|
87
|
+
rescue Fontist::Errors::GeneralError => e
|
88
|
+
handle_error(e)
|
80
89
|
end
|
81
90
|
|
82
91
|
desc "manifest-install MANIFEST", "Install fonts from MANIFEST (yaml)"
|
@@ -89,66 +98,66 @@ module Fontist
|
|
89
98
|
|
90
99
|
print_yaml(paths)
|
91
100
|
success
|
92
|
-
rescue Fontist::Errors::
|
93
|
-
|
94
|
-
rescue Fontist::Errors::ManifestCouldNotBeReadError
|
95
|
-
error("Manifest could not be read.")
|
101
|
+
rescue Fontist::Errors::GeneralError => e
|
102
|
+
handle_error(e)
|
96
103
|
end
|
97
104
|
|
98
105
|
desc "create-formula URL", "Create a new formula with fonts from URL"
|
99
106
|
option :name, desc: "Example: Times New Roman"
|
100
107
|
option :mirror, repeatable: true
|
101
108
|
option :subarchive, desc: "Subarchive to choose when there are several ones"
|
102
|
-
option :subdir, desc: "Subdirectory to take fonts from"
|
109
|
+
option :subdir, desc: "Subdirectory to take fonts from, starting with the " \
|
110
|
+
"root dir, e.g.: stixfonts-2.10/fonts/static_otf. May include `fnmatch` patterns."
|
103
111
|
def create_formula(url)
|
104
112
|
require "fontist/import/create_formula"
|
105
113
|
name = Fontist::Import::CreateFormula.new(url, options).call
|
106
114
|
Fontist.ui.say("#{name} formula has been successfully created")
|
115
|
+
success
|
116
|
+
end
|
117
|
+
|
118
|
+
desc "rebuild-index", "Rebuild formula index (used by formulas maintainers)"
|
119
|
+
long_desc <<-LONGDESC
|
120
|
+
This index is pre-built and served with formulas, so there is no need
|
121
|
+
update it unless something changes in the formulas repo.
|
122
|
+
LONGDESC
|
123
|
+
def rebuild_index
|
124
|
+
Fontist::Index.rebuild
|
125
|
+
Fontist.ui.say("Formula index has been rebuilt.")
|
107
126
|
STATUS_SUCCESS
|
108
127
|
end
|
109
128
|
|
129
|
+
desc "import-sil", "Import formulas from SIL"
|
130
|
+
def import_sil
|
131
|
+
require "fontist/import/sil_import"
|
132
|
+
Fontist::Import::SilImport.new.call
|
133
|
+
end
|
134
|
+
|
110
135
|
private
|
111
136
|
|
112
137
|
def success
|
113
138
|
STATUS_SUCCESS
|
114
139
|
end
|
115
140
|
|
116
|
-
def
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
"You can update the formula repository using the command " \
|
122
|
-
"`fontist update` and try again.")
|
141
|
+
def handle_error(exception)
|
142
|
+
status, message = ERROR_TO_STATUS[exception.class]
|
143
|
+
raise exception unless status
|
144
|
+
|
145
|
+
error(message || exception.message, status)
|
123
146
|
end
|
124
147
|
|
125
|
-
def error(message)
|
148
|
+
def error(message, status)
|
126
149
|
Fontist.ui.error(message)
|
127
|
-
|
150
|
+
status
|
128
151
|
end
|
129
152
|
|
130
153
|
def print_yaml(object)
|
131
154
|
Fontist.ui.say(YAML.dump(object))
|
132
155
|
end
|
133
156
|
|
134
|
-
def print_formulas(formulas)
|
135
|
-
formulas.each do |formula, fonts|
|
136
|
-
Fontist.ui.success(formula.installer)
|
137
|
-
|
138
|
-
fonts.each do |font, styles|
|
139
|
-
Fontist.ui.success(" #{font.name}")
|
140
|
-
|
141
|
-
styles.each do |style, path|
|
142
|
-
Fontist.ui.success(" #{style.type} (#{path})")
|
143
|
-
end
|
144
|
-
end
|
145
|
-
end
|
146
|
-
end
|
147
|
-
|
148
157
|
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
149
158
|
def print_list(formulas)
|
150
159
|
formulas.each do |formula, fonts|
|
151
|
-
Fontist.ui.say(formula.
|
160
|
+
Fontist.ui.say(formula.key)
|
152
161
|
|
153
162
|
fonts.each do |font, styles|
|
154
163
|
Fontist.ui.say(" #{font.name}")
|