puremvc-gen/lib/pure_m_v_c_gen/ant_checker.rb
Greg Jastrab e4a82c56b4 Release quality functionality in place.
Command line parsing in place and complete for initial version.
Will look next into reading command name and constant as arguments instead of options.

Script determines whether ant is found on the path, and complains if it is not.

TODO: Fix log messages to be read in appropriately
2008-12-05 13:46:20 -05:00

34 lines
846 B
Ruby

module PureMVCGen
class AntChecker
# Determines if ANT is installed on the system
def self.has_ant_installed?
AntChecker.find_in_path("ant")
end
# Searches the path, looking for the given utility. If an executable
# file is found that matches the parameter, this returns true.
def self.find_in_path(utility)
path = (ENV['PATH'] || "").split(File::PATH_SEPARATOR)
suffixes = self.on_windows? ? self.windows_executable_extensions : [""]
path.each do |dir|
suffixes.each do |sfx|
file = File.join(dir, utility + sfx)
return true if File.executable?(file)
end
end
false
end
def self.on_windows?
RUBY_PLATFORM =~ /mswin|mingw/
end
def self.windows_executable_extensions
%w(.exe .bat .com .cmd)
end
end
end