homebrew-core/Formula/newman.rb

70 lines
1.9 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-5.2.0.tgz"
sha256 "5c150469ad4992223ea3f694e362a923f473254719d8c0d252a67acbd11c5ef6"
license "Apache-2.0"
livecheck do
url :stable
end
bottle do
cellar :any_skip_relocation
sha256 "22e456dd51188aee5518ad13a88c28e345e7f2e5afde3c487c61d37225e67a81" => :catalina
sha256 "43aa0b74318ce9fbb39087c679d9b898a12dc4a3d62b85aa3b7650029fe1addf" => :mojave
sha256 "645bda6e706231d5278d6755db919df7509f568ed8b5b4ed7b8be2373242ea5e" => :high_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