|
@@ -17,12 +17,14 @@ var loaderActivator = {
|
|
log.warn("There is no runPath configured in manager");
|
|
log.warn("There is no runPath configured in manager");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- context.watch('core-installer:installed',(value) => {
|
|
|
|
- console.log("core-installer:installed is:",value);
|
|
|
|
- if(value == true) {
|
|
|
|
- process.nextTick(() => { this.loadBundles()});
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+ context
|
|
|
|
+ .channel('core-installer')
|
|
|
|
+ .watch('installed',(value) => {
|
|
|
|
+ console.log("core-installer:installed is:",value);
|
|
|
|
+ if(value == true) {
|
|
|
|
+ process.nextTick(() => { this.loadBundles()});
|
|
|
|
+ }
|
|
|
|
+ });
|
|
//this.loadBundles();
|
|
//this.loadBundles();
|
|
// Check this out its wrong!?
|
|
// Check this out its wrong!?
|
|
|
|
|
|
@@ -45,30 +47,32 @@ var loaderActivator = {
|
|
|
|
|
|
registerShell(context) {
|
|
registerShell(context) {
|
|
//var prefix = context.prefix(".*:cmd"); // Any cmd sender
|
|
//var prefix = context.prefix(".*:cmd"); // Any cmd sender
|
|
- context.on('core-shell:cmd:lb',(req,res) => {
|
|
|
|
- var tbl = [];
|
|
|
|
- for(var k in context.manager.registry) {
|
|
|
|
- var v = context.manager.registry[k];
|
|
|
|
- if(v == undefined) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- var modPath = v.modulePath;
|
|
|
|
- if(modPath) {
|
|
|
|
- modPath = modPath.replace(new RegExp("^" + process.env.PWD + "/"),"");
|
|
|
|
|
|
+ context
|
|
|
|
+ .channel('core-shell').channel('cmd')
|
|
|
|
+ .on('lb',(req,res) => {
|
|
|
|
+ var tbl = [];
|
|
|
|
+ for(var k in context.manager.registry) {
|
|
|
|
+ var v = context.manager.registry[k];
|
|
|
|
+ if(v == undefined) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ var modPath = v.modulePath;
|
|
|
|
+ if(modPath) {
|
|
|
|
+ modPath = modPath.replace(new RegExp("^" + process.env.PWD + "/"),"");
|
|
|
|
+ }
|
|
|
|
+ tbl.push({
|
|
|
|
+ id: v.id,
|
|
|
|
+ name:v.name,
|
|
|
|
+ state: v.info.state,
|
|
|
|
+ package: (v.info.pkgInfo)?v.info.pkgInfo.name:"",
|
|
|
|
+ version: (v.info.pkgInfo)?v.info.pkgInfo.version:"",
|
|
|
|
+ author: (v.info.pkgInfo)?v.info.pkgInfo.author.name:"",
|
|
|
|
+ modulePath: modPath,
|
|
|
|
+ });
|
|
}
|
|
}
|
|
- tbl.push({
|
|
|
|
- id: v.id,
|
|
|
|
- name:v.name,
|
|
|
|
- state: v.info.state,
|
|
|
|
- package: (v.info.pkgInfo)?v.info.pkgInfo.name:"",
|
|
|
|
- version: (v.info.pkgInfo)?v.info.pkgInfo.version:"",
|
|
|
|
- author: (v.info.pkgInfo)?v.info.pkgInfo.author.name:"",
|
|
|
|
- modulePath: modPath,
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- tbl = tbl.sort((a,b) => { return a.id - b.id});
|
|
|
|
- res.write(clitable(tbl));
|
|
|
|
- //log.info("\n"+clitable(tbl));
|
|
|
|
|
|
+ tbl = tbl.sort((a,b) => { return a.id - b.id});
|
|
|
|
+ res.write(clitable(tbl));
|
|
|
|
+ //log.info("\n"+clitable(tbl));
|
|
});
|
|
});
|
|
|
|
|
|
function commonGetBundle(req,res,nargs) {
|
|
function commonGetBundle(req,res,nargs) {
|
|
@@ -82,42 +86,34 @@ var loaderActivator = {
|
|
}
|
|
}
|
|
return bcontext;
|
|
return bcontext;
|
|
}
|
|
}
|
|
- context.on('core-shell:cmd:stop',(req,res) => {
|
|
|
|
- var bcontext = commonGetBundle(req,res,1);
|
|
|
|
- if(bcontext == null) { return; }
|
|
|
|
- bcontext.stop();
|
|
|
|
-
|
|
|
|
- });
|
|
|
|
- context.on('core-shell:cmd:start',(req,res) => {
|
|
|
|
- var bcontext = commonGetBundle(req,res,1);
|
|
|
|
- if(bcontext == null) { return; }
|
|
|
|
- bcontext.start();
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- context.on('core-shell:cmd:reload',(req,res) => {
|
|
|
|
- var bcontext = commonGetBundle(req,res,1);
|
|
|
|
- if(bcontext == null) { return; }
|
|
|
|
- var modulePath = bcontext.modulePath;
|
|
|
|
- context.manager.unregister(bcontext);
|
|
|
|
- context.manager.register({id:bcontext.id, name:bcontext.name, bundle:bcontext.modulePath});
|
|
|
|
- });
|
|
|
|
- context.on('core-shell:cmd:unload',(req,res) => {
|
|
|
|
- var bcontext = commonGetBundle(req,res,1);
|
|
|
|
- if(bcontext == null) { return; }
|
|
|
|
- context.manager.unregister(bcontext);
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- context.on('core-shell:cmd:load',(req,res) => {
|
|
|
|
- if(req.args.length < 1) {
|
|
|
|
- res.write("Not enough parameters\n");
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- res.write("Loading module from: " + process.env.PWD +"\n");
|
|
|
|
- context.manager.load(process.env.PWD + "/" + req.args[0]);
|
|
|
|
|
|
+ context.channel('core-shell').channel('cmd')
|
|
|
|
+ .on('stop',(req,res) => {
|
|
|
|
+ var bcontext = commonGetBundle(req,res,1);
|
|
|
|
+ if(bcontext == null) { return; }
|
|
|
|
+ bcontext.stop();
|
|
|
|
+ }).on('start',(req,res) => {
|
|
|
|
+ var bcontext = commonGetBundle(req,res,1);
|
|
|
|
+ if(bcontext == null) { return; }
|
|
|
|
+ bcontext.start();
|
|
|
|
+ }).on('reload',(req,res) => {
|
|
|
|
+ var bcontext = commonGetBundle(req,res,1);
|
|
|
|
+ if(bcontext == null) { return; }
|
|
|
|
+ var modulePath = bcontext.modulePath;
|
|
|
|
+ context.manager.unregister(bcontext);
|
|
|
|
+ context.manager.register({id:bcontext.id, name:bcontext.name, bundle:bcontext.modulePath});
|
|
|
|
+ }).on('unload',(req,res) => {
|
|
|
|
+ var bcontext = commonGetBundle(req,res,1);
|
|
|
|
+ if(bcontext == null) { return; }
|
|
|
|
+ context.manager.unregister(bcontext);
|
|
|
|
+ }).on('load',(req,res) => {
|
|
|
|
+ if(req.args.length < 1) {
|
|
|
|
+ res.write("Not enough parameters\n");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ res.write("Loading module from: " + process.env.PWD +"\n");
|
|
|
|
+ context.manager.load(process.env.PWD + "/" + req.args[0]);
|
|
//context.manager.register({name:args[1], bundle:path.resolve(path.join(process.env.PWD, args[2]))});
|
|
//context.manager.register({name:args[1], bundle:path.resolve(path.join(process.env.PWD, args[2]))});
|
|
- });
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|