changelogerator 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/changelogerator.rb +9 -12
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: abb70fa6b03f1b32056fe0c98ca923521c1a1f34799ce26d620a691386645b99
4
- data.tar.gz: f1f9879fee9e9e105ef470d7f1c62240f9bf1270918cdfd0c5dbabbe4f8c6b28
3
+ metadata.gz: b916cdb658f760af9794c4f947c54839f8b19b596b3a0fe9e20f674c8898f31d
4
+ data.tar.gz: efa45a9492704d76197ccb4b3d15d227a6c4a01d35bfe8fe6ff81b7b84049532
5
5
  SHA512:
6
- metadata.gz: 4986ec720e213717191e03077ce3aae3bea1e43b50d0411fdc0d7c4e3fedaf47f10cb0ec89a4372c1540f185b7ad3d3c7acdd216aaacbc456bbb5698d1a22396
7
- data.tar.gz: c462ba5d117b9f37659407473b78f1a91b2a8aba54dc89ff2b7d33d3de0a9aa6d32d606fd1d7001dcb328906f7c19d8b7aaf30e159e3c3ed21a5c55abbb8f489
6
+ metadata.gz: 298138ad4d9d52615de65931e3a96d7b5aee928bc71732a7142dfe2b8d97008d0dc090c2ef9ce81060b375288e3c5d9a4a3a375dafbca0b056d4b0b525ddcdc7
7
+ data.tar.gz: 70897f7bf61f7721a9d7097479e7c39c4be18c1781d970908b0620aadb2bf106d31ba81d0bc8e0e0eed988e38e0fda49a7f6549c38d511d0f8dd5e48db2fc93f
@@ -7,7 +7,7 @@
7
7
  # on how we classify the importance of PRs in the paritytech/polkadot project.
8
8
  # Probably not tremendously useful to other projects.
9
9
  class Changelog
10
- require 'github_api'
10
+ require 'octokit'
11
11
 
12
12
  attr_accessor :changes
13
13
  attr_reader :priority
@@ -65,14 +65,11 @@ class Changelog
65
65
  # token: a Github personal access token
66
66
  # prefix: whether or not to prefix PR numbers with their repo in the changelog
67
67
  def initialize(github_repo, from, to, token: '', prefix: nil)
68
- org, repo = github_repo.split('/')
69
- @ghr = github_repo
68
+ @repo = github_repo
70
69
  @priorities = self.class.priorities
71
- @gh = Github.new do |c|
72
- c.oauth_token = token
73
- c.org = org
74
- c.repo = repo
75
- end
70
+ @gh = Octokit::Client.new(
71
+ access_token: token
72
+ )
76
73
  @changes = prs_from_ids(pr_ids_from_git_diff(from, to), prefix)
77
74
  # add priority to each change
78
75
  @changes.map { |c| apply_priority_to_change(c) }
@@ -92,8 +89,8 @@ class Changelog
92
89
  end
93
90
 
94
91
  def pr_ids_from_git_diff(from, to)
95
- @gh.repos.commits.compare(@gh.org, @gh.repo, from, to).body.commits.map do |l|
96
- title = l.commit.message.split("\n\n").first
92
+ @gh.compare(@repo, from, to).commits.map do |c|
93
+ title = c.commit.message.split("\n\n").first
97
94
  next unless title =~ /\(#[0-9]+\)$/
98
95
 
99
96
  title.gsub(/.*#([0-9]+)\)$/, '\1')
@@ -103,9 +100,9 @@ class Changelog
103
100
  def prs_from_ids(ids, prefix)
104
101
  prs = []
105
102
  ids.each do |pr|
106
- pull = @gh.pull_requests.get(@gh.org, @gh.repo, pr).body
103
+ pull = @gh.pull_request(@repo, pr)
107
104
  pull[:pretty_title] = if prefix
108
- "#{pull[:title]} (#{@ghr}##{pull[:number]})"
105
+ "#{pull[:title]} (#{@repo}##{pull[:number]})"
109
106
  else
110
107
  "#{pull[:title]} (##{pull[:number]})"
111
108
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: changelogerator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Pugh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-28 00:00:00.000000000 Z
11
+ date: 2020-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: github_api