Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update README.md, support init command
- Loading branch information
Showing
52 changed files
with
745 additions
and
235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,20 @@ | |||
Copyright (c) 2013 mzhou, http://mzhou.me/ | |||
|
|||
Permission is hereby granted, free of charge, to any person obtaining | |||
a copy of this software and associated documentation files (the | |||
"Software"), to deal in the Software without restriction, including | |||
without limitation the rights to use, copy, modify, merge, publish, | |||
distribute, sublicense, and/or sell copies of the Software, and to | |||
permit persons to whom the Software is furnished to do so, subject to | |||
the following conditions: | |||
|
|||
The above copyright notice and this permission notice shall be | |||
included in all copies or substantial portions of the Software. | |||
|
|||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | |||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | |||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,11 +1,37 @@ | |||
**blogin** is A simple static blog framework, powered by Node.js. | **blogin** is A simple static blog framework, powered by Node.js. | ||
|
|
||
Usage: | How to install | ||
|
--- | ||
deploy Generate static files and deploy to github. | 1. Install [node.js](http://nodejs.org/) and [npm](https://npmjs.org/). | ||
server Start a server on http://localhost:3000 . | 2. `npm install -g blogin` | ||
update Generate the static files. | 3. `blogin init blogdir` | ||
post New post. | 4. `cd blogdir` | ||
page New page. | 4. `blogin update` | ||
init Init the project directory. | 5. `blogin server` | ||
help Display help. | 6. Open `http://127.0.0.1:3000` in browser. | ||
|
|||
Create post | |||
--- | |||
1. `blogin post this is my first post` | |||
2. Then edit "blogindir/data/posts/2013/this-is-my-first-post.md". Blogin use markdown format to write blog. | |||
3. `blogin update` | |||
4. `blogin server` | |||
|
|||
Usage | |||
--- | |||
blogin command: | |||
|
|||
deploy Generate static files and deploy to git server, like github. | |||
server Start a server on http://localhost:3000 . | |||
update Generate the static files. | |||
post Create post. | |||
page Create page. | |||
init Init the project directory. | |||
help Display help. | |||
|
|||
Custom theme | |||
--- | |||
Edit the file at "blogindir/public/" to custom your own theme. | |||
|
|||
|
|||
Please feel free to use blogin. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,58 @@ | |||
path = require('path') | |||
moment = require('moment') | |||
util = require('util') | |||
parseArg = require('./arg').parse | |||
MyUtil = require('./MyUtil') | |||
usage = require('./usage') | |||
file = require('./file') | |||
|
|||
projectDir = './' | |||
|
|||
module.exports = (args) -> | |||
arg = parseArg(args) | |||
projectDir = path.resolve(process.cwd(), arg.req[0] || './') | |||
|
|||
if file.copy(path.resolve(__dirname, '../prototype/'), projectDir) | |||
util.puts('Blog created at "' + projectDir + '".') | |||
else | |||
util.puts('Directory "' + projectDir + '" existed!') | |||
util.puts('Still create blog? (Y/N)') | |||
process.stdin.resume(); | |||
process.stdin.setEncoding('utf8'); | |||
|
|||
yesCallback = () -> | |||
file.copy(path.resolve(__dirname, '../prototype/'), projectDir, true) | |||
util.puts('Blog created at "' + projectDir + '".') | |||
util.puts('Init complete.') | |||
process.exit() | |||
|
|||
noCallback = () -> | |||
process.exit() | |||
|
|||
callback = () -> | |||
util.puts('Please input Y/N.') | |||
process.exit() | |||
|
|||
process.stdin.on 'data', (chunk) => | |||
if chunk[chunk.length - 1] isnt '\n' | |||
callback() | |||
return | |||
switch chunk.slice(0, -1) | |||
when 'Y' | |||
yesCallback() | |||
when 'y' | |||
yesCallback() | |||
when 'yes' | |||
yesCallback() | |||
when 'YES' | |||
yesCallback() | |||
when 'N' | |||
noCallback() | |||
when 'n' | |||
noCallback() | |||
when 'no' | |||
noCallback() | |||
when 'NO' | |||
noCallback() | |||
else | |||
callback() |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,9 +1,9 @@ | |||
{ | { | ||
"name": "Blogin's blog", | "name": "[Blog name]", | ||
"description": "A static blog base on blogin.", | "description": "[Blog description]", | ||
"keywords": "website,blog,framework,static,blogin", | "keywords": "[Blog keyowrds]", | ||
"author": "MZhou / @zhoumm", | "author": "[Your name]", | ||
"email": "zmmbreeze0825@gmail.com", | "email": "[Blog email]", | ||
"siteUrl": "http://nodejs.in", | "siteUrl": "http://nodejs.in", | ||
"favicon": "https://github.com//favicon.ico" | "favicon": "https://github.com//favicon.ico" | ||
} | } |
Oops, something went wrong.