| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance |
| # with the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, |
| # software distributed under the License is distributed on an |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| # KIND, either express or implied. See the License for the |
| # specific language governing permissions and limitations |
| # under the License. |
| |
| version: "3" |
| |
| tasks: |
| user: |
| silent: true |
| desc: get user |
| cmds: |
| - wsk property get | awk '/whisk namespace/{print $3}' |
| |
| apihost: |
| silent: true |
| desc: get apihost |
| cmds: |
| - wsk property get | awk '/whisk API host/{print $4}' |
| |
| detect: |
| silent: true |
| desc: detect project in directory |
| env: |
| PACKAGES_PATH: |
| sh: | |
| P=$($OPS -opspath ./packages) |
| if [ ! -z {{._path_}} ]; then |
| P=$($OPS -opspath {{._path_}}/packages) |
| fi |
| echo $P |
| WEB_PATH: |
| sh: | |
| P=$($OPS -opspath ./web) |
| if [ ! -z {{._path_}} ]; then |
| P=$(opspath {{._path_}}/web) |
| fi |
| echo $P |
| |
| cmds: |
| - | |
| if [ -d "$PACKAGES_PATH" ] && [ -d "$WEB_PATH" ]; then |
| echo "Packages directory: [OK]" |
| echo "Web directory : [OK]" |
| exit 0 |
| fi |
| |
| if [ ! -d "$WEB_PATH" ]; then |
| echo "Packages directory: [MISSING]" |
| exit 1 |
| fi |
| |
| if [ ! -d "$PACKAGES_PATH" ]; then |
| echo "Packages directory: [MISSING]" |
| exit 1 |
| fi |
| |
| die "No project detected (missing packages and web directory)." |
| |
| #scan: |
| # silent: true |
| # desc: scan directory and generate nuvolaris manifest files |
| # cmds: |
| # - task: detect |
| # - | |
| # if [ -f "$SCAN_PATH/packages/manifest.yaml" ]; then |
| # if {{.__force}} |
| # then |
| # rm $SCAN_PATH/packages/manifest.yaml |
| # bun scanner.js $SCAN_PATH |
| # bun $OPS_TMP/manifest.yaml $SCAN_PATH/packages/manifest.yaml |
| # echo "Manifest file overwritten in $SCAN_PATH/packages/manifest.yaml" |
| # else |
| # echo "Scan skipped: manifest file present (packages/manifest.yaml). Use --force to overwrite it."; |
| # fi |
| # else |
| # bun scanner.js $SCAN_PATH |
| # fi |
| # env: |
| # SCAN_PATH: |
| # sh: | |
| # P=$(realpath ./) |
| # if [ ! -z {{._path_}} ]; then |
| # P=$(realpath {{._path_}}) |
| # fi |
| # echo $P |
| # |
| #deploy: |
| # silent: true |
| # desc: deploy nuvolaris projects |
| # dir: $DEPLOY_PATH |
| # cmds: |
| # - | |
| # if [[ "{{._repo_or_path_}}" == https://* ]]; then |
| # echo "Detected 'https://' prefix, cloning repository..." |
| # git clone {{._repo_or_path_}} $DEPLOY_PATH |
| # fi |
| # - echo "Scanning project..." |
| # - nuv devel scan $DEPLOY_PATH |
| # - echo "Deploying project..." |
| # - nuv project deploy $DEPLOY_PATH |
| # env: |
| # DEPLOY_PATH: |
| # sh: | |
| # P=$(realpath ./) |
| # if [[ "{{._repo_or_path_}}" == https://* ]]; then |
| # # Extract repository name from URL and remove .git suffix |
| # REPO_NAME=$(basename "{{._repo_or_path_}}") |
| # REPO_NAME=$(echo "$REPO_NAME" | awk -F\. '{print $1}') |
| # P=$(realpath $REPO_NAME) |
| # else |
| # if [ ! -z {{._repo_or_path_}} ]; then |
| # P=$(realpath {{._repo_or_path_}}) |
| # fi |
| # fi |
| # echo $P |