Skip to content

Commit f84c6cd

Browse files
committed
doc update
1 parent bb24573 commit f84c6cd

File tree

7 files changed

+76
-224
lines changed

7 files changed

+76
-224
lines changed

CONTRIBUTING.md

Lines changed: 0 additions & 89 deletions
This file was deleted.

documentation.md

Lines changed: 53 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,21 @@
2020
* [support further development 🍺](#support-further-development)
2121
* [license](#license)
2222

23-
## requirements
2423

25-
* [node.js](https://nodejs.org/en/download) version >= 22
26-
* [npm](https://github.com/npm/npm) or [yarn](https://yarnpkg.com/en/docs/install)
24+
## features
2725

28-
## installation
26+
* command line
27+
* create reports in various formats from time tracking data stored on GitLab
28+
* monitor the time you spent on an issue or merge request locally and syncs the data to GitLab
2929

30-
Install the gtt command line interface using yarn:
3130

32-
```shell
33-
yarn global add gitlab-time-tracker --prefix /usr/local
34-
```
31+
## requirements
3532

36-
... or download a compiled binary from [here](https://github.com/kriskbx/gitlab-time-tracker/releases) and put it into your `PATH`.
33+
* GitLab instance
34+
35+
## installation
36+
37+
Download a compiled binary from [here](https://github.com/ndu2/gitlab-time-tracker/releases) and put it into your `PATH`.
3738

3839
Run the config command to create a config file and open it in your default editor.
3940
In linux terminal, you must set your preferred editor in the environment. For example, use `export EDITOR=vim` to edit the files with vim (put this in `.bashrc` or similar to have it always configured).
@@ -55,56 +56,57 @@ token: 01234567891011
5556
5657
**Updating from version <= 1.5? Please [click here](https://github.com/kriskbx/gitlab-time-tracker/blob/master/upgrade.md)!**
5758
58-
Update gtt via yarn:
59+
60+
## build tools
61+
62+
You will need node and npm to build the project
63+
64+
* [node.js](https://nodejs.org/en/download) version >= 22
65+
* [npm](https://github.com/npm/npm)
66+
67+
68+
Download the source code, and compile everything with
5969
6070
```shell
61-
yarn global upgrade gitlab-time-tracker
71+
npm install
72+
npm run-script buildAll
6273
```
6374

6475
## docker
6576

66-
You don't need to have node and gtt installed on your system in order to use gtt,
67-
you can use the official [Docker image](https://hub.docker.com/r/kriskbx/gitlab-time-tracker) as well:
77+
Build scripts including Dockerfile running the CommonJS build are provided. `npm run-script buildAll` will create a docker image (gitlab-time-tracker:latest).
78+
79+
Examples:
6880

6981
```shell
7082
docker run \
7183
--rm -it \
7284
-v ~/.local/share/.gtt/:/home/gtt/.local/share/.gtt \
73-
kriskbx/gitlab-time-tracker \
85+
gitlab-time-tracker:latest \
7486
--help
7587
```
7688

7789
`--rm` removes the container after running, `-it` makes it interactive, `-v ~/.local/share/.gtt/:/home/gtt/.local/share/.gtt ` mounts your gtt configuration directory in the gtt user home directory inside the container. For example, to run a report for a particular user with a date range:
7890

7991
```shell
80-
sudo docker run \
92+
docker run \
8193
--rm -it \
8294
-v ~/.local/share/.gtt/:/home/gtt/.local/share/.gtt \
83-
kriskbx/gitlab-time-tracker \
95+
gitlab-time-tracker:latest \
8496
report "ourorganization/aproject" --user=xxxx --from="2020-04-01" --to="2020-06-30"
8597
```
8698

87-
If you want to store the config in another place, mount another directory:
88-
89-
90-
```shell
91-
docker run \
92-
--rm -it \
93-
-v /path/to/gtt-config-dir:/home/gtt/.local/share/.gtt \
94-
kriskbx/gitlab-time-tracker \
95-
--help
96-
```
9799

98100
I highly recommend creating an alias and adding it to your `bashrc`:
99101

100102
```shell
101-
echo "alias gtt='docker run --rm -it -v -v ~/.local/share/.gtt/:/home/gtt/.local/share/.gtt kriskbx/gitlab-time-tracker'" >>~/.bashrc
103+
echo "alias gtt='docker run --rm -it -v -v ~/.local/share/.gtt/:/home/gtt/.local/share/.gtt gitlab-time-tracker:latest'" >>~/.bashrc
102104
```
103105

104106
Now you can simply write `gtt` instead of the bulky Docker command before. Try it out: `gtt --help`
105107

106108
**Note:** If you want to save reports via the `--file` parameter, make sure to save them in `/root` or another
107-
mounted directory that you have access to on your host machine. Take a look at the [Docker documentation](https://docs.docker.com/engine/tutorials/dockervolumes/) about how Dopcker handles data and volumes.
109+
mounted directory that you have access to on your host machine. Take a look at the [Docker documentation](https://docs.docker.com/engine/tutorials/dockervolumes/) about how Docker handles data and volumes.
108110

109111
## commands
110112

@@ -196,7 +198,7 @@ gtt edit 2XZkV5LNM
196198
gtt edit
197199
```
198200

199-
You can omit the id to edit the last added time record.
201+
You can omit the id to edit to bring up a list of the latest records to choose from.
200202

201203
**Delete a local time record by the given id:**
202204

@@ -207,6 +209,17 @@ gtt delete
207209

208210
You can omit the id to delete the last added time record.
209211

212+
213+
**Resume previous activity:**
214+
215+
```shell
216+
gtt resume
217+
gtt resume --ask
218+
```
219+
220+
Resume the last activity (--ask let you choose the activity to resume)
221+
222+
210223
**Sync local time records with time tracking data on Gitlab:**
211224

212225
```shell
@@ -288,6 +301,10 @@ gtt report --output=invoice --file=invoice.md --from 2021-02-01 --to 2021-02-28
288301

289302
For paper invoice, further process the output with a css, see the folder preview (styles.css, invoice.pdf)
290303

304+
305+
![invoice example](preview/invoice.png)
306+
307+
291308
#### Print the output to a file
292309

293310
```shell
@@ -786,63 +803,6 @@ timeFormat: "[%sign][%hours_overall:2]"
786803
18,25
787804
```
788805

789-
## how to use gtt as a library
790-
791-
Add as a dependency using yarn:
792-
793-
```shell
794-
yarn add gitlab-time-tracker
795-
```
796-
797-
... or using npm:
798-
799-
```shell
800-
npm install --save gitlab-time-tracker
801-
```
802-
803-
Use it in your project:
804-
805-
```js
806-
// require modules
807-
const Config = require('gitlab-time-tracker/src/include/config');
808-
const Report = require('gitlab-time-tracker/src/models/report');
809-
810-
// create a default config
811-
let config = new Config();
812-
813-
// set required parameters
814-
config.set('token', 'abcdefghijklmnopqrst');
815-
config.set('project', 'namespace/project');
816-
817-
// create report
818-
let report = new Report(config);
819-
820-
// query and process data
821-
try {
822-
await report.getProject()
823-
await report.getIssues()
824-
await report.getMergeRequests()
825-
await report.processIssues()
826-
await report.processMergeRequests()
827-
} catch (error) {
828-
console.log(error)
829-
}
830-
831-
// access data on report
832-
report.issues.forEach(issue => {
833-
// time records on issue
834-
console.log(issue.times);
835-
// time spent of single time record
836-
console.log(issue.times[0].time);
837-
});
838-
report.mergeRequests.forEach(mergeRequest => {
839-
// time records on merge requests
840-
console.log(mergeRequest.times);
841-
// user of single time record
842-
console.log(mergeRequest.times[0].user);
843-
});
844-
```
845-
846806
## dumps
847807

848808
Starting with 1.7.4 gtt can dump the results of all API requests within a report and use it on another machine without access to the GitLab instance itself. This is very useful for debugging purposes. If you stumble upon a bug which could be unique to your set of data, please rerun the report with these options to save a dump to the given file: `--output=dump --file=/path/dump.json` Check your dump for sensitive information and provide it when asked.
@@ -857,22 +817,23 @@ is the total amount of time spent in the given time frame.
857817

858818
## contributing
859819

860-
I would love to integrate unit testing in this project, but unfortunately my knowledge of
861-
testing in the JavaScript/Node.js world is very limited. (I'm actually a PHP dev)
862-
So this would be a very helpful thing to contribute but of course all contributions are very welcome.
820+
If you would like to contribute and provide bug fixes:
863821

864822
* Please work in your own branch, e.g. `integrate-awesome-feature`, `fix-awful-bug`, `improve-this-crappy-docs`
865-
* Create a pull request to the `dev` branch
823+
* Create a pull request to the `main` branch
824+
866825

867826
## support further development
868827

869-
gtt is an open source project, developed and maintained completely in my free time.
828+
gtt is an open source project.
870829

871830
If you enjoy using gtt you can support the project by [contributing](#contributing) to the code base,
872-
sharing it to your colleagues and co-workers or monetarily by [donating via PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DN9YVDKFGC6V6).
831+
sharing it to your colleagues and co-workers or monetarily by [donating via PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DN9YVDKFGC6V6) to the original author.
873832
Every type of support is helpful and thank you very much if you consider supporting the project
874833
or already have done so. 💜
875834

835+
Commercial support is available via my employer (see my github profile).
836+
876837
## license
877838

878839
GPL v2

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"test": "NODE_ENV=test mocha 'spec/**/*.spec.js'",
1717
"esbuild": "esbuild 'src/gtt.js' --format=cjs --target=node20 --platform=node --bundle --outfile=dist/gtt.cjs --inject:./src/polyfill/import-meta-url.js --define:import.meta.url=import_meta_url",
1818
"pkg": "pkg dist/gtt.cjs -o out/gtt -c package.json",
19-
"docker": "docker build . -t gtt:${npm_package_version} -t gtt:latest",
19+
"docker": "docker build . -t gitlab-time-tracker:${npm_package_version} -t gitlab-time-tracker:latest",
2020
"buildAll": "npm run-script prebuild && npm run-script test && npm run-script esbuild && npm run-script pkg && npm run-script docker"
2121
},
2222
"bin": {

preview/invoice.png

42 KB
Loading

0 commit comments

Comments
 (0)