Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit 914161a

Browse files
authored
Merge branch 'master' into test
2 parents 18582dc + ec5ca47 commit 914161a

File tree

6 files changed

+93
-7
lines changed

6 files changed

+93
-7
lines changed

CONTRIBUTING.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Contributing
2+
3+
## How to test the basic functions of gtt
4+
5+
Create a new project on GitLab if you haven't done so already and write down the project path. e.g. `kriskbx/example-project`. To test groups and subgroups, create a new group with at least one subgroup. Add a new project to both the parent group (e.g. `example-group`) and the subgroup (e.g. `example-group/example-subgroup`) and write down the paths of all the projects and groups. Create at least two issues (write down their id e.g. `42`, `43`) and one merge request (e.g. `13`) in all projects. Or just use our public group over here: https://gitlab.com/gtt
6+
7+
Then run the following basic commands and check that they work as expected:
8+
9+
```
10+
# Test config command
11+
gtt config
12+
13+
# Test basic time tracking
14+
gtt start "kriskbx/example-project" 42
15+
gtt stop
16+
gtt log
17+
18+
# Test cancelling
19+
gtt start "kriskbx/example-project" 42
20+
gtt cancel
21+
gtt log
22+
23+
# Test merge request
24+
gtt start --type=merge_request "kriskbx/example-project" 13
25+
gtt stop
26+
gtt log
27+
28+
# Test issue creation
29+
gtt create "krisbxkbx/example-project" "New Issue"
30+
gtt stop
31+
gtt log
32+
33+
# Test editing
34+
gtt edit
35+
36+
# Test deletion
37+
gtt start "kriskbx/example-project" 42
38+
gtt stop
39+
gtt delete
40+
41+
# Test sync, check out issues on GitLab if changes are synced correctly
42+
gtt sync
43+
44+
# Test basic report
45+
gtt report "kriskbx/example-project"
46+
47+
# Test report for a single issue and multiple issues
48+
gtt report "kriskbx/example-project" 42
49+
gtt report "kriskbx/example-project" 42 43
50+
51+
# Test report for a group
52+
gtt report --type=group "example-group"
53+
gtt report --type=group --subgroups "example-group"
54+
55+
# Test combined reports
56+
gtt report "kriskbx/example-project" "example-group/example-project"
57+
58+
# Test outputs
59+
gtt report --output=table "kriskbx/example-project"
60+
gtt report --output=markdown "kriskbx/example-project"
61+
gtt report --output=csv "kriskbx/example-project"
62+
gtt report --output=pdf --file=test.pdf "kriskbx/example-project"
63+
gtt report --output=xlsx --file=test.xlsx "kriskbx/example-project"
64+
65+
# Test timeframes (adjust the values so it includes/excludes your issues)
66+
gtt report --from="2020-06-02" --to="2020-06-03" "kriskbx/example-project"
67+
68+
# Test filtering (you might need to add milestones, labels and additional stuff to properly test this)
69+
gtt report --closed "kriskbx/example-project"
70+
gtt report --user=username "kriskbx/example-project"
71+
gtt report --milestone=milestone_name "kriskbx/example-project"
72+
gtt report --include_by_labels=critical "kriskbx/example-project"
73+
gtt report --exclude_by_labels=ignore "kriskbx/example-project"
74+
gtt report --query=issues "kriskbx/example-project"
75+
```

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
FROM node:8.2.1-alpine
22

33
ENV GTT_VERSION 1.7.39
4+
ENV EDITOR vi
5+
6+
WORKDIR /pwd
47

58
RUN yarn global add --prefix /usr/local "gitlab-time-tracker@$GTT_VERSION"
69

7-
VOLUME ["/root"]
10+
VOLUME ["/root", "/pwd"]
811
ENTRYPOINT ["gtt"]
912
CMD ["--help"]

