require "language/node" class AtomistCli < Formula desc "The Atomist CLI" homepage "https://github.com/atomist/cli#readme" url "https://registry.npmjs.org/@atomist/cli/-/@atomist/cli-1.3.0.tgz" sha256 "313b5f356bee3f77b800ebda3f4225813a6b1453fe26624cacbad82ba5b5d9d7" bottle do sha256 "74aa8f383e1b7fcc49f45e22e87a1a7e7bb7c03283f9ea2757c33b4e149094ab" => :mojave sha256 "4ee165787a2463c8cbcbf16c6615966ab140666c4bffe15d7f3307fe509a5915" => :high_sierra sha256 "ddef71ceeed53263d2e3b87bbb6b18244322efc96a69b4e611895d60f826bace" => :sierra end depends_on "node" def install system "npm", "install", *Language::Node.std_npm_install_args(libexec) bin.install_symlink Dir["#{libexec}/bin/*"] bash_completion.install "#{libexec}/lib/node_modules/@atomist/cli/assets/bash_completion/atomist" end test do assert_predicate bin/"atomist", :exist? assert_predicate bin/"atomist", :executable? assert_predicate bin/"@atomist", :exist? assert_predicate bin/"@atomist", :executable? run_output = shell_output("#{bin}/atomist 2>&1") assert_match "Not enough non-option arguments", run_output assert_match "Specify --help for available options", run_output version_output = shell_output("#{bin}/atomist --version") assert_match "@atomist/cli", version_output assert_match "@atomist/sdm ", version_output assert_match "@atomist/sdm-core", version_output assert_match "@atomist/sdm-local", version_output skill_output = shell_output("#{bin}/atomist show skills") assert_match(/\d+ commands are available from \d+ connected SDMs/, skill_output) end end