/Formula/ripgrep.rb

https://github.com/Homebrew/homebrew-core · Ruby · 42 lines · 39 code · 2 blank · 1 comment · 0 complexity · 47ff08414931f423210d66619ddf4b34 MD5 · raw file

  1. class Ripgrep < Formula
  2. desc "Search tool like grep and The Silver Searcher"
  3. homepage "https://github.com/BurntSushi/ripgrep"
  4. url "https://github.com/BurntSushi/ripgrep/archive/12.1.1.tar.gz"
  5. sha256 "2513338d61a5c12c8fea18a0387b3e0651079ef9b31f306050b1f0aaa926271e"
  6. license "Unlicense"
  7. head "https://github.com/BurntSushi/ripgrep.git"
  8. livecheck do
  9. url "https://github.com/BurntSushi/ripgrep/releases/latest"
  10. regex(%r{href=.*?/tag/v?(\d+(?:\.\d+)+)["' >]}i)
  11. end
  12. bottle do
  13. cellar :any
  14. sha256 "60460d422253113af3ed60332104f309638942821c655332211a6bc2213c472c" => :catalina
  15. sha256 "de4b18789f5d9bc4aaa4d906501200ae4ece7a1971dd1b86e2b2d0a2c8e0d764" => :mojave
  16. sha256 "cfea5335bf4eccfb7cd1d93bec234d96bd49dce8d593ea966687f777909ba291" => :high_sierra
  17. end
  18. depends_on "asciidoctor" => :build
  19. depends_on "pkg-config" => :build
  20. depends_on "rust" => :build
  21. depends_on "pcre2"
  22. def install
  23. system "cargo", "install", "--features", "pcre2", *std_cargo_args
  24. # Completion scripts and manpage are generated in the crate's build
  25. # directory, which includes a fingerprint hash. Try to locate it first
  26. out_dir = Dir["target/release/build/ripgrep-*/out"].first
  27. man1.install "#{out_dir}/rg.1"
  28. bash_completion.install "#{out_dir}/rg.bash"
  29. fish_completion.install "#{out_dir}/rg.fish"
  30. zsh_completion.install "complete/_rg"
  31. end
  32. test do
  33. (testpath/"Hello.txt").write("Hello World!")
  34. system "#{bin}/rg", "Hello World!", testpath
  35. end
  36. end