diff --git a/.gitignore b/.gitignore index 66118e0..0d2a3ad 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ _site/ spm_modules/ .DS_Store +node_modules/ diff --git a/bin/markline b/bin/markline new file mode 100755 index 0000000..6e22098 --- /dev/null +++ b/bin/markline @@ -0,0 +1,35 @@ +#!/usr/bin/env node + +var commander = require('commander'); +var markline = require("../index"); + +commander + .version(require('../package').version) + .usage('[options]') + .option('-v, --version', 'output the version number') + .option('build', 'build markdown to markline page.') + .option('server', 'build markdown to markline page.') + .parse(process.argv); + + +var cwd = process.cwd(); +var options = { + src: commander.source || cwd, + dist: commander.dist || cwd + "/dist" +}; + +if (commander.build) { + markline.build(options); + process.exit(); +} else if (commander.server){ + markline.server(options); + process.exit(); +} + +// output help and exit if no args found +if (commander.args.length === 0) { + commander.help(); +} + + +// vim:ft=javascript diff --git a/index.js b/index.js new file mode 100644 index 0000000..616b56f --- /dev/null +++ b/index.js @@ -0,0 +1,24 @@ + +function build(options){ + console.log(options.src) + console.log(options.dist) +} + +function server(options){ + var http = require('http'); + var app = http.createServer(function (req, res) { + res.writeHead(200, {'Content-Type': 'text/plain'}); + res.end('Hello World\n'); + }); + app.listen(8080); + console.log("Server Started 127.0.0.1:8080") +} + +function watch(){ +} + +module.exports = { + build: build, + server: server, + watch: watch +} diff --git a/package.json b/package.json index cf59d04..99c4ff8 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,16 @@ "bugs": { "url": "https://github.com/hotoo/markline/issues" }, - "licenses": "MIT", + "bin": { + "pinyin": "./bin/pinyin" + }, + "dependencies": { + "commander": "~1.1.1" + }, + "devDependencies": { + "mocha": "1.17.1", + "expect.js": "0.3.1" + }, "spm": { "main": "markline.js", "output": ["timeline.js", "timeline.css"], @@ -22,5 +31,6 @@ "devDependencies": { "expect.js": "0.3.1" } - } + }, + "licenses": "MIT" }