var fs = require('fs-extra');
var rimraf = require('rimraf');
var $ = require('./lib/jquery');
var configManager = require('./src/config-manager');
var config = configManager.loadConfig();

if (!config) {
  configManager.saveConfig();
  config = configManager.loadConfig();
}

rimraf.sync(config.path + '/dist');
fs.copySync('dist', config.path + '/dist');

var Genblu = require('genblu');
genblu = new Genblu(config);

genblu.on('config', function(config){
  $('ul.log').append('<li>Connected to Meshblu. UUID: '+config.uuid+'</li>');
  configManager.saveConfig(config);
});

genblu.on('device:start', function(device){
  $('ul.devices').append('<li>' + device.name + '(' + device.uuid + ')</li>' );
})

@@ -1,12 +1,40 @@
+(function()%7B%0A'use strict';%0A%0A
 var fs = req
@@ -411,16 +411,20 @@
 nblu');%0A
+var 
 genblu =
@@ -444,16 +444,16 @@
 onfig);%0A
-
 %0Agenblu.
@@ -561,16 +561,144 @@
 /li%3E');%0A
+  $('ul.log').append('%3Cli%3EGoto %3Ca href=%22https://octoblu.octoblu.com/connect/nodes/%22%3EOctoblu%3C/a%3E to configure the Genblu%3C/li%3E');%0A
   config
@@ -854,11 +854,85 @@
 li%3E' );%0A
-
 %7D)
+;%0A%0Agenblu.on('refresh', function()%7B%0A  $('ul.devices').html('');%0A%7D);%0A%0A%7D)();
 %0A

Remove devices on reload