Skip to content
Myr

Added app generation to bin/express

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 8beae06 · Browse files · 2 files+89 added−10 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+89 added−10 removed

  • other:+89 added−10 removed

2 files+89 added−10 removed

modified:bin/express+88 added-4 removed
21 unmodified lines
22 + '\x1b[1mUsage\x1b[0m: express [options] [PATH]\n'23 + '\n'24 + '\x1b[1mOptions\x1b[0m:\n'25 + ' -v, --version Output framework version\n'26 + ' -h, --help Output help information\n'26 + ' -h, --help Output help information\n';2728/**29 * Jade layout template.30 */3132var jadeLayout = [33 '!!!',34 'html',35 ' head',36 ' title= title',37 ' link(rel=\'stylesheet\', href=\'/stylesheets/style.css\')',38 ' body!= body'39].join('\n');4041/**42 * Default sass template.43 */4445var sass = [46 'body',47 ' :padding 50px',48 ' :font 14px "Lucida Grande", "Helvetica Nueue", Arial, sans-serif'49].join('\n');5051/**52 * Jade index template.53 */5455var jadeIndex = [56 'h1= title',57 'p Welcome to #{title}'58].join('\n');5960/**61 * App template.62 */6364var app = [65 '',66 '/**',67 ' * Module dependencies.',68 ' */',69 '',70 'var express = require(\'express\'),',71 ' connect = require(\'connect\');',72 '',73 '// Create and export Express app',74 '',75 'var app = module.exports = express.createServer();',76 '',77 '// Configuration',78 '',79 'app.configure(function(){',80 ' app.use(\'/\', connect.redirect());',81 ' app.use(\'/\', connect.bodyDecoder());',82 ' app.use(\'/\', connect.compiler({ src: __dirname + \'/public\', enable: [\'sass\'] }));',83 ' app.use(\'/\', connect.staticProvider(__dirname + \'/public\'));',84 '});',85 '',86 'app.configure(\'development\', function(){',87 ' app.use(\'/\', connect.errorHandler({ dumpExceptions: true, showStack: true })); ',88 '});',89 '',90 'app.configure(\'production\', function(){',91 ' app.use(\'/\', connect.errorHandler()); ',92 '});',93 '',94 '// Routes',95 '',96 'app.get(\'/\', function(req, res){',97 ' res.render(\'index.jade\', {',98 ' locals: {',99 ' title: \'Express\'',100 ' }',101 ' });',102 '});'103].join('\n');104105// Parse arguments106107var args = process.argv.slice(2),108 path = '.';
16 unmodified lines
125// Generate application126127(function createApplication(path) {128 mkdir(path, function(){52 write(path + '/app.js', 'app contents');53 mkdir(path + '/config');54 mkdir(path + '/views/partials');129 mkdir(path + '/pids');130 mkdir(path + '/logs');131 mkdir(path + '/public/{javascripts,stylesheets,images}', function(){132 write(path + '/public/stylesheets/style.sass', sass);133 });134 mkdir(path + '/views/partials', function(){135 write(path + '/views/layout.jade', jadeLayout);136 write(path + '/views/index.jade', jadeIndex);137 });138 write(path + '/app.js', app);139 });140})(path);141142/**
36 unmodified lines
modified:.pomo+1 added-6 removed
71 unmodified lines
72- !ruby/object:Pomo::Task 73 complete: false74 description: 75 length: 2576 name: next(err) from within view system?77- !ruby/object:Pomo::Task 78 complete: false79 description: 80 length: 2576 name: view defaults / extension defaults77- !ruby/object:Pomo::Task 78 complete: false79 description:
7 unmodified lines
87- !ruby/object:Pomo::Task 88 complete: false89 description: 90 length: 2596 name: view filters?91 name: view helpers