From 40f65dcd2b2822a28e24f3760420e56911f19116 Mon Sep 17 00:00:00 2001 From: zmmbreeze Date: Fri, 11 Jan 2013 18:04:54 +0800 Subject: [PATCH] move prototype, fix js style, add MyUtil.spawn --- bin/blogin | 29 +++++++++--------- index.html | 1 - lib/MyUtil.coffee | 26 +++++++++++++++- lib/deploy.coffee | 1 + lib/deploy.js | 7 +++++ lib/init.coffee | 0 lib/init.js | 6 ++++ page/hello-world.html | 3 -- page/my-first-page.html | 1 - post/2012/.DS_Store | Bin 6827 -> 0 bytes post/2012/hello-worldd.html | 1 - post/2012/index.html | 1 - blogin.json => prototype/blogin.json | 0 {data => prototype/data}/info | 0 {data => prototype/data}/pages/hello-world.md | 0 .../data}/pages/my-first-page.md | 0 {data => prototype/data}/posts/2012/.DS_Store | Bin .../data}/posts/2012/hello-worldd.md | 0 .../public}/stylesheet/markdown.css | 0 .../public}/stylesheet/normalize.css | 0 .../public}/stylesheet/style.css | 0 .../public}/template/archive.jade | 0 .../public}/template/includes/foot.jade | 0 .../public}/template/includes/head.jade | 0 .../public}/template/includes/info.jade | 0 .../public}/template/index.jade | 0 .../public}/template/layout.jade | 0 .../public}/template/page.jade | 0 .../public}/template/post.jade | 0 29 files changed, 53 insertions(+), 23 deletions(-) delete mode 100644 index.html create mode 100644 lib/deploy.coffee create mode 100644 lib/deploy.js create mode 100644 lib/init.coffee create mode 100644 lib/init.js delete mode 100644 page/hello-world.html delete mode 100644 page/my-first-page.html delete mode 100644 post/2012/.DS_Store delete mode 100644 post/2012/hello-worldd.html delete mode 100644 post/2012/index.html rename blogin.json => prototype/blogin.json (100%) rename {data => prototype/data}/info (100%) rename {data => prototype/data}/pages/hello-world.md (100%) rename {data => prototype/data}/pages/my-first-page.md (100%) rename {data => prototype/data}/posts/2012/.DS_Store (100%) rename {data => prototype/data}/posts/2012/hello-worldd.md (100%) rename {public => prototype/public}/stylesheet/markdown.css (100%) rename {public => prototype/public}/stylesheet/normalize.css (100%) rename {public => prototype/public}/stylesheet/style.css (100%) rename {public => prototype/public}/template/archive.jade (100%) rename {public => prototype/public}/template/includes/foot.jade (100%) rename {public => prototype/public}/template/includes/head.jade (100%) rename {public => prototype/public}/template/includes/info.jade (100%) rename {public => prototype/public}/template/index.jade (100%) rename {public => prototype/public}/template/layout.jade (100%) rename {public => prototype/public}/template/page.jade (100%) rename {public => prototype/public}/template/post.jade (100%) diff --git a/bin/blogin b/bin/blogin index f6df2fc..1cab041 100755 --- a/bin/blogin +++ b/bin/blogin @@ -1,20 +1,19 @@ #!/usr/bin/env node -var args = process.argv.slice(2) - , commandName = args.shift() - , commands = require('../lib/command') - ; +var args = process.argv.slice(2); +var commandName = args.shift(); +var commands = require('../lib/command'); switch (commandName) { - case '-v': - case '--version': - case 'ver': - case 'version': - var version = require('../package.json').version; - console.log(version); - break; - default: - var command = commands[commandName] || commands.help; - command(args); - break; + case '-v': + case '--version': + case 'ver': + case 'version': + var version = require('../package.json').version; + console.log(version); + break; + default: + var command = commands[commandName] || commands.help; + command(args); + break; } \ No newline at end of file diff --git a/index.html b/index.html deleted file mode 100644 index 5f394a2..0000000 --- a/index.html +++ /dev/null @@ -1 +0,0 @@ -Blogin's blog

