1
0
mirror of https://github.com/veden/Rampant.git synced 2024-12-28 21:08:22 +02:00
Rampant/make.rkt

93 lines
3.5 KiB
Racket
Raw Normal View History

2016-09-14 13:16:33 +02:00
(module BuildScript racket
(provide run)
(require file/zip)
(require json)
2017-12-14 04:27:00 +02:00
(define modFolder "/data/games/factorio/mods/")
(define zipModFolder "/data/games/factorio2/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 (makeZip folder)
(let ((packagePath (string->path (string-append folder
packageName
".zip"))))
(when (file-exists? packagePath)
(delete-file packagePath)))
(zip (string-append folder
packageName
".zip")
#:path-prefix packageName
(string->path "info.json")
(string->path "control.lua")
(string->path "config.lua")
(string->path "data.lua")
2017-04-02 01:40:47 +02:00
(string->path "data-updates.lua")
2017-05-17 08:18:25 +02:00
(string->path "data-final-fixes.lua")
(string->path "LICENSE.md")
(string->path "tests.lua")
2017-12-14 04:27:00 +02:00
(string->path "changelog.txt")
(string->path "Upgrade.lua")
2017-04-30 09:46:04 +02:00
(string->path "settings.lua")
(string->path "README.md")
(string->path "NOTICE")
(string->path "libs")
2017-11-21 09:27:03 +02:00
(string->path "sounds")
(string->path "locale")
(string->path "graphics")
(string->path "prototypes")))
(define (copyFile fileName modFolder)
(copy-file (string->path fileName)
(string->path (string-append modFolder
packageName
"/"
fileName))))
(define (copyDirectory directoryName modFolder)
(copy-directory/files (string->path directoryName)
(string->path (string-append modFolder
packageName
"/"
directoryName))))
(define (copyFiles modFolder)
(let ((packagePath (string->path (string-append modFolder
packageName))))
(when (directory-exists? packagePath)
(delete-directory/files packagePath))
(sleep 0.1)
(make-directory packagePath)
(copyFile "control.lua" modFolder)
(copyFile "config.lua" modFolder)
(copyFile "info.json" modFolder)
(copyFile "data.lua" modFolder)
2017-04-02 01:40:47 +02:00
(copyFile "data-updates.lua" modFolder)
2017-05-17 08:18:25 +02:00
(copyFile "data-final-fixes.lua" modFolder)
2017-04-30 09:46:04 +02:00
(copyFile "settings.lua" modFolder)
2017-12-14 04:27:00 +02:00
(copyFile "changelog.txt" modFolder)
(copyFile "Upgrade.lua" modFolder)
(copyFile "tests.lua" modFolder)
(copyDirectory "libs" modFolder)
(copyDirectory "locale" modFolder)
2017-11-21 09:27:03 +02:00
(copyDirectory "sounds" modFolder)
(copyDirectory "graphics" modFolder)
(copyDirectory "prototypes" modFolder)))
2018-09-26 07:14:13 +02:00
(define (copy)
(copyFiles modFolder))
(define (zipIt)
(makeZip modFolder))
(define (run)
2019-02-03 08:01:28 +02:00
;; (copyFiles modFolder)
2018-01-23 23:39:32 +02:00
;;(copyFiles zipModFolder)
2019-02-03 08:01:28 +02:00
(makeZip modFolder)
(system*/exit-code "/data/games/factorio/bin/x64/factorio")))