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

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


The following commit(s) were added to refs/heads/0.1.0 by this push:
     new 545ffad  updating to latest version
545ffad is described below

commit 545ffad56f7b5e7d844c6879a5aac661dcfc5675
Author: Michele Sciabarra <[email protected]>
AuthorDate: Sat Aug 3 13:53:48 2024 +0200

    updating to latest version
---
 nuvroot.json => opsroot.json       |  2 +-
 prereq.yml                         | 35 ++++++++++++++--
 tests/{nuvfile.yml => opsfile.yml} |  0
 util/nuvfile.yml                   | 16 --------
 util/opsfile.yml                   | 83 ++++++++++++++++++++++++++++++++++++++
 5 files changed, 116 insertions(+), 20 deletions(-)

diff --git a/nuvroot.json b/opsroot.json
similarity index 95%
rename from nuvroot.json
rename to opsroot.json
index c3d4823..fd25530 100644
--- a/nuvroot.json
+++ b/opsroot.json
@@ -1,5 +1,5 @@
 {
-    "version": "0.1.0-2407311454.dev",
+    "version": "0.1.0-2408011322.dev",
     "config": {
        "ops": {
             "coreutils": "arch b2sum b3sum base32 base64 basename basenc cat 
chgrp chmod chown chroot cksum comm cp csplit cut date dd df dir dircolors 
dirname du env expand expr factor fmt fold groups hashsum head hostid hostname 
id install join kill link ln logname ls md5sum mkdir mkfifo mknod mktemp more 
mv nice nl nohup nproc numfmt od paste pathchk pinky pr printenv printf ptx pwd 
readlink realpath rm rmdir seq sha1sum sha224sum sha256sum sha3-224sum 
sha3-256sum sha3-384sum sha3-512sum sh [...]
diff --git a/prereq.yml b/prereq.yml
index 4859ed7..76e7df2 100644
--- a/prereq.yml
+++ b/prereq.yml
@@ -4,8 +4,7 @@ vars:
   OS: "{{or .__OS OS}}"
   BOH: "{{.__ARCH}}"
   ARCH: "{{or .__ARCH ARCH}}"
-  ARC: '{{if eq .OS "windows"}}.zip{{else}}.tgz{{end}}'
-  ARC2: '{{if eq .OS "windows"}}.zip{{else}}.tar.gz{{end}}'
+  ARC: '{{if eq .OS "windows"}}.zip{{else}}.tar.gz{{end}}'
   EXE: '{{if eq .OS "windows"}}.exe{{else}}{{end}}'
 
 tasks:
@@ -71,7 +70,7 @@ tasks:
             windows-*) echo "x86_64-pc-windows-gnu" ;;
             *) echo "unknown" ;;
             esac
-      URL: 
"https://github.com/uutils/coreutils/releases/download/{{.VERSION}}/coreutils-{{.VERSION}}-{{.SUFFIX}}{{.ARC2}}";
 
+      URL: 
"https://github.com/uutils/coreutils/releases/download/{{.VERSION}}/coreutils-{{.VERSION}}-{{.SUFFIX}}{{.ARC}}";
 
       FILE: "{{base .URL}}"
       OUT: coreutils
     cmds:
@@ -134,6 +133,36 @@ tasks:
           URL: "{{.BASE}}/{{.FILE}}"
           OUT: k3sup
 
+  ripgrep:
+    desc: download ripgrep
+    vars:
+      XVERSION: 14.1.0
+      BASE: 
"https://github.com/BurntSushi/ripgrep/releases/download/{{.VERSION}}";
+      SUFFIX: 
+        sh: |
+            case "{{.OS}}-{{.ARCH}}" in
+            (linux-amd64)   echo "unknown-x86_64-linux-musl"  ;;
+            (linux-arm64)   echo "unknown-aarch64-linux-gnu" ;;
+            (darwin-amd64)  echo "x86_64-apple-darwin" ;;
+            (darwin-arm64)  echo "aarch64-apple-darwin" ;;
+            (windows-amd64) echo "pc-windows-msvc" ;;
+            esac
+      URL: "{{.BASE}}/ripgrep-{{.VERSION}}-{{.SUFFIX}}{{.ARC}}"
+      OUT: "rg{{.EXE}}"
+    cmds:
+      - cmd: echo "{{.URL}}"  -o "{{base .URL}}" 
+
+#https://github.com/BurntSushi/ripgrep/releases/download/14.1.0/ripgrep-14.1.0-aarch64-unknown-linux-gnu.tar.gz
+#https://github.com/BurntSushi/ripgrep/releases/download/14.1.0/ripgrep-14.1.0-unknown-x86_64-linux-musl.tar.gz
+
+#https://github.com/BurntSushi/ripgrep/releases/download/14.1.0/ripgrep-14.1.0-aarch64-unknown-linux-gnu.tar.gz
+
+#https://github.com/BurntSushi/ripgrep/releases/download/14.0.3/ripgrep-14.0.3-x86_64-unknown-linux-musl.tar.gz
+#https://github.com/BurntSushi/ripgrep/releases/download/14.1.0/ripgrep-14.1.0-unknown-x86_64-linux-musl.tar.gz
 
+
+
+
+
   all:
     - task: 7zz
     - task: coreutils    
diff --git a/tests/nuvfile.yml b/tests/opsfile.yml
similarity index 100%
rename from tests/nuvfile.yml
rename to tests/opsfile.yml
diff --git a/util/nuvfile.yml b/util/nuvfile.yml
deleted file mode 100644
index 59a9ac0..0000000
--- a/util/nuvfile.yml
+++ /dev/null
@@ -1,16 +0,0 @@
-version: 3
-
-tasks:
-
-  update-cli:
-    desc: update CLI (TODO)
-    silent: true
-    cmds:
-    - echo "your ops is outdated, please update it"
-    - false
-
-  check-operator-version:
-    desc: check running operator version and warns it is obsolete (TODO)
-    silent: true
-    cmds:
-    - echo "TODO checking the running operator version"
diff --git a/util/opsfile.yml b/util/opsfile.yml
new file mode 100644
index 0000000..9e45aa6
--- /dev/null
+++ b/util/opsfile.yml
@@ -0,0 +1,83 @@
+version: 3
+
+tasks:
+
+  update-cli:
+    desc: update CLI (TODO)
+    silent: true
+    prompt: updating the CLI, plese confirm
+    cmds:
+      - test -n "{{.EXT}}" || die "Sorry I cannot determine the environent. 
Please download from {{.BASE}}"
+      - |
+        SRC="{{.BASE}}/{{.VER}}/nuv_{{.VER}}_{{.ARCH}}{{.EXT}}"
+        TGT="$NUV_TMP/download/nuv{{.EXT}}"
+        if test -e "$TGT"
+        then rm "$TGT"
+        fi
+        echo "Downloading updated installer..."
+        mkdir -p $NUV_TMP/download
+        if curl --progress-bar -L -o "$TGT" "$SRC"
+        then
+          #echo $FILE
+          #echo {{.CMD}}
+          echo "Installing..."
+          if {{.CMD}} $TGT
+          then  echo "{{.MSG}}"
+          else
+              {{if eq OS "windows"}}
+                echo "I cannot update, most likeky because your execution 
policy is restricted."
+                echo "You can execute from powershell 'Set-ExecutionPolicy 
Unrestricted -Scope CurrentUser' and retry,"                
+                echo "or download and install from here:"
+                echo "$SRC"
+              {{else}}
+                echo "Someting went wrong, please download this file and 
install it manually:"
+                echo "$SRC"
+              {{end}}
+          fi
+        else
+          echo "Cannot download the package, please download this file and 
install it manually:"
+          echo $SRC
+        fi
+    vars:
+      BASE: "https://github.com/apache/openserverless-cli/releases/download";
+      VER:
+        sh: jq .version -r $NUV_ROOT/nuvroot.json
+      MSG: '{{if eq OS "windows"}}Please execute the 
Installer.{{else}}Installation Complete.{{end}}'
+      EXT:
+        sh: |
+          case {{.OS}} in
+          (linux)  
+            if test -e /bin/dpkg
+            then echo ".deb"
+            elif test -e /bin/rpm
+            then echo ".rpm"
+            else echo "unknown"
+            fi
+          ;;
+          (darwin) 
+            echo ".pkg"
+          ;;
+          (windows) 
+            echo ".msi"
+          ;;
+          esac
+      CMD:
+        sh: |
+          case {{.OS}} in
+          (linux)  
+            if test -e /bin/dpkg
+            then echo "sudo dpkg -i"
+            elif test -e /bin/rpm
+            then echo "sudo rpm -i"
+            else echo "unknown"
+            fi
+          ;;
+          (darwin) echo "sudo installer -target / -pkg" ;;
+          (windows) echo "powershell -File update.ps1 -Installer" ;;
+          esac
+
+  check-operator-version:
+    desc: check running operator version and warns it is obsolete (TODO)
+    silent: true
+    cmds:
+    - echo "TODO checking the running operator version"

Reply via email to