[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: script:
- crystal spec - crystal spec
- crystal tool format --check - crystal tool format --check
addons:
apt:
packages:
- pdftk

View File

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

View File

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