lib/fontcustom/base.rb in fontcustom-1.3.8 vs lib/fontcustom/base.rb in fontcustom-2.0.0
- old
+ new
@@ -4,11 +4,12 @@
class Base
include Utility
def initialize(raw_options)
check_fontforge
- manifest = ".fontcustom-manifest.json"
+ check_woff2
+ manifest = '.fontcustom-manifest.json'
raw_options[:manifest] = manifest
@options = Fontcustom::Options.new(raw_options).options
@manifest = Fontcustom::Manifest.new(manifest, @options)
end
@@ -28,12 +29,23 @@
end
private
def check_fontforge
- fontforge = `which fontforge`
+ if !Gem.win_platform?
+ fontforge = `which fontforge`
+ else
+ fontforge = `where fontforge`
+ end
if fontforge == "" || fontforge == "fontforge not found"
raise Fontcustom::Error, "Please install fontforge first. Visit <http://fontcustom.com> for instructions."
+ end
+ end
+
+ def check_woff2
+ woff2 = `which woff2_compress`
+ if woff2 == "" || woff2 == "woff2_compress not found"
+ fail Fontcustom::Error, "Please install woff2 first. Visit <https://github.com/google/woff2> for instructions."
end
end
# Calculates a hash of vectors, options, and templates (content and filenames)
def checksum