cocoapods-podfile_patch 0.1.0 → 0.1.1
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/README.md +48 -8
- data/lib/cocoapods-podfile_patch/gem_version.rb +1 -1
- data/lib/cocoapods-podfile_patch/main.rb +70 -0
- data/lib/cocoapods_plugin.rb +1 -70
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db532f51a36d8ed122fe39dff75ad95af60c9ed4
|
4
|
+
data.tar.gz: 8801633e0db80778e6c28348a0e235b96458dcbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d7bfa8726d98dfcb688ea598642082c60f85efc7e9e9f1c4cde0cc5aba2efe42283052f0965c868ff3dc85db8690f2d76d006ce9d3d6f0eb8a16de5562ef4c3
|
7
|
+
data.tar.gz: 303764e98bf05c41a6aea36a4b92e920b1119ca987e7e21902c9e92f0de991f0d542cbba2742354e089dfacf27e1eb8f282a5dfc9ed6a2e6a78a724a20a3fe65
|
data/README.md
CHANGED
@@ -1,35 +1,41 @@
|
|
1
1
|
# cocoapods-podfile_patch
|
2
2
|
|
3
|
-
This plugin
|
3
|
+
This plugin provides the ability to override podfile in another file.
|
4
4
|
|
5
|
-
Place a `Podfile.patch` at the same directory with Podfile.
|
6
|
-
|
7
|
-
the settings in podfile if duplicated.
|
5
|
+
Place a `Podfile.patch` at the same directory with Podfile. Configure the pods in patchfile just like in Podfile. It will be merged to the original podfile, and override
|
6
|
+
the pods settings in podfile if duplicated.
|
8
7
|
|
9
8
|
For example:
|
10
9
|
|
11
10
|
Podfile:
|
12
11
|
```
|
13
12
|
use_patch_file!
|
14
|
-
target EVA do
|
13
|
+
target EVA-0 do
|
15
14
|
pod "A", "1.5.3", :inhibit_warning => true
|
16
15
|
pod "B", :path => "some/path"
|
17
16
|
end
|
17
|
+
|
18
|
+
target EVA-1 do
|
19
|
+
pod "A", "1.5.3"
|
20
|
+
end
|
18
21
|
```
|
19
22
|
|
20
23
|
Podfile.patch
|
21
24
|
```
|
22
|
-
target EVA do
|
25
|
+
target EVA-0 do
|
23
26
|
pod "A", :path => "path/to/local/A"
|
24
27
|
end
|
25
28
|
```
|
26
29
|
|
27
30
|
The final result equal to
|
28
31
|
```
|
29
|
-
target EVA do
|
32
|
+
target EVA-0 do
|
30
33
|
pod "A", :path => "path/to/local/A"
|
31
34
|
pod "B", :path => "some/path"
|
32
35
|
end
|
36
|
+
target EVA-1 do
|
37
|
+
pod "A", :path => "path/to/local/A"
|
38
|
+
end
|
33
39
|
```
|
34
40
|
|
35
41
|
This function is base on the parsed result of podfile. It means you could do ANYTHING
|
@@ -41,4 +47,38 @@ you do in podfile, i.e. your custom pod function or other plugins.
|
|
41
47
|
|
42
48
|
## Usage
|
43
49
|
|
44
|
-
|
50
|
+
### Basic
|
51
|
+
|
52
|
+
- add `use_patch_file!` in podfile
|
53
|
+
- make your own `Podfile.patch` in the same directory with `Podfile`, and code just like in the podfile.
|
54
|
+
- pod install
|
55
|
+
|
56
|
+
The most common case is to override a pod in podfile with a local pod. You could do like the example above. If you don't want to add a target, you also could do this:
|
57
|
+
|
58
|
+
```
|
59
|
+
pod "A", :path => "path/to/local/A"
|
60
|
+
```
|
61
|
+
|
62
|
+
Adding a pod in the root level of podfile is actually supported by the original podfile. It means add the pod to all targets. If you add a root level pod `A` in the patchfile, it will add `A` to all targets in podfile.
|
63
|
+
|
64
|
+
|
65
|
+
### Advanced
|
66
|
+
|
67
|
+
*How it works?*
|
68
|
+
|
69
|
+
The patch file will be `eval` when `use_patch_file!` executed. That means you could do ANYTHING as in the podfile. The pod configuration in patchfile will be merged with podfile manually to resolve the conflicts.
|
70
|
+
|
71
|
+
*Custom patchfile name*
|
72
|
+
|
73
|
+
```
|
74
|
+
use_patch_file! "your_custom_patchfile_name_or_path"
|
75
|
+
```
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module Pod
|
2
|
+
class Podfile
|
3
|
+
module DSL
|
4
|
+
# Enable Podfile Patch feature.
|
5
|
+
#
|
6
|
+
# Thid feature provide the ability to override podfile in another file.
|
7
|
+
#
|
8
|
+
# Place a `Podfile.patch` at the same directory with Podfile. Configurate the pods
|
9
|
+
# in patchfile just like in Podfile. It will append to original podfile, and override
|
10
|
+
# the settings in podfile if duplicated.
|
11
|
+
#
|
12
|
+
# For example:
|
13
|
+
#
|
14
|
+
# Podfile:
|
15
|
+
# ```
|
16
|
+
# target EVA do
|
17
|
+
# pod "A", "1.5.3", :inhibit_warning => true
|
18
|
+
# pod "B", :path => "some/path"
|
19
|
+
# end
|
20
|
+
# ```
|
21
|
+
#
|
22
|
+
# Podfile.patch
|
23
|
+
# ```
|
24
|
+
# target EVA do
|
25
|
+
# pod "A", :path => "path/to/local/A"
|
26
|
+
# end
|
27
|
+
# ```
|
28
|
+
#
|
29
|
+
# The final result equal to
|
30
|
+
# ```
|
31
|
+
# target EVA do
|
32
|
+
# pod "A", :path => "path/to/local/A"
|
33
|
+
# pod "B", :path => "some/path"
|
34
|
+
# end
|
35
|
+
# ```
|
36
|
+
#
|
37
|
+
# This function is base on the parsed result of podfile. It means you could do ANYTHING
|
38
|
+
# you do in podfile, i.e. your custom pod function or other plugins.
|
39
|
+
#
|
40
|
+
def use_patch_file!(patchfile_path = 'Podfile.patch')
|
41
|
+
|
42
|
+
@current_patch_files ||= []
|
43
|
+
if @current_patch_files.include? patchfile_path
|
44
|
+
# Yes, you could even use it recureively, but don't use the same patch file.
|
45
|
+
raise "`use_patch_file!` called recursively. Most case is it's used in Patch file."
|
46
|
+
return
|
47
|
+
end
|
48
|
+
|
49
|
+
@current_patch_files << patchfile_path
|
50
|
+
require 'cocoapods-podfile_patch/podfile_patch'
|
51
|
+
@patch_target = PodfilePatch.new.load_patch_target self, patchfile_path
|
52
|
+
@current_patch_files.delete(patchfile_path)
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
module Pod
|
60
|
+
class Podfile
|
61
|
+
old_initialize_function = instance_method(:initialize)
|
62
|
+
define_method(:initialize) do |defined_in_file = nil, internal_hash = {}, &block|
|
63
|
+
old_initialize_function.bind(self).(defined_in_file, internal_hash, &block)
|
64
|
+
|
65
|
+
if not @patch_target.nil?
|
66
|
+
PodfilePatch.new.merge_patch_and_original_podfile(self, @patch_target)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
data/lib/cocoapods_plugin.rb
CHANGED
@@ -1,70 +1 @@
|
|
1
|
-
|
2
|
-
class Podfile
|
3
|
-
module DSL
|
4
|
-
# Enable Podfile Patch feature.
|
5
|
-
#
|
6
|
-
# Thid feature provide the ability to override podfile in another file.
|
7
|
-
#
|
8
|
-
# Place a `Podfile.patch` at the same directory with Podfile. Configurate the pods
|
9
|
-
# in patchfile just like in Podfile. It will append to original podfile, and override
|
10
|
-
# the settings in podfile if duplicated.
|
11
|
-
#
|
12
|
-
# For example:
|
13
|
-
#
|
14
|
-
# Podfile:
|
15
|
-
# ```
|
16
|
-
# target EVA do
|
17
|
-
# pod "A", "1.5.3", :inhibit_warning => true
|
18
|
-
# pod "B", :path => "some/path"
|
19
|
-
# end
|
20
|
-
# ```
|
21
|
-
#
|
22
|
-
# Podfile.patch
|
23
|
-
# ```
|
24
|
-
# target EVA do
|
25
|
-
# pod "A", :path => "path/to/local/A"
|
26
|
-
# end
|
27
|
-
# ```
|
28
|
-
#
|
29
|
-
# The final result equal to
|
30
|
-
# ```
|
31
|
-
# target EVA do
|
32
|
-
# pod "A", :path => "path/to/local/A"
|
33
|
-
# pod "B", :path => "some/path"
|
34
|
-
# end
|
35
|
-
# ```
|
36
|
-
#
|
37
|
-
# This function is base on the parsed result of podfile. It means you could do ANYTHING
|
38
|
-
# you do in podfile, i.e. your custom pod function or other plugins.
|
39
|
-
#
|
40
|
-
def use_patch_file!(patchfile_path = 'Podfile.patch')
|
41
|
-
|
42
|
-
@current_patch_files ||= []
|
43
|
-
if @current_patch_files.include? patchfile_path
|
44
|
-
# Yes, you could even use it recureively, but don't use the same patch file.
|
45
|
-
raise "`use_patch_file!` called recursively. Most case is it's used in Patch file."
|
46
|
-
return
|
47
|
-
end
|
48
|
-
|
49
|
-
@current_patch_files << patchfile_path
|
50
|
-
require 'cocoapods-podfile_patch/podfile_patch'
|
51
|
-
@patch_target = PodfilePatch.new.load_patch_target self, patchfile_path
|
52
|
-
@current_patch_files.delete(patchfile_path)
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
module Pod
|
60
|
-
class Podfile
|
61
|
-
old_initialize_function = instance_method(:initialize)
|
62
|
-
define_method(:initialize) do |defined_in_file = nil, internal_hash = {}, &block|
|
63
|
-
old_initialize_function.bind(self).(defined_in_file, internal_hash, &block)
|
64
|
-
|
65
|
-
if not @patch_target.nil?
|
66
|
-
PodfilePatch.new.merge_patch_and_original_podfile(self, @patch_target)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
1
|
+
require 'cocoapods-podfile_patch/main'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-podfile_patch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gao
|
@@ -53,6 +53,7 @@ files:
|
|
53
53
|
- cocoapods-podfile_patch.gemspec
|
54
54
|
- lib/cocoapods-podfile_patch.rb
|
55
55
|
- lib/cocoapods-podfile_patch/gem_version.rb
|
56
|
+
- lib/cocoapods-podfile_patch/main.rb
|
56
57
|
- lib/cocoapods-podfile_patch/podfile_patch.rb
|
57
58
|
- lib/cocoapods_plugin.rb
|
58
59
|
- spec/command/podfile_patch_spec.rb
|