stand 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/README.md +35 -19
- data/lib/standup/app.rb +1 -2
- data/lib/standup/report_generator.rb +54 -27
- data/lib/standup/version.rb +1 -1
- data/stand.gemspec +2 -1
- metadata +17 -3
- data/Gemfile.lock +0 -168
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76fed7b4155b7cc0affefd311d7ae03e2f87c2fd
|
4
|
+
data.tar.gz: 8baac876f06b2ca659d44d8c9ecb21510e6f624d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e43e732b7d57f6db23dd44f43fa85ba4c776ee0313fa56cc04f569b2921aaac0d2a81d70326becb7af7f95d8da9eacde43e83ad47f792680e399bde0ae035cc9
|
7
|
+
data.tar.gz: e801ca86fbf75e0b38a244b4e904c06ffd6d5594600711fdc3d0982b79c40fe16c3ddd7acabcb8df5529fa22a0733a5defa3e14fba87dc2d1dfe8d801a8ac822
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,42 +1,58 @@
|
|
1
1
|
# Standup
|
2
2
|
|
3
|
+
[](https://badge.fury.io/rb/stand)
|
4
|
+
|
3
5
|
This gem is a simple binary to help you generate reports of your work.
|
4
6
|
|
5
|
-
|
7
|
+
## Installation
|
6
8
|
|
7
9
|
- Install with `gem install stand`
|
8
10
|
- Generate a new token on https://gitlab.example.net/profile/personal_access_tokens with the "api" scope
|
9
11
|
- Create the file `$HOME/.standup/standup.yml` with the following content:
|
10
12
|
|
11
|
-
|
13
|
+
```yaml
|
12
14
|
gitlab_access_token: 'AbCdEfGhIjKlMnOp'
|
13
15
|
gitlab_endpoint: 'https://gitlab.example.net/api/v3'
|
14
|
-
|
15
|
-
|
16
|
+
```
|
16
17
|
|
17
|
-
|
18
|
+
## Usage
|
18
19
|
|
19
20
|
And you are good to go via
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
22
|
+
```bash
|
23
|
+
~$ standup --username <gitlab_username>
|
24
|
+
+------------+-------+-----+------------------------------------------------+
|
25
|
+
| DONE |
|
26
|
+
+------------+-------+-----+------------------------------------------------+
|
27
|
+
| PROJECT | TYPE | ID | TITLE |
|
28
|
+
+------------+-------+-----+------------------------------------------------+
|
29
|
+
| myproject | MR | #1 | I broke everything |
|
30
|
+
| myproject | MR | #2 | This should fix it |
|
31
|
+
| myproject | MR | #3 | Getting there |
|
32
|
+
| myproject | ISSUE | #1 | Super feature |
|
33
|
+
| myproject | ISSUE | #2 | Great feature |
|
34
|
+
+------------+-------+-----+------------------------------------------------+
|
35
|
+
|
36
|
+
+------------+-------+-----+------------------------------------------------+
|
37
|
+
| REVIEWED |
|
38
|
+
+------------+-------+-----+------------------------------------------------+
|
39
|
+
| PROJECT | TYPE | ID | TITLE |
|
40
|
+
+------------+-------+-----+------------------------------------------------+
|
41
|
+
| myproject | MR | #4 | Not there yet |
|
42
|
+
| myproject | MR | #5 | All set ! |
|
43
|
+
+------------+-------+-----+------------------------------------------------+
|
44
|
+
```
|
30
45
|
|
31
46
|
Forgot a standup two days ago? Just
|
32
47
|
|
33
|
-
|
34
|
-
|
48
|
+
```bash
|
49
|
+
~$ standup --from 2017-02-01 --to 2017-02-02 --username <gitlab_username>
|
50
|
+
```
|
35
51
|
|
36
|
-
|
52
|
+
## Integrations
|
37
53
|
|
38
|
-
For now,
|
54
|
+
For now, Gitlab's API only.
|
39
55
|
|
40
|
-
|
56
|
+
## License
|
41
57
|
|
42
58
|
MIT Licensed © Capitaine Train SAS
|
data/lib/standup/app.rb
CHANGED
@@ -7,14 +7,13 @@ module Standup
|
|
7
7
|
class App
|
8
8
|
include EasyAppHelper
|
9
9
|
|
10
|
-
VERSION = '0.0.1'
|
11
10
|
NAME = 'Auto Standup'
|
12
11
|
DESCRIPTION = 'Fetchs data from gitlab to report what you have done'
|
13
12
|
|
14
13
|
def initialize
|
15
14
|
config.config_file_base_name = 'standup'
|
16
15
|
config.describes_application app_name: NAME,
|
17
|
-
app_version: VERSION,
|
16
|
+
app_version: Standup::VERSION,
|
18
17
|
app_description: DESCRIPTION
|
19
18
|
add_script_options
|
20
19
|
end
|
@@ -1,20 +1,19 @@
|
|
1
1
|
require 'gitlab'
|
2
|
+
require 'terminal-table'
|
2
3
|
|
3
4
|
module Standup
|
4
5
|
class ReportGenerator
|
5
6
|
def initialize(settings)
|
6
7
|
@settings = settings
|
8
|
+
@result = {
|
9
|
+
'done' => [],
|
10
|
+
'reviewed' => [],
|
11
|
+
}
|
7
12
|
|
8
13
|
configure_gitlab_client
|
9
14
|
end
|
10
15
|
|
11
16
|
def gitlab_report!
|
12
|
-
done = []
|
13
|
-
reviewed = []
|
14
|
-
config = @settings.config
|
15
|
-
to_date = @settings.to_date
|
16
|
-
from_date = @settings.from_date
|
17
|
-
|
18
17
|
projects_query = {
|
19
18
|
per_page: 10,
|
20
19
|
scope: :owned,
|
@@ -30,6 +29,13 @@ module Standup
|
|
30
29
|
sort: :desc
|
31
30
|
}
|
32
31
|
|
32
|
+
issues_query = {
|
33
|
+
per_page: 100,
|
34
|
+
state: :closed,
|
35
|
+
order_by: :updated_at,
|
36
|
+
sort: :desc
|
37
|
+
}
|
38
|
+
|
33
39
|
projects = Gitlab.projects(projects_query)
|
34
40
|
|
35
41
|
projects.each do |project|
|
@@ -40,40 +46,61 @@ module Standup
|
|
40
46
|
merged_mrs = []
|
41
47
|
end
|
42
48
|
|
49
|
+
begin
|
50
|
+
closed_issues = Gitlab.issues(project.id, issues_query)
|
51
|
+
rescue Gitlab::Error::Forbidden
|
52
|
+
closed_issues = []
|
53
|
+
end
|
54
|
+
|
43
55
|
merged_mrs.each do |mr|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
updated_at > from_date
|
50
|
-
|
51
|
-
if author == config[:username]
|
52
|
-
done << "#{mr.title} (#{project.name})"
|
53
|
-
elsif assignee == config[:username]
|
54
|
-
reviewed << "#{mr.title} (#{project.name})"
|
55
|
-
end
|
56
|
-
end
|
56
|
+
validate_state(project, mr, 'MR')
|
57
|
+
end
|
58
|
+
|
59
|
+
closed_issues.each do |issue|
|
60
|
+
validate_state(project, issue, 'ISSUE')
|
57
61
|
end
|
58
62
|
end
|
59
63
|
|
60
|
-
puts '
|
61
|
-
puts
|
62
|
-
puts
|
64
|
+
puts Terminal::Table.new :title => 'DONE', :headings => [ 'PROJECT', 'TYPE', 'ID', 'TITLE' ], :rows => @result['done']
|
65
|
+
puts "\n"
|
66
|
+
puts Terminal::Table.new :title => 'REVIEWED', :headings => [ 'PROJECT', 'TYPE', 'ID', 'TITLE' ], :rows => @result['reviewed']
|
63
67
|
|
64
|
-
puts '--- REVIEWED ---'
|
65
|
-
puts reviewed
|
66
|
-
puts "----------------\n\n"
|
67
68
|
end
|
68
69
|
|
69
70
|
private
|
70
71
|
|
72
|
+
def config
|
73
|
+
@settings.config
|
74
|
+
end
|
75
|
+
|
76
|
+
def to_date
|
77
|
+
@settings.to_date
|
78
|
+
end
|
79
|
+
|
80
|
+
def from_date
|
81
|
+
@settings.from_date
|
82
|
+
end
|
83
|
+
|
84
|
+
def validate_state(project, event, type='?')
|
85
|
+
updated_at = Time.parse(event.updated_at)
|
86
|
+
author = event.author.username
|
87
|
+
assignee = event.assignee && event.assignee.username
|
88
|
+
|
89
|
+
if updated_at < to_date && updated_at > from_date
|
90
|
+
if author == config[:username]
|
91
|
+
@result['done'] << [project.name, type, "##{event.iid}", event.title]
|
92
|
+
elsif assignee == config[:username]
|
93
|
+
@result['reviewed'] << [project.name, type, "##{event.iid}", event.title]
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
71
98
|
def configure_gitlab_client
|
72
|
-
api_endpoint =
|
99
|
+
api_endpoint = config['gitlab_endpoint'] || 'https://gitlab.com/api/v3'.freeze
|
73
100
|
|
74
101
|
Gitlab.configure do |c|
|
75
102
|
c.endpoint = api_endpoint
|
76
|
-
c.private_token =
|
103
|
+
c.private_token = config['gitlab_access_token']
|
77
104
|
end
|
78
105
|
end
|
79
106
|
end
|
data/lib/standup/version.rb
CHANGED
data/stand.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.licenses = ['MIT']
|
7
7
|
s.version = Standup::VERSION
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
|
-
s.authors = ['Paul Bonaud', 'Théophile Helleboid']
|
9
|
+
s.authors = ['Paul Bonaud', 'Théophile Helleboid', 'Maxime Visonneau']
|
10
10
|
s.email = ['paul.bonaud@trainline.com']
|
11
11
|
s.homepage = 'https://rubygems.org/gems/stand'
|
12
12
|
s.summary = %q(Generate your standup reports instantly.)
|
@@ -22,6 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_dependency 'easy_app_helper'
|
23
23
|
s.add_dependency 'activesupport'
|
24
24
|
s.add_dependency 'gitlab'
|
25
|
+
s.add_dependency 'terminal-table'
|
25
26
|
|
26
27
|
s.add_development_dependency 'pry'
|
27
28
|
s.add_development_dependency 'guard'
|
metadata
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stand
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Bonaud
|
8
8
|
- Théophile Helleboid
|
9
|
+
- Maxime Visonneau
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date: 2017-05-
|
13
|
+
date: 2017-05-19 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: easy_app_helper
|
@@ -53,6 +54,20 @@ dependencies:
|
|
53
54
|
- - ">="
|
54
55
|
- !ruby/object:Gem::Version
|
55
56
|
version: '0'
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: terminal-table
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
type: :runtime
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
56
71
|
- !ruby/object:Gem::Dependency
|
57
72
|
name: pry
|
58
73
|
requirement: !ruby/object:Gem::Requirement
|
@@ -273,7 +288,6 @@ extra_rdoc_files: []
|
|
273
288
|
files:
|
274
289
|
- ".gitignore"
|
275
290
|
- Gemfile
|
276
|
-
- Gemfile.lock
|
277
291
|
- LICENSE
|
278
292
|
- README.md
|
279
293
|
- bin/standup
|
data/Gemfile.lock
DELETED
@@ -1,168 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
standup (0.0.1)
|
5
|
-
activesupport
|
6
|
-
easy_app_helper
|
7
|
-
gitlab
|
8
|
-
|
9
|
-
GEM
|
10
|
-
remote: https://rubygems.org/
|
11
|
-
specs:
|
12
|
-
activesupport (5.0.1)
|
13
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
-
i18n (~> 0.7)
|
15
|
-
minitest (~> 5.1)
|
16
|
-
tzinfo (~> 1.1)
|
17
|
-
addressable (2.5.0)
|
18
|
-
public_suffix (~> 2.0, >= 2.0.2)
|
19
|
-
ast (2.3.0)
|
20
|
-
builder (3.2.3)
|
21
|
-
ci_reporter (2.0.0)
|
22
|
-
builder (>= 2.1.2)
|
23
|
-
ci_reporter_rspec (1.0.0)
|
24
|
-
ci_reporter (~> 2.0)
|
25
|
-
rspec (>= 2.14, < 4)
|
26
|
-
coderay (1.1.1)
|
27
|
-
concurrent-ruby (1.0.4)
|
28
|
-
crack (0.4.3)
|
29
|
-
safe_yaml (~> 1.0.0)
|
30
|
-
deep_merge (1.1.1)
|
31
|
-
diff-lcs (1.3)
|
32
|
-
docile (1.1.5)
|
33
|
-
easy_app_helper (4.2.3)
|
34
|
-
activesupport
|
35
|
-
stacked_config (~> 2.0.0)
|
36
|
-
ffi (1.9.17)
|
37
|
-
formatador (0.2.5)
|
38
|
-
gitlab (3.7.0)
|
39
|
-
httparty (~> 0.13.0)
|
40
|
-
terminal-table
|
41
|
-
guard (2.14.1)
|
42
|
-
formatador (>= 0.2.4)
|
43
|
-
listen (>= 2.7, < 4.0)
|
44
|
-
lumberjack (~> 1.0)
|
45
|
-
nenv (~> 0.1)
|
46
|
-
notiffany (~> 0.0)
|
47
|
-
pry (>= 0.9.12)
|
48
|
-
shellany (~> 0.0)
|
49
|
-
thor (>= 0.18.1)
|
50
|
-
guard-compat (1.2.1)
|
51
|
-
guard-rspec (4.7.3)
|
52
|
-
guard (~> 2.1)
|
53
|
-
guard-compat (~> 1.1)
|
54
|
-
rspec (>= 2.99.0, < 4.0)
|
55
|
-
guard-rubocop (1.2.0)
|
56
|
-
guard (~> 2.0)
|
57
|
-
rubocop (~> 0.20)
|
58
|
-
hashdiff (0.3.2)
|
59
|
-
httparty (0.13.7)
|
60
|
-
json (~> 1.8)
|
61
|
-
multi_xml (>= 0.5.2)
|
62
|
-
i18n (0.8.0)
|
63
|
-
json (1.8.6)
|
64
|
-
listen (3.1.5)
|
65
|
-
rb-fsevent (~> 0.9, >= 0.9.4)
|
66
|
-
rb-inotify (~> 0.9, >= 0.9.7)
|
67
|
-
ruby_dep (~> 1.2)
|
68
|
-
lumberjack (1.0.11)
|
69
|
-
method_source (0.8.2)
|
70
|
-
minitest (5.10.1)
|
71
|
-
multi_xml (0.6.0)
|
72
|
-
nenv (0.3.0)
|
73
|
-
notiffany (0.1.1)
|
74
|
-
nenv (~> 0.1)
|
75
|
-
shellany (~> 0.0)
|
76
|
-
parser (2.4.0.0)
|
77
|
-
ast (~> 2.2)
|
78
|
-
powerpack (0.1.1)
|
79
|
-
pry (0.10.4)
|
80
|
-
coderay (~> 1.1.0)
|
81
|
-
method_source (~> 0.8.1)
|
82
|
-
slop (~> 3.4)
|
83
|
-
psych (2.0.8)
|
84
|
-
public_suffix (2.0.5)
|
85
|
-
rack (2.0.1)
|
86
|
-
rack-test (0.6.3)
|
87
|
-
rack (>= 1.0)
|
88
|
-
rainbow (2.2.1)
|
89
|
-
rake (12.0.0)
|
90
|
-
rb-fsevent (0.9.8)
|
91
|
-
rb-inotify (0.9.8)
|
92
|
-
ffi (>= 0.5.0)
|
93
|
-
rspec (3.5.0)
|
94
|
-
rspec-core (~> 3.5.0)
|
95
|
-
rspec-expectations (~> 3.5.0)
|
96
|
-
rspec-mocks (~> 3.5.0)
|
97
|
-
rspec-core (3.5.4)
|
98
|
-
rspec-support (~> 3.5.0)
|
99
|
-
rspec-expectations (3.5.0)
|
100
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
101
|
-
rspec-support (~> 3.5.0)
|
102
|
-
rspec-its (1.2.0)
|
103
|
-
rspec-core (>= 3.0.0)
|
104
|
-
rspec-expectations (>= 3.0.0)
|
105
|
-
rspec-mocks (3.5.0)
|
106
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
107
|
-
rspec-support (~> 3.5.0)
|
108
|
-
rspec-support (3.5.0)
|
109
|
-
rubocop (0.47.1)
|
110
|
-
parser (>= 2.3.3.1, < 3.0)
|
111
|
-
powerpack (~> 0.1)
|
112
|
-
rainbow (>= 1.99.1, < 3.0)
|
113
|
-
ruby-progressbar (~> 1.7)
|
114
|
-
unicode-display_width (~> 1.0, >= 1.0.1)
|
115
|
-
ruby-progressbar (1.8.1)
|
116
|
-
ruby_dep (1.5.0)
|
117
|
-
safe_yaml (1.0.4)
|
118
|
-
shellany (0.0.1)
|
119
|
-
simplecov (0.13.0)
|
120
|
-
docile (~> 1.1.0)
|
121
|
-
json (>= 1.8, < 3)
|
122
|
-
simplecov-html (~> 0.10.0)
|
123
|
-
simplecov-html (0.10.0)
|
124
|
-
simplecov-rcov (0.2.3)
|
125
|
-
simplecov (>= 0.4.1)
|
126
|
-
slop (3.6.0)
|
127
|
-
stacked_config (2.0.1)
|
128
|
-
slop (~> 3.0)
|
129
|
-
super_stack (~> 1.0)
|
130
|
-
super_stack (1.0.2)
|
131
|
-
deep_merge
|
132
|
-
psych (= 2.0.8)
|
133
|
-
terminal-table (1.7.3)
|
134
|
-
unicode-display_width (~> 1.1.1)
|
135
|
-
thor (0.19.4)
|
136
|
-
thread_safe (0.3.5)
|
137
|
-
timecop (0.8.1)
|
138
|
-
tzinfo (1.2.2)
|
139
|
-
thread_safe (~> 0.1)
|
140
|
-
unicode-display_width (1.1.3)
|
141
|
-
webmock (2.3.2)
|
142
|
-
addressable (>= 2.3.6)
|
143
|
-
crack (>= 0.3.2)
|
144
|
-
hashdiff
|
145
|
-
|
146
|
-
PLATFORMS
|
147
|
-
ruby
|
148
|
-
|
149
|
-
DEPENDENCIES
|
150
|
-
ci_reporter
|
151
|
-
ci_reporter_rspec
|
152
|
-
guard
|
153
|
-
guard-rspec
|
154
|
-
guard-rubocop
|
155
|
-
pry
|
156
|
-
rack-test
|
157
|
-
rake
|
158
|
-
rspec
|
159
|
-
rspec-its
|
160
|
-
rubocop
|
161
|
-
simplecov
|
162
|
-
simplecov-rcov
|
163
|
-
standup!
|
164
|
-
timecop
|
165
|
-
webmock
|
166
|
-
|
167
|
-
BUNDLED WITH
|
168
|
-
1.13.7
|