X-Git-Url: https://rtime.felk.cvut.cz/gitweb/hubacji1/coffee-getter.git/blobdiff_plain/7a89b4a6371e9dac477a7fe96003b3171e3c363e..400efd3a7aea2033e964cbe338c9dcd139fdba93:/README.md diff --git a/README.md b/README.md index 12e4c57..e081a52 100644 --- a/README.md +++ b/README.md @@ -1,62 +1,59 @@ -# Coffeebot getter -Somehow friendly API to get and share coffee related data from database. - -# Contribute -## Code -For quick orientation see the [changelog][1]. - -Please, think about [The seven rules of a great Git commit message][2] when -making commit. The project use [OneFlow][3] branching model with the `master` -branch as the branch where the development happens. - -## TDD -Test Driven Development (TDD) is used in this project. Each *feature* **must** -start with adding test and all the tests **must** pass before merge to the -*master*. - -Run the tests by: -``` -python3 -m unittest discover ut/ -``` - -See [unittest][5] for start. - -## Database -By default, sqlite3 `coffee.db` file is needed. Please, see [coffee_db.sql][6] -for the database format. You may create testing copy of database by: -``` -wget http://rtime.felk.cvut.cz/gitweb/coffee/coffee-flask.git/blob_plain/refs/heads/master:/coffee_db.sql -sqlite3 coffee.db < coffee_db.sql -``` - -Then add some testing data by: -``` -sqlite3 coffee.db "INSERT INTO "users" VALUES('1111','tester')" -sqlite3 coffee.db "insert into coffees (id, flavor) values ('1111', 'espresso lungo')" -sqlite3 coffee.db "insert into coffees (id, flavor) values ('1111', 'Club-Mate 0,5 l')" -sqlite3 coffee.db "insert into coffees (id, flavor) values ('1111', 'Club-Mate 0,33 l')" -sleep 1 -sqlite3 coffee.db "insert into coffees (id, flavor) values ('1111', 'espresso lungo')" -sqlite3 coffee.db "insert into coffees (id, flavor) values ('1111', 'Club-Mate 0,5 l')" -sqlite3 coffee.db "insert into coffees (id, flavor) values ('1111', 'Club-Mate 0,33 l')" -sleep 1 -sqlite3 coffee.db "insert into coffees (id, flavor) values ('1111', 'espresso lungo')" -sqlite3 coffee.db "insert into coffees (id, flavor) values ('1111', 'Club-Mate 0,5 l')" -sqlite3 coffee.db "insert into coffees (id, flavor) values ('1111', 'Club-Mate 0,33 l')" -sleep 1 -sqlite3 coffee.db "insert into coffees (id, flavor) values ('1111', 'espresso lungo')" -sqlite3 coffee.db "insert into coffees (id, flavor) values ('1111', 'Club-Mate 0,5 l')" -sqlite3 coffee.db "insert into coffees (id, flavor) values ('1111', 'Club-Mate 0,33 l')" -``` - -Database is needed to pass the tests. - -## License -This project is developed under [GNU GPLv3 license][4]. - -[1]: ./CHANGELOG.md -[2]: https://chris.beams.io/posts/git-commit/ -[3]: http://endoflineblog.com/oneflow-a-git-branching-model-and-workflow -[4]: ./LICENSE -[5]: https://docs.python.org/3.5/library/unittest.html -[6]: http://rtime.felk.cvut.cz/gitweb/coffee/coffee-flask.git/blob/refs/heads/master:/coffee_db.sql +Coffee getter is somehow friendly API to get and share coffee related data from +the database. + +This project is published under [GNU AGPLv3 license](./LICENSE). + + +## Running tasks periodically +Please, see [Timers][6] and [User][7] pages about systemd. + +Service example: + + [Unit] + Description=Run top 5 Mate drinkers stats + + [Service] + Environment=PYTHONPATH=/path/to/coffee-getter + ExecStart=/path/to/coffee-getter/run/top5_mate_stats.py + +Timer example: + + [Unit] + Description=Run top 5 Mate drinkers stats each Mon 9am + + [Timer] + OnCalendar=Mon *-*-* 09:00:00 + Persistent=true + + [Install] + WantedBy=timers.target + +Store both files in: + + ~/.config/systemd/user/ + +Enable timer and service: + + systemctl --user enable top5_mate_stats.timer + systemctl --user enable top5_mate_stats.service + +Start the timer: + + systemctl --user start top5_mate_stats.timer + + +## Contribute +Use Test Driven Development. Run test with: + + python3 -m unittest discover ut + +Send patches with git-send-email: + + git config format.subjectPrefix "PATCH coffee-getter" + git config sendemail.to "jiri.vlasak.2@cvut.cz" + +You need the database for the development. You may create it by: + + python3 -c ' + from ut.test_db import create_test_db + create_test_db("coffee.db")'