519c0b074a | ||
---|---|---|
app | ||
scripts | ||
.gitignore | ||
README.org | ||
box.json | ||
box.phar | ||
todo.txt |
README.org
Report cli
Automate generating invoices from youtrack reports and other time-tracking related functionality.
Usage
./rprt.php invoice -y -p -s
This command would send an invoice for last month created from the template file and last month report from youtrack as an email attachment.
./rprt.php report -r
Asks which report to print from the list of your reports and then prints out a table with that report.
Install/Getting started
Get .phar
file from r, Run configruration wizzard (planned for version 1.0).
Before version 1.0 is released you have to navigate into /app
directory
and call command through .rprt.php
file.
Requirements
- You have to create a youtrack API token.
-
You have to configure rprt-cli app.
- Default folder that app checks for config file is in
~/.config/rprt-cli/
.
- Default folder that app checks for config file is in
- You have to allow less secure applications in your gmail if you are using that email provider.
Building a phar
php box: https://github.com/box-project/box
./box.phar compile
Specs
A simple Console Command that prints out monthly report from youtrack.
Simple configuration:
- authentication token value
- project categories
- hourly wage
- folder for reports
Components
-
report service - provides a csv of a report
- local csv file read (provided via argument)
-
youtrack api request (with Guzzle and Youtrack API php client )
-
parse report
- compute hours per configured project categories from report
- output a table
-
Create an invoice
- send the invoice (to Wolfgang)
ValueObjects
List my reports
curl 'https://drunomics.myjetbrains.com/youtrack/api/reports?$top=-1&fields=id,name,own,owner(login,name)&query=owner:+%7Bme%7D' -H "Authorization: Bearer $YTOKEN" -H 'Cache-Control: no-cache' | jq '.[] | select( .own == true )'
Motivation
- practice php
-
automatization of repetitive task
- is it worth it? according to xkcd table - you should spend 1 day for automating a monthly task that takes 30 minutes. That would be if only I'd be using this app. If it get's picked up, by 5 others - it is worth 5 days of development.
- remove errors from reports
Support the work
If you find this Free Software useful you can consider donating to my @tehno-klistir liberapay account.
Development
Testing
Main source at symfony console command page. If you read thouroughly:
When using the Console component in a standalone project, use Application and extend the normal \PHPUnit\Framework\TestCase.
Plan
most current
-
For version 0.6.7
- data value objects
- phar file
- additional expenses
-
For version 1.0
-
plugin system
- for time tracking services
- for reports
- symfony/config & symfony/di components
-
-
Time tracking service
- youtrack-api
- jira-api
- kimai (https://www.kimai.org/documentation/timesheet.html)
current
-
For Version 1.0
- Track Command (track time from your cli)
- Report Command (read reports)
- Improve code and code style
.phar
file for simple app shipping
-
Version 2.0
- Implement templateing service
- Further code improvements
- Configuration Wizzard
-
Version 3.0
- Emacs package to track directly from orgmode
- Add tests
old
-
Basic structure of the cli-app
-
App preparation
- nice specifications
- composer project
- autoloading & dependency injection
-
Report service
- read a local csv file
-
Parse report
- read configuration (project categories, hourly wage)
- simple table output
-
-
First round of enhancements
- Tests
- youtrack request
- create composer package, create executable
-
Second round of enhancements
- Invoice output
- configuration wizard
Learning
-
https://www.youtube.com/watch?v=aCqM9YnjTe0
- Choices (
new ChoiceQuestion
) addOption('config')
- Choices (
API calls
Get csv file
curl 'https://drunomics.myjetbrains.com/youtrack/api/reports/83-554/export/csv?&$top=-1' -H 'Accept: application/json, text/plain, */*' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H "Authorization: Bearer $TKN" > ~/Documents/Drunomics/workhours/2021/21-09.csv