鄉民關心你 - 專案開發指南
技術架構(Technique Selection)
- Programming Language:
- Web: LiveScript (Frontend and Backend)
- Glue Tool: Python or any.
- Data Exchange: JSON
- Auth: pgrest + nodejs passport
- Backend PgREST:
- Restful DB: Postsql + PgRest
- 介紹簡報: node.js in the database
- https://npmjs.org/package/plv8x
- Test Framwork: Mocha
- Backend ROR
- Frontend Web:
- bootstrap
- semantic-ui
- HTML5 applications Assembler:
- Brunch (....) (in develop branch)
- ng-boilerplate (in car branch)
- MVW Framwork: AngularJS
- CSS Authoring Framework: Compass
- Visualization lib: D3.js
- Test Framwork: Karma
- Frontend Mobile APP
- Version Control: Git
- Continuation Testing: Travis
- Develop VM: Vagrant
- Deploy: Chef, Berkshelf
- Server OS: GNU/Linux Ubuntu
- Fake Data Generator:
- MoreText
- QuickCheck-like modules
- Python: pytest-quickcheck
- Haskell: quickcheck
- Third party service.
- webpage screenshot capture: urlshot
- http://blog.darkthread.net/post-2013-08-29-phantomjs.aspx
- 新聞比對(news diff)
- 國內: http://newsdiff.g0v.ronny.tw/
- 國外: http://newsdiffs.org/
Source Code
All: https://github.com/g0v/kuansim
前端(Chrome Extension): https://github.com/g0v/kuansim_chrome
前端(Web): https://github.com/g0v/kuansim-frontend
後端(Restful DB): https://github.com/g0v/kuansim-backend
後端(ROR): https://github.com/g0v/kuansim-rails
Chef Cookbook: https://github.com/kuansim-cookbooks/
DevOps codes: https://github.com/kuansim-devops
專案管理模型
- It is done when it is done
- TDD is preferred, but without unit testing is fine.
- Git branching mode (非強求, 但新功能不要直接在master 做)
- Git commit style
準備開發環境
- 安裝 Vagrant
- 閱讀利用 Vagrant 開發g0v.tang’w 專案
- 安裝 Berkshelf
- $ vagrant plugin install vagrant-berkshelf
- 安裝 Git
- 安裝 git-flow , or flowhub
- 安裝 editconfig
- 取得源碼
- 啟動DB
- $ cd kuansim/cookbooks/kuansim
- kuansim/cookbooks/kuansim $ vagrant up
- 開啟瀏覽器打 http://localhost:3000/collections, 即可操作rest api.
- 停止 service
- kuansim/cookbooks/kuansim $ vagrant ssh -c "stop kuansim"
- 啟動static web
- $ cd kuansim/frontend/web
- $ scripts/server.sh
- 使用方式見
- import data: https://github.com/g0v/moedict-data-twblg/blob/master/Makefile
- plv8x: https://npmjs.org/package/plv8x
準備開發環境 For Windows
據說目前 windows 的安裝方式壞掉了 , 似乎無法抓到 Vbox 檔案 (我是沒有人但我不會修) - 20140325
- 安裝 Vagrant (1.3.4) http://downloads.vagrantup.com/
- 安裝 virtalbox https://www.virtualbox.org/wiki/Downloads
- 確定電腦的 Virtualization Technology enabled
- how? google "[motherboard] bios VT"
- Environment variable -> path added C:\Program Files\Oracle\VirtualBox;
- 注: Vagrant 1.3.4 只支援 virtalbox 4.0,4.1,4.2 版本
- 安裝 git (1.8.4) http://git-scm.com/download/win
- try cmd -> git (看看有沒有這個指令)
- 安裝 mingw http://sourceforge.net/projects/mingw/files/
- MinGW install manager-> Basic Setup -> select
- mingw-developer toolkit
- mingy32-base
- msys-base
- b. Installation -> apply change
- c. environment variable -> path added C:\MinGW\bin;C:\MinGW\msys\1.0\bin
- cmd (開啟-> cmd [Enter])
- git clone https://github.com/g0v/kuansim.git
- git checkout develop // 確保在 develop branch
- cd kuansim/cookbooks/kuansim
- vagrant plugin install vagrant-berkshelf
- vagrant up
- 有可能 第一次fail 但是不要慌,第二次應該OK
- 看到 INFO: Chef Run complete in 1419.211913507 seconds 表示成功了!!
- vagrant ssh 就可以進入 vm 開發
- cd /opt/kuansim/backend
- npm start
- 開啟瀏覽器 http://127.0.0.1:3000/collections 應該會有些資訊 like ["bookmarks","news","tags","users","webpages"]