Permalink
Browse files

Merge branch 'master' into minorchanges

  • Loading branch information...
2 parents 3e281d9 + 8b543db commit a80d5fe788a2399d7c871134e09e14401754a482 @MiguelMadero committed Oct 9, 2012
Showing with 24,752 additions and 212 deletions.
  1. +1 −0 .gitignore
  2. +33 −12 bin/cli.js
  3. +12 −0 changelog.md
  4. +5 −2 deps/templato/lib/engines/ejs.js
  5. +5 −2 deps/templato/lib/engines/handlebars.js
  6. +5 −2 deps/templato/lib/engines/jade.js
  7. +4 −2 deps/templato/lib/engines/mustache.js
  8. +72 −0 docs/1-architecture.md
  9. +110 −0 docs/2-router.md
  10. +208 −0 docs/3-controllers.md
  11. +422 −0 docs/4-models.md
  12. +317 −0 docs/5-templates.md
  13. +83 −0 docs/6-CLI.md
  14. +3 −3 examples/todo_app/app/controllers/todos.js
  15. +1 −5 examples/todo_app/config/init.js
  16. +0 −60 examples/todo_app/lib/model_adapters/todo.js
  17. +6 −14 examples/todo_app_coffee/app/controllers/todos.coffee
  18. +0 −5 examples/todo_app_coffee/app/models/todo.coffee
  19. +3 −6 examples/todo_app_coffee/config/development.coffee
  20. +15 −0 examples/todo_app_coffee/config/development.coffee.mongo
  21. +0 −5 examples/todo_app_coffee/config/init.coffee
  22. +1 −1 lib/app.js
  23. +1 −1 lib/config.js
  24. +0 −31 lib/i18n/index.js
  25. +3 −5 lib/init/i18n.js
  26. 0 {site → site-old}/css/bootstrap.css
  27. 0 {site → site-old}/css/bootstrap.min.css
  28. 0 {site → site-old}/css/bootstrap.min.responsive.css
  29. 0 {site → site-old}/css/bootstrap.responsive
  30. 0 {site → site-old}/docs.html
  31. 0 {site → site-old}/features.html
  32. BIN {site → site-old}/img/glyphicons-halflings-white.png
  33. BIN {site → site-old}/img/glyphicons-halflings.png
  34. 0 {site → site-old}/index.html
  35. 0 {site → site-old}/js/bootstrap.js
  36. 0 {site → site-old}/js/bootstrap.min.js
  37. 0 {site → site-old}/js/google-code-prettify/lang-apollo.js
  38. 0 {site → site-old}/js/google-code-prettify/lang-clj.js
  39. 0 {site → site-old}/js/google-code-prettify/lang-css.js
  40. 0 {site → site-old}/js/google-code-prettify/lang-go.js
  41. 0 {site → site-old}/js/google-code-prettify/lang-hs.js
  42. 0 {site → site-old}/js/google-code-prettify/lang-lisp.js
  43. 0 {site → site-old}/js/google-code-prettify/lang-lua.js
  44. 0 {site → site-old}/js/google-code-prettify/lang-ml.js
  45. 0 {site → site-old}/js/google-code-prettify/lang-n.js
  46. 0 {site → site-old}/js/google-code-prettify/lang-proto.js
  47. 0 {site → site-old}/js/google-code-prettify/lang-scala.js
  48. 0 {site → site-old}/js/google-code-prettify/lang-sql.js
  49. 0 {site → site-old}/js/google-code-prettify/lang-tex.js
  50. 0 {site → site-old}/js/google-code-prettify/lang-vb.js
  51. 0 {site → site-old}/js/google-code-prettify/lang-vhdl.js
  52. 0 {site → site-old}/js/google-code-prettify/lang-wiki.js
  53. 0 {site → site-old}/js/google-code-prettify/lang-xq.js
  54. 0 {site → site-old}/js/google-code-prettify/lang-yaml.js
  55. 0 {site → site-old}/js/google-code-prettify/prettify.css
  56. 0 {site → site-old}/js/google-code-prettify/prettify.js
  57. 0 {site → site-old}/tutorial.html
  58. +25 −0 site/app/controllers/application.js
  59. +211 −0 site/app/controllers/main.js
  60. +68 −0 site/app/views/layouts/application.html.jade
  61. +13 −0 site/app/views/main/changelog.html.jade
  62. +54 −0 site/app/views/main/community.html.jade
  63. +19 −0 site/app/views/main/documentation.html.jade
  64. +38 −0 site/app/views/main/faq.html.jade
  65. +3 −0 site/app/views/main/index.html.jade
  66. +11 −0 site/app/views/main/tutorial.html.jade
  67. +31 −0 site/config/development.js
  68. +9 −0 site/config/environment.js
  69. +15 −0 site/config/init.js
  70. +32 −0 site/config/production.js
  71. +29 −0 site/config/router.js
  72. +1 −0 site/node_modules/.bin/jade
  73. +1 −0 site/node_modules/.bin/marked
  74. +14 −0 site/node_modules/jade/.npmignore
  75. +22 −0 site/node_modules/jade/LICENSE
  76. +1,299 −0 site/node_modules/jade/Readme.md
  77. +168 −0 site/node_modules/jade/bin/jade
  78. +4 −0 site/node_modules/jade/index.js
  79. +3,586 −0 site/node_modules/jade/jade.js
  80. +510 −0 site/node_modules/jade/jade.md
  81. +2 −0 site/node_modules/jade/jade.min.js
  82. +654 −0 site/node_modules/jade/lib/compiler.js
  83. +18 −0 site/node_modules/jade/lib/doctypes.js
  84. +97 −0 site/node_modules/jade/lib/filters.js
  85. +28 −0 site/node_modules/jade/lib/inline-tags.js
  86. +253 −0 site/node_modules/jade/lib/jade.js
  87. +774 −0 site/node_modules/jade/lib/lexer.js
  88. +77 −0 site/node_modules/jade/lib/nodes/attrs.js
  89. +33 −0 site/node_modules/jade/lib/nodes/block-comment.js
  90. +122 −0 site/node_modules/jade/lib/nodes/block.js
  91. +43 −0 site/node_modules/jade/lib/nodes/case.js
  92. +35 −0 site/node_modules/jade/lib/nodes/code.js
  93. +32 −0 site/node_modules/jade/lib/nodes/comment.js
  94. +29 −0 site/node_modules/jade/lib/nodes/doctype.js
  95. +35 −0 site/node_modules/jade/lib/nodes/each.js
  96. +35 −0 site/node_modules/jade/lib/nodes/filter.js
  97. +20 −0 site/node_modules/jade/lib/nodes/index.js
  98. +32 −0 site/node_modules/jade/lib/nodes/literal.js
  99. +36 −0 site/node_modules/jade/lib/nodes/mixin.js
  100. +25 −0 site/node_modules/jade/lib/nodes/node.js
  101. +95 −0 site/node_modules/jade/lib/nodes/tag.js
  102. +36 −0 site/node_modules/jade/lib/nodes/text.js
  103. +715 −0 site/node_modules/jade/lib/parser.js
  104. +174 −0 site/node_modules/jade/lib/runtime.js
  105. +19 −0 site/node_modules/jade/lib/self-closing.js
  106. +64 −0 site/node_modules/jade/lib/utils.js
  107. +4 −0 site/node_modules/jade/node_modules/commander/.npmignore
  108. +4 −0 site/node_modules/jade/node_modules/commander/.travis.yml
  109. +107 −0 site/node_modules/jade/node_modules/commander/History.md
  110. +7 −0 site/node_modules/jade/node_modules/commander/Makefile
  111. +262 −0 site/node_modules/jade/node_modules/commander/Readme.md
  112. +2 −0 site/node_modules/jade/node_modules/commander/index.js
  113. +1,026 −0 site/node_modules/jade/node_modules/commander/lib/commander.js
  114. +34 −0 site/node_modules/jade/node_modules/commander/package.json
  115. +2 −0 site/node_modules/jade/node_modules/mkdirp/.npmignore
  116. +4 −0 site/node_modules/jade/node_modules/mkdirp/.travis.yml
  117. +21 −0 site/node_modules/jade/node_modules/mkdirp/LICENSE
  118. +61 −0 site/node_modules/jade/node_modules/mkdirp/README.markdown
  119. +6 −0 site/node_modules/jade/node_modules/mkdirp/examples/pow.js
  120. +82 −0 site/node_modules/jade/node_modules/mkdirp/index.js
  121. +32 −0 site/node_modules/jade/node_modules/mkdirp/package.json
  122. +38 −0 site/node_modules/jade/node_modules/mkdirp/test/chmod.js
  123. +37 −0 site/node_modules/jade/node_modules/mkdirp/test/clobber.js
  124. +28 −0 site/node_modules/jade/node_modules/mkdirp/test/mkdirp.js
  125. +32 −0 site/node_modules/jade/node_modules/mkdirp/test/perm.js
  126. +39 −0 site/node_modules/jade/node_modules/mkdirp/test/perm_sync.js
  127. +41 −0 site/node_modules/jade/node_modules/mkdirp/test/race.js
  128. +32 −0 site/node_modules/jade/node_modules/mkdirp/test/rel.js
  129. +25 −0 site/node_modules/jade/node_modules/mkdirp/test/return.js
  130. +24 −0 site/node_modules/jade/node_modules/mkdirp/test/return_sync.js
  131. +18 −0 site/node_modules/jade/node_modules/mkdirp/test/root.js
  132. +32 −0 site/node_modules/jade/node_modules/mkdirp/test/sync.js
  133. +28 −0 site/node_modules/jade/node_modules/mkdirp/test/umask.js
  134. +32 −0 site/node_modules/jade/node_modules/mkdirp/test/umask_sync.js
  135. +47 −0 site/node_modules/jade/package.json
  136. +179 −0 site/node_modules/jade/runtime.js
  137. +1 −0 site/node_modules/jade/runtime.min.js
  138. +7 −0 site/node_modules/jade/test.jade
  139. +5 −0 site/node_modules/jade/testing/head.jade
  140. +1 −0 site/node_modules/jade/testing/index.jade
  141. +14 −0 site/node_modules/jade/testing/index.js
  142. +10 −0 site/node_modules/jade/testing/layout.jade
  143. +7 −0 site/node_modules/jade/testing/user.jade
  144. +27 −0 site/node_modules/jade/testing/user.js
  145. +2 −0 site/node_modules/marked/.npmignore
  146. +19 −0 site/node_modules/marked/LICENSE
  147. +9 −0 site/node_modules/marked/Makefile
  148. +125 −0 site/node_modules/marked/README.md
  149. +127 −0 site/node_modules/marked/bin/marked
  150. +1 −0 site/node_modules/marked/index.js
  151. +791 −0 site/node_modules/marked/lib/marked.js
  152. +49 −0 site/node_modules/marked/man/marked.1
  153. +40 −0 site/node_modules/marked/package.json
  154. +5,774 −0 site/public/css/bootstrap.css
  155. +9 −0 site/public/css/bootstrap.min.css
  156. +1,058 −0 site/public/css/bootstrap.responsive.css
  157. +9 −0 site/public/css/bootstrap.responsive.min.css
  158. +507 −0 site/public/css/style.css
  159. BIN site/public/favicon.ico
  160. BIN site/public/img/changelog-dark-72.png
  161. BIN site/public/img/changelog-light-72.png
  162. BIN site/public/img/community-dark-72.png
  163. BIN site/public/img/community-light-72.png
  164. BIN site/public/img/docs-dark-72.png
  165. BIN site/public/img/docs-light-72.png
  166. BIN site/public/img/faq-dark-72.png
  167. BIN site/public/img/faq-light-72.png
  168. BIN site/public/img/glyphicons-halflings-white.png
  169. BIN site/public/img/glyphicons-halflings.png
  170. BIN site/public/img/home-dark-72.png
  171. BIN site/public/img/home-light-72.png
  172. BIN site/public/img/tuts-dark-72.png
  173. BIN site/public/img/tuts-light-72.png
  174. BIN site/public/img/whitey.png
  175. +2,027 −0 site/public/js/bootstrap.js
  176. +6 −0 site/public/js/bootstrap.min.js
  177. +2 −0 site/public/js/jquery.min.js
  178. +94 −0 site/public/js/site.js
  179. +84 −47 templates/Jakefile
  180. +6 −0 templates/base/Jakefile.ejs
  181. +1 −1 templates/base/public/js/jquery.min.js
  182. +3 −4 templates/resource/model.ejs
  183. +12 −0 templates/resource/test.ejs
  184. +3 −4 templates/scaffold/model.ejs
  185. +680 −0 tutorial.md
