unwrappr 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -1
- data/CHANGELOG.md +5 -0
- data/README.md +9 -0
- data/lib/unwrappr/cli.rb +46 -8
- data/lib/unwrappr/gem_version.rb +0 -7
- data/lib/unwrappr/git_command_runner.rb +17 -3
- data/lib/unwrappr/version.rb +1 -1
- data/unwrappr.gemspec +2 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57128e02d34b1fcc40925c9b351f33facf1151c2e1ebc6487cc287df16503f04
|
4
|
+
data.tar.gz: c1f7fac65bedbde6ddcf5229ff97b4337fbf488171dcdfa62acf38dc2e254d85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3e26ba787dc0b1bd65debc91dcb9ef9aa771bcee690a96acd7f28c4a62fcd3aca65aa62885129b400baf147338fd74cff627e1f94c1431f4ed08f5df2d0016b
|
7
|
+
data.tar.gz: 536437315c3e31dba35eec20a2d6d2cb6b0212cee750519afa6cde9cee75267ee4b814b43f3221daa534b6b353a36610a34a9eb639d578d32ed600cbf4ea4237
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [0.3.2] 2018-11-13
|
10
|
+
### 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.
|
13
|
+
|
9
14
|
## [0.3.1] 2018-11-12
|
10
15
|
### Changed
|
11
16
|
- Travis CI enabled
|
data/README.md
CHANGED
@@ -50,6 +50,15 @@ export GITHUB_TOKEN=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
|
50
50
|
unwrappr
|
51
51
|
```
|
52
52
|
|
53
|
+
To run `unwrappr` against repositories as a part of a time-based job
|
54
|
+
scheduler, use the `clone` subcommand and specify as many `--repo` options as
|
55
|
+
you need:
|
56
|
+
|
57
|
+
```bash
|
58
|
+
export GITHUB_TOKEN=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
59
|
+
unwrappr clone --repo envato/abc [[--repo envato/xyz] ...]
|
60
|
+
```
|
61
|
+
|
53
62
|
See https://github.com/settings/tokens to set up personal access tokens.
|
54
63
|
|
55
64
|
## Requirements
|
data/lib/unwrappr/cli.rb
CHANGED
@@ -2,12 +2,13 @@
|
|
2
2
|
|
3
3
|
require 'clamp'
|
4
4
|
|
5
|
+
# Welcome to unwrappr...
|
5
6
|
module Unwrappr
|
6
7
|
# Entry point for the app
|
7
8
|
class CLI < Clamp::Command
|
8
9
|
self.default_subcommand = 'all'
|
9
10
|
|
10
|
-
option ['
|
11
|
+
option ['-v', '--version'], :flag, 'Show version' do
|
11
12
|
puts "unwrappr v#{Unwrappr::VERSION}"
|
12
13
|
exit(0)
|
13
14
|
end
|
@@ -15,22 +16,18 @@ module Unwrappr
|
|
15
16
|
subcommand 'all', 'run bundle update, push to github, '\
|
16
17
|
'create a pr and annotate changes' do
|
17
18
|
def execute
|
18
|
-
|
19
|
-
GitCommandRunner.create_branch!
|
20
|
-
BundlerCommandRunner.bundle_update!
|
21
|
-
GitCommandRunner.commit_and_push_changes!
|
22
|
-
GitHub::Client.make_pull_request!
|
19
|
+
Unwrappr.run_unwapper_in_pwd
|
23
20
|
end
|
24
21
|
end
|
25
22
|
|
26
23
|
subcommand 'annotate-pull-request',
|
27
24
|
'Annotate Gemfile.lock changes in a Github pull request' do
|
28
25
|
|
29
|
-
option '--repo', 'REPO',
|
26
|
+
option ['-r', '--repo'], 'REPO',
|
30
27
|
'The repo in github <owner/project>',
|
31
28
|
required: true
|
32
29
|
|
33
|
-
option '--pr', 'PR',
|
30
|
+
option ['-p', '--pr'], 'PR',
|
34
31
|
'The github PR number',
|
35
32
|
required: true
|
36
33
|
|
@@ -41,5 +38,46 @@ module Unwrappr
|
|
41
38
|
)
|
42
39
|
end
|
43
40
|
end
|
41
|
+
|
42
|
+
subcommand('clone', <<~DESCRIPTION) do
|
43
|
+
Clone one git repository or more and create an annotated bundle update PR for each.
|
44
|
+
DESCRIPTION
|
45
|
+
|
46
|
+
option(['-r', '--repo'],
|
47
|
+
'REPO',
|
48
|
+
<<~DESCRIPTION,
|
49
|
+
a repo in github <owner/project>, may be specified multiple times
|
50
|
+
DESCRIPTION
|
51
|
+
required: true,
|
52
|
+
multivalued: true)
|
53
|
+
|
54
|
+
def execute
|
55
|
+
repo_list.each do |repo|
|
56
|
+
unless Dir.exist?(repo)
|
57
|
+
GitCommandRunner.clone_repository(
|
58
|
+
"https://github.com/#{repo}",
|
59
|
+
repo
|
60
|
+
)
|
61
|
+
end
|
62
|
+
|
63
|
+
Dir.chdir(repo) { Unwrappr.run_unwapper_in_pwd }
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.run_unwapper_in_pwd
|
70
|
+
return unless lockfile_present?
|
71
|
+
|
72
|
+
puts "Doing the unwrappr thing in #{Dir.pwd}"
|
73
|
+
|
74
|
+
GitCommandRunner.create_branch!
|
75
|
+
BundlerCommandRunner.bundle_update!
|
76
|
+
GitCommandRunner.commit_and_push_changes!
|
77
|
+
GitHub::Client.make_pull_request!
|
78
|
+
end
|
79
|
+
|
80
|
+
def self.lockfile_present?
|
81
|
+
GitCommandRunner.file_exist?('Gemfile.lock')
|
44
82
|
end
|
45
83
|
end
|
data/lib/unwrappr/gem_version.rb
CHANGED
@@ -45,13 +45,6 @@ module Unwrappr
|
|
45
45
|
def segment(index)
|
46
46
|
segment = @version.canonical_segments[index] || 0
|
47
47
|
(segment.is_a?(Numeric) ? segment : nil)
|
48
|
-
rescue NoMethodError
|
49
|
-
abort(<<~MESSAGE)
|
50
|
-
Unwrappr requires RubyGems v2.7.0 or newer.
|
51
|
-
|
52
|
-
To upgrade to the latest RubyGems visit https://rubygems.org/pages/download
|
53
|
-
|
54
|
-
MESSAGE
|
55
48
|
end
|
56
49
|
end
|
57
50
|
end
|
@@ -36,6 +36,14 @@ module Unwrappr
|
|
36
36
|
git.current_branch
|
37
37
|
end
|
38
38
|
|
39
|
+
def clone_repository(repo, directory)
|
40
|
+
git_wrap { Git.clone(repo, directory) }
|
41
|
+
end
|
42
|
+
|
43
|
+
def file_exist?(filename)
|
44
|
+
!git.ls_files(filename).empty?
|
45
|
+
end
|
46
|
+
|
39
47
|
private
|
40
48
|
|
41
49
|
def git_dir?
|
@@ -63,11 +71,17 @@ module Unwrappr
|
|
63
71
|
end
|
64
72
|
|
65
73
|
def git
|
66
|
-
|
67
|
-
|
74
|
+
if Dir.pwd == @git&.dir&.path
|
75
|
+
@git
|
76
|
+
else
|
77
|
+
Git.open(Dir.pwd, log_options)
|
68
78
|
end
|
79
|
+
end
|
69
80
|
|
70
|
-
|
81
|
+
def log_options
|
82
|
+
{}.tap do |opt|
|
83
|
+
opt[:log] = Logger.new(STDOUT) if ENV['DEBUG']
|
84
|
+
end
|
71
85
|
end
|
72
86
|
|
73
87
|
def git_wrap
|
data/lib/unwrappr/version.rb
CHANGED
data/unwrappr.gemspec
CHANGED
@@ -22,6 +22,8 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength:
|
|
22
22
|
spec.description = 'bundle update PRs: Automated. Annotated.'
|
23
23
|
spec.homepage = 'http://www.unwrappr.com.org'
|
24
24
|
spec.license = 'MIT'
|
25
|
+
spec.required_ruby_version = '~> 2.3'
|
26
|
+
spec.required_rubygems_version = '~> 2.7'
|
25
27
|
|
26
28
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
29
|
f.match(%r{^(test|spec|features)/})
|
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.3.
|
4
|
+
version: 0.3.2
|
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: 2018-11-
|
15
|
+
date: 2018-11-13 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: bundler
|
@@ -282,14 +282,14 @@ require_paths:
|
|
282
282
|
- lib
|
283
283
|
required_ruby_version: !ruby/object:Gem::Requirement
|
284
284
|
requirements:
|
285
|
-
- - "
|
285
|
+
- - "~>"
|
286
286
|
- !ruby/object:Gem::Version
|
287
|
-
version: '
|
287
|
+
version: '2.3'
|
288
288
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
289
289
|
requirements:
|
290
|
-
- - "
|
290
|
+
- - "~>"
|
291
291
|
- !ruby/object:Gem::Version
|
292
|
-
version: '
|
292
|
+
version: '2.7'
|
293
293
|
requirements: []
|
294
294
|
rubyforge_project:
|
295
295
|
rubygems_version: 2.7.6
|