cupper-hugo-theme/lib/update.js

21 lines
712 B
JavaScript
Raw Normal View History

2017-08-21 19:33:53 +02:00
var exec = require('child_process').exec;
var path = require('path');
var themeFolder = path.join(path.resolve('.'), 'themes');
2017-11-02 16:37:06 +01:00
var oldTheme = path.join(themeFolder, 'cupper');
2017-08-21 19:33:53 +02:00
2017-08-22 10:54:01 +02:00
exec('mv '+oldTheme+' '+oldTheme+'-old-'+Date.now(), function(error, stdout, stderr) {
2017-09-13 09:37:35 +02:00
console.log('Updating...');
2017-08-21 19:33:53 +02:00
if (error !== null) {
2017-11-02 16:37:06 +01:00
console.error('Error saving old cupper version.');
2017-08-21 19:33:53 +02:00
return;
}
2017-11-02 16:37:06 +01:00
exec ('svn export https://github.com/ThePacielloGroup/cupper/trunk/themes/cupper '+oldTheme, function(error, stdout, stderr) {
2017-08-21 19:33:53 +02:00
if (error !== null) {
2017-11-02 16:37:06 +01:00
console.error('SVN error exporting cupper from Github. Is SVN installed?');
2017-08-21 19:33:53 +02:00
return;
}
2017-11-02 16:37:06 +01:00
console.log('Cupper updated to latest version!');
2017-08-21 19:33:53 +02:00
});
});