main: add example switch to displayu examples on heroku demo

This commit is contained in:
jean-emmanuel 2016-09-21 14:21:44 +02:00
parent 231a97042d
commit cba57fc6c4
3 changed files with 10 additions and 2 deletions

View file

@ -1 +1 @@
web: node index.js -n $PORT
web: node index.js -n $PORT --examples

View file

@ -8,6 +8,12 @@ module.exports = function(settings,fs,ipc,osc,dialog) {
if (settings.read('theme')) ipc.send('applyStyle',settings.read('theme'),clientId)
if (settings.read('sessionFile')) this.sessionOpen({path:settings.read('sessionFile')},clientId)
var recentSessions = settings.read('recentSessions')
if (settings.read('examples')) {
recentSessions = fs.readdirSync('examples')
recentSessions = recentSessions.map(function(file){return 'examples/' + file})
}
ipc.send('sessionList',recentSessions,clientId)
},

View file

@ -12,7 +12,8 @@ var argv = require('yargs')
'p':{alias:'port',describe:'osc input port (for synchronization)'},
'd':{alias:'debug',describe:'log received osc messages in the console'},
'n':{alias:'nogui',describe:'disable default gui and makes the app availabe through http on specified port'},
't':{alias:'theme',type:'array',describe:'theme name or path (mutliple values allowed)'}
't':{alias:'theme',type:'array',describe:'theme name or path (mutliple values allowed)'},
'examples':{describe:'list examples instead of recent sessions'}
})
.check(function(a,x){if(a.p==undefined || !isNaN(a.p)&&a.p>1023&&parseInt(a.p)===a.p){return true}else{throw 'Error: Port must be an integer >= 1024'}})
.check(function(a,x){if(a.n==undefined || !isNaN(a.n)&&a.n>1023&&parseInt(a.n)===a.n){return true}else{throw 'Error: Port must be an integer >= 1024'}})
@ -33,6 +34,7 @@ module.exports = function(fs) {
debug: argv.d || false,
sessionFile: argv.l || false,
noGui: argv.n || false,
examples: argv.examples,
theme: function(){
if (!argv.t) return
var style = []