Browse files

Merge branch 'master' of github.com:mde/geddy

  • Loading branch information...
2 parents c6d76fb + 2bda327 commit 60e2ef5ade82d45dc475a9244d82a63f34851233 mde committed Aug 25, 2012
View
3 lib/base_config.js
@@ -44,7 +44,8 @@ config = {
defaultLocale: 'en-us'
, loadPaths: [path.normalize(cwd + '/config/locales')]
}
-// Default to no SSL setup
+// Default to no SSL and SPDY setup
+, spdy: null
, ssl: null
// Model defaults
, model: {
View
32 lib/cluster/worker.js
@@ -1,4 +1,5 @@
var fs = require('fs')
+ , utils = require('utilities')
, dispatch = require('./worker_dispatch')
, Logger = require('./worker_logger').Logger
, Worker;
@@ -32,32 +33,51 @@ Worker.prototype = new (function () {
};
this.createServer = function () {
- var ssl = this.config.ssl;
+ var ssl = this.config.ssl
+ , spdy = this.config.spdy;
+
+ // If SSL options were given
if (ssl) {
if (ssl.cert && ssl.key) {
this.server = require('https').createServer({
- key: fs.readFileSync(ssl.key)
- , cert: fs.readFileSync(ssl.cert)
+ key: fs.readFileSync(ssl.key)
+ , cert: fs.readFileSync(ssl.cert)
});
}
else {
this.log.error('Cannot start server using SSL.' +
'Missing certificate or private key.');
}
}
+ // If SPDY options were given
+ else if (spdy) {
+ if (spdy.cert && spdy.key) {
+ this.server = utils.file.requireLocal('spdy').createServer({
+ key: fs.readFileSync(spdy.key)
+ , cert: fs.readFileSync(spdy.cert)
+ });
+ }
+ else {
+ this.log.error('Cannot start server using SPDY.' +
+ 'Missing certificate or private key.');
+ }
+ }
+ // If neither SSL or SPDY options were given use HTTP
else {
this.server = require('http').createServer();
}
};
this.startServer = function () {
if (this.config) {
- var hostname = this.config.hostname || null;
+ var hostname = this.config.hostname || null
+ , ssl = this.config.ssl ? ' (SSL)' : ''
+ , spdy = this.config.spdy ? '(SPDY)' : '';
+
this.server.listen(parseInt(this.config.port, 10), hostname);
this.log.info('Server worker running in ' + this.config.environment +
- ' on port ' + this.config.port + (this.config.ssl ? ' (SSL)' : '') +
- ' with a PID of: ' + process.pid);
+ ' on port ' + this.config.port + ssl + spdy + ' with a PID of: ' + process.pid);
this.log.debug('LOGGING STARTED ============================================');
this.log.debug('============================================================');
}
View
2 lib/model/adapters/mongo.js
@@ -156,7 +156,7 @@ var Mongo = function (config) {
}
// if we don't already have the to do item, save a new one
else {
- instance.saved = true;
+ cleanInstance.saved = instance.saved = true;
self.collection.save(cleanInstance, function(err, docs){
return callback(err, instance);
});
View
10 templates/Jakefile
@@ -4,7 +4,7 @@ require('../lib/geddy')
// Dependencies
var fs = require('fs')
, path = require('path')
- , utils = require('../node_modules/utilities')
+ , utils = require('utilities')
, adapter = require('../lib/template/adapters').Adapter
, templato = new (require('../deps/templato'));
@@ -370,8 +370,8 @@ namespace('gen', function () {
// Create default layout if one doesn't exist
// Hack: There should be a better way to detect if a application layout exists
- if(!utils.compat.existsSync(appLayoutPath + '.html.ejs') && !utils.compat.existsSync(appLayoutPath + '.html.jade') &&
- !utils.compat.existsSync(appLayoutPath + '.html.hbs') && !utils.compat.existsSync(appLayoutPath + '.html.ms')) {
+ if(!utils.file.existsSync(appLayoutPath + '.html.ejs') && !utils.file.existsSync(appLayoutPath + '.html.jade') &&
+ !utils.file.existsSync(appLayoutPath + '.html.hbs') && !utils.file.existsSync(appLayoutPath + '.html.ms')) {
// Copy template layout file to apps application layout file
jake.cpR(path.join(templateViewDir, 'layout' + ext), appLayoutPath + ext);
}
@@ -433,8 +433,8 @@ namespace('gen', function () {
// Create default layout if one doesn't exist
// Hack: There should be a better way to detect if a application layout exists
- if(!utils.compat.existsSync(appLayoutPath + '.html.ejs') && !utils.compat.existsSync(appLayoutPath + '.html.jade') &&
- !utils.compat.existsSync(appLayoutPath + '.html.hbs') && !utils.compat.existsSync(appLayoutPath + '.html.ms')) {
+ if(!utils.file.existsSync(appLayoutPath + '.html.ejs') && !utils.file.existsSync(appLayoutPath + '.html.jade') &&
+ !utils.file.existsSync(appLayoutPath + '.html.hbs') && !utils.file.existsSync(appLayoutPath + '.html.ms')) {
// Copy template layout file to apps application layout file
jake.cpR(path.join(templateViewDir, 'layout' + ext), appLayoutPath + ext);
}
View
2 templates/scaffold/views/ejs/add.html.ejs.ejs
@@ -1,5 +1,5 @@
<div class="hero-unit">
- <form id="<%= names.property.singular %>-form" class="form-horizontal" action="/<%= names.url.plural %>" method="POST">
+ <form id="<%= names.property.singular %>-form" class="form-horizontal" action="/<%= names.filename.plural %>" method="POST">
<fieldset>
<legend>Create a new <%= names.constructor.singular %></legend>
<@ if(params.errors) { @>
View
4 templates/scaffold/views/ejs/edit.html.ejs.ejs
@@ -1,5 +1,5 @@
<div class="hero-unit">
- <form id="<%= names.property.singular %>-form" class="form-horizontal" action="/<%= names.url.plural %>/<@= params.id @>?_method=PUT" method="POST">
+ <form id="<%= names.property.singular %>-form" class="form-horizontal" action="/<%= names.filename.plural %>/<@= params.id @>?_method=PUT" method="POST">
<fieldset>
<legend>Update this <%= names.constructor.singular %></legend>
<@ if(params.errors) { @>
@@ -47,7 +47,7 @@
<% } -%>
<div class="form-actions">
<@- contentTag('input', 'Save', {type: 'submit', class: 'btn btn-primary'}) @>
- <@- contentTag('button', 'Remove', {type: 'submit', formaction: '/<%= names.url.plural %>/' + params.id + '?_method=DELETE', formmethod: 'POST', class: 'btn btn-danger'}) @>
+ <@- contentTag('button', 'Remove', {type: 'submit', formaction: '/<%= names.filename.plural %>/' + params.id + '?_method=DELETE', formmethod: 'POST', class: 'btn btn-danger'}) @>
</div>
</fieldset>
</form>
View
2 templates/scaffold/views/jade/add.html.jade.ejs
@@ -1,5 +1,5 @@
.hero-unit
- form#<%= names.property.singular %>-form.form-horizontal(action="/<%= names.url.plural %>", method="POST")
+ form#<%= names.property.singular %>-form.form-horizontal(action="/<%= names.filename.plural %>", method="POST")
fieldset
legend Create a new <%= names.constructor.singular %>
if params.errors
View
4 templates/scaffold/views/jade/edit.html.jade.ejs
@@ -1,5 +1,5 @@
.hero-unit
- form#<%= names.property.singular %>-form.form-horizontal(action="/<%= names.url.plural %>/" + params.id + "?_method=PUT", method="POST")
+ form#<%= names.property.singular %>-form.form-horizontal(action="/<%= names.filename.plural %>/" + params.id + "?_method=PUT", method="POST")
fieldset
legend Update this <%= names.constructor.singular %>
if params.errors
@@ -40,4 +40,4 @@
<% } -%>
.form-actions
!= contentTag('input', 'Save', {type: 'submit', class: 'btn btn-primary'})
- != contentTag('button', 'Remove', {type: 'submit', formaction: '/<%= names.url.plural %>/' + params.id + '?_method=DELETE', formmethod: 'POST', class: 'btn btn-danger'})
+ != contentTag('button', 'Remove', {type: 'submit', formaction: '/<%= names.filename.plural %>/' + params.id + '?_method=DELETE', formmethod: 'POST', class: 'btn btn-danger'})

0 comments on commit 60e2ef5

Please sign in to comment.