Last active
January 21, 2019 20:27
Revisions
-
mindspank revised this gist
Apr 15, 2016 . No changes.There are no files selected for viewing
-
mindspank created this gist
Sep 18, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ var qsocks = require('qsocks') var serializeApp = require('serializeapp') var fs = require('fs-extra') var Promise = require('promise') function create(docname) { qsocks.Connect({appname: docname}) .then(function(global) { return global.openDoc(docname) }) .then(function(app) { return serializeApp(app) }) .then(function(data) { return writeJson(data) }) .then(function() { return console.log('Done') }) .catch(function(error) { console.log(error) }).done(function() { process.exit(1) }); }; function writeJson(data) { return new Promise(function(resolve, reject) { fs.writeJson(data.properties.qTitle + '.json', data, function (err) { if(err) { return reject(err); } return resolve(); }) }); }; create(process.argv[2] || 'Executive Dashboard'); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ var qsocks = require('qsocks') var buildapp = require('buildapp') var fs = require('fs-extra') var Promise = require('promise') function read(filename) { return qsocks.Connect().then(function(global) { return readJson(filename).then(function(data) { return buildapp(global, data, { filename: data.properties.qTitle + Date.now(), reload: true }); }); }) }; function readJson(filename) { return new Promise(function(resolve, reject) { return fs.readJson(filename, function (err, data) { return resolve(data) }) }); }; read(process.argv[2] || 'Telecom Customer Retention.json').then(function() { console.log('Done') }) .catch(function(error) { console.log(error) }) .done(function() { process.exit(1) });