diff --git a/documentation/cicdgen.asciidoc b/documentation/cicdgen.asciidoc new file mode 100644 index 000000000..a9a7f3637 --- /dev/null +++ b/documentation/cicdgen.asciidoc @@ -0,0 +1,19 @@ +:toc: +toc::[] + += cicdgen + +The `cicdgen` commandlet allows to install and setup https://github.com/devonfw/cicdgen[cicdgen]. +The arguments (`devon cicdgen «args»`) are explained by the following table: + +.Usage of `devon cicdgen` +[options="header"] +|======================= +|*Argument(s)* |*Meaning* +|`setup` |setup cicdgen (install and verify) +|`update` |update cicdgen (reinstall with @latest version and verify) +|`java «args»` |generate cicd files for the currect devon4java project +|`ng «args»` |generate cicd files for the currect devon4ng project +|`node «args»` |generate cicd files for the currect devon4node project +|`«args»` |call cicdgen with the specified arguments +|======================= \ No newline at end of file diff --git a/documentation/java.asciidoc b/documentation/java.asciidoc index 70224f0ac..f619bac02 100644 --- a/documentation/java.asciidoc +++ b/documentation/java.asciidoc @@ -13,6 +13,7 @@ The arguments (`devon java «args»`) are explained by the following table: |`setup` |setup OpenJDK (install or update and verify), link:configuration.asciidoc[configurable] via `JAVA_VERSION` (e.g. `8u222b10` or `11.0.4_11`) |`create «args»` |create a new Java project based on https://github.com/devonfw/devon4j/blob/develop/documentation/tutorial-newapp.asciidoc[devon4j application template]. If a single argument is provided, this is the package name and is automatically split into groupId and artifactId. Use `-DdbType=«db»` to choose the database (hana, oracle, mssql, postgresql, mariadb, mysql, h2, hsqldb). Any option starting with dash is passed as is." |`migrate [from «version»] [single]` |migrate a https://github.com/devonfw/devon4j[devon4j] project to the latest version. If for some reasons the current devonfw version (e.g. oasp4j:2.6.0) can not be auto-detected you may provide it manually after the 'from' argument. Also the 'single' option allows to migrate only to the next available version." +|`cicd «args»` |generate cicd files for the currect devon4java project |======================= == create diff --git a/documentation/master-ide.asciidoc b/documentation/master-ide.asciidoc index d1d4c1d83..adcb274cd 100644 --- a/documentation/master-ide.asciidoc +++ b/documentation/master-ide.asciidoc @@ -1,35 +1,35 @@ -= devonfw ide - -== Integrated Development Environment - -include::Home[leveloffset=2] - -include::features[leveloffset=2] - -include::setup[leveloffset=2] - -include::usage[leveloffset=2] - -include::license[leveloffset=2] - -include::structure[leveloffset=2] - -include::cli[leveloffset=2] - -include::variables[leveloffset=2] - -include::configuration[leveloffset=2] - -include::scripts[leveloffset=2] - -include::settings[leveloffset=2] - -include::software[leveloffset=2] - -include::integration[leveloffset=2] - -include::advanced-tooling[leveloffset=2] - -include::eclipse-plugins[leveloffset=2] - - += devonfw ide + +== Integrated Development Environment + +include::Home[leveloffset=2] + +include::features[leveloffset=2] + +include::setup[leveloffset=2] + +include::usage[leveloffset=2] + +include::license[leveloffset=2] + +include::structure[leveloffset=2] + +include::cli[leveloffset=2] + +include::variables[leveloffset=2] + +include::configuration[leveloffset=2] + +include::scripts[leveloffset=2] + +include::settings[leveloffset=2] + +include::software[leveloffset=2] + +include::integration[leveloffset=2] + +include::advanced-tooling[leveloffset=2] + +include::eclipse-plugins[leveloffset=2] + + diff --git a/documentation/ng.asciidoc b/documentation/ng.asciidoc index 7c1627181..2ac130f61 100644 --- a/documentation/ng.asciidoc +++ b/documentation/ng.asciidoc @@ -13,5 +13,6 @@ The arguments (`devon ng «args»`) are explained by the following table: |*Argument(s)* |*Meaning* |`setup` |setup yarn (install and verify), link:configuration.asciidoc[configurable] via `YARN_VERSION` |`create` |Create a new https://github.com/devonfw/devon4ng/#devon4ng[devon4ng] project. +|`cicd «args»` |generate cicd files for the currect devon4ng project |`«args»` |run ng with the given arguments (`«args»`) |======================= diff --git a/documentation/node.asciidoc b/documentation/node.asciidoc index b0c59a76a..d36909d3a 100644 --- a/documentation/node.asciidoc +++ b/documentation/node.asciidoc @@ -11,4 +11,9 @@ The arguments (`devon node «args»`) are explained by the following table: |======================= |*Argument(s)* |*Meaning* |`setup` |setup node.js (install and verify), link:configuration.asciidoc[configurable] via `NODE_VERSION` +|`create «name» [«args»]` | create a new devon4node application `(same as devon4node new)` +|`generate «s» [«args»]` | generate devon4node components using the schematic «s» `(same as devon4node generate)` +|`db «c» [«args»]` | execute a TypeORM command «c» `(same as devon4node db)` +|`cicd «args»` |generate cicd files for the currect devon4node project +|`«args»` | call NodeJS with the specified arguments |======================= diff --git a/scripts/src/main/resources/scripts/command/cicdgen b/scripts/src/main/resources/scripts/command/cicdgen new file mode 100644 index 000000000..900ffb8fa --- /dev/null +++ b/scripts/src/main/resources/scripts/command/cicdgen @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +# shellcheck source=scripts/functions +source "$(dirname "${0}")"/../functions + +# $1: optional setup +function doSetup() { + if command -v cicdgen &> /dev/null || [ "${1}" != "update" ] + then + if [ "${1}" = "setup" ] + then + echo "cicdgen is already installed at $(command -v cicdgen)" + exit + fi + else + doDevonCommand npm -q setup + local npm_command="${DEVON_IDE_HOME}/software/node/npm" + if [ ! -x "${npm_command}" ] + then + npm_command="${DEVON_IDE_HOME}/software/node/bin/npm" + fi + doRunCommand "'${npm_command}' install -g @devonfw/cicdgen@latest" "install cicdgen" + fi +} + +doRunCicdgen() { + doSetup + cicdgen generate "${@}" +} + +function printCicdgenHelp() { + echo "Setup or update cicdgen CLI." + echo + echo "Arguments:" + echo "setup setup cicdgen (install and verify)" + echo "update update cicdgen (reinstall with @latest version and verify)" + echo "java «args» generate cicd files for the currect devon4java project: $PWD" + echo "ng «args» generate cicd files for the currect devon4ng project: $PWD" + echo "node «args» generate cicd files for the currect devon4node project: $PWD" + echo "«args» call cicdgen with the specified arguments" + echo + echo "Options:" + exit +} + +#CLI +case ${1} in +"help" | "-h") + printCicdgenHelp +;; +"setup" | "s") + doSetup setup +;; +"update") + doSetup update +;; +"java") + shift + doRunCicdgen devon4j "${@}" +;; +"ng") + shift + doRunCicdgen devon4ng "${@}" +;; +"node") + shift + doRunCicdgen devon4node "${@}" +;; +*) + doSetup + cicdgen "${@}" +;; +esac \ No newline at end of file diff --git a/scripts/src/main/resources/scripts/command/java b/scripts/src/main/resources/scripts/command/java index 109763dda..65397fed1 100755 --- a/scripts/src/main/resources/scripts/command/java +++ b/scripts/src/main/resources/scripts/command/java @@ -69,6 +69,7 @@ then echo " the current devonfw version (e.g. oasp4j:2.6.0) can not be auto-detected you may provide" echo " it manually after the 'from' argument. Also the 'single' option allows to migrate only to" echo " the next available version." + echo " cicd «args» generate cicd files for the currect project: $PWD" echo echo "Options:" elif [ -z "${1}" ] || [ "${1}" = "setup" ] @@ -83,6 +84,10 @@ elif [ "${1}" = "migrate" ] then shift doMigrate "${@}" +elif [ "${1}" = "cicd" ] +then + shift + doDevonCommand cicdgen java "${*}" else doFail "Unknown argument ${1}" fi diff --git a/scripts/src/main/resources/scripts/command/ng b/scripts/src/main/resources/scripts/command/ng index 9fb5cbd7c..182fe7aa1 100755 --- a/scripts/src/main/resources/scripts/command/ng +++ b/scripts/src/main/resources/scripts/command/ng @@ -28,6 +28,7 @@ then echo echo "Arguments:" echo "setup setup angular-cli (install and verify)" + echo "cicd «args» generate cicd files for the currect devon4ng project: $PWD" echo "«args» call maven with the specified arguments" echo echo "Options:" @@ -42,6 +43,10 @@ then shift doSetup ng new "${@}" +elif [ "${1}" = "cicd" ] +then + shift + doDevonCommand cicdgen ng "${*}" else doSetup ng "${@}" diff --git a/scripts/src/main/resources/scripts/command/node b/scripts/src/main/resources/scripts/command/node index 763950a1b..4b8449c68 100755 --- a/scripts/src/main/resources/scripts/command/node +++ b/scripts/src/main/resources/scripts/command/node @@ -31,6 +31,14 @@ function doSetup() { fi } +function doSetupDevon4node() { + if ! command -v devon4node &> /dev/null + then + doDevonCommand yarn -q setup + doRunCommand "npm install -g @devon4node/cli@latest" "install devon4node" + fi +} + function doRun() { doSetup doEcho "Running: node ${*}" @@ -48,24 +56,42 @@ then fi #CLI -if [ "${1}" = "-h" ] || [ "${1}" = "help" ] -then - echo "Setup or run yarn." +case ${1} in +"help" | "-h") + echo "Setup or run NodeJS." echo echo "Arguments:" - echo " setup setup angular-cli (install and verify)" - echo " get-version get the current project version" - echo " set-version «nv» [«cv»] set the current project version to new version «nv» (assuming current version is «cv»)" - echo " check-top-level-project check if we are running on a top-level project or fail if in a module or no maven project at all" - echo " release start a clean deploy release build" - echo " «args» call maven with the specified arguments" + echo " setup setup NodeJS (install and verify)" + echo " create «name» [«args»] create a new devon4node application (same as devon4node new)" + echo " generate «s» [«args»] generate devon4node components using the schematic «s» (same as devon4node generate)" + echo " db «c» [«args»] execute a TypeORM command «c» (same as devon4node db)" + echo " cicd «args» generate cicd files for the currect devon4node project: $PWD" + echo " «args» call NodeJS with the specified arguments" echo echo "Options:" exit -fi -if [ "${1}" = "setup" ] -then +;; +"setup" | "s") doSetup setup -else +;; +"create" | "c") + shift + doSetupDevon4node + devon4node new "${@}" +;; +"generate" | "g") + doSetupDevon4node + devon4node "${@}" +;; +"db") + doSetupDevon4node + devon4node "${@}" +;; +"cicd") + shift + doDevonCommand cicdgen node "${*}" +;; +*) doRun "${*}" -fi +;; +esac \ No newline at end of file