Blogin's blog

Powered by blogin

Copyright © 2012 MZhou / @zhoumm

\ No newline at end of file diff --git a/lib/MyUtil.coffee b/lib/MyUtil.coffee index c04536a..ddf0e5e 100644 --- a/lib/MyUtil.coffee +++ b/lib/MyUtil.coffee @@ -1,5 +1,6 @@ path = require('path') util = require('util') +spawn = require('child_process').spawn file = require('./file') checkProjectDir = exports.checkProjectDir = (dirPath) -> @@ -89,4 +90,27 @@ exports.updateInfos = () -> page.mtime = file.getMTime(filePath) infos.page.push(page) - file.write(infoFile, JSON.stringify(infos, null, 4)) \ No newline at end of file + file.write(infoFile, JSON.stringify(infos, null, 4)) + +### + command: 'git' + args: ['add', '-A'] + options: + cwd: process.cwd + exit: () -> + stdout: () -> +### +exports.spawn = (options) -> + comm = spawn(options.command, options.args, options.options) + + comm.stdout.setEncoding('utf8') + comm.stderr.setEncoding('utf8') + + comm.stdout.on('data', options.stdout || (data) -> + console.log(data); + + comm.stdout.on('data', options.stdout || (data) -> + console.log(data); + + if options.exit + comm.on('exit', options.exit); \ No newline at end of file diff --git a/lib/deploy.coffee b/lib/deploy.coffee new file mode 100644 index 0000000..60a36dc --- /dev/null +++ b/lib/deploy.coffee @@ -0,0 +1 @@ +MyUtil = require('./MyUtil') \ No newline at end of file diff --git a/lib/deploy.js b/lib/deploy.js new file mode 100644 index 0000000..def4f02 --- /dev/null +++ b/lib/deploy.js @@ -0,0 +1,7 @@ +// Generated by CoffeeScript 1.4.0 +(function() { + var MyUtil; + + MyUtil = require('./MyUtil'); + +}).call(this); diff --git a/lib/init.coffee b/lib/init.coffee new file mode 100644 index 0000000..e69de29 diff --git a/lib/init.js b/lib/init.js new file mode 100644 index 0000000..c8b0aa7 --- /dev/null +++ b/lib/init.js @@ -0,0 +1,6 @@ +// Generated by CoffeeScript 1.4.0 +(function() { + + + +}).call(this); diff --git a/page/hello-world.html b/page/hello-world.html deleted file mode 100644 index efc44f3..0000000 --- a/page/hello-world.html +++ /dev/null @@ -1,3 +0,0 @@ -Blogin's blog - Hello world

Hello world

2012-11-11

hello world

- -

asdasd

Your infomation

Powered by blogin

Copyright © 2012 MZhou / @zhoumm

\ No newline at end of file diff --git a/page/my-first-page.html b/page/my-first-page.html deleted file mode 100644 index 640e899..0000000 --- a/page/my-first-page.html +++ /dev/null @@ -1 +0,0 @@ -Blogin's blog - My first page

My first page

2012-11-11

my first page

Your infomation

Powered by blogin

Copyright © 2012 MZhou / @zhoumm

