65 lines
1.8 KiB
Ruby
65 lines
1.8 KiB
Ruby
class Comby < Formula
|
|
desc "Tool for changing code across many languages"
|
|
homepage "https://comby.dev"
|
|
url "https://github.com/comby-tools/comby/archive/0.17.0.tar.gz"
|
|
sha256 "5f45a49b1d2e412e2774333df43a4955e585098b748db484a520e98b57385c91"
|
|
license "Apache-2.0"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "1524fc2784febfc37d3367de7652b4a49699d57b2b7b6730fc0f3041cf0cf0b7" => :catalina
|
|
sha256 "896f126e24879488e8ad0f3f3497c55abc9d1992d3e0121f5e6a2530bb2b6197" => :mojave
|
|
sha256 "b6e623302a2fdabd2b82bdc111373224076d8b4145fb23ea76618c0a585c3ef9" => :high_sierra
|
|
end
|
|
|
|
depends_on "gmp" => :build
|
|
depends_on "ocaml" => :build
|
|
depends_on "opam" => :build
|
|
depends_on "pcre"
|
|
depends_on "pkg-config"
|
|
|
|
uses_from_macos "m4"
|
|
uses_from_macos "unzip"
|
|
uses_from_macos "zlib"
|
|
|
|
def install
|
|
ENV.deparallelize
|
|
opamroot = buildpath/".opam"
|
|
ENV["OPAMROOT"] = opamroot
|
|
ENV["OPAMYES"] = "1"
|
|
|
|
system "opam", "init", "--no-setup", "--disable-sandboxing"
|
|
system "opam", "config", "exec", "--", "opam", "install", ".", "--deps-only", "-y"
|
|
|
|
ENV.prepend_path "LIBRARY_PATH", opamroot/"default/lib/hack_parallel" # for -lhp
|
|
system "opam", "config", "exec", "--", "make", "release"
|
|
|
|
bin.install "_build/default/src/main.exe" => "comby"
|
|
end
|
|
|
|
test do
|
|
expect = <<~EXPECT
|
|
--- /dev/null
|
|
+++ /dev/null
|
|
@@ -1,3 +1,3 @@
|
|
int main(void) {
|
|
- printf("hello world!");
|
|
+ printf("comby, hello!");
|
|
}
|
|
EXPECT
|
|
|
|
input = <<~INPUT
|
|
EOF
|
|
int main(void) {
|
|
printf("hello world!");
|
|
}
|
|
EOF
|
|
INPUT
|
|
|
|
match = 'printf(":[1] :[2]!")'
|
|
rewrite = 'printf("comby, :[1]!")'
|
|
|
|
assert_equal expect, shell_output("#{bin}/comby '#{match}' '#{rewrite}' .c -stdin -diff << #{input}")
|
|
end
|
|
end
|