Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

changed order of docs

  • Loading branch information...
commit 55145e8c709dfbae5ef9878d83e79720a06eee19 1 parent 5e29f80
@Techwraith Techwraith authored
View
1  .gitignore
@@ -11,6 +11,7 @@ node_modules
tmtags
*.DS_Store
examples/*/log/*
+site/log/*
.log
npm-debug.log
doc/
View
0  docs/router.md → docs/1-architecture.md
File renamed without changes
View
0  docs/models.md → docs/2-router.md
File renamed without changes
View
0  docs/controllers.md → docs/3-controllers.md
File renamed without changes
View
0  docs/architecture.md → docs/4-models.md
File renamed without changes
View
0  docs/templates.md → docs/5-templates.md
File renamed without changes
View
0  docs/CLI.md → docs/6-CLI.md
File renamed without changes
View
59 site/app/controllers/main.js
@@ -34,10 +34,19 @@ var Main = function () {
this.documentation = function (req, resp, params) {
var self = this
- , opts = {
- url: 'https://api.github.com/repos/mde/geddy/commits'
- , dataType: 'json'
+ , docs = []
+ , count = 0
+
+ // once we've got a list of commits, get the tree
+ // for the latest commit
+ , gotCommits = function (err, commits) {
+ var commit = commits[0] && commits[0].commit
+ , url = commit.tree && commit.tree.url;
+ return getTree(url, gotTree);
}
+
+ // once we've got the first tree, get 'docs' tree
+ // once we've got the 'docs' tree, call gotTree
, getTree = function (url, callback) {
var tree;
opts.url = url;
@@ -54,19 +63,47 @@ var Main = function () {
return callback(err, trees.tree);
});
}
- , gotCommits = function (err, commits) {
- var commit = commits[0] && commits[0].commit
- , url = commit.tree && commit.tree.url;
- return getTree(url, gotTree);
+ , getBlob = function (paths, i, callback) {
+ var options = {
+ url: paths[i].url
+ , dataType: 'json'
+ }
+ geddy.request(options, function (err, resp) {
+ var content = new Buffer(resp.content, 'base64').toString('utf8')
+ , name = paths[i].path.replace('.md','');
+ docs[name[0]] = {
+ name: name.split().splice(0,2)
+ , content: content
+ };
+ return respond(paths.length);
+ });
}
+
+ // once we've got the 'docs' tree,
+ // parse it and call getBlob for each file
, gotTree = function (err, tree) {
for (var i in tree) {
console.log(tree[i].path, ':', tree[i].url);
+ getBlob(tree, i, respond);
}
- self.respond(params, {
- format: 'html'
- , template: 'app/views/main/documentation'
- });
+ }
+
+ // once we've got everything done, respond with data
+ , respond = function (total) {
+ count++;
+ if (count == total) {
+ console.log(docs);
+ self.respond(params, {
+ format: 'html'
+ , template: 'app/views/main/documentation'
+ });
+ }
+ }
+
+ // inital call to get the commits
+ , opts = {
+ url: 'https://api.github.com/repos/mde/geddy/commits'
+ , dataType: 'json'
}
geddy.request(opts, gotCommits);
};
View
14 site/log/access.log
@@ -1,7 +1,7 @@
-[Sat, 06 Oct 2012 22:57:18 GMT] ACCESS 127.0.0.1 - - [Sat Oct 06 2012 15:57:16 GMT-0700 (PDT)] "GET /documentation 1.1" 200 5144 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.57 Safari/537.1"
-[Sat, 06 Oct 2012 22:57:18 GMT] ACCESS 127.0.0.1 - - [Sat Oct 06 2012 15:57:18 GMT-0700 (PDT)] "GET /css/style.css 1.1" 200 4632 "http://localhost:4000/documentation" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.57 Safari/537.1"
-[Sat, 06 Oct 2012 22:57:18 GMT] ACCESS 127.0.0.1 - - [Sat Oct 06 2012 15:57:18 GMT-0700 (PDT)] "GET /css/bootstrap.responsive.min.css 1.1" 200 15962 "http://localhost:4000/documentation" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.57 Safari/537.1"
-[Sat, 06 Oct 2012 22:57:18 GMT] ACCESS 127.0.0.1 - - [Sat Oct 06 2012 15:57:18 GMT-0700 (PDT)] "GET /css/bootstrap.min.css 1.1" 200 98165 "http://localhost:4000/documentation" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.57 Safari/537.1"
-[Sat, 06 Oct 2012 22:57:18 GMT] ACCESS 127.0.0.1 - - [Sat Oct 06 2012 15:57:18 GMT-0700 (PDT)] "GET /js/bootstrap.min.js 1.1" 200 25563 "http://localhost:4000/documentation" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.57 Safari/537.1"
-[Sat, 06 Oct 2012 22:57:18 GMT] ACCESS 127.0.0.1 - - [Sat Oct 06 2012 15:57:18 GMT-0700 (PDT)] "GET /js/jquery.min.js 1.1" 200 93437 "http://localhost:4000/documentation" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.57 Safari/537.1"
-[Sat, 06 Oct 2012 22:57:19 GMT] ACCESS 127.0.0.1 - - [Sat Oct 06 2012 15:57:19 GMT-0700 (PDT)] "GET /images/favicon.ico 1.1" 404 30 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.57 Safari/537.1"
+[Sat, 06 Oct 2012 23:36:20 GMT] ACCESS 127.0.0.1 - - [Sat Oct 06 2012 16:36:17 GMT-0700 (PDT)] "GET /documentation 1.1" 200 5144 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.57 Safari/537.1"
+[Sat, 06 Oct 2012 23:36:20 GMT] ACCESS 127.0.0.1 - - [Sat Oct 06 2012 16:36:20 GMT-0700 (PDT)] "GET /css/style.css 1.1" 200 4632 "http://localhost:4000/documentation" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.57 Safari/537.1"
+[Sat, 06 Oct 2012 23:36:20 GMT] ACCESS 127.0.0.1 - - [Sat Oct 06 2012 16:36:20 GMT-0700 (PDT)] "GET /css/bootstrap.responsive.min.css 1.1" 200 15962 "http://localhost:4000/documentation" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.57 Safari/537.1"
+[Sat, 06 Oct 2012 23:36:20 GMT] ACCESS 127.0.0.1 - - [Sat Oct 06 2012 16:36:20 GMT-0700 (PDT)] "GET /js/bootstrap.min.js 1.1" 200 25563 "http://localhost:4000/documentation" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.57 Safari/537.1"
+[Sat, 06 Oct 2012 23:36:20 GMT] ACCESS 127.0.0.1 - - [Sat Oct 06 2012 16:36:20 GMT-0700 (PDT)] "GET /css/bootstrap.min.css 1.1" 200 98165 "http://localhost:4000/documentation" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.57 Safari/537.1"
+[Sat, 06 Oct 2012 23:36:20 GMT] ACCESS 127.0.0.1 - - [Sat Oct 06 2012 16:36:20 GMT-0700 (PDT)] "GET /js/jquery.min.js 1.1" 200 93437 "http://localhost:4000/documentation" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.57 Safari/537.1"
+[Sat, 06 Oct 2012 23:36:20 GMT] ACCESS 127.0.0.1 - - [Sat Oct 06 2012 16:36:20 GMT-0700 (PDT)] "GET /images/favicon.ico 1.1" 404 30 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.57 Safari/537.1"
View
10 site/log/stdout.log
@@ -1,4 +1,4 @@
-[Sat, 06 Oct 2012 22:57:13 GMT] INFO Server starting with config: {
+[Sat, 06 Oct 2012 23:36:12 GMT] INFO Server starting with config: {
"environment": "development",
"workers": 1,
"port": 4000,
@@ -29,7 +29,7 @@
"hostname": null,
"detailedErrors": true
}
-[Sat, 06 Oct 2012 22:57:13 GMT] INFO Creating 1 worker process.
-[Sat, 06 Oct 2012 22:57:13 GMT] INFO Server worker running in development on port 4000 with a PID of: 79294
-[Sat, 06 Oct 2012 22:57:13 GMT] DEBUG LOGGING STARTED ============================================
-[Sat, 06 Oct 2012 22:57:13 GMT] DEBUG ============================================================
+[Sat, 06 Oct 2012 23:36:12 GMT] INFO Creating 1 worker process.
+[Sat, 06 Oct 2012 23:36:12 GMT] INFO Server worker running in development on port 4000 with a PID of: 80075
+[Sat, 06 Oct 2012 23:36:12 GMT] DEBUG LOGGING STARTED ============================================
+[Sat, 06 Oct 2012 23:36:12 GMT] DEBUG ============================================================

0 comments on commit 55145e8

Please sign in to comment.
Something went wrong with that request. Please try again.