Skip to content

Commit

Permalink
move prototype, fix js style, add MyUtil.spawn
Browse files Browse the repository at this point in the history
  • Loading branch information
zmmbreeze committed Jan 11, 2013
1 parent d8562fd commit 40f65dc
Show file tree
Hide file tree
Showing 29 changed files with 53 additions and 23 deletions.
29 changes: 14 additions & 15 deletions 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;
}
1 change: 0 additions & 1 deletion index.html

This file was deleted.

26 changes: 25 additions & 1 deletion 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) ->
Expand Down Expand Up @@ -89,4 +90,27 @@ exports.updateInfos = () ->
page.mtime = file.getMTime(filePath)
infos.page.push(page)

file.write(infoFile, JSON.stringify(infos, null, 4))
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);
1 change: 1 addition & 0 deletions lib/deploy.coffee
@@ -0,0 +1 @@
MyUtil = require('./MyUtil')
7 changes: 7 additions & 0 deletions lib/deploy.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file added lib/init.coffee
Empty file.
6 changes: 6 additions & 0 deletions lib/init.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions page/hello-world.html

This file was deleted.

1 change: 0 additions & 1 deletion page/my-first-page.html

This file was deleted.

Binary file removed post/2012/.DS_Store
Binary file not shown.
1 change: 0 additions & 1 deletion post/2012/hello-worldd.html

This file was deleted.

1 change: 0 additions & 1 deletion post/2012/index.html

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 40f65dc

Please sign in to comment.