Permalink
Browse files

more restructuring for the great code seperation

  • Loading branch information...
1 parent 8d50a9b commit 9ad33c43969a501327546e1d9ed0ac308378fef4 @brianleroux brianleroux committed Jun 9, 2010
Showing with 17,184 additions and 19 deletions.
  1. +15 −16 README.md
  2. +90 −0 node-code-blog/README.md
  3. +20 −0 node-code-blog/lib/express-clean-config/express-clean-config.js
  4. +7 −0 node-code-blog/lib/express/.gitignore
  5. +9 −0 node-code-blog/lib/express/lib/express.js
  6. +327 −0 node-code-blog/lib/express/lib/express/core.js
  7. +161 −0 node-code-blog/lib/express/lib/express/dsl.js
  8. +29 −0 node-code-blog/lib/express/lib/express/event.js
  9. +115 −0 node-code-blog/lib/express/lib/express/http.js
  10. +370 −0 node-code-blog/lib/express/lib/express/mime.js
  11. +29 −0 node-code-blog/lib/express/lib/express/pages/not-found.js
  12. +137 −0 node-code-blog/lib/express/lib/express/pages/show-exceptions.js
  13. +99 −0 node-code-blog/lib/express/lib/express/pages/style.js
  14. +43 −0 node-code-blog/lib/express/lib/express/plugin.js
  15. +12 −0 node-code-blog/lib/express/lib/express/plugins.js
  16. +28 −0 node-code-blog/lib/express/lib/express/plugins/body-decoder.js
  17. +234 −0 node-code-blog/lib/express/lib/express/plugins/cache.js
  18. +18 −0 node-code-blog/lib/express/lib/express/plugins/content-length.js
  19. +121 −0 node-code-blog/lib/express/lib/express/plugins/cookie.js
  20. +67 −0 node-code-blog/lib/express/lib/express/plugins/flash.js
  21. +73 −0 node-code-blog/lib/express/lib/express/plugins/hooks.js
  22. +83 −0 node-code-blog/lib/express/lib/express/plugins/logger.js
  23. +16 −0 node-code-blog/lib/express/lib/express/plugins/method-override.js
  24. +65 −0 node-code-blog/lib/express/lib/express/plugins/redirect.js
  25. +233 −0 node-code-blog/lib/express/lib/express/plugins/session.js
  26. +94 −0 node-code-blog/lib/express/lib/express/plugins/static.js
  27. +182 −0 node-code-blog/lib/express/lib/express/plugins/view.js
  28. +440 −0 node-code-blog/lib/express/lib/express/request.js
  29. +2 −0 node-code-blog/lib/express/lib/express/spec.js
  30. +178 −0 node-code-blog/lib/express/lib/express/spec/mocks.js
  31. +76 −0 node-code-blog/lib/express/lib/express/utils.js
  32. +73 −0 node-code-blog/lib/express/lib/support/class/lib/class.js
  33. +26 −0 node-code-blog/lib/express/lib/support/ejs/lib/ejs.js
  34. +45 −0 node-code-blog/lib/express/lib/support/ext/lib/ext.js
  35. +100 −0 node-code-blog/lib/express/lib/support/ext/lib/ext/base64.js
  36. +12 −0 node-code-blog/lib/express/lib/support/ext/lib/ext/core_ext.js
  37. +7 −0 node-code-blog/lib/express/lib/support/ext/lib/ext/core_ext/array.js
  38. +65 −0 node-code-blog/lib/express/lib/support/ext/lib/ext/core_ext/array/collections.js
  39. +83 −0 node-code-blog/lib/express/lib/support/ext/lib/ext/core_ext/array/enumerable.js
  40. +250 −0 node-code-blog/lib/express/lib/support/ext/lib/ext/core_ext/array/extensions.js
  41. +6 −0 node-code-blog/lib/express/lib/support/ext/lib/ext/core_ext/date.js
  42. +211 −0 node-code-blog/lib/express/lib/support/ext/lib/ext/core_ext/date/extensions.js
  43. +272 −0 node-code-blog/lib/express/lib/support/ext/lib/ext/core_ext/date/parser.js
  44. +29 −0 node-code-blog/lib/express/lib/support/ext/lib/ext/core_ext/error.js
  45. +41 −0 node-code-blog/lib/express/lib/support/ext/lib/ext/core_ext/function.js
  46. +277 −0 node-code-blog/lib/express/lib/support/ext/lib/ext/core_ext/number.js
  47. +5 −0 node-code-blog/lib/express/lib/support/ext/lib/ext/core_ext/object.js
  48. +64 −0 node-code-blog/lib/express/lib/support/ext/lib/ext/core_ext/object/extensions.js
  49. +24 −0 node-code-blog/lib/express/lib/support/ext/lib/ext/core_ext/regexp.js
  50. +6 −0 node-code-blog/lib/express/lib/support/ext/lib/ext/core_ext/string.js
  51. +186 −0 node-code-blog/lib/express/lib/support/ext/lib/ext/core_ext/string/extensions.js
  52. +224 −0 node-code-blog/lib/express/lib/support/ext/lib/ext/core_ext/string/inflections.js
  53. +225 −0 node-code-blog/lib/express/lib/support/ext/lib/ext/md5.js
  54. +139 −0 node-code-blog/lib/express/lib/support/ext/lib/ext/printf.js
  55. +3 −0 node-code-blog/lib/express/lib/support/haml/.gitmodules
  56. +1 −0 node-code-blog/lib/express/lib/support/haml/.ignore
  57. +640 −0 node-code-blog/lib/express/lib/support/haml/lib/haml.js
  58. +8 −0 node-code-blog/lib/express/lib/support/multipart/lib/multipart.js
  59. +436 −0 node-code-blog/lib/express/lib/support/multipart/lib/old.js
  60. +342 −0 node-code-blog/lib/express/lib/support/multipart/lib/parse.js
  61. +13 −0 node-code-blog/lib/express/lib/support/multipart/lib/utils.js
  62. +118 −0 node-code-blog/lib/express/lib/support/multipart/lib/write.js
  63. +7 −0 node-code-blog/lib/express/lib/support/sass/.gitignore
  64. +299 −0 node-code-blog/lib/express/lib/support/sass/lib/sass.js
  65. +154 −0 node-code-blog/lib/node-code-blog-themes/wtfjs/public/app.css
  66. +4 −0 node-code-blog/lib/node-code-blog-themes/wtfjs/public/app.js
  67. BIN node-code-blog/lib/node-code-blog-themes/wtfjs/public/favicon.ico
  68. +154 −0 node-code-blog/lib/node-code-blog-themes/wtfjs/public/jquery-1.4.2.min.js
  69. +71 −0 node-code-blog/lib/node-code-blog-themes/wtfjs/views/about.html.ejs
  70. +1 −0 node-code-blog/lib/node-code-blog-themes/wtfjs/views/archive.html.ejs
  71. +18 −0 node-code-blog/lib/node-code-blog-themes/wtfjs/views/index.html.ejs
  72. +39 −0 node-code-blog/lib/node-code-blog-themes/wtfjs/views/layout.html.ejs
  73. +1 −0 node-code-blog/lib/node-code-blog-themes/wtfjs/views/post.html.ejs
  74. +1,493 −0 node-code-blog/lib/prettyfy/prettyfy.js
  75. +419 −0 node-code-blog/lib/showdown-v0.9/compressed/showdown.js
  76. +720 −0 node-code-blog/lib/showdown-v0.9/example/showdown-gui.html
  77. +349 −0 node-code-blog/lib/showdown-v0.9/example/showdown-gui.js
  78. +1,296 −0 node-code-blog/lib/showdown-v0.9/example/showdown.js
  79. +34 −0 node-code-blog/lib/showdown-v0.9/license.txt
  80. +30 −0 node-code-blog/lib/showdown-v0.9/perlMarkdown/Markdown License.txt
  81. +1,509 −0 node-code-blog/lib/showdown-v0.9/perlMarkdown/Markdown-1.0.2b2.pl
  82. +1,642 −0 node-code-blog/lib/showdown-v0.9/perlMarkdown/Markdown-1.0.2b7.pl
  83. +13 −0 node-code-blog/lib/showdown-v0.9/perlMarkdown/readme.txt
  84. +156 −0 node-code-blog/lib/showdown-v0.9/readme.txt
  85. +1,301 −0 node-code-blog/lib/showdown-v0.9/src/showdown.js
  86. +58 −0 node-code-blog/node-code-blog.js
  87. +109 −0 node-code-blog/post.js
  88. +3 −3 server.js
