Skip to content

Commit

Permalink
Implement dynamic which/where for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jtanx committed Sep 9, 2017
1 parent 22d6345 commit f9927e4
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions lib/fontcustom/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ def initialize(raw_options)
@manifest = Fontcustom::Manifest.new(manifest, @options)
end

def which
if !Gem.win_platform?
"which"
else # on windows
"where"
end
end

def compile
current = checksum
previous = @manifest.get(:checksum)[:previous]
Expand All @@ -31,18 +39,14 @@ def compile
private

def check_fontforge
if !Gem.win_platform?
fontforge = `which fontforge`
else
fontforge = `where fontforge`
end
fontforge = `#{which} fontforge`
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`
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
Expand Down

0 comments on commit f9927e4

Please sign in to comment.