unwrappr 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +23 -0
- data/.rubocop.yml +2 -1
- data/.tool-versions +1 -0
- data/CHANGELOG.md +26 -1
- data/README.md +4 -4
- data/lib/unwrappr/cli.rb +13 -4
- data/lib/unwrappr/gem_change.rb +1 -0
- data/lib/unwrappr/git_command_runner.rb +11 -11
- data/lib/unwrappr/github/client.rb +10 -5
- data/lib/unwrappr/lock_file_diff.rb +1 -1
- data/lib/unwrappr/version.rb +1 -1
- data/unwrappr.gemspec +11 -8
- metadata +14 -13
- data/.travis.yml +0 -8
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
|
@@ -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/.rubocop.yml
CHANGED
data/.tool-versions
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby 3.0.0
|
data/CHANGELOG.md
CHANGED
@@ -6,7 +6,32 @@ 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.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
|
10
35
|
|
11
36
|
## [0.4.0] 2020-04-14
|
12
37
|
### Changed
|
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 [![
|
19
|
+
## Development status [![CI Status](https://github.com/envato/unwrappr/workflows/CI/badge.svg)](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
|
@@ -85,16 +85,16 @@ See https://github.com/settings/tokens to set up personal access tokens.
|
|
85
85
|
- [Em Esc](https://github.com/emesc)
|
86
86
|
- [Chun-wei Kuo](https://github.com/Domon)
|
87
87
|
|
88
|
-
## License [![license](https://img.shields.io/github/license/mashape/apistatus.svg?style=flat-square)](https://github.com/envato/unwrappr/blob/
|
88
|
+
## License [![license](https://img.shields.io/github/license/mashape/apistatus.svg?style=flat-square)](https://github.com/envato/unwrappr/blob/HEAD/LICENSE.txt)
|
89
89
|
|
90
90
|
`unwrappr` uses MIT license. See
|
91
|
-
[`LICENSE.txt`](https://github.com/envato/unwrappr/blob/
|
91
|
+
[`LICENSE.txt`](https://github.com/envato/unwrappr/blob/HEAD/LICENSE.txt) for
|
92
92
|
details.
|
93
93
|
|
94
94
|
## Code of Conduct
|
95
95
|
|
96
96
|
We welcome contribution from everyone. Read more about it in
|
97
|
-
[`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)
|
98
98
|
|
99
99
|
## Contributing [![PRs welcome](https://img.shields.io/badge/PRs-welcome-orange.svg?style=flat-square)](https://github.com/envato/unwrappr/issues)
|
100
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,7 +25,7 @@ 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
|
|
@@ -59,18 +68,18 @@ module Unwrappr
|
|
59
68
|
)
|
60
69
|
end
|
61
70
|
|
62
|
-
Dir.chdir(repo) { Unwrappr.run_unwapper_in_pwd }
|
71
|
+
Dir.chdir(repo) { Unwrappr.run_unwapper_in_pwd(base_branch: base_branch) }
|
63
72
|
end
|
64
73
|
end
|
65
74
|
end
|
66
75
|
end
|
67
76
|
|
68
|
-
def self.run_unwapper_in_pwd
|
77
|
+
def self.run_unwapper_in_pwd(base_branch:)
|
69
78
|
return unless lockfile_present?
|
70
79
|
|
71
80
|
puts "Doing the unwrappr thing in #{Dir.pwd}"
|
72
81
|
|
73
|
-
GitCommandRunner.create_branch!
|
82
|
+
GitCommandRunner.create_branch!(base_branch: base_branch)
|
74
83
|
BundlerCommandRunner.bundle_update!
|
75
84
|
GitCommandRunner.commit_and_push_changes!
|
76
85
|
GitHub::Client.make_pull_request!
|
data/lib/unwrappr/gem_change.rb
CHANGED
@@ -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
|
53
|
+
def checkout_target_branch(base_branch:)
|
54
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
|
data/lib/unwrappr/version.rb
CHANGED
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,9 +23,9 @@ 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 = '
|
28
|
+
spec.required_ruby_version = '>= 2.5'
|
26
29
|
spec.required_rubygems_version = '>= 2.7'
|
27
30
|
|
28
31
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
@@ -35,7 +38,7 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength:
|
|
35
38
|
spec.add_dependency 'bundler', '< 3'
|
36
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'
|
@@ -49,10 +52,10 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength:
|
|
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,10 +9,10 @@ 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
|
@@ -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
|
@@ -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,22 +268,22 @@ 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
288
|
version: '2.5'
|
288
289
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
@@ -291,8 +292,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
291
292
|
- !ruby/object:Gem::Version
|
292
293
|
version: '2.7'
|
293
294
|
requirements: []
|
294
|
-
rubygems_version: 3.
|
295
|
-
signing_key:
|
295
|
+
rubygems_version: 3.2.3
|
296
|
+
signing_key:
|
296
297
|
specification_version: 4
|
297
298
|
summary: A tool to unwrap your gems and see what's changed easily
|
298
299
|
test_files: []
|