\ No newline at end of file diff --git a/post/2012/.DS_Store b/post/2012/.DS_Store deleted file mode 100644 index a71fe7438096b6928d999130aa605a6b49eb3c1d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6827 zcmeHM&5qMB5RPFFi@5BOqlpBZ($GC2kyzPod*FarsUWdjAU|$nZDNPm*;RNq#3S(v zjDLy}6}W)2B8g(Ep=8yFJ>$LU7iV7F=bK6-Z%U5d8L6)PGV;!#qq_o=8gA>nNnua%Yyc2yjnKtl>?ii=ld}2jq*|SbD!6%b1uvD;6X>%@eNwMH& z!1w|JG>qTix~ID|jJu&|SQ$$-HdNM>DyuF^DPd+@8!8G>jU=hqEiRi}$~4sJ=a5bh zb0+3mr&lk@fh168k0Ds384Jnz^W}N8T*5DjApopoqX6v8dNY3H9CTEyb->J_KMrUj zeDe(aWd@SC`$b_vvPzd*CZz?&cOoR$V(76}Td17~KC4R{RVQ`|LUiOx+|iy^xEOJg zA4)1A(X}E55pq}_Qs~H~=*FJyYlWYdpuWVq{()bAsKtO|oP7ao+ex~vCSvO@v8hV^ E02&Blogin's blog - Hello worldd

Hello worldd

2012-11-11

Hello Worldd

Your infomation

Powered by blogin

Copyright © 2012 MZhou / @zhoumm

\ No newline at end of file diff --git a/post/2012/index.html b/post/2012/index.html deleted file mode 100644 index 5eba920..0000000 --- a/post/2012/index.html +++ /dev/null @@ -1 +0,0 @@ -Blogin's blog - 2012

Blogin's blog

Your infomation

Powered by blogin

Copyright © 2012 MZhou / @zhoumm

\ No newline at end of file diff --git a/blogin.json b/prototype/blogin.json similarity index 100% rename from blogin.json rename to prototype/blogin.json diff --git a/data/info b/prototype/data/info similarity index 100% rename from data/info rename to prototype/data/info diff --git a/data/pages/hello-world.md b/prototype/data/pages/hello-world.md similarity index 100% rename from data/pages/hello-world.md rename to prototype/data/pages/hello-world.md diff --git a/data/pages/my-first-page.md b/prototype/data/pages/my-first-page.md similarity index 100% rename from data/pages/my-first-page.md rename to prototype/data/pages/my-first-page.md diff --git a/data/posts/2012/.DS_Store b/prototype/data/posts/2012/.DS_Store similarity index 100% rename from data/posts/2012/.DS_Store rename to prototype/data/posts/2012/.DS_Store diff --git a/data/posts/2012/hello-worldd.md b/prototype/data/posts/2012/hello-worldd.md similarity index 100% rename from data/posts/2012/hello-worldd.md rename to prototype/data/posts/2012/hello-worldd.md diff --git a/public/stylesheet/markdown.css b/prototype/public/stylesheet/markdown.css similarity index 100% rename from public/stylesheet/markdown.css rename to prototype/public/stylesheet/markdown.css diff --git a/public/stylesheet/normalize.css b/prototype/public/stylesheet/normalize.css similarity index 100% rename from public/stylesheet/normalize.css rename to prototype/public/stylesheet/normalize.css diff --git a/public/stylesheet/style.css b/prototype/public/stylesheet/style.css similarity index 100% rename from public/stylesheet/style.css rename to prototype/public/stylesheet/style.css diff --git a/public/template/archive.jade b/prototype/public/template/archive.jade similarity index 100% rename from public/template/archive.jade rename to prototype/public/template/archive.jade diff --git a/public/template/includes/foot.jade b/prototype/public/template/includes/foot.jade similarity index 100% rename from public/template/includes/foot.jade rename to prototype/public/template/includes/foot.jade diff --git a/public/template/includes/head.jade b/prototype/public/template/includes/head.jade similarity index 100% rename from public/template/includes/head.jade rename to prototype/public/template/includes/head.jade diff --git a/public/template/includes/info.jade b/prototype/public/template/includes/info.jade similarity index 100% rename from public/template/includes/info.jade rename to prototype/public/template/includes/info.jade diff --git a/public/template/index.jade b/prototype/public/template/index.jade similarity index 100% rename from public/template/index.jade rename to prototype/public/template/index.jade diff --git a/public/template/layout.jade b/prototype/public/template/layout.jade similarity index 100% rename from public/template/layout.jade rename to prototype/public/template/layout.jade diff --git a/public/template/page.jade b/prototype/public/template/page.jade similarity index 100% rename from public/template/page.jade rename to prototype/public/template/page.jade diff --git a/public/template/post.jade b/prototype/public/template/post.jade similarity index 100% rename from public/template/post.jade rename to prototype/public/template/post.jade