homebrew-core/Formula/flow.rb
2018-02-16 21:32:19 -08: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.66.0.tar.gz"
sha256 "fa33ba8f6b305aff0bdfb3b84bc96b53e95d36202fad9d6b36931e91499bdc2c"
head "https://github.com/facebook/flow.git"
bottle do
cellar :any_skip_relocation
sha256 "f630955d7eb4871270c215b3ff85fcc24392fbdb6dcbaada433fe312547241df" => :high_sierra
sha256 "8a23f597266774c8869501ebb3400db4ba41232f4dbc9309c7c563b334d0c659" => :sierra
sha256 "aa78ab21f7ed8c0a3ea34bf929fe8449167a728be707c0edbf178259259ac66a" => :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: