homebrew-core/Formula/newman.rb
2019-06-07 13:47:08 +02: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.0.tgz"
sha256 "6c6c19dc1a20baa6f353249079429259e951104326df0b9f00b46ec13d83c5ff"
bottle do
cellar :any_skip_relocation
sha256 "46b1901623023bce40aaf69d8079680218db434010ce28bf8f1ad0750cbe4093" => :mojave
sha256 "becc508308ef7620188e0e26f928eb0d7cb383434509d140554d3f3579f876d1" => :high_sierra
sha256 "4356f96ff121e334e6de32d74b35dc318c9a28a5938534b894c2a7d9a69d12fa" => :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