View
@@ -11,6 +11,7 @@ node_modules
tmtags
*.DS_Store
examples/*/log/*
+site/log/*
.log
npm-debug.log
doc/
View
@@ -21,6 +21,9 @@ var cwd = process.cwd()
, filepath
, die
, jake
+ , jakeArgs
+ , jakeProgram
+ , jakeLoader
, start;
// Usage dialog
@@ -127,9 +130,11 @@ 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] == 'console') && !cmds[1]) {
+ cmds[0] == 'console')
+ && !cmds[1]) {
throw new Error(cmds[0] + ' command requires another argument.');
}
@@ -149,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') + ']';
@@ -190,13 +199,26 @@ if (cmds.length) {
}
jake = require('jake');
- jake.program.init({
- quiet: !opts.debug
- , trace: true
- });
- jake.loader.loadFile(filepath);
- jake.program.setTaskNames([cmd]);
- jake.program.run();
+ 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 {
+ jakeProgram.init({
+ quiet: !opts.debug
+ , trace: true
+ });
+ jakeProgram.setTaskNames([cmd]);
+ }
+ jakeProgram.run();
}
// Just `geddy` -- start the server
else {
@@ -205,8 +227,7 @@ else {
if (err) {
die(usage);
}
- else {
- start();
- }
+
+ start();
});
}
View
@@ -0,0 +1,12 @@
+### 0.5.0
++ removed models from geddy core
++ removed utilities from geddy core
++ removed router from geddy core
++ 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
++ added the `geddy exec` command
++ added a ton of tests
++ a ton of minor bug fixes
++ created a new website
@@ -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 it's models, controllers, and views as well as config files and routes.
+
+* * *
+
+#### structure
+
+```
+├── app
+│   ├── controllers
+│   │   ├── application.js
+│   │   └── main.js
+│   ├── helpers
+│   ├── models
+│   └── views
+│   ├── layouts
+│   │   └── application.html.jade
+│   └── main
+│   └── index.html.jade
+├── 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
+```
+
+* * *
View
@@ -0,0 +1,110 @@
+Geddy uses [Barista](http://github.com/kieran/barista) as it's router. Its API is very similar to rails routes. Both general purpose resource based routes and individually defined routes are possible.
+
+* * *
+
+#### .match
+`router.match( path [, method] )`
+
+defines the url to match to a controller action.
+
+##### path
+- `path [string]`: the url to match to an action
+
+##### method
+- `method [string]`: the http method to match
+
+##### examples
+```
+router.match(‘/‘).to(‘Main.index’);
+// will route any request to ‘/‘ to the Main controller’s index action
+
+
+router.match( '/products/:id', 'GET' ).to( 'products.show' )
+// will route ‘/products/5’ to Products.show()
+// and set the id paramer to be 5
+
+
+router.match( '/profiles/:username', 'GET' ).to( 'users.show' )
+// will route ‘/products/dan’ to Users.show()
+// and set the username paramer to be dan
+
+
+router.match( '/products/:id(.:format)', 'GET' ).to( 'products.show' )
+// things enclosed in parentheses are optional
+```
+
+* * *
+
+#### .to
+`router.match( path ).to( action )`
+
+defines the action to map the path to.
+
+##### action
+- `action [string]`: a controller name plus an action name as a string
+- `action [object]`: an object that defines a controller and action property
+
+##### examples
+```
+router.match(‘/‘).to(‘Main.index’);
+// will route any request to ‘/‘ to the Main controller’s index action
+
+
+router.match(‘/‘).to({controller: ‘Main’, action: ‘index’});
+// will route any request to ‘/‘ to the Main controller’s index action
+```
+
+* * *
+
+#### .get
+`router.get( path )`
+
+Equivalent to `router.match( path, 'GET' )`
+
+* * *
+
+#### .post
+`router.post( path )`
+
+Equivalent to `router.match( path, ‘POST’ )`
+
+* * *
+
+#### .put
+`router.put( path )`
+
+Equivalent to `router.match( path, ‘PUT’ )`
+
+* * *
+
+#### .del
+`router.del( path )`
+
+Equivalent to `router.match( path, ‘DELETE’ )`
+
+* * *
+
+#### .resource
+`router.resource( controller )`
+
+generates standard resource routes for a controller name
+
+##### controller
+- `controller [string]`: the camelCased controller name that needs resourceful routes
+
+##### examples
+```
+router.resource( 'products' )
+
+// is equivalent to:
+
+router.get( '/products(.:format)' ).to( 'products.index' )
+router.get( '/products/add(.:format)' ).to( 'products.add' )
+router.get( '/products/:id(.:format)' ).to('products.show' )
+router.get('/products/:id/edit(.:format)' ).to( 'products.edit' )
+router.post('/products(.:format)' ).to( 'products.create' )
+router.put('/products/:id(.:format)' ).to( 'products.update' )
+router.del('/products/:id(.:format)' ).to( 'products.destroy' )
+```
+
+* * *
Oops, something went wrong.

0 comments on commit a80d5fe

Please sign in to comment.