lib/fontist/utils/exe_extractor.rb in fontist-1.6.0 vs lib/fontist/utils/exe_extractor.rb in fontist-1.7.0
- old
+ new
@@ -6,11 +6,11 @@
exe_file = download_file(exe_file).path if download
Fontist.ui.say(%(Installing font "#{key}".))
cab_file = decompressor.search(exe_file)
- cabbed_fonts = grep_fonts(cab_file.files, font_ext) || []
+ cabbed_fonts = grep_fonts(cab_file.files) || []
fonts_paths = extract_cabbed_fonts_to_assets(cabbed_fonts)
block_given? ? yield(fonts_paths) : fonts_paths
end
@@ -27,22 +27,23 @@
require "libmspack"
LibMsPack::CabDecompressor.new
)
end
- def grep_fonts(file, font_ext)
+ def grep_fonts(file)
Array.new.tap do |fonts|
while file
- fonts.push(file) if file.filename.match(font_ext)
+ fonts.push(file) if font_file?(file.filename)
file = file.next
end
end
end
def extract_cabbed_fonts_to_assets(cabbed_fonts)
Array.new.tap do |fonts|
cabbed_fonts.each do |font|
- font_path = fonts_path.join(font.filename).to_s
+ target_filename = target_filename(font.filename)
+ font_path = fonts_path.join(target_filename).to_s
decompressor.extract(font, font_path)
fonts.push(font_path)
end
end