/Formula/ripgrep.rb

https://github.com/norbusan/linuxbrew-core · Ruby · 43 lines · 34 code · 6 blank · 3 comment · 0 complexity · 05450403dce84fe5548ba69233019456 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.2.tar.gz"
  5. sha256 "0983861279936ada8bc7a6d5d663d590ad34eb44a44c75c2d6ccd0ab33490055"
  6. head "https://github.com/BurntSushi/ripgrep.git"
  7. bottle do
  8. cellar :any_skip_relocation
  9. sha256 "8a9673593698833a3e79407423c549499c2096c206f2309baf3a6a1fa58bc83c" => :mojave
  10. sha256 "e0f43c540165eb7c181328c9e18a28f9fb65ca6e178a2d898915760c212bfcd6" => :high_sierra
  11. sha256 "3bb6e27a3adaf94129c18491a552899a354ce36846ec2a849ca5ad40e848ad62" => :sierra
  12. sha256 "b10c96f7970155a3d4819e7f8d6bd77fb83a49f468744092cd731208e23a5ae8" => :x86_64_linux
  13. end
  14. depends_on "asciidoc" => :build
  15. depends_on "docbook-xsl" => :build
  16. depends_on "pkg-config" => :build
  17. depends_on "rust" => :build
  18. depends_on "pcre2"
  19. def install
  20. ENV["XML_CATALOG_FILES"] = etc/"xml/catalog"
  21. system "cargo", "install", "--root", prefix,
  22. "--path", ".",
  23. "--features", "pcre2"
  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. # No man page gets built on Linux:
  28. man1.install "#{out_dir}/rg.1" if OS.mac?
  29. bash_completion.install "#{out_dir}/rg.bash"
  30. fish_completion.install "#{out_dir}/rg.fish"
  31. zsh_completion.install "complete/_rg"
  32. end
  33. test do
  34. (testpath/"Hello.txt").write("Hello World!")
  35. system "#{bin}/rg", "Hello World!", testpath
  36. end
  37. end