Added deploy and astylerc

This commit is contained in:
ineedbots 2021-06-18 14:17:58 -06:00
parent a568042934
commit 6d9dbb262a
5 changed files with 82 additions and 0 deletions

21
.astylerc Normal file
View File

@ -0,0 +1,21 @@
# try to mimic the original gsc provided
mode=c
style=allman
indent=tab
lineend=windows
pad-oper
pad-paren-in
pad-header
# delete-empty-lines
break-blocks
# remove-braces
indent-switches
indent-cases
indent-after-parens
remove-comment-prefix

5
.gitignore vendored
View File

@ -20,6 +20,11 @@ main_shared/maps/mp/gametypes/_hardpoints.gsx
*.zip
!/out
!/.astylerc
!/z_deploy.bat
!/deploy.bat
!/deploy.js
!/main/
/main/*
!/main/server.cfg

4
deploy.bat Normal file
View File

@ -0,0 +1,4 @@
xcopy cod4x_bot_warfare\main_shared\maps\mp\bots main_shared\maps\mp\bots\ /Y /I /E /H /C
xcopy cod4x_bot_warfare\main\waypoints main\waypoints\ /Y /I /E /H /C
xcopy cod4x_bot_warfare\main\botnames.txt main\botnames.txt /Y /I /H /C
xcopy cod4x_bot_warfare\main\plugins\httpget.dll main\plugins\httpget.dll /Y /I /H /C

51
deploy.js Normal file
View File

@ -0,0 +1,51 @@
// nodejs 14+
const exec = require('util').promisify(require('child_process').exec)
const repo_name = 'cod4x_bot_warfare'
const repo_url = `https://github.com/ineedbots/${repo_name}`
const deploy_check_rate = 60000
const title = 'CoD4x Bot Warfare Git Deployer'
function printToConsole(what, error = false)
{
log = error ? console.error : console.log
log(`[${new Date().toISOString()}]:`, what)
}
async function doDeploy() {
try {
const { stdout, stderr } = await exec(`cd ${repo_name} && git fetch`)
if (stderr.length <= 0)
return
if (stderr.startsWith('From '))
{
printToConsole('git fetched! Pulling...')
await exec(`cd ${repo_name} && git pull && git submodule update --init --recursive`)
printToConsole('Deploying...')
await exec('deploy.bat')
printToConsole('Deployed!')
}
} catch (e) {
printToConsole(e, true)
if (!e.stderr.startsWith('The system cannot find the path specified'))
return
printToConsole('Cloning repo...')
try {
await exec(`git clone ${repo_url} && cd ${repo_name} && git submodule update --init --recursive`)
printToConsole('Cloned!')
} catch (f) {
printToConsole(f, true)
}
}
}
process.stdout.write(`${String.fromCharCode(27)}]0;${title}${String.fromCharCode(7)}`)
doDeploy()
setInterval(doDeploy, deploy_check_rate)

1
z_deploy.bat Normal file
View File

@ -0,0 +1 @@
start "" "node" deploy.js