cocoapods-source-fix 0.1.1 → 0.1.3
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/LICENSE +21 -0
- data/README.md +27 -25
- data/config.example.yml +20 -20
- data/lib/cocoapods-source-fix/rule.rb +1 -1
- data/lib/cocoapods-source-fix/version.rb +1 -1
- metadata +12 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 07b6ef7555041966e1483d88e3801340fba6172241ed2971680ed953c6f58667
|
|
4
|
+
data.tar.gz: b7101d1bb0dfc74d85c92a5b3912910f489768c97e8e17d10cdbdfa5d02dc6f8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6388b4bb83f7c01534828d7e5d845739e25897681e373dfa168725dbdb6dada00fd240185378e096c75c9992ecd7a674c7a2b0a05d394f7633d8626310f95eec
|
|
7
|
+
data.tar.gz: '018b2d03c8b57def04deb5cd16a13be80da3bb35bd9c89ef34366774a817629834d0933f99d97888ed1edabf2a51611f1439b8bd433f11f3149178bad1a9eea4'
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ZCW
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
CocoaPods 插件:在 `pod install` 后自动对指定 Pod 的源码/头文件做**文本替换**,用于修复第三方库的编译问题(表达式修复、私有头引入修复、任意文本替换等)。
|
|
4
4
|
|
|
5
|
-
> 原名 `cocoapods-header-fix` 已废弃——插件能力不止「头文件修复」(如 YYText 是表达式修复),故更名为 `cocoapods-source-fix`(源码文本替换修复)。
|
|
6
|
-
|
|
7
5
|
## 特点
|
|
8
6
|
|
|
9
7
|
- **Podfile 零改动**:通过 monkey-patch `Pod::Installer#install!`(与 `cocoapods-local-override` 相同机制,绕过 HooksManager 白名单),gem 以 `cocoapods-*` 前缀安装后由 CocoaPods 自动加载即生效,**无需在 Podfile 写 `plugin` 指令**
|
|
@@ -16,20 +14,24 @@ CocoaPods 插件:在 `pod install` 后自动对指定 Pod 的源码/头文件
|
|
|
16
14
|
|
|
17
15
|
### 方式一:Gemfile(推荐,项目用 `bundle exec pod install` 时)
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
gem 已发布到 rubygems.org,在项目的 Gemfile 中加:
|
|
20
18
|
|
|
21
19
|
```ruby
|
|
22
|
-
gem 'cocoapods-source-fix',
|
|
20
|
+
gem 'cocoapods-source-fix', '~> 0.1'
|
|
23
21
|
```
|
|
24
22
|
|
|
25
23
|
然后 `bundle install && bundle exec pod install`。
|
|
26
24
|
|
|
25
|
+
本地开发调试时可改用本地路径:
|
|
26
|
+
|
|
27
|
+
```ruby
|
|
28
|
+
gem 'cocoapods-source-fix', :path => '/path/to/cocoapods-source-fix'
|
|
29
|
+
```
|
|
30
|
+
|
|
27
31
|
### 方式二:gem 全局安装(项目直接用 `pod install` 时)
|
|
28
32
|
|
|
29
33
|
```bash
|
|
30
|
-
|
|
31
|
-
gem build cocoapods-source-fix.gemspec
|
|
32
|
-
gem install cocoapods-source-fix-0.1.0.gem
|
|
34
|
+
gem install cocoapods-source-fix
|
|
33
35
|
```
|
|
34
36
|
|
|
35
37
|
之后 `pod install` 自动生效。
|
|
@@ -41,14 +43,14 @@ gem install cocoapods-source-fix-0.1.0.gem
|
|
|
41
43
|
```yaml
|
|
42
44
|
rules:
|
|
43
45
|
# Pod 模块:glob 相对该 Pod 目录
|
|
44
|
-
- name:
|
|
45
|
-
pod:
|
|
46
|
-
glob: '
|
|
46
|
+
- name: 表达式优先级修复
|
|
47
|
+
pod: SomePod
|
|
48
|
+
glob: 'SomePod/Component/SomeView.m'
|
|
47
49
|
pairs:
|
|
48
|
-
- from: '
|
|
49
|
-
to: '(
|
|
50
|
-
- from: '
|
|
51
|
-
to: '(
|
|
50
|
+
- from: 'a < b < c'
|
|
51
|
+
to: '(a < b) < c'
|
|
52
|
+
- from: 'x < y < z'
|
|
53
|
+
to: '(x < y) < z'
|
|
52
54
|
|
|
53
55
|
# 相对 Podfile 的目录
|
|
54
56
|
- dir: 'Pods/SomePod'
|
|
@@ -96,14 +98,14 @@ rules:
|
|
|
96
98
|
`exclude` 使用示例:
|
|
97
99
|
|
|
98
100
|
```yaml
|
|
99
|
-
- name:
|
|
100
|
-
pod:
|
|
101
|
+
- name: 头文件引入方式修复
|
|
102
|
+
pod: SomePod
|
|
101
103
|
glob: '**/*.{h,m,mm,swift}'
|
|
102
|
-
from: '#import <
|
|
103
|
-
to: '#import "
|
|
104
|
+
from: '#import <SomeDefine.h>'
|
|
105
|
+
to: '#import "SomeDefine.h"'
|
|
104
106
|
exclude:
|
|
105
|
-
- '
|
|
106
|
-
- '
|
|
107
|
+
- 'SomePod/SomePod.h' # 排除单个文件
|
|
108
|
+
- 'SomePod/Private/**' # 排除整棵目录树
|
|
107
109
|
```
|
|
108
110
|
|
|
109
111
|
## 日志输出
|
|
@@ -113,9 +115,9 @@ rules:
|
|
|
113
115
|
```
|
|
114
116
|
🛠️ [cocoapods-source-fix] 使用配置文件:/path/to/cocoapods-source-fix.yml(3 条规则)
|
|
115
117
|
🛠️ [cocoapods-source-fix] patching source files...
|
|
116
|
-
🛠️ [cocoapods-source-fix] processing rule:
|
|
117
|
-
🛠️ [cocoapods-source-fix] ✅ 已修复文件:/path/to/Pods/
|
|
118
|
-
🛠️ [cocoapods-source-fix] processing rule:
|
|
118
|
+
🛠️ [cocoapods-source-fix] processing rule: 表达式优先级修复
|
|
119
|
+
🛠️ [cocoapods-source-fix] ✅ 已修复文件:/path/to/Pods/SomePod/SomePod/Component/SomeView.m
|
|
120
|
+
🛠️ [cocoapods-source-fix] processing rule: 私有头引入修复
|
|
119
121
|
🛠️ [cocoapods-source-fix] ⏭️ 跳过(2 个文件内容已是最新,无需修复)
|
|
120
122
|
🛠️ [cocoapods-source-fix] processing rule: 某条无匹配的规则
|
|
121
123
|
🛠️ [cocoapods-source-fix] ⏭️ 跳过(无匹配文件)
|
|
@@ -137,8 +139,8 @@ rules:
|
|
|
137
139
|
默认只输出规则级汇总;配置 `verbose: true`(或环境变量 `COCOAPODS_SOURCE_FIX_VERBOSE=1`)后逐文件输出:
|
|
138
140
|
|
|
139
141
|
```
|
|
140
|
-
🛠️ [cocoapods-source-fix] ⏭️ 已是最新:/path/to/Pods/
|
|
141
|
-
🛠️ [cocoapods-source-fix] 🚫 已排除:/path/to/Pods/
|
|
142
|
+
🛠️ [cocoapods-source-fix] ⏭️ 已是最新:/path/to/Pods/SomePod/SomePod/Component/SomeView.m
|
|
143
|
+
🛠️ [cocoapods-source-fix] 🚫 已排除:/path/to/Pods/SomePod/SomePod/Private/Secret.h
|
|
142
144
|
```
|
|
143
145
|
|
|
144
146
|
- 每个实际发生替换的文件:`✅ 已修复文件:<path>`
|
data/config.example.yml
CHANGED
|
@@ -25,33 +25,33 @@
|
|
|
25
25
|
# ============================================================
|
|
26
26
|
|
|
27
27
|
rules:
|
|
28
|
-
# ---------- 示例 1:指定 Pod 模块 +
|
|
29
|
-
- name:
|
|
30
|
-
pod:
|
|
31
|
-
glob: '
|
|
28
|
+
# ---------- 示例 1:指定 Pod 模块 + 单文件多组替换(表达式优先级修复) ----------
|
|
29
|
+
- name: 表达式优先级修复
|
|
30
|
+
pod: SomePod
|
|
31
|
+
glob: 'SomePod/Component/SomeView.m'
|
|
32
32
|
pairs:
|
|
33
|
-
- from: '
|
|
34
|
-
to: '(
|
|
35
|
-
- from: '
|
|
36
|
-
to: '(
|
|
33
|
+
- from: 'a < b < c'
|
|
34
|
+
to: '(a < b) < c'
|
|
35
|
+
- from: 'x < y < z'
|
|
36
|
+
to: '(x < y) < z'
|
|
37
37
|
|
|
38
|
-
# ---------- 示例 2:指定 Pod 模块 + 多文件 glob
|
|
39
|
-
- name:
|
|
40
|
-
pod:
|
|
41
|
-
glob: '
|
|
38
|
+
# ---------- 示例 2:指定 Pod 模块 + 多文件 glob(私有头引入修复) ----------
|
|
39
|
+
- name: 私有头引入修复
|
|
40
|
+
pod: SomePod
|
|
41
|
+
glob: 'SomePod/Some{Manager,Session}.m'
|
|
42
42
|
from: '#import <netinet6/in6.h>'
|
|
43
43
|
to: '#include <sys/socket.h>'
|
|
44
44
|
|
|
45
|
-
# ---------- 示例 3:指定 Pod 模块 +
|
|
46
|
-
- name:
|
|
47
|
-
pod:
|
|
45
|
+
# ---------- 示例 3:指定 Pod 模块 + 目录遍历(头文件引入方式修复) ----------
|
|
46
|
+
- name: 头文件引入方式修复
|
|
47
|
+
pod: SomePod
|
|
48
48
|
glob: '**/*.{h,m,mm,swift}'
|
|
49
|
-
from: '#import <
|
|
50
|
-
to: '#import "
|
|
51
|
-
# 排除示例:不修复
|
|
52
|
-
# exclude: '
|
|
49
|
+
from: '#import <SomeDefine.h>'
|
|
50
|
+
to: '#import "SomeDefine.h"'
|
|
51
|
+
# 排除示例:不修复 SomePod.h 自身(exclude 也可传数组)
|
|
52
|
+
# exclude: 'SomePod/SomePod.h'
|
|
53
53
|
# 排除整棵目录树:
|
|
54
|
-
# exclude: '
|
|
54
|
+
# exclude: 'SomePod/Private/**'
|
|
55
55
|
|
|
56
56
|
# ---------- 示例 4:相对 Podfile 文件的目录 ----------
|
|
57
57
|
# - name: 相对目录示例
|
|
@@ -4,7 +4,7 @@ module CocoapodsSourceFix
|
|
|
4
4
|
# 单条替换规则
|
|
5
5
|
#
|
|
6
6
|
# 目标定位(互斥,均不指定则为全局):
|
|
7
|
-
# pod: '
|
|
7
|
+
# pod: 'SomePod' → 定位到 installer.sandbox.pod_dir('SomePod'),glob 相对该 Pod 目录
|
|
8
8
|
# dir: 'path' → 目录,路径绝对则直接使用,相对则相对 Podfile 目录
|
|
9
9
|
# file: 'path' → 文件,路径绝对则直接使用,相对则相对 Podfile 目录
|
|
10
10
|
# (无以上字段) → 全局,glob 相对 Podfile 目录(如 'Pods/**/*.{h,m}')
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cocoapods-source-fix
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ZCW
|
|
@@ -14,6 +14,9 @@ dependencies:
|
|
|
14
14
|
name: cocoapods
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.0'
|
|
17
20
|
- - ">="
|
|
18
21
|
- !ruby/object:Gem::Version
|
|
19
22
|
version: 1.0.0
|
|
@@ -21,6 +24,9 @@ dependencies:
|
|
|
21
24
|
prerelease: false
|
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
26
|
requirements:
|
|
27
|
+
- - "~>"
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: '1.0'
|
|
24
30
|
- - ">="
|
|
25
31
|
- !ruby/object:Gem::Version
|
|
26
32
|
version: 1.0.0
|
|
@@ -32,6 +38,7 @@ executables: []
|
|
|
32
38
|
extensions: []
|
|
33
39
|
extra_rdoc_files: []
|
|
34
40
|
files:
|
|
41
|
+
- LICENSE
|
|
35
42
|
- README.md
|
|
36
43
|
- config.example.yml
|
|
37
44
|
- lib/cocoapods-source-fix.rb
|
|
@@ -44,7 +51,9 @@ files:
|
|
|
44
51
|
homepage: https://github.com/charleszhao888888/cocoapods-source-fix
|
|
45
52
|
licenses:
|
|
46
53
|
- MIT
|
|
47
|
-
metadata:
|
|
54
|
+
metadata:
|
|
55
|
+
source_code_uri: https://github.com/charleszhao888888/cocoapods-source-fix
|
|
56
|
+
homepage_uri: https://rubygems.org/gems/cocoapods-source-fix
|
|
48
57
|
post_install_message:
|
|
49
58
|
rdoc_options: []
|
|
50
59
|
require_paths:
|
|
@@ -60,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
60
69
|
- !ruby/object:Gem::Version
|
|
61
70
|
version: '0'
|
|
62
71
|
requirements: []
|
|
63
|
-
rubygems_version: 3.
|
|
72
|
+
rubygems_version: 3.4.10
|
|
64
73
|
signing_key:
|
|
65
74
|
specification_version: 4
|
|
66
75
|
summary: CocoaPods plugin to apply text replacements to pod sources after pod install
|