[TxMt] Ruby require_cmd equivalent.

Simon Gregory simon at helvector.org
Wed Oct 31 18:49:51 UTC 2007


Hello,

I'm working on a new Ant bundle (It's in the reviews section of the  
TM repository) and one of the commands invokes ant via ruby.  
Currently I'm warning users that ant is missing/not found using:

ant_version = `ant -version`
if ant_version.nil? | ant_version.empty?
	puts "<h1>Error</h1>Ant was not found, please ensure that it has  
been installed and your $PATH is set correctly."
	exit
end

but this isn't quite as elegant as the TM shell script require_cmd  
(ruby prints the cmd not found error, and it takes a fraction longer  
for ant to start up). Is there an equivalent I should be using with  
ruby? If not is there a better way this could be achieved.

Thanks,
Simon




More information about the textmate mailing list