fontist 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fontist/errors.rb +1 -1
- data/lib/fontist/font_formula.rb +1 -1
- data/lib/fontist/formulas/andale_font.rb +1 -0
- data/lib/fontist/formulas/arial_black_font.rb +1 -0
- data/lib/fontist/formulas/cleartype_fonts.rb +1 -0
- data/lib/fontist/formulas/comic_font.rb +1 -0
- data/lib/fontist/formulas/courier_font.rb +1 -0
- data/lib/fontist/formulas/georgia_font.rb +1 -0
- data/lib/fontist/formulas/impact_font.rb +1 -0
- data/lib/fontist/formulas/ms_truetype_fonts.rb +1 -0
- data/lib/fontist/formulas/tahoma_font.rb +2 -1
- data/lib/fontist/formulas/webding_font.rb +1 -0
- data/lib/fontist/system.yml +4 -1
- data/lib/fontist/system_font.rb +11 -2
- data/lib/fontist/utils/downloader.rb +2 -1
- data/lib/fontist/version.rb +1 -1
- data/spec/fontist/system_font_spec.rb +1 -1
- data/spec/fontist/utils/downloader_spec.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbead3aabe1b99a416f96322c97681a9a693526c719d3fcf55658645ca6eb6ae
|
4
|
+
data.tar.gz: c45621c68c5b456104f2f6bc07b8af5dcba2f60a180ddb700bb6ad4373fee775
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e69aa36d462a3e554da1435f5194c12b9ad4103739d58ecc1bce0659d3fa730dcbedf1881c561535b2af2386038c42cff70535f62fc8c63ee4c1c86a7f429e67
|
7
|
+
data.tar.gz: f94bb6c098e06eca1efbd16fa79e2ea5ec525c05caddb1a043a7ba6e34a2d869c50125d1aa3af96f14b40bddbb95244ada63d5045126a7e621f9e2f9b634add3
|
data/lib/fontist/errors.rb
CHANGED
@@ -3,7 +3,7 @@ module Fontist
|
|
3
3
|
class LicensingError < StandardError; end
|
4
4
|
class MissingFontError < StandardError; end
|
5
5
|
class NonSupportedFontError < StandardError; end
|
6
|
-
class
|
6
|
+
class TamperedFileError < StandardError; end
|
7
7
|
class InvalidResourceError < StandardError; end
|
8
8
|
class TimeoutError < StandardError; end
|
9
9
|
end
|
data/lib/fontist/font_formula.rb
CHANGED
@@ -106,7 +106,7 @@ module Fontist
|
|
106
106
|
|
107
107
|
def download_file(source)
|
108
108
|
downloaded_file = Fontist::Utils::Downloader.download(
|
109
|
-
source[:urls].
|
109
|
+
source[:urls].first,
|
110
110
|
sha: source[:sha256],
|
111
111
|
file_size: source[:file_size],
|
112
112
|
progress_bar: is_progress_bar_enabled
|
@@ -7,6 +7,7 @@ module Fontist
|
|
7
7
|
|
8
8
|
resource "andale32.exe" do
|
9
9
|
urls [
|
10
|
+
"https://gitlab.com/fontmirror/archive/-/raw/master/andale32.exe",
|
10
11
|
"https://nchc.dl.sourceforge.net/project/corefonts/the%20fonts/final/andale32.exe",
|
11
12
|
"http://sft.if.usp.br/msttcorefonts/andale32.exe"
|
12
13
|
]
|
@@ -7,6 +7,7 @@ module Fontist
|
|
7
7
|
|
8
8
|
resource "arialb32.exe" do
|
9
9
|
urls [
|
10
|
+
"https://gitlab.com/fontmirror/archive/-/raw/master/arialb32.exe",
|
10
11
|
"https://nchc.dl.sourceforge.net/project/corefonts/the%20fonts/final/arialb32.exe",
|
11
12
|
"http://sft.if.usp.br/msttcorefonts/arialb32.exe"
|
12
13
|
]
|
@@ -8,6 +8,7 @@ module Fontist
|
|
8
8
|
display_progress_bar(true)
|
9
9
|
resource "PowerPointViewer.exe" do
|
10
10
|
urls [
|
11
|
+
"https://gitlab.com/fontmirror/archive/-/raw/master/PowerPointViewer.exe",
|
11
12
|
"https://nchc.dl.sourceforge.net/project/mscorefonts2/cabs/PowerPointViewer.exe",
|
12
13
|
"https://sourceforge.net/projects/mscorefonts2/files/cabs/PowerPointViewer.exe/download",
|
13
14
|
"https://web.archive.org/web/20171225132744/http://download.microsoft.com/download/E/6/7/E675FFFC-2A6D-4AB0-B3EB-27C9F8C8F696/PowerPointViewer.exe",
|
@@ -6,6 +6,7 @@ module Fontist
|
|
6
6
|
|
7
7
|
resource "courie32.exe" do
|
8
8
|
urls [
|
9
|
+
"https://gitlab.com/fontmirror/archive/-/raw/master/courie32.exe",
|
9
10
|
"https://nchc.dl.sourceforge.net/project/corefonts/the%20fonts/final/courie32.exe",
|
10
11
|
"http://sft.if.usp.br/msttcorefonts/courie32.exe"
|
11
12
|
]
|
@@ -6,6 +6,7 @@ module Fontist
|
|
6
6
|
|
7
7
|
resource "georgi32.exe" do
|
8
8
|
urls [
|
9
|
+
"https://gitlab.com/fontmirror/archive/-/raw/master/georgi32.exe",
|
9
10
|
"https://nchc.dl.sourceforge.net/project/corefonts/the%20fonts/final/georgi32.exe",
|
10
11
|
"http://sft.if.usp.br/msttcorefonts/georgi32.exe"
|
11
12
|
]
|
@@ -6,6 +6,7 @@ module Fontist
|
|
6
6
|
|
7
7
|
resource "impact32.exe" do
|
8
8
|
urls [
|
9
|
+
"https://gitlab.com/fontmirror/archive/-/raw/master/impact32.exe",
|
9
10
|
"https://nchc.dl.sourceforge.net/project/corefonts/the%20fonts/final/impact32.exe",
|
10
11
|
"http://sft.if.usp.br/msttcorefonts/impact32.exe"
|
11
12
|
]
|
@@ -6,6 +6,7 @@ module Fontist
|
|
6
6
|
|
7
7
|
resource "EUupdate.EXE" do
|
8
8
|
urls [
|
9
|
+
"https://gitlab.com/fontmirror/archive/-/raw/master/EUupdate.EXE",
|
9
10
|
"https://download.microsoft.com/download/a/1/8/a180e21e-9c2b-4b54-9c32-bf7fd7429970/EUupdate.EXE",
|
10
11
|
]
|
11
12
|
sha256 "464dd2cd5f09f489f9ac86ea7790b7b8548fc4e46d9f889b68d2cdce47e09ea8"
|
@@ -6,6 +6,7 @@ module Fontist
|
|
6
6
|
|
7
7
|
resource "IELPKTH.CAB" do
|
8
8
|
urls [
|
9
|
+
"https://gitlab.com/fontmirror/archive/-/raw/master/IELPKTH.CAB",
|
9
10
|
"https://master.dl.sourceforge.net/project/corefonts/OldFiles/IELPKTH.CAB"
|
10
11
|
]
|
11
12
|
|
@@ -141,6 +142,6 @@ module Fontist
|
|
141
142
|
serving your country, or write: Microsoft Sales Information Center/One
|
142
143
|
Microsoft Way/Redmond, WA 98052-6399.
|
143
144
|
EOS
|
144
|
-
end
|
145
|
+
end
|
145
146
|
end
|
146
147
|
end
|
@@ -6,6 +6,7 @@ module Fontist
|
|
6
6
|
|
7
7
|
resource "webdin32.exe" do
|
8
8
|
urls [
|
9
|
+
"https://gitlab.com/fontmirror/archive/-/raw/master/webdin32.exe",
|
9
10
|
"https://nchc.dl.sourceforge.net/project/corefonts/the%20fonts/final/webdin32.exe",
|
10
11
|
"http://sft.if.usp.br/msttcorefonts/webdin32.exe"
|
11
12
|
]
|
data/lib/fontist/system.yml
CHANGED
@@ -6,10 +6,13 @@ system:
|
|
6
6
|
windows:
|
7
7
|
paths:
|
8
8
|
- C:/Windows/Fonts/**/**.{ttc,ttf}
|
9
|
+
- C:/Users/{username}/AppData/Local/Microsoft/Windows/Fonts/**/**.{ttc,ttf}
|
9
10
|
|
10
|
-
|
11
|
+
macos:
|
11
12
|
paths:
|
13
|
+
- /Library/Fonts/**/**.{ttf,ttc}
|
12
14
|
- /System/Library/Fonts/**/**.{ttf,ttc}
|
15
|
+
- /Users/{username}/Library/Fonts/**.{ttf,ttc}
|
13
16
|
- /Applications/Microsoft**/Contents/Resources/**/**.{ttf,ttc}
|
14
17
|
|
15
18
|
unix:
|
data/lib/fontist/system_font.rb
CHANGED
@@ -20,10 +20,19 @@ module Fontist
|
|
20
20
|
|
21
21
|
attr_reader :font, :user_sources
|
22
22
|
|
23
|
+
def normalize_default_paths
|
24
|
+
@normalize_default_paths ||= default_sources["paths"].map do |path|
|
25
|
+
require "etc"
|
26
|
+
passwd = Etc.getpwuid
|
27
|
+
|
28
|
+
passwd ? path.gsub("{username}", passwd.name) : path
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
23
32
|
def font_paths
|
24
33
|
Dir.glob((
|
25
34
|
user_sources +
|
26
|
-
|
35
|
+
normalize_default_paths +
|
27
36
|
[fontist_fonts_path.join("**")]
|
28
37
|
).flatten.uniq)
|
29
38
|
end
|
@@ -45,7 +54,7 @@ module Fontist
|
|
45
54
|
when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
|
46
55
|
:windows
|
47
56
|
when /darwin|mac os/
|
48
|
-
:
|
57
|
+
:macos
|
49
58
|
when /linux/
|
50
59
|
:linux
|
51
60
|
when /solaris|bsd/
|
@@ -2,6 +2,7 @@ module Fontist
|
|
2
2
|
module Utils
|
3
3
|
class Downloader
|
4
4
|
def initialize(file, file_size: nil, sha: nil, progress_bar: nil)
|
5
|
+
# TODO: If the first mirror fails, try the second one
|
5
6
|
@file = file
|
6
7
|
@progress_bar = progress_bar
|
7
8
|
@sha = [sha].flatten.compact
|
@@ -12,7 +13,7 @@ module Fontist
|
|
12
13
|
file = download_file
|
13
14
|
|
14
15
|
if !sha.empty? && !sha.include?(Digest::SHA256.file(file).to_s)
|
15
|
-
raise(Fontist::Errors::
|
16
|
+
raise(Fontist::Errors::TamperedFileError.new(
|
16
17
|
"The downloaded file from #{@file} doesn't " \
|
17
18
|
"match with the expected sha256 checksum!"
|
18
19
|
))
|
data/lib/fontist/version.rb
CHANGED
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
RSpec.describe Fontist::SystemFont do
|
4
4
|
describe ".find" do
|
5
|
-
context "with a
|
5
|
+
context "with a valid existing font" do
|
6
6
|
it "returns the complete font path" do
|
7
7
|
name = "DejaVuSerif.ttf"
|
8
8
|
dejavu_ttf = Fontist::SystemFont.find(name, sources: [font_sources])
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fontist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-08-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: down
|
@@ -209,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
209
209
|
- !ruby/object:Gem::Version
|
210
210
|
version: '0'
|
211
211
|
requirements: []
|
212
|
-
rubygems_version: 3.0.
|
212
|
+
rubygems_version: 3.0.3
|
213
213
|
signing_key:
|
214
214
|
specification_version: 4
|
215
215
|
summary: A libarary find or download fonts
|