View
@@ -37,24 +37,23 @@ The code is pretty straightforward. Hack away!
wtfjs
|
- |-lib
+ |-node-code-blog
+ | |-post.js ..................... post model
+ | |-node-code-blog.js ........... routes
| |
- | '-codeblog .................... the blog code ............ soon to be its own repo
- | |
- | |-lib ....................... dependencies ............. until pkg mgmt is stable in NodeJS land
- | | |-express ................. web framework ............ http://expressjs.com
- | | '-showdown ................ markdown ................. http://attacklab.net/showdown (hacked up to run serverside)
- | |
- | |-post.js ................... post model
- | '-wtf.js .................... routes controller
- |
- |-public ........................ imgs, css and client js
+ | '-lib ......................... dependencies ............. until pkg mgmt is stable in NodeJS land
+ | |-express ................... web framework ............ http://expressjs.com
+ | |-express-clean-config ...... hacked express config .... a code blog mini dsl for config
+ | |-prettyfy .................. syntax highlighter ....... http://code.google.com/p/google-code-prettify
+ | |-showdown .................. markdown ................. http://attacklab.net/showdown
+ | '-node-code-blog-themes ..... themes ................... user contributed themes node-code-blog
+ | '-wtfjs
+ | |-public ................ imgs, css and client js
+ | '-views ................. view templates
|
|-posts
- | |
- | '-2010-05-10-hello-world.md ... typical post format
+ | '-2010-05-10-hello-world.md ... a typical post format
|
- |-views ......................... view templates
- '-server.js ..................... where it all begins
+ '-server.js ..................... config, custom routes and app init
-http://wtfjs.com was created by [@brianleroux](http://twitter.com/brianleroux). Everything here is under the WTFPL 2.0 license.
+http://wtfjs.com was created by [@brianleroux](http://twitter.com/brianleroux). Everything here is under the [WTFPL 2.0 license](http://wtfjs.com/license).
View
@@ -0,0 +1,90 @@
+node-code-blog
+===
+
+A pure JavaScript code blog backed up by Git and Node: **v0.1.96**.
+
+Features
+---
+
+- Posts are authored as basic Markdown and live in your Git repo.
+- Posts with `<code>` elements are auto syntax highlighted.
+- Automagic pagination and permalinks.
+- RSS 2.0 feed.
+- Heroku friendly.
+- Everything you need (_and nothin you do not_) to get a simple code centric blog up and running _fast_.
+
+Quickstart
+---
+
+[Download the example CodeBlog]() and in the root run `node server.js`. Congrats on your new `node-code-blog`!
+
+Maintainable start
+---
+
+[Copy this Gist]() and run in your terminal with `./generate-code-blog` or follow these steps:
+
+1. Download the example CodeBlog and delete the `lib/codeblog` folder.
+2. Initialize it as a Git Repo.
+3. Add codeblog as a Git Submodule to the lib/codeblog folder.
+4. Push it to GitHub and/or Heroku.
+5. Happy dance!
+
+The example `node-code-blog` directory structure looks like this:
+
+ appname
+ |
+ |-lib
+ | '-node-code-blog .................... This very library!
+ |
+ |-posts ............................... Your blog posts go here.
+ | '-yyyy-mm-dd-example-blog-post.md ... A typical post.
+ |
+ |-public .............................. Static files.
+ | |-app.css
+ | |-app.js
+ | '-favicon.ico
+ |
+ |-views ............................... View templates.
+ | |-about.html.ejs
+ | |-archive.html.ejs
+ | |-index.html.ejs
+ | |-layout.html.ejs
+ | '-post.html.ejs
+ |
+ '-server.js ........................... Heroku NodeJS friendly config.
+
+Posting
+---
+
+To post simply add a new Markdown file to the `/posts` directory. Markdown reference here.
+
+Theming
+---
+
+Create your own theme by modifying `/public/app.css` and the EJS templates found in `/views`.
+
+Adding pages
+---
+Its very easy to add new pages complete with serverside JavaScript logic to CodeBlog. Lets create a contact page. First, create a file like so `/views/contact.html.ejs` and add the following code:
+
+ <h1>Contact <%= name %></h1>
+
+ <p>You can reach me at: <%= email %></p>
+
+Crack open `/server.js` and add the following [ExpressJS](http://expressjs.com) compliant route:
+
+ require.paths.unshift("lib/codeblog");
+ require("codeblog");
+
+ get('/contact', function(){
+ render('contact.html.ejs', {locals:{
+ name: 'brian'
+ email:'spam@ham.com'
+ }});
+ });
+
+ init();
+
+Of course this means _anything_ Node can do so can your `node-code-blog`. Gnarly, eh.
+
+`node-code-blog` is [free software]() extracted from the redevelopment of [wtfjs](http://wtfjs.com) by [Brian LeRoux](http://twitter.com/brianleroux).
@@ -0,0 +1,20 @@
+// a little sugar for the config
+exports.config = function(opts) {
+ configure(function() {
+ // set codeblog specific vars
+ set('root', opts.root);
+ set('title', opts.title);
+ set('description',opts.description);
+ set('domain',opts.domain);
+ // plugins we will use
+ use(Logger);
+ use(Static);
+ // wow, I hate this syntax!
+ enable('show exceptions');
+ });
+};
+
+// hide the fugly
+exports.init = function() {
+ run(parseInt(process.env.PORT || 8000), null);
+};
@@ -0,0 +1,7 @@
+.DS_Store
+*.seed
+*.log
+*.csv
+*.dat
+*.out
+benchmarks/graphs
@@ -0,0 +1,9 @@
+
+require.paths.unshift(__dirname + '/support/ext/lib')
+require.paths.unshift(__dirname + '/support/ejs/lib')
+require.paths.unshift(__dirname + '/support/haml/lib')
+require.paths.unshift(__dirname + '/support/sass/lib')
+require.paths.unshift(__dirname + '/support/multipart/lib')
+require('ext')
+Class = require('support/class/lib/class').Class
+require('express/core')
Oops, something went wrong.

0 comments on commit 9ad33c4

Please sign in to comment.