mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-15 19:56:59 +08:00

This is the newest version that works with Ruby 2.3. Also, update the `.gitignore` to hide it while we're here.
27 lines
570 B
Ruby
27 lines
570 B
Ruby
# frozen_string_literal: true
|
|
|
|
require "cli/parser"
|
|
|
|
module Homebrew
|
|
module_function
|
|
|
|
def prof_args
|
|
Homebrew::CLI::Parser.new do
|
|
usage_banner <<~EOS
|
|
`prof` <command>
|
|
|
|
Run Homebrew with the Ruby profiler, e.g. `brew prof readall`.
|
|
EOS
|
|
end
|
|
end
|
|
|
|
def prof
|
|
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
|
|
safe_system "ruby-prof", "--printer=multi", "--file=prof", brew_rb, "--", *ARGV
|
|
end
|
|
end
|