├── .env.example ├── .gitignore ├── Dockerfile ├── README.md ├── commitlog ├── app.py ├── static │ └── what-the-duck.gif └── templates │ └── landing.html ├── docker-compose.yml ├── requirements.in └── requirements.txt /.env.example: -------------------------------------------------------------------------------- 1 | FLASK_APP=commitlog/app.py 2 | FLASK_DEBUG=1 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.py[co] 2 | eru.egg-info/* 3 | local_settings.py 4 | local_config.py 5 | tests/__pycache__/* 6 | .env 7 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python 2 | RUN pip install pip --upgrade 3 | ADD commitlog /commitlog 4 | ADD requirements.txt /commitlog/requirements.txt 5 | WORKDIR /commitlog 6 | RUN pip install -r ./requirements.txt 7 | EXPOSE 5000 8 | CMD ["gunicorn", "app:app", "-b", "0.0.0.0:5000", "-w", "4"] 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### CLaaS (Commit Log as a Service) 2 | 3 | 受到 [这位哥](http://whatthecommit.com/index.txt) 的启发, 搞个中文版的... 4 | 5 | ### Configure your .gitconfig 6 | 7 | ``` 8 | $ cat ~/.gitconfig 9 | [alias] 10 | wtf = "!git commit -m \"$(curl -L -s https://commitlog.wolege.ca)\"" 11 | 12 | $ git wtf 13 | [master (root-commit) 8a4796c] 打错字了 14 | 1 file changed, 0 insertions(+), 0 deletions(-) 15 | create mode 100644 aaa 16 | ``` 17 | -------------------------------------------------------------------------------- /commitlog/app.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | import random 4 | 5 | from flask import Flask, request, jsonify, render_template 6 | 7 | messages = [ 8 | u'修了修了别再催我了', 9 | u'诶我去, 上一个提交好像不太对', 10 | u'打错字了我擦', 11 | u'这样应该就可以了吧?', 12 | u'那可能是需要这么搞一下', 13 | u'啊啊啊啊啊终于好了', 14 | u'我艹好像还是没好, 那这么改一下试试', 15 | u'你妈啊这样总可以了吧', 16 | u'谁写的sb代码啊改了改了', 17 | u'先这样吧, 明天再说吧', 18 | u'快到点了, 准备闪人了', 19 | u'写的什么鬼, 不过能跑, 就酱吧', 20 | u'啊啊啊啊写错了, 还好这次改对了', 21 | u'这次的提交能值多少钱呢?', 22 | u'我是sb啊啊啊...', 23 | u'这回真的可以了, 我人格担保!', 24 | u'原来没挂啊, 改这个就好了', 25 | u'好像是可以了诶, 不过一会儿可能会挂, 先实验下', 26 | u'我其实就是手贱提交了一下', 27 | u'还是自己写靠谱啊', 28 | u'被别人骗了, 这东西要这么写才对 T^T', 29 | u'吔屎啦,产品狗!', 30 | u'续一秒', 31 | u'方便测试先改成这样,上线前再改回来', 32 | u'线上Bug紧急修复', 33 | u'产品经理说需求又改了,删掉删掉', 34 | u'祈祷这次的CI能过', 35 | u'晚上还没吃饭呢,有点饿了先这样吧', 36 | u'怎么这么多会要开,下班才有时间干活啊', 37 | u'什么鬼啊都没有新的message了', 38 | ] 39 | 40 | app = Flask(__name__) 41 | 42 | 43 | @app.route('/') 44 | def index(): 45 | message = random.choice(messages) 46 | if not request.user_agent.browser: 47 | return u'%s\n' % message 48 | return render_template('landing.html', message=message) 49 | 50 | 51 | @app.route('/_all') 52 | def list_all(): 53 | return jsonify(messages) 54 | -------------------------------------------------------------------------------- /commitlog/static/what-the-duck.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tonicmuroq/commitlog/e8d15156f66002c183d9f477902216941c0a88f8/commitlog/static/what-the-duck.gif -------------------------------------------------------------------------------- /commitlog/templates/landing.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 |24 | {{ message }} 25 | 28 | 36 |
37 |打开你的 ~/.gitconfig
然后:
40 | [alias] 41 | wtf = "!git commit -m \"$(curl -L -s https://commitlog.wolege.ca)\""42 |
43 | 记得转义双引号一定不能去掉, 因为这坑货自己会去掉双引号… 44 | 下次提交就敲 git wtf 看看你的老板多久会打死你。
45 |你的老板:
46 |
47 |
48 |