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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0cfb099ccb5649914589e1f049118e7b054e10f5
4
- data.tar.gz: 233b79da05af99232a0028a6eae5b51a43079c47
3
+ metadata.gz: 29503a9d6dd38a50b1496f5c25299063eedd7efb
4
+ data.tar.gz: 893df469a548b33eb46d76a66ffe90ac0a4ee09c
5
5
  SHA512:
6
- metadata.gz: 023507a9b281854004ba3da1858c8f57a2b443b0ebe5f7b8c4bf286e5254612166c63e3a96e749ee85286e59111e7654cb5ea70f4f1ab521a3b8db9302f4ffd1
7
- data.tar.gz: 4cda01ee0e39346d7d55844047dc30c394154d28a1027da8ddd74f57dbbd437a0d0ac5f70a2af67a84db03bc8c6d44e1048a7495af1e775cdf911b641689a972
6
+ metadata.gz: e85b79b545ce9f3179b4ced7c641b6bdc18c0da0ec56e59dd94093b0542fbbc1697383aad92a762c779edeb00f4f1dc6adbaf9131875a5a707ca1d08e9a18d34
7
+ data.tar.gz: cf2792217951efc527957a8a7d50353657e3b92f3eea2b640b6503c03148f59d60f1ef7ad9968550d5e28fbc9f3bf5c63d202ea4a9aab573452c4ba8c21ec9b8
@@ -1,16 +1,34 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2017-12-10 13:43:54 +0900 using RuboCop version 0.51.0.
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: 1
9
+ # Offense count: 2
10
10
  Metrics/AbcSize:
11
- Max: 21
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: 12
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
@@ -4,7 +4,7 @@ module Jenkins
4
4
  module Bundle
5
5
  module Update
6
6
  module Pr
7
- VERSION = '0.1.2'
7
+ VERSION = '0.1.3'
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jenkins-bundle-update-pr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hidekazu Tanaka