Skip to content

Commit

Permalink
some reorganizing to prepare for NPM packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
chris committed Feb 28, 2012
1 parent 0aec79c commit aede2ab
Show file tree
Hide file tree
Showing 30 changed files with 35 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
services
kernel.config.json
File renamed without changes.
8 changes: 5 additions & 3 deletions kernel/kernel.js → bin/kernel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env node

// requirements
var _ = require('underscore')
,util = require('util')
Expand All @@ -8,11 +10,11 @@ var _ = require('underscore')
var CONFIG = JSON.parse(fs.readFileSync('kernel.config.json'));

// load core modules
var eSites = require('./lib/sites.js').createSites(CONFIG.sites);
var eServices = require('./lib/services.js').createServices(eSites, CONFIG.services);
var eSites = require('../kernel-lib/sites.js').createSites(CONFIG.sites);
var eServices = require('../kernel-lib/services.js').createServices(eSites, CONFIG.services);

// instantiate management server
var eManagementServer = require('./lib/server.js').createServer({
var eManagementServer = require('../kernel-lib/server.js').createServer({
sites: eSites
,services: eServices
}, CONFIG.server);
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion kernel/lib/server.js → kernel-lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ exports.server = function(paths, options) {
me.options = options || {};
me.options.host = me.options.host || '0.0.0.0';
me.options.port = me.options.port || 1337;
me.options.staticDir = me.options.staticDir || './www';
me.options.staticDir = me.options.staticDir || './kernel-www';

// initialize state
}
Expand Down
10 changes: 7 additions & 3 deletions kernel/lib/services.js → kernel-lib/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ exports.ServicesController = function(sites, options) {
// initialize options and apply defaults
me.options = options || {};
me.options.plugins = me.options.plugins || {};
me.options.logsDir = me.options.logsDir || '/emergence/logs';
me.options.configDir = me.options.configDir || '/emergence/kernel/etc';
me.options.runDir = me.options.runDir || '/emergence/kernel/run';
me.options.servicesDir = me.options.servicesDir || '/emergence/services';
me.options.logsDir = me.options.logsDir || me.options.servicesDir+'/logs';
me.options.configDir = me.options.configDir || me.options.servicesDir+'/etc';
me.options.runDir = me.options.runDir || me.options.servicesDir+'/run';

// create required directories
if(!path.existsSync(me.options.servicesDir))
fs.mkdirSync(me.options.servicesDir, 0775);

if(!path.existsSync(me.options.logsDir))
fs.mkdirSync(me.options.logsDir, 0775);

Expand Down
File renamed without changes.
16 changes: 9 additions & 7 deletions kernel/lib/services/mysql.js → kernel-lib/services/mysql.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ var _ = require('underscore')
,path = require('path')
,util = require('util')
,spawn = require('child_process').spawn
,exec = require('child_process').exec
,MysqlClient = require('mysql').Client;
,exec = require('child_process').exec;

exports.createService = function(name, controller, options) {
return new exports.mysql(name, controller, options);
Expand Down Expand Up @@ -36,11 +35,11 @@ exports.mysql = function(name, controller, options) {
}

// instantiate MySQL client
me.client = new MysqlClient();
//me.client.database = 'information_schema';
me.client.user = me.options.managerUser;
me.client.password = me.options.managerPassword;
me.client.port = me.options.socketPath;
me.client = require('mysql').createClient({
port: me.options.socketPath
,user: me.options.managerUser
,password: me.options.managerPassword
});

// check for existing mysqld process
if(path.existsSync(me.options.pidPath))
Expand Down Expand Up @@ -228,6 +227,8 @@ exports.mysql.prototype.makeConfig = function() {
exports.mysql.prototype.connectClient = function() {
var me = this;

// new mysql client does this automatically now... this routine will probably be removed soon
/*
me.client.connect(function(error, results) {
if(error)
{
Expand All @@ -237,6 +238,7 @@ exports.mysql.prototype.connectClient = function() {
}
console.log(me.name+': mysql client connected');
});
*/
};

exports.mysql.prototype.onSiteCreated = function(siteData) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ Ext.define('eMan.view.site.CreateForm', {
fields: ['hostname', 'key']
,data: [
{hostname: 'skeleton.mics.me', key: 'm6Q136L0mDsWmShJ'}
,{hostname: 'skeleton.emr.ge', key: '8U6kydil36bl3vlJ'}
]
})
,listeners: {
Expand All @@ -94,6 +95,7 @@ Ext.define('eMan.view.site.CreateForm', {

if(hostField.getValue())
{
console.log('isHidden?', !keyField.isHidden());
if(!keyField.isHidden())
{
keyField.show();
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
{
"name": "emergence",
"preferGlobal": "true",
"version": "0.0.1",
"license": "MIT",
"dependencies": {
"underscore": "1.3.1"
"underscore": "1.3.x",
"mysql": "0.9.x",
"node-static": "0.5.x"
},
"bin": {
"emergence-kernel": "./bin/kernel"
}
}

0 comments on commit aede2ab

Please sign in to comment.