Permalink
Browse files

Say hello to Protos.

  • Loading branch information...
1 parent 53faa63 commit bb48659f35bc9878510d320ca6a21d511a05f97d @mendezcode mendezcode committed Mar 19, 2012
Showing with 380 additions and 380 deletions.
  1. +25 −25 README.md
  2. +18 −18 bin/{corejs → protos}
  3. +8 −8 drivers/mongodb.js
  4. +7 −7 drivers/mysql.js
  5. +2 −2 engines/coffeekup.js
  6. +2 −2 engines/dot.js
  7. +1 −1 engines/eco.js
  8. +2 −2 engines/ejs.js
  9. +1 −1 engines/haml.js
  10. +1 −1 engines/hamlcoffee.js
  11. +1 −1 engines/handlebars.js
  12. +1 −1 engines/hogan.js
  13. +3 −3 engines/jade.js
  14. +1 −1 engines/jazz.js
  15. +1 −1 engines/jqtpl.js
  16. +2 −2 engines/jshtml.js
  17. +1 −1 engines/kernel.js
  18. +2 −2 engines/liquor.js
  19. +2 −2 engines/swig.js
  20. +1 −1 engines/whiskers.js
  21. +1 −1 jshint.json
  22. +35 −35 lib/application.js
  23. +3 −3 lib/controller.js
  24. +1 −1 lib/driver.js
  25. +1 −1 lib/engine.js
  26. +3 −3 lib/model.js
  27. +47 −47 lib/{corejs.js → protos.js}
  28. +4 −4 lib/response.js
  29. +1 −1 lib/support/inflect.js
  30. +6 −6 lib/utility.js
  31. +2 −2 middleware/asset_compiler/asset-manager.js
  32. +1 −1 middleware/asset_compiler/asset-minifier.js
  33. +3 −3 middleware/asset_compiler/asset_compiler.js
  34. +2 −2 middleware/aws.js
  35. +2 −2 middleware/bcrypt.js
  36. +2 −2 middleware/body_parser/body_parser.js
  37. +2 −2 middleware/body_parser/controller.js
  38. +2 −2 middleware/body_parser/file_manager.js
  39. +1 −1 middleware/body_parser/request.js
  40. +2 −2 middleware/cookie_parser/application.js
  41. +1 −1 middleware/cookie_parser/cookie_parser.js
  42. +1 −1 middleware/cookie_parser/request.js
  43. +3 −3 middleware/cookie_parser/response.js
  44. +2 −2 middleware/csrf/csrf.js
  45. +1 −1 middleware/csrf/request.js
  46. +3 −3 middleware/logger/logger.js
  47. +1 −1 middleware/logger/transport-console.js
  48. +1 −1 middleware/logger/transport-file.js
  49. +2 −2 middleware/logger/transport-mongodb.js
  50. +3 −3 middleware/logger/transport-redis.js
  51. +1 −1 middleware/mailer.js
  52. +2 −2 middleware/markdown.js
  53. +1 −1 middleware/production_url.js
  54. +1 −1 middleware/redirect.js
  55. +1 −1 middleware/response_cache/response.js
  56. +1 −1 middleware/response_cache/response_cache.js
  57. +1 −1 middleware/session/request.js
  58. +1 −1 middleware/session/response.js
  59. +3 −3 middleware/session/session.js
  60. +2 −2 middleware/shortcode.js
  61. +3 −3 middleware/socket_io.js
  62. +3 −3 middleware/static_server/application.js
  63. +1 −1 middleware/static_server/response.js
  64. +2 −2 middleware/static_server/static_server.js
  65. +7 −7 package.json
  66. +1 −1 skeleton/app.js
  67. +1 −1 skeleton/app/helpers/main.js
  68. +1 −1 skeleton/app/views/main/main-index.html
  69. +3 −3 skeleton/boot.js
  70. +1 −1 skeleton/config/base.js
  71. +1 −1 skeleton/package.json
  72. +2 −2 skeleton/scripts/automate.js
  73. +7 −7 storages/mongodb.js
  74. +5 −5 storages/redis.js
  75. +31 −31 test/command.js
  76. +2 −2 test/drivers/mongodb.js
  77. +2 −2 test/drivers/mysql.js
  78. +9 −9 test/fixtures/bootstrap.js
  79. +1 −1 test/fixtures/storage-batch.js
  80. +1 −1 test/fixtures/test.skeleton/app/views/main/main-index.html
  81. +2 −2 test/integration/model-relationships.js
  82. +3 −3 test/integration/models.js
  83. +1 −1 test/middleware/asset_compiler.js
  84. +5 −5 test/middleware/redirect.js
  85. +1 −1 test/middleware/session-unit.js
  86. +1 −1 test/middleware/socket_io.js
  87. +1 −1 test/middleware/static_server.js
  88. +1 −1 test/storages/mongodb.js
  89. +1 −1 test/storages/redis.js
  90. +16 −16 test/unit/application.js
  91. +1 −1 test/unit/controller.js
  92. +17 −17 test/unit/{corejs.js → protos.js}
  93. +9 −9 test/unit/utility.js
  94. +1 −1 tools/scripts/install.sh
  95. +1 −1 tools/scripts/uninstall.sh
