lib/ebook_renamer/helpers.rb in ebook_renamer-0.0.3 vs lib/ebook_renamer/helpers.rb in ebook_renamer-0.0.4
- old
+ new
@@ -13,15 +13,12 @@
#
# @param [String] filename the input file name
# @param [String] binary the executable for use to extract the metadata
# @return [String] result of the output from running the command
def meta(filename, binary = 'ebook-meta')
- binary_path = which(binary)
-
- raise EbookMetaNotInstall, "Need to install ebook-meta to use this gem" if binary_path.nil?
-
+ raise EbookMetaNotInstall, "Need to install ebook-meta to use this gem" if which(binary).nil?
command = [
- binary_path,
+ binary,
Shellwords.escape(filename)
]
stdout_str, stderr_str, status = Open3.capture3(command.join(" "))
raise "Problem processing #{filename}" unless status.success?