faas-cli 0.5.0
- update ldflag for specifying the git commit in the version string - install the template files in pkgshare - update the test to verify - the templates installed in pkgshare work - the expected error is triggered when the templates are absent - the `template pull` command works - the `new --list` command works - fix a bug in the test where the version string wasn't actually being checked for the git commit Closes #20569. Signed-off-by: ilovezfs <ilovezfs@icloud.com>
This commit is contained in:
parent
c121a16258
commit
e602a24b3e
1 changed files with 23 additions and 7 deletions
|
@ -2,8 +2,8 @@ class FaasCli < Formula
|
|||
desc "CLI for templating and/or deploying FaaS functions"
|
||||
homepage "http://docs.get-faas.com/"
|
||||
url "https://github.com/openfaas/faas-cli.git",
|
||||
:tag => "0.4.31",
|
||||
:revision => "5eac30a84ce41603527cab8decb716f45eaeb40b"
|
||||
:tag => "0.5.0",
|
||||
:revision => "91177ec27037eccaf6e827c265a0e452e772f1ab"
|
||||
|
||||
bottle do
|
||||
cellar :any_skip_relocation
|
||||
|
@ -20,9 +20,12 @@ class FaasCli < Formula
|
|||
ENV["GOPATH"] = buildpath
|
||||
(buildpath/"src/github.com/openfaas/faas-cli").install buildpath.children
|
||||
cd "src/github.com/openfaas/faas-cli" do
|
||||
commit = Utils.popen_read("git rev-list -1 HEAD").chomp
|
||||
system "go", "build", "-ldflags", "-s -w -X github.com/openfaas/faas-cli/commands.GitCommit=#{commit}", "-a",
|
||||
project = "github.com/openfaas/faas-cli"
|
||||
commit = Utils.popen_read("git", "rev-parse", "HEAD").chomp
|
||||
system "go", "build", "-ldflags",
|
||||
"-s -w -X #{project}/version.GitCommit=#{commit}", "-a",
|
||||
"-installsuffix", "cgo", "-o", bin/"faas-cli"
|
||||
pkgshare.install "template"
|
||||
prefix.install_metafiles
|
||||
end
|
||||
end
|
||||
|
@ -68,12 +71,25 @@ class FaasCli < Formula
|
|||
EOS
|
||||
|
||||
begin
|
||||
cp_r pkgshare/"template", testpath
|
||||
|
||||
output = shell_output("#{bin}/faas-cli deploy -yaml test.yml")
|
||||
assert_equal expected, output
|
||||
|
||||
commit = Utils.popen_read("git rev-list -1 HEAD").chomp
|
||||
output = shell_output("#{bin}/faas-cli version")
|
||||
assert_match commit, output.chomp
|
||||
rm_rf "template"
|
||||
|
||||
output = shell_output("#{bin}/faas-cli deploy -yaml test.yml 2>&1", 1)
|
||||
assert_match "stat ./template/python/template.yml", output
|
||||
|
||||
assert_match "ruby", shell_output("#{bin}/faas-cli template pull 2>&1")
|
||||
assert_match "node", shell_output("#{bin}/faas-cli new --list")
|
||||
|
||||
output = shell_output("#{bin}/faas-cli deploy -yaml test.yml")
|
||||
assert_equal expected, output
|
||||
|
||||
stable_resource = stable.instance_variable_get(:@resource)
|
||||
commit = stable_resource.instance_variable_get(:@specs)[:revision]
|
||||
assert_match commit, shell_output("#{bin}/faas-cli version")
|
||||
ensure
|
||||
Process.kill("TERM", pid)
|
||||
Process.wait(pid)
|
||||
|
|
Loading…
Reference in a new issue