Browse files

Created app and resource generators for Jade, Handlebars and Mustache

  • Loading branch information...
1 parent 0feb0b2 commit ae3f611a00b7ee7ba06ac097a6bd1b6bc06f42a8 @larzconwell larzconwell committed Jul 2, 2012
Showing with 521 additions and 238 deletions.
  1. +155 −130 bin/cli.js
  2. +3 −0 lib/utils/file.js
  3. +3 −0 lib/utils/index.js
  4. +132 −107 templates/Jakefile
  5. +51 −0 templates/base/views/ejs/layouts/application.html.ejs
  6. 0 templates/base/views/{ → ejs}/main/index.html.ejs
  7. +1 −1 templates/base/views/{layouts/application.html.ejs → handlebars/layouts/application.html.hbs}
  8. +6 −0 templates/base/views/handlebars/main/index.html.hbs
  9. +46 −0 templates/base/views/jade/layouts/application.html.jade
  10. +6 −0 templates/base/views/jade/main/index.html.jade
  11. 0 templates/views/{ → ejs}/add.html.ejs
  12. 0 templates/views/{ → ejs}/edit.html.ejs
  13. 0 templates/views/{ → ejs}/index.html.ejs
  14. +12 −0 templates/views/ejs/layout.html.ejs
  15. 0 templates/views/{ → ejs}/show.html.ejs
  16. +6 −0 templates/views/handlebars/add.html.hbs
  17. +6 −0 templates/views/handlebars/edit.html.hbs
  18. +6 −0 templates/views/handlebars/index.html.hbs
  19. +12 −0 templates/views/handlebars/layout.html.hbs
  20. +6 −0 templates/views/handlebars/show.html.hbs
  21. +5 −0 templates/views/jade/add.html.jade
  22. +5 −0 templates/views/jade/edit.html.jade
  23. +5 −0 templates/views/jade/index.html.jade
  24. +8 −0 templates/views/jade/layout.html.jade
  25. +5 −0 templates/views/jade/show.html.jade
  26. +6 −0 templates/views/mustache/add.html.ms
  27. +6 −0 templates/views/mustache/edit.html.ms
  28. +6 −0 templates/views/mustache/index.html.ms
  29. +12 −0 templates/views/mustache/layout.html.ms
  30. +6 −0 templates/views/mustache/show.html.hbs
  31. +6 −0 templates/views/mustache/show.html.ms
