homebrew-core/Formula/flow.rb
2018-03-08 16:51:31 +10:00

57 lines
1.7 KiB
Ruby

class Flow < Formula
desc "Static type checker for JavaScript"
homepage "https://flowtype.org/"
url "https://github.com/facebook/flow/archive/v0.67.1.tar.gz"
sha256 "f7c62e5bbc2efc72a18ace779631c46e9392b2b8753920ebd14af1a3cc3d5f46"
head "https://github.com/facebook/flow.git"
bottle do
cellar :any_skip_relocation
sha256 "24efec7076cbd854d3bbe9a3ce0578accdd7db03c77d25b9175691beb3a5dd6b" => :high_sierra
sha256 "70fbc21cd4e013d1fc296e80778b926d6d270694663a136fe78106485c62a3d3" => :sierra
sha256 "b32a299fdf0ab1016d5cf6b22a1c0541f91f55b5f982532d713912b0995076f4" => :el_capitan
end
depends_on "ocaml" => :build
depends_on "opam" => :build
# Fix "compilation of ocaml-migrate-parsetree failed"
# Reported 24 Jul 2017 https://github.com/ocaml/opam/issues/3007
patch :DATA
def install
system "make", "all-homebrew"
bin.install "bin/flow"
bash_completion.install "resources/shell/bash-completion" => "flow-completion.bash"
zsh_completion.install_symlink bash_completion/"flow-completion.bash" => "_flow"
end
test do
system "#{bin}/flow", "init", testpath
(testpath/"test.js").write <<~EOS
/* @flow */
var x: string = 123;
EOS
expected = /Found 1 error/
assert_match expected, shell_output("#{bin}/flow check #{testpath}", 2)
end
end
__END__
diff --git a/Makefile b/Makefile
index 515e581..8886bf6 100644
--- a/Makefile
+++ b/Makefile
@@ -174,8 +174,8 @@ all-homebrew:
export OPAMYES="1"; \
export FLOW_RELEASE="1"; \
opam init --no-setup && \
- opam pin add flowtype . && \
- opam install flowtype --deps-only && \
+ opam pin add -n flowtype . && \
+ opam config exec -- opam install flowtype --deps-only && \
opam config exec -- make
clean: