unwrappr 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -1
- data/lib/unwrappr/cli.rb +16 -8
- data/lib/unwrappr/github/client.rb +6 -5
- data/lib/unwrappr/github/pr_source.rb +3 -2
- data/lib/unwrappr/lock_file_annotator.rb +4 -2
- data/lib/unwrappr/lock_file_comparator.rb +3 -1
- data/lib/unwrappr/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 197b63d85c71cc3d7701f8f22cd1a0c305bf07a6eade0c5e7c8ca52ec0538bb3
|
4
|
+
data.tar.gz: 07546ef3c1f66c5a6e9dd632d0f1ac07a5bae6c56897ec6908b9f5ae360dc682
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0eb4bed6b570378cc213667250f9fbca23e3a25ac84779d8ec2d54ebe4c7fb1cd601c1bac84a92ebff2861a52950f9c048f7c79fb947001c259289ca54272bd
|
7
|
+
data.tar.gz: 2ccbd4e9c68b2d38746b5a88bd37730f1bd211d65d94ceed575b6573e151d733cc7dae0dc4331dd9381d1b8084a05d92d932ad6800d83e726ed456dc4bcce2f1
|
data/CHANGELOG.md
CHANGED
@@ -6,7 +6,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
-
[Unreleased]: https://github.com/envato/unwrappr/compare/v0.
|
9
|
+
[Unreleased]: https://github.com/envato/unwrappr/compare/v0.6.0...HEAD
|
10
|
+
|
11
|
+
## [0.6.0] 2021-05-12
|
12
|
+
|
13
|
+
### Add
|
14
|
+
- Allow specification of Gemfile lock files to annotate. ([#86])
|
15
|
+
|
16
|
+
[0.6.0]: https://github.com/envato/unwrappr/compare/v0.5.0..v0.6.0
|
17
|
+
[#86]: https://github.com/envato/unwrappr/pull/86
|
10
18
|
|
11
19
|
## [0.5.0] 2021-01-04
|
12
20
|
|
data/lib/unwrappr/cli.rb
CHANGED
@@ -17,6 +17,13 @@ module Unwrappr
|
|
17
17
|
DESCRIPTION
|
18
18
|
attribute_name: :base_branch)
|
19
19
|
|
20
|
+
option ['-f', '--lock-file'],
|
21
|
+
'LOCK_FILE1 [-f LOCK_FILE2] [-f LOCK_FILE3] [-f ...]',
|
22
|
+
'The Gemfile.lock files to annotate. Useful when working with multiple lock files.',
|
23
|
+
multivalued: true,
|
24
|
+
default: ['Gemfile.lock'],
|
25
|
+
attribute_name: :lock_files
|
26
|
+
|
20
27
|
option ['-v', '--version'], :flag, 'Show version' do
|
21
28
|
puts "unwrappr v#{Unwrappr::VERSION}"
|
22
29
|
exit(0)
|
@@ -25,7 +32,7 @@ module Unwrappr
|
|
25
32
|
subcommand 'all', 'run bundle update, push to github, '\
|
26
33
|
'create a pr and annotate changes' do
|
27
34
|
def execute
|
28
|
-
Unwrappr.run_unwapper_in_pwd(base_branch: base_branch)
|
35
|
+
Unwrappr.run_unwapper_in_pwd(base_branch: base_branch, lock_files: lock_files)
|
29
36
|
end
|
30
37
|
end
|
31
38
|
|
@@ -42,7 +49,8 @@ module Unwrappr
|
|
42
49
|
def execute
|
43
50
|
LockFileAnnotator.annotate_github_pull_request(
|
44
51
|
repo: repo,
|
45
|
-
pr_number: pr.to_i
|
52
|
+
pr_number: pr.to_i,
|
53
|
+
lock_files: lock_files
|
46
54
|
)
|
47
55
|
end
|
48
56
|
end
|
@@ -68,24 +76,24 @@ module Unwrappr
|
|
68
76
|
)
|
69
77
|
end
|
70
78
|
|
71
|
-
Dir.chdir(repo) { Unwrappr.run_unwapper_in_pwd(base_branch: base_branch) }
|
79
|
+
Dir.chdir(repo) { Unwrappr.run_unwapper_in_pwd(base_branch: base_branch, lock_files: lock_files) }
|
72
80
|
end
|
73
81
|
end
|
74
82
|
end
|
75
83
|
end
|
76
84
|
|
77
|
-
def self.run_unwapper_in_pwd(base_branch:)
|
78
|
-
return unless
|
85
|
+
def self.run_unwapper_in_pwd(base_branch:, lock_files:)
|
86
|
+
return unless any_lockfile_present?(lock_files)
|
79
87
|
|
80
88
|
puts "Doing the unwrappr thing in #{Dir.pwd}"
|
81
89
|
|
82
90
|
GitCommandRunner.create_branch!(base_branch: base_branch)
|
83
91
|
BundlerCommandRunner.bundle_update!
|
84
92
|
GitCommandRunner.commit_and_push_changes!
|
85
|
-
GitHub::Client.make_pull_request!
|
93
|
+
GitHub::Client.make_pull_request!(lock_files)
|
86
94
|
end
|
87
95
|
|
88
|
-
def self.
|
89
|
-
GitCommandRunner.file_exist?(
|
96
|
+
def self.any_lockfile_present?(lock_files)
|
97
|
+
lock_files.any? { |lock_file| GitCommandRunner.file_exist?(lock_file) }
|
90
98
|
end
|
91
99
|
end
|
@@ -12,8 +12,8 @@ module Unwrappr
|
|
12
12
|
@github_token = nil
|
13
13
|
end
|
14
14
|
|
15
|
-
def make_pull_request!
|
16
|
-
create_and_annotate_pull_request
|
15
|
+
def make_pull_request!(lock_files)
|
16
|
+
create_and_annotate_pull_request(lock_files)
|
17
17
|
rescue Octokit::ClientError => e
|
18
18
|
raise "Failed to create and annotate pull request: #{e}"
|
19
19
|
end
|
@@ -27,7 +27,7 @@ module Unwrappr
|
|
27
27
|
[m[:org], m[:repo]].join('/')
|
28
28
|
end
|
29
29
|
|
30
|
-
def create_and_annotate_pull_request
|
30
|
+
def create_and_annotate_pull_request(lock_files)
|
31
31
|
pr = git_client.create_pull_request(
|
32
32
|
repo_name_and_org,
|
33
33
|
repo_default_branch,
|
@@ -35,7 +35,7 @@ module Unwrappr
|
|
35
35
|
'Automated Bundle Update',
|
36
36
|
pull_request_body
|
37
37
|
)
|
38
|
-
annotate_pull_request(pr.number)
|
38
|
+
annotate_pull_request(pr.number, lock_files)
|
39
39
|
end
|
40
40
|
|
41
41
|
def repo_default_branch
|
@@ -50,10 +50,11 @@ module Unwrappr
|
|
50
50
|
BODY
|
51
51
|
end
|
52
52
|
|
53
|
-
def annotate_pull_request(pr_number)
|
53
|
+
def annotate_pull_request(pr_number, lock_files)
|
54
54
|
LockFileAnnotator.annotate_github_pull_request(
|
55
55
|
repo: repo_name_and_org,
|
56
56
|
pr_number: pr_number,
|
57
|
+
lock_files: lock_files,
|
57
58
|
client: git_client
|
58
59
|
)
|
59
60
|
end
|
@@ -9,9 +9,10 @@ module Unwrappr
|
|
9
9
|
# Implements the `lock_file_diff_source` interface as defined by the
|
10
10
|
# LockFileAnnotator.
|
11
11
|
class PrSource
|
12
|
-
def initialize(repo, pr_number, client)
|
12
|
+
def initialize(repo, pr_number, lock_files, client)
|
13
13
|
@repo = repo
|
14
14
|
@pr_number = pr_number
|
15
|
+
@lock_files = lock_files
|
15
16
|
@client = client
|
16
17
|
end
|
17
18
|
|
@@ -33,7 +34,7 @@ module Unwrappr
|
|
33
34
|
@lock_file_diffs ||= @client
|
34
35
|
.pull_request_files(@repo, @pr_number)
|
35
36
|
.select do |file|
|
36
|
-
File.basename(file.filename)
|
37
|
+
@lock_files.include?(File.basename(file.filename))
|
37
38
|
end
|
38
39
|
end
|
39
40
|
|
@@ -18,10 +18,10 @@ module Unwrappr
|
|
18
18
|
class LockFileAnnotator
|
19
19
|
# rubocop:disable Metrics/MethodLength
|
20
20
|
def self.annotate_github_pull_request(
|
21
|
-
repo:, pr_number:, client: Octokit.client
|
21
|
+
repo:, pr_number:, lock_files:, client: Octokit.client
|
22
22
|
)
|
23
23
|
new(
|
24
|
-
lock_file_diff_source: Github::PrSource.new(repo, pr_number, client),
|
24
|
+
lock_file_diff_source: Github::PrSource.new(repo, pr_number, lock_files, client),
|
25
25
|
annotation_sink: Github::PrSink.new(repo, pr_number, client),
|
26
26
|
annotation_writer: Writers::Composite.new(
|
27
27
|
Writers::Title,
|
@@ -54,6 +54,8 @@ module Unwrappr
|
|
54
54
|
|
55
55
|
def annotate
|
56
56
|
@lock_file_diff_source.each_file do |lock_file_diff|
|
57
|
+
puts "Annotating #{lock_file_diff.filename}"
|
58
|
+
|
57
59
|
lock_file_diff.each_gem_change do |gem_change|
|
58
60
|
gem_change_info = @gem_researcher.research(gem_change, {})
|
59
61
|
message = @annotation_writer.write(gem_change, gem_change_info)
|
data/lib/unwrappr/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unwrappr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emilyn Escabarte
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: exe
|
14
14
|
cert_chain: []
|
15
|
-
date: 2021-
|
15
|
+
date: 2021-05-12 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: bundler
|
@@ -292,7 +292,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
292
292
|
- !ruby/object:Gem::Version
|
293
293
|
version: '2.7'
|
294
294
|
requirements: []
|
295
|
-
rubygems_version: 3.2.
|
295
|
+
rubygems_version: 3.2.11
|
296
296
|
signing_key:
|
297
297
|
specification_version: 4
|
298
298
|
summary: A tool to unwrap your gems and see what's changed easily
|