fontist 0.3.0 → 1.2.1
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/macosx.yml +1 -1
- data/.github/workflows/ubuntu.yml +1 -1
- data/.gitignore +4 -2
- data/README.md +91 -5
- data/lib/fontist.rb +26 -12
- data/lib/fontist/errors.rb +3 -1
- data/lib/fontist/font.rb +78 -0
- data/lib/fontist/font_formula.rb +123 -0
- data/lib/fontist/formula.rb +90 -0
- data/lib/fontist/formulas.rb +10 -3
- data/lib/fontist/formulas/andale_font.rb +80 -0
- data/lib/fontist/formulas/arial_black_font.rb +79 -0
- data/lib/fontist/formulas/cleartype_fonts.rb +227 -0
- data/lib/fontist/formulas/comic_font.rb +78 -0
- data/lib/fontist/formulas/courier_font.rb +81 -0
- data/lib/fontist/formulas/euphemia_font.rb +85 -0
- data/lib/fontist/formulas/georgia_font.rb +80 -0
- data/lib/fontist/formulas/impact_font.rb +78 -0
- data/lib/fontist/formulas/montserrat_font.rb +132 -0
- data/lib/fontist/formulas/ms_truetype_fonts.rb +125 -0
- data/lib/fontist/formulas/open_sans_fonts.rb +263 -0
- data/lib/fontist/formulas/overpass_font.rb +73 -0
- data/lib/fontist/formulas/source_fonts.rb +109 -0
- data/lib/fontist/formulas/stix_fonts.rb +108 -0
- data/lib/fontist/formulas/tahoma_font.rb +147 -0
- data/lib/fontist/formulas/webding_font.rb +78 -0
- data/lib/fontist/registry.rb +42 -0
- data/lib/fontist/{data/source.yml → system.yml} +5 -6
- data/lib/fontist/system_font.rb +27 -11
- data/lib/fontist/utils.rb +9 -0
- data/lib/fontist/utils/downloader.rb +75 -0
- data/lib/fontist/utils/dsl.rb +77 -0
- data/lib/fontist/utils/exe_extractor.rb +72 -0
- data/lib/fontist/utils/zip_extractor.rb +38 -0
- data/lib/fontist/version.rb +1 -1
- data/spec/fontist/font_formula_spec.rb +67 -0
- data/spec/fontist/font_spec.rb +87 -0
- data/spec/fontist/formula_spec.rb +67 -0
- data/spec/fontist/formulas/andale_font_spec.rb +29 -0
- data/spec/fontist/formulas/arial_black_font_spec.rb +29 -0
- data/spec/fontist/formulas/cleartype_fonts_spec.rb +38 -0
- data/spec/fontist/formulas/comic_font_spec.rb +29 -0
- data/spec/fontist/formulas/courier_font_spec.rb +29 -0
- data/spec/fontist/formulas/euphemia_font_spec.rb +29 -0
- data/spec/fontist/formulas/georgia_font_spec.rb +29 -0
- data/spec/fontist/formulas/impact_font_spec.rb +29 -0
- data/spec/fontist/formulas/montserrat_font_spec.rb +29 -0
- data/spec/fontist/formulas/ms_truetype_fonts_spec.rb +29 -0
- data/spec/fontist/formulas/open_sans_fonts_spec.rb +29 -0
- data/spec/fontist/formulas/overpass_font_spec.rb +29 -0
- data/spec/fontist/formulas/source_fonts_spec.rb +31 -0
- data/spec/fontist/formulas/stix_fonts_spec.rb +29 -0
- data/spec/fontist/formulas/tahoma_font_spec.rb +29 -0
- data/spec/fontist/formulas/webding_font_spec.rb +29 -0
- data/spec/fontist/registry_spec.rb +47 -0
- data/spec/fontist/system_font_spec.rb +17 -1
- data/spec/fontist/{downloader_spec.rb → utils/downloader_spec.rb} +6 -5
- data/spec/spec_helper.rb +4 -2
- data/spec/support/fontist_helper.rb +4 -2
- metadata +50 -20
- data/lib/fontist/data/formulas/ms_vista.yml +0 -39
- data/lib/fontist/data/formulas/source_font.yml +0 -51
- data/lib/fontist/downloader.rb +0 -70
- data/lib/fontist/finder.rb +0 -47
- data/lib/fontist/formulas/base.rb +0 -25
- data/lib/fontist/formulas/ms_vista.rb +0 -74
- data/lib/fontist/formulas/source_font.rb +0 -48
- data/lib/fontist/installer.rb +0 -47
- data/lib/fontist/source.rb +0 -58
- data/spec/fontist/finder_spec.rb +0 -41
- data/spec/fontist/formulas/ms_vista_spec.rb +0 -27
- data/spec/fontist/formulas/source_font_spec.rb +0 -18
- data/spec/fontist/installer_spec.rb +0 -48
- data/spec/fontist/source_spec.rb +0 -24
@@ -1,27 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe Fontist::Formulas::MsVista do
|
4
|
-
describe ".fetch_font" do
|
5
|
-
context "with valid licence", file_download: true do
|
6
|
-
it "downloads and returns font paths" do
|
7
|
-
name = "CANDARAI.TTF"
|
8
|
-
fonts = Fontist::Formulas::MsVista.fetch_font(
|
9
|
-
name, confirmation: "yes", force_download: true
|
10
|
-
)
|
11
|
-
|
12
|
-
expect(fonts.count).to eq(1)
|
13
|
-
expect(fonts.first).to include("CANDARAI.TTF")
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
context "with invalid licence agreement" do
|
18
|
-
it "raise an licensing error" do
|
19
|
-
font_name = "CANDARAI.TTF"
|
20
|
-
|
21
|
-
expect {
|
22
|
-
Fontist::Formulas::MsVista.fetch_font(font_name, confirmation: "no")
|
23
|
-
}.to raise_error(Fontist::Errors::LicensingError)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe Fontist::Formulas::SourceFont do
|
4
|
-
describe ".fetch_font" do
|
5
|
-
it "downloads and extract out fonts", file_download: true do
|
6
|
-
name = "SourceCodePro"
|
7
|
-
stub_fontist_path_to_assets
|
8
|
-
|
9
|
-
fonts = Fontist::Formulas::SourceFont.fetch_font(
|
10
|
-
name, confirmation: "yes", force_download: true,
|
11
|
-
)
|
12
|
-
|
13
|
-
expect(fonts).not_to be_empty
|
14
|
-
expect(fonts.first).to include(name)
|
15
|
-
expect(Fontist::Finder.find(name)).not_to be_empty
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe Fontist::Installer do
|
4
|
-
describe ".download" do
|
5
|
-
context "with already downloaded fonts", skip_in_windows: true do
|
6
|
-
it "returns the font path" do
|
7
|
-
name = "CALIBRI.TTF"
|
8
|
-
Fontist::Formulas::MsVista.fetch_font(name, confirmation: "yes")
|
9
|
-
|
10
|
-
allow(Fontist::Formulas::MsVista).to receive(:fetch_font).and_return(nil)
|
11
|
-
paths = Fontist::Installer.download(name, confirmation: "yes")
|
12
|
-
|
13
|
-
expect(paths.first).to include("fonts/#{name}")
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
context "with missing but downloadable fonts" do
|
18
|
-
it "downloads and install the fonts", skip_in_windows: true do
|
19
|
-
name = "CALIBRI.TTF"
|
20
|
-
confirmation = "yes"
|
21
|
-
allow(Fontist::SystemFont).to receive(:find).and_return(nil)
|
22
|
-
|
23
|
-
paths = Fontist::Installer.download(name, confirmation: confirmation)
|
24
|
-
|
25
|
-
expect(paths.first).to include("fonts/#{name}")
|
26
|
-
end
|
27
|
-
|
28
|
-
it "do not download if user didn't agree" do
|
29
|
-
name = "CALIBRI.TTF"
|
30
|
-
allow(Fontist::SystemFont).to receive(:find).and_return(nil)
|
31
|
-
|
32
|
-
expect {
|
33
|
-
Fontist::Installer.download(name, confirmation: "no")
|
34
|
-
}.to raise_error(Fontist::Errors::LicensingError)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
context "with unsupported fonts" do
|
39
|
-
it "raise an unsupported error" do
|
40
|
-
name = "InvalidFont.ttf"
|
41
|
-
|
42
|
-
expect {
|
43
|
-
Fontist::Installer.download(name, confirmation: "yes")
|
44
|
-
}.to raise_error(Fontist::Errors::NonSupportedFontError)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
data/spec/fontist/source_spec.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe Fontist::Source do
|
4
|
-
describe ".all" do
|
5
|
-
it "returns all of the dataset" do
|
6
|
-
sources = Fontist::Source.all
|
7
|
-
|
8
|
-
expect(sources.system.linux.paths).not_to be_nil
|
9
|
-
expect(sources.system.macosx.paths).not_to be_nil
|
10
|
-
expect(sources.system.windows.paths).not_to be_nil
|
11
|
-
expect(sources.remote.formulas.first).to include("./formulas")
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
describe ".formulas" do
|
16
|
-
it "returns all available dataset" do
|
17
|
-
formulas = Fontist::Source.formulas
|
18
|
-
|
19
|
-
expect(formulas.msvista.license).not_to be_nil
|
20
|
-
expect(formulas.msvista.file_size).to eq("62914560")
|
21
|
-
expect(formulas.msvista.fonts).to include("CALIBRI.TTF")
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|