Permalink
Browse files

Merge branch 'master' into feature/socket.io-mvc

  • Loading branch information...
2 parents 5d0b8b9 + 784ea41 commit 230c09b972bf912b876fb821b7c4324095acfcee Techwraith committed Oct 17, 2012
Showing with 4,249 additions and 9,969 deletions.
  1. +1 −0 .gitignore
  2. +25 −15 README.md
  3. +27 −23 bin/cli.js
  4. +13 −0 changelog.md
  5. +5 −2 deps/templato/lib/engines/ejs.js
  6. +5 −2 deps/templato/lib/engines/handlebars.js
  7. +5 −2 deps/templato/lib/engines/jade.js
  8. +4 −2 deps/templato/lib/engines/mustache.js
  9. +72 −0 docs/1-architecture.md
  10. +110 −0 docs/2-router.md
  11. +210 −0 docs/3-controllers.md
  12. +548 −0 docs/4-models.md
  13. +333 −0 docs/5-templates.md
  14. +83 −0 docs/6-CLI.md
  15. +55 −0 docs/7-sessions.md
  16. +59 −0 docs/8-deployment.md
  17. +3 −3 examples/todo_app/app/controllers/todos.js
  18. +1 −5 examples/todo_app/config/init.js
  19. +0 −60 examples/todo_app/lib/model_adapters/todo.js
  20. +6 −14 examples/todo_app_coffee/app/controllers/todos.coffee
  21. +0 −5 examples/todo_app_coffee/app/models/todo.coffee
  22. +3 −6 examples/todo_app_coffee/config/development.coffee
  23. +15 −0 examples/todo_app_coffee/config/development.coffee.mongo
  24. +0 −5 examples/todo_app_coffee/config/init.coffee
  25. +1 −1 lib/app.js
  26. +18 −5 lib/cluster/worker.js
  27. +2 −2 lib/config.js
  28. +0 −31 lib/i18n/index.js
  29. +3 −5 lib/init/i18n.js
  30. +2 −1 lib/model/datatypes.js
  31. +1 −1 lib/model/index.js
  32. +1 −1 lib/model/validators.js
  33. +10 −0 lib/template/helpers/utils.js
  34. +2 −2 package.json
  35. +0 −3,363 site-old/css/bootstrap.css
  36. +0 −610 site-old/css/bootstrap.min.css
  37. +0 −3 site-old/css/bootstrap.min.responsive.css
  38. +0 −567 site-old/css/bootstrap.responsive
  39. +0 −176 site-old/docs.html
  40. +0 −459 site-old/features.html
  41. BIN site-old/img/glyphicons-halflings-white.png
  42. BIN site-old/img/glyphicons-halflings.png
  43. +0 −153 site-old/index.html
  44. +0 −1,722 site-old/js/bootstrap.js
  45. +0 −1 site-old/js/bootstrap.min.js
  46. +0 −2 site-old/js/google-code-prettify/lang-apollo.js
  47. +0 −18 site-old/js/google-code-prettify/lang-clj.js
  48. +0 −2 site-old/js/google-code-prettify/lang-css.js
  49. +0 −1 site-old/js/google-code-prettify/lang-go.js
  50. +0 −2 site-old/js/google-code-prettify/lang-hs.js
  51. +0 −3 site-old/js/google-code-prettify/lang-lisp.js
  52. +0 −2 site-old/js/google-code-prettify/lang-lua.js
  53. +0 −2 site-old/js/google-code-prettify/lang-ml.js
  54. +0 −4 site-old/js/google-code-prettify/lang-n.js
  55. +0 −1 site-old/js/google-code-prettify/lang-proto.js
  56. +0 −2 site-old/js/google-code-prettify/lang-scala.js
  57. +0 −2 site-old/js/google-code-prettify/lang-sql.js
  58. +0 −1 site-old/js/google-code-prettify/lang-tex.js
  59. +0 −2 site-old/js/google-code-prettify/lang-vb.js
  60. +0 −3 site-old/js/google-code-prettify/lang-vhdl.js
  61. +0 −2 site-old/js/google-code-prettify/lang-wiki.js
  62. +0 −3 site-old/js/google-code-prettify/lang-xq.js
  63. +0 −2 site-old/js/google-code-prettify/lang-yaml.js
  64. +0 −53 site-old/js/google-code-prettify/prettify.css
  65. +0 −28 site-old/js/google-code-prettify/prettify.js
  66. +0 −648 site-old/tutorial.html
  67. +175 −1 site/app/controllers/main.js
  68. +26 −12 site/app/views/layouts/application.html.jade
  69. +13 −0 site/app/views/main/changelog.html.jade
  70. +39 −30 site/app/views/main/community.html.jade
  71. +19 −0 site/app/views/main/documentation.html.jade
  72. +46 −0 site/app/views/main/faq.html.jade
  73. +11 −0 site/app/views/main/tutorial.html.jade
  74. +5 −24 site/config/router.js
  75. 0 site/log/access.2012-10-03T13:14:59.log
  76. 0 site/log/access.2012-10-03T13:15:46.log
  77. +0 −914 site/log/access.2012-10-03T16:35:18.log
  78. +0 −15 site/log/access.2012-10-03T16:44:21.log
  79. +0 −616 site/log/access.2012-10-04T01:57:01.log
  80. +0 −27 site/log/access.log
  81. +0 −1 site/log/stderr.2012-10-03T13:14:59.log
  82. +0 −1 site/log/stderr.2012-10-03T13:15:46.log
  83. 0 site/log/stderr.2012-10-03T16:35:18.log
  84. 0 site/log/stderr.2012-10-03T16:44:21.log
  85. +0 −2 site/log/stderr.2012-10-04T01:57:01.log
  86. +0 −1 site/log/stderr.log
  87. +0 −35 site/log/stdout.2012-10-03T13:14:59.log
  88. +0 −35 site/log/stdout.2012-10-03T13:15:46.log
  89. +0 −40 site/log/stdout.2012-10-03T16:35:18.log
  90. +0 −55 site/log/stdout.2012-10-03T16:44:21.log
  91. +0 −35 site/log/stdout.2012-10-04T01:57:01.log
  92. +0 −35 site/log/stdout.log
  93. +1 −0 site/node_modules/.bin/marked
  94. +1 −1 site/node_modules/jade/lib/jade.js
  95. +3 −2 site/node_modules/jade/lib/parser.js
  96. +16 −1 site/node_modules/jade/lib/utils.js
  97. +0 −3 site/node_modules/jade/node_modules/commander/package.json
  98. +0 −3 site/node_modules/jade/node_modules/mkdirp/package.json
  99. +3 −3 site/node_modules/jade/package.json
  100. +2 −0 site/node_modules/marked/.npmignore
  101. +19 −0 site/node_modules/marked/LICENSE
  102. +9 −0 site/node_modules/marked/Makefile
  103. +125 −0 site/node_modules/marked/README.md
  104. +127 −0 site/node_modules/marked/bin/marked
  105. +1 −0 site/node_modules/marked/index.js
  106. +791 −0 site/node_modules/marked/lib/marked.js
  107. +49 −0 site/node_modules/marked/man/marked.1
  108. +40 −0 site/node_modules/marked/package.json
  109. +262 −14 site/public/css/style.css
  110. BIN site/public/img/changelog-dark-72.png
  111. BIN site/public/img/changelog-light-72.png
  112. BIN site/public/img/community-dark-72.png
  113. BIN site/public/img/community-light-72.png
  114. BIN site/public/img/docs-dark-72.png
  115. BIN site/public/img/docs-light-72.png
  116. BIN site/public/img/faq-dark-72.png
  117. BIN site/public/img/faq-light-72.png
  118. BIN site/public/img/home-dark-72.png
  119. BIN site/public/img/home-light-72.png
  120. BIN site/public/img/tuts-dark-72.png
  121. BIN site/public/img/tuts-light-72.png
  122. +1 −1 site/public/js/jquery.min.js
  123. +94 −0 site/public/js/site.js
  124. +42 −20 templates/Jakefile
  125. +1 −1 templates/base/public/js/jquery.min.js
  126. +10 −5 templates/resource/model.ejs
  127. +5 −6 templates/scaffold/model.ejs
  128. +10 −0 test/templates/helpers/helpers.js
  129. +680 −0 tutorial.md
