1
0
mirror of https://github.com/veden/Rampant.git synced 2024-12-30 21:19:46 +02:00
Rampant/make.rkt

81 lines
3.3 KiB
Racket
Raw Normal View History

2016-09-14 13:16:33 +02:00
(module BuildScript racket
(require file/zip)
(require json)
;(define modFolder "C:/Users/veden/AppData/Roaming/Factorio/mods/")
;(define zipModFolder "C:/Program Files/Factorio_0.14.1/mods/")
2016-09-14 22:18:56 +02:00
(define modFolder "/home/veden/.factorio/mods/")
2016-11-04 01:51:35 +02:00
(define zipModFolder "/data/games/factorio14.18/mods/")
2016-09-14 13:16:33 +02:00
(define configuration (call-with-input-file "info.json"
(lambda (port)
(string->jsexpr (port->string port)))))
2016-09-14 13:16:33 +02:00
(define packageName (string-append (string-replace (hash-ref configuration 'name) " " "_")
2016-10-15 02:00:18 +02:00
"_"
(hash-ref configuration 'version)))
2016-09-14 13:16:33 +02:00
2016-10-15 02:00:18 +02:00
(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")
(string->path "LICENSE.md")
(string->path "tests.lua")
; (string->path "setupUtils.lua")
(string->path "README.md")
; (string->path "setup.lua")
(string->path "NOTICE")
(string->path "libs")
(string->path "locale")
(string->path "graphics")
(string->path "prototypes")))
2016-09-14 13:16:33 +02:00
;(current-directory "..")
(define (copyFile fileName modFolder)
2016-10-15 02:00:18 +02:00
(copy-file (string->path fileName)
(string->path (string-append modFolder
packageName
"/"
fileName))))
2016-09-14 13:16:33 +02:00
(define (copyDirectory directoryName modFolder)
2016-10-15 02:00:18 +02:00
(copy-directory/files (string->path directoryName)
(string->path (string-append modFolder
packageName
"/"
directoryName))))
2016-09-14 13:16:33 +02:00
(define (copyFiles modFolder)
2016-10-15 02:00:18 +02:00
(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 "setupUtils.lua" modFolder)
(copyFile "data.lua" modFolder)
(copyFile "tests.lua" modFolder)
(copyDirectory "libs" modFolder)
(copyDirectory "locale" modFolder)
(copyDirectory "graphics" modFolder)
(copyDirectory "prototypes" modFolder)))
2017-01-20 07:58:36 +02:00
;;(copyFiles modFolder)
2016-10-31 05:24:14 +02:00
;; (copyFiles zipModFolder)
2016-11-04 09:26:19 +02:00
(makeZip modFolder)
2016-10-31 05:24:14 +02:00
;;(makeZip zipModFolder)
)