mirror of
https://github.com/ineedbots/t4_bot_warfare.git
synced 2025-04-23 00:15:44 +00:00
Add deploy and astylerc
This commit is contained in:
parent
a11119abe3
commit
ed8fd1db01
21
.astylerc
Normal file
21
.astylerc
Normal 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
5
.gitignore
vendored
@ -15,6 +15,11 @@
|
|||||||
|
|
||||||
*.zip
|
*.zip
|
||||||
|
|
||||||
|
!/.astylerc
|
||||||
|
!/z_deploy.bat
|
||||||
|
!/deploy.bat
|
||||||
|
!/deploy.js
|
||||||
|
|
||||||
!/main/
|
!/main/
|
||||||
!/main_shared/
|
!/main_shared/
|
||||||
/main/*
|
/main/*
|
||||||
|
3
deploy.bat
Normal file
3
deploy.bat
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
xcopy t4m_bot_warfare\main_shared\maps main_shared\maps\ /Y /I /E /H /C
|
||||||
|
xcopy t4m_bot_warfare\main_shared\waypoints main_shared\waypoints\ /Y /I /E /H /C
|
||||||
|
xcopy t4m_bot_warfare\main_shared\bots.txt main_shared\ /Y /I /H /C
|
51
deploy.js
Normal file
51
deploy.js
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
// nodejs 14+
|
||||||
|
|
||||||
|
const exec = require('util').promisify(require('child_process').exec)
|
||||||
|
|
||||||
|
const repo_name = 't4m_bot_warfare'
|
||||||
|
const repo_url = `https://github.com/ineedbots/${repo_name}`
|
||||||
|
const deploy_check_rate = 60000
|
||||||
|
const title = 'T4M 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
1
z_deploy.bat
Normal file
@ -0,0 +1 @@
|
|||||||
|
start "" "node" deploy.js
|
Loading…
x
Reference in New Issue
Block a user