unwrappr 0.3.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.buildkite/pipeline.yml +9 -0
- data/.github/workflows/ci.yml +23 -0
- data/.gitignore +2 -3
- data/.rubocop.yml +2 -1
- data/.tool-versions +1 -0
- data/CHANGELOG.md +89 -6
- data/README.md +6 -7
- data/lib/unwrappr/cli.rb +13 -5
- data/lib/unwrappr/gem_change.rb +6 -0
- data/lib/unwrappr/gem_version.rb +9 -1
- data/lib/unwrappr/git_command_runner.rb +12 -12
- data/lib/unwrappr/github/client.rb +10 -5
- data/lib/unwrappr/lock_file_diff.rb +1 -1
- data/lib/unwrappr/researchers/github_comparison.rb +17 -5
- data/lib/unwrappr/researchers/github_repo.rb +4 -1
- data/lib/unwrappr/researchers/ruby_gems_info.rb +3 -1
- data/lib/unwrappr/ruby_gems.rb +4 -8
- data/lib/unwrappr/version.rb +1 -1
- data/lib/unwrappr/writers/version_change.rb +14 -4
- data/unwrappr.gemspec +15 -12
- metadata +28 -28
- data/.travis.yml +0 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ac46367aac21e83d32adc4e911daae5b8048f65a8939895e47de3e5ae94e7faf
|
|
4
|
+
data.tar.gz: 7e3ad4f274d8dea952ddbbb2012256f90da27dae015974b3df19fd17d8fa5f6a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e837150f75105603329e612b5f351c358aee257e898cdcb2f402de7df1b451f5427d44e005f2d0923c696ef5914d42e62b5d1d9ccfd44bb9d62138f5aa51e485
|
|
7
|
+
data.tar.gz: 450af0d234ca5dc144553c17a76a43f3e3a025ffe30ba0c8e6d9dc5e4a75abbcfbd0bc6c452c995ac25f93aa46a73aaeda5eec4b081f54e429e476786eefa20b
|
data/.buildkite/pipeline.yml
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
|
|
3
3
|
steps:
|
|
4
|
+
- label: ":ruby: 2.6 :rspec:"
|
|
5
|
+
command: ".buildkite/steps/rspec.sh"
|
|
6
|
+
plugins:
|
|
7
|
+
docker#v1.2.1:
|
|
8
|
+
image: "ruby:2.6"
|
|
9
|
+
agents:
|
|
10
|
+
queue: "platform-docker-spot"
|
|
11
|
+
timeout_in_minutes: 5
|
|
12
|
+
|
|
4
13
|
- label: ":ruby: 2.5 :rspec:"
|
|
5
14
|
command: ".buildkite/steps/rspec.sh"
|
|
6
15
|
plugins:
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on: [push, pull_request]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
test:
|
|
7
|
+
strategy:
|
|
8
|
+
fail-fast: false
|
|
9
|
+
matrix:
|
|
10
|
+
ruby: ['2.5', '2.6', '2.7', '3.0']
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout
|
|
15
|
+
uses: actions/checkout@v2
|
|
16
|
+
- name: Set up Ruby
|
|
17
|
+
uses: ruby/setup-ruby@v1
|
|
18
|
+
with:
|
|
19
|
+
ruby-version: ${{ matrix.ruby }}
|
|
20
|
+
- name: Install dependencies
|
|
21
|
+
run: bundle install
|
|
22
|
+
- name: Run tests
|
|
23
|
+
run: bundle exec rake
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/.tool-versions
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ruby 3.0.0
|
data/CHANGELOG.md
CHANGED
|
@@ -6,16 +6,99 @@ 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.5.0...HEAD
|
|
10
|
+
|
|
11
|
+
## [0.5.0] 2021-01-04
|
|
12
|
+
|
|
13
|
+
### Add
|
|
14
|
+
- Support for Ruby 3. ([#79])
|
|
15
|
+
- Allow specification of base branch, upon which to base the pull-request
|
|
16
|
+
([#80], [#84])
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
- Moved CI to GitHub Actions ([#78])
|
|
20
|
+
- Fixed homepage URL in gemspec ([#77])
|
|
21
|
+
- Default branch is now `main`([#81])
|
|
22
|
+
- Rename private predicate methods in GitCommandRunner to be more descriptive.
|
|
23
|
+
([#82])
|
|
24
|
+
- Upgrade Faraday dependency to version 1 ([#85])
|
|
25
|
+
|
|
26
|
+
[0.5.0]: https://github.com/envato/unwrappr/compare/v0.4.0..v0.5.0
|
|
27
|
+
[#77]: https://github.com/envato/unwrappr/pull/77
|
|
28
|
+
[#78]: https://github.com/envato/unwrappr/pull/78
|
|
29
|
+
[#79]: https://github.com/envato/unwrappr/pull/79
|
|
30
|
+
[#80]: https://github.com/envato/unwrappr/pull/80
|
|
31
|
+
[#81]: https://github.com/envato/unwrappr/pull/81
|
|
32
|
+
[#82]: https://github.com/envato/unwrappr/pull/82
|
|
33
|
+
[#84]: https://github.com/envato/unwrappr/pull/84
|
|
34
|
+
[#85]: https://github.com/envato/unwrappr/pull/85
|
|
35
|
+
|
|
36
|
+
## [0.4.0] 2020-04-14
|
|
37
|
+
### Changed
|
|
38
|
+
- `bundler-audit` limited to `>= 0.6.0` ([#71])
|
|
39
|
+
|
|
40
|
+
### Removed
|
|
41
|
+
- Support for Ruby 2.3 and 2.4 ([#73])
|
|
42
|
+
|
|
43
|
+
### Added
|
|
44
|
+
- Rake vulnerability CVE-2020-8130 fixes ([#72])
|
|
45
|
+
- Support for Ruby 2.6 and 2.7 ([#73])
|
|
46
|
+
- Support for version numbers including a fourth segment (_e.g._ "6.0.2.2") ([#74])
|
|
47
|
+
- Support for GitHub URIs including anchors ([#75])
|
|
48
|
+
|
|
49
|
+
[0.4.0]: https://github.com/envato/unwrappr/compare/v0.3.5..v0.4.0
|
|
50
|
+
[#71]: https://github.com/envato/unwrappr/pull/71
|
|
51
|
+
[#72]: https://github.com/envato/unwrappr/pull/72
|
|
52
|
+
[#73]: https://github.com/envato/unwrappr/pull/73
|
|
53
|
+
[#74]: https://github.com/envato/unwrappr/pull/74
|
|
54
|
+
[#75]: https://github.com/envato/unwrappr/pull/75
|
|
55
|
+
|
|
56
|
+
## [0.3.5] 2019-11-28
|
|
57
|
+
### Changed
|
|
58
|
+
- ISO 8601 Date and time format for branch name ([#68])
|
|
59
|
+
### Fixed
|
|
60
|
+
- Changelog and source links in PR annotation are specific to the version
|
|
61
|
+
used in the project, not just the latest available on Rubygems.org ([#69]).
|
|
62
|
+
|
|
63
|
+
[0.3.5]: https://github.com/envato/unwrappr/compare/v0.3.4...v0.3.5
|
|
64
|
+
[#68]: https://github.com/envato/unwrappr/pull/68
|
|
65
|
+
[#69]: https://github.com/envato/unwrappr/pull/69
|
|
66
|
+
|
|
67
|
+
## [0.3.4] 2019-10-24
|
|
68
|
+
### Fixed
|
|
69
|
+
- Fix failure to annotate gem change with '.' in its name ([#65]).
|
|
70
|
+
|
|
71
|
+
[0.3.4]: https://github.com/envato/unwrappr/compare/v0.3.3...v0.3.4
|
|
72
|
+
[#65]: https://github.com/envato/unwrappr/pull/65
|
|
73
|
+
|
|
74
|
+
## [0.3.3] 2019-06-07
|
|
75
|
+
### Fixed
|
|
76
|
+
- Fix issue where gem install will now work on RubyGems v3 ([#61]).
|
|
77
|
+
|
|
78
|
+
[0.3.3]: https://github.com/envato/unwrappr/compare/v0.3.2...v0.3.3
|
|
79
|
+
[#61]: https://github.com/envato/unwrappr/pull/61
|
|
80
|
+
|
|
9
81
|
## [0.3.2] 2018-11-13
|
|
10
82
|
### Added
|
|
11
|
-
- Specify Ruby and RubyGems requirements in gemspec.
|
|
12
|
-
- Clone one git repository or more and create an annotated bundle update PR for each.
|
|
83
|
+
- Specify Ruby and RubyGems requirements in gemspec ([#56]).
|
|
84
|
+
- Clone one git repository or more and create an annotated bundle update PR for each ([#52]).
|
|
85
|
+
|
|
86
|
+
[0.3.2]: https://github.com/envato/unwrappr/compare/v0.3.1...v0.3.2
|
|
87
|
+
[#56]: https://github.com/envato/unwrappr/pull/56
|
|
88
|
+
[#52]: https://github.com/envato/unwrappr/pull/52
|
|
13
89
|
|
|
14
90
|
## [0.3.1] 2018-11-12
|
|
15
91
|
### Changed
|
|
16
|
-
- Travis CI enabled
|
|
17
|
-
- Ensure we are protected against CVE-2017-8418
|
|
18
|
-
- RubyGems metadata includes a description
|
|
92
|
+
- Travis CI enabled ([#55]).
|
|
93
|
+
- Ensure we are protected against CVE-2017-8418 ([#54]).
|
|
94
|
+
- RubyGems metadata includes a description ([#49]).
|
|
95
|
+
|
|
96
|
+
[0.3.1]: https://github.com/envato/unwrappr/compare/v0.3.0...v0.3.1
|
|
97
|
+
[#55]: https://github.com/envato/unwrappr/pull/55
|
|
98
|
+
[#54]: https://github.com/envato/unwrappr/pull/54
|
|
99
|
+
[#49]: https://github.com/envato/unwrappr/pull/49
|
|
19
100
|
|
|
20
101
|
## [0.3.0] 2018-11-12
|
|
21
|
-
|
|
102
|
+
### Initial Release
|
|
103
|
+
|
|
104
|
+
[0.3.0]: https://github.com/envato/unwrappr/releases/tag/v0.3.0
|
data/README.md
CHANGED
|
@@ -16,7 +16,7 @@ to get regular dependency updates into production.
|
|
|
16
16
|
- Vulnerability advisory information using [bundler-audit](https://github.com/rubysec/bundler-audit)
|
|
17
17
|
- Links to the home page, source code and change log (where available) of each gem
|
|
18
18
|
|
|
19
|
-
## Development status [](https://github.com/envato/unwrappr/actions?query=workflow%3ACI)
|
|
20
20
|
|
|
21
21
|
`unwrappr` is used in many projects around [Envato][envato]
|
|
22
22
|
However, it is still undergoing development and features are likely to change
|
|
@@ -63,13 +63,12 @@ See https://github.com/settings/tokens to set up personal access tokens.
|
|
|
63
63
|
|
|
64
64
|
## Requirements
|
|
65
65
|
|
|
66
|
-
- Ruby (tested against v2.
|
|
66
|
+
- Ruby (tested against v2.5 and above)
|
|
67
67
|
- GitHub access (see Configuration section)
|
|
68
68
|
|
|
69
|
-
## Contact
|
|
69
|
+
## Contact
|
|
70
70
|
|
|
71
71
|
- [GitHub project](https://github.com/envato/unwrappr)
|
|
72
|
-
- [Gitter chat room](https://gitter.im/envato/unwrappr)
|
|
73
72
|
- Bug reports and feature requests are welcome via [GitHub Issues](https://github.com/envato/unwrappr/issues)
|
|
74
73
|
|
|
75
74
|
## Maintainers
|
|
@@ -86,16 +85,16 @@ See https://github.com/settings/tokens to set up personal access tokens.
|
|
|
86
85
|
- [Em Esc](https://github.com/emesc)
|
|
87
86
|
- [Chun-wei Kuo](https://github.com/Domon)
|
|
88
87
|
|
|
89
|
-
## License [](https://github.com/envato/unwrappr/blob/
|
|
88
|
+
## License [](https://github.com/envato/unwrappr/blob/HEAD/LICENSE.txt)
|
|
90
89
|
|
|
91
90
|
`unwrappr` uses MIT license. See
|
|
92
|
-
[`LICENSE.txt`](https://github.com/envato/unwrappr/blob/
|
|
91
|
+
[`LICENSE.txt`](https://github.com/envato/unwrappr/blob/HEAD/LICENSE.txt) for
|
|
93
92
|
details.
|
|
94
93
|
|
|
95
94
|
## Code of Conduct
|
|
96
95
|
|
|
97
96
|
We welcome contribution from everyone. Read more about it in
|
|
98
|
-
[`CODE_OF_CONDUCT.md`](https://github.com/envato/unwrappr/blob/
|
|
97
|
+
[`CODE_OF_CONDUCT.md`](https://github.com/envato/unwrappr/blob/HEAD/CODE_OF_CONDUCT.md)
|
|
99
98
|
|
|
100
99
|
## Contributing [](https://github.com/envato/unwrappr/issues)
|
|
101
100
|
|
data/lib/unwrappr/cli.rb
CHANGED
|
@@ -8,6 +8,15 @@ module Unwrappr
|
|
|
8
8
|
class CLI < Clamp::Command
|
|
9
9
|
self.default_subcommand = 'all'
|
|
10
10
|
|
|
11
|
+
option(['-b', '--base'],
|
|
12
|
+
'BRANCH',
|
|
13
|
+
<<~DESCRIPTION,
|
|
14
|
+
the branch upon which to base the pull-request. Omit this option
|
|
15
|
+
to use the current branch, or repository's default branch
|
|
16
|
+
(typically 'origin/main') on clone.
|
|
17
|
+
DESCRIPTION
|
|
18
|
+
attribute_name: :base_branch)
|
|
19
|
+
|
|
11
20
|
option ['-v', '--version'], :flag, 'Show version' do
|
|
12
21
|
puts "unwrappr v#{Unwrappr::VERSION}"
|
|
13
22
|
exit(0)
|
|
@@ -16,13 +25,12 @@ module Unwrappr
|
|
|
16
25
|
subcommand 'all', 'run bundle update, push to github, '\
|
|
17
26
|
'create a pr and annotate changes' do
|
|
18
27
|
def execute
|
|
19
|
-
Unwrappr.run_unwapper_in_pwd
|
|
28
|
+
Unwrappr.run_unwapper_in_pwd(base_branch: base_branch)
|
|
20
29
|
end
|
|
21
30
|
end
|
|
22
31
|
|
|
23
32
|
subcommand 'annotate-pull-request',
|
|
24
33
|
'Annotate Gemfile.lock changes in a Github pull request' do
|
|
25
|
-
|
|
26
34
|
option ['-r', '--repo'], 'REPO',
|
|
27
35
|
'The repo in github <owner/project>',
|
|
28
36
|
required: true
|
|
@@ -60,18 +68,18 @@ module Unwrappr
|
|
|
60
68
|
)
|
|
61
69
|
end
|
|
62
70
|
|
|
63
|
-
Dir.chdir(repo) { Unwrappr.run_unwapper_in_pwd }
|
|
71
|
+
Dir.chdir(repo) { Unwrappr.run_unwapper_in_pwd(base_branch: base_branch) }
|
|
64
72
|
end
|
|
65
73
|
end
|
|
66
74
|
end
|
|
67
75
|
end
|
|
68
76
|
|
|
69
|
-
def self.run_unwapper_in_pwd
|
|
77
|
+
def self.run_unwapper_in_pwd(base_branch:)
|
|
70
78
|
return unless lockfile_present?
|
|
71
79
|
|
|
72
80
|
puts "Doing the unwrappr thing in #{Dir.pwd}"
|
|
73
81
|
|
|
74
|
-
GitCommandRunner.create_branch!
|
|
82
|
+
GitCommandRunner.create_branch!(base_branch: base_branch)
|
|
75
83
|
BundlerCommandRunner.bundle_update!
|
|
76
84
|
GitCommandRunner.commit_and_push_changes!
|
|
77
85
|
GitHub::Client.make_pull_request!
|
data/lib/unwrappr/gem_change.rb
CHANGED
|
@@ -18,6 +18,7 @@ module Unwrappr
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
attr_reader :name, :head_version, :base_version, :line_number
|
|
21
|
+
|
|
21
22
|
def_delegators :@lock_file_diff, :filename, :sha
|
|
22
23
|
|
|
23
24
|
def added?
|
|
@@ -43,6 +44,11 @@ module Unwrappr
|
|
|
43
44
|
head_version.patch_difference?(base_version)
|
|
44
45
|
end
|
|
45
46
|
|
|
47
|
+
def hotfix?
|
|
48
|
+
head_version && base_version &&
|
|
49
|
+
head_version.hotfix_difference?(base_version)
|
|
50
|
+
end
|
|
51
|
+
|
|
46
52
|
def upgrade?
|
|
47
53
|
head_version && base_version && (head_version > base_version)
|
|
48
54
|
end
|
data/lib/unwrappr/gem_version.rb
CHANGED
|
@@ -13,9 +13,10 @@ module Unwrappr
|
|
|
13
13
|
@major = segment(0)
|
|
14
14
|
@minor = segment(1)
|
|
15
15
|
@patch = segment(2)
|
|
16
|
+
@hotfix = segment(3)
|
|
16
17
|
end
|
|
17
18
|
|
|
18
|
-
attr_reader :major, :minor, :patch, :version
|
|
19
|
+
attr_reader :major, :minor, :patch, :hotfix, :version
|
|
19
20
|
|
|
20
21
|
def major_difference?(other)
|
|
21
22
|
(major != other.major)
|
|
@@ -32,6 +33,13 @@ module Unwrappr
|
|
|
32
33
|
(patch != other.patch)
|
|
33
34
|
end
|
|
34
35
|
|
|
36
|
+
def hotfix_difference?(other)
|
|
37
|
+
(major == other.major) &&
|
|
38
|
+
(minor == other.minor) &&
|
|
39
|
+
(patch == other.patch) &&
|
|
40
|
+
(hotfix != other.hotfix)
|
|
41
|
+
end
|
|
42
|
+
|
|
35
43
|
def <=>(other)
|
|
36
44
|
@version <=> other.version
|
|
37
45
|
end
|
|
@@ -7,15 +7,15 @@ module Unwrappr
|
|
|
7
7
|
# Runs Git commands
|
|
8
8
|
module GitCommandRunner
|
|
9
9
|
class << self
|
|
10
|
-
def create_branch!
|
|
10
|
+
def create_branch!(base_branch:)
|
|
11
11
|
raise 'Not a git working dir' unless git_dir?
|
|
12
|
-
raise
|
|
12
|
+
raise "failed to create branch from '#{base_branch}'" unless checkout_target_branch(base_branch: base_branch)
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def commit_and_push_changes!
|
|
16
|
-
raise 'failed to add git changes' unless
|
|
17
|
-
raise 'failed to commit changes' unless
|
|
18
|
-
raise 'failed to push changes' unless
|
|
16
|
+
raise 'failed to add git changes' unless stage_all_changes
|
|
17
|
+
raise 'failed to commit changes' unless commit_staged_changes
|
|
18
|
+
raise 'failed to push changes' unless push_current_branch_to_origin
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def reset_client
|
|
@@ -50,23 +50,23 @@ module Unwrappr
|
|
|
50
50
|
git_wrap { !current_branch_name.empty? }
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
-
def
|
|
54
|
-
timestamp = Time.now.strftime('%Y%d
|
|
53
|
+
def checkout_target_branch(base_branch:)
|
|
54
|
+
timestamp = Time.now.strftime('%Y%m%d-%H%M').freeze
|
|
55
55
|
git_wrap do
|
|
56
|
-
git.checkout(
|
|
56
|
+
git.checkout(base_branch) unless base_branch.nil?
|
|
57
57
|
git.branch("auto_bundle_update_#{timestamp}").checkout
|
|
58
58
|
end
|
|
59
59
|
end
|
|
60
60
|
|
|
61
|
-
def
|
|
61
|
+
def stage_all_changes
|
|
62
62
|
git_wrap { git.add(all: true) }
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
-
def
|
|
65
|
+
def commit_staged_changes
|
|
66
66
|
git_wrap { git.commit('Automatic Bundle Update') }
|
|
67
67
|
end
|
|
68
68
|
|
|
69
|
-
def
|
|
69
|
+
def push_current_branch_to_origin
|
|
70
70
|
git_wrap { git.push('origin', current_branch_name) }
|
|
71
71
|
end
|
|
72
72
|
|
|
@@ -80,7 +80,7 @@ module Unwrappr
|
|
|
80
80
|
|
|
81
81
|
def log_options
|
|
82
82
|
{}.tap do |opt|
|
|
83
|
-
opt[:log] = Logger.new(
|
|
83
|
+
opt[:log] = Logger.new($stdout) if ENV['DEBUG']
|
|
84
84
|
end
|
|
85
85
|
end
|
|
86
86
|
|
|
@@ -30,7 +30,7 @@ module Unwrappr
|
|
|
30
30
|
def create_and_annotate_pull_request
|
|
31
31
|
pr = git_client.create_pull_request(
|
|
32
32
|
repo_name_and_org,
|
|
33
|
-
|
|
33
|
+
repo_default_branch,
|
|
34
34
|
Unwrappr::GitCommandRunner.current_branch_name,
|
|
35
35
|
'Automated Bundle Update',
|
|
36
36
|
pull_request_body
|
|
@@ -38,6 +38,11 @@ module Unwrappr
|
|
|
38
38
|
annotate_pull_request(pr.number)
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
+
def repo_default_branch
|
|
42
|
+
git_client.repository(repo_name_and_org)
|
|
43
|
+
.default_branch
|
|
44
|
+
end
|
|
45
|
+
|
|
41
46
|
def pull_request_body
|
|
42
47
|
<<~BODY
|
|
43
48
|
Gems brought up-to-date with :heart: by [Unwrappr](https://github.com/envato/unwrappr).
|
|
@@ -58,16 +63,16 @@ module Unwrappr
|
|
|
58
63
|
end
|
|
59
64
|
|
|
60
65
|
def github_token
|
|
61
|
-
@github_token ||= ENV.fetch('GITHUB_TOKEN')
|
|
62
|
-
|
|
66
|
+
@github_token ||= ENV.fetch('GITHUB_TOKEN')
|
|
67
|
+
rescue KeyError
|
|
68
|
+
raise %(
|
|
63
69
|
Missing environment variable GITHUB_TOKEN.
|
|
64
70
|
See https://github.com/settings/tokens to set up personal access tokens.
|
|
65
71
|
Add to the environment:
|
|
66
72
|
|
|
67
73
|
export GITHUB_TOKEN=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
|
68
74
|
|
|
69
|
-
)
|
|
70
|
-
end
|
|
75
|
+
)
|
|
71
76
|
end
|
|
72
77
|
end
|
|
73
78
|
end
|
|
@@ -63,7 +63,7 @@ module Unwrappr
|
|
|
63
63
|
# '+ websocket-driver (0.6.5)'
|
|
64
64
|
# Careful not to match this (note the wider indent):
|
|
65
65
|
# '+ websocket-extensions (>= 0.1.0)'
|
|
66
|
-
pattern = /^(?<change_type>[
|
|
66
|
+
pattern = /^(?<change_type>[+\-]) (?<gem_name>\S+) \(\d/
|
|
67
67
|
match = pattern.match(line)
|
|
68
68
|
return match[:gem_name], match[:change_type] unless match.nil?
|
|
69
69
|
end
|
|
@@ -12,13 +12,13 @@ module Unwrappr
|
|
|
12
12
|
@client = client
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
def research(gem_change,
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
def research(gem_change, change_info)
|
|
16
|
+
return change_info if github_repo_not_identified?(change_info) ||
|
|
17
|
+
gem_added_or_removed?(gem_change)
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
change_info.merge(
|
|
20
20
|
github_comparison: try_comparing(
|
|
21
|
-
repo:
|
|
21
|
+
repo: github_repo(change_info),
|
|
22
22
|
base: gem_change.base_version,
|
|
23
23
|
head: gem_change.head_version
|
|
24
24
|
)
|
|
@@ -38,6 +38,18 @@ module Unwrappr
|
|
|
38
38
|
rescue Octokit::NotFound
|
|
39
39
|
nil
|
|
40
40
|
end
|
|
41
|
+
|
|
42
|
+
def github_repo_not_identified?(gem_change_info)
|
|
43
|
+
github_repo(gem_change_info).nil?
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def github_repo(gem_change_info)
|
|
47
|
+
gem_change_info[:github_repo]
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def gem_added_or_removed?(gem_change)
|
|
51
|
+
gem_change.base_version.nil? || gem_change.head_version.nil?
|
|
52
|
+
end
|
|
41
53
|
end
|
|
42
54
|
end
|
|
43
55
|
end
|
|
@@ -7,7 +7,10 @@ module Unwrappr
|
|
|
7
7
|
# Implements the `gem_researcher` interface required by the
|
|
8
8
|
# LockFileAnnotator.
|
|
9
9
|
class GithubRepo
|
|
10
|
-
GITHUB_URI_PATTERN = %r{^https?://
|
|
10
|
+
GITHUB_URI_PATTERN = %r{^https?://
|
|
11
|
+
github.com/
|
|
12
|
+
(?<repo>[^/]+/[[:alnum:]_.-]+)
|
|
13
|
+
}ix.freeze
|
|
11
14
|
|
|
12
15
|
def research(_gem_change, gem_change_info)
|
|
13
16
|
repo = match_repo(gem_change_info, :source_code_uri) ||
|
|
@@ -9,7 +9,9 @@ module Unwrappr
|
|
|
9
9
|
class RubyGemsInfo
|
|
10
10
|
def research(gem_change, gem_change_info)
|
|
11
11
|
gem_change_info.merge(
|
|
12
|
-
ruby_gems: ::Unwrappr::RubyGems.gem_info(
|
|
12
|
+
ruby_gems: ::Unwrappr::RubyGems.gem_info(
|
|
13
|
+
gem_change.name, gem_change.head_version
|
|
14
|
+
)
|
|
13
15
|
)
|
|
14
16
|
end
|
|
15
17
|
end
|
data/lib/unwrappr/ruby_gems.rb
CHANGED
|
@@ -6,15 +6,11 @@ module Unwrappr
|
|
|
6
6
|
# A wrapper around RubyGems' API
|
|
7
7
|
module RubyGems
|
|
8
8
|
SERVER = 'https://rubygems.org'
|
|
9
|
-
GET_GEM = '/api/
|
|
9
|
+
GET_GEM = '/api/v2/rubygems/%s/versions/%s.json'
|
|
10
10
|
|
|
11
11
|
class << self
|
|
12
|
-
def gem_info(name)
|
|
13
|
-
parse(Faraday.get(SERVER + GET_GEM
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def try_get_source_code_uri(gem_name)
|
|
17
|
-
Unwrappr::RubyGems.gem_info(gem_name)&.source_code_uri
|
|
12
|
+
def gem_info(name, version)
|
|
13
|
+
parse(Faraday.get(SERVER + format(GET_GEM, name, version)), name)
|
|
18
14
|
end
|
|
19
15
|
|
|
20
16
|
private
|
|
@@ -26,7 +22,7 @@ module Unwrappr
|
|
|
26
22
|
when 404
|
|
27
23
|
nil
|
|
28
24
|
else
|
|
29
|
-
|
|
25
|
+
warn(error_message(response: response, name: name))
|
|
30
26
|
end
|
|
31
27
|
end
|
|
32
28
|
|
data/lib/unwrappr/version.rb
CHANGED
|
@@ -27,18 +27,28 @@ module Unwrappr
|
|
|
27
27
|
private
|
|
28
28
|
|
|
29
29
|
def_delegators(:@gem_change,
|
|
30
|
-
:added?, :removed?, :major?, :minor?, :patch?,
|
|
30
|
+
:added?, :removed?, :major?, :minor?, :patch?, :hotfix?,
|
|
31
31
|
:upgrade?, :downgrade?, :base_version, :head_version)
|
|
32
32
|
|
|
33
33
|
def change_description
|
|
34
|
-
if added?
|
|
35
|
-
|
|
36
|
-
elsif
|
|
34
|
+
if added?
|
|
35
|
+
'Gem added :snowman:'
|
|
36
|
+
elsif removed?
|
|
37
|
+
'Gem removed :fire:'
|
|
38
|
+
else
|
|
39
|
+
version_description
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def version_description
|
|
44
|
+
if major?
|
|
37
45
|
"**Major** version #{grade}:exclamation: #{version_diff}"
|
|
38
46
|
elsif minor?
|
|
39
47
|
"**Minor** version #{grade}:large_orange_diamond: #{version_diff}"
|
|
40
48
|
elsif patch?
|
|
41
49
|
"**Patch** version #{grade}:small_blue_diamond: #{version_diff}"
|
|
50
|
+
elsif hotfix?
|
|
51
|
+
"**Hotfix** version #{grade}:small_red_triangle: #{version_diff}"
|
|
42
52
|
end
|
|
43
53
|
end
|
|
44
54
|
|
data/unwrappr.gemspec
CHANGED
|
@@ -12,6 +12,9 @@ AUTHORS = {
|
|
|
12
12
|
'vladimir.chervanev@envato.com' => 'Vladimir Chervanev'
|
|
13
13
|
}.freeze
|
|
14
14
|
|
|
15
|
+
GITHUB_URL = 'https://github.com/envato/unwrappr'
|
|
16
|
+
HOMEPAGE_URL = 'https://opensource.envato.com/projects/unwrappr.html'
|
|
17
|
+
|
|
15
18
|
Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength:
|
|
16
19
|
spec.name = 'unwrappr'
|
|
17
20
|
spec.version = Unwrappr::VERSION
|
|
@@ -20,10 +23,10 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength:
|
|
|
20
23
|
|
|
21
24
|
spec.summary = "A tool to unwrap your gems and see what's changed easily"
|
|
22
25
|
spec.description = 'bundle update PRs: Automated. Annotated.'
|
|
23
|
-
spec.homepage =
|
|
26
|
+
spec.homepage = HOMEPAGE_URL
|
|
24
27
|
spec.license = 'MIT'
|
|
25
|
-
spec.required_ruby_version = '
|
|
26
|
-
spec.required_rubygems_version = '
|
|
28
|
+
spec.required_ruby_version = '>= 2.5'
|
|
29
|
+
spec.required_rubygems_version = '>= 2.7'
|
|
27
30
|
|
|
28
31
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
29
32
|
f.match(%r{^(test|spec|features)/})
|
|
@@ -32,10 +35,10 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength:
|
|
|
32
35
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
33
36
|
spec.require_paths = ['lib']
|
|
34
37
|
|
|
35
|
-
spec.add_dependency 'bundler', '
|
|
36
|
-
spec.add_dependency 'bundler-audit', '
|
|
38
|
+
spec.add_dependency 'bundler', '< 3'
|
|
39
|
+
spec.add_dependency 'bundler-audit', '>= 0.6.0'
|
|
37
40
|
spec.add_dependency 'clamp', '~> 1'
|
|
38
|
-
spec.add_dependency 'faraday', '~>
|
|
41
|
+
spec.add_dependency 'faraday', '~> 1'
|
|
39
42
|
spec.add_dependency 'git', '~> 1'
|
|
40
43
|
spec.add_dependency 'octokit', '~> 4.0'
|
|
41
44
|
spec.add_dependency 'safe_shell', '~> 1'
|
|
@@ -43,16 +46,16 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength:
|
|
|
43
46
|
spec.add_development_dependency 'guard', '~> 2'
|
|
44
47
|
spec.add_development_dependency 'guard-rspec', '~> 4'
|
|
45
48
|
spec.add_development_dependency 'pry', '~> 0'
|
|
46
|
-
spec.add_development_dependency 'rake', '
|
|
49
|
+
spec.add_development_dependency 'rake', '>= 12.3.3'
|
|
47
50
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
|
48
51
|
spec.add_development_dependency 'rspec-its', '~> 1'
|
|
49
52
|
spec.add_development_dependency 'rubocop', '>= 0.49.0'
|
|
50
53
|
|
|
51
54
|
spec.metadata = {
|
|
52
|
-
'bug_tracker_uri' =>
|
|
53
|
-
'changelog_uri' =>
|
|
54
|
-
'documentation_uri' =>
|
|
55
|
-
'homepage_uri' =>
|
|
56
|
-
'source_code_uri' =>
|
|
55
|
+
'bug_tracker_uri' => "#{GITHUB_URL}/issues",
|
|
56
|
+
'changelog_uri' => "#{GITHUB_URL}/blob/HEAD/CHANGELOG.md",
|
|
57
|
+
'documentation_uri' => "#{GITHUB_URL}/blob/HEAD/README.md",
|
|
58
|
+
'homepage_uri' => HOMEPAGE_URL,
|
|
59
|
+
'source_code_uri' => GITHUB_URL
|
|
57
60
|
}
|
|
58
61
|
end
|
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.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Emilyn Escabarte
|
|
@@ -9,39 +9,39 @@ authors:
|
|
|
9
9
|
- Orien Madgwick
|
|
10
10
|
- Pete Johns
|
|
11
11
|
- Vladimir Chervanev
|
|
12
|
-
autorequire:
|
|
12
|
+
autorequire:
|
|
13
13
|
bindir: exe
|
|
14
14
|
cert_chain: []
|
|
15
|
-
date:
|
|
15
|
+
date: 2021-01-04 00:00:00.000000000 Z
|
|
16
16
|
dependencies:
|
|
17
17
|
- !ruby/object:Gem::Dependency
|
|
18
18
|
name: bundler
|
|
19
19
|
requirement: !ruby/object:Gem::Requirement
|
|
20
20
|
requirements:
|
|
21
|
-
- - "
|
|
21
|
+
- - "<"
|
|
22
22
|
- !ruby/object:Gem::Version
|
|
23
|
-
version: '
|
|
23
|
+
version: '3'
|
|
24
24
|
type: :runtime
|
|
25
25
|
prerelease: false
|
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
|
27
27
|
requirements:
|
|
28
|
-
- - "
|
|
28
|
+
- - "<"
|
|
29
29
|
- !ruby/object:Gem::Version
|
|
30
|
-
version: '
|
|
30
|
+
version: '3'
|
|
31
31
|
- !ruby/object:Gem::Dependency
|
|
32
32
|
name: bundler-audit
|
|
33
33
|
requirement: !ruby/object:Gem::Requirement
|
|
34
34
|
requirements:
|
|
35
|
-
- - "
|
|
35
|
+
- - ">="
|
|
36
36
|
- !ruby/object:Gem::Version
|
|
37
|
-
version:
|
|
37
|
+
version: 0.6.0
|
|
38
38
|
type: :runtime
|
|
39
39
|
prerelease: false
|
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
|
41
41
|
requirements:
|
|
42
|
-
- - "
|
|
42
|
+
- - ">="
|
|
43
43
|
- !ruby/object:Gem::Version
|
|
44
|
-
version:
|
|
44
|
+
version: 0.6.0
|
|
45
45
|
- !ruby/object:Gem::Dependency
|
|
46
46
|
name: clamp
|
|
47
47
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -62,14 +62,14 @@ dependencies:
|
|
|
62
62
|
requirements:
|
|
63
63
|
- - "~>"
|
|
64
64
|
- !ruby/object:Gem::Version
|
|
65
|
-
version: '
|
|
65
|
+
version: '1'
|
|
66
66
|
type: :runtime
|
|
67
67
|
prerelease: false
|
|
68
68
|
version_requirements: !ruby/object:Gem::Requirement
|
|
69
69
|
requirements:
|
|
70
70
|
- - "~>"
|
|
71
71
|
- !ruby/object:Gem::Version
|
|
72
|
-
version: '
|
|
72
|
+
version: '1'
|
|
73
73
|
- !ruby/object:Gem::Dependency
|
|
74
74
|
name: git
|
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -158,16 +158,16 @@ dependencies:
|
|
|
158
158
|
name: rake
|
|
159
159
|
requirement: !ruby/object:Gem::Requirement
|
|
160
160
|
requirements:
|
|
161
|
-
- - "
|
|
161
|
+
- - ">="
|
|
162
162
|
- !ruby/object:Gem::Version
|
|
163
|
-
version:
|
|
163
|
+
version: 12.3.3
|
|
164
164
|
type: :development
|
|
165
165
|
prerelease: false
|
|
166
166
|
version_requirements: !ruby/object:Gem::Requirement
|
|
167
167
|
requirements:
|
|
168
|
-
- - "
|
|
168
|
+
- - ">="
|
|
169
169
|
- !ruby/object:Gem::Version
|
|
170
|
-
version:
|
|
170
|
+
version: 12.3.3
|
|
171
171
|
- !ruby/object:Gem::Dependency
|
|
172
172
|
name: rspec
|
|
173
173
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -225,10 +225,11 @@ files:
|
|
|
225
225
|
- ".buildkite/pipeline.yml"
|
|
226
226
|
- ".buildkite/steps/rspec.sh"
|
|
227
227
|
- ".buildkite/steps/rubocop.sh"
|
|
228
|
+
- ".github/workflows/ci.yml"
|
|
228
229
|
- ".gitignore"
|
|
229
230
|
- ".rspec"
|
|
230
231
|
- ".rubocop.yml"
|
|
231
|
-
- ".
|
|
232
|
+
- ".tool-versions"
|
|
232
233
|
- CHANGELOG.md
|
|
233
234
|
- CODE_OF_CONDUCT.md
|
|
234
235
|
- Gemfile
|
|
@@ -267,33 +268,32 @@ files:
|
|
|
267
268
|
- lib/unwrappr/writers/title.rb
|
|
268
269
|
- lib/unwrappr/writers/version_change.rb
|
|
269
270
|
- unwrappr.gemspec
|
|
270
|
-
homepage:
|
|
271
|
+
homepage: https://opensource.envato.com/projects/unwrappr.html
|
|
271
272
|
licenses:
|
|
272
273
|
- MIT
|
|
273
274
|
metadata:
|
|
274
275
|
bug_tracker_uri: https://github.com/envato/unwrappr/issues
|
|
275
|
-
changelog_uri: https://github.com/envato/unwrappr/blob/
|
|
276
|
-
documentation_uri: https://github.com/envato/unwrappr/blob/
|
|
276
|
+
changelog_uri: https://github.com/envato/unwrappr/blob/HEAD/CHANGELOG.md
|
|
277
|
+
documentation_uri: https://github.com/envato/unwrappr/blob/HEAD/README.md
|
|
277
278
|
homepage_uri: https://opensource.envato.com/projects/unwrappr.html
|
|
278
279
|
source_code_uri: https://github.com/envato/unwrappr
|
|
279
|
-
post_install_message:
|
|
280
|
+
post_install_message:
|
|
280
281
|
rdoc_options: []
|
|
281
282
|
require_paths:
|
|
282
283
|
- lib
|
|
283
284
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
284
285
|
requirements:
|
|
285
|
-
- - "
|
|
286
|
+
- - ">="
|
|
286
287
|
- !ruby/object:Gem::Version
|
|
287
|
-
version: '2.
|
|
288
|
+
version: '2.5'
|
|
288
289
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
289
290
|
requirements:
|
|
290
|
-
- - "
|
|
291
|
+
- - ">="
|
|
291
292
|
- !ruby/object:Gem::Version
|
|
292
293
|
version: '2.7'
|
|
293
294
|
requirements: []
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
signing_key:
|
|
295
|
+
rubygems_version: 3.2.3
|
|
296
|
+
signing_key:
|
|
297
297
|
specification_version: 4
|
|
298
298
|
summary: A tool to unwrap your gems and see what's changed easily
|
|
299
299
|
test_files: []
|