1
0
mirror of https://github.com/veden/Rampant.git synced 2025-01-30 04:30:52 +02:00

FACTO-235: Added uninstall command

This commit is contained in:
Aaron Veden 2023-02-25 13:28:43 -08:00
parent 6e09673f81
commit 4980a7fd6a
No known key found for this signature in database
GPG Key ID: FF5990B1C6DD3F84
2 changed files with 31 additions and 29 deletions

View File

@ -20,5 +20,7 @@
((nil . ((projectile-project-install-cmd . "./make.sh copy")
(projectile-install-buffer-suffix . "install")
(projectile-project-package-cmd . "./make.sh zip")
(projectile-package-buffer-suffix . "package")
(projectile-package-buffer-suffix . "install")
(projectile-project-uninstall-cmd . "./make.sh clear")
(projectile-uninstall-buffer-suffix . "install")
(projectile-project-run-cmd . "factorio"))))

56
make.sh
View File

@ -6,24 +6,11 @@
(define modFolder "/mnt/gallery/gameFiles/factorio/mods/")
(define serverModFolder "/home/veden/Downloads/factorio/mods/")
(define configuration (call-with-input-file "info.json"
(lambda (port)
(string->jsexpr (port->string port)))))
(define packageName (string-append (string-replace (hash-ref configuration 'name) " " "_")
"_"
(hash-ref configuration 'version)))
(define packageName '())
(define configuration '())
(define (makeZip folder)
(let ((packagePath (string->path (string-append folder
packageName
".zip")))
(unzippedPath (string->path (string-append folder
packageName))))
(delete-directory/files unzippedPath)
(when (file-exists? packagePath)
(delete-file packagePath)))
(clear)
(zip (string-append folder
packageName
@ -90,28 +77,41 @@
(copyDirectory "graphics" modFolder)
(copyDirectory "prototypes" modFolder)))
(define (copy)
(define (set-metadata)
(set! configuration (call-with-input-file "info.json"
(lambda (port)
(string->jsexpr (port->string port)))))
(set! packageName (string-append (string-replace (hash-ref configuration 'name) " " "_")
"_"
(hash-ref configuration 'version)))
(hash-ref configuration 'version))))
(print (string-append "copying " (hash-ref configuration 'name) (hash-ref configuration 'version)))
(copyFiles modFolder))
(define (copy)
(set-metadata)
(copyFiles modFolder)
(print (string-append "copying " (hash-ref configuration 'name) (hash-ref configuration 'version))))
(define (zipIt)
(set! configuration (call-with-input-file "info.json"
(lambda (port)
(string->jsexpr (port->string port)))))
(set! packageName (string-append (string-replace (hash-ref configuration 'name) " " "_")
"_"
(hash-ref configuration 'version)))
(print (string-append "zipping " (hash-ref configuration 'name) (hash-ref configuration 'version)))
(makeZip modFolder))
(set-metadata)
(makeZip modFolder)
(print (string-append "zipping " (hash-ref configuration 'name) (hash-ref configuration 'version))))
(define (clear)
(set-metadata)
(let ((packagePath (string->path (string-append modFolder
packageName
".zip")))
(unzippedPath (string->path (string-append modFolder
packageName))))
(when (directory-exists? unzippedPath)
(delete-directory/files unzippedPath))
(when (file-exists? packagePath)
(delete-file packagePath)))
(print (string-append "clearing " (hash-ref configuration 'name) (hash-ref configuration 'version))))
(let ((arg (vector-ref (current-command-line-arguments) 0)))
(cond ((equal? arg "copy") (copy))
((equal? arg "zip") (zipIt))
((equal? arg "clear") (clear))
(else "Invalid command arg [copy,zip]")))