jenkins-bundle-update-pr 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +22 -4
- data/lib/jenkins/bundle/update/pr.rb +60 -0
- data/lib/jenkins/bundle/update/pr/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29503a9d6dd38a50b1496f5c25299063eedd7efb
|
4
|
+
data.tar.gz: 893df469a548b33eb46d76a66ffe90ac0a4ee09c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e85b79b545ce9f3179b4ced7c641b6bdc18c0da0ec56e59dd94093b0542fbbc1697383aad92a762c779edeb00f4f1dc6adbaf9131875a5a707ca1d08e9a18d34
|
7
|
+
data.tar.gz: cf2792217951efc527957a8a7d50353657e3b92f3eea2b640b6503c03148f59d60f1ef7ad9968550d5e28fbc9f3bf5c63d202ea4a9aab573452c4ba8c21ec9b8
|
data/.rubocop_todo.yml
CHANGED
@@ -1,16 +1,34 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2018-02-15 09:17:08 +0900 using RuboCop version 0.51.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count:
|
9
|
+
# Offense count: 2
|
10
10
|
Metrics/AbcSize:
|
11
|
-
Max:
|
11
|
+
Max: 59
|
12
|
+
|
13
|
+
# Offense count: 1
|
14
|
+
# Configuration parameters: CountBlocks.
|
15
|
+
Metrics/BlockNesting:
|
16
|
+
Max: 4
|
12
17
|
|
13
18
|
# Offense count: 1
|
19
|
+
Metrics/CyclomaticComplexity:
|
20
|
+
Max: 7
|
21
|
+
|
22
|
+
# Offense count: 2
|
14
23
|
# Configuration parameters: CountComments.
|
15
24
|
Metrics/MethodLength:
|
16
|
-
Max:
|
25
|
+
Max: 36
|
26
|
+
|
27
|
+
# Offense count: 1
|
28
|
+
Metrics/PerceivedComplexity:
|
29
|
+
Max: 10
|
30
|
+
|
31
|
+
# Offense count: 2
|
32
|
+
Style/IdenticalConditionalBranches:
|
33
|
+
Exclude:
|
34
|
+
- 'lib/jenkins/bundle/update/pr.rb'
|
@@ -5,6 +5,66 @@ require 'jenkins/bundle/update/pr/version'
|
|
5
5
|
require 'compare_linker'
|
6
6
|
require 'octokit'
|
7
7
|
|
8
|
+
class CompareLinker
|
9
|
+
def make_compare_links
|
10
|
+
if octokit.pull_request_files(repo_full_name, pr_number).find do |resource|
|
11
|
+
resource.filename == 'Gemfile.lock' || content.name == 'config/Gemfile.lock'
|
12
|
+
end
|
13
|
+
pull_request = octokit.pull_request(repo_full_name, pr_number)
|
14
|
+
|
15
|
+
fetcher = LockfileFetcher.new(octokit)
|
16
|
+
old_lockfile = fetcher.fetch(repo_full_name, pull_request.base.sha)
|
17
|
+
new_lockfile = fetcher.fetch(repo_full_name, pull_request.head.sha)
|
18
|
+
|
19
|
+
comparator = LockfileComparator.new
|
20
|
+
comparator.compare(old_lockfile, new_lockfile)
|
21
|
+
@compare_links = comparator.updated_gems.map do |gem_name, gem_info|
|
22
|
+
if gem_info[:owner].nil?
|
23
|
+
finder = GithubLinkFinder.new(octokit)
|
24
|
+
finder.find(gem_name)
|
25
|
+
if finder.repo_owner.nil?
|
26
|
+
gem_info[:homepage_uri] = finder.homepage_uri
|
27
|
+
formatter.format(gem_info)
|
28
|
+
else
|
29
|
+
gem_info[:repo_owner] = finder.repo_owner
|
30
|
+
gem_info[:repo_name] = finder.repo_name
|
31
|
+
|
32
|
+
tag_finder = GithubTagFinder.new(octokit)
|
33
|
+
old_tag = tag_finder.find(finder.repo_full_name, gem_info[:old_ver])
|
34
|
+
new_tag = tag_finder.find(finder.repo_full_name, gem_info[:new_ver])
|
35
|
+
|
36
|
+
if old_tag && new_tag
|
37
|
+
gem_info[:old_tag] = old_tag.name
|
38
|
+
gem_info[:new_tag] = new_tag.name
|
39
|
+
formatter.format(gem_info)
|
40
|
+
else
|
41
|
+
formatter.format(gem_info)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
else
|
45
|
+
formatter.format(gem_info)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
@compare_links
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
class LockfileFetcher
|
53
|
+
def fetch(repo_full_name, ref)
|
54
|
+
lockfile_content = octokit.contents(
|
55
|
+
repo_full_name, ref: ref
|
56
|
+
).find do |content|
|
57
|
+
content.name == 'Gemfile.lock' || content.name == 'config/Gemfile.lock'
|
58
|
+
end
|
59
|
+
Bundler::LockfileParser.new(
|
60
|
+
Base64.decode64(
|
61
|
+
octokit.blob(repo_full_name, lockfile_content.sha).content
|
62
|
+
)
|
63
|
+
)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
8
68
|
module Jenkins
|
9
69
|
module Bundle
|
10
70
|
module Update
|