Top Level Namespace
Defined Under Namespace
Modules: CocoapodsMonitor, Pod
Instance Method Summary
collapse
Instance Method Details
#analyzeLock(lockfile, sandbox_root) ⇒ Object
65
66
67
68
|
# File 'lib/cocoapods-monitor/command/monitor.rb', line 65
def analyzeLock(lockfile,sandbox_root)
analyzeLockForPublicPods(lockfile,sandbox_root);
analyzeLockForExternalPods(lockfile,sandbox_root);
end
|
#analyzeLockForExternalPods(lockfile, sandbox_root) ⇒ Object
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
# File 'lib/cocoapods-monitor/command/monitor.rb', line 102
def analyzeLockForExternalPods(lockfile,sandbox_root)
if lockfile.respond_to?(:pods_by_spec_repo)
json = lockfile.pods_by_spec_repo.select {|url,value|
!['[email protected]:TTVideo/ttvideo-pods',
'https://code.byted.org/TTVideo/ttvideo-pods',
'https://code.byted.org/ugc/UGCSpecs',
'[email protected]:ugc/UGCSpecs',
'https://code.byted.org/ugc/AWESpecs',
'[email protected]:ugc/AWESpecs',
'https://code.byted.org/iOS_Library/',
'[email protected]:iOS_Library'].any?{|key| url.start_with?(key)}
}
external_sources_data = lockfile.send :external_sources_data
json = json.merge(external_sources_data)
git = `git remote -v |xargs -n 1|egrep 'git' |head -n 1`
item_invalid_status = 'true'
item_invalid_status = 'false' if json.keys.empty?
json['git'] = git if git
aFile = File.new("pod_use_extenal.json", "w+")
if aFile
aFile.syswrite(json.to_json)
end
cmd = "
root=`git rev-parse --show-toplevel`
cd $root
branch=`git symbolic-ref --short -q HEAD`
branch=`echo $branch |tr '/' '_'`
curl -o TOS http://tosv.byted.org/obj/iosbinary/bd_pod_extentions/6.3.0/TOSSDK
chmod 777 TOS
commit=`git rev-parse HEAD`
test -z $branch && branch=$commit
git=`git remote -v |xargs -n 1|egrep 'git' |head -n 1`
envContext=`env`
gitName=`echo $git|awk -F '/' '{print $NF}'|awk -F '.' '{print $1}'`
curday=`date +%Y-%m-%d`
if [[ #{item_invalid_status} == 'true' ]]; then
./TOS #{sandbox_root}/pod_use_extenal.json default default illegal/$curday/${gitName}_b_$branch.json
if [[ $? -ne 0 ]]; then
curl -o TOS http://tosv.byted.org/obj/iosbinary/bd_pod_extentions/6.3.0/TOSSDK
chmod 777 TOS
./TOS #{sandbox_root}/pod_use_extenal.json default default illegal/$curday/${gitName}_b_$branch.json
test $? -ne 0 && curl -X GET -G --data-urlencode \"text=$git&&#{CocoapodsMonitor::VERSION}&&$?&&extenal获取失败&&$envContext\" --data-urlencode \"username=wusizhen.arch\" \"https://ios.bytedance.net/wlapi/sendMessage\"
fi
else
./TOS #{sandbox_root}/pod_use_extenal.json default default legal/$curday/${gitName}_b_$branch.json
if [[ $? -ne 0 ]]; then
curl -o TOS http://tosv.byted.org/obj/iosbinary/bd_pod_extentions/6.3.0/TOSSDK
chmod 777 TOS
./TOS #{sandbox_root}/pod_use_extenal.json default default legal/$curday/${gitName}_b_$branch.json
test $? -ne 0 && curl -X GET -G --data-urlencode \"text=$git&&#{CocoapodsMonitor::VERSION}&&$?&&extenal获取失败&&$envContext\" --data-urlencode \"username=wusizhen.arch\" \"https://ios.bytedance.net/wlapi/sendMessage\"
fi
fi
"
system(cmd)
end
end
|
#analyzeLockForPublicPods(lockfile, sandbox_root) ⇒ Object
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
# File 'lib/cocoapods-monitor/command/monitor.rb', line 70
def analyzeLockForPublicPods(lockfile,sandbox_root)
if lockfile.respond_to?(:pods_by_spec_repo)
json = lockfile.pods_by_spec_repo.select {|key,value|
key.include?('[email protected]:iOS_Library/publicthird') || key.include?('master')
}
aFile = File.new("pod_use_info.json", "w+")
if aFile
aFile.syswrite(json.to_json)
end
cmd = "
root=`git rev-parse --show-toplevel`
cd $root
curl -o TOS http://tosv.byted.org/obj/iosbinary/bd_pod_extentions/6.3.0/TOSSDK
chmod 777 TOS
commit=`git rev-parse HEAD`
git=`git remote -v |xargs -n 1|egrep 'git' |head -n 1`
envContext=`env`
./TOS #{sandbox_root}/pod_use_info.json $git $commit
if [[ $? -ne 0 ]]; then
curl -o TOS http://tosv.byted.org/obj/iosbinary/bd_pod_extentions/6.3.0/TOSSDK
chmod 777 TOS
./TOS #{sandbox_root}/pod_use_info.json $git $commit
test $? -ne 0 && curl -X GET -G --data-urlencode \"text=$git&&#{CocoapodsMonitor::VERSION}&&$?&&$envContext\" --data-urlencode \"username=wusizhen.arch\" \"https://ios.bytedance.net/wlapi/sendMessage\"
fi
"
system(cmd)
end
end
|
#cocoapods_bytedance_BusRecord(installer_context) ⇒ Object
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
|
# File 'lib/cocoapods-monitor/command/monitor.rb', line 229
def cocoapods_bytedance_BusRecord(installer_context)
if ENV['WORKSPACE'] || ENV.has_key?('CI_JOB_NAME')
newComponents = $Recorde.map do |key,value|
component = {
'componentName' => key,
'componentVersion' => value['version']
}
component['componentId'] = value['repoId'] if value['repoId']
component['componentCid'] = value['commit'] if value['commit']
component
end
json = newComponents.to_json
aFile = File.new("pods.json", "w+")
if aFile
aFile.syswrite(json)
end
cmd = "
branch=`git symbolic-ref --short -q HEAD`
commit=`git rev-parse HEAD`
channel=\"#{ENV['channel']}\"
git=`git remote -v |xargs -n 1|egrep 'git' |head -n 1`
curl -X POST \
http://mobile.bytedance.net/inner_mpaas/uploadAppComponent \
-H 'Content-Type: application/json' \
-d \"{ \
\\\"components\\\":`cat pods.json`,\
\\\"commitId\\\" : \\\"$commit\\\",\
\\\"appType\\\" : 1,\
\\\"channel\\\" : \\\"$channel\\\",\
\\\"branch\\\" : \\\"$branch\\\",\
\\\"gitlabUrl\\\" : \\\"$git\\\",\
\\\"JOB_URL\\\" : \\\"$JOB_URL\\\"\
}\"
"
if ENV.has_key?('JOB_NAME')
if !ENV['JOB_NAME'].start_with?('TT_iOS_Static_Project') && !ENV['JOB_NAME'].include?('Demo')
system(cmd)
end
else
system(cmd)
end
end
end
|
#cocoapods_bytedance_ComponentAnalyze(installer_context) ⇒ Object
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
# File 'lib/cocoapods-monitor/command/monitor.rb', line 165
def cocoapods_bytedance_ComponentAnalyze(installer_context)
if ENV['WORKSPACE'] || ENV.has_key?('CI_JOB_NAME')
sandbox_root = File::dirname(installer_context.sandbox_root)
Dir.chdir(sandbox_root) do
lockfile = Pod::Lockfile.from_file(installer_context.sandbox.manifest_path)
if ENV.has_key?('JOB_NAME')
if !ENV['JOB_NAME'].start_with?('TT_iOS_Static_Project') && !ENV['JOB_NAME'].include?('Demo')
analyzeLock(lockfile,sandbox_root)
end
else
analyzeLock(lockfile,sandbox_root)
end
end
end
end
|
#cocoapods_bytedance_SlardarRecord(installer_context) ⇒ Object
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
|
# File 'lib/cocoapods-monitor/command/monitor.rb', line 183
def cocoapods_bytedance_SlardarRecord(installer_context)
if ENV['WORKSPACE'] || ENV.has_key?('CI_JOB_NAME')
sandbox_root = File::dirname(installer_context.sandbox_root)
Dir.chdir(sandbox_root) do
pods_git_source = $Recorde
lockfile = Pod::Lockfile.from_file(installer_context.sandbox.manifest_path)
checkout_data = lockfile.send :checkout_options_data
checkout_data.each do |pod_name, hash|
pods_git_source[pod_name] = hash
end
json = pods_git_source.to_json
aFile = File.new("pod.json", "w+")
if aFile
aFile.syswrite(json)
end
cmd = "
root=`git rev-parse --show-toplevel`
cd $root
curl -o ParseProjectFileMap http://tosv.byted.org/obj/iosbinary/bd_pod_extentions/6.3.0/ParseProjectFileMap
chmod 777 ParseProjectFileMap
find ./ -type f|egrep -v \".svn|.git|.png|.plist|.strings\" > context.txt
commit=`git rev-parse HEAD`
git=`git remote -v |xargs -n 1|egrep 'git' |head -n 1`
./ParseProjectFileMap $root/context.txt #{sandbox_root}/pod.json $git $commit
if [[ $? -ne 0 ]]; then
curl -X GET -G --data-urlencode \"text=$git\" --data-urlencode \"username=wusizhen.arch\" \"https://ios.bytedance.net/wlapi/sendMessage\"
fi
"
if ENV.has_key?('JOB_NAME')
if !ENV['JOB_NAME'].start_with?('TT_iOS_Static_Project') && !ENV['JOB_NAME'].include?('Demo')
system(cmd)
end
else
system(cmd)
end
end
end
end
|