├── .gitignore ├── scripts ├── oos │ ├── tests │ │ ├── .gitignore │ │ ├── inheritance │ │ │ ├── ClassB.class.sh │ │ │ ├── ClassA.class.sh │ │ │ └── _test.sh │ │ ├── instances │ │ │ ├── LogEntry.class.sh │ │ │ └── _test.sh │ │ ├── clouds │ │ │ ├── clouds.sh │ │ │ └── _test.sh │ │ ├── installer │ │ │ └── _test.sh │ │ └── performance.sh │ ├── core │ │ ├── ClassObj.class.sh │ │ ├── json.sh │ │ └── transpiler-consts.sh │ ├── graphics │ │ ├── Animator2D.class.sh │ │ ├── Drawable2D.class.sh │ │ ├── Canvas2DS.class.sh │ │ ├── Engine2DS.class.sh │ │ ├── Canvas2D.class.sh │ │ └── Engine2D.class.sh │ └── utils │ │ └── InstallerDMG.class.sh ├── ._tests │ ├── file │ │ ├── .gitignore │ │ └── file.sh │ ├── core │ │ ├── folders.sh │ │ ├── string.sh │ │ └── spinner.sh │ ├── prompt │ │ └── user-choice.sh │ ├── errors.sh │ ├── pnpm │ │ └── pnpm.sh │ ├── string │ │ └── replace-all.sh │ ├── versioning.sh │ ├── array │ │ └── array.sh │ └── _tests.sh ├── firebase │ └── core.sh ├── dev │ ├── typescript-oo │ │ ├── templates │ │ │ ├── firebase_configs │ │ │ │ ├── firestore.indexes.json │ │ │ │ ├── database.rules.json │ │ │ │ ├── firestore.rules │ │ │ │ └── storage.rules │ │ │ ├── colors.ts │ │ │ ├── fonts.tsx │ │ │ └── icons.tsx │ │ ├── utils │ │ │ ├── typedoc.json │ │ │ └── .eslintrc.js │ │ ├── classes │ │ │ └── ExecutablePackage.class.sh │ │ └── _core │ │ │ ├── common.sh │ │ │ └── modules.sh │ ├── android-oo │ │ ├── classes │ │ │ ├── AndroidDeviceBridge.class.sh │ │ │ ├── AndroidApp.class.sh │ │ │ ├── AndroidDevice.class.sh │ │ │ └── GradleWorkspace.class.sh │ │ └── build-and-install.sh │ ├── build-and-install.sh │ ├── install-system.sh │ ├── align-branch.sh │ ├── docs │ │ └── generate-sidebar.sh │ ├── search-logs.sh │ └── dev-aliases.sh ├── android │ ├── oem-disply-hdmi.sh │ ├── _source.sh │ └── tools.sh ├── setup │ └── my-mac.sh ├── .examples │ ├── sandbox │ │ └── process-killer.sh │ ├── colors_and_formatting.sh │ └── 256-colors.sh ├── ci │ ├── jira │ │ ├── _core.sh │ │ ├── versions.sh │ │ └── JiraVersion.class.sh │ ├── android │ │ └── _source.sh │ └── thunderstorm │ │ ├── params.sh │ │ └── build-and-deploy.sh ├── _core-tools │ ├── shell.sh │ ├── time.sh │ ├── folder-filters.sh │ ├── _source.sh │ ├── google-drive.sh │ ├── number-tools.sh │ ├── signature.sh │ └── spinner.sh ├── node │ ├── pnpm │ │ └── pnpm.sh │ ├── node.sh │ ├── _source.sh │ ├── npm.sh │ ├── firebase.sh │ └── nvm.sh ├── jenkins │ ├── upgrade.sh │ ├── installation.sh │ ├── _setup-clone-jobs.sh │ ├── _upgrade.sh │ └── _setup-jenkins.sh ├── git │ ├── git-drop-stash.sh │ ├── fix-submodules.sh │ ├── git-prune.sh │ ├── git-status.sh │ ├── git-reset.sh │ └── git-fork.sh ├── server │ ├── copy-to-remote.sh │ └── copy-from-remote.sh ├── build │ └── upload-to-drive.sh ├── utils │ ├── create-ssl-cert.sh │ └── generate-ssl-cert.sh ├── animation │ └── animator.sh ├── python │ └── python3.sh └── to-sort │ └── scale-images.sh ├── .jenkins └── tests │ ├── slack-upload-file │ ├── dummy-file.txt │ └── run.groovy │ ├── templater │ ├── expected-output.txt │ ├── test-template.txt │ └── run.groovy │ ├── write-console-logs │ └── run.groovy │ └── test-ts-child-process │ ├── run.groovy │ └── test.ts ├── settings ├── formatter.jar ├── key-maps.jar ├── settings.jar ├── key-maps-mac.jar ├── color-Syntaxing.jar └── latest-intellij.zip ├── all-intellij-settings ├── settings.zip ├── file-template--proto-v3.zip └── file-templates--2024-01.zip ├── src └── com │ └── nu │ └── art │ ├── pipeline │ ├── IShell.groovy │ ├── interfaces │ │ ├── Getter.groovy │ │ └── Shell.groovy │ ├── modules │ │ ├── git │ │ │ ├── models │ │ │ │ ├── GitStatus_Job.groovy │ │ │ │ ├── GitStatus.groovy │ │ │ │ ├── GitStatus_Repo.groovy │ │ │ │ └── GitChangeLog.groovy │ │ │ ├── GitRepoChangeSet.groovy │ │ │ ├── GitRepoConfig.groovy │ │ │ └── Cli.groovy │ │ ├── jira │ │ │ └── JiraModule.groovy │ │ ├── build │ │ │ ├── JobParam.groovy │ │ │ ├── CopyArtifacts.groovy │ │ │ ├── JobTrigger.groovy │ │ │ └── TriggerCause.groovy │ │ ├── gcpBucket │ │ │ └── GCP_Bucket.groovy │ │ └── docker │ │ │ ├── DockerModule.groovy │ │ │ ├── DockerConfig.groovy │ │ │ └── Docker.groovy │ ├── workflow │ │ ├── variables │ │ │ ├── IVar_Cli.groovy │ │ │ ├── VarConsts.groovy │ │ │ ├── Var_Creds.groovy │ │ │ ├── Var_Env.groovy │ │ │ └── Var_Cli.groovy │ │ ├── OnPipelineListener.groovy │ │ ├── WorkflowProcessor.groovy │ │ ├── WorkflowModulesPack.groovy │ │ ├── logs │ │ │ ├── Config_WorkflowLogger.groovy │ │ │ ├── ANSI_Colors.groovy │ │ │ └── WorkflowLogger.groovy │ │ ├── utils │ │ │ └── Utils.groovy │ │ ├── WorkflowModule.groovy │ │ ├── BasePipeline.groovy │ │ └── Pipeline_BaseProxy.groovy │ ├── thunderstorm │ │ ├── models │ │ │ ├── VersionApp.groovy │ │ │ ├── ProjectEnvConfig.groovy │ │ │ └── ProjectGitConfig.groovy │ │ ├── Pipeline_ThunderstormApp.groovy │ │ ├── Pipeline_PromoteThunderstorm.groovy │ │ ├── Pipeline_ThunderstormMain.groovy │ │ ├── Pipeline_ThunderstormWebApp.groovy │ │ ├── Pipeline_ThunderstormWebProject.groovy │ │ └── Pipeline_ThunderstormWebProject_V2.groovy │ ├── exceptions │ │ └── BadImplementationException.groovy │ └── README.md │ └── utils │ ├── Colors.groovy │ └── StringTemplateReplacer.groovy ├── typescript ├── tsconfig-lib-test.json ├── tsconfig-lib-sw.json ├── tsconfig-lib-tsx.json └── tsconfig-lib-ts.json ├── README.md └── gradle ├── code-analysis.gradle ├── version-bump-tasks.gradle ├── common-cyborg-lib.gradle ├── common-cyborg-app.gradle └── deploy-artifacts-nexus.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | dev-tools -------------------------------------------------------------------------------- /scripts/oos/tests/.gitignore: -------------------------------------------------------------------------------- 1 | output -------------------------------------------------------------------------------- /scripts/._tests/file/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | output -------------------------------------------------------------------------------- /scripts/firebase/core.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | -------------------------------------------------------------------------------- /.jenkins/tests/slack-upload-file/dummy-file.txt: -------------------------------------------------------------------------------- 1 | Hello World -------------------------------------------------------------------------------- /settings/formatter.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nu-art/dev-tools/HEAD/settings/formatter.jar -------------------------------------------------------------------------------- /settings/key-maps.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nu-art/dev-tools/HEAD/settings/key-maps.jar -------------------------------------------------------------------------------- /settings/settings.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nu-art/dev-tools/HEAD/settings/settings.jar -------------------------------------------------------------------------------- /settings/key-maps-mac.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nu-art/dev-tools/HEAD/settings/key-maps-mac.jar -------------------------------------------------------------------------------- /settings/color-Syntaxing.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nu-art/dev-tools/HEAD/settings/color-Syntaxing.jar -------------------------------------------------------------------------------- /settings/latest-intellij.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nu-art/dev-tools/HEAD/settings/latest-intellij.zip -------------------------------------------------------------------------------- /.jenkins/tests/templater/expected-output.txt: -------------------------------------------------------------------------------- 1 | This is a lovely file with a few examples of 2 | friendly parameters -------------------------------------------------------------------------------- /all-intellij-settings/settings.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nu-art/dev-tools/HEAD/all-intellij-settings/settings.zip -------------------------------------------------------------------------------- /.jenkins/tests/templater/test-template.txt: -------------------------------------------------------------------------------- 1 | This is a {{TEST1}} file with a few {{PLACEHOLDER=examples of}} 2 | {{PARAM}} parameters -------------------------------------------------------------------------------- /scripts/dev/typescript-oo/templates/firebase_configs/firestore.indexes.json: -------------------------------------------------------------------------------- 1 | { 2 | "indexes": [], 3 | "fieldOverrides": [] 4 | } -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/IShell.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline 2 | 3 | interface IShell { 4 | 5 | T sh(String command); 6 | } 7 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/interfaces/Getter.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.interfaces 2 | 3 | interface Getter { 4 | T get() 5 | } -------------------------------------------------------------------------------- /scripts/android/oem-disply-hdmi.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | adb reboot bootloader 4 | fastboot oem select-display-panel hdmi 5 | fastboot reboot -------------------------------------------------------------------------------- /all-intellij-settings/file-template--proto-v3.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nu-art/dev-tools/HEAD/all-intellij-settings/file-template--proto-v3.zip -------------------------------------------------------------------------------- /all-intellij-settings/file-templates--2024-01.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nu-art/dev-tools/HEAD/all-intellij-settings/file-templates--2024-01.zip -------------------------------------------------------------------------------- /scripts/dev/typescript-oo/templates/firebase_configs/database.rules.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | ".read": false, 4 | ".write": false 5 | } 6 | } 7 | 8 | -------------------------------------------------------------------------------- /scripts/setup/my-mac.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source ${BASH_SOURCE%/*}/../_core-tools/_source.sh 4 | installBash 5 | brew install node@8 6 | brew install mongodb 7 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/interfaces/Shell.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.interfaces 2 | 3 | interface Shell { 4 | T sh(String command, Boolean returnStdout) 5 | } -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/modules/git/models/GitStatus_Job.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.modules.git.models 2 | 3 | class GitStatus_Job 4 | extends HashMap { 5 | } 6 | -------------------------------------------------------------------------------- /scripts/dev/typescript-oo/utils/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "entryPointStrategy": "resolve", 3 | "logLevel": "Warn", 4 | "categorizeByGroup": true, 5 | "excludeNotDocumented": true, 6 | "out": "docs" 7 | } -------------------------------------------------------------------------------- /scripts/oos/tests/inheritance/ClassB.class.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ClassB() { 4 | extends class ClassA 5 | 6 | declare memberB 7 | 8 | _toSomthing() { 9 | echo "doing something" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /typescript/tsconfig-lib-test.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": true, 4 | "module": "commonjs", 5 | "sourceMap": true, 6 | "strict": true, 7 | "target": "es6" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /typescript/tsconfig-lib-sw.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig-lib-ts.json", 3 | "compilerOptions": { 4 | "lib": [ 5 | "es5", 6 | "es6", 7 | "es7", 8 | "webworker" 9 | ] 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/modules/jira/JiraModule.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.modules.jira 2 | 3 | import com.nu.art.pipeline.workflow.WorkflowModule 4 | 5 | class JiraModule 6 | extends WorkflowModule { 7 | 8 | 9 | } 10 | -------------------------------------------------------------------------------- /scripts/oos/tests/inheritance/ClassA.class.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ClassA() { 4 | 5 | declare logMessage 6 | declare logLevel=Error 7 | 8 | _printLog() { 9 | log${logLevel} "${logMessage}" 10 | } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /scripts/oos/tests/instances/LogEntry.class.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | LogEntry() { 4 | declare logMessage 5 | declare logLevel=Error 6 | 7 | _printLog() { 8 | log${logLevel} "${logMessage}" 9 | } 10 | } 11 | 12 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/workflow/variables/IVar_Cli.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.workflow.variables 2 | 3 | import com.nu.art.pipeline.interfaces.Getter 4 | 5 | 6 | interface IVar_Cli 7 | extends Getter { 8 | 9 | String key() 10 | } -------------------------------------------------------------------------------- /scripts/dev/typescript-oo/templates/firebase_configs/firestore.rules: -------------------------------------------------------------------------------- 1 | rules_version = '2'; 2 | service cloud.firestore { 3 | match /databases/{database}/documents { 4 | match /{document=**} { 5 | allow read, write: if false; 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /scripts/dev/typescript-oo/templates/firebase_configs/storage.rules: -------------------------------------------------------------------------------- 1 | rules_version = '2'; 2 | service firebase.storage { 3 | match /b/{bucket}/o { 4 | match /{allPaths=**} { 5 | allow read, write: if request.auth!=null; 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /scripts/oos/core/ClassObj.class.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ClassObj() { 4 | 5 | declare parents 6 | declare class 7 | declare rawClass 8 | declare members 9 | declare staticMembers 10 | declare methods 11 | declare defaultValues 12 | } 13 | 14 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/thunderstorm/models/VersionApp.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.thunderstorm.models 2 | 3 | class VersionApp { 4 | VersionApp() { 5 | } 6 | 7 | VersionApp(String version) { 8 | this.version = version 9 | } 10 | 11 | String version 12 | } 13 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/workflow/OnPipelineListener.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.workflow 2 | 3 | interface OnPipelineListener { 4 | void onPipelineStarted() 5 | 6 | void onPipelineAborted() 7 | 8 | void onPipelineFailed(Throwable e) 9 | 10 | void onPipelineSuccess() 11 | } -------------------------------------------------------------------------------- /scripts/.examples/sandbox/process-killer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | killProcess() { 4 | logInfo "Killing processes ${*:2}" 5 | kill "-${1}" "${@:2}" 6 | trap "logWarning \"Wait for graceful exit... of ${*:2}\"" SIGINT 7 | wait "${@:2}" 8 | logDebug "Processes killed ${*:2}" 9 | trap - SIGINT 10 | } 11 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/workflow/WorkflowProcessor.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.workflow 2 | 3 | import com.cloudbees.groovy.cps.NonCPS 4 | import com.nu.art.core.generics.Processor 5 | 6 | class WorkflowProcessor 7 | implements Processor { 8 | 9 | @NonCPS 10 | @Override 11 | void process(T t) {} 12 | } -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/modules/git/models/GitStatus.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.modules.git.models 2 | 3 | class GitStatus { 4 | String branch 5 | String commitId 6 | 7 | GitStatus(String branch, String commitId) { 8 | this.branch = branch 9 | this.commitId = commitId 10 | } 11 | 12 | GitStatus() {} 13 | } 14 | -------------------------------------------------------------------------------- /typescript/tsconfig-lib-tsx.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig-lib-ts.json", 3 | "esModuleInterop": true, 4 | "module": "ES2020", 5 | "compilerOptions": { 6 | "target": "es2017", 7 | "jsx": "react", 8 | "lib": [ 9 | "es5", 10 | "es6", 11 | "es7", 12 | "dom" 13 | ] 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/modules/git/models/GitStatus_Repo.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.modules.git.models 2 | 3 | class GitStatus_Repo 4 | extends HashMap { 5 | 6 | String repoUrl 7 | 8 | GitStatus_Repo(String repoUrl) { 9 | this.repoUrl = repoUrl 10 | 11 | } 12 | 13 | GitStatus_Repo() {} 14 | } 15 | -------------------------------------------------------------------------------- /scripts/ci/jira/_core.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | JIRA_USER= 3 | JIRA_TOKEN= 4 | 5 | [[ `type -t addTranspilerClassPath` != 'function' ]] && throwError "Must source './dev-tools/scripts/oos/core/transpiler.sh' in order to use this api" 4 6 | addTranspilerClassPath ${BASH_SOURCE%/*} 7 | 8 | setJiraAuth() { 9 | JIRA_USER=${1} 10 | JIRA_TOKEN=${2} 11 | } 12 | -------------------------------------------------------------------------------- /scripts/dev/typescript-oo/templates/colors.ts: -------------------------------------------------------------------------------- 1 | // empty line 2 | COLORS_DECLARATION; 3 | 4 | function calculateColorWithAlpha(color: string, alpha: number = 1) { 5 | return color + (255 - Math.round(((1 - alpha) * 256) % 256)).toString(16); 6 | } 7 | 8 | export const COLORS = { 9 | 10 | COLORS_USAGE 11 | }; 12 | 13 | export type ColorsType = typeof COLORS -------------------------------------------------------------------------------- /scripts/dev/typescript-oo/templates/fonts.tsx: -------------------------------------------------------------------------------- 1 | 2 | 3 | function fontRenderer(text: string, fontFamily: string, color: string = '#000000', fontSize: number = 16) { 4 | return
{text}
; 5 | } 6 | 7 | export const FONTS = { 8 | FONTS_USAGE 9 | }; 10 | 11 | export type FontsType = typeof FONTS -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/workflow/WorkflowModulesPack.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.workflow 2 | 3 | import com.nu.art.modular.core.Module 4 | import com.nu.art.modular.core.ModulesPack 5 | 6 | abstract class WorkflowModulesPack 7 | extends ModulesPack { 8 | 9 | WorkflowModulesPack(Class... moduleTypes) { 10 | super(moduleTypes) 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/workflow/variables/VarConsts.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.workflow.variables 2 | 3 | class VarConsts { 4 | public static Var_Env Var_JenkinsHome 5 | public static Var_Env Var_JobName 6 | public static Var_Env Var_BuildNumber 7 | public static Var_Env Var_User 8 | public static Var_Env Var_BuildUrl 9 | public static Var_Env Var_Workspace 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/workflow/logs/Config_WorkflowLogger.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.workflow.logs 2 | 3 | import com.nu.art.belog.BeConfig 4 | 5 | class Config_WorkflowLogger extends BeConfig.LoggerConfig { 6 | static final String KEY = WorkflowLogger.class.getSimpleName() 7 | 8 | Config_WorkflowLogger() { 9 | super(KEY) 10 | setKey("default") 11 | } 12 | } 13 | //yo -------------------------------------------------------------------------------- /scripts/.examples/colors_and_formatting.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Background 4 | for clbg in {40..47} {100..107} 49 ; do 5 | #Foreground 6 | for clfg in {30..37} {90..97} 39 ; do 7 | #Formatting 8 | for attr in 0 1 2 4 5 7 ; do 9 | #Print the result 10 | echo -en "\e[${attr};${clbg};${clfg}m ^[${attr};${clbg};${clfg}m \e[0m" 11 | done 12 | echo #Newline 13 | done 14 | done 15 | 16 | exit 0 -------------------------------------------------------------------------------- /typescript/tsconfig-lib-ts.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": true, 4 | "lib": [ 5 | "es5", 6 | "es6", 7 | "es7" 8 | ], 9 | "experimentalDecorators": true, 10 | "moduleResolution": "node", 11 | "noUnusedLocals": true, 12 | "module": "commonjs", 13 | "sourceMap": true, 14 | "strict": true, 15 | "target": "es6" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /scripts/dev/typescript-oo/classes/ExecutablePackage.class.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ExecutablePackage() { 4 | extends class NodePackage 5 | 6 | _launch() { 7 | [[ ! "$(array_contains "${folderName}" "${ts_launch[@]}")" ]] && return 8 | 9 | logInfo "Launching: ${folderName}" 10 | node "./${outputDir}/"${ts_fileToExecute} 11 | throwError "execution failed ./${outputDir}/${ts_fileToExecute}" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/modules/build/JobParam.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.modules.build 2 | 3 | public class JobParam { 4 | public static JobParam Param_String = new JobParam("StringParameterValue") 5 | public static JobParam Param_Boolean = new JobParam("BooleanParameterValue") 6 | 7 | public final String key 8 | 9 | JobParam(String key) { 10 | this.key = key 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /scripts/.examples/256-colors.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for fgbg in 38 48 ; do # Foreground / Background 4 | for color in {0..255} ; do # Colors 5 | # Display the color 6 | printf "\e[${fgbg};5;%sm %3s \e[0m" $color $color 7 | # Display 6 colors per lines 8 | if [ $((($color + 1) % 6)) == 4 ] ; then 9 | echo # New line 10 | fi 11 | done 12 | echo # New line 13 | done 14 | 15 | exit 0 -------------------------------------------------------------------------------- /scripts/_core-tools/shell.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | shell.getFileRC() { 4 | if [ "$SHELL" == "" ]; then 5 | echo "${HOME}/.profile" 6 | elif [ -n "$($SHELL -c 'echo $ZSH_VERSION')" ]; then 7 | echo "${HOME}/.zshrc" 8 | elif [ -n "$($SHELL -c 'echo $BASH_VERSION')" ]; then 9 | echo "${HOME}/.bashrc" 10 | else 11 | throwError "unknown shell: $SHELL" 2 12 | fi 13 | } 14 | 15 | shell.version() { 16 | $SHELL --version 17 | } 18 | -------------------------------------------------------------------------------- /scripts/oos/graphics/Animator2D.class.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | Animator2D() { 4 | 5 | declare startFrame 6 | declare endFrame 7 | declare drawable 8 | declare interpolatorX 9 | declare interpolatorY 10 | 11 | _calculateX() { 12 | setVariable ${1} `eval "echo \"${interpolatorX}\"" | bc`; 13 | } 14 | 15 | _calculateY() { 16 | setVariable ${1} `eval "echo \"${interpolatorY}\"" | bc`; 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/workflow/utils/Utils.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.workflow.utils 2 | 3 | 4 | import groovy.json.JsonSlurper 5 | 6 | class Utils { 7 | 8 | static String parseJson(String jsonAsString) { 9 | return new JsonSlurper().parseText(jsonAsString) 10 | } 11 | 12 | static T parse(String jsonAsString, Closure converter = { it }) { 13 | return converter(new JsonSlurper().parseText(jsonAsString)) 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | A collection of development tools I use wherever I go that save me a ton of valuable time: 2 | 3 | * A collection of bash infra tools 4 | * Git repo lifecycle with nested submodules handling 5 | * Build - Install - Deploy android apps from terminal (I am not the biggest fan of launching via Studio) 6 | * CI bash tools for project and version 7 | 8 | * Gradle build and deploy utility scripts 9 | 10 | 11 | * My personal Intellij formatter and settings 12 | -------------------------------------------------------------------------------- /scripts/ci/jira/versions.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | jiraCreateNewVersion() { 4 | local projectId=${1} 5 | local version=${2} 6 | local description=${3} 7 | local released=${4} 8 | local archived=${5} 9 | 10 | curl --request POST \ 11 | --url "https://introb.atlassian.net/rest/api/3/version" \ 12 | --user "${JIRA_USER}:${JIRA_TOKEN}" 13 | --data "{\"\":}" 14 | } 15 | 16 | curl --request DELETE \ 17 | --url '/rest/api/3/version/{id}' \ 18 | --user 'email@example.com:' 19 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/exceptions/BadImplementationException.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.exceptions; 2 | 3 | public class BadImplementationException 4 | extends Exception { 5 | 6 | BadImplementationException() { 7 | } 8 | 9 | BadImplementationException(String message) { 10 | super(message) 11 | } 12 | 13 | BadImplementationException(String message, Throwable cause) { 14 | super(message, cause) 15 | } 16 | 17 | BadImplementationException(Throwable cause) { 18 | super(cause) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/modules/gcpBucket/GCP_Bucket.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.modules.gcpBucket 2 | 3 | 4 | import com.nu.art.pipeline.workflow.WorkflowModule 5 | 6 | class GCP_Bucket 7 | extends WorkflowModule { 8 | 9 | 10 | @Override 11 | void _init() { 12 | // TODO check if gsutils is installed 13 | // TODO check that google credentials exist 14 | // ... 15 | 16 | } 17 | 18 | void copyArtifactToBucket(String localPath, String bucketPath) { 19 | workflow.sh "gsutil cp ${localPath} gs://${env.GCS_BUCKET}/${bucketPath}" 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /scripts/oos/tests/clouds/clouds.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | _cloud1() { 5 | echo -e " _ 6 | (\` ). 7 | ( ). 8 | ( ( '\`. 9 | ( ) . ) 10 | (..__.:'--''" 11 | 12 | } 13 | 14 | _cloud2() { 15 | echo -e " .-- 16 | ( ) 17 | ( . ) 18 | ( ( )) 19 | \`- __.'" 20 | } 21 | 22 | _cloud3() { 23 | echo -e " __ _ 24 | _( )_( )_ 25 | (_ _ _) 26 | (_) (__)" 27 | } 28 | 29 | _cloud4() { 30 | echo -e " _ 31 | .:(\` )\`. 32 | :( . ) 33 | \`. ( ) ) 34 | \` _\` ) ) 35 | ( ) 36 | \`-'" 37 | } 38 | -------------------------------------------------------------------------------- /src/com/nu/art/utils/Colors.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.utils 2 | 3 | class Colors { 4 | static String randomColor() { 5 | return "#${UUID.randomUUID().toString().replace("-", "").substring(0, 6)}" 6 | } 7 | 8 | public static String LightGray = "#DDDDDD" 9 | public static String Gray = "#AAAAAA" 10 | public static String DarkGray = "#666666" 11 | public static String Blue = "#0774E0" 12 | public static String LightBlue = "#C2E5FF" 13 | public static String Red = "#C70700" 14 | public static String Yellow = "#F5C242" 15 | public static String Green = "#18A100" 16 | } 17 | -------------------------------------------------------------------------------- /scripts/oos/tests/inheritance/_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source "${BASH_SOURCE%/*}/../../core/transpiler.sh" 4 | 5 | CONST_Debug=true 6 | addTranspilerClassPath "${BASH_SOURCE%/*}" 7 | 8 | new ClassA logEntry1 9 | new ClassA logEntry2 10 | new ClassB logEntry3 11 | 12 | logEntry3.logMessage = "print log with default error level" 13 | logEntry1.logMessage = "This will be a Debug log" 14 | logEntry2.logMessage = "This will be a Warning log" 15 | # 16 | logEntry3.printLog 17 | logEntry2.logLevel = "Warning" 18 | logEntry2.printLog 19 | # 20 | logEntry1.logLevel = "Debug" 21 | logEntry1.printLog 22 | -------------------------------------------------------------------------------- /scripts/oos/tests/instances/_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source ${BASH_SOURCE%/*}/../../core/transpiler.sh 4 | 5 | CONST_Debug=true 6 | setTranspilerOutput ${BASH_SOURCE%/*} 7 | addTranspilerClassPath ${BASH_SOURCE%/*} 8 | 9 | new LogEntry logEntry1 10 | new LogEntry logEntry2 11 | new LogEntry logEntry3 12 | 13 | 14 | logEntry3.logMessage = "print log with default error level" 15 | logEntry1.logMessage = "This will be a Debug log" 16 | logEntry2.logMessage = "This will be a Warning log" 17 | 18 | logEntry3.printLog 19 | logEntry2.logLevel = "Warning" 20 | logEntry2.printLog 21 | 22 | logEntry1.logLevel = "Debug" 23 | logEntry1.printLog 24 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/modules/git/models/GitChangeLog.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.modules.git.models 2 | 3 | 4 | import java.text.SimpleDateFormat 5 | 6 | class GitChangeLog { 7 | final String hash 8 | final Date date 9 | final String author 10 | final String comment 11 | 12 | GitChangeLog(String commit) { 13 | def result = (commit =~ /^([0-9a-f]{5,}) ([0-9: \+-]{25}) "(.*?)" (.*)$/) 14 | hash = result[0][1] 15 | date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss zzz").parse(result[0][2]) 16 | author = result[0][3] 17 | comment = result[0][4] 18 | } 19 | 20 | String[] findPattern(String pattern) { 21 | return (comment =~ pattern)?.collect({ it }) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /scripts/oos/tests/installer/_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source "${BASH_SOURCE%/*}/../../core/transpiler.sh" 4 | 5 | CONST_Debug=true 6 | addTranspilerClassPath "${BASH_SOURCE%/*}/../../utils" 7 | 8 | new InstallerDMG Docker 9 | new InstallerDMG Spectacle 10 | 11 | 12 | Docker.label = "Docker" 13 | Docker.outputFile = "docker.dmg" 14 | Docker.downloadUrl = "https://download.docker.com/mac/stable/Docker.dmg" 15 | 16 | Spectacle.label = "Spectacle" 17 | Spectacle.inZipFile = "Spectacle.app" 18 | Spectacle.requiresMount = 19 | Spectacle.outputFile = "Spectacle.zip" 20 | Spectacle.downloadUrl = "https://s3.amazonaws.com/spectacle/downloads/Spectacle+1.2.zip" 21 | 22 | Spectacle.install 23 | Docker.install 24 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/workflow/variables/Var_Creds.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.workflow.variables 2 | 3 | 4 | import com.nu.art.pipeline.interfaces.Getter 5 | 6 | class Var_Creds 7 | implements Getter { 8 | 9 | final String type 10 | final String id 11 | final Var_Env envVar 12 | 13 | Var_Creds(String type, String id) { 14 | this(type, id, null) 15 | } 16 | 17 | Var_Creds(String type, String id, Var_Env envVar) { 18 | this.type = type 19 | this.id = id 20 | this.envVar = envVar 21 | } 22 | 23 | @Override 24 | String get() { 25 | return envVar.get() 26 | } 27 | 28 | Object toCredential(def script) { 29 | return script."$type"(credentialsId: id, variable: envVar.varName) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /scripts/dev/typescript-oo/utils/.eslintrc.js: -------------------------------------------------------------------------------- 1 | // FROM DEV-TOOLS 2 | 3 | module.exports = { 4 | root: true, 5 | "env": { 6 | "es6": true, 7 | "node": true 8 | }, 9 | "extends": [ 10 | "eslint:recommended", 11 | "plugin:@typescript-eslint/eslint-recommended" 12 | ], 13 | "globals": { 14 | "Atomics": "readonly", 15 | "SharedArrayBuffer": "readonly" 16 | }, 17 | "parser": "@typescript-eslint/parser", 18 | "parserOptions": { 19 | "ecmaVersion": 2018, 20 | "sourceType": "module" 21 | }, 22 | "plugins": [ 23 | "@typescript-eslint" 24 | ], 25 | "rules": { 26 | "no-mixed-spaces-and-tabs": "off", 27 | "no-unused-vars": "off", 28 | "no-useless-escape": "off", 29 | "no-inferrable-types": "off", 30 | "no-unnecessary-type-constraint": "off", 31 | } 32 | }; -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/thunderstorm/Pipeline_ThunderstormApp.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.thunderstorm 2 | 3 | import com.nu.art.pipeline.workflow.WorkflowModule 4 | 5 | class Pipeline_ThunderstormApp 6 | extends Pipeline_ThunderstormCore { 7 | 8 | Pipeline_ThunderstormApp(GString name, Class... modules = []) { 9 | this(name.toString(), modules) 10 | } 11 | 12 | Pipeline_ThunderstormApp(String name, Class... modules = []) { 13 | super(name, modules) 14 | } 15 | 16 | Pipeline_ThunderstormApp(Class... modules = []) { 17 | super(modules) 18 | } 19 | 20 | void preparePipeline() { 21 | checkout() 22 | install() 23 | } 24 | 25 | void pipeline() { 26 | preparePipeline() 27 | } 28 | } -------------------------------------------------------------------------------- /scripts/dev/typescript-oo/_core/common.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | CONST_FrontendIconsPath="src/main/res/icons" 4 | CONST_FrontendIconsFile="icons.tsx" 5 | CONST_FrontendFontsPath="src/main/res/fonts" 6 | CONST_FrontendFontsFile="fonts.tsx" 7 | CONST_FrontendColorsPath="src/main/res" 8 | CONST_FrontendColorsFile="colors.ts" 9 | 10 | copyConfigFile() { 11 | local filePattern=${1} 12 | local targetFile=${2} 13 | 14 | local envs=(${@:3}) 15 | 16 | for env in ${envs[@]}; do 17 | local envConfigFile=${filePattern//ENV_TYPE/${env}} 18 | [[ ! -e "${envConfigFile}" ]] && continue 19 | 20 | logDebug "Setting ${targetFile} from env: ${env}" 21 | cp "${envConfigFile}" "${targetFile}" 22 | return 0 23 | done 24 | 25 | throwError "Could not find a match for target file: ${targetFile} in envs: ${envs[@]}" 2 26 | } 27 | -------------------------------------------------------------------------------- /scripts/dev/android-oo/classes/AndroidDeviceBridge.class.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | AndroidDeviceBridge() { 4 | declare -a devices 5 | 6 | _isDeviceRegistered() { 7 | local serial=${1} 8 | 9 | for device in ${devices[@]}; do 10 | [[ "$("${device}.serial")" == "${serial}" ]] && echo true && return 11 | done 12 | } 13 | 14 | _detectDevices() { 15 | local output=$(adb devices | grep -E "[A-Za-z0-9.:].*" ) 16 | while IFS= read -r deviceLine; do 17 | local deviceRef=device${#devices[@]} 18 | lcoal serial="$(echo "${deviceLine}" | sed -E "s/(.*) .*/\1/")" 19 | [[ $(this.isDeviceRegistered "${serial}") ]] && continue 20 | 21 | new AndroidDevice "${deviceRef}" 22 | "${deviceRef}.serial" = "${serial}" 23 | devices+=("${deviceRef}") 24 | done <<< "$output" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/thunderstorm/models/ProjectEnvConfig.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.thunderstorm.models 2 | 3 | class ProjectEnvConfig { 4 | String webAppUrl 5 | String firebaseProjectUrl 6 | 7 | ProjectEnvConfig(String projectId) { 8 | this.webAppUrl = "https://${projectId}.firebaseapp.com" 9 | this.firebaseProjectUrl = "https://console.firebase.google.com/project/${projectId}" 10 | } 11 | 12 | ProjectEnvConfig(String webAppUrl, String firebaseProjectUrl) { 13 | this.webAppUrl = webAppUrl 14 | this.firebaseProjectUrl = firebaseProjectUrl 15 | } 16 | 17 | public setWebAppUrl(String webAppUrl) { 18 | this.webAppUrl = webAppUrl 19 | return this 20 | } 21 | 22 | public setFirebaseProjectUrl(String firebaseProjectUrl) { 23 | this.firebaseProjectUrl = firebaseProjectUrl 24 | return this 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/thunderstorm/models/ProjectGitConfig.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.thunderstorm.models 2 | 3 | class ProjectGitConfig { 4 | String httpUrl 5 | String gitRepoUri 6 | Boolean scm 7 | 8 | ProjectGitConfig(String repoId, scm = false) { 9 | this("https://github.com/${repoId}", "git@github.com:${repoId}.git") 10 | } 11 | 12 | ProjectGitConfig(String httpUrl, String gitRepoUri, Boolean scm = false) { 13 | this.httpUrl = httpUrl 14 | this.gitRepoUri = gitRepoUri 15 | this.scm = scm 16 | } 17 | 18 | public setHttpUrl(String httpUrl) { 19 | this.httpUrl = httpUrl 20 | return this 21 | } 22 | 23 | public setGitRepoUri(String gitRepoUri) { 24 | this.gitRepoUri = gitRepoUri 25 | return this 26 | } 27 | 28 | public setSCM(String scm) { 29 | this.scm = scm 30 | return this 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/workflow/WorkflowModule.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.workflow 2 | 3 | import com.cloudbees.groovy.cps.NonCPS 4 | @Grab('com.nu-art-software:module-manager:1.2.34') 5 | 6 | import com.nu.art.modular.core.Module 7 | 8 | abstract class WorkflowModule 9 | extends Module { 10 | 11 | @NonCPS 12 | @Override 13 | protected void init() {} 14 | 15 | void _init() {} 16 | 17 | @SuppressWarnings('GrMethodMayBeStatic') 18 | Workflow getWorkflow() { 19 | Workflow.workflow 20 | } 21 | 22 | def R cd(String path, Closure closure) { 23 | return workflow.cd(path, closure) 24 | } 25 | 26 | String sh(String command, readOutput = false) { 27 | return workflow.sh(command, readOutput) 28 | } 29 | 30 | String sh(GString command, readOutput = false) { 31 | return workflow.sh(command.toString(), readOutput) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/workflow/logs/ANSI_Colors.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.workflow.logs; 2 | 3 | class ANSI_Colors { 4 | 5 | static String COLOR_PREFIX = "\033" 6 | static String NoColor = "${COLOR_PREFIX}[0m".toString() // Text Reset 7 | static String BBlack = "${COLOR_PREFIX}[1;30m".toString() // Black 8 | static String BRed = "${COLOR_PREFIX}[1;31m".toString() // Red 9 | static String BGreen = "${COLOR_PREFIX}[1;32m".toString() // Green 10 | static String BYellow = "${COLOR_PREFIX}[1;33m".toString() // Yellow 11 | static String BBlue = "${COLOR_PREFIX}[1;34m".toString() // Blue 12 | static String BPurple = "${COLOR_PREFIX}[1;35m".toString() // Purple 13 | static String BCyan = "${COLOR_PREFIX}[1;36m".toString() // Cyan 14 | static String BWhite = "${COLOR_PREFIX}[1;37m".toString() // White 15 | } 16 | 17 | -------------------------------------------------------------------------------- /.jenkins/tests/write-console-logs/run.groovy: -------------------------------------------------------------------------------- 1 | @Library('dev-tools@prod') 2 | 3 | import com.nu.art.pipeline.workflow.BasePipeline 4 | import com.nu.art.pipeline.workflow.Workflow 5 | 6 | class PipelineTest_WriteLogs 7 | extends BasePipeline { 8 | 9 | PipelineTest_WriteLogs() { 10 | super("Write Logs") 11 | } 12 | 13 | @Override 14 | protected void init() {} 15 | 16 | @Override 17 | void pipeline() { 18 | _sh(""" 19 | echo "±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±" 20 | echo "Echoed Hello World" 21 | echo "±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±" 22 | """) 23 | this.logDebug("±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±\nLogged Hello World\n±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±") 24 | 25 | } 26 | } 27 | 28 | node() { 29 | Workflow.createWorkflow(PipelineTest_WriteLogs.class, this) 30 | } 31 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/modules/build/CopyArtifacts.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.modules.build 2 | 3 | class CopyArtifacts { 4 | BuildModule module 5 | String jobName 6 | String filter = "*" 7 | String output = "." 8 | def selector 9 | 10 | CopyArtifacts(BuildModule module) { 11 | this.module = module 12 | } 13 | 14 | CopyArtifacts job(String name, int build) { 15 | this.jobName = name 16 | this.selector = module.workflow.script.specific("${build}") 17 | return this 18 | } 19 | 20 | CopyArtifacts filter(String filter) { 21 | this.filter = filter 22 | return this 23 | } 24 | 25 | CopyArtifacts output(String output) { 26 | this.output = output 27 | return this 28 | } 29 | 30 | void copy() { 31 | module.workflow.script.copyArtifacts filter: filter, 32 | fingerprintArtifacts: true, 33 | projectName: jobName, 34 | selector: selector, 35 | target: output 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/thunderstorm/Pipeline_PromoteThunderstorm.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.thunderstorm 2 | 3 | import com.nu.art.pipeline.modules.build.BuildModule 4 | import com.nu.art.pipeline.processes.Pipeline_PromoteRepo 5 | import com.nu.art.pipeline.thunderstorm.models.VersionApp 6 | import com.nu.art.pipeline.workflow.utils.Utils 7 | import groovy.json.JsonOutput 8 | 9 | class Pipeline_PromoteThunderstorm 10 | extends Pipeline_PromoteRepo { 11 | 12 | @Override 13 | void saveVersion(String path, String version) { 14 | String pathToFile = getModule(BuildModule.class).pathToFile(path) 15 | String json = JsonOutput.toJson(new VersionApp(version)) 16 | workflow.writeToFile(pathToFile, json) 17 | } 18 | 19 | @Override 20 | String readVersion(String path) { 21 | String fileContent = workflow.readFile(getModule(BuildModule.class).pathToFile(path)) 22 | return (Utils.parseJson(fileContent) as VersionApp).version 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/README.md: -------------------------------------------------------------------------------- 1 | ## Required Plugins for Jenkins 2 | 3 | * AnsiColor 4 | * Copy Artifact Plugin 5 | * Generic Webhook Trigger Plugin 6 | * Hidden Parameter plugin 7 | * Pipeline Utility Steps 8 | * SSH Agent Plugin 9 | 10 | ## Idea Libs 11 | 12 | * com.nu-art-software:nu-art-core:1.2.59 13 | * com.nu-art-software:belog:1.2.59 14 | * com.nu-art-software:reflection:1.2.59 15 | * com.nu-art-software:module-manager:1.2.59 16 | * org.jenkins-ci.main:jenkins-core:1.538 17 | * org.jenkins-ci.plugins:git:4.4.1 18 | * org.jenkins-ci.plugins:pipeline-utility-steps:2.6.1 19 | * org.jenkins-ci.plugins:scm-api:2.6.4 20 | * org.jenkins-ci.plugins.workflow:workflow-api:2.40 21 | * org.jenkins-ci.plugins.workflow:workflow-cps:2.83 22 | * org.jenkins-ci.plugins.workflow:workflow-job:2.40 23 | * org.jenkins-ci.plugins.workflow:workflow-scm-step:2.6 24 | * org.jenkins-ci.plugins:ssh-agent:295.v9ca_a_1c7cc3a_a_ 25 | 26 | ## Maven Repo for Jenkins 27 | 28 | * https://repo.jenkins-ci.org/releases -------------------------------------------------------------------------------- /scripts/node/pnpm/pnpm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | pnpm.install() { 4 | local version="${1:-"8.15.5"}" 5 | 6 | if [[ $(pnpm.isInstalled) -eq 0 ]]; then 7 | [[ "${version}" == "$(pnpm.version)" ]] && return 0 8 | 9 | pnpm.uninstall 10 | fi 11 | 12 | bannerInfo "PNPM - Installing v${version}" 13 | 14 | export PNPM_VERSION=${version} 15 | bash ${BASH_SOURCE%/*}/install.sh 16 | source "$(shell.getFileRC)" 17 | 18 | logInfo "PNPM - Installed" 19 | } 20 | 21 | pnpm.isInstalled() { 22 | [[ -d "${PNPM_HOME}" ]] && return 0 23 | } 24 | 25 | pnpm.version() { 26 | if [[ -x "$(command -v pnpm)" ]]; then 27 | pnpm --version 28 | fi 29 | } 30 | 31 | pnpm.uninstall() { 32 | bannerInfo "PNPM - Uninstalling..." 33 | rm -rf "${PNPM_HOME}" 34 | logInfo "PNPM - Uninstalled" 35 | } 36 | 37 | pnpm.installPackages() { 38 | logInfo "PNPM - Installing package" 39 | pnpm install -f --no-frozen-lockfile "${@}" 40 | } 41 | 42 | pnpm.removePackages() { 43 | pnpm remove "${@}" 44 | } 45 | -------------------------------------------------------------------------------- /scripts/android/_source.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | 22 | source ${BASH_SOURCE%/*}/../_core-tools/_source.sh 23 | source ${BASH_SOURCE%/*}/install.sh 24 | source ${BASH_SOURCE%/*}/tools.sh 25 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/workflow/variables/Var_Env.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.workflow.variables 2 | 3 | import com.nu.art.pipeline.interfaces.Getter 4 | import com.nu.art.pipeline.workflow.Workflow 5 | 6 | class Var_Env 7 | implements Getter { 8 | 9 | final String varName 10 | final Getter value 11 | 12 | static Var_Env create(String varName) { 13 | return new Var_Env(varName) 14 | } 15 | 16 | static Var_Env create(String varName, Getter value) { 17 | return new Var_Env(varName, value) 18 | } 19 | 20 | 21 | Var_Env(String varName) { 22 | this(varName, { Workflow.workflow.getEnvironmentVariable(varName) }) 23 | } 24 | 25 | Var_Env(String varName, Getter value) { 26 | this.varName = varName 27 | this.value = value 28 | } 29 | 30 | String get() { 31 | return value.get() 32 | } 33 | 34 | String set(String newValue) { 35 | String oldValue = this.value.get() 36 | Workflow.workflow.setEnvironmentVariable(this.varName, newValue) 37 | return oldValue 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/workflow/logs/WorkflowLogger.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.workflow.logs 2 | 3 | import com.cloudbees.groovy.cps.NonCPS 4 | import com.nu.art.belog.LoggerClient 5 | import com.nu.art.belog.consts.LogLevel 6 | import com.nu.art.core.tools.ExceptionTools 7 | import com.nu.art.pipeline.workflow.Workflow 8 | 9 | @Grab('com.nu-art-software:belog:1.2.34') 10 | 11 | class WorkflowLogger 12 | extends LoggerClient { 13 | private String[] LogColors = [ANSI_Colors.NoColor, ANSI_Colors.BBlue, ANSI_Colors.BGreen, ANSI_Colors.BYellow, ANSI_Colors.BRed,] 14 | 15 | @NonCPS 16 | @Override 17 | protected void log(long timestamp, LogLevel level, Thread thread, String tag, String message, Throwable t) { 18 | GString preLog = "${LogColors[level.ordinal()]}${level.name().substring(0, 1)} - ${tag}:" 19 | 20 | Workflow.workflow.log "${preLog} ${message}${ANSI_Colors.NoColor}" 21 | if (t != null) { 22 | Workflow.workflow.log "${preLog} ${ExceptionTools.getStackTrace(t)}${ANSI_Colors.NoColor}" 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /scripts/ci/android/_source.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | 22 | source ${BASH_SOURCE%/*}/../../_core-tools/_source.sh 23 | source ${BASH_SOURCE%/*}/build-and-deploy.sh 24 | source ${BASH_SOURCE%/*}/install-android-build-tools.sh 25 | -------------------------------------------------------------------------------- /scripts/node/node.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | node.replaceVarsWithValues() { 4 | local __packageJson=${1:-"./__package.json"} 5 | local packageJson="$(file.pathToFile "${__packageJson}")/package.json" 6 | 7 | file.delete "${packageJson}" -n 8 | file.copy "${__packageJson}" "" "${packageJson}" -n 9 | 10 | envVars=() 11 | envVars+=($(file.findMatches "${packageJson}" '"(\$.*?)"')) 12 | 13 | cleanEnvVar() { 14 | local length=$((${#1} - 3)) 15 | string.substring "${1}" 2 ${length} 16 | } 17 | 18 | array.map envVars cleanEnvVar 19 | array.filterDuplicates envVars 20 | 21 | assertExistingVar() { 22 | local envVar="${1}" 23 | local version="${!envVar}" 24 | [[ "${version}" == "" ]] && throwError "no value defined for version key '${envVar}'" 2 25 | } 26 | 27 | array.forEach envVars assertExistingVar 28 | 29 | replaceWithVersion() { 30 | local envVar="${1}" 31 | local version="${!envVar}" 32 | file.replaceAll ".${envVar}" "${version}" "${packageJson}" % 33 | } 34 | 35 | array.forEach envVars replaceWithVersion 36 | } 37 | -------------------------------------------------------------------------------- /scripts/node/_source.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | source ${BASH_SOURCE%/*}/firebase.sh 22 | source ${BASH_SOURCE%/*}/node.sh 23 | source ${BASH_SOURCE%/*}/nvm.sh 24 | source ${BASH_SOURCE%/*}/npm.sh 25 | source ${BASH_SOURCE%/*}/pnpm/pnpm.sh 26 | -------------------------------------------------------------------------------- /scripts/jenkins/upgrade.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | if [[ -e "dev-tools" ]]; then 22 | cd dev-tools && git pull && cd .. 23 | else 24 | git clone https://github.com/nu-art/dev-tools.git 25 | fi 26 | bash ./dev-tools/scripts/jenkins/_upgrade.sh 27 | -------------------------------------------------------------------------------- /scripts/._tests/core/folders.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) 22 | source "${DIR}/../_tests.sh" 23 | 24 | folder.create pah 25 | folder.create "zevel 3" 26 | iterateOverFolders listFolders echo 27 | printSummary -------------------------------------------------------------------------------- /scripts/jenkins/installation.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | if [[ -e "dev-tools" ]]; then 22 | cd dev-tools && git pull && cd .. 23 | else 24 | git clone https://github.com/nu-art/dev-tools.git 25 | fi 26 | bash ./dev-tools/scripts/jenkins/_setup-jenkins.sh 27 | -------------------------------------------------------------------------------- /scripts/git/git-drop-stash.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | 22 | source ${BASH_SOURCE%/*}/_core.sh 23 | 24 | processFolder() { 25 | git stash drop 26 | } 27 | 28 | signature 29 | printCommand "$@" 30 | processFolder 31 | iterateOverFolders "gitListSubmodules" processFolder 32 | 33 | -------------------------------------------------------------------------------- /scripts/._tests/prompt/user-choice.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) 22 | source "${DIR}/../../_core-tools/_source.sh" 23 | 24 | prompt_WaitForChoice targetVar "Select an option" "option 1" "option 2" "option 3" 25 | echo "targetVar: ${targetVar}" 26 | -------------------------------------------------------------------------------- /scripts/dev/typescript-oo/templates/icons.tsx: -------------------------------------------------------------------------------- 1 | import {ElementType, HTMLAttributes} from 'react'; 2 | import {_className} from '@nu-art/thunderstorm/frontend'; 3 | import {_keys} from '@nu-art/ts-common'; 4 | 5 | 6 | ICONS_DECLARATION; 7 | 8 | const genIcon = (Icon: ElementType) => 9 | (props: HTMLAttributes) =>
10 | 11 |
; 12 | 13 | const genIconV4 = (icon: ElementType) => 14 | (props: HTMLAttributes) => { 15 | const className = _className('ts-icon__v4', props.className); 16 | return
; 17 | }; 18 | 19 | const AllIcons = { 20 | ICONS_USAGE 21 | }; 22 | 23 | const AllIconsV4 = { 24 | 25 | ICONS_V4_USAGE 26 | }; 27 | 28 | export type IconsType = typeof AllIcons 29 | export type IconKey = keyof IconsType 30 | 31 | export const ICONS: IconsType = AllIcons; 32 | export const ICONSV4: typeof AllIconsV4 = AllIconsV4; 33 | export const ICON_KEYS: IconKey[] = _keys(AllIcons); 34 | 35 | -------------------------------------------------------------------------------- /scripts/._tests/core/string.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) 22 | source "${DIR}/../_tests.sh" 23 | 24 | stringReplaceTest1() { 25 | local str="pah~Zevel" 26 | string_replace "~" " " "${str}" 27 | } 28 | 29 | assertCommand "pah Zevel" "stringReplaceTest1" 30 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/thunderstorm/Pipeline_ThunderstormMain.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.thunderstorm 2 | 3 | import com.nu.art.pipeline.modules.SlackModule 4 | import com.nu.art.pipeline.workflow.WorkflowModule 5 | import com.nu.art.pipeline.workflow.variables.Var_Env 6 | 7 | class Pipeline_ThunderstormMain 8 | extends Pipeline_ThunderstormWebProject { 9 | 10 | public Var_Env NO_GIT = new Var_Env("NO_GIT") 11 | 12 | 13 | Pipeline_ThunderstormMain(String name, String slackChannel, Class... modules) { 14 | super(name, slackChannel, modules) 15 | } 16 | 17 | protected T publish() { 18 | addStage("publish", { this._publish() }) 19 | return this as T 20 | } 21 | 22 | void _publish() { 23 | _sh("bash build-and-install.sh --publish --quick-publish --debug ${NO_GIT.get() == "true" ? "--no-git" : ""}") 24 | } 25 | 26 | @Override 27 | void pipeline() { 28 | checkout({ 29 | getModule(SlackModule.class).setOnSuccess(getRepo().getChangeLog().toSlackMessage()) 30 | }) 31 | 32 | install() 33 | clean() 34 | build() 35 | test() 36 | 37 | publish() 38 | deploy() 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /scripts/server/copy-to-remote.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | 22 | copyToRemoteServer() { 23 | local pathToPrivateKey=${1} 24 | local remoteServer=${2} 25 | local fromPath=${3} 26 | local toPath=${4} 27 | 28 | scp -i ${pathToPrivateKey} ${fromPath} ${remoteServer}:${toPath} 29 | } 30 | 31 | copyToRemoteServer ${1} ${2} ${3} ${4} -------------------------------------------------------------------------------- /scripts/server/copy-from-remote.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | 22 | copyFromRemoteServer() { 23 | local pathToPrivateKey=${1} 24 | local remoteServer=${2} 25 | local fromPath=${3} 26 | local toPath=${4} 27 | 28 | scp -r -i ${pathToPrivateKey} ${remoteServer}:${fromPath} ${toPath} 29 | } 30 | 31 | copyFromRemoteServer ${1} ${2} ${3} ${4} -------------------------------------------------------------------------------- /scripts/oos/core/json.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | jsonSerialize() { 4 | local instance=${1} 5 | local members=(${@:2}) 6 | local instanceClass=`${instance}.__class` 7 | local classMembers=(`${instanceClass}.members`) 8 | 9 | (( ${#members[@]} == 0 )) && members=(${classMembers[@]}) 10 | 11 | local memberIndex=0 12 | local json="{" 13 | for (( memberIndex = 0; memberIndex < ${#members[@]}; ++memberIndex )); do 14 | local member=${members[memberIndex]} 15 | 16 | [[ ! `array_contains ${member} ${classMembers[@]}` ]] && throwError "Cannot serialize a property that is not defined in class: ${instanceClass}" 3 17 | 18 | local value=`${instance}.${member}` 19 | [[ ! ${value} ]] && continue 20 | 21 | [[ `isFunction ${value}.__class` ]] && value=`jsonSerialize ${value}` 22 | 23 | [[ "${value:0:1}" != "{" ]] || [[ "${value: -1}" != "}" ]] && value=`echo "${value}" | sed -E 's/"/\\\"/g'` && value="\"${value}\"" 24 | # _logInfo "${value}" 25 | json="${json}\"${member}\":${value}" 26 | (( memberIndex < ${#members[@]} -1 )) && json="${json}," 27 | done 28 | json="${json}}" 29 | # json=`echo "${json}" | sed -E 's/"/\\\"/g'` 30 | 31 | echo "${json}" 32 | } -------------------------------------------------------------------------------- /scripts/dev/typescript-oo/_core/modules.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | boilerplateRepo="git@github.com:nu-art-js/thunderstorm.git" 4 | 5 | buildSteps=( 6 | setEnvironment 7 | printDependencyTree 8 | cleanEnv 9 | purge 10 | clean 11 | install 12 | link 13 | generate 14 | preBuild 15 | compile 16 | checkCyclicImports 17 | generateDocs 18 | lint 19 | test 20 | publish 21 | launch 22 | deploy 23 | ) 24 | 25 | allowedBranchesForPromotion=( 26 | prod 27 | master 28 | prod 29 | staging 30 | dev 31 | ) 32 | 33 | tsLibs=( 34 | ts-common 35 | ts-styles 36 | google-services 37 | # commando 38 | # build-and-install 39 | firebase 40 | thunderstorm 41 | ts-pdf 42 | slack 43 | live-docs 44 | user-account 45 | permissions 46 | ts-short-url 47 | ts-dependency-viewer 48 | ts-focused-object 49 | ts-messaging 50 | ts-workspace 51 | push-pub-sub 52 | jira 53 | bug-report 54 | github 55 | file-upload 56 | ts-openai 57 | schema-to-types 58 | ) 59 | 60 | projectLibs=( 61 | app-shared 62 | ) 63 | 64 | backendApps=( 65 | app-backend 66 | ) 67 | 68 | frontendApps=( 69 | app-frontend 70 | ) 71 | 72 | deployableApps=( 73 | app-backend 74 | app-frontend 75 | ) 76 | 77 | executableApps=( 78 | app 79 | ) 80 | -------------------------------------------------------------------------------- /.jenkins/tests/slack-upload-file/run.groovy: -------------------------------------------------------------------------------- 1 | @Library('dev-tools@prod') 2 | 3 | import com.nu.art.pipeline.modules.SlackModule 4 | import com.nu.art.pipeline.modules.build.BuildModule 5 | import com.nu.art.pipeline.workflow.BasePipeline 6 | import com.nu.art.pipeline.workflow.Workflow 7 | 8 | class PipelineTest_SlackUploadFile 9 | extends BasePipeline { 10 | 11 | PipelineTest_SlackUploadFile() { 12 | super("Slack Upload File", SlackModule.class) 13 | } 14 | 15 | @Override 16 | protected void init() { 17 | getModule(SlackModule.class).setToken("quai-slack-token") 18 | getModule(SlackModule.class).setTeam("quai-md") 19 | getModule(SlackModule.class).setDefaultChannel("pipeline-temp") 20 | } 21 | 22 | 23 | @Override 24 | void pipeline() { 25 | getModule(SlackModule.class).disable() 26 | addStage("upload file", { 27 | 28 | getModule(SlackModule.class).enableNotifications() 29 | getModule(SlackModule.class).sendFile("**/dummy-file.txt", "pipeline-temp") 30 | getModule(SlackModule.class).sendFile("**/dummy-file.txt", "pipeline-temp", "with message") 31 | getModule(SlackModule.class).disable() 32 | }) 33 | } 34 | } 35 | 36 | node() { 37 | Workflow.createWorkflow(PipelineTest_SlackUploadFile.class, this) 38 | } 39 | -------------------------------------------------------------------------------- /scripts/._tests/errors.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) 22 | source "${DIR}/_tests.sh" 23 | 24 | var=true 25 | 26 | return0() { 27 | return 0 28 | } 29 | 30 | return1() { 31 | return 1 32 | } 33 | 34 | return2() { 35 | return 2 36 | } 37 | 38 | [[ ! ${var} ]] && return0 39 | assertValue "1" $? 40 | 41 | [[ ${var} ]] && return2 42 | assertValue "2" $? 43 | 44 | 45 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/workflow/variables/Var_Cli.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.workflow.variables 2 | 3 | 4 | import com.nu.art.pipeline.interfaces.Getter 5 | 6 | class Var_Cli 7 | implements IVar_Cli { 8 | 9 | static String buildCommand(String command, Var_Cli... params) { 10 | List _params = params.collect { param -> "--${param.key()}=${param.get()}".toString() } 11 | String paramsAsString = "" 12 | for (i in 0..<_params.size()) { 13 | paramsAsString += " ${_params.get(i)}" 14 | } 15 | return "${command} ${paramsAsString}" 16 | } 17 | 18 | static Var_Cli create(String varName, Getter getter) { 19 | return new Var_Cli(varName, { getter.get() }) 20 | } 21 | 22 | static Var_Cli create(String varName, Var_Env value) { 23 | return new Var_Cli(varName, { value.get() }) 24 | } 25 | 26 | static Var_Cli create(String varName, String value) { 27 | return new Var_Cli(varName, { value }) 28 | } 29 | 30 | final String varName 31 | final Closure value 32 | 33 | private Var_Cli(String varName, Closure value) { 34 | this.varName = varName 35 | this.value = value 36 | } 37 | 38 | @Override 39 | String key() { 40 | return varName 41 | } 42 | 43 | @Override 44 | String get() { 45 | return value() 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /scripts/dev/build-and-install.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | 22 | echo "------------------------------------------" 23 | echo "- THIS SCRIPT IS DEPRECATED -" 24 | echo "- USE: -" 25 | echo "- -" 26 | echo "- android/build-and-install.sh -" 27 | echo "------------------------------------------" 28 | 29 | bash ${BASH_SOURCE%/*}/android/build-and-install.sh $@ -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/thunderstorm/Pipeline_ThunderstormWebApp.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.thunderstorm 2 | 3 | import com.nu.art.pipeline.workflow.WorkflowModule 4 | 5 | class Pipeline_ThunderstormWebApp 6 | extends Pipeline_ThunderstormCore { 7 | 8 | protected String env 9 | 10 | Pipeline_ThunderstormWebApp(GString name, Class... modules = []) { 11 | this(name.toString(), modules) 12 | } 13 | 14 | Pipeline_ThunderstormWebApp(String name, Class... modules = []) { 15 | super(name, modules) 16 | } 17 | 18 | Pipeline_ThunderstormWebApp(Class... modules = []) { 19 | super(modules) 20 | } 21 | 22 | protected void setEnv(String env) { 23 | this.env = env 24 | } 25 | 26 | protected T deploy() { 27 | addStage("deploy", { this._deploy() }) 28 | return this as T 29 | } 30 | 31 | protected void _install() { 32 | _sh("bash build-and-install.sh --set-env=${this.env} --install --no-build --link --debug") 33 | } 34 | 35 | protected void _deploy() { 36 | _sh("bash build-and-install.sh --print-env") 37 | _sh("bash build-and-install.sh --deploy --quick-deploy --no-git --debug") 38 | } 39 | 40 | @Override 41 | void pipeline() {} 42 | } 43 | -------------------------------------------------------------------------------- /scripts/dev/android-oo/classes/AndroidApp.class.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | AndroidApp() { 4 | 5 | declare name 6 | declare path 7 | declare packageName 8 | declare launcherClass 9 | declare apkPattern 10 | declare outputFolder 11 | 12 | declare buildType 13 | declare flavor 14 | 15 | declare pathToApk 16 | 17 | _clean() { 18 | logInfo "_clean" 19 | } 20 | 21 | _compile() { 22 | logInfo "_compile" 23 | } 24 | 25 | _uninstall() { 26 | logInfo "_uninstall" 27 | } 28 | 29 | _install() { 30 | if [[ ! -e "${outputFolder}" ]]; then 31 | throwError "Output folder does not exists... Build needed - ${outputFolder}" 2 32 | fi 33 | 34 | if [[ ! "${pathToApk}" ]]; then 35 | pathToApk=$(find "${outputFolder}" -name "${apkPattern}") 36 | fi 37 | 38 | if [[ ! "${pathToApk}" ]]; then 39 | throwError "Could not find apk in path '${outputFolder}', matching the pattern '${apkPattern}'" 2 40 | fi 41 | } 42 | 43 | _launch() { 44 | logInfo "_launch" 45 | } 46 | 47 | _dependencies() { 48 | logInfo "_dependencies" 49 | } 50 | 51 | _forceStop() { 52 | logInfo "_forceStop" 53 | } 54 | 55 | _clearData() { 56 | logInfo "_forceStop" 57 | } 58 | 59 | _test() { 60 | logInfo "_test" 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /scripts/oos/graphics/Drawable2D.class.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | Drawable2D() { 4 | 5 | declare delimiter=K 6 | declare animObj 7 | declare x 8 | declare y 9 | declare width 10 | declare height 11 | declare array lines 12 | declare array offsets 13 | 14 | _init() { 15 | local temp=(`echo -e "${animObj}" | sed -E "s/ /${delimiter}/g" | sed -E "s/(.*)$/\1/g"`) 16 | local linesTemp=() 17 | local offsetTemp=() 18 | 19 | height=${#temp[@]} 20 | for (( i=0; i<=${#temp[@]}; i+=1 )); do 21 | offsetTemp[${i}]="$(echo "${temp[${i}]}" | sed -E "s/(^${delimiter}*).*/\1/")" 22 | offsetTemp[${i}]=${#offsetTemp[${i}]} 23 | 24 | linesTemp[${i}]="$(echo "${temp[${i}]}" | sed -E "s/^${delimiter}*(.*)$/\1/" | sed -E "s/${delimiter}/ /g")" 25 | done 26 | 27 | lines=("${linesTemp[@]}") 28 | offsets=("${offsetTemp[@]}") 29 | # for (( i=0; i<=${height}; i+=1 )); do 30 | # echo ${offset[$i]} 31 | # done 32 | # for (( i=0; i<=`cloud.height`; i+=1 )); do 33 | ## echo ${lines[$i]} 34 | # done 35 | 36 | } 37 | 38 | _getLine(){ 39 | echo "${lines[${1}]}" 40 | } 41 | _getOffset(){ 42 | echo "${offsets[${1}]}" 43 | } 44 | } 45 | 46 | -------------------------------------------------------------------------------- /gradle/code-analysis.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Permissions management system, define access level for each of 3 | * your server apis, and restrict users by giving them access levels 4 | * 5 | * Copyright (C) 2020 Adam van der Kruk aka TacB0sS 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | def addPlugin_Sonarqube(variant) { 21 | String branch = System.getenv('BRANCH_NAME') ?: "master" 22 | branch = branch.replace("origin/", "").replace("/", "__") 23 | 24 | apply plugin: 'org.sonarqube' 25 | sonarqube { 26 | androidVariant variant 27 | properties { 28 | property "sonar.projectKey", "${project.name}:${branch}" 29 | property "sonar.projectName", "${project.name} ${branch}" 30 | } 31 | } 32 | } 33 | 34 | ext.addPlugin_Sonarqube = this.&addPlugin_Sonarqube 35 | -------------------------------------------------------------------------------- /scripts/oos/graphics/Canvas2DS.class.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | Canvas2DS() { 4 | 5 | declare frame 6 | declare buffer 7 | declare width 8 | declare height 9 | 10 | _prepare() { 11 | buffer=`seq -f " " -s '' $(( ${width} * ${height} ))` 12 | frame=`seq -f " " -s '' $(( ${width} + 2 ))` 13 | } 14 | 15 | _paint() { 16 | local animation=${1} 17 | local x=${2} 18 | local y=${3} 19 | local animHeight=`${animation}.height` 20 | for (( i=0; i<${animHeight}; i+=1 )); do 21 | local line=`${animation}.getLine ${i}` 22 | local offset=`${animation}.getOffset ${i}` 23 | 24 | local position1=$(( (${i} + ${y}) * ${width} + ${x} + ${offset} )) 25 | local position2=$(( ${position1} + ${#line} )) 26 | 27 | buffer="${buffer:0:${position1}}${line}${buffer:${position2}}" 28 | done 29 | } 30 | 31 | _clean() { 32 | for ((i=0; i< ${height} +2; i++)); do 33 | tput cuu1 tput el 34 | done 35 | } 36 | 37 | _draw() { 38 | echo -e "${On_Black}${frame}${NoColor}" 39 | for (( h=0; h<${height}; h+=1 )); do 40 | echo -e "${On_Black} ${NoColor}${buffer:$(( ${h} * ${width} )):${width}}${On_Black} ${NoColor}" 41 | done 42 | echo -e "${On_Black}${frame}${NoColor}" 43 | } 44 | } 45 | 46 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/modules/build/JobTrigger.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.modules.build 2 | 3 | import com.nu.art.pipeline.workflow.Workflow 4 | import com.nu.art.pipeline.workflow.variables.Var_Env 5 | import org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper 6 | 7 | class JobTrigger 8 | implements Serializable { 9 | 10 | String name 11 | Workflow workflow 12 | def params = [] 13 | boolean wait = true 14 | 15 | JobTrigger(Workflow workflow, String name) { 16 | this.name = name 17 | this.workflow = workflow 18 | } 19 | 20 | JobTrigger addString(String key, String value) { 21 | return this.addParam(JobParam.Param_String, key.toString(), value) 22 | } 23 | 24 | JobTrigger addString(Var_Env envVar) { 25 | return this.addParam(JobParam.Param_String, envVar.varName, envVar.get()) 26 | } 27 | 28 | JobTrigger addBoolean(String key, Boolean value) { 29 | return this.addParam(JobParam.Param_Boolean, key.toString(), value) 30 | } 31 | 32 | JobTrigger setWait(boolean wait) { 33 | this.wait = wait 34 | return this 35 | } 36 | 37 | private JobTrigger addParam(JobParam type, String key, T value) { 38 | params += [$class: type.key, name: key, value: value.toString()] 39 | return this 40 | } 41 | 42 | RunWrapper run() { 43 | RunWrapper result = workflow.script.build job: name, parameters: params, wait: wait 44 | return result 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /scripts/._tests/pnpm/pnpm.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) 22 | source "${DIR}/../_tests.sh" 23 | source "${DIR}/../node/pnpm.sh" 24 | test.pnpm.install() { 25 | pnpm.install ${1} > /dev/null 2>&1 26 | pnpm.install ${1} > /dev/null 2>&1 27 | pnpm.version 28 | } 29 | 30 | test.pnpm.install-uninstall-install() { 31 | pnpm.install > /dev/null 2>&1 32 | pnpm.uninstall > /dev/null 2>&1 33 | pnpm.install 7.29.0 > /dev/null 2>&1 34 | pnpm.version 35 | } 36 | 37 | assertCommand "7.29.1" "test.pnpm.install" 38 | assertCommand "7.29.0" "test.pnpm.install-uninstall-install" 39 | -------------------------------------------------------------------------------- /scripts/dev/android-oo/build-and-install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | source ./dev-tools/scripts/oos/core/transpiler.sh 3 | 4 | setErrorOutputFile "$(pwd)/error_message.txt" 5 | 6 | # shellcheck source=./params.sh 7 | source "${BASH_SOURCE%/*}/params.sh" 8 | 9 | [[ -e ".scripts/signature.sh" ]] && source .scripts/signature.sh 10 | 11 | #signature 12 | extractParams "$@" 13 | 14 | CONST_RunningFolder="$(folder.getRunningPath 1)" 15 | #setTranspilerOutput "${CONST_RunningFolder}" 16 | setTranspilerOutput ".trash/bai" 17 | addTranspilerClassPath "${CONST_RunningFolder}/classes" 18 | 19 | buildWorkspace() { 20 | 21 | new Workspace workspace 22 | workspace.setup 23 | workspace.loadApps 24 | # Workspace: 25 | # load version from version file 26 | # load list of apps 27 | # set list of active apps 28 | # 29 | # Set Projects: 30 | # future settings.gradle config 31 | # 32 | # detect connected devices 33 | # 34 | # Run lifecycle 35 | # 36 | workspace.setEnvironment 37 | 38 | workspace.purge 39 | workspace.clean 40 | workspace.install 41 | workspace.link 42 | workspace.generate 43 | workspace.compile 44 | workspace.lint 45 | workspace.test 46 | 47 | workspace.publish 48 | workspace.launch 49 | workspace.deploy 50 | 51 | } 52 | 53 | buildWorkspace 54 | 55 | #zevel() { 56 | # echo "${1}er" 57 | #} 58 | # 59 | #original="what a piece rap of crap this little crap is" 60 | #echo "${original}" | sed -E "s/(rap)/$(zevel \\1)/g" 61 | -------------------------------------------------------------------------------- /scripts/oos/tests/performance.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | #!/bin/bash 4 | # assoc-arr-test.sh 5 | # Benchmark test script to compare execution times of 6 | # numeric-indexed array vs. associative array. 7 | # Thank you, Erik Brandsberg. 8 | 9 | count=100000 # May take a while for some of the tests below. 10 | declare simple # Can change to 20000, if desired. 11 | declare -a array1 12 | declare -A array2 13 | declare -a array3 14 | declare -A array4 15 | 16 | echo "===Assignment tests===" 17 | echo 18 | 19 | echo "Assigning a simple variable:" 20 | # References $i twice to equalize lookup times. 21 | time for (( i=0; i< $count; i++)); do 22 | simple=$i$i 23 | done 24 | 25 | echo "---" 26 | 27 | echo "Assigning a numeric index array entry:" 28 | time for (( i=0; i< $count; i++)); do 29 | array1[$i]=$i 30 | done 31 | 32 | echo "---" 33 | 34 | echo "Overwriting a numeric index array entry:" 35 | time for (( i=0; i< $count; i++)); do 36 | array1[$i]=$i 37 | done 38 | 39 | echo "---" 40 | 41 | echo "Linear reading of numeric index array:" 42 | time for (( i=0; i< $count; i++)); do 43 | simple=array1[$i] 44 | done 45 | 46 | echo "---" 47 | 48 | echo "Assigning an associative array entry:" 49 | time for (( i=0; i< $count; i++)); do 50 | array2[$i]=$i 51 | done 52 | 53 | echo "---" 54 | 55 | echo "Overwriting an associative array entry:" 56 | time for (( i=0; i< $count; i++)); do 57 | array2[$i]=$i 58 | done 59 | -------------------------------------------------------------------------------- /scripts/._tests/string/replace-all.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) 22 | source "${DIR}/../_tests.sh" 23 | string_replaceDashWithUnderscore() { 24 | local output=$(string_replaceAll "-" "_" "pah-zevel") 25 | echo "${output}" 26 | } 27 | 28 | string_replaceDashAndSlashWithUnderscore() { 29 | local output=$(string_replaceAll "-" "_" "pah-zevel/ashpa") 30 | local output=$(string_replaceAll "/" "_" "${output}" "%") 31 | echo "${output}" 32 | } 33 | 34 | assertCommand "pah_zevel" "string_replaceDashWithUnderscore" 35 | assertCommand "pah_zevel_ashpa" "string_replaceDashAndSlashWithUnderscore" 36 | -------------------------------------------------------------------------------- /scripts/jenkins/_setup-clone-jobs.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | source ${BASH_SOURCE%/*}/../android/_source.sh 22 | 23 | executeCommand() { 24 | local command=${1} 25 | local message=${2} 26 | if [[ ! "${message}" ]]; then message="Running: ${1}"; fi 27 | logInfo "${message}" 28 | eval "${command}" 29 | throwError "${message}" 30 | } 31 | 32 | signature "Setup - Jenkins Jobs" 33 | # ASSERT jenkins user is active 34 | executeCommand "cd ~" "Switch to Jenkins user" 35 | executeCommand "rm -rf jobs" "Delete jobs folder" 36 | executeCommand "git clone git@github.com:TacB0sS/jenkins-jobs.git jobs" "Cloning jobs from git" 37 | -------------------------------------------------------------------------------- /src/com/nu/art/utils/StringTemplateReplacer.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.utils 2 | 3 | import com.nu.art.pipeline.workflow.Workflow 4 | 5 | class StringTemplateReplacer { 6 | 7 | static void replace(String fromFile, String toFile) { 8 | // Read content from the source file 9 | String content = Workflow.workflow.script.readFile fromFile 10 | 11 | // Regex to find {{VAR_NAME}} patterns 12 | String pattern = /\{\{([a-zA-Z_][a-zA-Z_0-9]+)(?:=(.*?))?\}\}/ 13 | 14 | // Replace each found pattern with the value from Jenkins environment variable 15 | String fileContent = content.replaceAll(pattern) { match -> 16 | String varName = match[1] 17 | String defaultValue = match[2] 18 | 19 | // Attempt to fetch the environment variable value 20 | String varValue = Workflow.workflow.getEnvironmentVariable(varName) 21 | 22 | // Use the default value if the environment variable is not found or is empty 23 | if (!varValue) { 24 | if (defaultValue != null) { 25 | // Default value specified and variable not found, use default 26 | varValue = defaultValue 27 | } else { 28 | // Variable not found and no default specified, throw exception 29 | throw new Exception("Environment variable '${varName}' not found and no default value specified.") 30 | } 31 | } 32 | 33 | return varValue 34 | } 35 | 36 | 37 | // Write the modified content to the destination file 38 | Workflow.workflow.script.writeFile file: toFile, text: fileContent 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /.jenkins/tests/templater/run.groovy: -------------------------------------------------------------------------------- 1 | import com.nu.art.pipeline.modules.git.GitModule 2 | @Library('dev-tools') 3 | import com.nu.art.pipeline.workflow.Workflow 4 | import com.nu.art.utils.StringTemplateReplacer 5 | import com.nu.art.pipeline.workflow.BasePipeline 6 | import com.nu.art.pipeline.modules.git.GitModule 7 | import com.nu.art.pipeline.modules.build.BuildModule 8 | import com.nu.art.pipeline.modules.git.GitRepo 9 | 10 | class PipelineTest_Templater 11 | extends BasePipeline { 12 | 13 | PipelineTest_Templater() { 14 | super("Test Templater", BuildModule.class, GitModule.class) 15 | } 16 | 17 | @Override 18 | protected void init() { 19 | } 20 | 21 | void pipeline() { 22 | 23 | GitModule gitModule = getModule(GitModule.class) 24 | GitRepo repo = gitModule 25 | .create("https://github.com/nu-art/dev-tools.git") 26 | .setBranch("prod") 27 | .setOutputFolder(".") 28 | .build() 29 | 30 | repo.cloneRepo() 31 | 32 | this.workflow.setEnvironmentVariable("TEST1", "lovely") 33 | this.workflow.setEnvironmentVariable("PARAM", "friendly") 34 | 35 | String fromFile = getModule(BuildModule.class).pathToFile("./.jenkins/tests/templater/test-template.txt") 36 | String toFile = getModule(BuildModule.class).pathToFile("./.jenkins/tests/templater/output.txt") 37 | StringTemplateReplacer.replace(fromFile, toFile) 38 | _sh 'cat "./.jenkins/tests/templater/output.txt"' 39 | } 40 | } 41 | 42 | node() { 43 | Workflow.createWorkflow(PipelineTest_Templater.class, this) 44 | } 45 | 46 | -------------------------------------------------------------------------------- /scripts/_core-tools/time.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | timerMap=() 22 | 23 | startTimer() { 24 | local key=${1} 25 | timerMap[$key]=$SECONDS 26 | } 27 | 28 | calcDuration() { 29 | local key=${1} 30 | local startedTimestamp=${timerMap[$key]} 31 | if [[ ! "${startedTimestamp}" ]]; then startedTimestamp=0; fi 32 | 33 | local duration=$(($SECONDS - ${startedTimestamp})) 34 | local seconds=$(($duration % 60)) 35 | if [[ "$seconds" -lt 10 ]]; then seconds="0$seconds"; fi 36 | 37 | local min=$(($duration / 60)) 38 | if [[ "$min" -eq 0 ]]; then min=00; elif [[ "$min" -lt 10 ]]; then min="0$min"; else min="$min"; fi 39 | echo ${min}:${seconds} 40 | } 41 | 42 | startTimer "rootTimer" 43 | -------------------------------------------------------------------------------- /scripts/oos/graphics/Engine2DS.class.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | Engine2DS() { 4 | 5 | declare canvas 6 | declare array animators 7 | declare totalFrames=1 8 | declare frame=0 9 | 10 | _addAnimation() { 11 | animators=("${animators[@]}" "${1}") 12 | } 13 | 14 | _start() { 15 | while (( ${frame} < ${totalFrames} )); do 16 | this.render 17 | frame=$(( ${frame} + 1 )) 18 | done 19 | 20 | canvas.draw 21 | } 22 | 23 | _render() { 24 | canvas.prepare 25 | local width=canvas.width 26 | local height=canvas.height 27 | 28 | for animator in "${animators[@]}"; do 29 | local startFrame=`${animator}.startFrame` 30 | local endFrame=`${animator}.endFrame` 31 | if (( ${frame} < ${startFrame} ));then 32 | continue 33 | fi 34 | 35 | if (( ${frame} >= ${endFrame} ));then 36 | continue 37 | fi 38 | 39 | local progress=`echo " (${frame} - ${startFrame}) / (${endFrame} - ${startFrame}) " | bc -l` 40 | # >&2 echo "HERE" ${animator} 41 | 42 | local x= 43 | local y= 44 | ${animator}.calculateX x ${progress} ${width} ${height} 45 | ${animator}.calculateY y ${progress} ${width} ${height} 46 | local drawable=`${animator}.drawable` 47 | canvas.paint ${drawable} ${x} ${y} 48 | done 49 | canvas.draw 50 | canvas.clean 51 | } 52 | } 53 | 54 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/modules/git/GitRepoChangeSet.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.modules.git 2 | 3 | import com.nu.art.pipeline.modules.git.models.GitChangeLog 4 | 5 | class GitRepoChangeSet { 6 | GitChangeLog[] log 7 | GitRepo repo 8 | String fromCommit 9 | String toCommit 10 | 11 | GitRepoChangeSet(GitRepo repo, String fromCommit, String toCommit) { 12 | this.repo = repo 13 | this.fromCommit = fromCommit 14 | this.toCommit = toCommit 15 | } 16 | 17 | GitRepoChangeSet init() { 18 | if (!toCommit) { 19 | log = [] 20 | return this 21 | } 22 | 23 | String changeLog = repo.executeCommand("git log --pretty=format:'%h %ad \"%an\" %s' --date=format:'%Y-%m-%d %H:%M:%S %z' ${fromCommit}...${toCommit}", true) 24 | if (changeLog.length() < 10) 25 | return this 26 | 27 | this.log = changeLog.split("\n").collect { commit -> new GitChangeLog(commit) } 28 | this.log.reverse() 29 | return this 30 | } 31 | 32 | String toSlackMessage() { 33 | GitRepoConfig config = repo.config 34 | String repoUrl = "https://github.com/${config.group}/${config.repoName}" 35 | String repo = "<${repoUrl}|${config.repoName}>" 36 | String diff = "<${repoUrl}/compare/${toCommit}...${fromCommit}|diff> " 37 | String changeLog = "${repo} | ${diff}\n" 38 | log.collect({ "<${repoUrl}/commit/${it.hash}/|Changes> by *${it.author}*: ${it.comment}" }).each { changeLog += " - ${it}\n" } 39 | return changeLog 40 | } 41 | 42 | String[] findPattern(String pattern) { 43 | return log.collect({ it.findPattern(pattern) }).flatten() 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/modules/docker/DockerModule.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.modules.docker 2 | 3 | import com.nu.art.pipeline.workflow.WorkflowModule 4 | 5 | class DockerModule 6 | extends WorkflowModule { 7 | 8 | DockerConfig create(String key, String version) { 9 | return new DockerConfig(this, key, version) 10 | } 11 | } 12 | 13 | 14 | //+ docker exec -w /data/jenkins/workspace/v2_upload_elliq_firebase_data-DEV 783e39a7-003b-488d-b616-24720851b5a4 bash -c bash build-and-install.sh --install --no-build --link 15 | //+ docker exec -w /data/jenkins/workspace/v2_upload_elliq_firebase_data-DEV@3 c45656ff-ff76-4683-9667-5bc76561f6ea bash -c bash build-and-install.sh --install --no-build --link 16 | // 17 | //docker run --rm -d --net=host --name c45656ff-ff76-4683-9667-5bc76561f6ea 18 | // -e USER=jenkins 19 | // -v ****:**** -v ****:**** 20 | // -v /home/jenkins/.config:/home/jenkins/.config 21 | // -v /home/jenkins/.ssh/id_rsa:/home/jenkins/.ssh/id_rsa 22 | // -v /home/jenkins/.ssh/known_hosts:/home/jenkins/.ssh/known_hosts 23 | // eu.gcr.io/ir-infrastructure-246111/jenkins-ci-python-env:1.0.18 tail -f /dev/null 24 | // 25 | //docker run --rm -d --net=host --name 783e39a7-003b-488d-b616-24720851b5a4 26 | // -v ****:**** -v ****:**** 27 | // -e WORKSPACE=/data/jenkins/workspace/v2_upload_elliq_firebase_data-DEV 28 | // -e BUILD_NUMBER=46 29 | // -v /data/jenkins/workspace/v2_upload_elliq_firebase_data-DEV:/data/jenkins/workspace/v2_upload_elliq_firebase_data-DEV 30 | // eu.gcr.io/ir-infrastructure-246111/jenkins-ci-python-env:1.0.18 tail -f /dev/null 31 | -------------------------------------------------------------------------------- /scripts/build/upload-to-drive.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | source ${BASH_SOURCE%/*}/../utils/error-handling.sh 22 | source ${BASH_SOURCE%/*}/../utils/drive-tools.sh 23 | source ${BASH_SOURCE%/*}/../utils/log-tools.sh 24 | 25 | folderName=$1 26 | fileName=$2 27 | 28 | logInfo "Requesting folder id for: ${folderName}" 29 | folderId=$(getFolderId ${folderName}) 30 | if [[ ! "${folderId}" ]]; then 31 | echo "could not find folder: ${folderName}" 32 | exit 1 33 | fi 34 | 35 | logInfo "Found folder id: ${folderId}, for folder: ${folderName}" 36 | 37 | logInfo "Uploading file: ${fileName} to folder id: ${folderId}" 38 | upload "${fileName}" "${folderId}" 39 | 40 | logInfo "SUCCESS!" 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /scripts/node/npm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | npm.verifyPackageInstalledGlobally() { 4 | local package=${1} 5 | local minVersion=${2} 6 | local foundVersion="$(npm.getPackageVersion "${package}")" 7 | 8 | [[ "${foundVersion}" == "${minVersion}" ]] && return 0 9 | 10 | logWarning "Found wrong version '${foundVersion}' of '${package}...'" 11 | logInfo "Installing required package version: ${package}@${minVersion}" 12 | npm i -g "${package}@${minVersion}" 13 | } 14 | 15 | npm.printPackageVersion() { 16 | local package=${1} 17 | logInfo "${package}: $(npm.getPackageVersion "${package}")" 18 | } 19 | 20 | npm.getPackageVersion() { 21 | local package=${1} 22 | 23 | zevel=$(npm list -g "${package}" | grep "${package}" 2>&1) 24 | local code=$? 25 | [[ "${code}" != "0" ]] && echo "N/A" && return 1 26 | 27 | local output="${zevel}" 28 | local foundVersion=$(echo "${output}" | tail -1 | sed -E "s/.*${package}@(.*)/\1/") 29 | echo "${foundVersion}" 30 | return 0 31 | } 32 | 33 | printNodePackageTree() { 34 | local module=$(getRunningDir) 35 | local output=${1} 36 | logDebug "${module} - Printing dependency tree..." 37 | folder.create "${output}" 38 | npm list > "${output}/${module}.txt" 39 | } 40 | 41 | npm.queryVersion() { 42 | local packageName="${1}" 43 | local version="${2}" 44 | local resolvedVersion=$(npm view "${packageName}@${version}" version | tail -1 | sed -E "s/.*'([0-9.]+)'/\1/" 2>&1) 45 | if [[ "${resolvedVersion}" == "" ]]; then 46 | echo "${version}" 47 | else 48 | echo "${resolvedVersion}" 49 | fi 50 | } -------------------------------------------------------------------------------- /scripts/dev/install-system.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | folder="${1}" 22 | deviceId="${2}" 23 | if [[ ! "${folder}" ]]; then 24 | echo "MUST provide a target folder" 25 | exit 1 26 | fi 27 | 28 | if [[ "${deviceId}" ]]; then 29 | deviceId="-s ${deviceId}" 30 | fi 31 | 32 | images=("boot" "system") 33 | 34 | pushd "${folder}" 35 | echo "Entering boot loader" 36 | adb ${deviceId} reboot bootloader 37 | 38 | for image in "${images[@]}"; do 39 | if [[ ! -e "${image}.img" ]]; then 40 | continue; 41 | fi 42 | 43 | echo "Flashing ${image}..." 44 | fastboot ${deviceId} flash "${image}" "${image}.img" 45 | done 46 | 47 | echo "Rebooting" 48 | fastboot ${deviceId} reboot 49 | popd 50 | -------------------------------------------------------------------------------- /scripts/node/firebase.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | firebase.setPath() { 4 | 5 | CONST_Firebase=$(which firebase) 6 | logWarning "Found firebase at: ${CONST_Firebase}" 7 | } 8 | 9 | firebase.verifyAccessToProject() { 10 | local firebaseProject=${1} 11 | 12 | logWarning "CONST_Firebase=${CONST_Firebase}" 13 | logDebug "Verifying You are logged in to firebase tools... command '${CONST_Firebase} login'" 14 | [[ "${USER,,}" != "jenkins" ]] && ${CONST_Firebase} login 15 | logDebug 16 | 17 | logDebug "Verifying access to firebase project: '${firebaseProject}'" 18 | local output=$(${CONST_Firebase} projects:list | grep "${firebaseProject}" 2>&1) 19 | if [[ "${output}" =~ "Command requires authentication" ]]; then 20 | logError " User not logged in" 21 | return 2 22 | fi 23 | 24 | # shellcheck disable=SC2076 25 | if [[ ! "${output}" =~ "${firebaseProject}" ]]; then 26 | logError " No access found to ${firebaseProject}" 27 | return 1 28 | fi 29 | return 0 30 | } 31 | 32 | firebase.login() { 33 | ${CONST_Firebase} login 34 | } 35 | 36 | firebase.use() { 37 | local firebaseProject=${1} 38 | $(resolveCommand firebase) use "${firebaseProject}" 39 | } 40 | 41 | firebase.deploy() { 42 | ${CONST_Firebase} deploy 43 | throwWarning "Error while deploying" 44 | } 45 | 46 | firebase.deploy.hosting() { 47 | ${CONST_Firebase} deploy --only hosting 48 | throwWarning "Error while deploying hosting" 49 | } 50 | 51 | firebase.deploy.functions() { 52 | ${CONST_Firebase} --debug deploy --only functions --force 53 | throwWarning "Error while deploying functions" 54 | } 55 | -------------------------------------------------------------------------------- /scripts/utils/create-ssl-cert.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | outputFolder=${1} 22 | 23 | if [[ ! "${outputFolder}" ]]; then 24 | outputFolder="." 25 | fi 26 | 27 | if [[ ! -d "${outputFolder}" ]]; then 28 | mkdir "${outputFolder}" 29 | fi 30 | 31 | openssl req \ 32 | -newkey rsa:2048 \ 33 | -x509 \ 34 | -nodes \ 35 | -keyout "${outputFolder}/server-temp.pem" \ 36 | -new \ 37 | -out "${outputFolder}/server-cert.pem" \ 38 | -subj /CN=localhost \ 39 | -reqexts SAN \ 40 | -extensions SAN \ 41 | -config <(cat /System/Library/OpenSSL/openssl.cnf \ 42 | <(printf '[SAN]\nsubjectAltName=DNS:localhost')) \ 43 | -sha256 \ 44 | -days 3650 45 | 46 | openssl rsa -in "${outputFolder}/server-temp.pem" -out "${outputFolder}/server-key.pem" 47 | -------------------------------------------------------------------------------- /scripts/._tests/versioning.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) 22 | source "${DIR}/_tests.sh" 23 | 24 | assertCommand "0.0.2" "promoteVersion 0.0.1 patch" 25 | assertCommand "0.1.1" "promoteVersion 0.1 patch 3" 26 | assertCommand "0.1.1" "promoteVersion 0.1 patch 2" 27 | assertCommand "0.1.1" "promoteVersion 0.1 patch" 28 | assertCommand "0.2" "promoteVersion 0.1 minor" 29 | assertCommand "0.3" "promoteVersion 0.2 minor 1" 30 | assertCommand "0.2.0" "promoteVersion 0.1 minor 3" 31 | assertCommand "1.0.0" "promoteVersion 0.2 major 3" 32 | assertCommand "1.0" "promoteVersion 0.2 major" 33 | assertCommand "1.0.0" "promoteVersion 0.2.0 major" 34 | assertCommand "1.0" "promoteVersion 0.2 major 2" 35 | assertCommand "1" "promoteVersion 0.2 major 1" 36 | 37 | printSummary -------------------------------------------------------------------------------- /scripts/dev/align-branch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | branchName= 3 | updateSubmodules= 4 | force= 5 | 6 | source ${BASH_SOURCE%/*}/../git/_core.sh 7 | 8 | extractParams() { 9 | for paramValue in "${@}"; do 10 | case "${paramValue}" in 11 | "--branch="*) 12 | branchName=`regexParam "--branch" "${paramValue}"` 13 | ;; 14 | 15 | "--gsu") 16 | updateSubmodules="true" 17 | ;; 18 | 19 | "--this") 20 | branchName=`gitGetCurrentBranch` 21 | ;; 22 | 23 | "--force") 24 | force="--force" 25 | ;; 26 | 27 | "*") 28 | echo "UNKNOWN PARAM: ${paramValue}"; 29 | ;; 30 | esac 31 | done 32 | } 33 | 34 | printUsage() { 35 | logVerbose 36 | logVerbose " USAGE:" 37 | logVerbose " ${BBlack}bash${NoColor} ${BCyan}${0}${NoColor} ${branchName}" 38 | logVerbose 39 | exit 0 40 | } 41 | 42 | verifyRequirement() { 43 | missingData= 44 | if [[ ! "${branchName}" ]]; then 45 | branchName="--branch=${paramColor}branch-name${NoColor}" 46 | missingData=true 47 | fi 48 | 49 | if [[ "${missingData}" ]]; then 50 | printUsage 51 | fi 52 | } 53 | 54 | extractParams $@ 55 | verifyRequirement 56 | 57 | git pull && git checkout ${branchName} && git pull 58 | 59 | bash ./dev-tools/scripts/git/git-checkout.sh --branch=${branchName} --project ${force} 60 | bash ./dev-tools/scripts/git/git-pull.sh --project 61 | 62 | if [[ "${updateSubmodules}" == "yes" ]]; then 63 | echo "calling git submodule update --init" 64 | git submodule update --init 65 | fi -------------------------------------------------------------------------------- /scripts/jenkins/_upgrade.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | source ${BASH_SOURCE%/*}/../android/_source.sh 22 | 23 | executeCommand() { 24 | local command=${1} 25 | local message=${2} 26 | if [[ ! "${message}" ]]; then message="Running: ${1}"; fi 27 | logInfo "${message}" 28 | eval "${command}" 29 | throwError "${message}" 30 | } 31 | 32 | logInfo "DID YOU REMEMBER TO COMMENT OUT THE PASSWORD?" 33 | 34 | signature "Jenkins Upgrade" 35 | executeCommand "sudo service jenkins stop" 36 | executeCommand "wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -" 37 | executeCommand "sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'" 38 | executeCommand "sudo apt-get update" 39 | executeCommand "sudo apt-get install jenkins" 40 | executeCommand "sudo service jenkins start" 41 | -------------------------------------------------------------------------------- /.jenkins/tests/test-ts-child-process/run.groovy: -------------------------------------------------------------------------------- 1 | @Library('dev-tools@prod') 2 | 3 | import com.nu.art.pipeline.modules.git.GitModule 4 | import com.nu.art.pipeline.modules.git.GitRepo 5 | import com.nu.art.pipeline.workflow.BasePipeline 6 | import com.nu.art.pipeline.workflow.Workflow 7 | 8 | class PipelineTest_ChildProcessTS 9 | extends BasePipeline { 10 | 11 | PipelineTest_ChildProcessTS() { 12 | super("Test TS Child Process", GitModule.class) 13 | } 14 | 15 | @Override 16 | protected void init() { 17 | } 18 | 19 | @Override 20 | void pipeline() { 21 | GitModule gitModule = getModule(GitModule.class) 22 | GitRepo repo = gitModule 23 | .create("https://github.com/nu-art/dev-tools.git") 24 | .setBranch("prod") 25 | .setOutputFolder(".") 26 | .build() 27 | 28 | repo.cloneRepo() 29 | 30 | _sh("""echo 18.15.0>.nvmrc""") // set nvm version 31 | _sh("""curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh" | bash""") // install nvm 32 | 33 | 34 | _sh(""" 35 | cat <package.json 36 | { 37 | "name": "temp", 38 | "version": "0.0.1", 39 | "devDependencies": { 40 | "@types/node": "^18.15.0", 41 | "@nu-art/build-and-install": "~0.204.38", 42 | "@nu-art/commando": "~0.204.38", 43 | "@nu-art/ts-common": "~0.204.38" 44 | } 45 | } 46 | EOF 47 | """) 48 | _sh(""" 49 | #!/bin/bash 50 | export NVM_DIR="\$HOME/.nvm" 51 | [ -s "\$NVM_DIR/nvm.sh" ] && \\. "\$NVM_DIR/nvm.sh" # This loads nvm 52 | nvm install 53 | nvm use 54 | npm i -g ts-node@latest 55 | ts-node ./.jenkins/tests/test-ts-child-process/test.ts 56 | """) 57 | } 58 | } 59 | 60 | node() { 61 | Workflow.createWorkflow(PipelineTest_ChildProcessTS.class, this) 62 | } 63 | -------------------------------------------------------------------------------- /scripts/dev/android-oo/classes/AndroidDevice.class.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | AndroidDevice() { 4 | 5 | declare serial 6 | declare status 7 | declare errorFileName 8 | 9 | _adbShell() { 10 | local command="${1}" 11 | local message="${2}" 12 | execute "${adbCommand} -s ${serial} shell ${command}" "${message}" 13 | } 14 | 15 | _adb() { 16 | local command="${1}" 17 | local message="${2}" 18 | execute "${adbCommand} -s ${serial} ${command}" "${message}" 19 | } 20 | 21 | _waitForDevice() { 22 | logInfo "_waitForDevice" ${@} 23 | } 24 | 25 | _installApp() { 26 | local app=${1} 27 | this.waitForDevice 28 | 29 | local appName="$("${app}.name")" 30 | local pathToApk="$("${app}.pathToApk")" 31 | local targetApkName="${appName}-app.apk" 32 | local pathToTargetApkName="/data/local/tmp/${targetApkName}" 33 | 34 | logVerbose 35 | this.adb "push ${pathToApk} ${pathToTargetApkName}" "Copy ${appName} apk onto device: ${pathToTargetApkName}" 2> "${errorFileName}" 36 | logVerbose 37 | this.adbShell "pm install -r -d ${pathToTargetApkName}" "Installing ${appName} apk onto device: ${pathToTargetApkName}" true 2> "${errorFileName}" 38 | 39 | # local output=$(cat "${errorFileName}") 40 | deleteFile "${errorFileName}" 41 | # retry "${output}" "installAppOnDevice ${serial}" "uninstallFromDevice ${serial}" "COULD NOT INSTALL APP" 42 | } 43 | 44 | _uninstallApp() { 45 | local app=${1} 46 | this.adb "uninstall $("${app}.packageName")" "Uninstalling '$("${app}.name")'..." 47 | } 48 | 49 | _forceStopApp() { 50 | local app=${1} 51 | this.adbShell "am force-stop $("${app}.packageName")" "Force stopping '$("${app}.name")'..." 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /scripts/git/fix-submodules.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | 22 | source ${BASH_SOURCE%/*}/_core.sh 23 | 24 | NEWLINE=$'\n' 25 | TAB=$'\t' 26 | 27 | directories=$(listAllGitFolders) 28 | directories=(${directories//,/ }) 29 | for folderName in "${directories[@]}"; do 30 | pushd ${folderName} >> /dev/null 31 | url=`gitGetRepoUrl` 32 | branch=`gitGetCurrentBranch` 33 | 34 | if [[ ! "${branch}" ]]; then 35 | branch=master 36 | fi 37 | 38 | finalOutput="${finalOutput}[submodule \"${folderName}\"]${NEWLINE}" 39 | finalOutput="${finalOutput}${TAB}path = ${folderName} ${NEWLINE}" 40 | finalOutput="${finalOutput}${TAB}url = ${url} ${NEWLINE}" 41 | finalOutput="${finalOutput}${TAB}branch = ${branch} ${NEWLINE}" 42 | popd >> /dev/null 43 | 44 | git submodule add ${url} ${folderName} 45 | done 46 | 47 | echo "${finalOutput}" > ./.gitmodules 48 | -------------------------------------------------------------------------------- /scripts/git/git-prune.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | 22 | source ${BASH_SOURCE%/*}/_core.sh 23 | 24 | projectsToIgnore=("dev-tools") 25 | runningDir=`getRunningDir` 26 | 27 | processFolder() { 28 | git remote prune origin 29 | } 30 | 31 | signature "prune repos" 32 | printCommand "$@" 33 | 34 | execute() { 35 | git remote prune origin 36 | } 37 | 38 | processSubmodule() { 39 | local mainModule=${1} 40 | logVerbose 41 | bannerDebug "Processing: ${mainModule}" 42 | 43 | execute & 44 | pid=$! 45 | pids+=(${pid}) 46 | 47 | local submodules=(`getSubmodulesByScope "project" "${projectsToIgnore[@]}"`) 48 | for submodule in "${submodules[@]}"; do 49 | cd ${submodule} 50 | processSubmodule "${mainModule}/${submodule}" 51 | cd .. 52 | done 53 | } 54 | 55 | processSubmodule "${runningDir}" 56 | 57 | for pid in "${pids[@]}"; do 58 | wait ${pid} 59 | done -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/modules/git/GitRepoConfig.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.modules.git 2 | 3 | class GitRepoConfig { 4 | final String url 5 | final String repoName 6 | final String group 7 | 8 | String outputFolder 9 | 10 | String service = "GithubWeb" 11 | String branch = "master" 12 | Boolean shallowClone = false 13 | Boolean trackSubmodules = true 14 | Boolean changelog = true 15 | GitModule module 16 | boolean trackSCM = true 17 | 18 | GitRepoConfig(GitModule module, String url) { 19 | this.module = module 20 | this.url = url 21 | this.repoName = url.replace(".git", "").substring(url.lastIndexOf("/") + 1) 22 | this.group = url.substring(url.indexOf(":") + 1,url.lastIndexOf("/")) 23 | this.outputFolder = this.repoName 24 | } 25 | 26 | GitRepoConfig setService(String service) { 27 | this.service = service 28 | return this 29 | } 30 | 31 | GitRepoConfig setBranch(String branch) { 32 | this.branch = branch 33 | return this 34 | } 35 | 36 | GitRepoConfig setOutputFolder(String outputFolder) { 37 | this.outputFolder = outputFolder 38 | return this 39 | } 40 | 41 | GitRepoConfig setShallowClone(Boolean shallowClone) { 42 | this.shallowClone = shallowClone 43 | return this 44 | } 45 | 46 | GitRepoConfig setTrackSubmodules(Boolean trackSubmodules) { 47 | this.trackSubmodules = trackSubmodules 48 | return this 49 | } 50 | 51 | GitRepoConfig setChangelog(Boolean changelog) { 52 | this.changelog = changelog 53 | return this 54 | } 55 | 56 | GitRepoConfig setTrackSCM(boolean trackSCM) { 57 | this.trackSCM = trackSCM 58 | return this 59 | } 60 | 61 | String getOutputFolder() { 62 | return outputFolder 63 | } 64 | 65 | GitRepo build() { 66 | return module.createRepo(this) 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /scripts/_core-tools/folder-filters.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | allFolders() { 22 | echo true 23 | } 24 | 25 | allGitFolders() { 26 | local module=${1} 27 | [[ ! -e "${module}/.git" ]] && return 28 | echo true 29 | } 30 | 31 | gitFolders() { 32 | local module=${1} 33 | [[ "${module}" == "dev-tools" ]] && return 34 | [[ ! -e "${module}/.git" ]] && return 35 | echo true 36 | } 37 | 38 | moduleFolder() { 39 | # shellcheck disable=SC2076 40 | [[ "$(cat "${1}/build.gradle" | grep com.android.application)" =~ "com.android.application" ]] && echo 41 | echo true 42 | } 43 | 44 | androidAppsFolder() { 45 | # shellcheck disable=SC2076 46 | [[ ! "$(cat "${1}/build.gradle" | grep com.android.application)" =~ "com.android.application" ]] && return 47 | echo true 48 | } 49 | 50 | allGradleFolders() { 51 | [[ ! -e "${1}/build.gradle" ]] || [[ -e "${1}/settings.gradle" ]] && return 52 | echo true 53 | } 54 | -------------------------------------------------------------------------------- /scripts/android/tools.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | 22 | waitForDevice() { 23 | local deviceId=${1} 24 | local wait= 25 | if [[ ! ${2} ]]; then 26 | wait=30 27 | else 28 | wait=$((${2}-1)) 29 | fi 30 | local message=${3} 31 | 32 | if [[ ! "${deviceId}" ]]; then 33 | throwError "Error waiting for device... no deviceId specified!!" 2 34 | fi 35 | 36 | local device=`adb devices | grep ${deviceId}` 37 | 38 | if [[ "${wait}" == "0" ]]; then 39 | logVerbose 40 | logError "Device connection timed out" 41 | exit 3 42 | fi 43 | 44 | if [[ "${device}" ]]; then 45 | logVerbose 46 | return 47 | fi 48 | 49 | if [[ ! "${message}" ]]; then 50 | message="Waiting for device '${deviceId}'" 51 | fi 52 | 53 | logWarning "${message}... ${wait}s " true 54 | sleep 1 55 | waitForDevice ${deviceId} ${wait} ${3} 56 | } -------------------------------------------------------------------------------- /scripts/_core-tools/_source.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | DIR_CoreTools=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) 22 | 23 | CHAR_TAB="$(printf '\t')" 24 | 25 | source ${DIR_CoreTools}/colors.sh 26 | source ${DIR_CoreTools}/logger.sh 27 | source ${DIR_CoreTools}/time.sh 28 | source ${DIR_CoreTools}/signature.sh 29 | source ${DIR_CoreTools}/spinner.sh 30 | 31 | source ${DIR_CoreTools}/tools.sh 32 | source ${DIR_CoreTools}/error-handling.sh 33 | source ${DIR_CoreTools}/cli-params.sh 34 | source ${DIR_CoreTools}/folder-filters.sh 35 | source ${DIR_CoreTools}/file-tools.sh 36 | source ${DIR_CoreTools}/folder-tools.sh 37 | source ${DIR_CoreTools}/array-tools.sh 38 | source ${DIR_CoreTools}/string-tools.sh 39 | source ${DIR_CoreTools}/number-tools.sh 40 | source ${DIR_CoreTools}/versioning.sh 41 | source ${DIR_CoreTools}/help-tools.sh 42 | source ${DIR_CoreTools}/prompt-tools.sh 43 | source ${DIR_CoreTools}/shell.sh 44 | source ${DIR_CoreTools}/debugger.sh 45 | -------------------------------------------------------------------------------- /scripts/oos/graphics/Canvas2D.class.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | Canvas2D() { 4 | 5 | declare buffer 6 | declare width 7 | declare height 8 | 9 | _prepare() { 10 | buffer=() 11 | } 12 | 13 | _paint() { 14 | local animation=${1} 15 | local x=${2} 16 | local y=${3} 17 | local animHeight=`${animation}.height` 18 | for (( i=0; i<${animHeight}; i+=1 )); do 19 | local line=`${animation}.getLine ${i}` 20 | local offset=`${animation}.getOffset ${i}` 21 | 22 | lineAsArray=() 23 | for (( l=0 ; l < ${#line} ; l++ )); do lineAsArray[l]=${line:l:1}; done 24 | 25 | local position1=$(( (${i} + ${y}) * ${width} + ${x} + ${offset} )) 26 | local position2=$(( ${position1} + ${#line} )) 27 | # >&2 logDebug "${animation} (${x},${y}) ${line}" 28 | 29 | for (( k=0; k<${#lineAsArray[@]}; k+=1)); do 30 | local index=$((${position1} + ${k})) 31 | 32 | # >&2 logDebug "${animation} (${x},${y}) ${index} ${lineAsArray[${k}]}" 33 | buffer[${index}]="${lineAsArray[${k}]}" 34 | done 35 | # buffer="${buffer:0:${position1}}${line}${buffer:${position2}}" 36 | done 37 | } 38 | 39 | _clean() { 40 | for ((i=0; i< ${height}; i++)); do 41 | tput cuu1 tput el 42 | done 43 | } 44 | 45 | _draw() { 46 | local char 47 | for (( h=0; h<${height}; h+=1 )); do 48 | local limit=$(( (h+1) * ${width} )) 49 | echo -n A 50 | for (( w=$(( h * ${width} )); w ${parentFolder}" 55 | } -------------------------------------------------------------------------------- /gradle/version-bump-tasks.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Permissions management system, define access level for each of 3 | * your server apis, and restrict users by giving them access levels 4 | * 5 | * Copyright (C) 2020 Adam van der Kruk aka TacB0sS 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | apply from: rootProject.projectDir.getAbsolutePath() + '/dev-tools/gradle/version-bump.gradle' 21 | 22 | task incrementVersionName { 23 | doLast { 24 | switch (promoteVersion) { 25 | case "Build": 26 | println("incrementVersionNameBuild") 27 | incrementVersionName(4, 3) 28 | break 29 | 30 | case "Minor": 31 | println("incrementVersionNameMinor") 32 | incrementVersionName(3, 2) 33 | break 34 | 35 | case "Major": 36 | println("incrementVersionNameMajor") 37 | incrementVersionName(3, 1) 38 | break 39 | 40 | case "Version": 41 | println("incrementVersionNameVersion") 42 | incrementVersionName(3, 0) 43 | break 44 | 45 | } 46 | } 47 | } 48 | 49 | task incrementVersionCode { 50 | doLast { 51 | println("incrementVersionCode") 52 | incrementVersionCode() 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /.jenkins/tests/test-ts-child-process/test.ts: -------------------------------------------------------------------------------- 1 | import {exec} from 'child_process'; 2 | 3 | 4 | console.log('SUCCESS!!'); 5 | 6 | exec('echo YEY!!'); 7 | 8 | const commandSetup = ` 9 | echo 1 10 | 11 | export NVM_DIR="\$HOME/.nvm" 12 | echo "2 export NVM_DIR="\$HOME/.nvm" => $?" 13 | 14 | [ -s "\$NVM_DIR/nvm.sh" ] && . "\$NVM_DIR/nvm.sh" # This loads nvm 15 | echo "3 [ -s "\$NVM_DIR/nvm.sh" ] && . "\$NVM_DIR/nvm.sh" => $?" 16 | 17 | nvm install 18 | echo "4 nvm install => $?" 19 | 20 | nvm use 21 | echo "5 nvm use => $?" 22 | 23 | npm i -g ts-node@latest 24 | echo "6 npm i -g ts-node@latest => $?" 25 | 26 | curl -fsSL "https://get.pnpm.io/install.sh" | env PNPM_VERSION=9.1.0 bash - 27 | 28 | echo 1 29 | pnpm store prune 30 | echo 2 31 | pnpm install -f --no-frozen-lockfile --prefer-offline false 32 | `; 33 | 34 | const commandPNPM = ` 35 | echo 1 36 | pnpm store prune 37 | echo 2 38 | pnpm install -f --no-frozen-lockfile --prefer-offline false 39 | `; 40 | 41 | function execute(command: string, label: string, next?: () => Promise) { 42 | console.log(`-------------------- STARTED ${label} -----------------------`); 43 | return new Promise((resolve, reject) => { 44 | console.log(`${label} - RUNNING!!`); 45 | console.log(`${label} - command: `, command); 46 | exec(command, {shell: '/bin/bash'}, (error, stdout, stderr) => { 47 | console.log(`${label} - COMPLETED RUNNING!!`); 48 | if (error) 49 | console.error(`${label} - error:`, error); 50 | resolve({stdout, stderr}); 51 | }); 52 | }).then(async ({stdout, stderr}: any) => { 53 | console.log(`${label} - DONE!!`); 54 | console.log(`${label} - stdout:`, stdout); 55 | 56 | console.error(`${label} - stderr:`, stderr); 57 | console.log(`-------------------- ENDED ${label} -----------------------`); 58 | return next?.(); 59 | }); 60 | } 61 | 62 | execute(commandSetup, 'setup'); 63 | // execute(commandSetup, 'setup', () => execute(commandPNPM, 'pnpm-install')); 64 | 65 | -------------------------------------------------------------------------------- /scripts/._tests/core/spinner.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) 22 | source "${DIR}/../_tests.sh" 23 | 24 | actionToRun() { 25 | echo "Got param: ${1} - START" 26 | sleep 1 27 | echo "Got param: 1" 28 | sleep 1 29 | echo "Got param: 2" 30 | sleep 1 31 | echo "Got param: 3" 32 | sleep 1 33 | echo "Got param: 4" 34 | sleep 1 35 | echo "Got param: 5" 36 | echo "Got param: ${1} - END" 37 | } 38 | 39 | spinner "actionToRun Default" "test" 40 | spinner "actionToRun Dot" "test" Spinner_Dot 41 | spinner "actionToRun Vertical" "test" Spinner_Vertical 42 | spinner "actionToRun Horizontal" "test" Spinner_Horizontal 43 | spinner "actionToRun Arrows" "test" Spinner_Arrows 44 | spinner "actionToRun WHAT" "test" Spinner_WHAT 45 | spinner "actionToRun WHAT2" "test" Spinner_WHAT2 46 | spinner "actionToRun Triangle" "test" Spinner_Triangle 47 | spinner "actionToRun Square" "test" Spinner_Square 48 | spinner "actionToRun Quarters" "test" Spinner_Quarters 49 | spinner "actionToRun Halves" "test" Spinner_Halves 50 | spinner "actionToRun Braille" "test" Spinner_Braille -------------------------------------------------------------------------------- /scripts/_core-tools/number-tools.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | 22 | ## @function: number_assertNumeric(number, defaultValue?) 23 | ## 24 | ## @description: 25 | ## Asserts that the given "number" is numeric, other wise return the defaultValue. 26 | ## If no default value is provided, this will throw an error NaN... 27 | ## 28 | ## @return: The numeric value give, or the default value if provided 29 | number_assertNumeric() { 30 | local number="${1}" 31 | local defaultValue="${2}" 32 | 33 | if [[ ! "${number}" =~ ^[+-]?[0-9]+([.][0-9]+)?$ ]]; then 34 | [[ ! "${defaultValue}" ]] && throwError "'${number}' is NaN" 2 35 | [[ ! "${defaultValue}" =~ ^[+-]?[0-9]+([.][0-9]+)?$ ]] && throwError "Default provided '${defaultValue}' is NaN" 2 36 | 37 | echo "${defaultValue}" 38 | return 39 | fi 40 | 41 | echo "${number}" 42 | } 43 | 44 | ## @function: number_random(seed) 45 | ## 46 | ## @description: 47 | ## Generate a random number between 0 - ${seed} 48 | ## 49 | ## @return: The generated random number 50 | number_random() { 51 | local seed=$(number_assertNumeric "${1}" 100) 52 | echo "$(((RANDOM * RANDOM * RANDOM) % seed))" 53 | } 54 | -------------------------------------------------------------------------------- /scripts/dev/android-oo/classes/GradleWorkspace.class.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | GradleWorkspace() { 4 | declare appVersion 5 | 6 | declare -a active 7 | declare -a apps 8 | 9 | Workspace.active.generateCommand() { 10 | this.generateCommand "${1}" "${active[*]}" "${@:2}" 11 | } 12 | 13 | _generateCommand() { 14 | local command=${1} 15 | [[ ! "${command}" ]] && throwError "No command specified" 2 16 | local items=(${2}) 17 | 18 | for item in "${items[@]}"; do 19 | _pushd "$("${item}.path")/$("${item}.folderName")" 20 | "${item}.${command}" "${@:3}" 21 | (($? > 0)) && throwError "Error executing command: ${item}.${command}" 22 | _popd 23 | done 24 | } 25 | 26 | _setup() { 27 | logInfo 28 | bannerInfo "Setup Workspace" 29 | [[ ! -e ".scripts/apps.sh" ]] && throwError "Must specify .scripts/apps.sh for project !!" 2 30 | source .scripts/apps.sh 31 | } 32 | 33 | _clean() { 34 | [[ ! "${ts_clean}" ]] && return 35 | 36 | logInfo 37 | bannerInfo "Clean" 38 | 39 | this.active.forEach clean 40 | } 41 | 42 | _compile() { 43 | logInfo "_compile" 44 | } 45 | 46 | _uninstall() { 47 | logInfo "_uninstall" 48 | } 49 | 50 | _install() { 51 | if [[ ! -e "${outputFolder}" ]]; then 52 | throwError "Output folder does not exists... Build needed - ${outputFolder}" 2 53 | fi 54 | 55 | if [[ ! "${pathToApk}" ]]; then 56 | pathToApk=$(find "${outputFolder}" -name "${apkPattern}") 57 | fi 58 | 59 | if [[ ! "${pathToApk}" ]]; then 60 | throwError "Could not find apk in path '${outputFolder}', matching the pattern '${apkPattern}'" 2 61 | fi 62 | } 63 | 64 | _launch() { 65 | logInfo "_launch" 66 | } 67 | 68 | _dependencies() { 69 | logInfo "_dependencies" 70 | } 71 | 72 | _forceStop() { 73 | logInfo "_forceStop" 74 | } 75 | 76 | _clearData() { 77 | logInfo "_forceStop" 78 | } 79 | 80 | _test() { 81 | logInfo "_test" 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /gradle/common-cyborg-lib.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Permissions management system, define access level for each of 3 | * your server apis, and restrict users by giving them access levels 4 | * 5 | * Copyright (C) 2020 Adam van der Kruk aka TacB0sS 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | apply plugin: 'com.android.library' 20 | 21 | // To be removed, use the common-cyborg.gradle and call applyAndroidLibrary 22 | android { 23 | def rootProjectPath = rootProject.projectDir.getAbsolutePath() 24 | apply from: rootProjectPath + '/dev-tools/gradle/utils.gradle' 25 | 26 | compileSdkVersion COMPILE_SDK.toInteger() 27 | if (!checkMinGradleVersion("4.4")) 28 | buildToolsVersion TOOLS_VERSION 29 | 30 | lintOptions { 31 | abortOnError false 32 | } 33 | 34 | compileOptions { 35 | sourceCompatibility JavaVersion.VERSION_1_8 36 | targetCompatibility JavaVersion.VERSION_1_8 37 | } 38 | 39 | defaultConfig { 40 | minSdkVersion MIN_SDK 41 | targetSdkVersion TARGET_SDK 42 | versionName getVersionNameFromFile() 43 | project.version = versionName 44 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 45 | 46 | javaCompileOptions { 47 | annotationProcessorOptions { 48 | includeCompileClasspath false 49 | } 50 | } 51 | } 52 | 53 | buildTypes { 54 | release { 55 | signingConfig null 56 | } 57 | } 58 | 59 | defineVariantsAAR() 60 | } -------------------------------------------------------------------------------- /scripts/._tests/file/file.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | DIR_test_file=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) 22 | source "${DIR_test_file}/../_tests.sh" 23 | 24 | test.file.prepare() { 25 | rm -rf output 26 | mkdir output 27 | } 28 | 29 | test.file.cleanup() { 30 | rm -rf output 31 | } 32 | 33 | test.file.copy() { 34 | local originName=origin.txt 35 | local targetName=target.txt 36 | 37 | echo ZE ZEVEL > ./output/${originName} 38 | file.copy "./output/${originName}" "./output" "${targetName}" -s 39 | cat "./output/${targetName}" 40 | } 41 | 42 | test.file.findMatches() { 43 | local originName=origin.txt 44 | local pathToFile=./output/${originName} 45 | echo 'ZE "$ZEVEL"' > "${pathToFile}" 46 | echo '"$ZEVEL" ZEZE' >> "${pathToFile}" 47 | 48 | local toRet=() 49 | toRet+=($(file.findMatches "${pathToFile}" '"(\$.*?)"')) 50 | echo "${toRet[@]}" 51 | } 52 | 53 | test.file.pathToFile() { 54 | local pathToFile="$(file.pathToFile "/pah/zevel/male.ashpa")" 55 | echo "${pathToFile}" 56 | } 57 | 58 | assertCommand '/pah/zevel' "test.file.pathToFile" 59 | #assertCommand "ZE ZEVEL" "test.file.copy" "test.file.prepare" "test.file.cleanup" 60 | #assertCommand '"$ZEVEL" "$ZEVEL"' "test.file.findMatches" "test.file.prepare" "test.file.cleanup" 61 | -------------------------------------------------------------------------------- /scripts/._tests/array/array.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) 22 | source "${DIR}/../_tests.sh" 23 | arrayRemoveTest1() { 24 | local pah=("value1" "value2" "value3" "value4") 25 | array_remove pah value3 value4 26 | echo "${pah[@]}" 27 | } 28 | 29 | arrayRemoveTest2() { 30 | local pah=("value1" "value2" "value3" "value4" "value4") 31 | array_remove pah value3 value4 32 | echo "${pah[@]}" 33 | } 34 | 35 | arraySetVarTest1() { 36 | local pah=("value1" "value2") 37 | array_setVariable zevel "${pah[@]}" 38 | echo "${zevel[@]}" 39 | } 40 | 41 | test.array.filterDuplicates() { 42 | pah=("value1" "value2" "value2" "value2" "value3" "value2" "value1") 43 | array.filterDuplicates pah 44 | echo "${pah[@]}" 45 | } 46 | 47 | arrayMapperTest1() { 48 | mapper() { 49 | local input=${1} 50 | string_replaceAll "-" "_" "${input}" 51 | } 52 | 53 | local pah=("valu-e1" "val--ue-2") 54 | array.map pah zevel mapper 55 | echo "${zevel[@]}" 56 | } 57 | 58 | assertCommand "value1 value2 value3" "test.array.filterDuplicates" 59 | assertCommand "value1 value2" "arrayRemoveTest1" 60 | assertCommand "value1 value2" "arrayRemoveTest2" 61 | assertCommand "value1 value2" "arraySetVarTest1" 62 | assertCommand "valu_e1 val__ue_2" "arrayMapperTest1" 63 | -------------------------------------------------------------------------------- /scripts/oos/tests/clouds/_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DIR1=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) 4 | source "${DIR1}/../../core/transpiler.sh" 5 | source "${DIR1}/clouds.sh" 6 | 7 | CONST_Debug=true 8 | addTranspilerClassPath "${DIR1}/../../graphics" 9 | 10 | run() { 11 | new Canvas2D canvas 12 | new Drawable2D cloud1 13 | new Drawable2D cloud2 14 | 15 | canvas.width = 100 16 | canvas.height = 10 17 | canvas.prepare 18 | #canvas.clean 19 | # 20 | cloud1.animObj = "$(_cloud2)" 21 | cloud1.init 22 | 23 | cloud2.animObj = "$(_cloud1)" 24 | cloud2.init 25 | 26 | fromX=10 27 | toX=80 28 | dx=1 29 | 30 | for ((x = fromX; x != toX; x += dx)); do 31 | canvas.prepare 32 | canvas.paint cloud1 ${x} 1 33 | canvas.paint cloud1 $((${x} + 5)) 1 34 | canvas.paint cloud2 $((90 - ${x})) 3 35 | canvas.draw 36 | canvas.clean 37 | done 38 | canvas.draw 39 | } 40 | 41 | runEngine() { 42 | createEngine() { 43 | new Engine2D engine 44 | new Canvas2D canvas 45 | canvas.width = 100 46 | canvas.height = 20 47 | engine.canvas = canvas 48 | } 49 | 50 | createCloud() { 51 | local name=${1} 52 | local image=${2} 53 | local startFrame=${3} 54 | local endFrame=${4} 55 | local calcX=${5} 56 | local calcY=${6} 57 | 58 | new Drawable2D ${name} 59 | new Animator2D anim_${name} 60 | 61 | ${name}.animObj = "${image}" 62 | ${name}.init 63 | 64 | anim_${name}.drawable = ${name} 65 | anim_${name}.startFrame = 5 66 | anim_${name}.endFrame = 90 67 | 68 | anim_${name}.interpolatorX = "${calcX}" 69 | anim_${name}.interpolatorY = "${calcY}" 70 | engine.addAnimation anim_${name} 71 | } 72 | 73 | createEngine 74 | 75 | createCloud cloud1 "$(_cloud1)" 5 90 "(\${2} * 80)/1" "(2 + \${2} * 6)/1" 76 | createCloud cloud3 "$(_cloud3)" 5 90 "(\${2} * 80)/1" "(10 - (2 + \${2} * 6))/1" 77 | createCloud cloud2 "$(_cloud2)" 5 90 "(80 - \${2} * 80)/1" "(2 + \${2} * 6)/1" 78 | createCloud cloud4 "$(_cloud4)" 5 90 "(80 - \${2} * 80)/1" "(10 - (2 + \${2} * 6))/1" 79 | 80 | engine.frame = 0 81 | engine.totalFrames = 100 82 | time engine.start 83 | } 84 | 85 | runEngine 86 | -------------------------------------------------------------------------------- /scripts/ci/thunderstorm/params.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | debug= 4 | 5 | branch= 6 | gitUrl= 7 | folderName= 8 | versionPromotion= 9 | 10 | deploy= 11 | publish= 12 | environment= 13 | 14 | params=(debug branch gitUrl folderName environment versionPromotion deploy publish) 15 | 16 | extractParams() { 17 | for paramValue in "${@}"; do 18 | case "${paramValue}" in 19 | # ==== General ==== 20 | "--help" | "-h") 21 | #￿￿￿￿DOC: This help menu 22 | 23 | printHelp "${BASH_SOURCE%/*}/params.sh" 24 | ;; 25 | 26 | "--branch="* | "-b="*) 27 | #￿￿￿￿DOC: which branch to clone 28 | 29 | branch=$(regexParam "--branch|-b" "${paramValue}") 30 | ;; 31 | 32 | "--gitUrl="* | "-u="*) 33 | #￿￿￿￿DOC: The project repo to clone from 34 | 35 | gitUrl=$(regexParam "--gitUrl|-u" "${paramValue}") 36 | ;; 37 | 38 | "--folderName="* | "-f="*) 39 | #￿￿￿￿DOC: The local folder name the repo will be cloned into 40 | 41 | folderName=$(regexParam "--folderName|-f" "${paramValue}") 42 | ;; 43 | 44 | "--publish="* | "-p="*) 45 | #￿￿￿￿DOC: Whether to publish artifacts an which version to promote 46 | #PARAM=[pathc | minor | major] 47 | 48 | versionPromotion=$(regexParam "--publish|-p" "${paramValue}") 49 | publish=true 50 | ;; 51 | 52 | "--deploy" | "-d") 53 | #￿￿￿￿DOC: Whether to deploy frontend and backend 54 | 55 | deploy=true 56 | ;; 57 | 58 | "--env="* | "-e="*) 59 | #￿￿￿￿DOC: Which environment to build the project 60 | 61 | environment=$(regexParam "--env|-e" "${paramValue}") 62 | ;; 63 | 64 | *) 65 | logWarning "UNKNOWN PARAM: ${paramValue}" 66 | ;; 67 | esac 68 | done 69 | 70 | [[ ! "${branch}" ]] && throwError "Mandatory param is missing: branch" 2 71 | [[ ! "${gitUrl}" ]] && throwError "Mandatory param is missing: gitUrl" 2 72 | [[ ! "${folderName}" ]] && throwError "Mandatory param is missing: folderName" 2 73 | [[ ! "${versionPromotion}" ]] && throwError "Mandatory param is missing: versionPromotion" 2 74 | [[ ! "${environment}" ]] && throwError "Mandatory param is missing: environment" 2 75 | 76 | } 77 | -------------------------------------------------------------------------------- /scripts/oos/graphics/Engine2D.class.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | Engine2D() { 4 | 5 | declare canvasCount=0 6 | declare array canvas=() 7 | declare width 8 | declare height 9 | declare array animators 10 | declare totalFrames=1 11 | declare frame=0 12 | 13 | _addAnimation() { 14 | animators=("${animators[@]}" "${1}") 15 | } 16 | 17 | _start() { 18 | eval "new Canvas2D canvas1" 19 | while (( ${frame} < ${totalFrames} )); do 20 | this.render 21 | # sleep 0.05 22 | frame=$(( ${frame} + 1 )) 23 | done 24 | } 25 | 26 | 27 | _render() { 28 | canvas1.width = ${width} 29 | canvas1.height = ${height} 30 | 31 | pickedCanvas=canvas1 32 | ${pickedCanvas}.prepare 33 | local width=${pickedCanvas}.width 34 | local height=${pickedCanvas}.height 35 | 36 | for animator in "${animators[@]}"; do 37 | local startFrame=`${animator}.startFrame` 38 | local endFrame=`${animator}.endFrame` 39 | if (( ${frame} < ${startFrame} ));then 40 | continue 41 | fi 42 | 43 | if (( ${frame} >= ${endFrame} ));then 44 | continue 45 | fi 46 | 47 | # local progress="0.5" 48 | local progress=`echo " (${frame} - ${startFrame}) / (${endFrame} - ${startFrame}) " | bc -l` 49 | 50 | # local posX=`${animator}.calculateX posX ${progress} ${width} ${height}` 51 | # local posY=`${animator}.calculateY posY ${progress} ${width} ${height}` 52 | 53 | local posX= 54 | ${animator}.calculateX posX ${progress} ${width} ${height} 55 | local posY= 56 | ${animator}.calculateY posY ${progress} ${width} ${height} 57 | 58 | # >&2 echo "Render: ${animator} (${posX}, ${posY})" 59 | local drawable=`${animator}.drawable` 60 | ${pickedCanvas}.paint ${drawable} ${posX} ${posY} 61 | 62 | # pickedCanvas.paint ${drawable} 80 4 63 | done 64 | ${pickedCanvas}.draw 65 | ${pickedCanvas}.clean 66 | # sleep 0.01 67 | } 68 | } 69 | 70 | -------------------------------------------------------------------------------- /gradle/common-cyborg-app.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Permissions management system, define access level for each of 3 | * your server apis, and restrict users by giving them access levels 4 | * 5 | * Copyright (C) 2020 Adam van der Kruk aka TacB0sS 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | apply plugin: 'com.android.application' 20 | 21 | // To be removed, use the common-cyborg.gradle and call applyAndroidApplication 22 | android { 23 | def rootProjectPath = rootProject.projectDir.getAbsolutePath() 24 | 25 | compileSdkVersion COMPILE_SDK.toInteger() 26 | if (!checkMinGradleVersion("4.4")) 27 | buildToolsVersion TOOLS_VERSION 28 | 29 | defaultConfig { 30 | minSdkVersion MIN_SDK 31 | targetSdkVersion TARGET_SDK 32 | versionName getVersionNameFromFile() 33 | versionCode getVersionCodeFromFile() 34 | project.version = versionName 35 | multiDexEnabled true 36 | 37 | javaCompileOptions { 38 | annotationProcessorOptions { 39 | includeCompileClasspath false 40 | } 41 | } 42 | } 43 | 44 | lintOptions { 45 | checkReleaseBuilds false 46 | abortOnError false 47 | } 48 | 49 | compileOptions { 50 | sourceCompatibility JavaVersion.VERSION_1_8 51 | targetCompatibility JavaVersion.VERSION_1_8 52 | } 53 | 54 | signingConfigs { 55 | debug { 56 | storeFile file(rootProjectPath + "/debug.keystore") 57 | } 58 | } 59 | 60 | buildTypes { 61 | debug { 62 | signingConfig signingConfigs.debug 63 | } 64 | } 65 | } -------------------------------------------------------------------------------- /scripts/animation/animator.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | 5 | " _ " 6 | " (\` ). _ " 7 | " ( ). .:(\` )\`. " 8 | ") _( '\`. :( . ) " 9 | " .=(\`( . ) .-- \`. ( ) ) " 10 | " (( (..__.:'-' .+( ) \` _\` ) ) " 11 | "\`. \`( ) ) ( . ) ( ) ._ " 12 | " ) \` __.:' ) ( ( )) \`-'.-(\` ) " 13 | ") ) ( ) --' \`- __.' :( )) " 14 | ".-' (_.' .') \`( ) )) " 15 | " (_ ) \` __.:' " 16 | " " 17 | " _.-._ _.-._ " 18 | "--..,___.--,/ \-..-.--+--.,,-,,..._.--..-._/ \." 19 | 20 | 21 | 22 | _cloud1() { 23 | cloud1=" _ 24 | (\` ). 25 | ( ). 26 | ( ( '\`. 27 | ( ) . ) 28 | (..__.:'--''" 29 | 30 | } 31 | 32 | _cloud2() { 33 | cloud2="OS .-- 34 | OS ( ) 35 | OS ( . ) 36 | OS( ( )) 37 | OS\`- __.' " 38 | } 39 | 40 | _cloud1 41 | _cloud2 42 | 43 | animate() { 44 | local item=${1} 45 | local x=${2} 46 | local y=${3} 47 | local width=${4} 48 | local height=${5} 49 | 50 | local toX=${5} 51 | local toY=${5} 52 | 53 | local fromX=${2} 54 | local toX=${3} 55 | local fromY=${4} 56 | local toY=${5} 57 | local dx=1 58 | local dy=1 59 | 60 | if (( ${fromX} > ${toX} )); then 61 | dx=-1 62 | fi 63 | 64 | 65 | for (( arg=${fromX}; arg != ${toX}; arg+=${dx} )); do 66 | echo "fromX: ${fromX} toX: ${toX} progress: ${arg}" 67 | local replacer=`seq -f " " -s '' ${arg}` 68 | local temp=`echo "${item}" | sed -E "s/OS/${replacer}/"` 69 | echo -e "${temp}" 70 | 71 | if [[ "${arg}" == "${toX}" ]]; then 72 | break; 73 | fi 74 | 75 | sleep 0.01 76 | tput cuu1 77 | tput cuu1 78 | tput cuu1 79 | tput cuu1 80 | tput cuu1 81 | tput cuu1 82 | done 83 | } 84 | 85 | animate "${cloud2}" 5 20 86 | animate "${cloud1}" 5 20 -------------------------------------------------------------------------------- /scripts/python/python3.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | python3.install() { 4 | local version="${1:-"3.11"}" 5 | 6 | if [[ $(python3.isInstalled) -eq 0 ]]; then 7 | if ! [[ "$(python3.version)" =~ ${version} ]]; then 8 | if [[ $(isMacOS) == "true" ]]; then 9 | brew update 10 | bannerInfo "Python3 - Installing v${version}" 11 | brew install python@${version} 12 | python3 -m ensurepip --upgrade 13 | else 14 | # Assuming apt for non-macOS systems; adjust as necessary 15 | bannerInfo "Python3 - Installing v${version}" 16 | sudo apt-get update 17 | sudo apt-get install -y python3 python3-pip 18 | python3 --version 19 | pip3 --version 20 | # Use update-alternatives to set python3 as the default python version if needed 21 | fi 22 | fi 23 | fi 24 | 25 | logInfo "Python3 - Installed ${version}" 26 | } 27 | 28 | python3.isInstalled() { 29 | [[ -x "$(command -v python3)" ]] && return 0 30 | } 31 | 32 | python3.version() { 33 | if [[ -x "$(command -v python3)" ]]; then 34 | python3 --version 35 | fi 36 | } 37 | 38 | python3.installvenv() { 39 | logInfo "PIP3 - Installing packages ${*}" 40 | if [[ $(isMacOS) == "true" ]]; then 41 | pip3 install venv 42 | else 43 | sudo apt-get install -y python3-venv 44 | fi 45 | } 46 | 47 | python3.setVenv() { 48 | local envName=${1} 49 | logInfo "Setting up VENV - ${envName}" 50 | python3 -m venv "${envName}" 51 | source "${envName}/bin/activate" 52 | 53 | } 54 | 55 | python3.installRequirements() { 56 | local folderName=${1:-.} 57 | logInfo "PIP3 - Installing Requirements" 58 | pip3 install -r "${folderName}/requirements.txt" 59 | } 60 | 61 | python3.uninstallRequirements() { 62 | local folderName=${1:-.} 63 | logInfo "PIP3 - Uninstalling Requirements" 64 | pip3 uninstall -r "${folderName}/requirements.txt" 65 | } 66 | 67 | python3.installPackages() { 68 | logInfo "PIP3 - Installing packages ${*}" 69 | pip3 install "${@}" 70 | } 71 | 72 | python3.uninstallPackages() { 73 | logInfo "PIP3 - Uninstalling packages ${*}" 74 | python3 uninstall "${@}" 75 | } 76 | 77 | python3.run() { 78 | local pathToMainFile=${1} 79 | export PYTHONPATH=. 80 | python3 "${pathToMainFile}" ${@:2} 81 | } 82 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/workflow/BasePipeline.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.workflow 2 | 3 | import com.nu.art.pipeline.modules.build.BuildModule 4 | import com.nu.art.pipeline.modules.build.JobTrigger 5 | import com.nu.art.pipeline.workflow.variables.VarConsts 6 | import com.nu.art.pipeline.workflow.variables.Var_Creds 7 | import com.nu.art.pipeline.workflow.variables.Var_Env 8 | 9 | abstract class BasePipeline 10 | extends WorkflowModulesPack { 11 | 12 | public Var_Env Var_CleanWorkspace = new Var_Env("CLEAN_WORKSPACE") 13 | 14 | private static Class[] defaultModules = [BuildModule.class] 15 | protected final Workflow workflow = Workflow.workflow 16 | 17 | protected final String name 18 | protected Var_Creds[] creds = [] 19 | protected String[] sshCreds = [] 20 | 21 | BasePipeline(String name, Class... modules) { 22 | super(defaultModules + modules) 23 | this.name = name 24 | } 25 | 26 | T printEnvParams(Var_Env... envVars) { 27 | envVars.each { workflow.logDebug("${it.varName} == ${it.get()}") } 28 | return (T) this 29 | } 30 | 31 | T setRequiredCredentials(Var_Creds... creds) { 32 | this.creds = creds 33 | return (T) this 34 | } 35 | 36 | T setRequiredSSHCredentials(String... sshCreds) { 37 | this.sshCreds = sshCreds 38 | return (T) this 39 | } 40 | 41 | T addStage(String name, Closure toRun) { 42 | workflow.addStage(name, toRun) 43 | return (T) this 44 | } 45 | 46 | void cd(String folder, Closure todo) { 47 | workflow.cd(folder, todo) 48 | } 49 | 50 | void withCredentials(Var_Creds[] params, Closure toRun) { 51 | workflow.withCredentials(params, toRun) 52 | } 53 | 54 | JobTrigger triggerJob(String name) { 55 | return getModule(BuildModule.class).triggerJob(name) 56 | } 57 | 58 | String _sh(String command, readOutput = false) { 59 | return workflow.sh(command, readOutput) 60 | } 61 | 62 | String getName() { 63 | return name 64 | } 65 | 66 | void run() { 67 | printEnvParams(Var_CleanWorkspace) 68 | setDisplayName() 69 | workflow.run() 70 | } 71 | 72 | abstract void pipeline() 73 | 74 | void _postInit() {} 75 | 76 | void setDisplayName() { 77 | getModule(BuildModule.class).setDisplayName("#${VarConsts.Var_BuildNumber.get()}: ${name}") 78 | } 79 | 80 | void cleanup() { 81 | if ("true" == Var_CleanWorkspace.get()) workflow.deleteWorkspace() 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /scripts/_core-tools/signature.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/usr/bin/env bash 21 | 22 | printedSignature= 23 | signature() { 24 | local scriptName=${1} 25 | if [[ ! "${scriptName}" ]]; then 26 | scriptName=$(echo "${0}" | sed -E "s/.*\/(.*)\.sh/\1/") 27 | fi 28 | 29 | if [[ "${printedSignature}" ]]; then 30 | return 31 | fi 32 | 33 | printedSignature="true" 34 | 35 | # clear 36 | echo 37 | echo -e " Script: '${Red}${scriptName}${NoColor}'" 38 | echo -e " License: '${Red}Apache v2.0${NoColor}'" 39 | echo 40 | printSig2 41 | echo -e " ${NoColor}" 42 | } 43 | 44 | printSig1() { 45 | echo -e "MMP\"\"MM\"\"YMM \`7MM\"\"\"Yp, .M\"\"\"bgd " 46 | echo -e "P' MM \`7 MM Yb ,MI \"Y " 47 | echo -e " MM ,6\"Yb. ,p6\"bo MM dP ,pP\"\"Yq. ,pP\"Ybd \`MMb. " 48 | echo -e " MM 8) MM 6M' OO MM\"\"\"bg. 6W' \`Wb 8I \`\" \`YMMNq. " 49 | echo -e " MM ,pm9MM 8M MM \`Y 8M M8 \`YMMMa. . \`MM " 50 | echo -e " MM 8M MM YM. , MM ,9 YA. ,A9 L. I8 Mb dM " 51 | echo -e " .JMML.\`Moo9^Yo.YMbmd'.JMMmmmd9 \`Ybmmd9' M9mmmP' P\"Ybmmd\"" 52 | } 53 | 54 | printSig2() { 55 | echo -e ",--------. ,-----. ,--. ,---. " 56 | echo -e "'--. .--',--,--. ,---.| |) /_ / \ ,---. ' .-' " 57 | echo -e " | | ' ,-. || .--'| .-. \| () |( .-' \`. \`-. " 58 | echo -e " | | \ '-' |\ \`--.| '--' / \ / .-' \`).-' | " 59 | echo -e " \`--' \`--\`--' \`---'\`------' \`--' \`----' \`-----' " 60 | } 61 | -------------------------------------------------------------------------------- /scripts/ci/thunderstorm/build-and-deploy.sh: -------------------------------------------------------------------------------- 1 | projectName="thunderstorm" 2 | source ${BASH_SOURCE%/*}/../../_core-tools/_source.sh 3 | source ${BASH_SOURCE%/*}/params.sh 4 | 5 | extractParams "$@" 6 | 7 | if [[ ! -e "${projectName}" ]]; then 8 | git clone "${gitUrl}" --recursive --branch "${branch}" "${folderName}" 9 | throwError "Error cloning repo" 10 | else 11 | _cd "${folderName}" 12 | git pull 13 | throwError "Error pulling repo" 14 | _cd.. 15 | fi 16 | 17 | _cd "${folderName}" 18 | bash ./dev-tools/scripts/git/git-reset.sh -a 19 | bash ./dev-tools/scripts/git/git-checkout.sh --branch=${branch} --all 20 | bash ./dev-tools/scripts/git/git-pull.sh -a -f 21 | 22 | [[ "${publish}" ]] && publish="--publish=${promoteVersion}" 23 | [[ "${deploy}" ]] && version="--set-version=$(getVersionName version-app.json).${BUILD_NUMBER}" 24 | [[ "${deploy}" ]] && deploy="-d" 25 | bash build-and-install.sh --debug -i -c "-se=${environment}" --account=/etc/test-account.json --log=verbose "${publish}" ${deploy} ${version} 26 | throwError "Error while publishing artifacts to NPM and deploying project" 27 | 28 | newVersionName=$(getVersionName version-thunderstorm.json) 29 | echo newVersionName="${newVersionName}" > ../build.properties 30 | 31 | errorMessage=$(cat ./error_message.txt) 32 | echo errorMessage="${errorMessage}" >> ../build.properties 33 | _cd.. 34 | 35 | # FOR FUTURE REF... CAN TEST ONLY THINGS THAT HAVE CHANGED... 36 | # BUT SHOULD IT TEST ALSO THE PACKAGES THAT ARE DEPENDENT AS WELL.. ?? 37 | # 38 | #bash build-and-install.sh --debug --log=verbose -i -c "-se=${environment}" 39 | # 40 | #folders=() 41 | #usePackages="" 42 | #counter=0 43 | #lastTag="$(getVersionName version-app.json).$((BUILD_NUMBER - counter))}" 44 | #while gitAssertTagExists "${lastTag}"; do 45 | # counter=$((counter + 1)) 46 | # lastTag="$(getVersionName version-app.json).$((BUILD_NUMBER - counter))}" 47 | #done 48 | # 49 | #if [[ "${lastTag}" ]]; then 50 | # logInfo "found last tag: ${lastTag}" 51 | # changes="$(git diff --dirstat=files,0 "${lastTag}" | sed -E 's/^[ 0-9\.]*% ([a-zA-Z0-9_-]*).*/\1/g')" 52 | # while IFS= read -r folder; do 53 | # [[ "$(array_contains "${folder}" "${folders[@]}")" ]] && continue 54 | # folders+=("${folder}") 55 | # usePackages="${usePackages} -up=${folder}" 56 | # done <<< "$changes" 57 | #fi 58 | #bash build-and-install.sh --debug --log=verbose --account=/etc/test-account.json ${usePackages} 59 | #bash build-and-install.sh --debug --log=verbose "${publish}" ${deploy} ${version} 60 | -------------------------------------------------------------------------------- /scripts/node/nvm.sh: -------------------------------------------------------------------------------- 1 | CONST__FILE_NVMRC=".nvmrc" 2 | 3 | nvm.installAndUseNvmIfNeeded() { 4 | nvm.prepare 5 | [[ $(nvm.isInstalled) != "true" ]] && nvm.install 6 | 7 | nvm.prepare 8 | nvm.source 9 | 10 | [[ $(nvm.isVersionInstalled) != "true" ]] && nvm.installVersion 11 | nvm.use 12 | } 13 | 14 | nvm.prepare() { 15 | export NVM_DIR="$HOME/.nvm" 16 | } 17 | 18 | nvm.isInstalled() { 19 | [[ -d "${NVM_DIR}" ]] && echo "true" 20 | } 21 | 22 | nvm.uninstall() { 23 | [[ $(nvm.isInstalled) == "true" ]] && folder.delete "${NVM_DIR}" 24 | } 25 | 26 | # shellcheck disable=SC2120 27 | nvm.install() { 28 | local version="${1:-"0.35.3"}" 29 | 30 | logInfo 31 | bannerInfo "NVM - Installing v${version}" 32 | 33 | curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/v${version}/install.sh" | bash 34 | 35 | local shellRCFile="$(shell.getFileRC)" 36 | [[ -e "${shellRCFile}" ]] && [[ "$(cat "${shellRCFile}" | grep 'NVM_DIR')" != "" ]] && return 0 37 | 38 | echo 'export NVM_DIR="$HOME/.nvm"' >> "${shellRCFile}" 39 | echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' >> "${shellRCFile}" 40 | echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion' >> "${shellRCFile}" 41 | logInfo "NVM - Installed" 42 | } 43 | 44 | nvm.source() { 45 | # shellcheck source=./$HOME/.nvm 46 | [[ -s "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh" # This loads nvm 47 | } 48 | 49 | nvm.assert() { 50 | [[ ! $(isFunction nvm) ]] && throwError "NVM - Installation was not found" 404 51 | } 52 | 53 | nvm.activeVersion() { 54 | nvm.assert 55 | nvm current 56 | } 57 | 58 | nvm.requiredVersion() { 59 | [[ ! -e "${CONST__FILE_NVMRC}" ]] && throwError "NVM - ${CONST__FILE_NVMRC} file was not found" 404 60 | cat "${CONST__FILE_NVMRC}" | head -1 61 | } 62 | 63 | nvm.installVersion() { 64 | logInfo "NVM - Install required version" 65 | nvm.assert 66 | nvm install 67 | } 68 | 69 | # shellcheck disable=SC2120 70 | nvm.isVersionInstalled() { 71 | local requiredNodeVersion="${1}" 72 | [[ ! "${requiredNodeVersion}" ]] && requiredNodeVersion="$(nvm.requiredVersion)" 73 | local foundVersion="$(nvm ls | grep "v${requiredNodeVersion}" | head -1)" 74 | 75 | [[ "${foundVersion}" ]] && echo "true" 76 | } 77 | 78 | nvm.use() { 79 | logInfo "NVM - Use required version" 80 | logWarning " nvm use --delete-prefix \"v${requiredNodeVersion}\" --silent" 81 | nvm use --delete-prefix "v${requiredNodeVersion}" --silent 82 | nvm use 83 | } 84 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/modules/docker/Docker.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.modules.docker 2 | 3 | import com.nu.art.pipeline.IShell 4 | import com.nu.art.pipeline.exceptions.BadImplementationException 5 | import com.nu.art.pipeline.workflow.variables.VarConsts 6 | 7 | class Docker 8 | implements IShell, Serializable { 9 | 10 | String id 11 | final DockerConfig config 12 | final DockerModule module 13 | 14 | Docker(DockerModule module, DockerConfig config) { 15 | this.config = config 16 | this.module = module 17 | } 18 | 19 | Docker init() { 20 | this.id = "${UUID.randomUUID().toString()}_${VarConsts.Var_JobName.get()}-${VarConsts.Var_BuildNumber.get()}" 21 | return this 22 | } 23 | 24 | Docker launch() { 25 | if (!config.key) 26 | throw new BadImplementationException("Trying to launch a Docker without a container key") 27 | 28 | if (!config.version) 29 | throw new BadImplementationException("Trying to launch a Docker without a container version") 30 | 31 | List _envVars = config.envVariables.collect { key, value -> "-e ${key}=${value}".toString() } 32 | String envVars = "" 33 | for (i in 0..<_envVars.size()) { 34 | envVars += " ${_envVars.get(i)}" 35 | } 36 | 37 | List _virtualFiles = config.virtualFiles.collect { key, value -> "-v ${key}:${value}".toString() } 38 | String virtualFilesVars = "" 39 | for (i in 0..<_virtualFiles.size()) { 40 | virtualFilesVars += " ${_virtualFiles.get(i)}" 41 | } 42 | 43 | GString dockerLink = "${config.key}:${config.version}" 44 | module.logInfo("Launching docker: ${id}") 45 | module.workflow.sh """docker run --rm -d --net=host --name ${id} ${envVars} ${virtualFilesVars} ${dockerLink} tail -f /dev/null""" 46 | return this 47 | } 48 | 49 | Docker sh(GString command, GString workingDirector = "${VarConsts.Var_Workspace.get()}") { 50 | if (!command) 51 | throw new BadImplementationException("Trying to execute a command that is undefined") 52 | 53 | return sh(command.toString(), workingDirector.toString()) 54 | } 55 | 56 | Docker sh(String command, String workingDirector = VarConsts.Var_Workspace.get()) { 57 | if (!command) 58 | throw new BadImplementationException("Trying to execute a command that is undefined") 59 | 60 | module.workflow.sh """docker exec -w ${workingDirector} ${id} bash -c \"${command}\"""" 61 | return this 62 | } 63 | 64 | void kill() { 65 | module.workflow.logInfo("Killing docker: ${id}") 66 | module.workflow.sh "docker rm -f ${id}" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/modules/git/Cli.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.modules.git 2 | 3 | import com.nu.art.pipeline.workflow.Workflow 4 | 5 | class Cli { 6 | public static Cli _continue 7 | public static Cli _break 8 | public static Cli _return 9 | 10 | String script = "" 11 | Boolean async 12 | 13 | Cli(String shebang = "", async = false) { 14 | if (shebang.length() > 0) 15 | script = "${shebang}\n" 16 | 17 | this.async = async 18 | } 19 | 20 | static void init() { 21 | _continue = new Cli().append("continue") 22 | _break = new Cli().append("break") 23 | _return = new Cli().append("return") 24 | } 25 | 26 | T _if(String condition, Closure ifBlock, Closure elseBlock = null) { 27 | append("if ${condition}; then") 28 | append(ifBlock()) 29 | 30 | if (elseBlock) { 31 | append("else") 32 | append(elseBlock()) 33 | } 34 | 35 | append("fi") 36 | 37 | return (T) this 38 | } 39 | 40 | T _for(String varName, String arrayName, Closure loop) { 41 | append("for ${varName} in \"\${${arrayName}[@]}\"; do") 42 | append(loop()) 43 | append("done") 44 | append("") 45 | } 46 | 47 | T _for(String varName, String[] values, Closure loop) { 48 | append("for ${varName} in ${values.collect({ "\"it\"" }).join(" ")}; do") 49 | append(loop()) 50 | append("done") 51 | append("") 52 | } 53 | 54 | T ls(String params = "") { 55 | append("ls ${params}") 56 | return (T) this 57 | } 58 | 59 | T cd(String dir, Closure toRun = null) { 60 | if (dir != "") 61 | append("cd ${dir}") 62 | 63 | if (toRun) { 64 | append(toRun()) 65 | 66 | if (dir != "") 67 | append("cd -") 68 | } 69 | 70 | return (T) this 71 | } 72 | 73 | T pwd() { 74 | append("pwd") 75 | return (T) this 76 | } 77 | 78 | T assign(String varName, String value) { 79 | append("${varName}=${value}") 80 | } 81 | 82 | T assign(String varName, String[] value) { 83 | append("${varName}=(${value.join(" ")})") 84 | } 85 | 86 | T append(String command) { 87 | script = "${script}${command}${command.endsWith("\n") ? "" : "\n"}" 88 | return (T) this 89 | } 90 | 91 | T append(Cli cli) { 92 | String script = cli.script.replaceAll("^", " ").replaceAll("\n", "\n ") 93 | append(script.substring(0, script.length() - 2)) 94 | } 95 | 96 | String execute(output = false) { 97 | return Workflow.workflow.sh(this.script, output) 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /scripts/git/git-status.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | 22 | source ${BASH_SOURCE%/*}/_core.sh 23 | 24 | runningDir=`getRunningDir` 25 | projectsToIgnore=("dev-tools") 26 | scope="changed" 27 | grepFilter="HEAD detached|you are still merging|Processing|Your branch|modified|On branch|\^" 28 | 29 | params=(scope grepFilter) 30 | 31 | extractParams() { 32 | for paramValue in "${@}"; do 33 | case "${paramValue}" in 34 | "--project" | "-p") 35 | scope="project" 36 | ;; 37 | 38 | "--all" | "-a") 39 | scope="all" 40 | ;; 41 | 42 | "--external" | "-e") 43 | scope="external" 44 | ;; 45 | 46 | "--debug") 47 | debug="true" 48 | ;; 49 | 50 | "--no-filter") 51 | grepFilter= 52 | ;; 53 | esac 54 | done 55 | } 56 | 57 | extractParams "$@" 58 | 59 | signature "Status repo" 60 | printCommand "$@" 61 | printDebugParams ${debug} "${params[@]}" 62 | 63 | execute() { 64 | if [[ ! "${grepFilter}" ]]; then 65 | git status 66 | else 67 | git status | grep -E "${grepFilter}" 68 | fi 69 | } 70 | 71 | 72 | processSubmodule() { 73 | local mainModule=${1} 74 | logVerbose 75 | bannerDebug "Processing: ${mainModule}" 76 | execute 77 | 78 | local submodules=(`getSubmodulesByScope ${scope} "${projectsToIgnore[@]}"`) 79 | for submodule in "${submodules[@]}"; do 80 | cd ${submodule} 81 | processSubmodule "${mainModule}/${submodule}" 82 | cd .. 83 | done 84 | } 85 | 86 | processSubmodule "${runningDir}" 87 | 88 | -------------------------------------------------------------------------------- /scripts/utils/generate-ssl-cert.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # ================================================== 4 | # Generate a self-signed SSL certificate with SAN support 5 | # For local development (supports wildcard subdomains like *.localhost) 6 | # 7 | # Author: Based on original work by Adam van der Kruk aka TacB0sS 8 | # Updated: 2025 9 | # License: Apache 2.0 10 | # ================================================== 11 | 12 | # Default values 13 | DOMAIN="localhost" 14 | OUTPUT_DIR="." 15 | POSTFIX="" 16 | ORG_NAME="DEV" 17 | SUBDOMAINS=() 18 | 19 | # Parse arguments 20 | for arg in "$@"; do 21 | case $arg in 22 | --output=*) 23 | OUTPUT_DIR="${arg#*=}" 24 | ;; 25 | --postfix=*) 26 | POSTFIX="-${arg#*=}" 27 | ;; 28 | --domain=*) 29 | DOMAIN="${arg#*=}" 30 | ;; 31 | --sub-domain=*) 32 | SUBDOMAINS+=("${arg#*=}") 33 | ;; 34 | --org-name=*) 35 | ORG_NAME="${arg#*=}" 36 | ;; 37 | *) 38 | echo "❌ Unknown parameter: ${arg}" 39 | exit 1 40 | ;; 41 | esac 42 | done 43 | 44 | # Ensure output directory exists 45 | mkdir -p "${OUTPUT_DIR}" 46 | 47 | # Filenames 48 | KEY_FILE="${OUTPUT_DIR}/server-key${POSTFIX}.pem" 49 | CERT_FILE="${OUTPUT_DIR}/server-cert${POSTFIX}.pem" 50 | CONFIG_FILE="${OUTPUT_DIR}/openssl-${DOMAIN}${POSTFIX}.cnf" 51 | 52 | # Generate temporary OpenSSL config with SAN support 53 | cat > "${CONFIG_FILE}" <> "${CONFIG_FILE}" 81 | ((DNS_INDEX++)) 82 | done 83 | 84 | # Generate private key and certificate 85 | openssl req \ 86 | -x509 \ 87 | -nodes \ 88 | -days 825 \ 89 | -newkey rsa:2048 \ 90 | -keyout "${KEY_FILE}" \ 91 | -out "${CERT_FILE}" \ 92 | -config "${CONFIG_FILE}" \ 93 | -extensions req_ext 94 | 95 | # Cleanup 96 | rm "${CONFIG_FILE}" 97 | 98 | echo "✅ Certificate created:" 99 | echo " Key: ${KEY_FILE}" 100 | echo " Cert: ${CERT_FILE}" -------------------------------------------------------------------------------- /scripts/git/git-reset.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | 22 | projectsToIgnore=("dev-tools") 23 | source ${BASH_SOURCE%/*}/_core.sh 24 | scope="changed" 25 | runningDir=`getRunningDir` 26 | 27 | params=(origin scope branchName) 28 | 29 | extractParams() { 30 | for paramValue in "${@}"; do 31 | case "${paramValue}" in 32 | "--branch="*) 33 | branchName=`regexParam "--branch" ${paramValue}` 34 | ;; 35 | 36 | "-b="*) 37 | branchName=`regexParam "-b" ${paramValue}` 38 | ;; 39 | 40 | "--project" | "-p") 41 | scope="project" 42 | ;; 43 | 44 | "--all" | "-a") 45 | scope="all" 46 | ;; 47 | 48 | "--external" | "-e") 49 | scope="external" 50 | ;; 51 | 52 | "--debug") 53 | debug="true" 54 | ;; 55 | 56 | "--origin") 57 | origin=true 58 | ;; 59 | esac 60 | done 61 | } 62 | 63 | extractParams "$@" 64 | 65 | signature "Reset hard repo" 66 | printCommand "$@" 67 | printDebugParams ${debug} "${params[@]}" 68 | 69 | processSubmodule() { 70 | local mainModule=${1} 71 | logVerbose 72 | bannerDebug "Processing: ${mainModule}" 73 | 74 | gitResetHard ${origin} "${branchName}" 75 | git clean -f 76 | 77 | local submodules=($(getSubmodulesByScope ${scope} "${projectsToIgnore[@]}")) 78 | logInfo "submodules: ${submodules[@]}" 79 | for submodule in "${submodules[@]}"; do 80 | _cd "${submodule}" 81 | processSubmodule "${mainModule}/${submodule}" 82 | _cd.. 83 | done 84 | } 85 | 86 | processSubmodule "${runningDir}" 87 | -------------------------------------------------------------------------------- /scripts/_core-tools/spinner.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | DEFAULT_SpinnerFrames=("—" "\\" "|" "/") 22 | 23 | # Credit for the lovely spinner sequences 24 | # https://unix.stackexchange.com/a/565551/248440 25 | 26 | Spinner_Dot=("⠁" "⠂" "⠄" "⡀" "⢀" "⠠" "⠐" "⠈") 27 | Spinner_Vertical=("▁" "▂" "▃" "▄" "▅" "▆" "▇" "█" "▇" "▆" "▅" "▄" "▃" "▂" "▁") 28 | Spinner_Horizontal=("▉" "▊" "▋" "▌" "▍" "▎" "▏" "▎" "▍" "▌" "▋" "▊" "▉") 29 | Spinner_Arrows=("←" "↖" "↑" "↗" "→" "↘" "↓" "↙") 30 | Spinner_WHAT=("▖" "▘" "▝" "▗") 31 | Spinner_WHAT2=("┤" "┘" "┴" "└" "├" "┌" "┬" "┐") 32 | Spinner_Triangle=("◢" "◣" "◤" "◥") 33 | Spinner_Square=("◰" "◳" "◲" "◱") 34 | Spinner_Quarters=("◴" "◷" "◶" "◵") 35 | Spinner_Halves=("◐" "◓" "◑" "◒") 36 | Spinner_Braille=("⣾" "⣽" "⣻" "⢿" "⡿" "⣟" "⣯" "⣷") 37 | 38 | ## @function: spinner(action, label, &spinnerFramesRef[]) 39 | ## 40 | ## @description: Perform an action asynchronously and display 41 | ## spinner till action is completed 42 | ## 43 | ## @param action: The action the execute 44 | ## @param label: The label to display while waiting 45 | ## @param spinnerRef: In case you feel like a custom spinner, pass a ref to an array of strings 46 | spinner() { 47 | local frameRef 48 | local action="${1}" 49 | local label="${2} " 50 | local spinnerRef="${3-DEFAULT_SpinnerFrames}" 51 | local spinnerFrames=$(eval "echo \${!${spinnerRef}[@]}") 52 | 53 | spinnerRun() { 54 | while true; do 55 | for frame in ${spinnerFrames[@]}; do 56 | frameRef="${spinnerRef}[${frame}]" 57 | echo "${label}${!frameRef}" 58 | tput cuu1 tput el 59 | sleep 0.2 60 | done 61 | done 62 | echo -e "\r" 63 | } 64 | 65 | spinnerRun & 66 | local spinnerPid=$! 67 | ${action} 68 | kill "${spinnerPid}" 69 | } 70 | -------------------------------------------------------------------------------- /scripts/dev/docs/generate-sidebar.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source ../dev-tools/scripts/_core-tools/_source.sh 4 | 5 | getFolders() { 6 | local folders=($(ls -l1 -d */ )) 7 | echo "${folders[@]}" 8 | } 9 | 10 | getMDFiles() { 11 | local files=($(ls -l1 *.md 2>/dev/null)) 12 | echo "${files[@]}" 13 | } 14 | 15 | createSidebar() { 16 | local allFileFullPaths=() 17 | local allFileNames=() 18 | 19 | local output="[Home](Home)\n" 20 | local counter=1 21 | append() { 22 | local toAppend=${1} 23 | output="${output}${toAppend}\n" 24 | } 25 | 26 | local folders=(`getFolders`) 27 | for folder in "${folders[@]}"; do 28 | local _folder=$(echo "${folder}" | sed -E "s/[0-9]+-(.*)/\1/") 29 | _folder="${_folder::-1}" 30 | _cd "${folder}" 31 | local files=($(getMDFiles)) 32 | if (( "${#files}" > 0 )); then 33 | append "${counter}. ${_folder^}" 34 | ((counter++)) 35 | fi 36 | for mdFile in "${files[@]}"; do 37 | allFileFullPaths+=("./${folder}${mdFile}") 38 | allFileNames+=("${mdFile}") 39 | local firstLine=$(cat "${mdFile}" | head -1) 40 | if [[ ! "${firstLine}" =~ "# " ]]; then 41 | firstLine="# NO-INPUT" 42 | logWarning "Missing title input for: ${mdFile}" 43 | fi 44 | 45 | if [[ "${mdFile}" =~ "__" ]]; then continue; fi 46 | append " * [${firstLine:2}](${mdFile::-3})" 47 | done 48 | cd .. 49 | done 50 | 51 | for file in "${allFileFullPaths[@]}"; do 52 | # echo cat ${file} 53 | local links=($(cat ${file} | grep -o '\[.*\]: .*' | sed -E "s/.*: (.*)/\1/")) 54 | local links2=($(cat ${file} | grep -o '\[.*\](.*)' | sed -E "s/.*\((.*)\)/\1/")) 55 | links+=("${links2[@]}") 56 | local hasBadLinks= 57 | for link in "${links[@]}"; do 58 | if [[ "${link}" =~ "http" ]]; then 59 | continue 60 | fi 61 | 62 | if [[ "${link}" =~ .. ]]; then 63 | continue 64 | fi 65 | 66 | if [[ $(array_contains "${link}.md" "${allFileNames[@]}") ]]; then 67 | continue 68 | fi 69 | 70 | if [[ ! "${hasBadLinks}" ]]; then logVerbose; logError "Error in file: ${file}"; fi 71 | hasBadLinks=true 72 | logDebug " - Found bad wiki ref: ${file} -> ${link}" 73 | done 74 | done 75 | 76 | echo -e "${output}" > _Sidebar.md 77 | } 78 | -------------------------------------------------------------------------------- /scripts/._tests/_tests.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) 22 | source "${DIR}/../_core-tools/_source.sh" 23 | CONST_Debug=TRUE 24 | 25 | totalSuccess=0 26 | totalErrors=0 27 | 28 | assertValue() { 29 | local expected=${1} 30 | local actual=${2} 31 | 32 | assert "${expected}" "${actual}" 33 | result=$? 34 | [[ ${result} == "1" ]] && logWarning "expected: ${expected} ... but got ${actual}" 35 | } 36 | 37 | assert() { 38 | local expected=${1} 39 | local actual=${2} 40 | 41 | if [[ "${expected}" == "${actual}" ]]; then 42 | ((totalSuccess++)) 43 | return 0 44 | else 45 | ((totalErrors++)) 46 | return 1 47 | fi 48 | } 49 | 50 | assertCommand() { 51 | local expected=${1} 52 | local toEval=${2} 53 | local prepare=${3} 54 | local cleanup=${4} 55 | logDebug "${toEval}" 56 | 57 | local cleanupResult=0 58 | local prepareResult=0 59 | 60 | if [[ -e ${prepare} ]]; then 61 | ${prepare} 62 | prepareResult=$? 63 | [[ ${prepareResult} != "0" ]] && logError " fail - to prepare: ${toEval} with error code ${prepareResult}" 64 | fi 65 | 66 | local actual=$(${toEval}) 67 | assert "${expected}" "${actual}" 68 | result=$? 69 | 70 | if [[ -e ${cleanup} ]]; then 71 | ${cleanup} 72 | cleanupResult=$? 73 | [[ ${cleanupResult} != "0" ]] && logError " fail - to cleanup: ${toEval} with error code ${cleanupResult}" 74 | fi 75 | 76 | if [[ ${prepareResult} == "0" ]] && [[ ${cleanupResult} == "0" ]] && [[ ${result} == "0" ]]; then 77 | logInfo " pass - ${toEval} => ${actual}" 78 | else 79 | logError " fail - ${toEval} => ${actual} ... expected: ${expected}" 80 | fi 81 | } 82 | 83 | printSummary() { 84 | logInfo "Success: ${totalSuccess}" 85 | ((totalErrors > 0)) && logError "Errors: ${totalErrors}" 86 | } 87 | -------------------------------------------------------------------------------- /scripts/to-sort/scale-images.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | 22 | targetWidth=${1} 23 | targetHeight=${2} 24 | ratio=`bc -l <<< "scale=3; ${targetWidth}/${targetHeight}"` 25 | echo "Target dimension: w=${targetWidth} h=${targetHeight} R=${ratio}" 26 | mkdir output 27 | 28 | listFilesImpl() { 29 | ls -lf > list.txt 30 | local files=() 31 | local filesName 32 | 33 | while IFS='' read -r line || [[ -n "$line" ]]; do 34 | for word in ${line}; do 35 | filesName=${word} 36 | done 37 | 38 | filesName=`echo ${filesName} | sed -E 's/\///'` 39 | 40 | if [[ ! -d "${filesName}" ]] && ([[ "${filesName}" =~ ".png" ]] || [[ "${filesName}" =~ ".jpg" ]]); then 41 | files[${#files[*]}]="${filesName}" 42 | continue 43 | fi 44 | 45 | done < list.txt 46 | 47 | rm list.txt 48 | echo "${files[@]}" 49 | } 50 | 51 | scaleImageTo() { 52 | local fileName=${1} 53 | 54 | echo "Processing image: ${fileName}" 55 | local output=`sips -g pixelWidth ${fileName}` 56 | imageWidth=`echo ${output} | sed -E 's/.* pixel.*: (.*)/\1/'` 57 | 58 | local output=`sips -g pixelHeight ${fileName}` 59 | imageHeight=`echo ${output} | sed -E 's/.* pixel.*: (.*)/\1/'` 60 | 61 | echo " Dimensions: w=${imageWidth} h=${imageHeight}" 62 | local cropWidth=`bc -l <<< "scale=0; ${imageHeight}*${ratio}"` 63 | cropWidth=${cropWidth%.*} 64 | local cropHeight="${imageHeight}" 65 | 66 | echo " Crop Dimensions: w=${cropWidth} h=${cropHeight}" 67 | 68 | sips -c ${cropWidth} ${cropHeight} ${fileName} --out output 69 | 70 | sips -z ${targetWidth} ${targetHeight} output/${fileName} --out output 71 | } 72 | 73 | files=$(listFilesImpl) 74 | files=(${files//,/ }) 75 | for fileName in "${files[@]}"; do 76 | scaleImageTo ${fileName} 77 | done -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/modules/build/TriggerCause.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Permissions management system, define access level for each of 3 | * your server apis, and restrict users by giving them access levels 4 | * 5 | * Copyright (C) 2020 Adam van der Kruk aka TacB0sS 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | package com.nu.art.pipeline.modules.build 21 | 22 | import hudson.model.Cause 23 | 24 | class TriggerCause { 25 | public static String Type_User = "user" 26 | public static String Type_SCM = "scm" 27 | public static String Type_Rebuild = "rebuild" 28 | public static String Type_BranchIndexing = "branch-indexing" 29 | public static String Type_GenericTrigger = "generic-trigger" 30 | public static String Type_Unknown = "unknown" 31 | 32 | final String className 33 | final String description 34 | final String type 35 | final String originator 36 | final String data 37 | 38 | TriggerCause(Cause cause) { 39 | className = cause.getClass().getName() 40 | description = cause.getShortDescription() 41 | 42 | switch (className) { 43 | case 'hudson.model.Cause$UserIdCause': 44 | type = Type_User 45 | originator = cause.userName 46 | data = cause.userId 47 | break 48 | 49 | case 'com.cloudbees.jenkins.GitHubPushCause': 50 | type = Type_SCM 51 | originator = cause.pushedBy 52 | data = "GitHub" 53 | break 54 | 55 | case 'com.sonyericsson.rebuild.RebuildCause': 56 | type = Type_Rebuild 57 | originator = (cause as Cause.UpstreamCause).upstreamProject 58 | data = (cause as Cause.UpstreamCause).upstreamBuild 59 | break 60 | 61 | case 'jenkins.branch.BranchIndexingCause': 62 | type = Type_BranchIndexing 63 | originator = cause.properties.toString() 64 | 65 | break 66 | 67 | case 'org.jenkinsci.plugins.gwt.GenericCause': 68 | type = Type_GenericTrigger 69 | originator = cause.properties.toString() 70 | 71 | break 72 | 73 | default: 74 | type = Type_Unknown 75 | originator = "N/A" 76 | data = "N/A" 77 | } 78 | } 79 | 80 | String print() { 81 | return "Cause(${className}): ${description}" 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/workflow/Pipeline_BaseProxy.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Permissions management system, define access level for each of 3 | * your server apis, and restrict users by giving them access levels 4 | * 5 | * Copyright (C) 2020 Adam van der Kruk aka TacB0sS 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | package com.nu.art.pipeline.workflow 21 | 22 | import com.nu.art.pipeline.modules.SlackModule 23 | import com.nu.art.pipeline.modules.build.BuildModule 24 | import com.nu.art.pipeline.modules.build.JobTrigger 25 | import com.nu.art.pipeline.workflow.variables.VarConsts 26 | import com.nu.art.pipeline.workflow.variables.Var_Env 27 | 28 | abstract class Pipeline_BaseProxy 29 | extends BasePipeline { 30 | 31 | public Var_Env Env_Branch = new Var_Env("BRANCH_NAME") 32 | def envJobs = [:] 33 | 34 | Pipeline_BaseProxy() { 35 | super("proxy", ([SlackModule.class] as Class[]) as Class[]) 36 | } 37 | 38 | Pipeline_BaseProxy(Class... modules) { 39 | super("proxy", (([SlackModule.class] as Class[]) + modules) as Class[]) 40 | } 41 | 42 | Pipeline_BaseProxy(String name) { 43 | super(name, (([SlackModule.class] as Class[])) as Class[]) 44 | } 45 | 46 | Pipeline_BaseProxy(String name, Class... modules) { 47 | super(name, (([SlackModule.class] as Class[]) + modules) as Class[]) 48 | } 49 | 50 | void declareJob(String branch, String jobName) { 51 | envJobs.put(branch, jobName) 52 | } 53 | 54 | void setDisplayName() { 55 | def branch = Env_Branch.get() 56 | getModule(BuildModule.class).setDisplayName("#${VarConsts.Var_BuildNumber.get()}: ${getName()}-${branch}") 57 | } 58 | 59 | @Override 60 | void pipeline() { 61 | addStage("running", { 62 | def branch = Env_Branch.get() 63 | def jobName = (String) envJobs[branch] 64 | new JobTrigger(workflow, jobName).setWait(false).run() 65 | }) 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /scripts/dev/search-logs.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | folder=${1} 22 | echo "Searching for crashes in folder: ${folder}" 23 | 24 | pushd "${folder}" 25 | pwd 26 | for file in logs*.zip; do 27 | [[ -e "$file" ]] || continue 28 | # ... rest of the loop body 29 | 30 | index=`echo ${file} | sed -E "s/logs-(..).zip/\1/"` 31 | unzip ${file} -d temp-${index} > NUL 32 | mv temp-${index}/logs-00.txt logs-${index}.txt 33 | rm ${file} 34 | rm -rf temp-${index} 35 | done 36 | 37 | 38 | mv logcat.txt logcat.txt.00 39 | for file in logcat.txt*; do 40 | [[ -e "$file" ]] || continue 41 | # ... rest of the loop body 42 | 43 | outputName=`echo ${file} | sed -E "s/logcat\.txt\.(..)/logcat-\1.txt/"` 44 | echo ${outputName} 45 | mv ${file} ${outputName} 46 | done 47 | 48 | echo "Bluetooth:" 49 | # grep -rnw '.' --include=\*.txt -e 'Application Starting' 50 | grep -E 'Turning bluetooth adapter' -rnw '.' --include=\*.txt 51 | grep -E '=> ERROR_BLUETOOTH__REBOOT' -rnw '.' --include=\*.txt 52 | echo 53 | 54 | # echo "Application started:" 55 | # grep -rnw '.' --include=\*.txt -e 'Application Starting' 56 | # echo 57 | 58 | echo "On boot completed" 59 | grep -rnw '.' --include=\*.txt -e 'Boot completed' 60 | echo 61 | # 62 | # echo "Process Killed by system:" 63 | # grep -rnw '.' --include=\*.txt -e 'Process com.ir.ai.kyou' 64 | # echo 65 | # 66 | # echo "Process crashed:" 67 | # grep -rnw '.' --include=\*.txt -e 'Crash on thread' 68 | # grep -rnw '.' --include=\*.txt -e 'FATAL' 69 | # echo 70 | # 71 | # echo "Process died:" 72 | # grep -rnw '.' --include=\*.txt -e 'SIG' 73 | # echo 74 | # echo 75 | # echo 76 | # 77 | # 78 | # echo "Searching for exceptions:" 79 | # grep -rnw '.' --include=\*.txt -e 'Exception' 80 | # echo 81 | 82 | popd 83 | -------------------------------------------------------------------------------- /gradle/deploy-artifacts-nexus.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Permissions management system, define access level for each of 3 | * your server apis, and restrict users by giving them access levels 4 | * 5 | * Copyright (C) 2020 Adam van der Kruk aka TacB0sS 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | def addTask_DeployJavaArtifactToNexus(groupId) { 21 | addTasks_JavaSourceAndDocs() 22 | addTask_DeployToNexus(groupId, "jar") 23 | } 24 | 25 | def addTask_DeployAndroidArtifactToNexus(groupId) { 26 | addTasks_AndroidSourceAndDocs() 27 | addTask_DeployToNexus(groupId, "aar") 28 | } 29 | 30 | def addTask_DeployToNexus(groupId, _packaging) { 31 | if (!project.hasProperty("nexusRepoUrl") || !nexusRepoUrl) { 32 | println("Will not be able to deply to nexus.. project does not define 'nexusRepoUrl' in gradle.properties") 33 | return 34 | } 35 | 36 | uploadArchives { 37 | apply plugin: 'maven' 38 | 39 | repositories { 40 | mavenDeployer { 41 | repository(url: nexusRepoUrl) { 42 | def userName = System.getenv('NEXUS_USER') 43 | if (!userName) 44 | userName = System.properties['NEXUS_USER'] 45 | 46 | def password = System.getenv('NEXUS_PASSWORD') 47 | if (!password) 48 | password = System.properties['NEXUS_PASSWORD'] 49 | 50 | println("userName: " + userName + " password: " + password) 51 | authentication(userName: userName, password: password) 52 | } 53 | 54 | println("groupId: " + groupId + " _packaging: " + _packaging + " nexusRepoUrl: " + nexusRepoUrl) 55 | pom.version = project.version 56 | pom.groupId = groupId 57 | pom.artifactId = project.name 58 | pom.packaging = _packaging 59 | 60 | } 61 | } 62 | } 63 | } 64 | 65 | ext.addTask_DeployJavaArtifactToNexus = this.&addTask_DeployJavaArtifactToNexus 66 | ext.addTask_DeployAndroidArtifactToNexus = this.&addTask_DeployAndroidArtifactToNexus 67 | ext.addTask_DeployToNexus = this.&addTask_DeployToNexus 68 | -------------------------------------------------------------------------------- /scripts/jenkins/_setup-jenkins.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | source ${BASH_SOURCE%/*}/../android/_source.sh 22 | 23 | executeCommand() { 24 | local command=${1} 25 | local message=${2} 26 | if [[ ! "${message}" ]]; then message="Running: ${1}"; fi 27 | logInfo "${message}" 28 | eval "${command}" 29 | throwError "${message}" 30 | } 31 | 32 | signature "Jenkins Setup" 33 | executeCommand "sudo apt-get update" 34 | 35 | # Installing packages 36 | executeCommand "sudo apt-get install -y unzip" "Installing unzip" 37 | executeCommand "sudo apt-get install -y zip" "Installing zip" 38 | 39 | # Set 16 gb swap 40 | executeCommand "sudo fallocate -l 16G /swapfile" "Setup 16gb swapfile" 41 | executeCommand "sudo chmod 600 /swapfile" "chmod 600 for swapfile" 42 | executeCommand "sudo mkswap /swapfile" "Make swap to swapfile" 43 | executeCommand "sudo swapon /swapfile" "Enable swap" 44 | 45 | executeCommand "sudo wget -O /usr/share/keyrings/jenkins-keyring.asc https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key" "Resolving Jenkins - 1" 46 | executeCommand "echo \"deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc]\" https://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list > /dev/null" "Resolving Jenkins - 2" 47 | 48 | executeCommand "sudo apt-get update" 49 | executeCommand "sudo apt-get install -y fontconfig" "Install fontconfig" 50 | executeCommand "sudo apt-get install -y openjdk-17-jre" "Install Open JRE 17" 51 | executeCommand "sudo apt-get install -y jenkins" "Install Jenkins" 52 | executeCommand "sudo systemctl start jenkins" "Start Jenkins" 53 | executeCommand "sudo cat /var/lib/jenkins/secrets/initialAdminPassword" "Displaying Jenkins Admin Password" 54 | 55 | executeCommand "sudo su jenkins && cd ~" "Switch to Jenkins user" 56 | executeCommand "ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa -N \"\" -C \"jenkins@nu-art-software.com\"" "Generate SSH key" 57 | 58 | executeCommand "cat /var/lib/jenkins/.ssh/id_rsa.pub" "Displaying SSH Public Key" 59 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/thunderstorm/Pipeline_ThunderstormWebProject.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.thunderstorm 2 | 3 | import com.nu.art.pipeline.modules.SlackModule 4 | import com.nu.art.pipeline.modules.build.BuildModule 5 | import com.nu.art.pipeline.modules.git.GitModule 6 | import com.nu.art.pipeline.thunderstorm.models.ProjectEnvConfig 7 | import com.nu.art.pipeline.thunderstorm.models.ProjectGitConfig 8 | import com.nu.art.pipeline.workflow.WorkflowModule 9 | import com.nu.art.pipeline.workflow.variables.VarConsts 10 | import com.nu.art.pipeline.workflow.variables.Var_Env 11 | 12 | class Pipeline_ThunderstormWebProject 13 | extends Pipeline_ThunderstormWebApp { 14 | 15 | public Var_Env Env_WorkingEnv = new Var_Env("WORKING_ENV") 16 | public Var_Env Env_Branch = new Var_Env("BRANCH_NAME") 17 | 18 | ProjectGitConfig gitConfig 19 | def envProjects = [:] 20 | String slackChannel 21 | 22 | Pipeline_ThunderstormWebProject(String name, String slackChannel, Class... modules) { 23 | super(name, modules) 24 | this.slackChannel = slackChannel 25 | } 26 | 27 | @Override 28 | protected void init() { 29 | String env = Env_WorkingEnv.get() 30 | String branch = Env_Branch.get() ?: env 31 | env = env ?: branch 32 | 33 | getModule(SlackModule.class).setDefaultChannel(this.slackChannel) 34 | 35 | GitModule gitModule = getModule(GitModule.class) 36 | setRepo(gitModule 37 | .create(gitConfig.gitRepoUri) 38 | .setTrackSCM(gitConfig.scm) 39 | .setBranch(branch) 40 | .build()) 41 | 42 | 43 | ProjectEnvConfig envConfig = envProjects.get(env) as ProjectEnvConfig 44 | String links = ("" + 45 | "<${envConfig.webAppUrl}|WebApp> | " + 46 | "<${envConfig.firebaseProjectUrl}|Firebase> | " + 47 | "<${gitConfig.httpUrl}|Github>").toString() 48 | 49 | getModule(SlackModule.class).setOnSuccess(links) 50 | 51 | setEnv(env) 52 | super.init() 53 | } 54 | 55 | void setGitRepoId(String repoId, boolean scm = false) { 56 | setProjectGitConfig(new ProjectGitConfig(repoId, scm)) 57 | } 58 | 59 | void setProjectGitConfig(ProjectGitConfig gitConfig) { 60 | this.gitConfig = gitConfig 61 | } 62 | 63 | void declareEnv(String env, String projectId) { 64 | declareEnv(env, new ProjectEnvConfig(projectId)) 65 | } 66 | 67 | void declareEnv(String env, ProjectEnvConfig envConfig) { 68 | envProjects.put(env, envConfig) 69 | } 70 | 71 | void setDisplayName() { 72 | def version = getVersion() ? " - v${getVersion()}" : "" 73 | getModule(BuildModule.class).setDisplayName("#${VarConsts.Var_BuildNumber.get()}: ${getName()} ${this.env} ${version}") 74 | } 75 | 76 | @Override 77 | void pipeline() { 78 | checkout({ 79 | getModule(SlackModule.class).setOnSuccess(getRepo().getChangeLog().toSlackMessage()) 80 | }) 81 | 82 | install() 83 | clean() 84 | build() 85 | test() 86 | 87 | deploy() 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /scripts/dev/dev-aliases.sh: -------------------------------------------------------------------------------- 1 | export PATH=/opt/homebrew/bin:$PATH 2 | export githubUserName=${YOUR_GITHUB_USER_NAME_HERE} 3 | 4 | alias lbd='npm run serve-debug' 5 | alias lf='npm run dev' 6 | alias lb='npm run serve' 7 | alias kn='killall 9 node' 8 | alias kj='killall 9 java' 9 | 10 | alias bai-test='bash build-and-install.sh --debug --test-mode' 11 | alias bait-test='bash build-and-install.sh --debug --test-mode --no-som' 12 | alias bais-test='bash build-and-install.sh --debug --test-mode --no-tablet' 13 | 14 | alias baia='bash build-and-install.sh --debug --agent-only' 15 | alias bait='bash build-and-install.sh --debug --no-som' 16 | alias bais='bash build-and-install.sh --debug --no-tablet' 17 | 18 | # Typescript Boilerplate 19 | alias deploy-test='bash build-and-install.sh -se=test --setup -df -db' 20 | alias deploy-staging='bash build-and-install.sh -se=staging --setup -df -db' 21 | alias deploy-prod='bash build-and-install.sh -se=prod --setup -df -db' 22 | 23 | alias bai='baiImpl' 24 | function baiImpl() { 25 | if [[ -e build-and-install.sh ]]; then 26 | bash build-and-install.sh ${@} --debug 27 | return 28 | fi 29 | 30 | local runningFolder=$(pwd | sed -E "s/.*\/(.*)$/\1/g") 31 | cd .. 32 | trap "echo BREAK" SIGINT 33 | bash build-and-install.sh "${@}" -up=${runningFolder} --debug 34 | trap - SIGINT 35 | cd ${runningFolder} 36 | } 37 | 38 | # Git Scripts 39 | function gitcommitpush() { 40 | git add . && git commit -am "$1" && git push 41 | } 42 | 43 | function updateSubmoduleToLatest() { 44 | local repo=$1 45 | local branch=${2-master} 46 | 47 | if [[ ! "${repo}" ]]; then 48 | echo "need to specify submodule repo name" 49 | return 50 | fi 51 | 52 | cd ${repo} 53 | git checkout ${branch} 54 | git pull 55 | cd .. 56 | } 57 | 58 | alias grh='git reset --hard' 59 | alias gc='git checkout' 60 | alias gm='git merge' 61 | alias gmo='git merge origin/' 62 | alias gcm='git commit -am ' 63 | alias gcp='gitcommitpush ' 64 | alias _gsu='updateSubmoduleToLatest' 65 | 66 | alias gs='git status' 67 | alias gsu='git submodule update' 68 | alias gsui='git submodule update --init' 69 | alias gsf='git submodule foreach' 70 | 71 | alias _udt='cd dev-tools && git checkout master && git pull && cd ..' 72 | 73 | alias _align='bash ./dev-tools/scripts/dev/align-branch.sh --debug' 74 | alias _reset='bash ./dev-tools/scripts/git/git-reset.sh --debug' 75 | 76 | alias _status='bash ./dev-tools/scripts/git/git-status.sh --debug' 77 | alias _pull='bash ./dev-tools/scripts/git/git-pull.sh --debug --project' 78 | alias _checkout='bash ./dev-tools/scripts/git/git-checkout.sh --debug --project' 79 | alias _push='bash ./dev-tools/scripts/git/git-push.sh --debug' 80 | alias _merge='bash ./dev-tools/scripts/git/git-merge.sh --debug' 81 | alias _prune='bash ./dev-tools/scripts/git/git-prune.sh' 82 | alias _request-pull='bash ./dev-tools/scripts/git/git-pull-request.sh --debug --github-username=${githubUserName}' -------------------------------------------------------------------------------- /scripts/ci/jira/JiraVersion.class.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | JiraVersion() { 4 | declare archived=false 5 | declare released=false 6 | declare id= 7 | declare name= 8 | declare releaseDate= 9 | declare description= 10 | declare projectId= 11 | 12 | _create() { 13 | [[ ! "${name}" ]] && throwError "Cannot create a version without a name" 2 14 | [[ ! "${projectId}" ]] && throwError "Cannot create a version without a projectId" 2 15 | 16 | _logDebug "Creating a version '${name}' for project with id: ${projectId}" 17 | local data=`jsonSerialize ${__this}`; 18 | 19 | local output=$(curl --write-out "\n--- Response: %{http_code} ---" \ 20 | --request POST \ 21 | --url https://introb.atlassian.net/rest/api/3/version \ 22 | --user ${JIRA_USER}:${JIRA_TOKEN} \ 23 | --header 'Content-Type: application/json' \ 24 | --header 'Accept: application/json' \ 25 | --data "${data}") 26 | 27 | # _logWarning "output: ${output}" 28 | local responseCode=`echo -e "${output}" | grep -E "Response:" | sed -E "s/--- Response: ([0-9]+) ---/\1/"` 29 | (( responseCode >= 400)) && throwError "Error creating version: ${name}.\n\n ${output}\n" "${responseCode}" 30 | id=`echo "${output}" | grep -E "\"id\":" | sed -E "s/^.*\"id\":\"([a-zA-Z0-9\.]+)\".*$/\1/"` 31 | return 0 32 | } 33 | 34 | _exists() { 35 | [[ ! "${name}" ]] && throwError "Cannot check for a version without a name" 2 36 | 37 | _logDebug "Checking if version exists for name: ${name}" 38 | local output=$(curl --write-out "\n--- Response: %{http_code} ---" \ 39 | --request GET \ 40 | --url https://introb.atlassian.net/rest/api/3/project/${projectId}/versions \ 41 | --user ${JIRA_USER}:${JIRA_TOKEN} \ 42 | --header 'Content-Type: application/json' \ 43 | --header 'Accept: application/json') 44 | 45 | # _logWarning "output: ${output}" 46 | local responseCode=`echo -e "${output}" | grep -E "Response:" | sed -E "s/--- Response: ([0-9]+) ---/\1/"` 47 | (( responseCode >= 400)) && throwError "Error getting versions.\n\n${output}\n" "${responseCode}" 48 | id=`echo "${output}" | grep -E "${name}" | sed -E "s/.*\"id\":\"([a-zA-Z0-9\.]+)\".*,?\"name\":\"${name}\".*/\1/"` 49 | 50 | return 0 51 | } 52 | 53 | _delete() { 54 | [[ ! "${id}" ]] && throwError "Cannot delete a version without an id" 2 55 | 56 | _logDebug "Deleting version with id: ${id}" 57 | local output=$(curl --write-out "\n--- Response: %{http_code} ---" \ 58 | --request DELETE \ 59 | --url https://introb.atlassian.net/rest/api/3/version/${id} \ 60 | --user ${JIRA_USER}:${JIRA_TOKEN}) 61 | 62 | local responseCode=`echo -e "${output}" | grep -E "Response:" | sed -E "s/--- Response: ([0-9]+) ---/\1/"` 63 | (( responseCode >= 400)) && throwError "Error getting versions.\n\n${output}\n" "${responseCode}" 64 | 65 | return 0 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /scripts/oos/utils/InstallerDMG.class.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | 22 | InstallerDMG() { 23 | 24 | declare label 25 | declare requiresMount=true 26 | declare outputFile 27 | declare inZipFile 28 | declare downloadUrl 29 | declare volumeToInstall 30 | 31 | _cleanup() { 32 | deleteFile "${outputFile}" 33 | } 34 | 35 | _onAborted() { 36 | echo 37 | echo 38 | this.cleanup 39 | throwError "${label} download aborted by user" 2 40 | } 41 | 42 | _download() { 43 | [[ "${inZipFile}" ]] && [[ -e "${inZipFile}" ]] && return 44 | [[ -e "${outputFile}" ]] && return 45 | 46 | trap 'this.onAborted' SIGINT 47 | logInfo "Downloading ${label}..." 48 | curl "${downloadUrl}" -o "${outputFile}" 49 | trap - SIGINT 50 | 51 | [[ ! -e "${outputFile}" ]] && throwError "Download completed, but no file found at: ${outputFile}" 52 | } 53 | 54 | _unzip() { 55 | [[ ! ${inZipFile} ]] && return 56 | if [[ ! -e "${inZipFile}" ]]; then 57 | logInfo "Unzipping ${outputFile}" 58 | unzip "${outputFile}" -d "${label}" > /dev/null 59 | throwError "Error Unzipping archive: ${outputFile}" 60 | 61 | deleteFile "${outputFile}" 62 | fi 63 | 64 | [[ ! "${requiresMount}" ]] && volumeToInstall=./${label} 65 | outputFile="${inZipFile}" 66 | } 67 | 68 | _mount() { 69 | [[ ! "${requiresMount}" ]] && return 70 | 71 | logInfo "Mounting ${outputFile}" 72 | local mountoutput=$(hdiutil mount "${outputFile}") 73 | throwError "Error mounting: ${outputFile}" 74 | 75 | local pah=($(echo "${mountoutput}" | tail -1)) 76 | local length=$((${#pah[@]} - 1)) 77 | volumeToInstall="${pah[${length}]}" 78 | } 79 | 80 | _run() { 81 | logInfo "Installing ${label}" 82 | sleep 1 83 | rsync -a "${volumeToInstall}"/*.app /Applications/ 84 | throwError "Error copying *.app into application folder" 85 | } 86 | 87 | _unmount() { 88 | [[ ! "${requiresMount}" ]] && folder.delete "${volumeToInstall}" && return 89 | 90 | logInfo "Unmouting ${label}" 91 | hdiutil detach -quiet "${volumeToInstall}" 92 | } 93 | 94 | _install() { 95 | this.download 96 | this.unzip 97 | this.mount 98 | this.run 99 | this.unmount 100 | this.cleanup 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /src/com/nu/art/pipeline/thunderstorm/Pipeline_ThunderstormWebProject_V2.groovy: -------------------------------------------------------------------------------- 1 | package com.nu.art.pipeline.thunderstorm 2 | 3 | import com.nu.art.pipeline.modules.SlackModule 4 | import com.nu.art.pipeline.modules.build.BuildModule 5 | import com.nu.art.pipeline.modules.git.GitModule 6 | import com.nu.art.pipeline.thunderstorm.models.ProjectEnvConfig 7 | import com.nu.art.pipeline.thunderstorm.models.ProjectGitConfig 8 | import com.nu.art.pipeline.workflow.WorkflowModule 9 | import com.nu.art.pipeline.workflow.variables.VarConsts 10 | import com.nu.art.pipeline.workflow.variables.Var_Env 11 | 12 | class Pipeline_ThunderstormWebProject_V2 13 | extends Pipeline_ThunderstormWebApp { 14 | 15 | public Var_Env Env_DeployToEnv = new Var_Env("DEPLOY_TO_ENV") 16 | public Var_Env Env_GitCloneBranch = new Var_Env("GIT_CLONE_BRANCH") 17 | 18 | ProjectGitConfig gitConfig 19 | def envProjects = [:] 20 | String slackChannel 21 | 22 | Pipeline_ThunderstormWebProject_V2(String name, String slackChannel, Class... modules) { 23 | super(name, modules) 24 | this.slackChannel = slackChannel 25 | } 26 | 27 | @Override 28 | protected void init() { 29 | String env = Env_DeployToEnv.get() 30 | String branch = Env_GitCloneBranch.get() ?: env 31 | env = env ?: branch 32 | 33 | getModule(SlackModule.class).setDefaultChannel(this.slackChannel) 34 | 35 | GitModule gitModule = getModule(GitModule.class) 36 | setRepo(gitModule 37 | .create(gitConfig.gitRepoUri) 38 | .setTrackSCM(gitConfig.scm) 39 | .setBranch(branch) 40 | .build()) 41 | 42 | 43 | ProjectEnvConfig envConfig = envProjects.get(env) as ProjectEnvConfig 44 | String links = ("" + 45 | "<${envConfig.webAppUrl}|WebApp> | " + 46 | "<${envConfig.firebaseProjectUrl}|Firebase> | " + 47 | "<${gitConfig.httpUrl}|Github>").toString() 48 | 49 | getModule(SlackModule.class).setOnSuccess(links) 50 | 51 | setEnv(env) 52 | super.init() 53 | } 54 | 55 | void setGitRepoId(String repoId, boolean scm = false) { 56 | setProjectGitConfig(new ProjectGitConfig(repoId, scm)) 57 | } 58 | 59 | void setProjectGitConfig(ProjectGitConfig gitConfig) { 60 | this.gitConfig = gitConfig 61 | } 62 | 63 | void declareEnv(String env, String projectId) { 64 | declareEnv(env, new ProjectEnvConfig(projectId)) 65 | } 66 | 67 | void declareEnv(String env, ProjectEnvConfig envConfig) { 68 | envProjects.put(env, envConfig) 69 | } 70 | 71 | void setDisplayName() { 72 | def version = getVersion() ? " - v${getVersion()}" : "" 73 | getModule(BuildModule.class).setDisplayName("#${VarConsts.Var_BuildNumber.get()}: ${getName()} ${this.env} ${version}") 74 | } 75 | 76 | @Override 77 | void pipeline() { 78 | checkout({ 79 | getModule(SlackModule.class).setOnSuccess(getRepo().getChangeLog().toSlackMessage()) 80 | }) 81 | 82 | install() 83 | clean() 84 | build() 85 | test() 86 | 87 | deploy() 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /scripts/git/git-fork.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of nu-art projects development tools, 3 | # it has a set of bash and gradle scripts, and the default 4 | # settings for Android Studio and IntelliJ. 5 | # 6 | # Copyright (C) 2017 Adam van der Kruk aka TacB0sS 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | 20 | #!/bin/bash 21 | 22 | source ${BASH_SOURCE%/*}/_core.sh 23 | runningDir=`getRunningDir` 24 | 25 | fromRepo=`gitGetRepoUrl` 26 | params=(debug toRepo fromRepo output) 27 | 28 | extractParams() { 29 | for paramValue in "${@}"; do 30 | case "${paramValue}" in 31 | "--from="*) 32 | fromRepo=`regexParam "--from" ${paramValue}` 33 | ;; 34 | 35 | "--output="*) 36 | output=`regexParam "--output" ${paramValue}` 37 | ;; 38 | 39 | "--to="*) 40 | toRepo=`regexParam "--to" ${paramValue}` 41 | ;; 42 | 43 | "--debug") 44 | debug=true 45 | ;; 46 | esac 47 | done 48 | } 49 | 50 | printUsage() { 51 | logVerbose 52 | logVerbose " USAGE:" 53 | logVerbose " ${BBlack}bash${NoColor} ${BCyan}${0}${NoColor} ${fromRepo} ${toRepo} ${output}" 54 | logVerbose 55 | exit 0 56 | } 57 | 58 | verifyRequirement() { 59 | local missingParamColor=${BRed} 60 | local existingParamColor=${BBlue} 61 | 62 | missingData= 63 | if [[ ! "${fromRepo}" ]]; then 64 | fromRepo="${missingParamColor}Repo to clone" 65 | missingData=true 66 | fi 67 | 68 | if [[ ! "${toRepo}" ]]; then 69 | toRepo="${missingParamColor}Repo to mirror${NoColor}" 70 | missingData=true 71 | fi 72 | 73 | if [[ ! "${output}" ]]; then 74 | output="${missingParamColor}where to clone mirror repo to${NoColor}" 75 | missingData=true 76 | fi 77 | 78 | if [[ "${missingData}" ]]; then 79 | fromRepo=" --from=${existingParamColor}${fromRepo}${NoColor}" 80 | toRepo=" --to=${existingParamColor}${toRepo}${NoColor}" 81 | output=" --output=${existingParamColor}${output}${NoColor}" 82 | 83 | printUsage 84 | fi 85 | } 86 | 87 | extractParams "$@" 88 | verifyRequirement 89 | 90 | signature "Fork Repo" 91 | printCommand "$@" 92 | printDebugParams ${debug} "${params[@]}" 93 | 94 | targetName=../temp-repo.git 95 | logInfo "Cloning: ${fromRepo} => ${targetName}" 96 | 97 | git clone --bare ${fromRepo} ${targetName} 98 | cd ${targetName} 99 | logInfo "Mirroring: ${targetName} => ${toRepo}" 100 | git push --mirror ${toRepo} 101 | cd - 102 | rm -rf ${targetName} 103 | 104 | git clone --recursive ${toRepo} ${output} --------------------------------------------------------------------------------