Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

some reorganizing to prepare for NPM packaging

  • Loading branch information...
commit aede2abe81071380153377c3bb0090047a34b822 1 parent 0aec79c
chris authored
Showing with 35 additions and 15 deletions.
  1. +3 −0  .gitignore
  2. 0  bin/{file2classes.sh → file2classes}
  3. +5 −3 kernel/kernel.js → bin/kernel
  4. 0  bin/{stdin2classes.sh → stdin2classes}
  5. +1 −1  {kernel/lib → kernel-lib}/server.js
  6. +7 −3 {kernel/lib → kernel-lib}/services.js
  7. 0  {kernel/lib → kernel-lib}/services/abstract.js
  8. +9 −7 {kernel/lib → kernel-lib}/services/mysql.js
  9. 0  {kernel/lib → kernel-lib}/services/nginx.js
  10. 0  {kernel/lib → kernel-lib}/sites.js
  11. 0  {kernel/www → kernel-www}/app.js
  12. 0  {kernel/www → kernel-www}/app/controller/Log.js
  13. 0  {kernel/www → kernel-www}/app/controller/Services.js
  14. 0  {kernel/www → kernel-www}/app/controller/Sites.js
  15. 0  {kernel/www → kernel-www}/app/controller/Viewport.js
  16. 0  {kernel/www → kernel-www}/app/model/LogEntry.js
  17. 0  {kernel/www → kernel-www}/app/model/Service.js
  18. 0  {kernel/www → kernel-www}/app/model/Site.js
  19. 0  {kernel/www → kernel-www}/app/store/Log.js
  20. 0  {kernel/www → kernel-www}/app/store/Services.js
  21. 0  {kernel/www → kernel-www}/app/store/Sites.js
  22. 0  {kernel/www → kernel-www}/app/view/Viewport.js
  23. 0  {kernel/www → kernel-www}/app/view/log/Grid.js
  24. 0  {kernel/www → kernel-www}/app/view/services/Grid.js
  25. +2 −0  {kernel/www → kernel-www}/app/view/site/CreateForm.js
  26. 0  {kernel/www → kernel-www}/app/view/site/Grid.js
  27. 0  {kernel/www → kernel-www}/app/view/site/Menu.js
  28. 0  {kernel/www → kernel-www}/index.html
  29. 0  {kernel → }/kernel.config.json.SAMPLE
  30. +8 −1 package.json
3  .gitignore
View
@@ -0,0 +1,3 @@
+node_modules
+services
+kernel.config.json
0  bin/file2classes.sh → bin/file2classes
View
File renamed without changes
8 kernel/kernel.js → bin/kernel
View
@@ -1,3 +1,5 @@
+#!/usr/bin/env node
+
// requirements
var _ = require('underscore')
,util = require('util')
@@ -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);
0  bin/stdin2classes.sh → bin/stdin2classes
View
File renamed without changes
2  kernel/lib/server.js → kernel-lib/server.js
View
@@ -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
}
10 kernel/lib/services.js → kernel-lib/services.js
View
@@ -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);
0  kernel/lib/services/abstract.js → kernel-lib/services/abstract.js
View
File renamed without changes
16 kernel/lib/services/mysql.js → kernel-lib/services/mysql.js
View
@@ -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);
@@ -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))
@@ -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)
{
@@ -237,6 +238,7 @@ exports.mysql.prototype.connectClient = function() {
}
console.log(me.name+': mysql client connected');
});
+*/
};
exports.mysql.prototype.onSiteCreated = function(siteData) {
0  kernel/lib/services/nginx.js → kernel-lib/services/nginx.js
View
File renamed without changes
0  kernel/lib/sites.js → kernel-lib/sites.js
View
File renamed without changes
0  kernel/www/app.js → kernel-www/app.js
View
File renamed without changes
0  kernel/www/app/controller/Log.js → kernel-www/app/controller/Log.js
View
File renamed without changes
0  kernel/www/app/controller/Services.js → kernel-www/app/controller/Services.js
View
File renamed without changes
0  kernel/www/app/controller/Sites.js → kernel-www/app/controller/Sites.js
View
File renamed without changes
0  kernel/www/app/controller/Viewport.js → kernel-www/app/controller/Viewport.js
View
File renamed without changes
0  kernel/www/app/model/LogEntry.js → kernel-www/app/model/LogEntry.js
View
File renamed without changes
0  kernel/www/app/model/Service.js → kernel-www/app/model/Service.js
View
File renamed without changes
0  kernel/www/app/model/Site.js → kernel-www/app/model/Site.js
View
File renamed without changes
0  kernel/www/app/store/Log.js → kernel-www/app/store/Log.js
View
File renamed without changes
0  kernel/www/app/store/Services.js → kernel-www/app/store/Services.js
View
File renamed without changes
0  kernel/www/app/store/Sites.js → kernel-www/app/store/Sites.js
View
File renamed without changes
0  kernel/www/app/view/Viewport.js → kernel-www/app/view/Viewport.js
View
File renamed without changes
0  kernel/www/app/view/log/Grid.js → kernel-www/app/view/log/Grid.js
View
File renamed without changes
0  kernel/www/app/view/services/Grid.js → kernel-www/app/view/services/Grid.js
View
File renamed without changes
2  kernel/www/app/view/site/CreateForm.js → kernel-www/app/view/site/CreateForm.js
View
@@ -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: {
@@ -94,6 +95,7 @@ Ext.define('eMan.view.site.CreateForm', {
if(hostField.getValue())
{
+ console.log('isHidden?', !keyField.isHidden());
if(!keyField.isHidden())
{
keyField.show();
0  kernel/www/app/view/site/Grid.js → kernel-www/app/view/site/Grid.js
View
File renamed without changes
0  kernel/www/app/view/site/Menu.js → kernel-www/app/view/site/Menu.js
View
File renamed without changes
0  kernel/www/index.html → kernel-www/index.html
View
File renamed without changes
0  kernel/kernel.config.json.SAMPLE → kernel.config.json.SAMPLE
View
File renamed without changes
9 package.json
View
@@ -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"
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.