cocoapods-BDTransform 5.1.0 → 6.0.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 +4 -4
- data/lib/cocoapods-BDTransform/command/BDTransform/AweToBinary +0 -0
- data/lib/cocoapods-BDTransform/command/BDTransform/AweToLog.rb +131 -7
- data/lib/cocoapods-BDTransform/command/BDTransform/AweToSource +0 -0
- data/lib/cocoapods-BDTransform/command/BDTransform/ToLog.rb +12 -2
- data/lib/cocoapods-BDTransform/gem_version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8225bf5fad9c8440b3019b63b6c4e5256862a49a39536d137b5d158bd512e9c
|
4
|
+
data.tar.gz: 00a2883482e24f38254d63a42a09c58c5c6f67b31c441ecc8ff9cca6e87cc415
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f18638c6cffcabf76528e1545a119722feb9f15178cf9cf5413f037068d093a0c316aa7407c2b9a9b3bc48222e6a217eb9520f82cad97858018f1da90332fd05
|
7
|
+
data.tar.gz: 1b428512a2436e0ea64634ae4ee8b809f8583e8563e52720a27a97f0af90ea9b1d188fdce42078015365fb3d13334754902cfbe60220eb702f331afce6ae24d1
|
Binary file
|
@@ -19,40 +19,118 @@ module BDAwesomeTransmit
|
|
19
19
|
|
20
20
|
attr_accessor :repo
|
21
21
|
|
22
|
-
def initialize(repoName)
|
22
|
+
def initialize(repoName,dev_path = nil)
|
23
23
|
@repoName = repoName
|
24
|
+
|
25
|
+
@dev_path = dev_path
|
24
26
|
end
|
25
27
|
|
26
28
|
|
27
29
|
def run
|
30
|
+
getComponentVersion
|
28
31
|
requirePodspecInfo
|
29
|
-
|
32
|
+
requirePodspecInfoIfNeeded
|
30
33
|
establishGitRepo
|
34
|
+
trans_dev_if_needed
|
31
35
|
end
|
32
36
|
|
33
37
|
private
|
34
38
|
|
39
|
+
def trans_dev_if_needed
|
40
|
+
return unless @dev_path
|
41
|
+
@@project = Xcodeproj::Project.open('Pods/Pods.xcodeproj')
|
42
|
+
|
43
|
+
unless isContainDevPod
|
44
|
+
dev_pods = @@project.main_group.new_group('Development Pods')
|
45
|
+
@@project.main_group.children.pop()
|
46
|
+
@@project.main_group.children.insert(1,dev_pods)
|
47
|
+
end
|
48
|
+
pod_g = pod_group(@repoName)
|
49
|
+
unless isInDevPod(@repoName)
|
50
|
+
pod_g.move(development_pod)
|
51
|
+
end
|
52
|
+
`
|
53
|
+
test -d "#{@dev_path}/#{@repoName}" || mv Pods/"#{@repoName}" "#{@dev_path}"
|
54
|
+
rm -rf Pods/"#{@repoName}"
|
55
|
+
last=\`pwd\`
|
56
|
+
cd "#{@dev_path}"
|
57
|
+
ln -fs \`pwd\`/"#{@repoName}" $last/Pods
|
58
|
+
`
|
59
|
+
if pod_g.is_a? Xcodeproj::Project::Object::PBXFileReference
|
60
|
+
|
61
|
+
pod_proj = Xcodeproj::Project.open(pod_g.real_path)
|
62
|
+
pod_proj_g = pod_proj.groups.find { |group| group.name == @repoName }
|
63
|
+
pod_proj_g.set_path("#{@dev_path}/#{@repoName}")
|
64
|
+
pod_proj_g.groups.find{|group| group.name == 'Support Files'}.set_path("#{Dir.pwd}/Pods/Target Support Files/#{@repoName}")
|
65
|
+
pod_proj.save
|
66
|
+
@@project.save
|
67
|
+
else
|
68
|
+
pod_g.set_path("#{@dev_path}/#{@repoName}")
|
69
|
+
pod_g.groups.find{|group| group.name == 'Support Files'}.set_path("#{Dir.pwd}/Pods/Target Support Files/#{@repoName}")
|
70
|
+
@@project.save
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
|
76
|
+
def getComponentVersion
|
77
|
+
manifestpath = Pathname.new('Pods/Manifest.lock')
|
78
|
+
@repo_version = Pod::Lockfile.from_file(manifestpath).version(@repoName)
|
79
|
+
end
|
80
|
+
|
35
81
|
# 检测用户权限
|
36
82
|
|
37
83
|
def checkUserPermission
|
84
|
+
transhomepage
|
38
85
|
return unless @repohomepage
|
39
|
-
|
86
|
+
raise "没有权限访问 #{@repoName} 源码,源码地址:#{@repohomepage}" unless Pod::HTTP::validate_url(@repohomepage).success?
|
87
|
+
end
|
88
|
+
|
89
|
+
def transhomepage
|
90
|
+
return if @repohomepage
|
91
|
+
@repohomepage = @repo.gsub('git@code.byted.org:','https://code.byted.org/') if @repo.include? 'git@code.byted.org:'
|
92
|
+
@repohomepage = @repohomepage.gsub('.git','')
|
40
93
|
end
|
41
94
|
|
42
95
|
# 获取 pod 的基本信息
|
43
96
|
|
44
97
|
def requirePodspecInfo
|
98
|
+
transform_path = Pathname.new('Pods/transform.json')
|
99
|
+
if File.exist? transform_path
|
100
|
+
repo_infos = JSON.parse(File.read(transform_path))
|
101
|
+
if repo_infos.has_key? @repoName
|
102
|
+
@checkoutinfo = repo_infos[@repoName]['commit']
|
103
|
+
@repo = repo_infos[@repoName]['git']
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
def requirePodspecInfoIfNeeded
|
109
|
+
return if @repo && @checkoutinfo
|
45
110
|
url = "https://ios.bytedance.net/api/v1/repo/all?appType=1&offset=1&limit=10&search=#{@repoName}&appId=-1"
|
46
111
|
req = REST.get(url, 'Authorization' => 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoid3VzaXpoZW4uYXJjaCIsImlhdCI6MTU0NDYwMjI5MH0.daVOz8_8Er0qTv1c4w5O7nGC9D-doDqlcaXOC4SBo2k')
|
47
112
|
pods = JSON.parse(req.body)
|
48
113
|
raise "没有在无线研发平台上发现对应的组件:#{@repoName},请重试一下" if pods['data']['count'] == 0
|
49
|
-
|
114
|
+
repo_info = pods['data']['rows'].find { |component|
|
115
|
+
if component['repoName'] == @repoName
|
116
|
+
find_version = "http://mobile.bytedance.net/inner_mpaas/v2/repo/searchUpgradeHistoryDetail?repo_id=#{component['id']}&version=#{@repo_version}"
|
117
|
+
req = REST.get(find_version)
|
118
|
+
info = JSON.parse(req.body)
|
119
|
+
if info['err_no'].to_i == 0
|
120
|
+
@checkoutinfo = info['data']['commit_id']
|
121
|
+
true
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
}
|
126
|
+
raise "没有找到名为 #{@repoName} 的组件" unless repo_info
|
127
|
+
raise "没有找到 #{@repoName} #{@repo_version} 版本的 commit 信息,请在 Bus 平台查看" unless repo_info
|
128
|
+
|
129
|
+
@repo = repo_info['repo']
|
50
130
|
|
51
131
|
@repohomepage = pods['data']['rows'][0]['repohomepage']
|
52
132
|
end
|
53
133
|
|
54
|
-
|
55
|
-
|
56
134
|
# 获取Git地址
|
57
135
|
|
58
136
|
def establishGitRepo
|
@@ -61,13 +139,15 @@ module BDAwesomeTransmit
|
|
61
139
|
Dir.mktmpdir{|dir|
|
62
140
|
Pod::CoreUI.print("-- 正在部署 #{@repoName} ")
|
63
141
|
Pod::CoreUI.print(" ")
|
142
|
+
|
64
143
|
output = `
|
65
144
|
cd #{dir}
|
66
145
|
git clone -q #{@repo} #{@repoName}
|
67
146
|
cd #{@repoName}
|
147
|
+
git checkout -q #{@checkoutinfo}
|
68
148
|
echo "#{cdir}/.git"
|
69
149
|
test -d #{cdir}/.git && rm -rf #{cdir}/.git
|
70
|
-
mv -f .git #{cdir}
|
150
|
+
mv -f .git #{cdir} && cd #{cdir} && git reset --hard
|
71
151
|
`.lines.to_a
|
72
152
|
if $?.exitstatus != 0
|
73
153
|
Pod::CoreUI.warn('[ERROR] 部署失败,请产看原因:')
|
@@ -77,5 +157,49 @@ module BDAwesomeTransmit
|
|
77
157
|
}
|
78
158
|
end
|
79
159
|
|
160
|
+
# 工具方法
|
161
|
+
def isInDevPod(pod_name)
|
162
|
+
development_pods.find { |group| group.name == pod_name || group.path == pod_name }.class != NilClass
|
163
|
+
end
|
164
|
+
|
165
|
+
def isInNormalPods(pod_name)
|
166
|
+
pods.find { |group| group.name == pod_name || group.path == pod_name }
|
167
|
+
end
|
168
|
+
|
169
|
+
def pod_group(pod_name)
|
170
|
+
pod_groups.find { |group| group.name == pod_name || group.path == pod_name }
|
171
|
+
end
|
172
|
+
|
173
|
+
def pod_groups
|
174
|
+
if development_pods
|
175
|
+
return pods + development_pods
|
176
|
+
end
|
177
|
+
return pods
|
178
|
+
end
|
179
|
+
|
180
|
+
def development_pod
|
181
|
+
if isContainDevPod
|
182
|
+
return @@project.groups.find { |group| group.name == 'Development Pods' }
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
|
187
|
+
def pods
|
188
|
+
find = @@project.groups.find { |group| group.name == 'Pods' }
|
189
|
+
find.children.objects
|
190
|
+
end
|
191
|
+
|
192
|
+
def development_pods
|
193
|
+
if isContainDevPod
|
194
|
+
return @@project.groups.find { |group| group.name == 'Development Pods' }.children.objects
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
def isContainDevPod
|
199
|
+
find = @@project.groups.find { |group| group.name == 'Development Pods' }
|
200
|
+
find.class != NilClass
|
201
|
+
end
|
202
|
+
|
80
203
|
end
|
81
204
|
end
|
205
|
+
|
Binary file
|
@@ -52,10 +52,17 @@ module Pod
|
|
52
52
|
CLAide::Argument.new('podName', true),
|
53
53
|
]
|
54
54
|
|
55
|
+
def self.options
|
56
|
+
[
|
57
|
+
['--dev_path=', 'Mbox 专属,用于将转化后的 组件 移动到指定的目录下,以此无需pod install 即可进行 dev 开发']
|
58
|
+
|
59
|
+
]
|
60
|
+
end
|
61
|
+
|
55
62
|
def initialize(argv)
|
56
63
|
|
57
64
|
@bd_transform_pod = argv.arguments
|
58
|
-
|
65
|
+
@dev_path = argv.option('dev_path')
|
59
66
|
end
|
60
67
|
|
61
68
|
def validate!
|
@@ -63,6 +70,9 @@ module Pod
|
|
63
70
|
help! 'A Pod name is required.' unless @bd_transform_pod.count > 0
|
64
71
|
targetDir = Dir::pwd + '/Pods/' + @bd_transform_pod[0]
|
65
72
|
help! "目录 #{targetDir} 不存在,请在 Podfile 同级目录下执行" unless File::exist?(Dir::pwd + '/Pods/' + @bd_transform_pod[0])
|
73
|
+
if @dev_path
|
74
|
+
raise "#{@dev_path} 不存在" unless File.exist? @dev_path
|
75
|
+
end
|
66
76
|
end
|
67
77
|
|
68
78
|
def run
|
@@ -74,7 +84,7 @@ module Pod
|
|
74
84
|
else
|
75
85
|
require 'cocoapods-BDTransform/command/BDTransform/AweToLog.rb'
|
76
86
|
end
|
77
|
-
log = BDAwesomeTransmit::BDPodsTransLog.new(@bd_transform_pod[0])
|
87
|
+
log = BDAwesomeTransmit::BDPodsTransLog.new(@bd_transform_pod[0],@dev_path)
|
78
88
|
log.run
|
79
89
|
end
|
80
90
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-BDTransform
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 6.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bupterambition
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: zip
|
@@ -123,7 +123,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
requirements: []
|
126
|
-
|
126
|
+
rubyforge_project:
|
127
|
+
rubygems_version: 2.7.6
|
127
128
|
signing_key:
|
128
129
|
specification_version: 4
|
129
130
|
summary: A longer description of cocoapods-BDTransform.
|