Last active
May 29, 2019 23:37
-
-
Save chrmoritz/7be25daadaf211bb4d2576bd3ed64643 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Deno < Formula | |
desc "Command-line JavaScript / TypeScript engine" | |
homepage "https://deno.land/" | |
url "https://github.com/denoland/deno.git", | |
:tag => "v0.7.0", | |
:revision => "5265bd7cb1f86af99b01d73c537d52a50df95fe2" | |
bottle do | |
cellar :any_skip_relocation | |
sha256 "470aa4ad260593875fff68af034a574d447ddeeacb0a0f6ca5b99052c196cec0" => :mojave | |
sha256 "4cb01d19914fa93b83ac936c408f2cbffa5a2caf33828ddb94609da9e8cd9e64" => :high_sierra | |
sha256 "d66b1a52a81928a4a7624fe18f1dea496519993f8c71a51d9e60fe5ca2bfde4c" => :sierra | |
end | |
depends_on "llvm" => :build | |
depends_on "ninja" => :build | |
depends_on "node" => :build | |
depends_on "rust" => :build | |
# 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", | |
:revision => "64b846c96daeb3eaf08e26d8a84d8451c6cb712b" | |
end | |
patch do | |
url "https://github.com/denoland/deno/pull/2423.patch?full_index=1" | |
sha256 "591c186dd97b2c7e78b0a79bf8aa8521d67d63738fbb24a27e2a6a414b2ce2cb" | |
end | |
def install | |
(buildpath/"gn").install resource("gn") | |
cd "gn" do | |
system "python", "build/gen.py" | |
system "ninja", "-C", "out/", "gn" | |
end | |
ENV["DENO_BUILD_MODE"] = "release" | |
ENV["DENO_BUILD_ARGS"] = "clang_base_path=\"#{Formula["llvm"].prefix}\"" | |
ENV["DENO_GN_PATH"] = buildpath/"gn/out/gn" | |
ENV["DENO_NINJA_PATH"] = Formula["ninja"].bin/"ninja" | |
system "python", "tools/setup.py", "--no-binary-download" | |
system "python", "tools/build.py", "--release" | |
bin.install "target/release/deno" | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment