[ci] Fixes CI Build

This commit is contained in:
Nemo 2020-04-01 02:04:15 +05:30
parent f4cf8ce97c
commit 18a051e20f
3 changed files with 10 additions and 6 deletions

View File

@ -3,3 +3,8 @@ language: crystal
script:
- crystal spec
- crystal tool format --check
addons:
apt:
packages:
- pdftk

View File

@ -3,8 +3,6 @@ require "./spec_helper"
describe Muse::Dl::Pdftk do
it "should find pdftk binary" do
pdftk = Muse::Dl::Pdftk.new
if pdftk.binary
pdftk.binary.should eq "/usr/sbin/pdftk"
end
pdftk.ready?.should eq true
end
end

View File

@ -7,14 +7,15 @@ require "dir"
module Muse::Dl
class Pdftk
PDFTK_BINARY_NAME = "pdftk"
@binary = "/usr/sbin/pdftk"
@binary : String | Nil
@tmp_file_path : String
getter :binary
def ready?
@binary != nil
end
def initialize(tmp_file_path : String = Dir.tempdir)
@tmp_file_path = tmp_file_path
possible_binary = Process.find_executable(Pdftk::PDFTK_BINARY_NAME)
if possible_binary
@binary = possible_binary