Explorar el Código

Gitbook Auto Published

willin hace 8 años
padre
commit
f4672c926b
Se han modificado 2 ficheros con 48 adiciones y 17 borrados
  1. 3 3
      README.md
  2. 45 14
      cmd

+ 3 - 3
README.md

@@ -3,9 +3,9 @@
 你离技术经理,只差这本书: <http://leader.js.cool>
 
 ```
-info: found 70 pages
-info: found 61 asset files
-Completed counting with 30240 words.
+info: found 74 pages
+info: found 62 asset files
+Completed counting with 35714 words.
 info: >> generation finished with success in 10.6s !
 ```
 

+ 45 - 14
cmd

@@ -1,17 +1,48 @@
 #!/bin/bash
 
-git add .
-git commit -m 'Gitbook Auto Published'
-git push origin master
-git push coding master
+pushd $(dirname "${0}") > /dev/null
+DIR=$(pwd -L)
+popd > /dev/null
 
-rm -rf _book
-node_modules/.bin/gitbook build
-cd _book
-git init
-git add .
-git commit -m "Gitbook Auto Deployed"
-git remote add origin git@github.com:js-cool/leader.js.cool.git
-git remote add coding git@git.coding.net:willin/leader.js.cool.git
-git push -f coding master:coding-pages
-git push -f origin master:gh-pages
+ACTION=$1
+
+build() {
+  git add .
+  git commit -m 'Gitbook Auto Published'
+  git push origin master
+  git push coding master
+
+  node_modules/.bin/gitbook build
+  cd _book
+  git add .
+  git commit -m "Gitbook Auto Deployed"
+  git push -f coding master:coding-pages
+  git push -f origin master:gh-pages
+}
+
+clean() {
+  git add .
+  git commit -m 'Gitbook Auto Published'
+  git push origin master
+  git push coding master
+
+  rm -rf _book
+  node_modules/.bin/gitbook build
+  cd _book
+  git init
+  git add .
+  git commit -m "Gitbook Auto Deployed"
+  git remote add origin git@github.com:js-cool/leader.js.cool.git
+  git remote add coding git@git.coding.net:willin/leader.js.cool.git
+  git push -f coding master:coding-pages
+  git push -f origin master:gh-pages
+}
+
+case "$ACTION" in
+  clean)
+    clean
+  ;;
+  *)
+    build
+  ;;
+esac