module Ratch class Manager # Return master toolset directory. If toolset if given then # return that toolsets directory. def toolset_directory(toolset=nil) if toolset File.join(File.dirname(__FILE__), 'toolset', toolset) else File.join(File.dirname(__FILE__), 'toolset') end end # List toolsets. def toolsets files = [] Dir.chdir(toolset_directory) do files = Dir.glob('*/').map{ |d| d.chomp('/') } end files end # List tools for a give toolset. def tools(toolset=nil) files = [] direc = toolset ? File.join(toolset_directory, toolset) : toolset_directory Dir.chdir(direc) do files = Dir.glob('**/*') - Dir.glob('**/*/').map{ |d| d.chomp('/') } end files end # Verify a toolset exists? def toolset?(toolset) path = File.join(toolset_directory, toolset) File.exist?(path) ? path : false end # Verify a tool exists for a given toolset. def tool?(toolset, batchfile) path = File.join(toolset_directory, toolset, batchfile) File.exist?(path) ? path : false end end end