Skip to content
Merged
19 changes: 19 additions & 0 deletions documentation/cicdgen.asciidoc
Original file line number Diff line number Diff line change
@@ -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
Comment thread
dario-rodriguez marked this conversation as resolved.
|`«args»` |call cicdgen with the specified arguments
|=======================
1 change: 1 addition & 0 deletions documentation/java.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
70 changes: 35 additions & 35 deletions documentation/master-ide.asciidoc
Original file line number Diff line number Diff line change
@@ -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]


1 change: 1 addition & 0 deletions documentation/ng.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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»`)
|=======================
5 changes: 5 additions & 0 deletions documentation/node.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
|=======================
72 changes: 72 additions & 0 deletions scripts/src/main/resources/scripts/command/cicdgen
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions scripts/src/main/resources/scripts/command/java
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
Expand All @@ -83,6 +84,10 @@ elif [ "${1}" = "migrate" ]
then
shift
doMigrate "${@}"
elif [ "${1}" = "cicd" ]
then
shift
doDevonCommand cicdgen java "${*}"
else
doFail "Unknown argument ${1}"
fi
5 changes: 5 additions & 0 deletions scripts/src/main/resources/scripts/command/ng
Original file line number Diff line number Diff line change
Expand Up @@ -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:"
Expand All @@ -42,6 +43,10 @@ then
shift
doSetup
ng new "${@}"
elif [ "${1}" = "cicd" ]
then
shift
doDevonCommand cicdgen ng "${*}"
else
doSetup
ng "${@}"
Expand Down
54 changes: 40 additions & 14 deletions scripts/src/main/resources/scripts/command/node
Original file line number Diff line number Diff line change
Expand Up @@ -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 ${*}"
Expand All @@ -48,24 +56,42 @@ then
fi

#CLI
if [ "${1}" = "-h" ] || [ "${1}" = "help" ]
then
echo "Setup or run yarn."
case ${1} in
"help" | "-h")
Comment thread
dario-rodriguez marked this conversation as resolved.
echo "Setup or run NodeJS."
Comment thread
dario-rodriguez marked this conversation as resolved.
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