inspec/lib/resources/command.rb
Dominik Richter cb3e067a1f feature: helper method to check if a default command exists
Signed-off-by: Dominik Richter <dominik@vulcanosec.com>
2015-06-21 18:19:04 +02:00

11 lines
No EOL
306 B
Ruby

# Copyright (c) 2015 Vulcano Security GmbH. All rights reserved.
module Serverspec::Type
class Command < Base
# Check if a given command (executable) exists
# in the default path
def exists?
cmd = @name
Command.new("type \"#{cmd}\" > /dev/null").exit_status == 0
end
end
end