This is an automated email from the ASF dual-hosted git repository.

msciabarra pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/openserverless-cli.git

commit 6789e80f4f695ca739450c538d1b2a3d0381cec3
Author: Michele Sciabarra <[email protected]>
AuthorDate: Tue Jul 23 18:38:17 2024 +0200

    fixed task which has an init in flags
---
 .gitignore             |   8 ++++++++
 Taskfile.yml           |  23 +++++++++++++++++++----
 _patches/.gitignore    |   5 -----
 _patches/patch-task.sh |   7 +++++--
 _patches/task          | Bin 17174491 -> 17159510 bytes
 go.mod                 |   2 +-
 go.sum                 |   6 ++++--
 main.go                |   2 +-
 shell.nix              |   3 ++-
 9 files changed, 40 insertions(+), 16 deletions(-)

diff --git a/.gitignore b/.gitignore
index 20ccc83..1683916 100644
--- a/.gitignore
+++ b/.gitignore
@@ -42,3 +42,11 @@ nuv.spec
 nix/result
 .direnv/
 ops
+tests/bats/
+tests/test_helper/bats-assert/
+tests/test_helper/bats-support/
+_patch/task
+_patch/gosh
+_patch/wsk
+_patch/openwhisk-wskdeploy
+_patch/openwhisk-cli
diff --git a/Taskfile.yml b/Taskfile.yml
index 709709b..290cd3f 100644
--- a/Taskfile.yml
+++ b/Taskfile.yml
@@ -37,9 +37,15 @@ tasks:
     - git tag
 
 
+  rebuild:
+    - rm -f ops
+    - task: build
+
   build:
     desc: build ops locally
-      - go build {{.DEBUG}} -ldflags "-X main.NuvVersion={{.VERSION}} -X 
main.NuvBranch={{.BASEVER}}"  -o bin/nuv
+    cmds:
+      - echo building {{.VERSION}}
+      - go build  {{.DEBUG}} -ldflags "-X main.NuvVersion={{.VERSION}} -X 
main.NuvBranch={{.BASEVER}}" cmd/ops/ops.go
     sources:
       - "*.go"
       - "tools/*.go"
@@ -59,8 +65,7 @@ tasks:
       - build
     cmds:
       - sudo cp ops /usr/local/bin
-      - sudo ln -sf $PWD/{{OS}}/{{ARCH}}/nuv /usr/local/bin/nuv
-      - sudo ln -sf $PWD/{{OS}}/{{ARCH}}/nuv /usr/bin/nuv
+      - sudo ln -sf /usr/local/bin/ops /usr/local/bin/nuv
 
   test:
     desc: tests all
@@ -75,17 +80,27 @@ tasks:
       - rm -Rf ~/.nuv/olaris
       - go test ./...
 
+  bats:
+    dir: tests
+    cmds:
+    - git clone https://github.com/bats-core/bats-core bats
+    - git clone https://github.com/bats-core/bats-support 
test_helper/bats-support
+    - git clone https://github.com/bats-core/bats-assert 
test_helper/bats-assert
+    status:
+    - test -d bats
+
   itest:
     desc: integration tests nuv
     dir: tests
     cmds:
+      - task: bats
       - rm -Rf ~/.nuv/olaris
       - bats/bin/bats .
 
   clean:
+    - rm ops || true
     - go clean -cache -modcache -testcache -fuzzcache
 
-
   utestdiff:
     cmds:
       - |-
diff --git a/_patches/.gitignore b/_patches/.gitignore
deleted file mode 100644
index 74f09bd..0000000
--- a/_patches/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-task
-gosh
-wsk
-openwhisk-wskdeploy
-openwhisk-cli
diff --git a/_patches/patch-task.sh b/_patches/patch-task.sh
index 63835a8..4cd3fdf 100644
--- a/_patches/patch-task.sh
+++ b/_patches/patch-task.sh
@@ -4,7 +4,7 @@ cd "$(dirname $0)"
 HERE=$PWD
 SHVER=$(git ls-remote https://github.com/sciabarracom/sh | awk 
'/refs\/heads\/openserverless/{print $1}')
 STAG="v3.38.0"
-DTAG="v3.38.4"
+DTAG="v3.38.6"
 cd taskfile
 go clean -cache -modcache
 git checkout "$STAG" -B openserverless
@@ -13,10 +13,12 @@ cat cmd/task/task.go \
 | sed -e 's/package main/package taskmain/' \
 | sed -e 's/func main()/func _main()/' \
 | tee cmd/taskmain/task.go
