/
graphqlviz.rb
33 lines (27 loc) 路 925 Bytes
/
graphqlviz.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
require "language/node"
class Graphqlviz < Formula
desc "GraphQL Server schema visualizer"
homepage "https://github.com/sheerun/graphqlviz"
url "https://registry.npmjs.org/graphqlviz/-/graphqlviz-4.0.1.tgz"
sha256 "1ede0553fe61ca6f59876b31a7d86f8f9aa692456255c1acf91c204feb2e1ef3"
license "MIT"
bottle do
sha256 cellar: :any_skip_relocation, all: "62665fa4b145517916c55a51b222a0f896106797a5cf7d63d2967da10f75b0e8"
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
test_file = testpath/"test.graphql"
test_file.write <<~EOS
type Query {
hello: String
}
EOS
output = pipe_output("#{bin}/graphqlviz", test_file.read)
assert_match "digraph erd", output
assert_match version.to_s, shell_output("#{bin}/graphqlviz --version")
end
end