class Opal::Util::Command
def command_installed?(cmd, install_comment)
def command_installed?(cmd, install_comment) command_installed = Command::INSTALLED[cmd.to_s] ||= which(cmd) $stderr.puts %Q("#{cmd}" command not found#{install_comment}) unless command_installed command_installed end
def hide_stderr
def hide_stderr if (/mswin|mingw/ =~ RUBY_PLATFORM).nil? '2> /dev/null' else '2> nul' end end
def initialize(command, options, message = nil)
def initialize(command, options, message = nil) @command, @options, @message = command, options, message return unless command_installed? command, message end
def which(cmd)
def which(cmd) exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : [''] ENV['PATH'].split(File::PATH_SEPARATOR).find do |path| exts.find { |ext| exe = File.join(path, "#{cmd}#{ext}") exe if File.executable? exe } end end