Skip to content

Commit

Permalink
Merge branch 'TrevorBramble-bugfix-epubcheck-detection'
Browse files Browse the repository at this point in the history
  • Loading branch information
mhartl committed Aug 14, 2014
2 parents 590c9ef + 18713e8 commit d4f8d3e
Showing 1 changed file with 15 additions and 20 deletions.
35 changes: 15 additions & 20 deletions lib/softcover/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -237,37 +237,32 @@ def commands(lines)
def dependency_filename(label)
case label
when :latex
`which xelatex`.chomp
filename(:xelatex)
when :ghostscript
`which gs`.chomp
filename(:gs)
when :convert
`which convert`.chomp
when :node
`which node`.chomp
when :phantomjs
`which phantomjs`.chomp
when :kindlegen
`which kindlegen`.chomp
when :java
`which java`.chomp
when :zip
`which zip`.chomp
when :calibre
`which ebook-convert`.chomp
when :epubcheck
File.join(Dir.home, 'bin', 'epubcheck-3.0', 'epubcheck-3.0.jar')
default = File.join(Dir.home, 'bin', 'epubcheck-3.0', 'epubcheck-3.0.jar')
filename_or_default(:epubcheck, default)
when :inkscape
filename = `which inkscape`.chomp
if filename.empty?
filename = '/Applications/Inkscape.app/Contents/Resources/bin/' +
'inkscape'
end
filename
default = '/Applications/Inkscape.app/Contents/Resources/bin/inkscape'
filename_or_default(:inkscape, default)
else
raise "Unknown label #{label}"
filename(label)
end
end

def filename(name)
`which #{name}`.chomp
end

def filename_or_default(name, default)
(f = filename(name)).empty? ? default : f
end

# Returns the language labels from the config file.
def language_labels
YAML.load_file(File.join(Softcover::Directories::CONFIG, 'lang.yml'))
Expand Down

0 comments on commit d4f8d3e

Please sign in to comment.