if ENV["_"] =~ /ruby\-prof/ if ARGV.empty? ARGV.concat Dir[File.join(File.dirname(__FILE__), 'spec/**/*_spec.rb')] end ARGV.each do |fi| next unless File.file? fi load fi end else puts <<-end_banner This script will use ruby-prof to run the specs. Usage: ruby-prof do_profile.rb end_banner end