View
@@ -1,6 +1,6 @@
-# CoreJS [![Build Status](https://secure.travis-ci.org/corejs/corejs.png)](http://travis-ci.org/corejs/corejs)
+# Protos [![Build Status](https://secure.travis-ci.org/protos/protos.png)](http://travis-ci.org/protos/protos)
-CoreJS is an open source Web Application Development framework, focused on high performance, integration, ease of
+Protos is an open source Web Application Development framework, focused on high performance, integration, ease of
deployment, maintainability and security.
It aims to integrate several open source packages and combine their power & functionality, to bring a common set of
@@ -33,7 +33,7 @@ utilities and functionality to all applications, reducing their dependencies.
## Development Stack
-CoreJS provides a set of APIs that allow the framework to be extended in all sorts of ways. Use it either to contribute
+Protos provides a set of APIs that allow the framework to be extended in all sorts of ways. Use it either to contribute
new functionality & components to it, or to enhance it with the needs of your team/organization.
### Drivers
@@ -64,38 +64,38 @@ means you can use a database backend for development, and another for production
Here's the Development Stack the framework provides, in a nutshell:
-- **Drivers**   _[MongoDB](https://github.com/corejs/corejs/blob/master/drivers/mongodb.js), [MySQL](https://github.com/corejs/corejs/blob/master/drivers/mysql.js)_
-- **Storages**   _[MongoDB](https://github.com/corejs/corejs/blob/master/storages/mongodb.js), [Redis](https://github.com/corejs/corejs/blob/master/storages/redis.js)_
+- **Drivers**   _[MongoDB](https://github.com/protos/protos/blob/master/drivers/mongodb.js), [MySQL](https://github.com/protos/protos/blob/master/drivers/mysql.js)_
+- **Storages**   _[MongoDB](https://github.com/protos/protos/blob/master/storages/mongodb.js), [Redis](https://github.com/protos/protos/blob/master/storages/redis.js)_
- **Models**   _Use any Driver supported_
- **Query Cache (Drivers)**   _Use any Storage supported_
- **Query Cache (Models)**   _Handled by underlying Driver_
- **Caching**   _Use any Storage supported_
- **Sessions**   _Use any Storage supported_
- **Response Caching**   _Use any Storage supported_
-- **Logging**   _[MongoDB](https://github.com/corejs/corejs/blob/master/middleware/logger/transport-mongodb.js),
-[Redis](https://github.com/corejs/corejs/blob/master/middleware/logger/transport-redis.js) (additionally
-[File](https://github.com/corejs/corejs/blob/master/middleware/logger/transport-file.js), [Console](https://github.com/corejs/corejs/blob/master/middleware/logger/transport-console.js) via Middleware)_
+- **Logging**   _[MongoDB](https://github.com/protos/protos/blob/master/middleware/logger/transport-mongodb.js),
+[Redis](https://github.com/protos/protos/blob/master/middleware/logger/transport-redis.js) (additionally
+[File](https://github.com/protos/protos/blob/master/middleware/logger/transport-file.js), [Console](https://github.com/protos/protos/blob/master/middleware/logger/transport-console.js) via Middleware)_
## Middleware
The Application's functionality can be extended with the following (ready to use) components:
- [asset_compiler](/middleware#asset_compiler)   *Compiles LESS, Stylus and CoffeeScript, Supports Watch/Compress/Minify.*
-- [aws](http://corejs.org/middleware#aws)   *Amazon Web Services support. Provides clients to all services (ES3, EC2, etc)*
-- [bcrypt](http://corejs.org/middleware#bcrypt)   *Blowfish encryption support*
-- [body_parser](http://corejs.org/middleware#body_parser)   *Parse request bodies and file uploads in POST/PUT requests*
-- [cookie_parser](http://corejs.org/middleware#cookie_parser)   *Parse cookie headers, Integrates with Sessions & Auth*
-- [csrf](http://corejs.org/middleware#csrf)   *Cross-Site Request Forgery protection, integrates with Controller Validation*
-- [logger](http://corejs.org/middleware#logger)   *Application/Request logger, supporting several transports such as MongoDB, Redis, File & console*
-- [mailer](http://corejs.org/middleware#mailer)   *Send email using SMTP, Amazon SES or Sendmail*
-- [ markdown ](http://corejs.org/middleware#markdown)   *Parse markdown syntax*
-- [production_url](http://corejs.org/middleware#production_url)   *Remove port number from application-generated URLs*
-- [redirect](http://corejs.org/middleware#redirect)   *Quick redirection support (useful for "maintenance mode")*
-- [response_cache](http://corejs.org/middleware#response_cache)   *Response caching into supported Storages (Redis, MongoDB, etc)*
-- [session](http://corejs.org/middleware#session)   *Full session support with Storages, guest sessions and regeneration*
-- [shortcode](http://corejs.org/middleware#shortcode)   *Allows custom content to be inserted into views using shortcodes*
-- [socket_io](http://corejs.org/middleware#socket_io)   *Socket.io Integration with applications*
-- [static_server](http://corejs.org/middleware#static_server)   *Complete Static Server solution, supporting Ranges, Conditional GETs, etc.*
+- [aws](http://protos.org/middleware#aws)   *Amazon Web Services support. Provides clients to all services (ES3, EC2, etc)*
+- [bcrypt](http://protos.org/middleware#bcrypt)   *Blowfish encryption support*
+- [body_parser](http://protos.org/middleware#body_parser)   *Parse request bodies and file uploads in POST/PUT requests*
+- [cookie_parser](http://protos.org/middleware#cookie_parser)   *Parse cookie headers, Integrates with Sessions & Auth*
+- [csrf](http://protos.org/middleware#csrf)   *Cross-Site Request Forgery protection, integrates with Controller Validation*
+- [logger](http://protos.org/middleware#logger)   *Application/Request logger, supporting several transports such as MongoDB, Redis, File & console*
+- [mailer](http://protos.org/middleware#mailer)   *Send email using SMTP, Amazon SES or Sendmail*
+- [ markdown ](http://protos.org/middleware#markdown)   *Parse markdown syntax*
+- [production_url](http://protos.org/middleware#production_url)   *Remove port number from application-generated URLs*
+- [redirect](http://protos.org/middleware#redirect)   *Quick redirection support (useful for "maintenance mode")*
+- [response_cache](http://protos.org/middleware#response_cache)   *Response caching into supported Storages (Redis, MongoDB, etc)*
+- [session](http://protos.org/middleware#session)   *Full session support with Storages, guest sessions and regeneration*
+- [shortcode](http://protos.org/middleware#shortcode)   *Allows custom content to be inserted into views using shortcodes*
+- [socket_io](http://protos.org/middleware#socket_io)   *Socket.io Integration with applications*
+- [static_server](http://protos.org/middleware#static_server)   *Complete Static Server solution, supporting Ranges, Conditional GETs, etc.*
## Template Engines
@@ -152,7 +152,7 @@ THE SOFTWARE.
## Resources
-- Visit the official [corejs.org](http://corejs.org) website.
+- Visit the official [protos.org](http://protos.org) website.
- Follow [@derdesign](http://twitter.com/derdesign) on Twitter for updates.
-- Report issues on the [github issues](https://github.com/corejs/corejs/issues) page.
+- Report issues on the [github issues](https://github.com/protos/protos/issues) page.
View
@@ -7,11 +7,11 @@ var _ = require('underscore'),
regex = require('../lib/regex.js'),
pathModule = require('path'),
inflect = require('../lib/support/inflect.js'),
- CoreJS = require('../lib/corejs.js'),
+ Protos = require('../lib/protos.js'),
Multi = require('multi'),
CommandLine = require('../lib/command.js');
-var corejs;
+var protos;
var origPath;
@@ -270,7 +270,7 @@ var commands = {
switch (action) {
case 'start':
case 'stop':
- var cmd = 'node ' + CoreJS.path + '/tools/' + action + '-inspector';
+ var cmd = 'node ' + Protos.path + '/tools/' + action + '-inspector';
cp.exec(cmd, function(err, stdout, stderr) {
if (err) throw err;
else console.exit(stdout.trim());
@@ -432,20 +432,20 @@ function createApplication(data, libs) {
if (err) console.exit(stderr);
else {
- // Replace corejs directory
+ // Replace protos directory
var bootFile = util.format('./%s/boot.js', app),
boot = fs.readFileSync(bootFile, 'utf-8').toString();
- var repl, isGlobal = pathModule.existsSync('/usr/local/lib/node/corejs');
+ var repl, isGlobal = pathModule.existsSync('/usr/local/lib/node/protos');
if (isGlobal) {
- // We can use `require('corejs')` safely
- repl = 'corejs';
+ // We can use `require('protos')` safely
+ repl = 'protos';
} else {
// We need to use the global path instead
repl = masterPath;
}
- boot = boot.replace("var CoreJS = require('../');", util.format("var CoreJS = require('%s');", repl));
+ boot = boot.replace("var Protos = require('../');", util.format("var Protos = require('%s');", repl));
if (data.domain) {
boot = boot.replace("host: 'localhost',", util.format("host: '%s',", data.domain));
@@ -691,7 +691,7 @@ function createView(app, controller, view, partial) {
file = file.replace('__static-', '');
if (controller == 'main' && this.mustache == true) {
- tpl = "\n<p>Welcome to {{corejs.className}}</p>\n";
+ tpl = "\n<p>Welcome to {{protos.className}}</p>\n";
fs.unlinkSync(app + '/app/views/main/main-index.html');
} else if (typeof this.ext === 'undefined') {
tpl = util.format("\n<p>%s Controller</p>\n", inflect.camelize(controller));
@@ -757,7 +757,7 @@ function getLibs(args) {
libs.css[lib].id = lib;
libs.css[lib].type = 'css';
} else {
- console.exit("CSS Framework not bundled by CoreJS: " + lib);
+ console.exit("CSS Framework not bundled by Protos: " + lib);
}
});
@@ -766,7 +766,7 @@ function getLibs(args) {
libs.javascript[lib].id = lib;
libs.javascript[lib].type = 'js';
} else {
- console.exit("JavaScript Library not bundled by CoreJS: " + lib);
+ console.exit("JavaScript Library not bundled by Protos: " + lib);
}
});
return libs;
@@ -799,7 +799,7 @@ function validateApp(data, noexit) {
this.printHelp();
process.exit();
} else {
- console.exit(util.format("corejs [%s] only works within the application path.", this.context));
+ console.exit(util.format("protos [%s] only works within the application path.", this.context));
}
} else {
return false;
@@ -843,7 +843,7 @@ bouncy(function(req, bounce) { var host, port;\
host = req.headers.host.split(':').shift();\
if (port = hosts[host]) bounce(port);\
else req.socket.destroy(); \
-}).listen(%s);", CoreJS.path, JSON.stringify(hosts), data.port);
+}).listen(%s);", Protos.path, JSON.stringify(hosts), data.port);
code = code.replace(/"/g, '\\"');
// console.exit(code);
@@ -873,17 +873,17 @@ bouncy(function(req, bounce) { var host, port;\
var cli = new CommandLine(commands);
cli.help.before = "\
-Usage: corejs [action] [arguments]\n\n\
+Usage: protos [action] [arguments]\n\n\
Actions: [create, server, deploy, fetch, inspector] [controller, helper, model, view, partial, static]\n";
cli.help.after = "\n\
Example:\n\n\
- corejs create myapp --css bootstrap --js jquery backbone --model users --controller admin user\n\n\
+ protos create myapp --css bootstrap --js jquery backbone --model users --controller admin user\n\n\
Generate an application skeleton in the current directory, with the assets,\n\
models and controllers specified in the command.\n\n\
- corejs server myapp --fork --logpath server.log\n\n\
+ protos server myapp --fork --logpath server.log\n\n\
Starts the application's server and forks a new node process.\n\n\
- For documentation, refer to http://corejs.org\n\n\
- corejs@" + CoreJS.version + " " + CoreJS.path;
+ For documentation, refer to http://protos.org\n\n\
+ protos@" + Protos.version + " " + Protos.path;
cli.parse();
View
@@ -22,7 +22,7 @@ function MongoDB(app, config) {
var self = this;
- config = corejs.extend({
+ config = protos.extend({
host: 'localhost',
port: 27017,
database: 'default',
@@ -34,15 +34,15 @@ function MongoDB(app, config) {
this.app = app;
this.config = config;
- corejs.async(app); // Register async queue
+ protos.async(app); // Register async queue
var reportError = function(err) {
app.log(util.format("MongoDB [%s:%s] %s", config.host, config.port, err.code));
self.client = err;
- corejs.done(app); // Flush async queue
+ protos.done(app); // Flush async queue
}
- corejs.util.checkPort(config.port, function(err) {
+ protos.util.checkPort(config.port, function(err) {
if (err) {
reportError(err);
@@ -61,7 +61,7 @@ function MongoDB(app, config) {
// Set storage
if (typeof config.storage == 'string') {
self.storage = app._getResource('storages/' + config.storage);
- } else if (config.storage instanceof corejs.lib.storage) {
+ } else if (config.storage instanceof protos.lib.storage) {
self.storage = config.storage;
}
@@ -74,7 +74,7 @@ function MongoDB(app, config) {
Collection.prototype.__count = Collection.prototype.count;
}
- corejs.done(app); // Flush async queue
+ protos.done(app); // Flush async queue
}
});
@@ -83,10 +83,10 @@ function MongoDB(app, config) {
});
// Only set important properties enumerable
- corejs.util.onlySetEnumerable(this, ['className', 'db']);
+ protos.util.onlySetEnumerable(this, ['className', 'db']);
}
-util.inherits(MongoDB, corejs.lib.driver);
+util.inherits(MongoDB, protos.lib.driver);
/**
Inserts values into a collection
View
@@ -29,11 +29,11 @@ function MySQL(app, config) {
this.app = app;
this.config = config;
- corejs.async(app); // Register async queue
+ protos.async(app); // Register async queue
- corejs.util.checkPort(config.port, function(err) {
+ protos.util.checkPort(config.port, function(err) {
- corejs.done(app); // Flush async queue
+ protos.done(app); // Flush async queue
if (err) {
app.log(util.format("MySQL [%s:%s] %s", config.host, config.port, err.code));
@@ -45,7 +45,7 @@ function MySQL(app, config) {
// Assign storage
if (typeof config.storage == 'string') {
self.storage = app._getResource('storages/' + config.storage);
- } else if (config.storage instanceof corejs.lib.storage) {
+ } else if (config.storage instanceof protos.lib.storage) {
self.storage = config.storage;
}
@@ -63,11 +63,11 @@ function MySQL(app, config) {
});
// Only set important properties enumerable
- corejs.util.onlySetEnumerable(this, ['className', 'db']);
+ protos.util.onlySetEnumerable(this, ['className', 'db']);
}
-util.inherits(MySQL, corejs.lib.driver);
+util.inherits(MySQL, protos.lib.driver);
/**
Queries rows from a table
@@ -276,7 +276,7 @@ MySQL.prototype.insertInto = function(o, callback) {
values = o.values || {};
if (util.isArray(values)) {
- params = corejs.util.strRepeat('?, ', values.length).replace(regex.endingComma, '');
+ params = protos.util.strRepeat('?, ', values.length).replace(regex.endingComma, '');
args = ["INSERT INTO " + table + " VALUES(" + params + ")", values];
} else {
query = "INSERT INTO " + table + " SET ";
View
@@ -11,7 +11,7 @@ function CoffeeKup(app) {
var opts = (app.config.engines && app.config.engines.coffeekup) || {};
- this.options = corejs.extend({
+ this.options = protos.extend({
locals: true,
hardcode: {}
}, opts);
@@ -21,7 +21,7 @@ function CoffeeKup(app) {
this.extensions = ['coffeekup', 'ck.html'];
}
-util.inherits(CoffeeKup, corejs.lib.engine);
+util.inherits(CoffeeKup, protos.lib.engine);
CoffeeKup.prototype.render = function(data) {
data = this.app.applyFilters('coffeekup_template', data);
View
@@ -20,11 +20,11 @@ function Dot(app) {
var opts = (app.config.engines && app.config.engines.dot) || {};
- dot.templateSettings = corejs.extend(dot.templateSettings, opts);
+ dot.templateSettings = protos.extend(dot.templateSettings, opts);
}
-util.inherits(Dot, corejs.lib.engine);
+util.inherits(Dot, protos.lib.engine);
Dot.prototype.render = function(data) {
data = this.app.applyFilters('dot_template', data);
View
@@ -13,7 +13,7 @@ function Eco(app) {
this.extensions = ['eco', 'eco.html'];
}
-util.inherits(Eco, corejs.lib.engine);
+util.inherits(Eco, protos.lib.engine);
Eco.prototype.render = function(data) {
data = this.app.applyFilters('eco_template', data);
View
@@ -11,14 +11,14 @@ function EJS(app) {
var opts = (app.config.engines && app.config.engines.ejs) || {};
- this.options = corejs.extend({open: '<%', close: '%>'}, opts);
+ this.options = protos.extend({open: '<%', close: '%>'}, opts);
this.module = ejs;
this.multiPart = true;
this.extensions = ['ejs', 'ejs.html'];
}
-util.inherits(EJS, corejs.lib.engine);
+util.inherits(EJS, protos.lib.engine);
EJS.prototype.render = function(data) {
data = this.app.applyFilters('ejs_template', data);
View
@@ -13,7 +13,7 @@ function Haml(app) {
this.extensions = ['haml', 'haml.html'];
}
-util.inherits(Haml, corejs.lib.engine);
+util.inherits(Haml, protos.lib.engine);
Haml.prototype.render = function(data) {
data = this.app.applyFilters('haml_template', data);
View
@@ -13,7 +13,7 @@ function HamlCoffee(app) {
this.extensions = ['hamlc', 'haml.coffee', 'hamlc.html'];
}
-util.inherits(HamlCoffee, corejs.lib.engine);
+util.inherits(HamlCoffee, protos.lib.engine);
HamlCoffee.prototype.render = function(data) {
data = this.app.applyFilters('hamlcoffee_template', data);
View
@@ -16,7 +16,7 @@ function Handlebars(app) {
partials = {partials: app.views.partials};
}
-util.inherits(Handlebars, corejs.lib.engine);
+util.inherits(Handlebars, protos.lib.engine);
Handlebars.prototype.render = function(data) {
data = this.app.applyFilters('handlebars_template', data);
Oops, something went wrong.

0 comments on commit bb48659

Please sign in to comment.