|
2 | 2 |
|
3 | 3 | set -o errexit -o errtrace -o nounset -o pipefail
|
4 | 4 |
|
5 |
| -update_sources() { |
| 5 | +: "${GIT:=git}" |
6 | 6 |
|
7 |
| - get_project_name_from_github_url() { |
8 |
| - local sContent sProject sUrl |
| 7 | +update_sources() { |
9 | 8 |
|
10 |
| - readonly sContent="${1?One parameter required: <content>}" |
| 9 | + local -r sScriptPath="$(realpath "$(dirname "${BASH_SOURCE[0]}")")" |
11 | 10 |
|
12 |
| - readonly sUrl=$(echo "${sContent}" | grep -E '^SOURCE=' | grep -oE 'https?://.*') |
13 |
| - readonly sProject="$(echo "${sUrl}" | rev | grep -oE '[^/]+/[^/]+' | rev)" |
14 |
| - |
15 |
| - echo "${sProject}" |
16 |
| - } |
| 11 | + # shellcheck source=./src/function.get_local_version.sh |
| 12 | + source "${sScriptPath}/src/function.get_local_version.sh" |
| 13 | + # shellcheck source=./src/function.get_project_name_from_github_url.sh |
| 14 | + source "${sScriptPath}/src/function.get_project_name_from_github_url.sh" |
| 15 | + # shellcheck source=./src/function.get_version_from_remote_git.sh |
| 16 | + source "${sScriptPath}/src/function.get_version_from_remote_git.sh" |
17 | 17 |
|
18 | 18 | update_source() {
|
19 |
| - local iLength sConfig sFilePath sPath sProject sSource sSourceFile sSourcePath sTargetFile sTargetPath |
| 19 | + local iLength sConfig sFilePath sPath sProject sRemoteVersion sSource sSourceFile sSourcePath sTargetFile sTargetFolder sTargetPath |
20 | 20 |
|
21 | 21 | readonly sProject="${1?Five parameters required: <project> <target-path> <source-path> <path> <config>}"
|
22 | 22 | readonly sTargetPath="${2?Five parameters required: <project> <target-path> <source-path> <path> <config>}"
|
@@ -62,6 +62,22 @@ update_sources() {
|
62 | 62 | echo -e "\tNo '*.puml' files found. Skipping"
|
63 | 63 | # @TODO: Check if there is an SVG (or PNG?) source dir and generate '*.puml' files from there
|
64 | 64 | fi
|
| 65 | + |
| 66 | + echo " -----> Writing INFO file" |
| 67 | + sRemoteVersion="$(get_version_from_remote_git "${sProject}")" |
| 68 | + |
| 69 | + if [[ "${sRemoteVersion}" == '' ]];then |
| 70 | + sRemoteVersion="0.0.1" |
| 71 | + fi |
| 72 | + |
| 73 | + if echo "${sRemoteVersion}" | grep -E '^[0-9]+\.[0-9]+$';then |
| 74 | + sRemoteVersion="${sRemoteVersion}.0" |
| 75 | + fi |
| 76 | + |
| 77 | + cat > "${sTargetPath}/${sPath}/INFO" <<TXT |
| 78 | +VERSION=${sRemoteVersion} |
| 79 | +SOURCE=https://github.com/${sProject} |
| 80 | +TXT |
65 | 81 | fi
|
66 | 82 | }
|
67 | 83 |
|
|
0 commit comments