whatsup_github 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/.whatsnew.yml +17 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +91 -0
- data/LICENSE.txt +21 -0
- data/README.md +69 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/whatsup_github +4 -0
- data/lib/template/.whatsup.yml +18 -0
- data/lib/whatsup_github.rb +6 -0
- data/lib/whatsup_github/cli.rb +14 -0
- data/lib/whatsup_github/config-reader.rb +29 -0
- data/lib/whatsup_github/generator.rb +16 -0
- data/lib/whatsup_github/pulls.rb +53 -0
- data/lib/whatsup_github/row.rb +64 -0
- data/lib/whatsup_github/row_collector.rb +70 -0
- data/lib/whatsup_github/runner.rb +42 -0
- data/lib/whatsup_github/table.rb +17 -0
- data/lib/whatsup_github/version.rb +3 -0
- data/lib/whatsup_github/yaml-formatter.rb +28 -0
- data/whatsup_github.gemspec +46 -0
- metadata +199 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 28f70d20f66860466a71e5f253d75db911d24bfd91c7403d8351bc6f62b9ba7e
|
4
|
+
data.tar.gz: 43fd5d4cf2d8d29f150a2bbe61aeb1b92a7fdd76e099138622786db4a191e058
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ea289b8d727aaed1ce88219250ccd41b30cf77c3417a3ca16e185afdcbcf5575f8f14554ebcf60196ca001e44b8fc140b11b2e4108a91032ec9bd30beed2b97a
|
7
|
+
data.tar.gz: fa873b26c9faa0559c877904c10d33eae35dab773acf0a1eb0025964dd35fd69a314554b060eb33015be0b4cbe85096974ff6ceff672fc53e82ff18ed42eabb5
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/.whatsnew.yml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Name of the base branch in GitHub PRs
|
2
|
+
base_branch: master
|
3
|
+
|
4
|
+
# Repos for scanning
|
5
|
+
repos:
|
6
|
+
- magento/devdocs
|
7
|
+
|
8
|
+
# Labels for filtering
|
9
|
+
labels:
|
10
|
+
- New doc
|
11
|
+
- Major update
|
12
|
+
- Technical
|
13
|
+
|
14
|
+
# Output format
|
15
|
+
output_format:
|
16
|
+
# - markdown
|
17
|
+
- yaml
|
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
whatsup_github (0.0.1)
|
5
|
+
netrc (~> 0.10)
|
6
|
+
octokit (~> 4.14)
|
7
|
+
thor (~> 0.20)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
addressable (2.6.0)
|
13
|
+
public_suffix (>= 2.0.2, < 4.0)
|
14
|
+
aruba (0.14.10)
|
15
|
+
childprocess (>= 0.6.3, < 1.1.0)
|
16
|
+
contracts (~> 0.9)
|
17
|
+
cucumber (>= 1.3.19)
|
18
|
+
ffi (~> 1.9)
|
19
|
+
rspec-expectations (>= 2.99)
|
20
|
+
thor (~> 0.19)
|
21
|
+
backports (3.15.0)
|
22
|
+
builder (3.2.3)
|
23
|
+
childprocess (1.0.1)
|
24
|
+
rake (< 13.0)
|
25
|
+
coderay (1.1.2)
|
26
|
+
contracts (0.16.0)
|
27
|
+
cucumber (3.1.2)
|
28
|
+
builder (>= 2.1.2)
|
29
|
+
cucumber-core (~> 3.2.0)
|
30
|
+
cucumber-expressions (~> 6.0.1)
|
31
|
+
cucumber-wire (~> 0.0.1)
|
32
|
+
diff-lcs (~> 1.3)
|
33
|
+
gherkin (~> 5.1.0)
|
34
|
+
multi_json (>= 1.7.5, < 2.0)
|
35
|
+
multi_test (>= 0.1.2)
|
36
|
+
cucumber-core (3.2.1)
|
37
|
+
backports (>= 3.8.0)
|
38
|
+
cucumber-tag_expressions (~> 1.1.0)
|
39
|
+
gherkin (~> 5.0)
|
40
|
+
cucumber-expressions (6.0.1)
|
41
|
+
cucumber-tag_expressions (1.1.1)
|
42
|
+
cucumber-wire (0.0.1)
|
43
|
+
diff-lcs (1.3)
|
44
|
+
faraday (0.15.4)
|
45
|
+
multipart-post (>= 1.2, < 3)
|
46
|
+
ffi (1.11.1)
|
47
|
+
gherkin (5.1.0)
|
48
|
+
method_source (0.9.2)
|
49
|
+
multi_json (1.13.1)
|
50
|
+
multi_test (0.1.2)
|
51
|
+
multipart-post (2.1.1)
|
52
|
+
netrc (0.11.0)
|
53
|
+
octokit (4.14.0)
|
54
|
+
sawyer (~> 0.8.0, >= 0.5.3)
|
55
|
+
pry (0.12.2)
|
56
|
+
coderay (~> 1.1.0)
|
57
|
+
method_source (~> 0.9.0)
|
58
|
+
public_suffix (3.1.0)
|
59
|
+
rake (10.5.0)
|
60
|
+
rspec (3.8.0)
|
61
|
+
rspec-core (~> 3.8.0)
|
62
|
+
rspec-expectations (~> 3.8.0)
|
63
|
+
rspec-mocks (~> 3.8.0)
|
64
|
+
rspec-core (3.8.1)
|
65
|
+
rspec-support (~> 3.8.0)
|
66
|
+
rspec-expectations (3.8.4)
|
67
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
68
|
+
rspec-support (~> 3.8.0)
|
69
|
+
rspec-mocks (3.8.1)
|
70
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
71
|
+
rspec-support (~> 3.8.0)
|
72
|
+
rspec-support (3.8.2)
|
73
|
+
sawyer (0.8.2)
|
74
|
+
addressable (>= 2.3.5)
|
75
|
+
faraday (> 0.8, < 2.0)
|
76
|
+
thor (0.20.3)
|
77
|
+
|
78
|
+
PLATFORMS
|
79
|
+
ruby
|
80
|
+
|
81
|
+
DEPENDENCIES
|
82
|
+
aruba (~> 0.14)
|
83
|
+
bundler (~> 1.17)
|
84
|
+
cucumber (~> 3.1)
|
85
|
+
pry (~> 0.12)
|
86
|
+
rake (~> 10.0)
|
87
|
+
rspec (~> 3.0)
|
88
|
+
whatsup_github!
|
89
|
+
|
90
|
+
BUNDLED WITH
|
91
|
+
1.17.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Dima Shevtsov
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
# WhatsupGithub
|
2
|
+
|
3
|
+
The tool helps to update the [Whats New on DevDocs](http://devdocs.magento.com/whats-new.html).
|
4
|
+
It filters by labels the pull requests merged into repositories and generates an output in a specified format (`markdown` or/and `yaml`).
|
5
|
+
In the command line, provide the date since when you want to check changes.
|
6
|
+
By default, the tool filters results for the passed week.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem 'whatsup_github'
|
14
|
+
```
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
```bash
|
19
|
+
bundle
|
20
|
+
```
|
21
|
+
|
22
|
+
Or install it yourself as:
|
23
|
+
|
24
|
+
```bash
|
25
|
+
gem install whatsup_github
|
26
|
+
```
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
Generate the output with recent updates since April 2 of the current year till today:
|
31
|
+
|
32
|
+
```bash
|
33
|
+
whatsup_github since 'apr 2'
|
34
|
+
```
|
35
|
+
|
36
|
+
By default, it generates recent updates for the passed week:
|
37
|
+
|
38
|
+
```bash
|
39
|
+
whatsup_github
|
40
|
+
```
|
41
|
+
|
42
|
+
You can use different date formats like `'April 2'`, `'2 April'`, `'apr 2'`, `'2 Apr'`, `2018-04-02`.
|
43
|
+
|
44
|
+
The result is returned into _tmp/whats-new.yml_ or _tmp/whats-new.md_ files, depending on the format specified in configuration.
|
45
|
+
|
46
|
+
## Configuration
|
47
|
+
|
48
|
+
The configuration file [`.whatsup.yml`](lib/template/.whatsup.yml) will be created during the first run.
|
49
|
+
|
50
|
+
## Authentication
|
51
|
+
|
52
|
+
You can use the tool as anonymous user until you'll need to scan private repositories or merely reach the [rate limit of unauthenticted requests](https://developer.github.com/v3/#rate-limiting).
|
53
|
+
In this case, use [`~/.netrc`](https://github.com/octokit/octokit.rb#using-a-netrc-file) file for authentication.
|
54
|
+
|
55
|
+
## Development
|
56
|
+
|
57
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the Ruby tests, and `bundle exec cucumber features` to run CLI tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
58
|
+
|
59
|
+
## Contributing
|
60
|
+
|
61
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/dshevtsov/whatsup_github. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
62
|
+
|
63
|
+
## License
|
64
|
+
|
65
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
66
|
+
|
67
|
+
## Code of Conduct
|
68
|
+
|
69
|
+
Everyone interacting in the WhatsupGithub project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/dshevtsov/whatsup_github/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "whatsup_github"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
require "pry"
|
11
|
+
Pry.start
|
12
|
+
|
13
|
+
# require "irb"
|
14
|
+
# IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/exe/whatsup_github
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# Name of the base branch in GitHub PRs
|
2
|
+
base_branch: master
|
3
|
+
|
4
|
+
# Repositories for scanning. If you want to search private repositories, use credentials to specify
|
5
|
+
repos:
|
6
|
+
- magento/devdocs
|
7
|
+
|
8
|
+
# Labels for filtering (currently, hard-coded)
|
9
|
+
labels:
|
10
|
+
- New doc
|
11
|
+
- Major update
|
12
|
+
- Technical
|
13
|
+
|
14
|
+
# Output format
|
15
|
+
output_format:
|
16
|
+
# - markdown
|
17
|
+
- yaml
|
18
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require "whatsup_github/runner"
|
3
|
+
module WhatsupGithub
|
4
|
+
class CLI < Thor
|
5
|
+
desc "since DATE", "Filters pull requests since the specified date till now."
|
6
|
+
|
7
|
+
def since(date = Date.today - 7)
|
8
|
+
|
9
|
+
runner = WhatsupGithub::Runner.new(Date.parse(date.to_s))
|
10
|
+
runner.run
|
11
|
+
end
|
12
|
+
default_task :since
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'singleton'
|
3
|
+
|
4
|
+
module WhatsupGithub
|
5
|
+
# Creates readable objects from confirurarion files
|
6
|
+
class Config
|
7
|
+
attr_reader :config
|
8
|
+
include Singleton
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@file = '.whatsup.yml'
|
12
|
+
@config = {}
|
13
|
+
end
|
14
|
+
|
15
|
+
def read(*options)
|
16
|
+
unless File.exist?(@file)
|
17
|
+
dist_file = File.expand_path("../template/#{@file}", __dir__)
|
18
|
+
FileUtils.cp dist_file, @file
|
19
|
+
end
|
20
|
+
load_from_yaml.dig options.join ','
|
21
|
+
end
|
22
|
+
|
23
|
+
def load_from_yaml
|
24
|
+
@config = YAML.load_file @file
|
25
|
+
return {} unless @config
|
26
|
+
@config
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module WhatsupGithub
|
2
|
+
# Creates the final table
|
3
|
+
class Generator
|
4
|
+
def initialize(since)
|
5
|
+
@collector = RowCollector.new(since: since)
|
6
|
+
end
|
7
|
+
|
8
|
+
def content
|
9
|
+
@collector.sort_by_date
|
10
|
+
end
|
11
|
+
|
12
|
+
def run formatter, content
|
13
|
+
formatter.generate_output_from content
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'octokit'
|
2
|
+
require_relative 'config-reader'
|
3
|
+
|
4
|
+
module WhatsupGithub
|
5
|
+
# Gets pull filtered pull requests from GitHub
|
6
|
+
class Pulls
|
7
|
+
attr_reader :since, :repo
|
8
|
+
|
9
|
+
def initialize(args = {})
|
10
|
+
@repo = args[:repo]
|
11
|
+
@since = args[:since]
|
12
|
+
end
|
13
|
+
|
14
|
+
def filtered
|
15
|
+
issues = []
|
16
|
+
labels.each do |label|
|
17
|
+
issues += search_issues(label).items
|
18
|
+
end
|
19
|
+
issues
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
# def access_token
|
25
|
+
# credentials.read 'github_token'
|
26
|
+
# end
|
27
|
+
|
28
|
+
def configuration
|
29
|
+
Config.instance
|
30
|
+
end
|
31
|
+
|
32
|
+
def labels
|
33
|
+
configuration.read 'labels'
|
34
|
+
end
|
35
|
+
|
36
|
+
def base_branch
|
37
|
+
configuration.read 'base_branch'
|
38
|
+
end
|
39
|
+
|
40
|
+
def client
|
41
|
+
Octokit::Client.new(:netrc => true)
|
42
|
+
end
|
43
|
+
|
44
|
+
def search_issues(label)
|
45
|
+
auto_paginate
|
46
|
+
client.search_issues("repo:#{repo} label:\"#{label}\" merged:>=#{since} base:#{base_branch}")
|
47
|
+
end
|
48
|
+
|
49
|
+
def auto_paginate
|
50
|
+
Octokit.auto_paginate = true
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
module WhatsupGithub
|
2
|
+
# Row to be converted to entry in future table
|
3
|
+
class Row
|
4
|
+
attr_reader :body, :title, :labels, :pr_number, :assignee, :link
|
5
|
+
def initialize(args)
|
6
|
+
@repo = args[:repo]
|
7
|
+
@title = args[:pr_title]
|
8
|
+
@body = args[:pr_body]
|
9
|
+
@date = args[:date]
|
10
|
+
@labels = args[:pr_labels]
|
11
|
+
@assignee = args[:assignee]
|
12
|
+
@pr_number = args[:pr_number]
|
13
|
+
@link = args[:pr_url]
|
14
|
+
end
|
15
|
+
|
16
|
+
UPDATED_MASK = 'Major update'.freeze
|
17
|
+
UPDATED_PHRASE = 'Major update'.freeze
|
18
|
+
NEW_MASK = 'New topic'.freeze
|
19
|
+
NEW_PHRASE = 'New topic'.freeze
|
20
|
+
TECHNICAL_MASK = 'Technical'.freeze
|
21
|
+
TECHNICAL_PHRASE = 'Technical changes'.freeze
|
22
|
+
|
23
|
+
def versions
|
24
|
+
label_versions = labels.select { |label| label.start_with?(/\d\./) }
|
25
|
+
label_versions.join(', ')
|
26
|
+
end
|
27
|
+
|
28
|
+
def date
|
29
|
+
@date.strftime('%B %-e, %Y')
|
30
|
+
end
|
31
|
+
|
32
|
+
def type
|
33
|
+
labels_string = labels.join(' ')
|
34
|
+
label_type = /#{ UPDATED_MASK }|#{ NEW_MASK }|#{ TECHNICAL_MASK }/.match(labels_string)
|
35
|
+
case label_type.to_s
|
36
|
+
when /#{ UPDATED_MASK }/
|
37
|
+
UPDATED_PHRASE
|
38
|
+
when /#{ NEW_MASK }/
|
39
|
+
NEW_PHRASE
|
40
|
+
when /#{ TECHNICAL_MASK }/
|
41
|
+
TECHNICAL_PHRASE
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def parse_body
|
46
|
+
whatsnew_splited = body.split('whatsnew')[-1]
|
47
|
+
newline_splited = whatsnew_splited.split("\n")
|
48
|
+
cleaned_array = newline_splited.map { |e| e.delete "\r\*" }
|
49
|
+
cleaned_array.delete('')
|
50
|
+
striped_array = cleaned_array.map(&:strip)
|
51
|
+
striped_array.join('<br/>')
|
52
|
+
end
|
53
|
+
|
54
|
+
def description
|
55
|
+
if body.include?('whatsnew')
|
56
|
+
parse_body
|
57
|
+
else
|
58
|
+
message = "MISSING whatsnew in the #{type} PR \##{pr_number}: \"#{title}\" assigned to #{assignee} (#{link})"
|
59
|
+
puts message
|
60
|
+
message
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require_relative 'row'
|
2
|
+
require_relative 'pulls'
|
3
|
+
require_relative 'config-reader'
|
4
|
+
|
5
|
+
module WhatsupGithub
|
6
|
+
# Creates Row objects for the future table
|
7
|
+
class RowCollector
|
8
|
+
attr_reader :repos, :since
|
9
|
+
|
10
|
+
def initialize(args = {})
|
11
|
+
@repos = config.read('repos')
|
12
|
+
@since = args[:since]
|
13
|
+
end
|
14
|
+
|
15
|
+
def collect_rows
|
16
|
+
rows = []
|
17
|
+
repos.each do |repo|
|
18
|
+
rows << collect_rows_for_a(repo)
|
19
|
+
end
|
20
|
+
rows.flatten
|
21
|
+
end
|
22
|
+
|
23
|
+
def collect_rows_for_a(repo)
|
24
|
+
pulls(repo).map do |pull|
|
25
|
+
Row.new(
|
26
|
+
repo: repo,
|
27
|
+
pr_number: pull.number,
|
28
|
+
pr_title: pull.title,
|
29
|
+
pr_body: pull.body,
|
30
|
+
date: pull.closed_at,
|
31
|
+
pr_labels: label_names(pull.labels),
|
32
|
+
assignee: assignee(pull.assignee),
|
33
|
+
pr_url: pull.html_url
|
34
|
+
)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def sort_by_date
|
39
|
+
collect_rows.sort_by do |c|
|
40
|
+
Date.parse(c.date)
|
41
|
+
end.reverse
|
42
|
+
end
|
43
|
+
|
44
|
+
def reverse(collection)
|
45
|
+
collection.reverse
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def assignee(assignee)
|
51
|
+
if assignee.nil?
|
52
|
+
'NOBODY'
|
53
|
+
else
|
54
|
+
assignee.login
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def label_names(labels)
|
59
|
+
labels.map(&:name)
|
60
|
+
end
|
61
|
+
|
62
|
+
def pulls(repo)
|
63
|
+
Pulls.new(repo: repo, since: since).filtered
|
64
|
+
end
|
65
|
+
|
66
|
+
def config
|
67
|
+
Config.instance
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require_relative 'generator'
|
3
|
+
require_relative 'config-reader'
|
4
|
+
require_relative 'yaml-formatter'
|
5
|
+
require_relative 'table'
|
6
|
+
|
7
|
+
module WhatsupGithub
|
8
|
+
class Runner
|
9
|
+
|
10
|
+
def initialize(date)
|
11
|
+
@generator = Generator.new date
|
12
|
+
@config = Config.instance
|
13
|
+
@content ||= @generator.content
|
14
|
+
end
|
15
|
+
|
16
|
+
def run
|
17
|
+
format = @config.read 'output_format'
|
18
|
+
raise 'Cannot find "output_format" in config.yml' unless format
|
19
|
+
table if format.include? 'markdown'
|
20
|
+
data if format.include? 'yaml'
|
21
|
+
end
|
22
|
+
|
23
|
+
def write_results file, formatter
|
24
|
+
formatted_content = @generator.run formatter, @content
|
25
|
+
check_dir_at File.dirname file
|
26
|
+
File.write file, formatted_content
|
27
|
+
puts "Done!\nOpen \"#{file}\" to see the result."
|
28
|
+
end
|
29
|
+
|
30
|
+
def check_dir_at(filepath)
|
31
|
+
FileUtils.mkdir_p filepath unless Dir.exist? filepath
|
32
|
+
end
|
33
|
+
|
34
|
+
def table
|
35
|
+
write_results 'tmp/whats-new-on-devdocs.md', Table.new
|
36
|
+
end
|
37
|
+
|
38
|
+
def data
|
39
|
+
write_results 'tmp/whats-new.yml', YAMLFormatter.new
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require_relative 'row_collector'
|
2
|
+
|
3
|
+
module WhatsupGithub
|
4
|
+
# Table containing Rows
|
5
|
+
class Table
|
6
|
+
|
7
|
+
# def initialize(since)
|
8
|
+
# @collector = RowCollector.new(since: since)
|
9
|
+
# end
|
10
|
+
|
11
|
+
def generate_output_from(content)
|
12
|
+
content.collect do |object|
|
13
|
+
"| #{object.description} | #{object.versions} | #{object.type} | #{object.date} |\n".tr_s(' ', ' ')
|
14
|
+
end.join
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
module WhatsupGithub
|
3
|
+
# Table containing Rows
|
4
|
+
class YAMLFormatter
|
5
|
+
# def initialize(since)
|
6
|
+
# @collector = RowCollector.new(since: since)
|
7
|
+
# end
|
8
|
+
|
9
|
+
def generate_output_from(content)
|
10
|
+
entries =
|
11
|
+
content.collect do |object|
|
12
|
+
{
|
13
|
+
'description' => object.description,
|
14
|
+
'versions' => object.versions,
|
15
|
+
'type' => object.type,
|
16
|
+
'date' => object.date,
|
17
|
+
'link' => object.link
|
18
|
+
}
|
19
|
+
end
|
20
|
+
output =
|
21
|
+
{
|
22
|
+
'updated' => Time.now.strftime('%c').tr_s(' ', ' '),
|
23
|
+
'entries' => entries
|
24
|
+
}
|
25
|
+
output.to_yaml
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "whatsup_github/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "whatsup_github"
|
8
|
+
spec.version = WhatsupGithub::VERSION
|
9
|
+
spec.authors = ["Dima Shevtsov"]
|
10
|
+
spec.email = ["shevtsov@adobe.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Collect info from GitHub pull requests.}
|
13
|
+
spec.homepage = "https://github.com/dshevtsov/whatsup_github"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
|
+
if spec.respond_to?(:metadata)
|
19
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
20
|
+
spec.metadata["source_code_uri"] = "https://github.com/dshevtsov/whatsup_github"
|
21
|
+
spec.metadata["changelog_uri"] = "https://github.com/dshevtsov/whatsup_github/blob/master/CHANGELOG.md"
|
22
|
+
else
|
23
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
24
|
+
"public gem pushes."
|
25
|
+
end
|
26
|
+
|
27
|
+
# Specify which files should be added to the gem when it is released.
|
28
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
29
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
30
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
31
|
+
end
|
32
|
+
spec.bindir = "exe"
|
33
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
34
|
+
spec.require_paths = ["lib"]
|
35
|
+
|
36
|
+
spec.add_dependency "octokit", "~> 4.14"
|
37
|
+
spec.add_dependency "thor", "~> 0.20"
|
38
|
+
spec.add_dependency "netrc", "~> 0.10"
|
39
|
+
|
40
|
+
spec.add_development_dependency "bundler", "~> 1.17"
|
41
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
42
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
43
|
+
spec.add_development_dependency "cucumber", "~> 3.1"
|
44
|
+
spec.add_development_dependency "aruba", "~> 0.14"
|
45
|
+
spec.add_development_dependency "pry", "~> 0.12"
|
46
|
+
end
|
metadata
ADDED
@@ -0,0 +1,199 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: whatsup_github
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dima Shevtsov
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-06-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: octokit
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.14'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.14'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: thor
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.20'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.20'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: netrc
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.10'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.10'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.17'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.17'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '10.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '10.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: cucumber
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '3.1'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '3.1'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: aruba
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.14'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0.14'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: pry
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0.12'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0.12'
|
139
|
+
description:
|
140
|
+
email:
|
141
|
+
- shevtsov@adobe.com
|
142
|
+
executables:
|
143
|
+
- whatsup_github
|
144
|
+
extensions: []
|
145
|
+
extra_rdoc_files: []
|
146
|
+
files:
|
147
|
+
- ".gitignore"
|
148
|
+
- ".rspec"
|
149
|
+
- ".travis.yml"
|
150
|
+
- ".whatsnew.yml"
|
151
|
+
- CHANGELOG.md
|
152
|
+
- Gemfile
|
153
|
+
- Gemfile.lock
|
154
|
+
- LICENSE.txt
|
155
|
+
- README.md
|
156
|
+
- Rakefile
|
157
|
+
- bin/console
|
158
|
+
- bin/setup
|
159
|
+
- exe/whatsup_github
|
160
|
+
- lib/template/.whatsup.yml
|
161
|
+
- lib/whatsup_github.rb
|
162
|
+
- lib/whatsup_github/cli.rb
|
163
|
+
- lib/whatsup_github/config-reader.rb
|
164
|
+
- lib/whatsup_github/generator.rb
|
165
|
+
- lib/whatsup_github/pulls.rb
|
166
|
+
- lib/whatsup_github/row.rb
|
167
|
+
- lib/whatsup_github/row_collector.rb
|
168
|
+
- lib/whatsup_github/runner.rb
|
169
|
+
- lib/whatsup_github/table.rb
|
170
|
+
- lib/whatsup_github/version.rb
|
171
|
+
- lib/whatsup_github/yaml-formatter.rb
|
172
|
+
- whatsup_github.gemspec
|
173
|
+
homepage: https://github.com/dshevtsov/whatsup_github
|
174
|
+
licenses:
|
175
|
+
- MIT
|
176
|
+
metadata:
|
177
|
+
homepage_uri: https://github.com/dshevtsov/whatsup_github
|
178
|
+
source_code_uri: https://github.com/dshevtsov/whatsup_github
|
179
|
+
changelog_uri: https://github.com/dshevtsov/whatsup_github/blob/master/CHANGELOG.md
|
180
|
+
post_install_message:
|
181
|
+
rdoc_options: []
|
182
|
+
require_paths:
|
183
|
+
- lib
|
184
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
185
|
+
requirements:
|
186
|
+
- - ">="
|
187
|
+
- !ruby/object:Gem::Version
|
188
|
+
version: '0'
|
189
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
190
|
+
requirements:
|
191
|
+
- - ">="
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: '0'
|
194
|
+
requirements: []
|
195
|
+
rubygems_version: 3.0.3
|
196
|
+
signing_key:
|
197
|
+
specification_version: 4
|
198
|
+
summary: Collect info from GitHub pull requests.
|
199
|
+
test_files: []
|