podsorz 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,700 @@
1
+ require "podsorz/util/logger"
2
+ require "podsorz/util/git_operator"
3
+
4
+ module PodsOrz
5
+
6
+ class PodsGitOperator
7
+ attr_accessor :kx_pods_path, :app_release_version, :author_suffix, :git_operator
8
+
9
+ def initialize(kx_pods_path, app_release_version, author_suffix)
10
+ @kx_pods_path = kx_pods_path
11
+ @app_release_version = app_release_version
12
+ @author_suffix = author_suffix
13
+
14
+ @git_operator = PodsOrz::GitOperator.new()
15
+ end
16
+
17
+ def get_pod_file_path(pod)
18
+ pod_file_path = File.expand_path(pod, @kx_pods_path)
19
+
20
+ pod_file_path
21
+ end
22
+
23
+ def switch_develop_pod(pod)
24
+ previous_branch = self.current_pod_branch(pod)
25
+ next_branch = "develop"
26
+
27
+ is_ready = true
28
+ is_same = previous_branch.include? next_branch
29
+ if !is_same
30
+ #diff branch
31
+ is_ready = check_prepare_work(pod)
32
+ if is_ready
33
+ #switch to develop, auto fetch latest
34
+ self.ensure_develop_branch(pod)
35
+ end
36
+ end
37
+
38
+ is_ready
39
+ end
40
+
41
+ def switch_feature_pod(pod)
42
+ previous_branch = self.current_pod_branch(pod)
43
+ next_branch = "feature/" + "#{@author_suffix}" + "_#{@app_release_version}"
44
+
45
+ is_ready = true
46
+ is_same = previous_branch.include? next_branch
47
+ if !is_same
48
+ #diff branch
49
+ is_ready = check_prepare_work(pod)
50
+ if is_ready
51
+ pod_file_path = File.expand_path(pod, @kx_pods_path)
52
+ has_branch = @git_operator.has_branch(pod_file_path, next_branch)
53
+ if has_branch
54
+ @git_operator.checkout(pod_file_path, next_branch)
55
+ else
56
+ #feature new
57
+ self.ensure_develop_branch(pod)
58
+
59
+ feature_cmd_list = []
60
+ feature_cmd_list << "cd #{pod_file_path}"
61
+ feature_cmd_list << "git checkout -b #{next_branch}"
62
+
63
+ io_lines = []
64
+ IO.popen(feature_cmd_list.join(";")) do |io|
65
+ io_lines = io.readlines
66
+ io_lines.each do |line|
67
+ puts line
68
+ end
69
+ io.close
70
+ end
71
+ end
72
+
73
+ end
74
+ end
75
+
76
+ is_ready
77
+ end
78
+
79
+ def switch_release_pod(pod)
80
+ previous_branch = self.current_pod_branch(pod)
81
+ next_branch = "release/" + "#{@app_release_version}"
82
+
83
+ is_ready = true
84
+ is_same = previous_branch.include? next_branch
85
+ if !is_same
86
+ #diff branch
87
+ is_ready = check_prepare_work(pod)
88
+ if is_ready
89
+ pod_file_path = File.expand_path(pod, @kx_pods_path)
90
+ has_branch = @git_operator.has_branch(pod_file_path, next_branch)
91
+ if has_branch
92
+ @git_operator.checkout(pod_file_path, next_branch)
93
+ else
94
+ #release new
95
+ self.ensure_develop_branch(pod)
96
+
97
+ release_cmd_list = []
98
+ release_cmd_list << "cd #{pod_file_path}"
99
+ release_cmd_list << "git checkout -b #{next_branch}"
100
+ release_cmd_list << "git push -u origin #{next_branch}"
101
+
102
+ io_lines = []
103
+ IO.popen(release_cmd_list.join(";")) do |io|
104
+ io_lines = io.readlines
105
+ io_lines.each do |line|
106
+ puts line
107
+ end
108
+ io.close
109
+ end
110
+ end
111
+ end
112
+ end
113
+
114
+ is_ready
115
+ end
116
+
117
+ def switch_bugfix_pod(pod)
118
+ previous_branch = self.current_pod_branch(pod)
119
+ next_branch = "bugfix/" + "#{@author_suffix}" + "_#{@app_release_version}"
120
+
121
+ is_ready = true
122
+ is_same = previous_branch.include? next_branch
123
+ if !is_same
124
+ #diff branch
125
+ is_ready = check_prepare_work(pod)
126
+ if is_ready
127
+ pod_file_path = File.expand_path(pod, @kx_pods_path)
128
+ has_branch = @git_operator.has_branch(pod_file_path, next_branch)
129
+ if has_branch
130
+ @git_operator.checkout(pod_file_path, next_branch)
131
+ else
132
+ #bugfix new
133
+ release_branch = "release/" + "#{@app_release_version}"
134
+ has_release_branch = @git_operator.has_branch(pod_file_path, release_branch)
135
+ if has_release_branch
136
+ bugfix_cmd_list = []
137
+ bugfix_cmd_list << "cd #{pod_file_path}"
138
+ bugfix_cmd_list << "git checkout #{release_branch}" unless previous_branch.include? release_branch
139
+ bugfix_cmd_list << "git fetch origin #{release_branch}"
140
+ bugfix_cmd_list << "git reset --hard origin/#{release_branch}"
141
+ bugfix_cmd_list << "git checkout -b #{next_branch}"
142
+
143
+ io_lines = []
144
+ IO.popen(bugfix_cmd_list.join(";")) do |io|
145
+ io_lines = io.readlines
146
+ io_lines.each do |line|
147
+ puts line
148
+ end
149
+ io.close
150
+ end
151
+ else
152
+ Logger.error("【#{pod}】not exist release branch: #{release_branch}")
153
+ is_ready = false
154
+ end
155
+ end
156
+
157
+ end
158
+ end
159
+
160
+ is_ready
161
+ end
162
+
163
+ def current_pod_branch(pod)
164
+ pod_file_path = File.expand_path(pod, @kx_pods_path)
165
+ branch = @git_operator.current_branch(pod_file_path)
166
+
167
+ branch
168
+ end
169
+
170
+ def check_prepare_work(pod)
171
+ is_ready = true
172
+
173
+ pod_file_path = File.expand_path(pod, @kx_pods_path)
174
+ current_branch = self.current_pod_branch(pod)
175
+
176
+ has_changes = @git_operator.has_changes(pod_file_path)
177
+ if has_changes
178
+ Logger.error("【#{pod}】 on branch: \"#{current_branch}\" has unstaged/uncommit changes, please staged and commit local first")
179
+ is_ready = false
180
+
181
+ return is_ready
182
+ end
183
+
184
+
185
+ has_commits_unpush = false
186
+ has_remote_branch = @git_operator.has_remote_branch(pod_file_path, current_branch)
187
+ unless has_remote_branch
188
+ Logger.warning("【#{pod}】 on branch: \'#{current_branch}\' is local branch, please do not forget to push remote in future.")
189
+ else
190
+ check_cmd_list = []
191
+ check_cmd_list << "cd #{pod_file_path}"
192
+ check_cmd_list << "git log --left-right #{current_branch}...origin/#{current_branch} --pretty=oneline"
193
+ io_lines = []
194
+ local_commits = []
195
+ IO.popen(check_cmd_list.join(";")) do |io|
196
+ io_lines = io.readlines
197
+ io_lines.each do |line|
198
+ if line.include? "<"
199
+ has_commits_unpush = true
200
+ local_commits << line
201
+ end
202
+ end
203
+
204
+ io.close
205
+ end
206
+
207
+ if has_commits_unpush
208
+ Logger.separator
209
+ local_commits.each do |line|
210
+ puts line
211
+ end
212
+ Logger.separator
213
+
214
+ is_develop = current_branch.include? "develop"
215
+ is_release = current_branch.include? "release/"
216
+ if is_develop || is_release
217
+ Logger.error("【#{pod}】on branch: \'#{current_branch}\' forbidden local commit which will be reset hard by other operation.Please manual 'git checkout #{current_branch};git push' first")
218
+ is_ready = false
219
+ else
220
+ Logger.warning("【#{pod}】on branch: \'#{current_branch}\' has local commits that not push remote, please do not forget to push remote in future.")
221
+ end
222
+
223
+ end
224
+ end
225
+
226
+ is_ready
227
+ end
228
+
229
+ def ensure_develop_branch(pod)
230
+ pod_file_path = File.expand_path(pod, @kx_pods_path)
231
+ has_branch = @git_operator.has_branch(pod_file_path, "develop")
232
+ current_branch = self.current_pod_branch(pod)
233
+
234
+ if !has_branch
235
+ #develop new
236
+ Logger.warning("\"#{pod}\" do not have develop branch, current branch is: \"#{current_branch}\", generate develop...")
237
+
238
+ develop_cmd_list = []
239
+ develop_cmd_list << "cd #{pod_file_path}"
240
+ develop_cmd_list << "git checkout master" unless current_branch.include? "master"
241
+ develop_cmd_list << "git fetch origin master"
242
+ develop_cmd_list << "git reset --hard origin/master"
243
+ develop_cmd_list << "git checkout -b develop"
244
+ develop_cmd_list << "git push -u origin develop"
245
+
246
+ io_lines = []
247
+ IO.popen(develop_cmd_list.join(";")) do |io|
248
+ io_lines = io.readlines
249
+ io_lines.each do |line|
250
+ puts line
251
+ end
252
+ io.close
253
+ end
254
+
255
+ else
256
+ #fetch develop force
257
+ Logger.warning("\"#{pod}\" needs to ensure develop latest, forced!")
258
+
259
+ develop_cmd_list = []
260
+ develop_cmd_list << "cd #{pod_file_path}"
261
+ develop_cmd_list << "git checkout develop" unless current_branch.include? "develop"
262
+ develop_cmd_list << "git fetch origin develop"
263
+ develop_cmd_list << "git reset --hard origin/develop"
264
+
265
+ io_lines = []
266
+ IO.popen(develop_cmd_list.join(";")) do |io|
267
+ io_lines = io.readlines
268
+ io_lines.each do |line|
269
+ puts line
270
+ end
271
+ io.close
272
+ end
273
+ end
274
+ end
275
+
276
+ def commit_local(pod)
277
+ pod_file_path = File.expand_path(pod, @kx_pods_path)
278
+ has_changes = @git_operator.has_changes(pod_file_path)
279
+ if has_changes
280
+ Logger.default("请输入【#{pod}】提交的message备注:")
281
+ message = gets
282
+ message = "#{@author_suffix} 默认提交信息" if message.strip.empty?
283
+
284
+ @git_operator.commit(pod_file_path, message)
285
+ else
286
+ current_branch = self.current_pod_branch(pod)
287
+ Logger.default("【#{pod}】 on branch: \"#{current_branch}\" nothing to commit.")
288
+ end
289
+ end
290
+
291
+ def commit_push(pod)
292
+ pod_file_path = File.expand_path(pod, @kx_pods_path)
293
+ current_branch = self.current_pod_branch(pod)
294
+
295
+ is_push_success = true
296
+
297
+ has_remote_branch = @git_operator.has_remote_branch(pod_file_path, current_branch)
298
+ unless has_remote_branch
299
+ @git_operator.push_to_remote(pod_file_path, current_branch)
300
+ return is_push_success
301
+ end
302
+
303
+
304
+ has_conflicts = false
305
+
306
+ pull_cmd_list = []
307
+ pull_cmd_list << "cd #{pod_file_path}"
308
+ pull_cmd_list << "git fetch origin #{current_branch}"
309
+ pull_cmd_list << "git pull --no-ff --no-squash --no-edit"
310
+ pull_io_lines = []
311
+ IO.popen(pull_cmd_list.join(";")) do |io|
312
+ pull_io_lines = io.readlines
313
+ pull_io_lines.each do |line|
314
+ has_conflicts = true if line.include? "Merge conflict"
315
+ end
316
+
317
+ io.close
318
+ end
319
+
320
+ if has_conflicts
321
+ Logger.error("【#{pod}】 on branch: \"#{current_branch}\" Merge conflict, please manual fix conflicts.(fix conflicts and run \"git commit\")(use \"git merge --abort\" to abort the merge)")
322
+ is_push_success = false
323
+ else
324
+ @git_operator.push_to_remote(pod_file_path, current_branch)
325
+ end
326
+
327
+ return is_push_success
328
+ end
329
+
330
+ def commit_notify(pod)
331
+ is_push_success = true
332
+
333
+ current_branch = self.current_pod_branch(pod)
334
+
335
+ #develop & release push remote
336
+ is_develop = current_branch.include? "develop"
337
+ is_release = current_branch.include? "release"
338
+
339
+ if is_develop || is_release
340
+
341
+ end
342
+
343
+ #feature
344
+ is_feature = current_branch.include? "feature"
345
+ if is_feature
346
+ is_push_success = self.commit_notify_persional_branch(pod, "develop")
347
+ end
348
+
349
+ #bugfix
350
+ is_bugfix = current_branch.include? "bugfix"
351
+ if is_bugfix
352
+ is_push_success = self.commit_notify_persional_branch(pod, "release")
353
+ end
354
+
355
+ is_push_success
356
+ end
357
+
358
+ def commit_notify_persional_branch(pod, parent_branch)
359
+ base_on_branch = ""
360
+ if parent_branch.include? "develop"
361
+ base_on_branch = "develop"
362
+ else
363
+ base_on_branch = "release/" + "#{@app_release_version}"
364
+ end
365
+
366
+ pod_file_path = File.expand_path(pod, @kx_pods_path)
367
+ current_branch = self.current_pod_branch(pod)
368
+
369
+ is_push_success = true
370
+ has_conflicts = false
371
+
372
+ rebase_cmd_list = []
373
+ rebase_cmd_list << "cd #{pod_file_path}"
374
+ rebase_cmd_list << "git fetch origin #{base_on_branch}"
375
+ rebase_cmd_list << "git rebase origin/#{base_on_branch}"
376
+ rebase_cmd_lines = []
377
+ IO.popen(rebase_cmd_list.join(";")) do |io|
378
+ rebase_cmd_lines = io.readlines
379
+ rebase_cmd_lines.each do |line|
380
+ has_conflicts = true if line.include? "Merge conflict"
381
+ end
382
+
383
+ io.close
384
+ end
385
+
386
+ if has_conflicts
387
+ Logger.error("【#{pod}】 on branch: \"#{current_branch}\" Merge conflict, please manual fix conflicts.(fix conflicts and run \"git rebase --continue\")(use \"git rebase --abort\" to abort the merge)")
388
+ is_push_success = false
389
+ else
390
+ force_push_cmd_list = []
391
+ force_push_cmd_list << "cd #{pod_file_path}"
392
+ force_push_cmd_list << "git push -f -u origin #{current_branch}"
393
+ IO.popen(force_push_cmd_list.join(";")) do |io|
394
+ io.each do |line|
395
+ puts line
396
+ end
397
+
398
+ Logger.highlight("【#{pod}】 on branch: \"#{current_branch}\" push remote success")
399
+ io.close
400
+ end
401
+
402
+ merge_cmd_list = []
403
+ merge_cmd_list << "cd #{pod_file_path}"
404
+ merge_cmd_list << "git checkout #{base_on_branch}"
405
+ merge_cmd_list << "git merge #{current_branch} --no-ff --no-squash --no-edit"
406
+ merge_cmd_list << "git push -u origin #{base_on_branch}"
407
+ IO.popen(merge_cmd_list.join(";")) do |io|
408
+ io.each do |line|
409
+ puts line
410
+ end
411
+
412
+ Logger.highlight("【#{pod}】 on branch: \"#{current_branch}\" Merge into #{base_on_branch} success")
413
+ io.close
414
+ end
415
+
416
+ local_branch_cmd_list = []
417
+ local_branch_cmd_list << "cd #{pod_file_path}"
418
+ local_branch_cmd_list << "git checkout #{current_branch}"
419
+ local_branch_cmd_list << "git push origin --delete #{current_branch}"
420
+
421
+ IO.popen(local_branch_cmd_list.join(";")) do |io|
422
+ io.each do |line|
423
+ puts line
424
+ end
425
+
426
+ Logger.highlight("【#{pod}】 on branch: \"#{current_branch}\" has deleted remote branch")
427
+ io.close
428
+ end
429
+ end
430
+
431
+ return is_push_success
432
+ end
433
+
434
+ def commit_version_increase(pod, version)
435
+ pod_file_path = File.expand_path(pod, @kx_pods_path)
436
+ message = "#{pod} version increase to \'#{version}\'"
437
+ @git_operator.commit(pod_file_path, message)
438
+
439
+ is_commit_success = self.commit_push(pod)
440
+
441
+ is_commit_success
442
+ end
443
+
444
+ def clear_modify_pod(pod)
445
+ pod_file_path = File.expand_path(pod, @kx_pods_path)
446
+ current_branch = self.current_pod_branch(pod)
447
+
448
+ clear_cmd_list = []
449
+ clear_cmd_list << "cd #{pod_file_path}"
450
+ clear_cmd_list << "git checkout ."
451
+ IO.popen(clear_cmd_list.join(";")) do |io|
452
+ Logger.default("#{pod} on branch is clear")
453
+ io.close
454
+ end
455
+ end
456
+
457
+ #Publish
458
+
459
+ def has_new_publish(pod)
460
+ is_new_content = true
461
+
462
+ is_new_content = is_publish_ready(pod)
463
+ return is_new_content unless is_new_content
464
+
465
+
466
+ pod_file_path = File.expand_path(pod, @kx_pods_path)
467
+ current_branch = self.current_pod_branch(pod)
468
+
469
+ fetch_cmd_list = []
470
+ fetch_cmd_list << "cd #{pod_file_path}"
471
+ fetch_cmd_list << "git fetch origin master"
472
+ IO.popen(fetch_cmd_list.join(";")) do |io|
473
+ io.each do |line|
474
+ puts line
475
+ end
476
+ io.close
477
+ end
478
+
479
+ diff_lines_list = []
480
+ diff_lines_list = @git_operator.compare_branch(pod_file_path, current_branch, "origin/master")
481
+
482
+ if diff_lines_list.empty?
483
+ is_new_content = false
484
+ return is_new_content
485
+ end
486
+
487
+ is_new_content = false
488
+
489
+ Logger.warning("#{pod} on branch:\'#{current_branch}\' -- compare branch:\'origin/master\'")
490
+
491
+ should_show_detail = true
492
+ limit_count = 10
493
+
494
+ if diff_lines_list.size > limit_count
495
+ Logger.default("不同 commit 较多,是否显示全部 commit ?选择输入:[yes / no]")
496
+ input_choose = gets
497
+ unless input_choose.downcase.include? "yes"
498
+ should_show_detail = false
499
+ end
500
+ end
501
+
502
+ diff_lines_list.each do |line|
503
+ limit_count = limit_count -1 unless should_show_detail
504
+
505
+ puts line if limit_count >= 0
506
+
507
+ is_new_content = true if line.strip.chomp.include? "<"
508
+ end
509
+
510
+ is_new_content
511
+ end
512
+
513
+ def is_publish_ready(pod)
514
+ is_ready = true
515
+
516
+ #has un-staged un-cached
517
+ is_ready = check_prepare_work(pod)
518
+ return is_ready unless is_ready
519
+
520
+ #fetch latest
521
+ pod_file_path = File.expand_path(pod, @kx_pods_path)
522
+ current_branch = self.current_pod_branch(pod)
523
+
524
+ unless current_branch.include? "release"
525
+ Logger.error("【#{pod}】current branch: #{current_branch}, is not release branch!")
526
+ is_ready = false
527
+ return is_ready
528
+ end
529
+
530
+ is_ready
531
+ end
532
+
533
+ def publish_merge(pod)
534
+ is_merge_success = true
535
+
536
+ is_merge_success = is_publish_ready(pod)
537
+ return is_merge_success unless is_merge_success
538
+
539
+ double_check_alert(pod)
540
+
541
+ pod_file_path = File.expand_path(pod, @kx_pods_path)
542
+ current_branch = self.current_pod_branch(pod)
543
+
544
+ fetch_cmd_list = []
545
+ fetch_cmd_list << "cd #{pod_file_path}"
546
+ fetch_cmd_list << "git fetch origin #{current_branch}"
547
+ fetch_cmd_list << "git reset --hard origin/#{current_branch}"
548
+ IO.popen(fetch_cmd_list.join(";")) do |io|
549
+ io.each do |line|
550
+ puts line
551
+ end
552
+ io.close
553
+ end
554
+
555
+ is_merge_success = publish_merge_branch(pod, "master", current_branch)
556
+ return is_merge_success unless is_merge_success
557
+
558
+ is_merge_success = publish_merge_branch(pod, "develop", current_branch)
559
+
560
+ is_merge_success
561
+ end
562
+
563
+ def double_check_alert(pod)
564
+ Logger.warning("【#{pod}】 即将提交合并到主干分支,请再次确认无异常,选择输入:[continue / stop]")
565
+ force_fetch_input = gets
566
+ if force_fetch_input.downcase.include? "stop"
567
+ Logger.error("【#{pod}】中止,程序已停止")
568
+ exit()
569
+ end
570
+
571
+ unless force_fetch_input.downcase.include? "continue"
572
+ double_check_alert(pod)
573
+ end
574
+ end
575
+
576
+ def publish_merge_branch(pod, into_branch, from_branch)
577
+ is_merge_success = true
578
+ pod_file_path = File.expand_path(pod, @kx_pods_path)
579
+
580
+ merge_cmd_list = []
581
+ merge_cmd_list << "cd #{pod_file_path}"
582
+ merge_cmd_list << "git checkout #{into_branch}"
583
+ merge_cmd_list << "git fetch origin #{into_branch}"
584
+ merge_cmd_list << "git reset --hard origin/#{into_branch}"
585
+ merge_cmd_list << "git merge #{from_branch} --no-ff --no-squash --no-edit"
586
+
587
+ merge_cmd_lines = []
588
+ has_conflicts = false
589
+ IO.popen(merge_cmd_list.join(";")) do |io|
590
+ merge_cmd_lines = io.readlines
591
+ merge_cmd_lines.each do |line|
592
+ has_conflicts = true if line.include? "Merge conflict"
593
+ end
594
+
595
+ io.close
596
+ end
597
+
598
+ if has_conflicts
599
+ Logger.error("【#{pod}】 on branch: \"#{into_branch}\" Merge conflict, please manual fix conflicts.(fix conflicts and run \"git commit\")(use \"git merge --abort\" to abort the merge)")
600
+ is_merge_success = false
601
+ return is_merge_success
602
+ end
603
+
604
+ push_cmd_list = []
605
+ push_cmd_list << "cd #{pod_file_path}"
606
+ push_cmd_list << "git push -u origin #{into_branch}"
607
+ IO.popen(push_cmd_list.join(";")) do |io|
608
+ io.each do |line|
609
+ puts line
610
+ end
611
+
612
+ Logger.highlight("【#{pod}】from:#{from_branch} merge into branch: #{into_branch} success")
613
+ io.close
614
+ end
615
+
616
+ is_merge_success
617
+ end
618
+
619
+ def add_pod_tag(pod, version_num)
620
+ is_add_success = true
621
+ pod_file_path = File.expand_path(pod, @kx_pods_path)
622
+
623
+ tag_list = @git_operator.tag_list(pod_file_path)
624
+
625
+ has_tag = false
626
+ tag_list.each do |tag|
627
+ has_tag = true if tag.to_s.include? version_num
628
+ end
629
+
630
+ if has_tag
631
+ Logger.error("\'#{pod}\' -> #{version_num} git tag is exist, please increase #{pod}.podspec version number")
632
+ is_add_success = false
633
+ return is_add_success
634
+ end
635
+
636
+ tag_cmd_list = []
637
+ tag_cmd_list << "cd #{pod_file_path}"
638
+ tag_cmd_list << "git tag #{version_num}"
639
+ tag_cmd_list << "git push origin #{version_num}"
640
+ IO.popen(tag_cmd_list.join(";")) do |io|
641
+ io.each do |line|
642
+ puts line
643
+ end
644
+
645
+ Logger.highlight("\'#{pod}\' -> :#{version_num} tag add success")
646
+ io.close
647
+ end
648
+
649
+ is_add_success
650
+
651
+ end
652
+
653
+ def delete_pod_tag(pod, version_num)
654
+ is_delete_success = true
655
+ pod_file_path = File.expand_path(pod, @kx_pods_path)
656
+
657
+ tag_list = @git_operator.tag_list(pod_file_path)
658
+ has_tag = false
659
+ tag_list.each do |tag|
660
+ has_tag = true if tag.to_s.include? version_num
661
+ end
662
+
663
+ unless has_tag
664
+ Logger.warning("#{tag_list}, #{version_num} delete 1")
665
+ Logger.warning("\'#{pod}\' -> #{version_num} git tag is not exist, nothing needs to delete")
666
+ return is_delete_success
667
+ end
668
+
669
+ tag_cmd_list = []
670
+ tag_cmd_list << "cd #{pod_file_path}"
671
+ tag_cmd_list << "git tag -d #{version_num}"
672
+ tag_cmd_list << "git push origin -d #{version_num}"
673
+ IO.popen(tag_cmd_list.join(";")) do |io|
674
+ io.each do |line|
675
+ puts line
676
+ end
677
+
678
+ Logger.highlight("\'#{pod}\' -> :#{version_num} tag delete success")
679
+ io.close
680
+ end
681
+
682
+ is_delete_success
683
+ end
684
+
685
+ def get_pod_git_tag(pod)
686
+ git_tag = "0.0.0"
687
+
688
+ pod_file_path = File.expand_path(pod, @kx_pods_path)
689
+
690
+ tag_list = @git_operator.tag_list(pod_file_path)
691
+
692
+ return git_tag if tag_list.empty?
693
+
694
+ git_tag = tag_list.first.to_s
695
+
696
+ git_tag
697
+ end
698
+ end
699
+
700
+ end