Skip to content

Commit

Permalink
changed order of docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Techwraith committed Oct 6, 2012
1 parent 5e29f80 commit 55145e8
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 23 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -11,6 +11,7 @@ node_modules
tmtags
*.DS_Store
examples/*/log/*
site/log/*
.log
npm-debug.log
doc/
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
59 changes: 48 additions & 11 deletions site/app/controllers/main.js
Expand Up @@ -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;
Expand All @@ -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);
};
Expand Down
14 changes: 7 additions & 7 deletions 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"
10 changes: 5 additions & 5 deletions 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,
Expand Down Expand Up @@ -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.