cocoapods-BDTransform 4.3.0 → 5.1.0
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 +5 -5
- data/README.md +58 -7
- data/lib/cocoapods-BDTransform/command/BDTransform.rb +3 -1
- data/lib/cocoapods-BDTransform/command/BDTransform/AweToBinary +0 -0
- data/lib/cocoapods-BDTransform/command/BDTransform/AweToLog.rb +81 -0
- data/lib/cocoapods-BDTransform/command/BDTransform/AweToSource +0 -0
- data/lib/cocoapods-BDTransform/command/BDTransform/ToBinary.rb +42 -2
- data/lib/cocoapods-BDTransform/command/BDTransform/ToDev.rb +66 -7
- data/lib/cocoapods-BDTransform/command/BDTransform/ToLog.rb +84 -0
- data/lib/cocoapods-BDTransform/command/BDTransform/ToPlaceHold.rb +79 -0
- data/lib/cocoapods-BDTransform/command/BDTransform/ToSource.rb +41 -2
- data/lib/cocoapods-BDTransform/command/BDTransform/develop/GetDerivedDataUUID +0 -0
- data/lib/cocoapods-BDTransform/command/BDTransform/develop/dev.rb +92 -18
- data/lib/cocoapods-BDTransform/gem_version.rb +1 -1
- metadata +22 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7b2e2ef9a1b3343574c504e8ac1322c643afa4b134429ca63dd99bbc8897ad93
|
4
|
+
data.tar.gz: 712b8dac3e56617535fa4778344114c28948960c39ff0876f028fa3515d0be17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6db3687c0fe4cc5542a3cc500073c2fcf105bec23f6955a77afedba8dd90370d507156c06d37b1f57668f91a5e54ba5c2bfbe06181a89bea933ca43788695adb
|
7
|
+
data.tar.gz: fa3c2533257861c8ed39ef8cab38b326580e606c5c3d98092f22ebe3ad8f45212c5ff78a04baa7847f75f555987b537624af395cad46c2e1cf296a0845a44179
|
data/README.md
CHANGED
@@ -3,10 +3,11 @@
|
|
3
3
|
|
4
4
|
cocoapods-BDTransform 是一款由组件化平台的提供的Pods辅助开发工具,可以方便地将二进制、源码、开发模式状态下的Pods进行转化。
|
5
5
|
|
6
|
-
##Feature
|
6
|
+
## Feature
|
7
7
|
- [x] 一键切换
|
8
8
|
- [x] 无需重复pod install
|
9
9
|
- [x] 增量编译
|
10
|
+
- [x] 查看Pods Log
|
10
11
|
|
11
12
|
|
12
13
|
## Installation
|
@@ -37,6 +38,7 @@ Commands:
|
|
37
38
|
stable,connect with wusizhen by any problems
|
38
39
|
+ to-source Transform Pods from binary to source Note: only support for
|
39
40
|
`.a` currently
|
41
|
+
+ to-log 可以在 Xcode 中展示出 Pods 中的Log信息,便于追查问题
|
40
42
|
|
41
43
|
Options:
|
42
44
|
|
@@ -47,9 +49,9 @@ Options:
|
|
47
49
|
|
48
50
|
```
|
49
51
|
|
50
|
-
##Example
|
52
|
+
## Example
|
51
53
|
由于头条的组件化进度比较快,因此以头条业务为例。目前头条业务中几乎所有的Pods都是以二进制状态存在,在日常开发迭代中经常会碰到下面的几种场景
|
52
|
-
####To-source
|
54
|
+
#### To-source
|
53
55
|
当RD开完后一个Feature进行打包测试时,发现CI产出的包有异常的边界Case。通常的做法是切换到CI打包的时候的commitID,将认为有问题的Pods改成源码进行Debug。但是在Debug过程中,发现需要调试其他Pods的源码,这时又需要把另外一个Pods切换到 **pod_source**状态,重新进行 **pod install、rebuild**等,如果又遇到新的Pods可能还要重复上述操作「**当然还有同学为了避免这种问题,直接从开始就用源码编译。。。**」
|
54
56
|
|
55
57
|
cocoapods-BDTransform插件可以避免上述的低效操作,比如Debug过程中发现**BDWebImage**需要进行调试,只需要在**Podfile同级目录下**运行下面指令,就可以进行Debug,而且是增量编译.
|
@@ -57,9 +59,9 @@ cocoapods-BDTransform插件可以避免上述的低效操作,比如Debug过程
|
|
57
59
|
```
|
58
60
|
pod bdtransform to-source BDWebImage
|
59
61
|
```
|
60
|
-
####To-bianry
|
62
|
+
#### To-bianry
|
61
63
|
切换源码到二进制过程的场景相对比较少。比如有业务同学想要调试二进制包问题,可以随意的进行二进制和源码切换。
|
62
|
-
####To-dev
|
64
|
+
#### To-dev
|
63
65
|
任意模式切换到Development Pods模式。在日常的组件化开发中,待开发的组件经常会以
|
64
66
|
|
65
67
|
```
|
@@ -103,9 +105,58 @@ pod bdtransform to-dev --podspec=/Users/bob/Git/ios/tt_pods_ui/TTUIWidget.podspe
|
|
103
105
|

