#!/usr/bin/env ruby # Script to use TextMate to look at the headers for a named framework # Usage: # fw CarbonCore # or: # fw carboncore require 'find' $target = ARGV[0] #$out = $stdout $out = nil def search(path) if path =~ /(.*\.app|Classes|Commands|Libraries|Resources|Versions)$/ then $out && $out.puts("pruning #{path}") Find.prune end if path =~ /#{$target}.framework\/Headers/i command = "mate #{path}" $out && $out.puts(command) system(command) elsif File.symlink?(path) then real_path = File.readlink(path) if real_path[0] != ?/ then real_path = File.dirname(path) + '/' + real_path end $out && $out.puts("traversing symlink into #{real_path}") Find.find(real_path) do |path2| search(path2) end end $out && $out.puts("ignoring #{path}") end Find.find('/System/Library/Frameworks', '/Library/Frameworks') do |path| search(path) end