View
@@ -11,6 +11,7 @@ node_modules
tmtags
*.DS_Store
examples/*/log/*
+site/log/*
.log
npm-debug.log
doc/
View
@@ -1,8 +1,21 @@
-## Geddy web framework for Node.js
-- - -
+# Geddy
+####A simple, structured web framework for Node
+
+```
+$ npm install -g geddy
+$ geddy app my_app
+$ cd my_app
+$ geddy
+// app now running on localhost:4000
+```
+
[![build status](https://secure.travis-ci.org/mde/geddy.png)](http://travis-ci.org/mde/geddy)
+### Documentation
+
+Docs are located on the GeddyJS website: http://geddyjs.org/documentation
+
### Goals
* Easy to use
@@ -16,6 +29,7 @@ but still let you get under the hood and tinker if you want.
* Powerful, flexible router
* Easy resource-based routing
+ * Database adapters for Postgres, MongoDB, Riak, and in-memory
* App, resource and scaffold generators
* Content-negotiation
* Session support (in-memory, cookie)
@@ -33,6 +47,15 @@ Apache License, Version 2
Geddy requires version 0.6.x of Node.js or higher, and the
[Jake](https://github.com/mde/jake) JavaScript build-tool.
+### Installing with [NPM](http://npmjs.org/)
+
+```
+[sudo] npm -g install geddy
+```
+
+Note: Geddy (specifically, the generators) is a system-level
+tool, and wants to be installed globally.
+
### Installing from Github
To get Geddy from Github and install it do:
@@ -57,15 +80,6 @@ If you do install Geddy somewhere special, you'll need to add the
"bin" directory in the install target to your PATH to get access
to the `geddy` executable.
-### Installing with [NPM](http://npmjs.org/)
-
-```
-[sudo] npm -g install geddy
-```
-
-Note: Geddy (specifically, the generators) is a system-level
-tool, and wants to be installed globally.
-
### Creating a Geddy application
To create Geddy applications simply run `geddy app <name>`.
@@ -356,10 +370,6 @@ In the geddy project directory, run `jake test`. The tests simply
use NodeJS's `assert` library, which throws an error on failure.
If there are no errors, the tests all ran successfully.
-## API Docs
-
-API docs [can be found here](http://mde.github.com/geddy/doc/).
-
- - -
Geddy Web-app development framework copyright 2112
mde@fleegix.org.
View
@@ -21,6 +21,9 @@ var cwd = process.cwd()
, filepath
, die
, jake
+ , jakeArgs
+ , jakeProgram
+ , jakeLoader
, start;
// Usage dialog
@@ -46,14 +49,15 @@ usage = [
, ' --version, -v Output the version of Geddy that\'s installed'
, ''
, 'Commands:'
+ , ' console Start up the Geddy REPL'
, ' app <name> Create a new Geddy application'
, ' resource <name> [attrs] Create a new resource. A resource includes'
, ' a model, controller and route'
, ' scaffold <name> [attrs] Create a new scaffolding. Scaffolding includes'
, ' the views, a model, controller and route'
, ' secret Generate a new application secret in'
, ' `congig/environment`'
- , ' controller <name> Generate a new controller including an index view'
+ , ' controller <name> Generate a new controller including an index view'
, ' and and a route'
, ' model <name> [attrs] Generate a new model'
, ''
@@ -126,9 +130,9 @@ if (cmds.length) {
cmd = '';
// Some commands take only one arg
- if (!(cmds[0] == 'secret' ||
+ if (!(cmds[0] == 'jake' ||
+ cmds[0] == 'secret' ||
cmds[0] == 'db:init' ||
- cmds[0].indexOf('test') === 0 ||
cmds[0] == 'console')
&& !cmds[1]) {
throw new Error(cmds[0] + ' command requires another argument.');
@@ -150,6 +154,10 @@ if (cmds.length) {
// Add Jake argument based on commands
switch (cmds[0]) {
+ case 'jake':
+ cmd = 'jake';
+ jakeArgs = cmds.slice(1);
+ break;
case 'console':
// Create DBs
cmd += 'console:start[' + (cmds[1] || 'development') + ']';
@@ -158,12 +166,6 @@ if (cmds.length) {
// Create DBs
cmd += 'db:init';
break;
- case 'test':
- cmd = 'test';
- if (cmds[1]) {
- cmd += '[' + cmds[1] + ']'
- }
- break;
case 'db:createTable':
// Create DBs
cmd += 'db:createTable[' + cmds[1] + ']';
@@ -197,23 +199,26 @@ if (cmds.length) {
}
jake = require('jake');
- jake.loader.loadFile(filepath);
- if (cmd.indexOf('test') === 0) {
- jake.loader.loadFile(path.join(process.cwd(), 'Jakefile'));
- // Load up the Geddy env before running
- jake.program.setTaskNames(['env:init', cmd]);
- jake.program.init({
- trace: true
- });
+ jakeProgram = jake.program;
+ jakeLoader = jake.loader;
+ // Load Geddy's bundled Jakefile
+ jakeLoader.loadFile(filepath);
+ if (cmd == 'jake') {
+ jakeProgram.parseArgs(jakeArgs);
+ // Load Jakefile and jakelibdir files for app
+ jakeLoader.loadFile(jakeProgram.opts.jakefile);
+ jakeLoader.loadDirectory(jakeProgram.opts.jakelibdir);
+ // Prepend env:init to load Geddy env
+ jakeProgram.taskNames.unshift('env:init');
}
else {
- jake.program.init({
+ jakeProgram.init({
quiet: !opts.debug
, trace: true
});
- jake.program.setTaskNames([cmd]);
+ jakeProgram.setTaskNames([cmd]);
}
- jake.program.run();
+ jakeProgram.run();
}
// Just `geddy` -- start the server
else {
@@ -222,8 +227,7 @@ else {
if (err) {
die(usage);
}
- else {
- start();
- }
+
+ start();
});
}
View
@@ -0,0 +1,13 @@
+### 0.5
++ Brand new Web site with extensive docs
++ Removed models from geddy core, moved into Model project
++ Removed utilities from geddy core, moved into Utilities project
++ Removed router from geddy core, replaced with Barista
++ Added view helpers
++ Added [model](https://github.com/mde/model) as a dependency
++ Added [utilities](https://github.com/mde/utilities) as a dependency
++ Added [barista](https://github.com/kieran/barista) as a dependency
++ Added the `geddy console` command for CLI access to apps
++ Added the `geddy jake` command to run Jake tasks in the app environment
++ Added a ton of tests
++ Fixed a ton of bugs
@@ -1,8 +1,11 @@
-var TemplatoEJS = (function() {
+var path = require('path')
+ , TemplatoEJS;
+
+TemplatoEJS = (function() {
function TemplatoEJS() {
try {
- this.engine = this.engine || require('ejs');
+ this.engine = this.engine || require(path.join(process.cwd(), 'node_modules', 'ejs'));
} catch(err) {
throw "To use EJS you will need to install it: [sudo] npm install [-g] ejs";
}
@@ -1,8 +1,11 @@
-var TemplatoHandlebars = (function() {
+var path = require('path')
+ , TemplatoHandlebars;
+
+TemplatoHandlebars = (function() {
function TemplatoHandlebars() {
try {
- this.engine = this.engine || require('handlebars');
+ this.engine = this.engine || require(path.join(process.cwd(), 'node_modules', 'handlebars'));
} catch(err) {
throw "To use Handlebars you will need to install it: [sudo] npm install [-g] handlebars";
}
@@ -1,8 +1,11 @@
-var TemplatoJade = (function() {
+var path = require('path')
+ , TemplatoJade;
+
+TemplatoJade = (function() {
function TemplatoJade() {
try {
- this.engine = this.engine || require('jade');
+ this.engine = this.engine || require(path.join(process.cwd(), 'node_modules', 'jade'));
} catch(err) {
throw "To use Jade you will need to install it: [sudo] npm install [-g] jade";
}
@@ -1,10 +1,12 @@
require('../../color');
+var path = require('path')
+ , TemplatoMustache;
-var TemplatoMustache = (function() {
+TemplatoMustache = (function() {
function TemplatoMustache() {
try {
- this.engine = this.engine || require('handlebars');
+ this.engine = this.engine || require(path.join(process.cwd(), 'node_modules', 'mustache'));
} catch(err) {
throw [
"To use Handlebars you will need to install it: [sudo] npm install [-g] handlebars"
View
@@ -0,0 +1,72 @@
+Geddy is built on the same MVC principles that many popular frameworks are based on. Every Geddy app has its models, controllers, and views as well as config files and routes.
+
+* * *
+
+#### structure
+
+```
+├── app
+│   ├── controllers
+│   │   ├── application.js
+│   │   └── main.js
+│   ├── helpers
+│   ├── models
+│   └── views
+│   ├── layouts
+│   │   └── application.html.ejs
+│   └── main
+│   └── index.html.ejs
+├── config
+ ├── development.js
+ ├── environment.js
+ ├── init.js
+ ├── production.js
+ └── router.js
+├── lib
+├── log
+├── node_modules
+└── public
+```
+
+* * *
+
+#### config
+`geddy.config`
+
+Geddy has built in configuration management. Global config options should go in your 'config/environments.js` file. Likewise, your production and development config options should go in their respective files
+
+If you want to start up your app in a specific environment, use the `-e` option:
+
+```
+$ geddy -e production
+```
+
+* * *
+
+#### logger
+`geddy.log[level]`
+
+Geddy automatically logs requests to an access log, and you can log anything you'd like to stdout or a file. It supports 9 different log levels from debug to emergency.
+
+##### levels
+- `access`: outputs to the access log and stdout
+- `debug`: debug level logging
+- `info`: info level logging
+- `notice`: notice level logging
+- `warning`: warning level logging
+- `error`: error level logging, prints to stdout and stderr
+- `critical`: critical level logging
+- `alert`: alert level logging
+- `emergency`: emergency level logging
+
+##### examples
+```
+geddy.log.debug('someting to debug')
+// prints `something to debug` to the console
+
+
+geddy.log.error('something went wrong')
+// prints 'something went wrong' to stderr and the console
+```
+
+* * *
Oops, something went wrong.

0 comments on commit 230c09b

Please sign in to comment.