homebrew-core/Formula/newman.rb
2019-08-02 04:31:18 +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.3.tgz"
sha256 "e982c7ca6eeb53b9ae6d2922c09a5202f82ebbda228ff2133b2cb74fe722d5c8"
bottle do
cellar :any_skip_relocation
sha256 "b70f201ca959626adc794615ee104c7e9ba40500ed312b49f0259d6d24eac325" => :mojave
sha256 "8927b26ecc8b246e93a239c61317827809f13cc43505304d40c7b44fe76ee355" => :high_sierra
sha256 "43fa03a48d0bef489f5822271329cef211331f4b003b001ef9702e108008b5fd" => :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