[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [websites/neverland/gsoc] /: copy template files to new theme folder
From:       Minh Chu <scsilver94 () gmail ! com>
Date:       2016-05-31 18:30:13
Message-ID: E1b7oQf-0007Rk-Fb () scm ! kde ! org
[Download RAW message or body]

Git commit 5a771d24ee80c34ed2e83745ee2f4ddb2ce7a147 by Minh Chu.
Committed on 31/05/2016 at 18:30.
Pushed by minhchu into branch 'gsoc'.

copy template files to new theme folder

M  +23   -0    neverland

http://commits.kde.org/websites/neverland/5a771d24ee80c34ed2e83745ee2f4ddb2ce7a147

diff --git a/neverland b/neverland
index 25ad6c2..d210501 100644
--- a/neverland
+++ b/neverland
@@ -3,6 +3,7 @@
 
 const chalk = require('chalk');
 const vorpal = require('vorpal')();
+const fs = require('fs');
 
 /*console.log(chalk.bgGreen(`
   _   _                     _                 _
@@ -22,6 +23,28 @@ vorpal
     .action(function (args) {
         this.log('Creating new ' + chalk.green(args.themeName) + ' theme');
         // implementation
+        var templatesPath = __dirname + '/architect/templates/';
+        var blueprintsPath = __dirname + '/blueprints/';
+
+        fs.mkdir(blueprintsPath + args.themeName, function(err) {
+            if (err) {
+                if (err.code !== 'EEXIST') {
+                    console.log('Something went wrong');
+                }
+                console.log('Theme already existed');
+                return;
+            }
+            fs.readdir(templatesPath, function(err, files) {
+                files.forEach(function(file) {
+                    var fileName = file;
+                    if (file === 'config.json') {
+                        fileName = args.themeName + '.json';
+                    }
+                    fs.createReadStream(templatesPath + file)
+                      .pipe(fs.createWriteStream(blueprintsPath + args.themeName + '/' + fileName));
+                })
+            })
+        });
     });
 
 vorpal
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic