branch specific syncing
parent
71ffc122d6
commit
6685ff1ae1
|
|
@ -1,7 +1,7 @@
|
||||||
(() => {
|
(() => {
|
||||||
const log = require('signale').scope('service');
|
const log = require('signale').scope('service');
|
||||||
const { execSync, spawn } = require('child_process');
|
const { execSync, spawn } = require('child_process');
|
||||||
const branch = 'master';
|
const branch = execSync('git rev-parse --abbrev-ref HEAD').toString().trim();
|
||||||
let proc;
|
let proc;
|
||||||
const Datastore = require('nedb');
|
const Datastore = require('nedb');
|
||||||
const logs = new Datastore({
|
const logs = new Datastore({
|
||||||
|
|
@ -14,10 +14,17 @@ const app = express();
|
||||||
|
|
||||||
logp('==================================');
|
logp('==================================');
|
||||||
logp('Starting Valnet Node as a Service!');
|
logp('Starting Valnet Node as a Service!');
|
||||||
|
logp('Syncing to branch: ' + branch);
|
||||||
logp('==================================');
|
logp('==================================');
|
||||||
|
|
||||||
setInterval(function update() {
|
setInterval(function update() {
|
||||||
const remoteHash = execSync('git ls-remote https://github.com/marcus13345/valnet.git').toString().split(/[\t\n]/g)[0].trim();
|
const remoteHash = execSync('git ls-remote https://github.com/marcus13345/valnet.git').toString()
|
||||||
|
.split('\n')
|
||||||
|
.filter(test => {
|
||||||
|
return test.trim().endsWith(branch);
|
||||||
|
})[0]
|
||||||
|
.split('\t')[0]
|
||||||
|
.trim();
|
||||||
const localHash = execSync(`git rev-parse ${branch}`).toString().trim();
|
const localHash = execSync(`git rev-parse ${branch}`).toString().trim();
|
||||||
if(remoteHash !== localHash) {
|
if(remoteHash !== localHash) {
|
||||||
logp(`remote hash: ${remoteHash}`);
|
logp(`remote hash: ${remoteHash}`);
|
||||||
|
|
|
||||||
Reference in New Issue