whatsup_github 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +1 -1
- data/CHANGELOG.md +27 -0
- data/Gemfile +4 -2
- data/Gemfile.lock +94 -57
- data/README.md +18 -1
- data/Rakefile +7 -5
- data/bin/console +4 -3
- data/exe/whatsup_github +1 -0
- data/lib/template/.whatsup.yml +9 -1
- data/lib/whatsup_github.rb +2 -2
- data/lib/whatsup_github/cli.rb +5 -4
- data/lib/whatsup_github/{config-reader.rb → config_reader.rb} +17 -6
- data/lib/whatsup_github/generator.rb +3 -1
- data/lib/whatsup_github/members.rb +18 -0
- data/lib/whatsup_github/pulls.rb +26 -12
- data/lib/whatsup_github/row.rb +20 -1
- data/lib/whatsup_github/row_collector.rb +33 -7
- data/lib/whatsup_github/runner.rb +6 -4
- data/lib/whatsup_github/table.rb +2 -1
- data/lib/whatsup_github/version.rb +3 -1
- data/lib/whatsup_github/{yaml-formatter.rb → yaml_formatter.rb} +6 -2
- data/whatsup_github.gemspec +27 -26
- metadata +33 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0633d017c04fd64dfdd657e5c88db7dfed9ec1ff6fd91d4fe6471a50d1e0308
|
4
|
+
data.tar.gz: 819d3cd2c72f38ea8df1fbd496a394b727d522ac52c620221fc9bb4f71b2a31e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f545b95c7dd6e2e6facb23eec0ffa26d4f8e9f7330698c7c2bd471a2affcc98bbbddef433b35ff74ae8ace4a639b223262409fd32caf9014ed5d5b1d47fd9ab
|
7
|
+
data.tar.gz: '0910958934e53e7a8feb8d63121f9193133a725057b7139df5fef6d4c2e16d506e44014afe55320027fda6c3514f1b8214a0f1fa9143583c79220054f16e2790'
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.7.
|
1
|
+
ruby-2.7.2
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,30 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## 0.4.0
|
4
|
+
|
5
|
+
### General
|
6
|
+
|
7
|
+
- Loading more data about pull requests via API
|
8
|
+
- Loading data about configured organization members via API
|
9
|
+
- Upgraded gem specs
|
10
|
+
- Removed non-working tests. TODO: Add tests for the output file.
|
11
|
+
|
12
|
+
### New configuration option
|
13
|
+
|
14
|
+
Added `membership` to configuration. Value: name of an organization to check membership of a contributor.
|
15
|
+
|
16
|
+
### New output data
|
17
|
+
|
18
|
+
Added `merge_commit`, `labels`, and `membership` to YAML output.
|
19
|
+
Values for `membership`:
|
20
|
+
- `true` if contributor is a member of the configured organization
|
21
|
+
- `false` if not a member
|
22
|
+
- empty if not configured
|
23
|
+
|
24
|
+
## 0.3.1
|
25
|
+
|
26
|
+
- Added `contributor` and `profile` output data.
|
27
|
+
|
1
28
|
## 0.3.0
|
2
29
|
|
3
30
|
- Added "magic word" to configuration file
|
data/Gemfile
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
4
6
|
|
5
7
|
# Specify your gem's dependencies in whatsup_github.gemspec
|
6
8
|
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,92 +1,129 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
whatsup_github (0.
|
5
|
-
netrc (~> 0.
|
6
|
-
octokit (~> 4.
|
7
|
-
thor (~>
|
4
|
+
whatsup_github (0.4.0)
|
5
|
+
netrc (~> 0.11)
|
6
|
+
octokit (~> 4.20)
|
7
|
+
thor (~> 1.1)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
+
activesupport (6.1.3.1)
|
13
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
+
i18n (>= 1.6, < 2)
|
15
|
+
minitest (>= 5.1)
|
16
|
+
tzinfo (~> 2.0)
|
17
|
+
zeitwerk (~> 2.3)
|
12
18
|
addressable (2.7.0)
|
13
19
|
public_suffix (>= 2.0.2, < 5.0)
|
14
|
-
aruba (0.
|
15
|
-
childprocess (>= 0
|
16
|
-
contracts (~> 0.
|
17
|
-
cucumber (>=
|
18
|
-
|
19
|
-
|
20
|
-
thor (>= 0.19, < 2.0)
|
21
|
-
backports (3.17.0)
|
20
|
+
aruba (1.0.4)
|
21
|
+
childprocess (>= 2.0, < 5.0)
|
22
|
+
contracts (~> 0.16.0)
|
23
|
+
cucumber (>= 2.4, < 6.0)
|
24
|
+
rspec-expectations (~> 3.4)
|
25
|
+
thor (~> 1.0)
|
22
26
|
builder (3.2.4)
|
23
|
-
childprocess (
|
24
|
-
coderay (1.1.
|
27
|
+
childprocess (4.0.0)
|
28
|
+
coderay (1.1.3)
|
29
|
+
concurrent-ruby (1.1.8)
|
25
30
|
contracts (0.16.0)
|
26
|
-
cucumber (3.
|
27
|
-
builder (>= 2.
|
28
|
-
cucumber-core (~>
|
29
|
-
cucumber-
|
30
|
-
cucumber-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
31
|
+
cucumber (5.3.0)
|
32
|
+
builder (~> 3.2, >= 3.2.4)
|
33
|
+
cucumber-core (~> 8.0, >= 8.0.1)
|
34
|
+
cucumber-create-meta (~> 2.0, >= 2.0.2)
|
35
|
+
cucumber-cucumber-expressions (~> 10.3, >= 10.3.0)
|
36
|
+
cucumber-gherkin (~> 15.0, >= 15.0.2)
|
37
|
+
cucumber-html-formatter (~> 9.0, >= 9.0.0)
|
38
|
+
cucumber-messages (~> 13.1, >= 13.1.0)
|
39
|
+
cucumber-wire (~> 4.0, >= 4.0.1)
|
40
|
+
diff-lcs (~> 1.4, >= 1.4.4)
|
41
|
+
multi_test (~> 0.1, >= 0.1.2)
|
42
|
+
sys-uname (~> 1.2, >= 1.2.1)
|
43
|
+
cucumber-core (8.0.1)
|
44
|
+
cucumber-gherkin (~> 15.0, >= 15.0.2)
|
45
|
+
cucumber-messages (~> 13.0, >= 13.0.1)
|
46
|
+
cucumber-tag-expressions (~> 2.0, >= 2.0.4)
|
47
|
+
cucumber-create-meta (2.0.4)
|
48
|
+
cucumber-messages (~> 13.1, >= 13.1.0)
|
49
|
+
sys-uname (~> 1.2, >= 1.2.1)
|
50
|
+
cucumber-cucumber-expressions (10.3.0)
|
51
|
+
cucumber-gherkin (15.0.2)
|
52
|
+
cucumber-messages (~> 13.0, >= 13.0.1)
|
53
|
+
cucumber-html-formatter (9.0.0)
|
54
|
+
cucumber-messages (~> 13.0, >= 13.0.1)
|
55
|
+
cucumber-messages (13.2.1)
|
56
|
+
protobuf-cucumber (~> 3.10, >= 3.10.8)
|
57
|
+
cucumber-tag-expressions (2.0.4)
|
58
|
+
cucumber-wire (4.0.1)
|
59
|
+
cucumber-core (~> 8.0, >= 8.0.1)
|
60
|
+
cucumber-cucumber-expressions (~> 10.3, >= 10.3.0)
|
61
|
+
cucumber-messages (~> 13.0, >= 13.0.1)
|
62
|
+
diff-lcs (1.4.4)
|
63
|
+
faraday (1.3.0)
|
64
|
+
faraday-net_http (~> 1.0)
|
44
65
|
multipart-post (>= 1.2, < 3)
|
45
|
-
|
46
|
-
|
66
|
+
ruby2_keywords
|
67
|
+
faraday-net_http (1.0.1)
|
68
|
+
ffi (1.15.0)
|
69
|
+
i18n (1.8.9)
|
70
|
+
concurrent-ruby (~> 1.0)
|
47
71
|
method_source (1.0.0)
|
48
|
-
|
72
|
+
middleware (0.1.0)
|
73
|
+
minitest (5.14.4)
|
49
74
|
multi_test (0.1.2)
|
50
75
|
multipart-post (2.1.1)
|
51
76
|
netrc (0.11.0)
|
52
|
-
octokit (4.
|
77
|
+
octokit (4.20.0)
|
53
78
|
faraday (>= 0.9)
|
54
79
|
sawyer (~> 0.8.0, >= 0.5.3)
|
55
|
-
|
80
|
+
protobuf-cucumber (3.10.8)
|
81
|
+
activesupport (>= 3.2)
|
82
|
+
middleware
|
83
|
+
thor
|
84
|
+
thread_safe
|
85
|
+
pry (0.14.0)
|
56
86
|
coderay (~> 1.1)
|
57
87
|
method_source (~> 1.0)
|
58
|
-
public_suffix (4.0.
|
59
|
-
rake (13.0.
|
60
|
-
rspec (3.
|
61
|
-
rspec-core (~> 3.
|
62
|
-
rspec-expectations (~> 3.
|
63
|
-
rspec-mocks (~> 3.
|
64
|
-
rspec-core (3.
|
65
|
-
rspec-support (~> 3.
|
66
|
-
rspec-expectations (3.
|
88
|
+
public_suffix (4.0.6)
|
89
|
+
rake (13.0.3)
|
90
|
+
rspec (3.10.0)
|
91
|
+
rspec-core (~> 3.10.0)
|
92
|
+
rspec-expectations (~> 3.10.0)
|
93
|
+
rspec-mocks (~> 3.10.0)
|
94
|
+
rspec-core (3.10.1)
|
95
|
+
rspec-support (~> 3.10.0)
|
96
|
+
rspec-expectations (3.10.1)
|
67
97
|
diff-lcs (>= 1.2.0, < 2.0)
|
68
|
-
rspec-support (~> 3.
|
69
|
-
rspec-mocks (3.
|
98
|
+
rspec-support (~> 3.10.0)
|
99
|
+
rspec-mocks (3.10.2)
|
70
100
|
diff-lcs (>= 1.2.0, < 2.0)
|
71
|
-
rspec-support (~> 3.
|
72
|
-
rspec-support (3.
|
101
|
+
rspec-support (~> 3.10.0)
|
102
|
+
rspec-support (3.10.2)
|
103
|
+
ruby2_keywords (0.0.4)
|
73
104
|
sawyer (0.8.2)
|
74
105
|
addressable (>= 2.3.5)
|
75
106
|
faraday (> 0.8, < 2.0)
|
76
|
-
|
107
|
+
sys-uname (1.2.2)
|
108
|
+
ffi (~> 1.1)
|
109
|
+
thor (1.1.0)
|
110
|
+
thread_safe (0.3.6)
|
111
|
+
tzinfo (2.0.4)
|
112
|
+
concurrent-ruby (~> 1.0)
|
113
|
+
zeitwerk (2.4.2)
|
77
114
|
|
78
115
|
PLATFORMS
|
79
116
|
ruby
|
80
117
|
x86_64-darwin-19
|
81
118
|
|
82
119
|
DEPENDENCIES
|
83
|
-
aruba (~> 0
|
84
|
-
bundler (~>
|
85
|
-
cucumber (~> 3
|
86
|
-
pry (~> 0.
|
120
|
+
aruba (~> 1.0)
|
121
|
+
bundler (~> 2.2)
|
122
|
+
cucumber (~> 5.3)
|
123
|
+
pry (~> 0.14)
|
87
124
|
rake (~> 13.0)
|
88
|
-
rspec (~> 3.
|
125
|
+
rspec (~> 3.10)
|
89
126
|
whatsup_github!
|
90
127
|
|
91
128
|
BUNDLED WITH
|
92
|
-
|
129
|
+
2.2.15
|
data/README.md
CHANGED
@@ -32,6 +32,7 @@ Added documentation about [New Magento feature](https://devdocs.magento.com/new-
|
|
32
32
|
### `type`
|
33
33
|
|
34
34
|
Set as a list of `labels` in `.whatsup.yml`. There are two types of labels in configuration:
|
35
|
+
|
35
36
|
- `required` are labels that must include `whatsnew`. Otherwise, resulting output will warn about missing `whatsnew`.
|
36
37
|
- `optional` are labels that may include `whatsnew`. If `whatsnew` is missing, you won't get any notification about this.
|
37
38
|
|
@@ -48,6 +49,22 @@ Date when the pull request was merged.
|
|
48
49
|
|
49
50
|
URL of the pull request.
|
50
51
|
|
52
|
+
### `contributor`
|
53
|
+
|
54
|
+
An author of a pull request.
|
55
|
+
|
56
|
+
### `merge_commit`
|
57
|
+
|
58
|
+
Merge commit SHA of the pull request.
|
59
|
+
|
60
|
+
### `membership`
|
61
|
+
|
62
|
+
Memebership of the contributor in a configured organization.
|
63
|
+
|
64
|
+
### `labels`
|
65
|
+
|
66
|
+
All labels added to the pull request.
|
67
|
+
|
51
68
|
## Installation
|
52
69
|
|
53
70
|
This gem can be installed as a system command-line tool or as a command-line tool available in a project.
|
@@ -166,7 +183,7 @@ end
|
|
166
183
|
To run such test, run the corresponding file:
|
167
184
|
|
168
185
|
```bash
|
169
|
-
ruby lib/whatsup_github/
|
186
|
+
ruby lib/whatsup_github/config_reader.rb
|
170
187
|
```
|
171
188
|
|
172
189
|
The tests use the root `.whatsup.yml` file to read configuration.
|
data/Rakefile
CHANGED
@@ -1,14 +1,16 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'rspec/core/rake_task'
|
3
5
|
require 'cucumber'
|
4
6
|
require 'cucumber/rake/task'
|
5
7
|
|
6
8
|
RSpec::Core::RakeTask.new(:spec)
|
7
9
|
|
8
|
-
task :
|
10
|
+
task default: :spec
|
9
11
|
|
10
12
|
Cucumber::Rake::Task.new(:features) do |t|
|
11
|
-
t.cucumber_opts =
|
13
|
+
t.cucumber_opts = '--format pretty' # Any valid command line option can go here.
|
12
14
|
end
|
13
15
|
|
14
|
-
task :
|
16
|
+
task test: %i[spec features]
|
data/bin/console
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
|
-
require
|
4
|
-
require
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'whatsup_github'
|
5
6
|
|
6
7
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
8
|
# with your gem easier. You can also use a different console, if you like.
|
8
9
|
|
9
10
|
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
require
|
11
|
+
require 'pry'
|
11
12
|
Pry.start
|
12
13
|
|
13
14
|
# require "irb"
|
data/exe/whatsup_github
CHANGED
data/lib/template/.whatsup.yml
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# Parameters for a GitHub search query
|
2
2
|
base_branch: master
|
3
3
|
|
4
|
+
# The list of repositories to scan for pull requests
|
4
5
|
repos:
|
5
6
|
- magento/devdocs
|
7
|
+
- magento-commerce/devdocs
|
6
8
|
|
7
9
|
# Labels also will be used as a 'type' value in the output file
|
8
10
|
labels:
|
@@ -17,4 +19,10 @@ output_format:
|
|
17
19
|
- yaml
|
18
20
|
# - markdown
|
19
21
|
|
20
|
-
|
22
|
+
# The phrase that is used as a separator in the pull request descripion.
|
23
|
+
# All the lines that follows this phrase are captured as 'description' for this PR's entry in the resulted data file.
|
24
|
+
magic_word: whatsnew
|
25
|
+
|
26
|
+
# An organization to check a contributor for membership.
|
27
|
+
# Values: 'true', 'false', empry if not configured.
|
28
|
+
membership: magento-commerce
|
data/lib/whatsup_github.rb
CHANGED
data/lib/whatsup_github/cli.rb
CHANGED
@@ -1,14 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'thor'
|
2
|
-
require
|
4
|
+
require 'whatsup_github/runner'
|
3
5
|
module WhatsupGithub
|
4
6
|
class CLI < Thor
|
5
|
-
desc
|
7
|
+
desc 'since DATE', 'Filters pull requests since the specified date till now.'
|
6
8
|
|
7
9
|
def since(date = Date.today - 7)
|
8
|
-
|
9
10
|
runner = WhatsupGithub::Runner.new(Date.parse(date.to_s))
|
10
11
|
runner.run
|
11
12
|
end
|
12
13
|
default_task :since
|
13
14
|
end
|
14
|
-
end
|
15
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'yaml'
|
2
4
|
require 'singleton'
|
3
5
|
|
@@ -5,6 +7,7 @@ module WhatsupGithub
|
|
5
7
|
# Creates readable objects from confirurarion files
|
6
8
|
class Config
|
7
9
|
attr_reader :config
|
10
|
+
|
8
11
|
include Singleton
|
9
12
|
|
10
13
|
def initialize
|
@@ -18,20 +21,21 @@ module WhatsupGithub
|
|
18
21
|
FileUtils.cp dist_file, @file
|
19
22
|
end
|
20
23
|
@config = YAML.load_file @file
|
21
|
-
return {}
|
24
|
+
return {} unless @config
|
25
|
+
|
22
26
|
@config
|
23
27
|
end
|
24
28
|
|
25
29
|
def repos
|
26
|
-
read
|
30
|
+
read['repos']
|
27
31
|
end
|
28
32
|
|
29
33
|
def base_branch
|
30
|
-
read
|
34
|
+
read['base_branch']
|
31
35
|
end
|
32
36
|
|
33
37
|
def output_format
|
34
|
-
read
|
38
|
+
read['output_format']
|
35
39
|
end
|
36
40
|
|
37
41
|
def labels
|
@@ -41,17 +45,23 @@ module WhatsupGithub
|
|
41
45
|
def required_labels
|
42
46
|
res = read.dig 'labels', 'required'
|
43
47
|
return [] unless res
|
48
|
+
|
44
49
|
res
|
45
50
|
end
|
46
51
|
|
47
52
|
def optional_labels
|
48
53
|
res = read.dig 'labels', 'optional'
|
49
54
|
return [] unless res
|
55
|
+
|
50
56
|
res
|
51
57
|
end
|
52
58
|
|
59
|
+
def membership
|
60
|
+
read['membership']
|
61
|
+
end
|
62
|
+
|
53
63
|
def magic_word
|
54
|
-
read
|
64
|
+
read['magic_word']
|
55
65
|
end
|
56
66
|
end
|
57
67
|
end
|
@@ -65,4 +75,5 @@ if $PROGRAM_NAME == __FILE__
|
|
65
75
|
p config.required_labels
|
66
76
|
p config.optional_labels
|
67
77
|
p config.magic_word
|
68
|
-
|
78
|
+
p config.membership
|
79
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module WhatsupGithub
|
2
4
|
# Creates the final table
|
3
5
|
class Generator
|
@@ -9,7 +11,7 @@ module WhatsupGithub
|
|
9
11
|
@collector.sort_by_date
|
10
12
|
end
|
11
13
|
|
12
|
-
def run
|
14
|
+
def run(formatter, content)
|
13
15
|
formatter.generate_output_from content
|
14
16
|
end
|
15
17
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module WhatsupGithub
|
4
|
+
# Members of an organization
|
5
|
+
class Members
|
6
|
+
def initialize(org)
|
7
|
+
@org = org
|
8
|
+
end
|
9
|
+
|
10
|
+
def client
|
11
|
+
Octokit::Client.new(netrc: true)
|
12
|
+
end
|
13
|
+
|
14
|
+
def members
|
15
|
+
client.org_members @org
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/whatsup_github/pulls.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'octokit'
|
2
|
-
require_relative '
|
4
|
+
require_relative 'config_reader'
|
3
5
|
|
4
6
|
module WhatsupGithub
|
5
|
-
# Gets
|
7
|
+
# Gets issues found on GitHub by query
|
6
8
|
class Pulls
|
7
9
|
attr_reader :since, :repo
|
8
10
|
|
@@ -11,15 +13,12 @@ module WhatsupGithub
|
|
11
13
|
@since = args[:since]
|
12
14
|
end
|
13
15
|
|
14
|
-
def
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
end
|
19
|
-
optional_labels.each do |label|
|
20
|
-
issues += search_issues_with_magic_word(label).items
|
16
|
+
def data
|
17
|
+
pull_requests = []
|
18
|
+
filtered_numbers.each do |number|
|
19
|
+
pull_requests << client.pull_request(@repo, number)
|
21
20
|
end
|
22
|
-
|
21
|
+
pull_requests
|
23
22
|
end
|
24
23
|
|
25
24
|
private
|
@@ -49,7 +48,7 @@ module WhatsupGithub
|
|
49
48
|
end
|
50
49
|
|
51
50
|
def client
|
52
|
-
Octokit::Client.new(:
|
51
|
+
Octokit::Client.new(netrc: true)
|
53
52
|
end
|
54
53
|
|
55
54
|
def search_issues(label)
|
@@ -69,6 +68,21 @@ module WhatsupGithub
|
|
69
68
|
def auto_paginate
|
70
69
|
Octokit.auto_paginate = true
|
71
70
|
end
|
71
|
+
|
72
|
+
def filtered_issues
|
73
|
+
issues = []
|
74
|
+
required_labels.each do |label|
|
75
|
+
issues += search_issues(label).items
|
76
|
+
end
|
77
|
+
optional_labels.each do |label|
|
78
|
+
issues += search_issues_with_magic_word(label).items
|
79
|
+
end
|
80
|
+
issues
|
81
|
+
end
|
82
|
+
|
83
|
+
def filtered_numbers
|
84
|
+
filtered_issues.map(&:number)
|
85
|
+
end
|
72
86
|
end
|
73
87
|
end
|
74
88
|
|
@@ -76,5 +90,5 @@ if $PROGRAM_NAME == __FILE__
|
|
76
90
|
require 'date'
|
77
91
|
two_weeks_ago = (Date.today - 14).to_s
|
78
92
|
pulls = WhatsupGithub::Pulls.new(repo: 'magento/devdocs', since: two_weeks_ago)
|
79
|
-
p pulls.
|
93
|
+
p pulls.data
|
80
94
|
end
|
data/lib/whatsup_github/row.rb
CHANGED
@@ -1,9 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module WhatsupGithub
|
2
4
|
# Row to be converted to entry in future table
|
3
5
|
class Row
|
4
|
-
attr_reader :body,
|
6
|
+
attr_reader :body,
|
7
|
+
:title,
|
8
|
+
:labels,
|
9
|
+
:link,
|
10
|
+
:pr_number,
|
11
|
+
:assignee,
|
12
|
+
:author,
|
13
|
+
:author_url,
|
14
|
+
:merge_commit,
|
15
|
+
:is_private,
|
16
|
+
:membership
|
17
|
+
|
5
18
|
def initialize(args)
|
6
19
|
@repo = args[:repo]
|
20
|
+
@repo_url = args[:repo_url]
|
21
|
+
@is_private = args[:private]
|
7
22
|
@title = args[:pr_title]
|
8
23
|
@body = args[:pr_body]
|
9
24
|
@date = args[:date]
|
@@ -13,6 +28,8 @@ module WhatsupGithub
|
|
13
28
|
@author_url = args[:author_url]
|
14
29
|
@pr_number = args[:pr_number]
|
15
30
|
@link = args[:pr_url]
|
31
|
+
@merge_commit = args[:merge_commit_sha]
|
32
|
+
@membership = args[:membership]
|
16
33
|
@config = Config.instance
|
17
34
|
end
|
18
35
|
|
@@ -42,7 +59,9 @@ module WhatsupGithub
|
|
42
59
|
end
|
43
60
|
|
44
61
|
def parse_body
|
62
|
+
# Split PR description in two parts by 'magic word', and take the second half
|
45
63
|
description_splited = body.split(magic_word)[-1]
|
64
|
+
# Convert new line separators to <br> tags
|
46
65
|
newline_splited = description_splited.split("\n")
|
47
66
|
cleaned_array = newline_splited.map { |e| e.delete "\r\*" }
|
48
67
|
cleaned_array.delete('')
|
@@ -1,6 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'row'
|
2
4
|
require_relative 'pulls'
|
3
|
-
require_relative '
|
5
|
+
require_relative 'config_reader'
|
6
|
+
require_relative 'members'
|
4
7
|
|
5
8
|
module WhatsupGithub
|
6
9
|
# Creates Row objects for the future table
|
@@ -24,12 +27,17 @@ module WhatsupGithub
|
|
24
27
|
pulls(repo).map do |pull|
|
25
28
|
Row.new(
|
26
29
|
repo: repo,
|
30
|
+
repo_url: pull.base.repo.html_url,
|
31
|
+
private: pull.base.repo.private?,
|
27
32
|
pr_number: pull.number,
|
28
33
|
pr_title: pull.title,
|
29
34
|
pr_body: pull.body,
|
30
|
-
date: pull.
|
35
|
+
date: pull.merged_at,
|
31
36
|
pr_labels: label_names(pull.labels),
|
32
|
-
assignee: assignee(pull.
|
37
|
+
assignee: assignee(pull.assignees),
|
38
|
+
membership: member?(pull.user.login),
|
39
|
+
merger: pull.merged_by.login,
|
40
|
+
merge_commit_sha: pull.merge_commit_sha,
|
33
41
|
author: pull.user.login,
|
34
42
|
author_url: pull.user.html_url,
|
35
43
|
pr_url: pull.html_url
|
@@ -49,20 +57,38 @@ module WhatsupGithub
|
|
49
57
|
|
50
58
|
private
|
51
59
|
|
52
|
-
def assignee(
|
53
|
-
if
|
60
|
+
def assignee(assignees)
|
61
|
+
if assignees.empty?
|
54
62
|
'NOBODY'
|
55
63
|
else
|
56
|
-
|
64
|
+
assignees.map(&:login).join(', ')
|
57
65
|
end
|
58
66
|
end
|
59
67
|
|
68
|
+
def member?(login)
|
69
|
+
return nil unless config.membership
|
70
|
+
|
71
|
+
member_logins.include? login
|
72
|
+
end
|
73
|
+
|
60
74
|
def label_names(labels)
|
61
75
|
labels.map(&:name)
|
62
76
|
end
|
63
77
|
|
64
78
|
def pulls(repo)
|
65
|
-
Pulls.new(repo: repo, since: since).
|
79
|
+
Pulls.new(repo: repo, since: since).data
|
80
|
+
end
|
81
|
+
|
82
|
+
def load_members
|
83
|
+
return if @members
|
84
|
+
|
85
|
+
@members = Members.new(config.membership).members
|
86
|
+
p 'Hello'
|
87
|
+
end
|
88
|
+
|
89
|
+
def member_logins
|
90
|
+
load_members
|
91
|
+
@members.map(&:login)
|
66
92
|
end
|
67
93
|
|
68
94
|
def config
|
@@ -1,12 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'fileutils'
|
2
4
|
require_relative 'generator'
|
3
|
-
require_relative '
|
4
|
-
require_relative '
|
5
|
+
require_relative 'config_reader'
|
6
|
+
require_relative 'yaml_formatter'
|
5
7
|
require_relative 'table'
|
6
8
|
|
7
9
|
module WhatsupGithub
|
8
10
|
class Runner
|
9
|
-
|
10
11
|
def initialize(date)
|
11
12
|
@generator = Generator.new date
|
12
13
|
@config = Config.instance
|
@@ -16,11 +17,12 @@ module WhatsupGithub
|
|
16
17
|
def run
|
17
18
|
format = @config.output_format
|
18
19
|
raise 'Cannot find "output_format" in config.yml' unless format
|
20
|
+
|
19
21
|
table if format.include? 'markdown'
|
20
22
|
data if format.include? 'yaml'
|
21
23
|
end
|
22
24
|
|
23
|
-
def write_results
|
25
|
+
def write_results(file, formatter)
|
24
26
|
formatted_content = @generator.run formatter, @content
|
25
27
|
check_dir_at File.dirname file
|
26
28
|
File.write file, formatted_content
|
data/lib/whatsup_github/table.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'yaml'
|
2
4
|
module WhatsupGithub
|
3
5
|
# Table containing Rows
|
@@ -12,11 +14,13 @@ module WhatsupGithub
|
|
12
14
|
{
|
13
15
|
'description' => object.description,
|
14
16
|
'versions' => object.versions,
|
15
|
-
'type' =>
|
17
|
+
'type' => object.type,
|
16
18
|
'date' => object.date,
|
17
19
|
'link' => object.link,
|
20
|
+
'merge_commit' => object.merge_commit,
|
18
21
|
'contributor' => object.author,
|
19
|
-
'
|
22
|
+
'membership' => object.membership,
|
23
|
+
'labels' => object.labels
|
20
24
|
}
|
21
25
|
end
|
22
26
|
output =
|
data/whatsup_github.gemspec
CHANGED
@@ -1,48 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
|
-
lib = File.expand_path(
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
5
|
+
require 'whatsup_github/version'
|
5
6
|
|
6
7
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
8
|
+
spec.name = 'whatsup_github'
|
8
9
|
spec.version = WhatsupGithub::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
10
|
+
spec.authors = ['Dima Shevtsov']
|
11
|
+
spec.email = ['shevtsov@adobe.com']
|
11
12
|
|
12
|
-
spec.summary =
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
13
|
+
spec.summary = 'Collect info from GitHub pull requests.'
|
14
|
+
spec.homepage = 'https://github.com/dshevtsov/whatsup_github'
|
15
|
+
spec.license = 'MIT'
|
15
16
|
|
16
17
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
18
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
19
|
if spec.respond_to?(:metadata)
|
19
|
-
spec.metadata[
|
20
|
-
spec.metadata[
|
21
|
-
spec.metadata[
|
20
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
21
|
+
spec.metadata['source_code_uri'] = 'https://github.com/dshevtsov/whatsup_github'
|
22
|
+
spec.metadata['changelog_uri'] = 'https://github.com/dshevtsov/whatsup_github/blob/master/CHANGELOG.md'
|
22
23
|
else
|
23
|
-
raise
|
24
|
-
|
24
|
+
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
25
|
+
'public gem pushes.'
|
25
26
|
end
|
26
27
|
|
27
28
|
# Specify which files should be added to the gem when it is released.
|
28
29
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
29
|
-
spec.files
|
30
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
30
31
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
31
32
|
end
|
32
|
-
spec.bindir =
|
33
|
+
spec.bindir = 'exe'
|
33
34
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
34
|
-
spec.require_paths = [
|
35
|
+
spec.require_paths = ['lib']
|
35
36
|
|
36
|
-
spec.required_ruby_version = '>= 2.
|
37
|
+
spec.required_ruby_version = '>= 2.5.0'
|
37
38
|
|
38
|
-
spec.add_dependency
|
39
|
-
spec.add_dependency
|
40
|
-
spec.add_dependency
|
39
|
+
spec.add_dependency 'netrc', '~> 0.11'
|
40
|
+
spec.add_dependency 'octokit', '~> 4.20'
|
41
|
+
spec.add_dependency 'thor', '~> 1.1'
|
41
42
|
|
42
|
-
spec.add_development_dependency
|
43
|
-
spec.add_development_dependency
|
44
|
-
spec.add_development_dependency
|
45
|
-
spec.add_development_dependency
|
46
|
-
spec.add_development_dependency
|
47
|
-
spec.add_development_dependency
|
43
|
+
spec.add_development_dependency 'aruba', '~> 1.0'
|
44
|
+
spec.add_development_dependency 'bundler', '~> 2.2'
|
45
|
+
spec.add_development_dependency 'cucumber', '~> 5.3'
|
46
|
+
spec.add_development_dependency 'pry', '~> 0.14'
|
47
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
48
|
+
spec.add_development_dependency 'rspec', '~> 3.10'
|
48
49
|
end
|
metadata
CHANGED
@@ -1,141 +1,141 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: whatsup_github
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dima Shevtsov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: netrc
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0.11'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0.11'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: octokit
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '4.20'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '4.20'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: thor
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '1.1'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '1.1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: aruba
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '1.
|
61
|
+
version: '1.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '1.
|
68
|
+
version: '1.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: bundler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '2.2'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '2.2'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: cucumber
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '3
|
89
|
+
version: '5.3'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '3
|
96
|
+
version: '5.3'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: pry
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '0.14'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '0.14'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: rake
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '0
|
117
|
+
version: '13.0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '0
|
124
|
+
version: '13.0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: rspec
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
131
|
+
version: '3.10'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
138
|
+
version: '3.10'
|
139
139
|
description:
|
140
140
|
email:
|
141
141
|
- shevtsov@adobe.com
|
@@ -160,15 +160,16 @@ files:
|
|
160
160
|
- lib/template/.whatsup.yml
|
161
161
|
- lib/whatsup_github.rb
|
162
162
|
- lib/whatsup_github/cli.rb
|
163
|
-
- lib/whatsup_github/
|
163
|
+
- lib/whatsup_github/config_reader.rb
|
164
164
|
- lib/whatsup_github/generator.rb
|
165
|
+
- lib/whatsup_github/members.rb
|
165
166
|
- lib/whatsup_github/pulls.rb
|
166
167
|
- lib/whatsup_github/row.rb
|
167
168
|
- lib/whatsup_github/row_collector.rb
|
168
169
|
- lib/whatsup_github/runner.rb
|
169
170
|
- lib/whatsup_github/table.rb
|
170
171
|
- lib/whatsup_github/version.rb
|
171
|
-
- lib/whatsup_github/
|
172
|
+
- lib/whatsup_github/yaml_formatter.rb
|
172
173
|
- whatsup_github.gemspec
|
173
174
|
homepage: https://github.com/dshevtsov/whatsup_github
|
174
175
|
licenses:
|
@@ -185,7 +186,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
185
186
|
requirements:
|
186
187
|
- - ">="
|
187
188
|
- !ruby/object:Gem::Version
|
188
|
-
version: 2.
|
189
|
+
version: 2.5.0
|
189
190
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
190
191
|
requirements:
|
191
192
|
- - ">="
|