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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ed1544d47bbf2db75fc8f7bb403b42ea516880d657037ba05e447f29f396a5c4
4
- data.tar.gz: a4ef6a8305efa53dde82ffb2c95c9708d8fcafe044e5b58c8f98af54a1e49560
3
+ metadata.gz: 07b6ef7555041966e1483d88e3801340fba6172241ed2971680ed953c6f58667
4
+ data.tar.gz: b7101d1bb0dfc74d85c92a5b3912910f489768c97e8e17d10cdbdfa5d02dc6f8
5
5
  SHA512:
6
- metadata.gz: 85385cef57604d801add2034f444e312f61f211b554c63a07eb8d0798f83ed1e41c9140a0bcdf619be95c08973938468d9e231aec4b7cbd160d8e0287bfe97f1
7
- data.tar.gz: 96d7f6ade273b4d66b054456848a49a38a68264c6b11a91694bcef55c3abb4c37216b9be9732becc2cf7733b5cb9bd9035f8b179504256b83a4035dda19c13c0
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
- 在项目的 Gemfile 中加:
17
+ gem 已发布到 rubygems.org,在项目的 Gemfile 中加:
20
18
 
21
19
  ```ruby
22
- gem 'cocoapods-source-fix', :path => '/path/to/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
- cd '/path/to/cocoapods-source-fix'
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: YYText 表达式修复
45
- pod: YYText
46
- glob: 'YYText/Component/YYTextLayout.m'
46
+ - name: 表达式优先级修复
47
+ pod: SomePod
48
+ glob: 'SomePod/Component/SomeView.m'
47
49
  pairs:
48
- - from: 'fabs(left - point.y) < fabs(right - point.y) < (right ? prev : next)'
49
- to: '(fabs(left - point.y) < fabs(right - point.y)) == (right ? prev : next)'
50
- - from: 'fabs(left - point.x) < fabs(right - point.x) < (right ? prev : next)'
51
- to: '(fabs(left - point.x) < fabs(right - point.x)) == (right ? prev : next)'
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: LFPhoneInfo 头引入方式修复
100
- pod: LFPhoneInfo
101
+ - name: 头文件引入方式修复
102
+ pod: SomePod
101
103
  glob: '**/*.{h,m,mm,swift}'
102
- from: '#import <LFPhoneDefine.h>'
103
- to: '#import "LFPhoneDefine.h"'
104
+ from: '#import <SomeDefine.h>'
105
+ to: '#import "SomeDefine.h"'
104
106
  exclude:
105
- - 'LFPhoneInfo/LFPhoneInfo.h' # 排除单个文件
106
- - 'LFPhoneInfo/Private/**' # 排除整棵目录树
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: YYText 表达式修复
117
- 🛠️ [cocoapods-source-fix] ✅ 已修复文件:/path/to/Pods/YYText/YYText/Component/YYTextLayout.m
118
- 🛠️ [cocoapods-source-fix] processing rule: AFNetworking 私有头修复
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/YYText/YYText/Component/YYTextLayout.m
141
- 🛠️ [cocoapods-source-fix] 🚫 已排除:/path/to/Pods/LFPhoneInfo/LFPhoneInfo/Private/Secret.h
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 模块 + 单文件多组替换(迁移自 YYText 表达式修复) ----------
29
- - name: YYText 表达式修复
30
- pod: YYText
31
- glob: 'YYText/Component/YYTextLayout.m'
28
+ # ---------- 示例 1:指定 Pod 模块 + 单文件多组替换(表达式优先级修复) ----------
29
+ - name: 表达式优先级修复
30
+ pod: SomePod
31
+ glob: 'SomePod/Component/SomeView.m'
32
32
  pairs:
33
- - from: 'fabs(left - point.y) < fabs(right - point.y) < (right ? prev : next)'
34
- to: '(fabs(left - point.y) < fabs(right - point.y)) == (right ? prev : next)'
35
- - from: 'fabs(left - point.x) < fabs(right - point.x) < (right ? prev : next)'
36
- to: '(fabs(left - point.x) < fabs(right - point.x)) == (right ? prev : next)'
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(迁移自 AFNetworking 私有头修复) ----------
39
- - name: AFNetworking 私有头修复
40
- pod: AFNetworking
41
- glob: 'AFNetworking/AF{NetworkReachabilityManager,HTTPSessionManager}.m'
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 模块 + 目录遍历(迁移自 LFPhoneInfo 头引入修复) ----------
46
- - name: LFPhoneInfo 头引入方式修复
47
- pod: LFPhoneInfo
45
+ # ---------- 示例 3:指定 Pod 模块 + 目录遍历(头文件引入方式修复) ----------
46
+ - name: 头文件引入方式修复
47
+ pod: SomePod
48
48
  glob: '**/*.{h,m,mm,swift}'
49
- from: '#import <LFPhoneDefine.h>'
50
- to: '#import "LFPhoneDefine.h"'
51
- # 排除示例:不修复 LFPhoneInfo.h 自身(exclude 也可传数组)
52
- # exclude: 'LFPhoneInfo/LFPhoneInfo.h'
49
+ from: '#import <SomeDefine.h>'
50
+ to: '#import "SomeDefine.h"'
51
+ # 排除示例:不修复 SomePod.h 自身(exclude 也可传数组)
52
+ # exclude: 'SomePod/SomePod.h'
53
53
  # 排除整棵目录树:
54
- # exclude: 'LFPhoneInfo/Private/**'
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: 'YYText' → 定位到 installer.sandbox.pod_dir('YYText'),glob 相对该 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}')
@@ -1,3 +1,3 @@
1
1
  module CocoapodsSourceFix
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.3'
3
3
  end
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.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.3.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