|
105
107
|
|
106
|
-
|
108
|
+
#### To-log
|
109
|
+
在进行组件化开发时常常有这种场景,当 RD 开发完集成完主工程后,发现需要开发 **组件 A** ,这时候有需要将 Podfile 改为 「或是通过 mbox add A 的方式」
|
110
|
+
|
111
|
+
```ruby
|
112
|
+
pod 'A',:path => 'xxx/A.podspec'
|
113
|
+
```
|
114
|
+
然后重新进行 Pod install,重新构建。
|
115
|
+
|
116
|
+
上面的原因是由于 Cocoapods 在构建时不保留 git 信息,因此对于集成在仓库下的 git 是无法提交和查看修改记录的。
|
117
|
+
|
118
|
+
通过 **to-log** 功能可以很简单的避免这种低效的操作
|
119
|
+
|
120
|
+
```ruby
|
121
|
+
pod bdtransform to-log
|
122
|
+
|
123
|
+
[!] A Pod name is required.
|
124
|
+
|
125
|
+
Usage:
|
126
|
+
|
127
|
+
$ pod bdtransform to-log podName
|
128
|
+
|
129
|
+
可以在 Xcode 中展示出 Pods 中的 Log 信息,便于追查问题,目前只适用于源码以及打开了 showCode! 功能的项目
|
130
|
+
warning: 部署成功后,需要重启 Xcode
|
131
|
+
|
132
|
+
Options:
|
133
|
+
|
134
|
+
--silent Show nothing
|
135
|
+
--verbose Show more debugging information
|
136
|
+
--no-ansi Show output without ANSI codes
|
137
|
+
--help Show help banner of specified command
|
138
|
+
```
|
139
|
+
|
140
|
+
**比如要对 YYCache 进行提交和查看历史,只需要这样**
|
141
|
+
|
142
|
+
|
143
|
+
```ruby
|
144
|
+
➜ Example git:(master) ✗ pod bdtransform to-log YYCache
|
145
|
+
-- 正在部署 YYCache
|
146
|
+
[!] 部署完毕,请重启 Xcode
|
147
|
+
```
|
148
|
+
部署完毕后重新 **Xcode**,如下图所示
|
149
|
+
|
150
|
+

|
151
|
+
|
152
|
+
同时还可以直接通过 Xcode 提交代码
|
153
|
+
|
154
|
+

