/Formula/ripgrep.rb

https://github.com/norbusan/homebrew-core · Ruby · 41 lines · 33 code · 6 blank · 2 comment · 0 complexity · 78187f695c547b42b6e377018e58ef49 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/11.0.1.tar.gz"
  5. sha256 "ba106404342160a66f703b8c9db9d45117c1a3664a0996822496bcb9f238b184"
  6. head "https://github.com/BurntSushi/ripgrep.git"
  7. bottle do
  8. cellar :any
  9. sha256 "db7aa040d1dace4cc4225493ca37802cf7c3769b26e3ed0d1cdd32780aeda252" => :mojave
  10. sha256 "d205bcd983c83ec1097523502d44598b844c3a13760e88449cd05b34e0ceba77" => :high_sierra
  11. sha256 "1212eb9d8a2a38bc54cbbb38cc92015c6572622324bdd049b3e016564a8571da" => :sierra
  12. end
  13. depends_on "asciidoc" => :build
  14. depends_on "docbook-xsl" => :build
  15. depends_on "pkg-config" => :build
  16. depends_on "rust" => :build
  17. depends_on "pcre2"
  18. def install
  19. ENV["XML_CATALOG_FILES"] = etc/"xml/catalog"
  20. system "cargo", "install", "--root", prefix,
  21. "--path", ".",
  22. "--features", "pcre2"
  23. # Completion scripts and manpage are generated in the crate's build
  24. # directory, which includes a fingerprint hash. Try to locate it first
  25. out_dir = Dir["target/release/build/ripgrep-*/out"].first
  26. man1.install "#{out_dir}/rg.1"
  27. bash_completion.install "#{out_dir}/rg.bash"
  28. fish_completion.install "#{out_dir}/rg.fish"
  29. zsh_completion.install "complete/_rg"
  30. end
  31. test do
  32. (testpath/"Hello.txt").write("Hello World!")
  33. system "#{bin}/rg", "Hello World!", testpath
  34. end
  35. end