+sed -i -e 's/func init/func FlagInit/' internal/flags/flags.go
 cat   <<EOF >>cmd/taskmain/task.go
 
 func Task(_args []string) (int, error) {
-       os.Args = _args
+   os.Args = _args
+   flags.FlagInit()
        if err := run(); err != nil {
                l := &logger.Logger{
                        Stdout:  os.Stdout,
@@ -53,6 +55,7 @@ go get github.com/sciabarracom/sh/v3@$SHVER
 go mod tidy
 git commit -m "patching sh for ops" -a
 git tag $DTAG
+go build
 git push origin-auth openserverless -f --tags
 VER=$(git rev-parse HEAD)
 GOBIN=$HERE go install github.com/sciabarracom/task/v3/cmd/task@$VER
diff --git a/_patches/task b/_patches/task
index 8600b21..bbd6523 100755
Binary files a/_patches/task and b/_patches/task differ
diff --git a/go.mod b/go.mod
index cb1cd9f..70ba5d3 100644
--- a/go.mod
+++ b/go.mod
@@ -22,7 +22,7 @@ require (
        github.com/nuvolaris/jj v0.0.0-20231020143327-10b90948a5d2
        github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c
        github.com/sciabarracom/openwhisk-cli v1.2.1
-       github.com/sciabarracom/task/v3 v3.38.4
+       github.com/sciabarracom/task/v3 v3.38.6
        github.com/stretchr/testify v1.9.0
        github.com/zalando/go-keyring v0.2.5
        golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
diff --git a/go.sum b/go.sum
index af96fc9..d4d6af7 100644
--- a/go.sum
+++ b/go.sum
@@ -345,8 +345,10 @@ github.com/sciabarracom/openwhisk-wskdeploy v1.2.1 
h1:t5hgca9OFEO39t4OqIxcWybYRj
 github.com/sciabarracom/openwhisk-wskdeploy v1.2.1/go.mod 
h1:bWjrIOIAzt8AcPqiJ0mWEecUxXbT4bY4ysMlJO6/q78=
 github.com/sciabarracom/sh/v3 v3.8.1 
h1:DQXhDNnbcGbeMtaTFbGa8OlmZZxxfBcwI8u8oS2gSyg=
 github.com/sciabarracom/sh/v3 v3.8.1/go.mod 
h1:CeMVr3PRLhlUrS+VPLTp8dS5/6xNzmmX0h/WVHRR6DA=
-github.com/sciabarracom/task/v3 v3.38.4 
h1:xS1zHXMh5nJZwevXjWXBv8Jp2KtpSqto7Spp/uswsoA=
-github.com/sciabarracom/task/v3 v3.38.4/go.mod 
h1:KOSMNSJm4CBpVzAXUlkgEPgbDp9kQoL9nNm/B6DvcW0=
+github.com/sciabarracom/task/v3 v3.38.5 
h1:n3MoGltcwTtuG3R4tlPX9V0DmFYa55ESDItNiJIpiYk=
+github.com/sciabarracom/task/v3 v3.38.5/go.mod 
h1:KOSMNSJm4CBpVzAXUlkgEPgbDp9kQoL9nNm/B6DvcW0=
+github.com/sciabarracom/task/v3 v3.38.6 
h1:vNVqq/EUDkCbt4TUvk4LWtpD4wE0G4mveWMBb8QUieU=
+github.com/sciabarracom/task/v3 v3.38.6/go.mod 
h1:KOSMNSJm4CBpVzAXUlkgEPgbDp9kQoL9nNm/B6DvcW0=
 github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod 
h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
 github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 
h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8=
 github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod 
h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
diff --git a/main.go b/main.go
index b26aa14..36c1deb 100644
--- a/main.go
+++ b/main.go
@@ -117,7 +117,7 @@ func Main() {
 
        var err error
        me := os.Args[0]
-       if filepath.Base(me) == "nuv" || filepath.Base(me) == "nuv.exe" {
+       if filepath.Base(me) == "ops" || filepath.Base(me) == "ops.exe" {
                tools.NuvCmd, err = setupCmd(me)
                if err != nil {
                        log.Fatalf("cannot setup cmd: %s", err.Error())
diff --git a/shell.nix b/shell.nix
index 95fd5d7..50f8dc8 100644
--- a/shell.nix
+++ b/shell.nix
@@ -30,7 +30,8 @@ pkgs.mkShellNoCC {
     gopkgs
     gocode-gomod
     godef
-    golint   
+    golint
+    delve
     silver-searcher
     jq
   ];

Reply via email to