2019-01-03 00:02:20 +00:00
|
|
|
class Deno < Formula
|
|
|
|
desc "Command-line JavaScript / TypeScript engine"
|
|
|
|
homepage "https://deno.land/"
|
|
|
|
url "https://github.com/denoland/deno.git",
|
2019-09-06 21:21:18 +00:00
|
|
|
:tag => "v0.18.0",
|
|
|
|
:revision => "7e3296dad92cee2e8b77baedfbeca38aa297928e"
|
2019-01-03 00:02:20 +00:00
|
|
|
|
2019-05-23 19:01:50 +00:00
|
|
|
bottle do
|
2019-09-13 23:56:23 +00:00
|
|
|
cellar :any
|
|
|
|
sha256 "70bcca9e5ab6f52eb1efa03b8428c0c29cc178a5fb5b83b32457549581886d1f" => :mojave
|
|
|
|
sha256 "030fb930565692470fd7e6022a3d48e9f3ad79c7c7b80fd46c79e905d0e72465" => :high_sierra
|
|
|
|
sha256 "a63d4e45131199cd9f851a5b36f441346d175d93b2d6ed02ccf8c713081da5fc" => :sierra
|
2019-05-23 19:01:50 +00:00
|
|
|
end
|
|
|
|
|
2019-01-03 00:02:20 +00:00
|
|
|
depends_on "ninja" => :build
|
|
|
|
depends_on "rust" => :build
|
2019-09-06 21:21:18 +00:00
|
|
|
depends_on "llvm"
|
2019-01-03 00:02:20 +00:00
|
|
|
|
|
|
|
# https://bugs.chromium.org/p/chromium/issues/detail?id=620127
|
|
|
|
depends_on :macos => :el_capitan
|
|
|
|
|
|
|
|
resource "gn" do
|
|
|
|
url "https://gn.googlesource.com/gn.git",
|
2019-09-06 21:21:18 +00:00
|
|
|
:revision => "972ed755f8e6d31cae9ba15fcd08136ae1a7886f"
|
2019-01-03 00:02:20 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def install
|
2019-06-08 20:54:30 +00:00
|
|
|
# Build gn from source (used as a build tool here)
|
2019-01-03 00:02:20 +00:00
|
|
|
(buildpath/"gn").install resource("gn")
|
|
|
|
cd "gn" do
|
|
|
|
system "python", "build/gen.py"
|
|
|
|
system "ninja", "-C", "out/", "gn"
|
|
|
|
end
|
|
|
|
|
2019-06-08 20:54:30 +00:00
|
|
|
# env args for building a release build with our clang, ninja and gn
|
2019-09-06 21:21:18 +00:00
|
|
|
ENV["DENO_NO_BINARY_DOWNLOAD"] = "1"
|
|
|
|
ENV["FORCE_MAC_SDK_MIN"] = "10.12"
|
|
|
|
# remove treat_warnings_as_errors with llvm@9
|
2019-06-08 20:54:30 +00:00
|
|
|
ENV["DENO_BUILD_ARGS"] = %W[
|
|
|
|
clang_base_path="#{Formula["llvm"].prefix}"
|
|
|
|
clang_use_chrome_plugins=false
|
2019-08-09 11:16:19 +00:00
|
|
|
mac_deployment_target="#{MacOS.version}"
|
2019-09-06 21:21:18 +00:00
|
|
|
treat_warnings_as_errors=false
|
2019-06-08 20:54:30 +00:00
|
|
|
].join(" ")
|
|
|
|
ENV["DENO_NINJA_PATH"] = Formula["ninja"].bin/"ninja"
|
|
|
|
ENV["DENO_GN_PATH"] = buildpath/"gn/out/gn"
|
|
|
|
|
2019-09-06 21:21:18 +00:00
|
|
|
cd "cli" do
|
|
|
|
system "cargo", "install", "-vv", "--root", prefix, "--path", "."
|
|
|
|
end
|
2019-07-07 17:05:09 +00:00
|
|
|
|
|
|
|
# Install bash and zsh completion
|
|
|
|
output = Utils.popen_read("#{bin}/deno completions bash")
|
|
|
|
(bash_completion/"deno").write output
|
|
|
|
output = Utils.popen_read("#{bin}/deno completions zsh")
|
|
|
|
(zsh_completion/"_deno").write output
|
2019-01-03 00:02:20 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
(testpath/"hello.ts").write <<~EOS
|
|
|
|
console.log("hello", "deno");
|
|
|
|
EOS
|
|
|
|
hello = shell_output("#{bin}/deno run hello.ts")
|
|
|
|
assert_includes hello, "hello deno"
|
|
|
|
end
|
|
|
|
end
|