diff options
| author | aethrvmn <me@aethrvmn.gr> | 2025-11-11 00:06:42 +0000 |
|---|---|---|
| committer | aethrvmn <me@aethrvmn.gr> | 2025-11-11 00:06:42 +0000 |
| commit | 9ff4c6820f794ed48eb503e1bb437c4b820c7008 (patch) | |
| tree | 91db6de0c88d47e7d6dcc8d4c13caea1927799d9 /src/old.core/manager.nim | |
| parent | added main executable (diff) | |
removed obsolete files
Diffstat (limited to 'src/old.core/manager.nim')
| -rw-r--r-- | src/old.core/manager.nim | 98 |
1 files changed, 0 insertions, 98 deletions
diff --git a/src/old.core/manager.nim b/src/old.core/manager.nim deleted file mode 100644 index a739f3d..0000000 --- a/src/old.core/manager.nim +++ /dev/null @@ -1,98 +0,0 @@ -import std / [ - os, - osproc, - hashes, - strformat -] - -proc runCommand*( - command: string, - workingDir: string = "" -): (string, int) = - echo "-> {command} (workingDir: {workingDir})".fmt - let (output, code) = execCmdEx( - command=command, - workingDir=workingDir - ) - result = (output, code) - -proc ensureDir*(path: string) = - if not dirExists(path): - createDir(path) - -proc readConfigFile*(configPath: string): string = - if fileExists(configPath): - result = readFile(configPath) - else: - result = "" - -proc cloneSource*( - repoURL: string, - destinationDir: string -) = - if dirExists(destinationDir): - echo "Repository already exists at {destinationDir}".fmt - echo "Pulling..." - let (output, code) = runCommand( - command="git pull", - workingDir=destinationDir - ) - echo output - else: - echo "Cloning from {repoURL}...".fmt - let (output, code) = runCommand( - command="git clone {repoURL} {destinationDir}".fmt - ) - echo output - -proc fetchTags*( - destinationDir: string -) = - let (output, code) = runCommand( - command="git fetch --tags --force", - workingDir=destinationDir - ) - echo output - - -proc resolveTag*( - destinationDir: string, - pinnedTag: string = "" -): string = - ## if pinnedTag is defined, we use that; - ## otherwise we fall back to newest tag - if pinnedTag.len > 0: - result = pinnedTag - let (output, code) = runCommand( - command="git rev-parse --verify {pinnedTag}".fmt, - workingDir=destinationDir - ) - echo output - if code != 0: - # if it fails, we try to fetch the tag - # just in case - fetchTags(destinationDir) - let (newOutput, newCode) = runCommand( - "git rev-parse --verify {pinnedTag}".fmt, - workingDir=destinationdir - ) - echo newOutput - if newCode != 0: - quit("Pinned tag {pinnedTag} not found in repo at {destDir}.") - else: - let (output, code) = runCommand( - command="git describe --tags --abbrev=0", - workingDir=destinationDir - ) - result = output - if code != 0: - quit("There seem to be no releases available from this software") - -proc computeSHA256*( - sourceDir: string, - chosenTag: string -): string = - let - tag = if chosenTag.len > 0: tag else: "HEAD" - command = "git archive --format=tar {tag} | sha256sum".fmt - |
