#!/usr/bin/env ruby # frozen_string_literal: true # Make sure we can access all the binaries the site needs - otherwise, it's gonna be a bad day. quiet = ARGV.include?('-q') BINARIES = { 'gifsicle' => '--version', 'jpegtran' => '-version', 'optipng' => '--version', 'safe-rsvg-convert' => nil, 'mediastat' => '-v', 'mediathumb' => '-v', 'ffmpeg' => '-version', 'convert' => '--version', 'identify' => '--version' }.freeze BINARIES.each do |bin, version_args| path = `bash -c "command -v #{bin}"`.strip if $? == 0 next if quiet version = if version_args `#{bin} #{version_args} 2>&1 | head -n1`.strip else 'unknown' end puts "[+] Found #{bin} OK: #{path} (#{version})" else puts "[-] Error: #{bin} doesn't seem to be installed or in PATH." exit 1 end end