From 3f51a23dfe2caaf3f311e286c8ede4cfd8040d66 Mon Sep 17 00:00:00 2001 From: Jordan Danford Date: Sun, 13 Aug 2017 13:21:54 -0700 Subject: [PATCH] http-server 0.10.0 (new formula) Closes #16760. Signed-off-by: ilovezfs --- Formula/http-server.rb | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Formula/http-server.rb diff --git a/Formula/http-server.rb b/Formula/http-server.rb new file mode 100644 index 0000000000..4eebd70547 --- /dev/null +++ b/Formula/http-server.rb @@ -0,0 +1,29 @@ +require "language/node" + +class HttpServer < Formula + desc "Simple zero-configuration command-line HTTP server" + homepage "https://github.com/indexzero/http-server" + url "https://registry.npmjs.org/http-server/-/http-server-0.10.0.tgz" + sha256 "cf7bde2def672698f78463ce8bec54dfe6392c24552f2b1c5e2e5ce94428de23" + head "https://github.com/indexzero/http-server.git" + + depends_on "node" + + def install + system "npm", "install", *Language::Node.std_npm_install_args(libexec) + bin.install_symlink Dir["#{libexec}/bin/*"] + end + + test do + begin + pid = fork do + exec "#{bin}/http-server" + end + sleep 1 + output = shell_output("curl -sI http://localhost:8080") + assert_match /200 OK/m, output + ensure + Process.kill("HUP", pid) + end + end +end