update command

This commit is contained in:
Heydon Pickering 2017-08-21 18:33:53 +01:00
parent 5c07e6d1a4
commit bd316ce0c1
2 changed files with 22 additions and 1 deletions

View File

@ -7,7 +7,8 @@
"test": "echo \"Error: no test specified\" && exit 1",
"serve": "hugo server --baseURL http://localhost:1313",
"clean": "rm -rf content && mkdir content && mkdir content/patterns && hugo new patterns/pattern.md && hugo new _index.md && hugo new print-version.md --kind print-version && cat themes/infusion/data/README_BLANK.md > README.md",
"build": "rm -rfv docs/* && hugo && sw-precache --root=docs && git add -A"
"build": "rm -rfv docs/* && hugo && sw-precache --root=docs && git add -A",
"update": "node scripts/update.js"
},
"pre-commit": [
"build"

20
scripts/update.js Executable file
View File

@ -0,0 +1,20 @@
var exec = require('child_process').exec;
var path = require('path');
var themeFolder = path.join(path.resolve('.'), 'themes');
console.log(themeFolder);
var oldTheme = path.join(themeFolder, 'infusion');
exec('mv '+oldTheme+' '+oldTheme+'-old-version-'+Date.now(), function(error, stdout, stderr) {
if (error !== null) {
console.error('Error saving old infusion version.');
return;
}
exec ('svn export https://github.com/ThePacielloGroup/infusion/trunk/themes/infusion '+oldTheme, function(error, stdout, stderr) {
if (error !== null) {
console.error('SVN error exporting infusion from Github. Is SVN installed?');
return;
}
console.log('Infusion updated to latest version!');
});
});