Skip to content
This repository has been archived by the owner on May 2, 2024. It is now read-only.

Commit

Permalink
screaming
Browse files Browse the repository at this point in the history
  • Loading branch information
sharpcdf committed Sep 16, 2022
1 parent 7b56660 commit 1275f77
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
10 changes: 4 additions & 6 deletions jitter/extract.nim
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,16 @@ proc extract*(pkg: Package, path, toDir: string, make = true) =

#Creates symlinks for executables and adds them to the bin
for file in walkDirRec(nerveDir / toDir):
if file.splitFile().name == "odin":
echo file
if not symlinkExists(binDir / file.splitFile().name):
case file.splitFile().ext:
of "":
if not file.hasExecPerms() and file.splitFile().name.isExecFile():
file.setFilePermissions({fpUserExec, fpOthersExec, fpUserRead, fpUserWrite, fpOthersRead, fpOthersWrite})
if file.hasExecPerms() and file.splitFile().name.isExecFile():
if not duplicate:
file.createSymlink(binDir / file.splitFile().name)
else:
file.createSymlink(binDir / fmt"{file.splitFile().name}-{pkg.tag}")
#if not duplicate:
file.createSymlink(binDir / file.splitFile().name)
#else:
# file.createSymlink(binDir / fmt"{file.splitFile().name}-{pkg.tag}")
success fmt"Created symlink {file.splitFile().name}"
of ".AppImage":
file.createSymlink(binDir / pkg.repo)
Expand Down
9 changes: 5 additions & 4 deletions jitter/github.nim
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ proc downloadRelease(pkg: Package, make = true) =
if name.isCompatibleExt() and name.isCompatibleCPU() and name.isCompatibleOS():
downloadUrl = asset["browser_download_url"].getStr()
downloadPath = name

#TODO: fix download proceeding despite 'no' response
success fmt"Archive found: {name}"
ask "Are you sure you want to download this archive? There might be other compatible assets. [Y/n]"
var answer = stdin.readLine().strip()
Expand All @@ -101,12 +101,13 @@ proc downloadRelease(pkg: Package, make = true) =

if downloadUrl.len == 0:
fatal fmt"No archives found for {pkg.gitFormat()}"

for f in walkDir(nerveDir):
if f.path.splitFile().name == pkg.pkgFormat():
fatal "Repository is already installed, exiting"
info fmt"Downloading {downloadUrl}"
#downloadPath should be ~/.jitter/nerve/repo-release.tar.gz or similar
client.downloadFile(downloadUrl, nerveDir / downloadPath)
success fmt"Downloaded {pkg.gitFormat()}"

success fmt"Downloaded {pkg.gitFormat}"
pkg.extract(nerveDir / downloadPath, pkg.pkgFormat(), make)

proc ghDownload*(pkg: Package, make = true) =
Expand Down
10 changes: 8 additions & 2 deletions jitter/parse.nim
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,16 @@ proc isCompatibleOS*(file: string): bool =
return false

proc isExecFile*(file:string): bool =
return file.startsWith(".") or file.toLowerAscii() == "makefile" or "license" in file.toLowerAscii()
if file.startsWith(".") or file.toLowerAscii() == "makefile" or "license" in file.toLowerAscii():
return false
else:
return true
proc hasExecPerms*(file: string): bool =
let perms = getFilePermissions(file)
return fpUserExec in perms or fpGroupExec in perms or fpOthersExec in perms
if fpUserExec in perms or fpGroupExec in perms or fpOthersExec in perms:
return true
else:
return false

proc validIdent(input: string, strVal: var string, start: int, validChars = IdentChars + {'.', '-'}): int =
while start + result < input.len and input[start + result] in validChars:
Expand Down

0 comments on commit 1275f77

Please sign in to comment.