View
285 bin/cli.js
@@ -1,163 +1,188 @@
#!/usr/bin/env node
-// Load the basic Geddy toolkit
-var geddy = require('../lib/geddy');
-
-var exec = require('child_process').exec
+// Dependencies
+var geddy = require('../lib/geddy')
+ , exec = require('child_process').exec
, fs = require('fs')
, path = require('path')
, parseopts = require('../lib/parseopts')
- , utils = require('../lib/utils/index')
- , parser
- , cwd = process.cwd()
+ , utils = require('../lib/utils/index');
+
+// Variables
+var cwd = process.cwd()
, args = process.argv.slice(2)
+ , parser
, optsMap
, cmds
, opts
, usage
, cmd
- , filepath;
-
-usage = ''
- + 'Geddy web framework for Node.js\n'
- + '*********************************************************************************************\n'
- + 'With no flags, server starts running on port 4000, on http://localhost, in development mode\n'
- + '*********************************************************************************************\n'
- + '{Usage}: geddy [options]\n'
- + '\n'
- + '{Options}:\n'
- + ' -e, --environment Evironment config to use\n'
- + ' -p, --port NUM Port number, defaults to 4000\n'
- + ' -n, --workers NUM Number of worker processes to use, defaults to 2\n'
- + ' -V/v, --version Outputs the version of geddy that you have installed\n'
- + ' -d, --debug Sets the log level to output debug messages to the console\n'
- + ' -h, --help Outputs help information\n'
- + '';
+ , filepath
+ , die
+ , start;
+
+// Help dialog
+usage = [
+ 'Geddy web framework for Node.js'
+ , ''
+ , 'With no flags, Geddy starts on port 4000, on http://localhost in development mode'
+ , ''
+ , 'Usage: geddy [options] [arguments]'
+ , ''
+ , 'Options:'
+ , ' --environment, -e # Environment to use'
+ , ' --port, -p # Port to connect to'
+ , ' --workers, -w # Number of worker processes to use(default: 2)'
+ , ' --version, -v # Output the version of Geddy installed'
+ , ' --debug, -d # Sets the log level to output debug messages to the console'
+ , ' --help, -h # Output the help dialog'
+ , ' --jade, -j # Generate Jade templates for the app/resource/controller'
+ , ' commands(Default: EJS)'
+ , ' --handle, -H # Generate Handlebars templates for the'
+ , ' app/resource/controller commands(Default: EJS)'
+ , ' --mustache, -m # Generate Mustache templates for the'
+ , ' app/resource/controller commands(Default: EJS)'
+ , ''
+ , ' app # Create a new Geddy application'
+ , ' resource # Create a new resource'
+ , ' (Views, Model, Controller and resource route)'
+ , ' secret # Create new app secret in `environment.js`'
+ , ' controller # Generate a new controller(views and routes included)'
+ , ' model # Generate a new model'
+ , ''
+].join('\n');
+// Options available
optsMap = [
- { full: 'origins'
- , abbr: 'o'
- }
-, { full: 'port'
- , abbr: 'p'
- }
-, { full: 'workers'
- , abbr: 'n'
- }
-, { full: 'version'
- , abbr: 'V'
- }
-, { full: 'version'
- , abbr: 'v'
- }
-, { full: 'help'
- , abbr: 'h'
- }
-, { full: 'debug'
- , abbr: 'd'
- }
-, { full: 'logLevel'
- , abbr: 'l'
-}
-, { full: 'environment'
- , abbr: 'e'
- }
-, { full: 'spawned'
- , abbr: 'Q'
- }
+ { full: 'origins', abbr: 'o' }
+ , { full: 'port', abbr: 'p' }
+ , { full: 'workers', abbr: 'n' } // Compat
+ , { full: 'workers', abbr: 'w' }
+ , { full: 'version', abbr: 'v' }
+ , { full: 'version', abbr: 'V' } // Compat
+ , { full: 'help', abbr: 'h' }
+ , { full: 'debug', abbr: 'd' }
+ , { full: 'loglevel', abbr: 'l' }
+ , { full: 'environment', abbr: 'e' }
+ , { full: 'spawned', abbr: 'Q' } // Compat
+ , { full: 'spawned', abbr: 'q' } // Compat
+ , { full: 'spawned', abbr: 's' }
+ , { full: 'jade', abbr: 'j' }
+ , { full: 'handle', abbr: 'H' }
+ , { full: 'handlebars', abbr: 'H' }
+ , { full: 'mustache', abbr: 'm' }
];
+// Parse optsMap and generate options and cmd commands
parser = new parseopts.Parser(optsMap);
parser.parse(args);
cmds = parser.cmds;
opts = parser.opts;
-var die = function (str) {
+// Set handlebars option to handle option
+opts.handle = opts.handlebars || opts.handle;
+
+// Exit the process with a message
+die = function(str) {
console.log(str);
process.exit();
};
-var start = function () {
+// Start Geddy with options
+start = function() {
geddy.config(opts);
geddy.start();
};
-if (typeof opts.help != 'undefined') {
- die(usage);
-}
-else if (typeof opts.version != 'undefined') {
- die(geddy.version);
-}
-else {
- // `geddy app foo` or `geddy resource bar` etc. -- run generators
- if (cmds.length) {
- filepath = path.normalize(path.join(__dirname, '..', 'templates', 'Jakefile'));
- if (process.platform == 'win32') {
- filepath = '"' + filepath + '"';
- }
- cmd = 'jake -t -f ' + filepath + ' ';
- if (cmds[0] != 'secret' && !cmds[1]) {
- throw new Error(cmds[0] + ' command requires another argument.');
- }
- switch (cmds[0]) {
- case 'app':
- cmd += 'gen:app[' + cmds[1] + ']';
- break;
- case 'resource':
- cmd += 'gen:resource[' + cmds[1] + ']';
- break;
- case 'controller':
- cmd += 'gen:bareController[' + cmds[1] + ']';
- break;
- case 'model':
- cmd += 'gen:model[' + cmds[1] + ']';
- break;
- case 'secret':
- cmd += 'gen:secret';
- break;
- default:
- die(cmds[0] + ' is not a Geddy command.');
- }
- cmd += ' --quiet';
- exec(cmd, function (err, stdout, stderr) {
- if (err) {
- throw err;
- }
- else {
- if (stderr) {
- console.log(utils.string.trim(stderr));
- }
- if (stdout) {
- console.log(utils.string.trim(stdout));
- }
- }
- });
+if(opts.help) die(usage);
+if(opts.version) die(geddy.version);
+
+// `geddy app foo` or `geddy resource bar` etc. -- run generators
+if(cmds.length) {
+ filepath = path.normalize(path.join(__dirname, '..', 'templates', 'Jakefile'));
+
+ // Wrap quotes in case path has spaces
+ if(process.platform === 'win32') filepath = '"' + filepath + '"';
+ cmd = 'jake -t -f ' + filepath + ' ';
+
+ // If command isn't secret and has no other argument
+ if (cmds[0] !== 'secret' && !cmds[1]) {
+ throw new Error(cmds[0] + ' command requires another argument.');
}
- // Just `geddy` -- start the server
- else {
- var relPath = '';
-
- // Search for the `config` directory needed to run Geddy
- // - up to 5 parent directories then show the usage
- for(var i = 0, len = 5; i <= len; i++) {
- var configPath = path.join(cwd, relPath, 'config')
- , existsSync = typeof fs.existsSync == 'function' ?
- fs.existsSync : path.existsSync
- , geddyApp = existsSync(configPath);
-
- if(geddyApp) {
- break;
- } else {
- // If 5 directories up show usage
- if(i === 5) die(usage);
-
- // Add a relative parent directory
- relPath += '../';
- process.chdir(path.join(cwd, relPath));
- }
- }
- start(); // Start the server up
+
+ switch(cmds[0]) {
+ case 'app':
+ // Generating application
+ cmd += 'gen:app[' + cmds[1];
+
+ if(opts.jade) cmd += ',' + 'jade';
+ if(opts.handle) cmd += ',' + 'handlebars';
+ if(opts.mustache) cmd += ',' + 'mustache';
+
+ cmd += ']';
+ break;
+ case 'resource':
+ // Generating resources
+ cmd += 'gen:resource[' + cmds[1];
+
+ if(opts.jade) cmd += ',' + 'jade';
+ if(opts.handle) cmd += ',' + 'handlebars';
+ if(opts.mustache) cmd += ',' + 'mustache';
+
+ cmd += ']';
+ break;
+ case 'controller':
+ // Generating controller
+ cmd += 'gen:bareController[' + cmds[1];
+
+ if(opts.jade) cmd += ',' + 'jade';
+ if(opts.handle) cmd += ',' + 'handlebars';
+ if(opts.mustache) cmd += ',' + 'mustache';
+
+ cmd += ']';
+ break;
+ case 'model':
+ // Generating model
+ cmd += 'gen:model[' + cmds[1] + ']';
+ break;
+ case 'secret':
+ // Generating new app secret
+ cmd += 'gen:secret';
+ break;
+ default:
+ die(cmds[0] + ' is not a Geddy command.');
}
+
+ cmd += ' --quiet';
+ exec(cmd, function(err, stdout, stderr) {
+ if(err) throw err;
+
+ if(stderr) console.log(utils.string.trim(stderr));
+ if(stdout) console.log(utils.string.trim(stdout));
+ });
}
+// Just `geddy` -- start the server
+else {
+ var relPath = '';
+
+ // Search for the `config` directory needed to run Geddy
+ // - up to 5 parent directories then show the usage
+ for(var i = 0, len = utils.file.maxParentDir; i <= len; i++) {
+ var configPath = path.join(cwd, relPath, 'config')
+ , existsSync = typeof fs.existsSync == 'function' ?
+ fs.existsSync : path.existsSync
+ , geddyApp = existsSync(configPath);
+ if(geddyApp) {
+ break;
+ } else {
+ // If 5 directories up show usage
+ if(i === len) die(usage);
+ // Add a relative parent directory
+ relPath += '../';
+ process.chdir(path.join(cwd, relPath));
+ }
+ }
+ start(); // Start the server up
+}
View
3 lib/utils/file.js
@@ -249,6 +249,9 @@ var fileUtils = new (function () {
return str || '.';
};
+ // Maximum directory count to search for parent directories
+ this.maxParentDir = 5;
+
})();
module.exports = fileUtils;
View
3 lib/utils/index.js
@@ -17,6 +17,7 @@
*/
var geddy
, string = require('./string').string
+ , fileUtils = require('./file')
, async = require('./async').async
, uri = require('./uri').uri
, array = require('./array').array
@@ -113,6 +114,8 @@ var utils = new (function () {
})();
utils.string = string;
+utils.file = fileUtils;
+utils.fileUtils = fileUtils;
utils.async = async;
utils.uri = uri;
utils.array = array;
View
239 templates/Jakefile
@@ -1,6 +1,7 @@
// Load the basic Geddy toolkit
require('../lib/geddy')
+// Dependencies
var fs = require('fs')
, path = require('path')
, existsSync = typeof fs.existsSync == 'function' ?
@@ -11,173 +12,197 @@ var fs = require('fs')
, templato = new (require('../deps/templato'));
namespace('gen', function () {
- var _writeTemplate = function (name, filename, dirname, opts) {
- var names = _getInflections(name)
- , text = fs.readFileSync(path.join(__dirname,
- filename +'.ejs'), 'utf8').toString()
- , templ
- , filePath;
- // Render with the right model name
- templ = new adapter({ data: {ext:'.ejs'}, text: text, templato: templato });
- templ.process({names: names});
- filePath = path.join('app', dirname,
- names.filename[opts.inflection] + '.js');
- fs.writeFileSync(filePath, templ.markup, 'utf8');
- console.log('[ADDED] ' + filePath);
- }
- , _getInflections = function (nameParam) {
- var name = utils.string.snakeize(nameParam)
- , namePlural = inflection.pluralize(name)
- , names = {
- filename: {
- singular: name
- , plural: namePlural
- }
- , constructor: {
- singular: utils.string.camelize(name, true)
- , plural: utils.string.camelize(namePlural, true)
- }
- , property: {
- singular: utils.string.camelize(name)
- , plural: utils.string.camelize(namePlural)
- }
- };
- return names;
- };
+ var _writeTemplate = function (name, filename, dirname, options) {
+ options = options || {};
+
+ var names = _getInflections(name)
+ , text = fs.readFileSync(path.join(__dirname, filename + '.ejs'), 'utf8').toString()
+ , templ
+ , filePath;
+
+ // Render with the right model name
+ templ = new adapter({ data: {ext: '.ejs'}, text: text, templato: templato });
+ templ.process({names: names});
+
+ // Write file
+ filePath = path.join('app', dirname, names.filename[options.inflection] + '.js');
+ fs.writeFileSync(filePath, templ.markup, 'utf8');
+
+ console.log('[ADDED] ' + filePath);
+ };
+
+ var _getInflections = function (nameParam) {
+ var name = utils.string.snakeize(nameParam)
+ , namePlural = inflection.pluralize(name);
+
+ return {
+ filename: {
+ singular: name
+ , plural: namePlural
+ },
+ constructor: {
+ singular: utils.string.camelize(name, true)
+ , plural: utils.string.camelize(namePlural, true)
+ },
+ property: {
+ singular: utils.string.camelize(name)
+ , plural: utils.string.camelize(namePlural)
+ }
+ };
+ };
// Creates a new Geddy app scaffold
- task('app', [], function (appName) {
- if (!appName) {
- throw new Error('No app-name specified.');
- }
+ task('app', [], function(name, engine) {
+ if(!name) throw new Error('No app-name specified.');
+ if(!engine) engine = 'ejs';
+
var mkdirs = [
- ''
- , 'config'
- , 'app/models'
- , 'app/controllers'
- , 'lib'
- , 'log'
- , 'node_modules'
+ ''
+ , 'config'
+ , 'app/models'
+ , 'app/controllers'
+ , 'lib'
+ , 'log'
+ , 'node_modules'
]
, cps = [
- , ['views', 'app']
- , ['public', '']
- , ['router.js', 'config']
- , ['init.js', 'config']
- , ['environment.js', 'config']
- , ['development.js', 'config']
- , ['production.js', 'config']
- , ['main.js', 'app/controllers']
- , ['application.js', 'app/controllers']
- , ['favicon.ico', 'public']
+ ['views/' + engine, 'app/views']
+ , ['public', '']
+ , ['router.js', 'config']
+ , ['init.js', 'config']
+ , ['environment.js', 'config']
+ , ['development.js', 'config']
+ , ['production.js', 'config']
+ , ['main.js', 'app/controllers']
+ , ['application.js', 'app/controllers']
+ , ['favicon.ico', 'public']
];
- mkdirs.forEach(function (d) {
- jake.mkdirP(path.join(appName, d));
+
+ mkdirs.forEach(function(dir) {
+ jake.mkdirP(path.join(name, dir));
});
- cps.forEach(function (cp) {
- jake.cpR(path.join(__dirname, 'base', cp[0]),
- path.join(appName, cp[1]));
+ cps.forEach(function(cp) {
+ jake.cpR(path.join(__dirname, 'base', cp[0]), path.join(name, cp[1]));
});
- console.log('Created app ' + appName + '.');
+
+ console.log('Created app ' + name + '.');
});
- // Creates a resource-based route with model and controller
- task('resource', function (name) {
+ // Creates a resource(Model, Controller, Views and resource route)
+ task('resource', function(name, engine) {
jake.Task['gen:model'].invoke(name);
jake.Task['gen:controller'].invoke(name);
jake.Task['gen:route'].invoke(name);
- jake.Task['gen:views'].invoke(name);
+ jake.Task['gen:views'].invoke(name, { engine: engine });
});
- task('model', [], function (name) {
- _writeTemplate(name, 'resource_model', 'models',
- {inflection: 'singular'});
+ task('model', [], function(name) {
+ _writeTemplate(name, 'resource_model', 'models', { inflection: 'singular' });
});
- task('controller', [], function (name) {
- _writeTemplate(name, 'resource_controller', 'controllers',
- {inflection: 'plural'});
+ task('controller', [], function(name) {
+ _writeTemplate(name, 'resource_controller', 'controllers', { inflection: 'plural' });
});
- task('route', [], function (name, opts) {
+ task('route', [], function(name, options) {
+ options = options || {};
+
var names = _getInflections(name)
- , options = opts || {}
, routeType = options.bare ? 'Bare' : 'Resource'
, filePath = path.normalize('config/router.js')
- , newRoute
, text = fs.readFileSync(filePath, 'utf8').toString()
+ , newRoute
, routeArr;
if (options.bare) {
newRoute = 'router.match(\'/' + names.filename.plural +
- '\').to({controller: \'' + names.constructor.plural +
- '\', action: \'index\'});';
- }
- else {
- newRoute = 'router.resource(\'' + names.filename.plural + '\');'
- }
+ '\').to({controller: \'' + names.constructor.plural +
+ '\', action: \'index\'});';
+ } else newRoute = 'router.resource(\'' + names.filename.plural + '\');'
// Don't add the same route over and over
- if (text.indexOf(newRoute) == -1) {
+ if(text.indexOf(newRoute) == -1) {
// Add the new resource route just above the export
routerArr = text.split('exports.router');
routerArr[0] += newRoute + '\n';
+
text = routerArr.join('exports.router');
fs.writeFileSync(filePath, text, 'utf8');
+
console.log(routeType + ' ' + names.filename.plural +
- ' route added to ' + filePath);
+ ' route added to ' + filePath);
}
else {
console.log('(' + routeType + ' ' + names.filename.plural +
- ' route already defined in ' + filePath + ')');
+ ' route already defined in ' + filePath + ')');
}
});
- task('views', [], function (name, opts) {
+ task('views', [], function(name, options) {
+ options = options || {};
+
+ // If `engine` option isn't set then default to EJS
+ if(!options.engine) options.engine = 'ejs';
+
var names = _getInflections(name)
- , options = opts || {}
- , viewDir = path.join('app/views', names.filename.plural)
- , actions
+ , engine = options.engine
+ , appViewDir = path.join('app', 'views', names.filename.plural)
+ , templateViewDir = path.join(__dirname, 'views', engine)
, cmds = []
- , addActionView = function (action) {
- jake.cpR(path.join(__dirname, 'views',
- action + '.html.ejs'), viewDir);
- };
-
- jake.mkdirP(viewDir);
+ , ext = '.html'
+ , appLayoutPath
+ , actions
+ , addActionView;
+
+ // Set extension based on engine option
+ if(engine === 'ejs') ext += '.ejs';
+ if(engine === 'jade') ext += '.jade';
+ if(engine === 'handlebars') ext += '.hbs';
+ if(engine === 'mustache') ext += '.ms';
+
+ // Set application layout path
+ appLayoutPath = path.join('app', 'views', 'layouts', 'application');
+ // Copy template view to application path
+ addActionView = function(action) {
+ jake.cpR(path.join(templateViewDir, action + ext), appViewDir);
+ };
+
+ jake.mkdirP(appViewDir);
jake.mkdirP('app/views/layouts');
-
addActionView('index');
+
// Add views for the other CRUD actions when doing a full-on resource
- if (!options.bare) {
+ if(!options.bare) {
['add', 'edit', 'show'].forEach(function (action) {
addActionView(action);
});
}
- // Create an app-layout if one doesn't exist
- if (!existsSync(path.join(process.cwd(),
- 'app/views/layouts/application.html.ejs'))) {
- jake.cpR(path.join(__dirname, '/views/layout.html.ejs'),
- 'app/views/layouts/application.html.ejs');
+ // Create default layout if one doesn't exist
+ // Hack: There should be a better way to detect if a application layout exists
+ if(!existsSync(appLayoutPath + '.html.ejs') && !existsSync(appLayoutPath + '.html.jade') &&
+ !existsSync(appLayoutPath + '.html.hbs') && !existsSync(appLayoutPath + '.html.ms')) {
+ // Copy template layout file to apps application layout file
+ jake.cpR(path.join(templateViewDir, 'layout' + ext), appLayoutPath + ext);
}
console.log('Created view templates.');
});
- task('bareController', [], function (name) {
- _writeTemplate(name, 'bare_controller', 'controllers',
- {inflection: 'plural'});
- jake.Task['gen:route'].invoke(name, {bare: true});
- jake.Task['gen:views'].invoke(name, {bare: true});
+ task('bareController', [], function(name, engine) {
+ _writeTemplate(name, 'bare_controller', 'controllers', { inflection: 'plural' });
+
+ jake.Task['gen:route'].invoke(name, { bare: true });
+ jake.Task['gen:views'].invoke(name, { bare: true, engine: engine });
});
- task('secret', [], function (name) {
+ // Generate a new application secret in environment.js
+ task('secret', [], function(name) {
var filename = path.join(process.cwd(), 'config/environment.js')
, conf = fs.readFileSync(filename).toString()
- , confArr
- , secret = utils.string.uuid(128);
+ , secret = utils.string.uuid(128)
+ , confArr;
// Remove any old secret
conf = conf.replace(/\nconfig.secret.+;\n/, '');
@@ -186,8 +211,8 @@ namespace('gen', function () {
conf = confArr[0] + "config.secret = '" + secret + "';\n\n" +
'module.exports = config;' + confArr[1];
fs.writeFileSync(filename, conf);
+
console.log('app-secret added to environment.js config.');
});
});
-
View
51 templates/base/views/ejs/layouts/application.html.ejs
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <title>Geddy App | This app uses Geddy.js</title>
+ <meta name="description" content="">
+ <meta name="author" content="">
+
+ <meta name="viewport" content="width=device-width" />
+
+ <!-- The HTML5 shim, for IE6-8 support of HTML elements -->
+ <!--[if lt IE 9]>
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+ <![endif]-->
+
+ <%- scriptLink('/js/jquery.min.js', {type:'text/javascript'}) %>
+ <%- scriptLink('/js/bootstrap.min.js', {type:'text/javascript'}) %>
+
+ <%- styleLink('/css/bootstrap.min.css', {rel:'stylesheet'}) %>
+ <%- styleLink('/css/style.css', {rel:'stylesheet'}) %>
+ <%- styleLink('/css/bootstrap.responsive.min.css', {rel:'stylesheet'}) %>
+
+ <!-- The fav and touch icons -->
+ <link rel="shortcut icon" href="/images/favicon.ico">
+ <link rel="apple-touch-icon" href="images/apple-touch-icon.png">
+ <link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
+ <link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
+ </head>
+ <body>
+ <div class="navbar navbar-fixed-top">
+ <div class="navbar-inner">
+ <div class="container">
+ <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
+ <span class="i-bar"><i class="icon-chevron-down icon-white"></i></span>
+ </a>
+ <%- linkTo('Geddy App', '/', { class: 'brand' }) %>
+ <div class="nav-collapse">
+ <ul class="nav">
+ <li class="active"><%- linkTo('Home', '/') %></li>
+ <li><%- linkTo('Tutorial', 'http://geddyjs.org/tutorial.html') %></li>
+ <!--<li><%- linkTo('Docs', 'http://geddyjs.org/docs.html') %></li>-->
+ </ul>
+ </div><!--/.nav-collapse -->
+ </div>
+ </div>
+ </div>
+ <div class="container">
+ <%- yield(); %>
+ </div>
+ </body>
+</html>
View
0 templates/base/views/main/index.html.ejs → templates/base/views/ejs/main/index.html.ejs
File renamed without changes.
View
2 ...s/base/views/layouts/application.html.ejs → ...s/handlebars/layouts/application.html.hbs
@@ -45,7 +45,7 @@
</div>
</div>
<div class="container">
- <%- yield(); %>
+ {{{yield}}}
</div>
</body>
</html>
View
6 templates/base/views/handlebars/main/index.html.hbs
@@ -0,0 +1,6 @@
+<!-- Lets talk about geddy -->
+<div class="hero-unit geddy-welcome-box">
+ <h1>Hello, World!</h1>
+ <p>You've created a Geddy app and your server is running. If you already know what you're doing, feel free to jump into your app logic, if not...</p>
+ <p><a href="http://geddyjs.org/tutorial.html" class="btn btn-primary btn-large">Lets get you started »</a></p>
+</div>
View
46 templates/base/views/jade/layouts/application.html.jade
@@ -0,0 +1,46 @@
+!!! html
+
+html(lang="en")
+ head
+ meta(charset="utf-8")
+ meta(name="description", content="")
+ meta(name="author", content="")
+ meta(name="viewport", content="width=device-width")
+ title Geddy App | This app uses Geddy.js
+
+ // The HTML5 shim, for IE6-8 support of HTML elements
+ //if lt IE 9
+ script(src="http://html5shim.googlecode.com/svn/trunk/html5.js")
+
+ != scriptLink('/js/jquery.min.js', {type:'text/javascript'})
+ != scriptLink('/js/bootstrap.min.js', {type:'text/javascript'})
+
+ != styleLink('/css/bootstrap.min.css', {rel:'stylesheet'})
+ != styleLink('/css/style.css', {rel:'stylesheet'})
+ != styleLink('/css/bootstrap.responsive.min.css', {rel:'stylesheet'})
+
+ // The fav and touch icons
+ link(rel="shortcut icon", href="/images/favicon.ico")
+ link(rel="apple-touch-icon", href="images/apple-touch-icon.png")
+ link(rel="apple-touch-icon", sizes="72x72", href="images/apple-touch-icon-72x72.png")
+ link(rel="apple-touch-icon", sizes="114x114", href="images/apple-touch-icon-114x114.png")
+
+ body
+ .navbar.navbar-fixed-top
+ .navbar-inner
+ .container
+ a.btn.btn-navbar(data-toggle="collapse", data-target=".nav-collapse")
+ span.i-bar
+ i.icon-chevron-down.icon-white
+ != linkTo('Geddy App', '/', { class: 'brand' })
+ .nav-collapse
+ ul.nav
+ li.active
+ != linkTo('Home', '/')
+ li
+ != linkTo('Tutorial', 'http://geddyjs.org/tutorial.html')
+ //li
+ != linkTo('Docs', 'http://geddyjs.org/docs.html')
+
+ .container
+ != yield()
View
6 templates/base/views/jade/main/index.html.jade
@@ -0,0 +1,6 @@
+// Lets talk about geddy
+.hero-unit.geddy-welcome-box
+ h1 Hello, World!
+ p You've created a Geddy app and your server is running. If you already know what you're doing, feel free to jump into your app logic, if not...
+ p
+ a.btn.btn-primary.btn-large(href="http://geddyjs.org/tutorial.html") Lets get you started »
View
0 templates/views/add.html.ejs → templates/views/ejs/add.html.ejs
File renamed without changes.
View
0 templates/views/edit.html.ejs → templates/views/ejs/edit.html.ejs
File renamed without changes.
View
0 templates/views/index.html.ejs → templates/views/ejs/index.html.ejs
File renamed without changes.
View
12 templates/views/ejs/layout.html.ejs
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <title>Geddy App | This app uses Geddy.js</title>
+ </head>
+ <body>
+ <div class="container">
+ <%- yield(); %>
+ </div>
+ </body>
+</html>
View
0 templates/views/show.html.ejs → templates/views/ejs/show.html.ejs
File renamed without changes.
View
6 templates/views/handlebars/add.html.hbs
@@ -0,0 +1,6 @@
+<div class="hero-unit">
+ <h3>Params</h3>
+ {{#params}}
+ <p>{{action}} action on {{controller}} controller.</p>
+ {{/params}}
+</div>
View
6 templates/views/handlebars/edit.html.hbs
@@ -0,0 +1,6 @@
+<div class="hero-unit">
+ <h3>Params</h3>
+ {{#params}}
+ <p>{{action}} action on {{controller}} controller.</p>
+ {{/params}}
+</div>
View
6 templates/views/handlebars/index.html.hbs
@@ -0,0 +1,6 @@
+<div class="hero-unit">
+ <h3>Params</h3>
+ {{#params}}
+ <p>{{action}} action on {{controller}} controller.</p>
+ {{/params}}
+</div>
View
12 templates/views/handlebars/layout.html.hbs
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <title>Geddy App | This app uses Geddy.js</title>
+ </head>
+ <body>
+ <div class="container">
+ {{{yield}}}
+ </div>
+ </body>
+</html>
View
6 templates/views/handlebars/show.html.hbs
@@ -0,0 +1,6 @@
+<div class="hero-unit">
+ <h3>Params</h3>
+ {{#params}}
+ <p>{{action}} action on {{controller}} controller.</p>
+ {{/params}}
+</div>
View
5 templates/views/jade/add.html.jade
@@ -0,0 +1,5 @@
+.hero-unit
+ h3 Params
+ ul
+ - for (var p in params)
+ li= p + ':' + params[p]
View
5 templates/views/jade/edit.html.jade
@@ -0,0 +1,5 @@
+.hero-unit
+ h3 Params
+ ul
+ - for (var p in params)
+ li= p + ':' + params[p]
View
5 templates/views/jade/index.html.jade
@@ -0,0 +1,5 @@
+.hero-unit
+ h3 Params
+ ul
+ - for (var p in params)
+ li= p + ':' + params[p]
View
8 templates/views/jade/layout.html.jade
@@ -0,0 +1,8 @@
+!!! html
+html(lang="en")
+ head
+ meta(charset="utf-8")
+ title Geddy App | This app uses Geddy.js
+ body
+ .container
+ != yield()
View
5 templates/views/jade/show.html.jade
@@ -0,0 +1,5 @@
+.hero-unit
+ h3 Params
+ ul
+ - for (var p in params)
+ li= p + ':' + params[p]
View
6 templates/views/mustache/add.html.ms
@@ -0,0 +1,6 @@
+<div class="hero-unit">
+ <h3>Params</h3>
+ {{#params}}
+ <p>{{action}} action on {{controller}} controller.</p>
+ {{/params}}
+</div>
View
6 templates/views/mustache/edit.html.ms
@@ -0,0 +1,6 @@
+<div class="hero-unit">
+ <h3>Params</h3>
+ {{#params}}
+ <p>{{action}} action on {{controller}} controller.</p>
+ {{/params}}
+</div>
View
6 templates/views/mustache/index.html.ms
@@ -0,0 +1,6 @@
+<div class="hero-unit">
+ <h3>Params</h3>
+ {{#params}}
+ <p>{{action}} action on {{controller}} controller.</p>
+ {{/params}}
+</div>
View
12 templates/views/mustache/layout.html.ms
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <title>Geddy App | This app uses Geddy.js</title>
+ </head>
+ <body>
+ <div class="container">
+ {{{yield}}}
+ </div>
+ </body>
+</html>
View
6 templates/views/mustache/show.html.hbs
@@ -0,0 +1,6 @@
+<div class="hero-unit">
+ <h3>Params</h3>
+ {{#params}}
+ <p>{{action}} action on {{controller}} controller.</p>
+ {{/params}}
+</div>
View
6 templates/views/mustache/show.html.ms
@@ -0,0 +1,6 @@
+<div class="hero-unit">
+ <h3>Params</h3>
+ {{#params}}
+ <p>{{action}} action on {{controller}} controller.</p>
+ {{/params}}
+</div>

0 comments on commit ae3f611

Please sign in to comment.