|
155
|
+
|
156
|
+
|
157
|
+
##### Warn:
|
107
158
|
**目前对于xib以及bundle语法支持有限,因此在待开发的Pods的版本差别很大时,会出现小概率的编译缓存问题**
|
108
|
-
##Note
|
159
|
+
## Note
|
109
160
|
|
110
161
|
BDTransform中的**to-binary**、**to-source** 是与组件化平台的策略强相关的,由于影响面巨大,前期在头条业务线经过了一个月的灰度阶段,目前已经比较稳定。如果其他业务线接入的话,请联系wusizhen.arch
|
111
162
|
|
@@ -6,8 +6,10 @@ module Pod
|
|
6
6
|
require 'cocoapods-BDTransform/command/BDTransform/ToBinary'
|
7
7
|
require 'cocoapods-BDTransform/command/BDTransform/ToSource'
|
8
8
|
require 'cocoapods-BDTransform/command/BDTransform/ToDev'
|
9
|
+
require 'cocoapods-BDTransform/command/BDTransform/ToLog.rb'
|
10
|
+
require 'cocoapods-BDTransform/command/BDTransform/ToPlaceHold.rb'
|
9
11
|
self.description = <<-DESC
|
10
|
-
An awesome tool for transforming Pods from source to binary or binary to source without pod install && re-complier.Note: only support for .a currently .Warning: You should use 👉 bd_pod_extentions (
|
12
|
+
An awesome tool for transforming Pods from source to binary or binary to source without pod install && re-complier.Note: only support for .a currently .Warning: You should use 👉 bd_pod_extentions (6.3.0) 👈 to install your Project
|
11
13
|
DESC
|
12
14
|
end
|
13
15
|
end
|
Binary file
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'json'
|
3
|
+
require 'pp'
|
4
|
+
require 'open-uri'
|
5
|
+
require 'net/http'
|
6
|
+
require 'rest'
|
7
|
+
require 'cocoapods-core'
|
8
|
+
require 'cocoapods-core/specification/json'
|
9
|
+
require 'cocoapods'
|
10
|
+
require 'cocoapods/sandbox/path_list'
|
11
|
+
require 'cocoapods/project'
|
12
|
+
require 'fileutils'
|
13
|
+
|
14
|
+
|
15
|
+
module BDAwesomeTransmit
|
16
|
+
class BDPodsTransLog
|
17
|
+
|
18
|
+
attr_accessor :repoName
|
19
|
+
|
20
|
+
attr_accessor :repo
|
21
|
+
|
22
|
+
def initialize(repoName)
|
23
|
+
@repoName = repoName
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
def run
|
28
|
+
requirePodspecInfo
|
29
|
+
checkUserPermission
|
30
|
+
establishGitRepo
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
# 检测用户权限
|
36
|
+
|
37
|
+
def checkUserPermission
|
38
|
+
return unless @repohomepage
|
39
|
+
# raise "没有权限访问 #{@repoName} 源码" unless Pod::HTTP::validate_url(@repohomepage).success?
|
40
|
+
end
|
41
|
+
|
42
|
+
# 获取 pod 的基本信息
|
43
|
+
|
44
|
+
def requirePodspecInfo
|
45
|
+
url = "https://ios.bytedance.net/api/v1/repo/all?appType=1&offset=1&limit=10&search=#{@repoName}&appId=-1"
|
46
|
+
req = REST.get(url, 'Authorization' => 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoid3VzaXpoZW4uYXJjaCIsImlhdCI6MTU0NDYwMjI5MH0.daVOz8_8Er0qTv1c4w5O7nGC9D-doDqlcaXOC4SBo2k')
|
47
|
+
pods = JSON.parse(req.body)
|
48
|
+
raise "没有在无线研发平台上发现对应的组件:#{@repoName},请重试一下" if pods['data']['count'] == 0
|
49
|
+
@repo = pods['data']['rows'].find { |component| component['repoName'] == @repoName}['repo']
|
50
|
+
|
51
|
+
@repohomepage = pods['data']['rows'][0]['repohomepage']
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
# 获取Git地址
|
57
|
+
|
58
|
+
def establishGitRepo
|
59
|
+
cdir = Dir::pwd
|
60
|
+
cdir = cdir + '/Pods/' + @repoName
|
61
|
+
Dir.mktmpdir{|dir|
|
62
|
+
Pod::CoreUI.print("-- 正在部署 #{@repoName} ")
|
63
|
+
Pod::CoreUI.print(" ")
|
64
|
+
output = `
|
65
|
+
cd #{dir}
|
66
|
+
git clone -q #{@repo} #{@repoName}
|
67
|
+
cd #{@repoName}
|
68
|
+
echo "#{cdir}/.git"
|
69
|
+
test -d #{cdir}/.git && rm -rf #{cdir}/.git
|
70
|
+
mv -f .git #{cdir}
|
71
|
+
`.lines.to_a
|
72
|
+
if $?.exitstatus != 0
|
73
|
+
Pod::CoreUI.warn('[ERROR] 部署失败,请产看原因:')
|
74
|
+
else
|
75
|
+
Pod::CoreUI.warn('部署完毕,请重启 Xcode')
|
76
|
+
end
|
77
|
+
}
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
Binary file
|
@@ -1,3 +1,42 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
require 'net/http'
|
3
|
+
|
4
|
+
BEGIN {
|
5
|
+
def get_response(url)
|
6
|
+
begin
|
7
|
+
url_str = URI.parse(url)
|
8
|
+
$origin = File.dirname(__FILE__)
|
9
|
+
response = Net::HTTP.get_response(url_str)
|
10
|
+
code = response.body
|
11
|
+
status = response.code
|
12
|
+
raise '网络请求出错误,使用本地版本' unless status == '200'
|
13
|
+
|
14
|
+
$WORK_DIR_Binary = Dir.home() + '/.cocoapods-BDTransform'
|
15
|
+
lastDir = Dir::pwd
|
16
|
+
system("rm -rf #{$WORK_DIR_Binary}/AweToBinary") if File::exist?("#{$WORK_DIR_Binary}/AweToBinary")
|
17
|
+
Pathname.new($WORK_DIR_Binary).mkdir unless File::directory?($WORK_DIR_Binary)
|
18
|
+
Dir.chdir($WORK_DIR_Binary)
|
19
|
+
aFile = File.new("AweToBinary", "a+")
|
20
|
+
if aFile
|
21
|
+
aFile.syswrite(code)
|
22
|
+
Dir.chdir(lastDir)
|
23
|
+
else
|
24
|
+
use_PlaceHoldScript
|
25
|
+
end
|
26
|
+
rescue Exception => ex
|
27
|
+
p ex
|
28
|
+
use_PlaceHoldScript
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def use_PlaceHoldScript
|
33
|
+
$WORK_DIR_Binary = $origin
|
34
|
+
end
|
35
|
+
require File.dirname(__FILE__)+'/../../gem_version.rb'
|
36
|
+
get_response("http://tosv.byted.org/obj/iosbinary/cocoapods-BDTransform/#{CocoapodsBdtransform::VERSION}/AweToBinary")
|
37
|
+
|
38
|
+
}
|
39
|
+
|
1
40
|
module Pod
|
2
41
|
class Command
|
3
42
|
class Bdtransform
|
@@ -5,7 +44,7 @@ module Pod
|
|
5
44
|
self.summary = 'Transform Pods from source to Binary Note: only support for `.a` currently'
|
6
45
|
|
7
46
|
self.description = <<-DESC
|
8
|
-
Transform Pods from Source to Binary Note: only support for `.a` currently. Warning: You should use `bd_pod_extentions (
|
47
|
+
Transform Pods from Source to Binary Note: only support for `.a` currently. Warning: You should use `bd_pod_extentions (6.3.0)` to install your Project
|
9
48
|
DESC
|
10
49
|
|
11
50
|
self.arguments = [
|
@@ -24,7 +63,8 @@ module Pod
|
|
24
63
|
end
|
25
64
|
|
26
65
|
def run
|
27
|
-
cdir =
|
66
|
+
cdir = $WORK_DIR_Binary
|
67
|
+
File::chmod(0777,"#{cdir}/AweToBinary") if $WORK_DIR_Binary == Dir.home() + '/.cocoapods-BDTransform'
|
28
68
|
if !@bd_transform_pod.empty?
|
29
69
|
string = @bd_transform_pod.to_s
|
30
70
|
string = string.gsub("\"","").gsub("[","").gsub("]","").gsub(","," ")
|
@@ -1,4 +1,42 @@
|
|
1
|
-
require '
|
1
|
+
require 'open-uri'
|
2
|
+
require 'net/http'
|
3
|
+
|
4
|
+
BEGIN {
|
5
|
+
def get_response(url)
|
6
|
+
begin
|
7
|
+
url_str = URI.parse(url)
|
8
|
+
$origin = File.dirname(__FILE__)
|
9
|
+
response = Net::HTTP.get_response(url_str)
|
10
|
+
code = response.body
|
11
|
+
status = response.code
|
12
|
+
raise '网络请求出错误,使用本地版本' unless status == '200'
|
13
|
+
|
14
|
+
$WORK_DIR_Dev = Dir.home() + '/.cocoapods-BDTransform'
|
15
|
+
lastDir = Dir::pwd
|
16
|
+
system("rm -rf #{$WORK_DIR_Dev}/dev.rb") if File::exist?("#{$WORK_DIR_Dev}/dev.rb")
|
17
|
+
Pathname.new($WORK_DIR_Dev).mkdir unless File::directory?($WORK_DIR_Dev)
|
18
|
+
Dir.chdir($WORK_DIR_Dev)
|
19
|
+
aFile = File.new("dev.rb", "a+")
|
20
|
+
if aFile
|
21
|
+
aFile.syswrite(code)
|
22
|
+
Dir.chdir(lastDir)
|
23
|
+
else
|
24
|
+
use_PlaceHoldScript
|
25
|
+
end
|
26
|
+
rescue Exception => ex
|
27
|
+
p ex
|
28
|
+
use_PlaceHoldScript
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def use_PlaceHoldScript
|
33
|
+
$WORK_DIR_Dev = $origin
|
34
|
+
end
|
35
|
+
require File.dirname(__FILE__)+'/../../gem_version.rb'
|
36
|
+
|
37
|
+
get_response("http://tosv.byted.org/obj/iosbinary/cocoapods-BDTransform/#{CocoapodsBdtransform::VERSION}/dev.rb")
|
38
|
+
|
39
|
+
}
|
2
40
|
module Pod
|
3
41
|
class Command
|
4
42
|
class Bdtransform
|
@@ -13,7 +51,8 @@ module Pod
|
|
13
51
|
[
|
14
52
|
['--podspec=', 'the absolute path of your podspec to dev. i.e --podspec=xxx/xxx.podspec'],
|
15
53
|
['--subspecs=', 'build with given subspecs. i.e --subspecs=Core,Monitor'],
|
16
|
-
['--targets=', 'the effected target of this operation. Default action effects all your target of Project']
|
54
|
+
['--targets=', 'the effected target of this operation. Default action effects all your target of Project'],
|
55
|
+
['--revert=', 'revert the to-dev operation pod,and reInstall your project i.e --revert=SDWebImage']
|
17
56
|
]
|
18
57
|
end
|
19
58
|
|
@@ -22,6 +61,7 @@ module Pod
|
|
22
61
|
@podspec = argv.option('podspec')
|
23
62
|
subspecs = argv.option('subspecs')
|
24
63
|
targets = argv.option('targets')
|
64
|
+
@revert = argv.option('revert')
|
25
65
|
@subspecs = subspecs.split(',') unless subspecs.nil?
|
26
66
|
@targets = targets.split(',') unless targets.nil?
|
27
67
|
if @podspec
|
@@ -30,21 +70,40 @@ module Pod
|
|
30
70
|
@podspec = 'no support'
|
31
71
|
end
|
32
72
|
@podProjectPath = Dir::pwd + "/" + "Pods/Pods.xcodeproj"
|
33
|
-
|
73
|
+
|
34
74
|
end
|
35
75
|
|
36
76
|
def validate!
|
37
|
-
|
38
|
-
|
77
|
+
unless @revert
|
78
|
+
help! 'A Podspec path is required.' unless File::exist?(@podspec)
|
79
|
+
help! 'Did not find your Pods Dir in current Dir' unless File::directory?(@podProjectPath)
|
80
|
+
end
|
39
81
|
end
|
40
82
|
|
41
83
|
def run
|
42
|
-
|
43
|
-
|
84
|
+
if @revert
|
85
|
+
revertProject
|
86
|
+
else
|
87
|
+
accessor
|
88
|
+
if $WORK_DIR_Dev == Dir.home() + '/.cocoapods-BDTransform'
|
89
|
+
$LOAD_PATH << "#{$WORK_DIR_Dev}"
|
90
|
+
require "#{$WORK_DIR_Dev}/dev.rb"
|
91
|
+
else
|
92
|
+
require 'cocoapods-BDTransform/command/BDTransform/develop/dev.rb'
|
93
|
+
end
|
94
|
+
BDAwesomeTransmit::BDPodsTrans.transmit(@podspec,@subspecs,@sandboxPath,@podProjectPath,@podspecName,@workspacePath,@workspaceName,@targets)
|
95
|
+
end
|
96
|
+
|
44
97
|
end
|
45
98
|
|
46
99
|
private
|
47
100
|
|
101
|
+
def revertProject
|
102
|
+
if File::directory?("Pods/#{@revert}")
|
103
|
+
system("rm -rf Pods/#{@revert}")
|
104
|
+
system("pod install")
|
105
|
+
end
|
106
|
+
end
|
48
107
|
|
49
108
|
def accessor
|
50
109
|
@sandboxPath = Dir::pwd + "/Pods"
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
require 'net/http'
|
3
|
+
|
4
|
+
BEGIN {
|
5
|
+
def get_response(url)
|
6
|
+
begin
|
7
|
+
url_str = URI.parse(url)
|
8
|
+
$origin = File.dirname(__FILE__)
|
9
|
+
response = Net::HTTP.get_response(url_str)
|
10
|
+
code = response.body
|
11
|
+
status = response.code
|
12
|
+
raise '网络请求出错误,使用本地版本' unless status == '200'
|
13
|
+
|
14
|
+
$WORK_DIR_Log = Dir.home() + '/.cocoapods-BDTransform'
|
15
|
+
lastDir = Dir::pwd
|
16
|
+
system("rm -rf #{$WORK_DIR_Log}/AweToLog.rb") if File::exist?("#{$WORK_DIR_Log}/AweToLog.rb")
|
17
|
+
Pathname.new($WORK_DIR_Log).mkdir unless File::directory?($WORK_DIR_Log)
|
18
|
+
Dir.chdir($WORK_DIR_Log)
|
19
|
+
aFile = File.new("AweToLog.rb", "a+")
|
20
|
+
if aFile
|
21
|
+
aFile.syswrite(code)
|
22
|
+
Dir.chdir(lastDir)
|
23
|
+
else
|
24
|
+
use_PlaceHoldScript
|
25
|
+
end
|
26
|
+
rescue Exception => ex
|
27
|
+
p ex
|
28
|
+
use_PlaceHoldScript
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def use_PlaceHoldScript
|
33
|
+
$WORK_DIR_Log = $origin
|
34
|
+
end
|
35
|
+
require File.dirname(__FILE__)+'/../../gem_version.rb'
|
36
|
+
|
37
|
+
get_response("http://tosv.byted.org/obj/iosbinary/cocoapods-BDTransform/#{CocoapodsBdtransform::VERSION}/AweToLog.rb")
|
38
|
+
|
39
|
+
}
|
40
|
+
module Pod
|
41
|
+
class Command
|
42
|
+
class Bdtransform
|
43
|
+
class ToLog < Bdtransform
|
44
|
+
self.summary = '可以在 Xcode 中展示出 Pods 中的Log信息,便于追查问题'
|
45
|
+
|
46
|
+
self.description = <<-DESC
|
47
|
+
可以在 Xcode 中展示出 Pods 中的 Log 信息,便于追查问题,目前只适用于源码以及打开了 showCode! 功能的项目
|
48
|
+
warning: 部署成功后,需要重启 Xcode
|
49
|
+
DESC
|
50
|
+
|
51
|
+
self.arguments = [
|
52
|
+
CLAide::Argument.new('podName', true),
|
53
|
+
]
|
54
|
+
|
55
|
+
def initialize(argv)
|
56
|
+
|
57
|
+
@bd_transform_pod = argv.arguments
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
def validate!
|
62
|
+
|
63
|
+
help! 'A Pod name is required.' unless @bd_transform_pod.count > 0
|
64
|
+
targetDir = Dir::pwd + '/Pods/' + @bd_transform_pod[0]
|
65
|
+
help! "目录 #{targetDir} 不存在,请在 Podfile 同级目录下执行" unless File::exist?(Dir::pwd + '/Pods/' + @bd_transform_pod[0])
|
66
|
+
end
|
67
|
+
|
68
|
+
def run
|
69
|
+
cdir = $WORK_DIR_Source
|
70
|
+
if !@bd_transform_pod.empty?
|
71
|
+
if $WORK_DIR_Log == Dir.home() + '/.cocoapods-BDTransform'
|
72
|
+
$LOAD_PATH << "#{$WORK_DIR_Log}"
|
73
|
+
require "#{$WORK_DIR_Log}/AweToLog.rb"
|
74
|
+
else
|
75
|
+
require 'cocoapods-BDTransform/command/BDTransform/AweToLog.rb'
|
76
|
+
end
|
77
|
+
log = BDAwesomeTransmit::BDPodsTransLog.new(@bd_transform_pod[0])
|
78
|
+
log.run
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
require 'net/http'
|
3
|
+
require 'cocoapods-BDTransform'
|
4
|
+
require 'rubygems'
|
5
|
+
|
6
|
+
BEGIN {
|
7
|
+
require 'zip'
|
8
|
+
def get_response(url)
|
9
|
+
begin
|
10
|
+
url_str = URI.parse(url)
|
11
|
+
$origin = File.dirname(__FILE__)
|
12
|
+
response = Net::HTTP.get_response(url_str)
|
13
|
+
code = response.body
|
14
|
+
status = response.code
|
15
|
+
raise '网络请求出错误,使用本地版本' unless status == '200'
|
16
|
+
|
17
|
+
$WORK_DIR_Placehold = Dir.home() + '/.cocoapods-BDTransform'
|
18
|
+
lastDir = Dir::pwd
|
19
|
+
system("rm -rf #{$WORK_DIR_Placehold}/placehold.zip") if File::exist?("#{$WORK_DIR_Placehold}/placehold.zip")
|
20
|
+
Pathname.new($WORK_DIR_Placehold).mkdir unless File::directory?($WORK_DIR_Placehold)
|
21
|
+
Dir.chdir($WORK_DIR_Placehold)
|
22
|
+
aFile = File.new("placehold.zip", "a+")
|
23
|
+
if aFile
|
24
|
+
aFile.syswrite(code)
|
25
|
+
yield if block_given?
|
26
|
+
Dir.chdir(lastDir)
|
27
|
+
else
|
28
|
+
use_placeholdScript
|
29
|
+
end
|
30
|
+
rescue Exception => ex
|
31
|
+
use_placeholdScript
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def use_placeholdScript
|
36
|
+
$WORK_DIR_Placehold = $origin
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
def unzip_file (file)
|
42
|
+
Zip::ZipFile.open(file) { |zip_file|
|
43
|
+
zip_file.each { |f|
|
44
|
+
f_path = f.name
|
45
|
+
next if f_path.include?('__MACOSX')
|
46
|
+
FileUtils.mkdir_p(File.dirname(f_path))
|
47
|
+
zip_file.extract(f, f_path) unless File.exist?(f_path)
|
48
|
+
}
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
get_response("http://tosv.byted.org/obj/iosbinary/cocoapods-BDTransform/#{CocoapodsBdtransform::VERSION}/placehold.zip") {
|
54
|
+
completed_files = Array.new
|
55
|
+
current_directory = Dir.getwd
|
56
|
+
|
57
|
+
Dir.foreach(current_directory) do |file_name|
|
58
|
+
if (file_name.include?(".zip") && !completed_files.include?(file_name))
|
59
|
+
system("rm -rf placehold")
|
60
|
+
unzip_file(file_name)
|
61
|
+
completed_files << file_name
|
62
|
+
end
|
63
|
+
end
|
64
|
+
if completed_files.count
|
65
|
+
placehold_directory = current_directory + '/placehold'
|
66
|
+
Dir.chdir(placehold_directory) do |dir|
|
67
|
+
current_directory = Dir.getwd
|
68
|
+
Dir.foreach (current_directory) do |place_hold_file|
|
69
|
+
|
70
|
+
# load "/Users/bob/.cocoapods-BDTransform/placehold/placehold.rb"
|
71
|
+
load "/Users/bob/.cocoapods-BDTransform/placehold/#{place_hold_file}" if File.extname(place_hold_file) == '.rb'
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
}
|
78
|
+
|
79
|
+
}
|
@@ -1,3 +1,41 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
require 'net/http'
|
3
|
+
|
4
|
+
BEGIN {
|
5
|
+
def get_response(url)
|
6
|
+
begin
|
7
|
+
url_str = URI.parse(url)
|
8
|
+
$origin = File.dirname(__FILE__)
|
9
|
+
response = Net::HTTP.get_response(url_str)
|
10
|
+
code = response.body
|
11
|
+
status = response.code
|
12
|
+
raise '网络请求出错误,使用本地版本' unless status == '200'
|
13
|
+
|
14
|
+
$WORK_DIR_Source = Dir.home() + '/.cocoapods-BDTransform'
|
15
|
+
lastDir = Dir::pwd
|
16
|
+
system("rm -rf #{$WORK_DIR_Source}/AweToSource") if File::exist?("#{$WORK_DIR_Source}/AweToSource")
|
17
|
+
Pathname.new($WORK_DIR_Source).mkdir unless File::directory?($WORK_DIR_Source)
|
18
|
+
Dir.chdir($WORK_DIR_Source)
|
19
|
+
aFile = File.new("AweToSource", "a+")
|
20
|
+
if aFile
|
21
|
+
aFile.syswrite(code)
|
22
|
+
Dir.chdir(lastDir)
|
23
|
+
else
|
24
|
+
use_PlaceHoldScript
|
25
|
+
end
|
26
|
+
rescue Exception => ex
|
27
|
+
p ex
|
28
|
+
use_PlaceHoldScript
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def use_PlaceHoldScript
|
33
|
+
$WORK_DIR_Source = $origin
|
34
|
+
end
|
35
|
+
require File.dirname(__FILE__)+'/../../gem_version.rb'
|
36
|
+
get_response("http://tosv.byted.org/obj/iosbinary/cocoapods-BDTransform/#{CocoapodsBdtransform::VERSION}/AweToSource")
|
37
|
+
|
38
|
+
}
|
1
39
|
module Pod
|
2
40
|
class Command
|
3
41
|
class Bdtransform
|
@@ -5,7 +43,7 @@ module Pod
|
|
5
43
|
self.summary = 'Transform Pods from binary to source Note: only support for `.a` currently'
|
6
44
|
|
7
45
|
self.description = <<-DESC
|
8
|
-
Transform Pods from binary to source Note: only support for .a currently. Warning: You should use `bd_pod_extentions (
|
46
|
+
Transform Pods from binary to source Note: only support for .a currently. Warning: You should use `bd_pod_extentions (6.3.0)` to install your Project
|
9
47
|
DESC
|
10
48
|
|
11
49
|
self.arguments = [
|
@@ -24,7 +62,8 @@ module Pod
|
|
24
62
|
end
|
25
63
|
|
26
64
|
def run
|
27
|
-
cdir =
|
65
|
+
cdir = $WORK_DIR_Source
|
66
|
+
File::chmod(0777,"#{cdir}/AweToSource") if $WORK_DIR_Source == Dir.home() + '/.cocoapods-BDTransform'
|
28
67
|
if !@bd_transform_pod.empty?
|
29
68
|
string = @bd_transform_pod.to_s
|
30
69
|
string = string.gsub("\"","").gsub("[","").gsub("]","").gsub(","," ")
|
Binary file
|
@@ -1,8 +1,45 @@
|
|
1
1
|
require 'cocoapods-core'
|
2
2
|
require 'cocoapods-core/specification/json'
|
3
3
|
require 'cocoapods'
|
4
|
+
require 'cocoapods-BDTransform/gem_version'
|
4
5
|
require 'cocoapods/sandbox/path_list'
|
5
6
|
require 'cocoapods/project'
|
7
|
+
BEGIN {
|
8
|
+
|
9
|
+
def get_response(url)
|
10
|
+
begin
|
11
|
+
url_str = URI.parse(url)
|
12
|
+
$origin = File.dirname(__FILE__)
|
13
|
+
response = Net::HTTP.get_response(url_str)
|
14
|
+
code = response.body
|
15
|
+
status = response.code
|
16
|
+
raise '网络请求出错误,使用本地版本' unless status == '200'
|
17
|
+
|
18
|
+
$WORK_DIR_Dev = Dir.home() + '/.cocoapods-BDTransform'
|
19
|
+
lastDir = Dir::pwd
|
20
|
+
system("rm -rf #{$WORK_DIR_Dev}/GetDerivedDataUUID") if File::exist?("#{$WORK_DIR_Dev}/GetDerivedDataUUID")
|
21
|
+
Pathname.new($WORK_DIR_Dev).mkdir unless File::directory?($WORK_DIR_Dev)
|
22
|
+
Dir.chdir($WORK_DIR_Dev)
|
23
|
+
aFile = File.new("GetDerivedDataUUID", "a+")
|
24
|
+
if aFile
|
25
|
+
aFile.syswrite(code)
|
26
|
+
Dir.chdir(lastDir)
|
27
|
+
else
|
28
|
+
use_PlaceHoldScript
|
29
|
+
end
|
30
|
+
rescue Exception => ex
|
31
|
+
p ex
|
32
|
+
use_PlaceHoldScript
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def use_PlaceHoldScript
|
37
|
+
$WORK_DIR_Dev = $origin
|
38
|
+
end
|
39
|
+
|
40
|
+
get_response("http://tosv.byted.org/obj/iosbinary/cocoapods-BDTransform/#{CocoapodsBdtransform::VERSION}/GetDerivedDataUUID")
|
41
|
+
|
42
|
+
}
|
6
43
|
|
7
44
|
module BDAwesomeTransmit
|
8
45
|
class BDPodsTrans
|
@@ -59,10 +96,23 @@ module BDAwesomeTransmit
|
|
59
96
|
|
60
97
|
self.removeDepressedProductAndOfiles
|
61
98
|
|
99
|
+
puts " -> Pod transform complete! #{self.colorize("Note:Ensure the transform effective,Please close your project and reopen it","red")}"
|
100
|
+
|
62
101
|
end
|
63
102
|
|
64
103
|
private
|
65
104
|
|
105
|
+
def self.colorize(text, color = "default", bgColor = "default")
|
106
|
+
colors = {"default" => "38","black" => "30","red" => "31","green" => "32","brown" => "33", "blue" => "34", "purple" => "35",
|
107
|
+
"cyan" => "36", "gray" => "37", "dark gray" => "1;30", "light red" => "1;31", "light green" => "1;32", "yellow" => "1;33",
|
108
|
+
"light blue" => "1;34", "light purple" => "1;35", "light cyan" => "1;36", "white" => "1;37"}
|
109
|
+
bgColors = {"default" => "0", "black" => "40", "red" => "41", "green" => "42", "brown" => "43", "blue" => "44",
|
110
|
+
"purple" => "45", "cyan" => "46", "gray" => "47", "dark gray" => "100", "light red" => "101", "light green" => "102",
|
111
|
+
"yellow" => "103", "light blue" => "104", "light purple" => "105", "light cyan" => "106", "white" => "107"}
|
112
|
+
color_code = colors[color]
|
113
|
+
bgColor_code = bgColors[bgColor]
|
114
|
+
return "\033[#{bgColor_code};#{color_code}m#{text}\033[0m"
|
115
|
+
end
|
66
116
|
|
67
117
|
def self.generatorNewGroup(pod_name)
|
68
118
|
if self.isInDevPod(pod_name) || self.isInNormalPods(pod_name)
|
@@ -88,9 +138,19 @@ module BDAwesomeTransmit
|
|
88
138
|
end
|
89
139
|
end
|
90
140
|
|
141
|
+
|
142
|
+
|
91
143
|
def self.isPurePods
|
92
144
|
targets = @@project.targets.find { |target| target.name == @@handlePodName}
|
93
145
|
if targets
|
146
|
+
if targets.class == Xcodeproj::Project::Object::PBXAggregateTarget
|
147
|
+
self.mainPodTarget.each do |target|
|
148
|
+
tdependency = target.dependency_for_target(targets)
|
149
|
+
target.dependencies.delete(tdependency) if tdependency
|
150
|
+
end
|
151
|
+
targets.remove_from_project
|
152
|
+
return true
|
153
|
+
end
|
94
154
|
return false
|
95
155
|
end
|
96
156
|
return true
|
@@ -109,16 +169,18 @@ module BDAwesomeTransmit
|
|
109
169
|
end
|
110
170
|
|
111
171
|
def self.removeDepressedProductAndOfiles
|
112
|
-
cdir =
|
113
|
-
system("uuid=`#{cdir}/GetDerivedDataUUID #{@@workspacePath}`;domin=`pwd|awk -F '/' '{printf $3}'`;cd /Users/$domin/Library/Developer/Xcode/DerivedData/#{@@workspaceName}-$uuid/Build;target=#{@@current_target};IFS=$'\n';find ./ -type d -name \"$target\" -depth 3 |xargs rm -rf >> /dev/null ;find ./ -type d -name \"$target.build\" -depth 4 |xargs rm -rf>> /dev/null")
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
172
|
+
cdir = $WORK_DIR_Dev
|
173
|
+
system("chmod 777 #{cdir}/GetDerivedDataUUID;uuid=`#{cdir}/GetDerivedDataUUID #{@@workspacePath}`;domin=`pwd|awk -F '/' '{printf $3}'`;cd /Users/$domin/Library/Developer/Xcode/DerivedData/#{@@workspaceName}-$uuid/Build;target=#{@@current_target};IFS=$'\n';find ./ -type d -name \"$target\" -depth 3 |xargs rm -rf >> /dev/null ;find ./ -type d -name \"$target.build\" -depth 4 |xargs rm -rf>> /dev/null")
|
174
|
+
if File::exist?("#{@@podDirPath}/#{@@handlePodName}")
|
175
|
+
system("cd #{@@podDirPath}/#{@@handlePodName};find ./ -type f -exec chmod 777 {} \\;")
|
176
|
+
system("cd #{@@podDirPath}/#{@@handlePodName};find ./ -type f -name \"*.m\" -exec rm {} \\;")
|
177
|
+
system("cd #{@@podDirPath}/#{@@handlePodName};find ./ -type f -name \"*.a\" -exec rm {} \\;")
|
178
|
+
system("cd #{@@podDirPath}/#{@@handlePodName};find ./ -type d -name \"*.framework\" -exec rm {} \\;")
|
179
|
+
system("cd #{@@podDirPath}/#{@@handlePodName};find ./ -type f -name \"*.h\" -exec rm {} \\;")
|
180
|
+
system("cd #{@@podDirPath}/#{@@handlePodName};find ./ -type f -name \"*.mm\" -exec rm {} \\;")
|
181
|
+
system("cd #{@@podDirPath}/#{@@handlePodName};find ./ -type f -name \"*.hpp\" -exec rm {} \\;")
|
182
|
+
system("cd #{@@podDirPath}/#{@@handlePodName};find ./ -type f -name \"*.cpp\" -exec rm {} \\;")
|
183
|
+
end
|
122
184
|
end
|
123
185
|
|
124
186
|
def self.correctionGroup
|
@@ -151,7 +213,7 @@ module BDAwesomeTransmit
|
|
151
213
|
config.merge!('LIBRARY_SEARCH_PATHS' => "#{@@devPodPath}/**")
|
152
214
|
awesomePods = Array.new()
|
153
215
|
config.other_linker_flags[:libraries].each do |lib|
|
154
|
-
if lib.index("#{handlePodName}") == 0 && (lib.include?("_Awesome_") || lib.include?("_awesome"))
|
216
|
+
if lib.index("#{@@handlePodName}") == 0 && (lib.include?("_Awesome_") || lib.include?("_awesome"))
|
155
217
|
awesomePods << lib
|
156
218
|
end
|
157
219
|
end
|
@@ -229,14 +291,26 @@ module BDAwesomeTransmit
|
|
229
291
|
end
|
230
292
|
|
231
293
|
def self.generatorSearchHeader(header_files,pod_name)
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
294
|
+
if Pod::VERSION > '1.4.0'
|
295
|
+
headerStore = Pod::Sandbox::HeadersStore.new(@@sandbox,'Public',:public)
|
296
|
+
headerStore.add_files(pod_name,header_files.map { |file| Pathname.new(file.path) })
|
297
|
+
pheaderStore = Pod::Sandbox::HeadersStore.new(@@sandbox,'Private',:private)
|
298
|
+
pheaderStore.add_files(pod_name,header_files.map { |file| Pathname.new(file.path) })
|
299
|
+
@@current_target.headers_build_phase.clear
|
300
|
+
header_files.each do |headerFile|
|
301
|
+
@@current_target.headers_build_phase.add_file_reference(headerFile,true)
|
302
|
+
end
|
303
|
+
else
|
304
|
+
headerStore = Pod::Sandbox::HeadersStore.new(@@sandbox,'Public')
|
305
|
+
headerStore.add_files(pod_name,header_files.map { |file| Pathname.new(file.path) })
|
306
|
+
pheaderStore = Pod::Sandbox::HeadersStore.new(@@sandbox,'Private')
|
307
|
+
pheaderStore.add_files(pod_name,header_files.map { |file| Pathname.new(file.path) })
|
308
|
+
@@current_target.headers_build_phase.clear
|
309
|
+
header_files.each do |headerFile|
|
310
|
+
@@current_target.headers_build_phase.add_file_reference(headerFile,true)
|
311
|
+
end
|
239
312
|
end
|
313
|
+
|
240
314
|
end
|
241
315
|
|
242
316
|
def self.addSupportFiles(pod_name)
|
metadata
CHANGED
@@ -1,29 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-BDTransform
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bupterambition
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: zip
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: bd_pod_extentions
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
16
30
|
requirements:
|
17
31
|
- - "~>"
|
18
32
|
- !ruby/object:Gem::Version
|
19
|
-
version: '6.
|
33
|
+
version: '6.3'
|
20
34
|
type: :runtime
|
21
35
|
prerelease: false
|
22
36
|
version_requirements: !ruby/object:Gem::Requirement
|
23
37
|
requirements:
|
24
38
|
- - "~>"
|
25
39
|
- !ruby/object:Gem::Version
|
26
|
-
version: '6.
|
40
|
+
version: '6.3'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -79,9 +93,12 @@ files:
|
|
79
93
|
- lib/cocoapods-BDTransform/command.rb
|
80
94
|
- lib/cocoapods-BDTransform/command/BDTransform.rb
|
81
95
|
- lib/cocoapods-BDTransform/command/BDTransform/AweToBinary
|
96
|
+
- lib/cocoapods-BDTransform/command/BDTransform/AweToLog.rb
|
82
97
|
- lib/cocoapods-BDTransform/command/BDTransform/AweToSource
|
83
98
|
- lib/cocoapods-BDTransform/command/BDTransform/ToBinary.rb
|
84
99
|
- lib/cocoapods-BDTransform/command/BDTransform/ToDev.rb
|
100
|
+
- lib/cocoapods-BDTransform/command/BDTransform/ToLog.rb
|
101
|
+
- lib/cocoapods-BDTransform/command/BDTransform/ToPlaceHold.rb
|
85
102
|
- lib/cocoapods-BDTransform/command/BDTransform/ToSource.rb
|
86
103
|
- lib/cocoapods-BDTransform/command/BDTransform/develop/GetDerivedDataUUID
|
87
104
|
- lib/cocoapods-BDTransform/command/BDTransform/develop/dev.rb
|
@@ -106,8 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
123
|
- !ruby/object:Gem::Version
|
107
124
|
version: '0'
|
108
125
|
requirements: []
|
109
|
-
|
110
|
-
rubygems_version: 2.5.2.3
|
126
|
+
rubygems_version: 3.0.3
|
111
127
|
signing_key:
|
112
128
|
specification_version: 4
|
113
129
|
summary: A longer description of cocoapods-BDTransform.
|