27 lines
585 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2019-04-17 18:25:08 +09:00
require "cli/parser"
module Homebrew
module_function
def prof_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
2020-08-03 02:07:06 +01:00
`prof` [<command>]
2019-08-06 14:22:24 -04:00
Run Homebrew with the Ruby profiler, e.g. `brew prof readall`.
EOS
end
end
def prof
2020-08-03 02:07:06 +01:00
args = prof_args.parse
Homebrew.install_gem_setup_path! "ruby-prof", version: "0.18.0"
FileUtils.mkdir_p "prof"
brew_rb = (HOMEBREW_LIBRARY_PATH/"brew.rb").resolved_path
2020-08-03 02:07:06 +01:00
safe_system "ruby-prof", "--printer=multi", "--file=prof", brew_rb, "--", *args.named
end
end