cocoapods-patch 0.0.1 → 0.0.6
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/lib/cocoapods-patch/command/patch/apply.rb +22 -10
- data/lib/cocoapods-patch/gem_version.rb +1 -2
- data/lib/cocoapods-patch/hook.rb +18 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f1fc48aa0350d562d1ad476ab439624105cee81c22bab3b604a73131e1dd6eb
|
4
|
+
data.tar.gz: b03c8bf4611c20f40536936fa02c2b43f833588b63038d083fe834be9a368a0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c96592ef2a7c17cbc4916afc582a0af9219bf2ecf351dbc6f21ab10a6660cb4de8e5a8fcd69c3cada1d5d69c6c29c53e654143f426193e23a0e4bf757acb4d78
|
7
|
+
data.tar.gz: c7c7d93705236d902f9ddd02d4102ae800c9280bc1f8549d31b600a7fc4a1c5b6616b2029a0e2468fa58678fabc3dc5d5a9d09ddcba34f83ad414251a7added1
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'cocoapods'
|
2
|
+
|
1
3
|
module Pod
|
2
4
|
class Command
|
3
5
|
class Patch < Command
|
@@ -28,15 +30,25 @@ end
|
|
28
30
|
|
29
31
|
# also used from the post-install hook
|
30
32
|
def apply_patch(patch_file)
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
33
|
+
working_dir = Dir.pwd
|
34
|
+
repo_root = `git rev-parse --show-toplevel`.strip
|
35
|
+
ios_project_path = Pathname.new(working_dir).relative_path_from(Pathname.new(repo_root))
|
36
|
+
|
37
|
+
directory_arg = (ios_project_path.to_s.eql? ".") ? "Pods" : File.join(ios_project_path, 'Pods')
|
38
|
+
|
39
|
+
Dir.chdir(repo_root) {
|
40
|
+
Pod::UI.puts "YOOOOO #{patch_file} - #{directory_arg}"
|
41
|
+
check_cmd = "git apply --check #{patch_file} --directory=#{directory_arg} -p2 2> /dev/null"
|
42
|
+
|
43
|
+
can_apply = system(check_cmd)
|
44
|
+
if can_apply
|
45
|
+
apply_cmd = check_cmd.gsub('--check ', '')
|
46
|
+
did_apply = system(apply_cmd)
|
47
|
+
if did_apply
|
48
|
+
Pod::UI.puts "Successfully applied #{patch_file}"
|
49
|
+
else
|
50
|
+
Pod::UI.warn "Failed to apply #{patch_file}"
|
51
|
+
end
|
40
52
|
end
|
41
|
-
|
53
|
+
}
|
42
54
|
end
|
data/lib/cocoapods-patch/hook.rb
CHANGED
@@ -2,11 +2,24 @@ require 'cocoapods'
|
|
2
2
|
require 'pathname'
|
3
3
|
require_relative 'command/patch/apply'
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
class Pod::Installer
|
6
|
+
# Because our patches may also delete files, we need to apply them before the pod project is generated
|
7
|
+
# The project is generated in the `integrate` method, so we override it
|
8
|
+
# We first run our patch action and then the original implementation of the method
|
9
|
+
# Reference: https://github.com/CocoaPods/CocoaPods/blob/760828a07f8fcfbff03bce13f56a1789b6f5a95d/lib/cocoapods/installer.rb#L178
|
10
|
+
alias_method :integrate_old, :integrate
|
11
|
+
|
12
|
+
def integrate
|
13
|
+
# apply our patches
|
14
|
+
apply_patches
|
15
|
+
# run the original implementation
|
16
|
+
integrate_old
|
17
|
+
end
|
18
|
+
|
19
|
+
def apply_patches
|
20
|
+
Pod::UI.puts 'Applying patches if necessary'
|
21
|
+
patches_dir = Pathname.new(Dir.pwd) + 'patches'
|
22
|
+
if patches_dir.directory?
|
10
23
|
patches = patches_dir.each_child.select { |c| c.to_s.end_with?('.diff') }
|
11
24
|
patches.each { |p| apply_patch(p) }
|
12
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-patch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Double Symmetry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|