unwrappr 0.7.0 → 0.8.0

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
  SHA256:
3
- metadata.gz: 716600410b7247858c17de5f15be9934b38014a8d4726e362381db3cc97e1bc5
4
- data.tar.gz: a7856db5a3f7c3b968f5ed9999c569aab80b3498e429950a1543f745d5febd98
3
+ metadata.gz: 1e53f322cf4057535b08607023edcf655e1f6aed5dda15538615f0fd5b06fc2f
4
+ data.tar.gz: 348ae550a3a6c1692502d9138639a9fa3a111a6a61f13b54dbd3f6c391637463
5
5
  SHA512:
6
- metadata.gz: 29c64e12848728098873c2267c75a8ec6c5d2b04b0efa82305a1774f3c2a0aac14c3aa8089ae5c61e6e8cf4ee8302a86d6fd4d2710d38508ce864f4bdb6a7b43
7
- data.tar.gz: 8bfaf10e97b15b062208187e91f4b9647bd9a0836245b20e7aa20c7d91c045bd0ba04ee2ab8fb15a9ebe50646333c880e07151e82ef037e4fdc9c0815d541590
6
+ metadata.gz: 52b132cf79ce405129eacc7423c9769a7e90962e1c35869ea6af4491320815f47467b2755a756cdff75c8bb6efedf40e2a1d5c416ecbad438cc3e3d28120688f
7
+ data.tar.gz: 168c20cc164596e3abe39ebc00a7c605022295fce8364973a4901381cd59405df68ea85cdbabc76fbb10d859b5505b74c5b2f97f9051039644685fdef388804f
data/CHANGELOG.md CHANGED
@@ -6,7 +6,17 @@ 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.7.0...HEAD
9
+ [Unreleased]: https://github.com/envato/unwrappr/compare/v0.8.0...HEAD
10
+
11
+ ## [0.8.0] 2021-07-22
12
+
13
+ ### Add
14
+
15
+ - Ability to perform a `bundle update` in subdirectories with the `-R` /
16
+ `--recursive` flag. ([#90])
17
+
18
+ [0.8.0]: https://github.com/envato/unwrappr/compare/v0.7.0...v0.8.0
19
+ [#90]: https://github.com/envato/unwrappr/pull/90
10
20
 
11
21
  ## [0.7.0] 2021-07-15
12
22
 
data/lib/unwrappr/cli.rb CHANGED
@@ -29,10 +29,15 @@ module Unwrappr
29
29
  exit(0)
30
30
  end
31
31
 
32
- subcommand 'all', 'run bundle update, push to github, '\
32
+ subcommand 'all', 'run bundle update, push to GitHub, '\
33
33
  'create a pr and annotate changes' do
34
+ option ['-R', '--recursive'],
35
+ :flag,
36
+ 'Recurse into subdirectories',
37
+ attribute_name: :recursive
38
+
34
39
  def execute
35
- Unwrappr.run_unwapper_in_pwd(base_branch: base_branch, lock_files: lock_files)
40
+ Unwrappr.run_unwrappr_in_pwd(base_branch: base_branch, lock_files: lock_files, recursive: recursive?)
36
41
  end
37
42
  end
38
43
 
@@ -43,7 +48,7 @@ module Unwrappr
43
48
  required: true
44
49
 
45
50
  option ['-p', '--pr'], 'PR',
46
- 'The github PR number',
51
+ 'The GitHub PR number',
47
52
  required: true
48
53
 
49
54
  def execute
@@ -62,33 +67,33 @@ module Unwrappr
62
67
  option(['-r', '--repo'],
63
68
  'REPO',
64
69
  <<~DESCRIPTION,
65
- a repo in github <owner/project>, may be specified multiple times
70
+ a repo in GitHub <owner/project>, may be specified multiple times
66
71
  DESCRIPTION
67
72
  required: true,
68
73
  multivalued: true)
69
74
 
75
+ option ['-R', '--recursive'],
76
+ :flag,
77
+ 'Recurse into subdirectories',
78
+ attribute_name: :recursive
79
+
70
80
  def execute
71
81
  repo_list.each do |repo|
72
- unless Dir.exist?(repo)
73
- GitCommandRunner.clone_repository(
74
- "https://github.com/#{repo}",
75
- repo
76
- )
77
- end
82
+ GitCommandRunner.clone_repository("https://github.com/#{repo}", repo) unless Dir.exist?(repo)
78
83
 
79
- Dir.chdir(repo) { Unwrappr.run_unwapper_in_pwd(base_branch: base_branch, lock_files: lock_files) }
84
+ Dir.chdir(repo) do
85
+ Unwrappr.run_unwrappr_in_pwd(base_branch: base_branch, lock_files: lock_files, recursive: recursive?)
86
+ end
80
87
  end
81
88
  end
82
89
  end
83
90
  end
84
91
 
85
- def self.run_unwapper_in_pwd(base_branch:, lock_files:)
92
+ def self.run_unwrappr_in_pwd(base_branch:, lock_files:, recursive:)
86
93
  return unless any_lockfile_present?(lock_files)
87
94
 
88
- puts "Doing the unwrappr thing in #{Dir.pwd}"
89
-
90
95
  GitCommandRunner.create_branch!(base_branch: base_branch)
91
- BundlerCommandRunner.bundle_update!
96
+ bundle_update!(lock_files: lock_files, recursive: recursive)
92
97
  GitCommandRunner.commit_and_push_changes!
93
98
  GitHub::Client.make_pull_request!(lock_files)
94
99
  end
@@ -96,4 +101,24 @@ module Unwrappr
96
101
  def self.any_lockfile_present?(lock_files)
97
102
  lock_files.any? { |lock_file| GitCommandRunner.file_exist?(lock_file) }
98
103
  end
104
+
105
+ def self.bundle_update!(lock_files:, recursive:)
106
+ directories(lock_files: lock_files, recursive: recursive).each do |dir|
107
+ Dir.chdir(dir) do
108
+ puts "Doing the unwrappr thing in #{Dir.pwd}"
109
+ BundlerCommandRunner.bundle_update!
110
+ end
111
+ end
112
+ end
113
+
114
+ def self.directories(lock_files:, recursive:)
115
+ if recursive
116
+ lock_files
117
+ .flat_map { |f| Dir.glob("**/#{f}") }
118
+ .map { |f| File.dirname(f) }
119
+ .uniq
120
+ else
121
+ %w[.]
122
+ end
123
+ end
99
124
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Unwrappr
4
- VERSION = '0.7.0'
4
+ VERSION = '0.8.0'
5
5
  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.7.0
4
+ version: 0.8.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-07-15 00:00:00.000000000 Z
15
+ date: 2021-07-21 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.23
295
+ rubygems_version: 3.2.22
296
296
  signing_key:
297
297
  specification_version: 4
298
298
  summary: A tool to unwrap your gems and see what's changed easily