mirror of
https://github.com/misenhower/splatoon2.ink.git
synced 2026-03-21 17:24:37 -05:00
Split out upload/download sync actions
This commit is contained in:
parent
a2e1482a93
commit
daed626dc0
|
|
@ -6,12 +6,14 @@
|
|||
"build": "vue-cli-service build --modern --no-clean",
|
||||
"lint": "vue-cli-service lint",
|
||||
"cron": "node src/app/cron",
|
||||
"start": "npm run sync && npm run splatnet && npm run twitter && npm run cron",
|
||||
"start": "npm run sync:download && npm run splatnet && npm run twitter && npm run cron",
|
||||
"locale-man": "node node_modules/locale-man/ -l en,es,es-MX,fr,fr-CA,de,nl,it,ru,ja -o src/locale",
|
||||
"splatnet": "node src/app splatnet",
|
||||
"twitter": "node src/app twitter",
|
||||
"twitter:test": "node src/app twitterTest",
|
||||
"sync": "node src/app sync",
|
||||
"sync:upload": "node src/app syncUpload",
|
||||
"sync:download": "node src/app syncDownload",
|
||||
"utility:copyTranslation": "node src/utility copyTranslation",
|
||||
"utility:getSplatNetLanguageFiles": "node src/utility getSplatNetLanguageFiles",
|
||||
"utility:updateGear": "node src/utility updateGear"
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ module.exports = {
|
|||
twitter: require('./twitter').maybePostTweets,
|
||||
twitterTest: require('./twitter').testScreenshots,
|
||||
sync: require('./sync').sync,
|
||||
syncUpload: require('./sync').syncUpload,
|
||||
syncDownload: require('./sync').syncDownload,
|
||||
};
|
||||
|
||||
require('make-runnable/custom')({ printOutputFrame: false });
|
||||
|
|
|
|||
|
|
@ -5,11 +5,6 @@ const mime = require('mime-types');
|
|||
|
||||
class S3Syncer
|
||||
{
|
||||
async sync() {
|
||||
await this.download();
|
||||
await this.upload();
|
||||
}
|
||||
|
||||
download() {
|
||||
this.log('Downloading files...');
|
||||
|
||||
|
|
|
|||
|
|
@ -9,16 +9,35 @@ function canSync() {
|
|||
);
|
||||
}
|
||||
|
||||
function sync() {
|
||||
async function doSync(download, upload) {
|
||||
if (!canSync()) {
|
||||
console.warn('Missing S3 connection parameters');
|
||||
return;
|
||||
}
|
||||
|
||||
console.info('Syncing files...');
|
||||
|
||||
const syncer = new S3Syncer();
|
||||
return syncer.sync();
|
||||
|
||||
if (download) {
|
||||
console.info('Downloading files...');
|
||||
await syncer.download();
|
||||
}
|
||||
|
||||
if (upload) {
|
||||
console.info('Uploading files...');
|
||||
await syncer.upload();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { canSync, sync };
|
||||
function sync() {
|
||||
return doSync(true, true);
|
||||
}
|
||||
|
||||
function syncUpload() {
|
||||
return doSync(false, true);
|
||||
}
|
||||
|
||||
function syncDownload() {
|
||||
return doSync(true, false);
|
||||
}
|
||||
|
||||
module.exports = { canSync, sync, syncUpload, syncDownload };
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user