homebrew-core/Formula/rbspy.rb

46 lines
1.9 KiB
Ruby

class Rbspy < Formula
desc "Sampling profiler for Ruby"
homepage "https://rbspy.github.io/"
url "https://github.com/rbspy/rbspy/archive/v0.5.0.tar.gz"
sha256 "fc2bcca0d609f7deb4800d90bd1366903f3a2927401e953c5cf22b6ecac29ca1"
license "MIT"
bottle do
sha256 cellar: :any_skip_relocation, arm64_big_sur: "b46417313a5d4b1fac4d0c8cae3c144db38f3bb0deb3b1c3d49e173c21735217"
sha256 cellar: :any_skip_relocation, big_sur: "80d45a6614756be71a3a8eedc97559044388eb1961e803f41be504ffdea5c560"
sha256 cellar: :any_skip_relocation, catalina: "50e98da62be43526b001cf94695c148b1e4c46a1817bd0efe8c7073ecf89cf39"
sha256 cellar: :any_skip_relocation, mojave: "a9569469c7b7ee709f3c45f017762276a6f907705c06adf3f9c7609e56ba325e"
end
depends_on "rust" => :build
def install
system "cargo", "install", *std_cargo_args
end
test do
recording = <<~EOS
H4sICDJNbmAAA3JlcG9ydAC9ks1OwzAQhO88RbUnkKzGqfPTRIi34FRV1to11MKxLdtphaq8O
w5QVEEPnHrd2ZlPu5ogon+nq7sTRBy8UTxgUtCXlBIIs8YPKkTtLPRAl9WSAYGYMCSe9JAXs0
/JyKO2UnHlndxnc1O2bcfWrCJg0bpfct2UrOsopdOUsSmgzDmbU16dAyEapfxiIxcvo5Upk7c
ZGZTBpA+Ke0w5Au5H+2bd0T5kDUV0ZkxnzY7GEDDaKuugpxP5SUbEK1Hfd/vgXgMOyyD+RkLx
HPMXChHUsfj8SnHNdWayC6YQ4ibM9oIppbwJsywvoI8Davt0Gy6btgS83uWzq1XTEkj7oHDH5
0lVreuqrlmTC/yPitZXK1rSlrbNV0U/ACePNHUiAwAA
EOS
(testpath/"recording.gz").write Base64.decode64(recording.delete("\n"))
system "#{bin}/rbspy", "report", "-f", "summary", "-i", "recording.gz",
"-o", "result"
expected_result = <<~EOS
% self % total name
100.00 100.00 sleep [c function] - (unknown)
0.00 100.00 ccc - sample_program.rb
0.00 100.00 bbb - sample_program.rb
0.00 100.00 aaa - sample_program.rb
0.00 100.00 <main> - sample_program.rb
EOS
assert_equal File.read("result"), expected_result
end
end