documentation.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,13 @@ you can use the official [Docker image](https://hub.docker.com/r/kriskbx/gitlab-
7070
docker run \
7171
--rm -it \
7272
-v ~:/root \
73+
-v $(pwd):/pwd \
7374
kriskbx/gitlab-time-tracker \
7475
--help
7576
```
7677

7778
`--rm` removes the container after running, `-it` makes it interactive, `-v ~:/root` mounts your home directory to the
78-
home directory inside the container. If you want to store the config in another place, mount another directory:
79+
home directory inside the container, `-v $(pwd):/pwd` mounts current directory inside the container to gtt be able to read local config. If you want to store the config in another place, mount another directory:
7980

8081

8182
```shell
@@ -101,7 +102,7 @@ docker run \
101102
I highly recommend creating an alias and adding it to your `bashrc`:
102103

103104
```shell
104-
echo "alias gtt='docker run --rm -it -v ~:/root kriskbx/gitlab-time-tracker'" >>~/.bashrc
105+
echo "alias gtt='docker run --rm -it -v ~:/root -v $(pwd):/pwd kriskbx/gitlab-time-tracker'" >>~/.bashrc
105106
```
106107

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

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"read-yaml": "^1.1.0",
5656
"shelljs": "^0.8.3",
5757
"tempfile": "^2.0.0",
58+
"throttled-queue": "^1.0.7",
5859
"underscore": "^1.9.1",
5960
"xdg-basedir": "^3.0.0",
6061
"xlsx": "^0.13.5"

src/models/base.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const async = require('async');
22
const crypto = require('crypto');
3+
const throttle = require('throttled-queue')(10, 1000);
34

45
/**
56
* base model
@@ -18,7 +19,7 @@ class base {
1819
this._perPage = this.config ? this.config.get('_perPage') : 100;
1920
this._parallel = this.config ? this.config.get('_parallel') : 4;
2021
this._proxy = this.config && this.config.get('proxy') ? this.config.get('proxy') : undefined;
21-
this._insecure = this.config && this.config.get('unsecure') ? this.config.get('unsecure') : false;
22+
this._insecure = this.config && this.config.get('insecure') ? this.config.get('insecure') : false;
2223
}
2324

2425
/**
@@ -48,7 +49,7 @@ class base {
4849
if (this.config.get('_createDump')) this.setDump(response, key);
4950
resolve(response);
5051
}).catch(e => reject(e));
51-
});
52+
}));
5253
}
5354

5455
/**
@@ -78,7 +79,7 @@ class base {
7879
if (this.config.get('_createDump')) this.setDump(response, key);
7980
resolve(response);
8081
}).catch(e => reject(e));
81-
});
82+
}));
8283
}
8384

8485
/**
@@ -194,4 +195,4 @@ class base {
194195
}
195196
}
196197

197-
module.exports = base;
198+
module.exports = base;

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2429,6 +2429,11 @@ [email protected], text-encoding@^0.6.4:
24292429
version "0.6.4"
24302430
resolved "https://registry.yarnpkg.com/text-encoding/-/text-encoding-0.6.4.tgz#e399a982257a276dae428bb92845cb71bdc26d19"
24312431

2432+
throttled-queue@^1.0.7:
2433+
version "1.0.7"
2434+
resolved "https://registry.yarnpkg.com/throttled-queue/-/throttled-queue-1.0.7.tgz#da7ed6702941993044a1c5fd2ac3a58582dd2977"
2435+
integrity sha512-/HT49S7m+NvdyJMoMRzIYlawKjeHn8jEc8TZaGmFi5IBu09hIiU/QoP1zcrB9X2qsVC11PgfRfqd8zEQs7PlEA==
2436+
24322437
throttleit@^1.0.0:
24332438
version "1.0.0"
24342439
resolved "https://registry.yarnpkg.com/throttleit/-/throttleit-1.0.0.tgz#9e785836daf46743145a5984b6268d828528ac6c"

0 commit comments

Comments
 (0)