فهرست منبع

update command

Heydon Pickering 8 سال پیش
والد
کامیت
bd316ce0c1
2فایلهای تغییر یافته به همراه22 افزوده شده و 1 حذف شده
  1. 2 1
      package.json
  2. 20 0
      scripts/update.js

+ 2 - 1
package.json

@@ -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 - 0
scripts/update.js

@@ -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!');
+  });
+});