homebrew-core/Formula/newman.rb
2019-08-15 18:14:31 +08:00

64 lines
1.8 KiB
Ruby

require "language/node"
class Newman < Formula
desc "Command-line collection runner for Postman"
homepage "https://www.getpostman.com"
url "https://registry.npmjs.org/newman/-/newman-4.5.4.tgz"
sha256 "518ff807343dc8cbac29b472f01d2890ee6c6b009b177858b1caba8449f42820"
bottle do
cellar :any_skip_relocation
sha256 "a6ab1400604b2f0e2480b49adcdea3da94709731b4f82bfff62eae8eb3cf2bf4" => :mojave
sha256 "b8da4046f59e43bd457151a00ce03f015f3536debdade304021d708f7ae735a7" => :high_sierra
sha256 "6de5e0fc7453bf3ce93134c704900bfb954c777cc0f4d547623afe8b99ad0042" => :sierra
end
depends_on "node"
def install
system "npm", "install", *Language::Node.std_npm_install_args(libexec)
bin.install_symlink Dir["#{libexec}/bin/*"]
end
test do
path = testpath/"test-collection.json"
path.write <<~EOS
{
"info": {
"_postman_id": "db95eac2-6e1c-48c0-8c3a-f83c5341d4dd",
"name": "Homebrew",
"description": "Homebrew formula test",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "httpbin-get",
"request": {
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://httpbin.org/get",
"protocol": "https",
"host": [
"httpbin",
"org"
],
"path": [
"get"
]
}
},
"response": []
}
]
}
EOS
assert_match /newman/, shell_output("#{bin}/newman run #{path}")
assert_equal version.to_s, shell_output("#{bin}/newman --version").strip
end
end