podsorz 0.0.5 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1c41db9afd0aa8e6264d04ce0583b22ea435fce9f86295a60509cd759071eae1
4
- data.tar.gz: 01afb0a6bf59631a3f0c8e47fa0d36d4dbfb119c2dc17447ede0f79ef4003b07
3
+ metadata.gz: 728879be777d0fc735cb208e256f5397a4930a712ae2da103fdf971698cde73c
4
+ data.tar.gz: 49e47437e30d2dbfa2ac8984ff0c8370e772c527c493183e0c6edd253ffc0797
5
5
  SHA512:
6
- metadata.gz: 31bc8b0be37e5e8c5698ad989be1f20742a9d226ea8a969bd066014c2d2284bdb0da57fd8263e0b47994bace9087a69bcce853283107a4f1321a7bfd76c4dd59
7
- data.tar.gz: ed59b60eabcff8c0d0b5370ad1d2a40f096fe726ee8b0f6e5775b1fb788d433fa5374f7d19c3f772a37d6e96b82460f47638e69da8d78e90bdcfb8f32347a747
6
+ metadata.gz: 3627912e4815e19f3ac624017c952a581c9909d57140316e258f5d8e8162fd216fd67f45e1aca4221efcc1325a2223481e8ca7408e6773ac69545ec6d0ca7c9a
7
+ data.tar.gz: aa28aaafbbe094033e71380bde262f01b9401fa2ee5a15b9e73f1a2b8d5fd266da70a0dda2ba79040032b8d9348ad912828fe0cd703266f904ea91ac888d9811
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/Gemfile CHANGED
@@ -4,3 +4,13 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  # Specify your gem's dependencies in podsorz.gemspec
6
6
  gemspec
7
+ gem "rspec"
8
+
9
+ group :development do
10
+ gem 'bacon'
11
+ gem 'mocha-on-bacon'
12
+ gem 'mocha'
13
+ gem 'prettybacon'
14
+ gem 'coveralls', :require => false
15
+ gem 'rubocop'
16
+ end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- podsorz (0.0.3)
4
+ podsorz (0.0.8)
5
5
  cocoapods
6
6
  cocoapods-packager
7
7
  colorize
@@ -21,7 +21,9 @@ GEM
21
21
  algoliasearch (1.27.5)
22
22
  httpclient (~> 2.8, >= 2.8.3)
23
23
  json (>= 1.5.1)
24
+ ast (2.4.2)
24
25
  atomos (0.1.3)
26
+ bacon (1.2.0)
25
27
  claide (1.0.3)
26
28
  cocoapods (1.10.1)
27
29
  addressable (~> 2.6)
@@ -54,7 +56,7 @@ GEM
54
56
  cocoapods-deintegrate (1.0.4)
55
57
  cocoapods-downloader (1.4.0)
56
58
  cocoapods-packager (1.5.0)
57
- cocoapods (>= 1.1.1, < 2.0)
59
+ cocoapods (>= 1.7.3, < 2.0)
58
60
  cocoapods-plugins (1.0.0)
59
61
  nap
60
62
  cocoapods-search (1.0.0)
@@ -65,6 +67,14 @@ GEM
65
67
  colored2 (3.1.2)
66
68
  colorize (0.8.1)
67
69
  concurrent-ruby (1.1.8)
70
+ coveralls (0.8.23)
71
+ json (>= 1.8, < 3)
72
+ simplecov (~> 0.16.1)
73
+ term-ansicolor (~> 1.3)
74
+ thor (>= 0.19.4, < 2.0)
75
+ tins (~> 1.6)
76
+ diff-lcs (1.4.4)
77
+ docile (1.3.5)
68
78
  escape (0.0.4)
69
79
  ethon (0.12.0)
70
80
  ffi (>= 1.3.0)
@@ -78,17 +88,65 @@ GEM
78
88
  concurrent-ruby (~> 1.0)
79
89
  json (2.5.1)
80
90
  minitest (5.14.4)
91
+ mocha (1.12.0)
92
+ mocha-on-bacon (0.2.3)
93
+ mocha (>= 0.13.0)
81
94
  molinillo (0.6.6)
82
95
  nanaimo (0.3.0)
83
96
  nap (1.1.0)
84
97
  netrc (0.11.0)
98
+ parallel (1.20.1)
99
+ parser (3.0.0.0)
100
+ ast (~> 2.4.1)
101
+ prettybacon (0.0.2)
102
+ bacon (~> 1.2)
85
103
  public_suffix (4.0.6)
104
+ rainbow (3.0.0)
105
+ regexp_parser (2.1.1)
106
+ rexml (3.2.4)
107
+ rspec (3.10.0)
108
+ rspec-core (~> 3.10.0)
109
+ rspec-expectations (~> 3.10.0)
110
+ rspec-mocks (~> 3.10.0)
111
+ rspec-core (3.10.1)
112
+ rspec-support (~> 3.10.0)
113
+ rspec-expectations (3.10.1)
114
+ diff-lcs (>= 1.2.0, < 2.0)
115
+ rspec-support (~> 3.10.0)
116
+ rspec-mocks (3.10.2)
117
+ diff-lcs (>= 1.2.0, < 2.0)
118
+ rspec-support (~> 3.10.0)
119
+ rspec-support (3.10.2)
120
+ rubocop (1.11.0)
121
+ parallel (~> 1.10)
122
+ parser (>= 3.0.0.0)
123
+ rainbow (>= 2.2.2, < 4.0)
124
+ regexp_parser (>= 1.8, < 3.0)
125
+ rexml
126
+ rubocop-ast (>= 1.2.0, < 2.0)
127
+ ruby-progressbar (~> 1.7)
128
+ unicode-display_width (>= 1.4.0, < 3.0)
129
+ rubocop-ast (1.4.1)
130
+ parser (>= 2.7.1.5)
86
131
  ruby-macho (1.4.0)
132
+ ruby-progressbar (1.11.0)
133
+ simplecov (0.16.1)
134
+ docile (~> 1.1)
135
+ json (>= 1.8, < 3)
136
+ simplecov-html (~> 0.10.0)
137
+ simplecov-html (0.10.2)
138
+ sync (0.5.0)
139
+ term-ansicolor (1.7.1)
140
+ tins (~> 1.0)
141
+ thor (1.1.0)
87
142
  thread_safe (0.3.6)
143
+ tins (1.28.0)
144
+ sync
88
145
  typhoeus (1.4.0)
89
146
  ethon (>= 0.9.0)
90
147
  tzinfo (1.2.9)
91
148
  thread_safe (~> 0.1)
149
+ unicode-display_width (2.0.0)
92
150
  xcodeproj (1.19.0)
93
151
  CFPropertyList (>= 2.3.3, < 4.0)
94
152
  atomos (~> 0.1.3)
@@ -100,7 +158,14 @@ PLATFORMS
100
158
  ruby
101
159
 
102
160
  DEPENDENCIES
161
+ bacon
162
+ coveralls
163
+ mocha
164
+ mocha-on-bacon
103
165
  podsorz!
166
+ prettybacon
167
+ rspec
168
+ rubocop
104
169
 
105
170
  BUNDLED WITH
106
171
  1.17.2
data/Podfile ADDED
File without changes
data/lib/podsorz.rb CHANGED
@@ -8,6 +8,8 @@ require "podsorz/command/publish"
8
8
  require "podsorz/command/sync"
9
9
  require "podsorz/command/binary"
10
10
  require "podsorz/command/install"
11
+ require "podsorz/command/check"
12
+ require "podsorz/command/sort"
11
13
 
12
14
  require 'gli'
13
15
 
@@ -40,6 +42,8 @@ module PodsOrz
40
42
  install_command()
41
43
  sync_command()
42
44
  binary_command()
45
+ check_command()
46
+ sort_command()
43
47
 
44
48
  desc "Show podsorz version"
45
49
  command :version do |version|
@@ -0,0 +1,28 @@
1
+ # require "podsorz/core/PodsOrz/pods_check_merge"
2
+ # require "../../PodsOrz/lib/podsorz/core/PodsOrz/pods_check_merge.rb"
3
+ require "podsorz/core/PodsOrz/pods_check_merge"
4
+
5
+ module PodsOrz
6
+ def self.check_command
7
+ desc "Check Pods not merge"
8
+ command :check do |check|
9
+ check.action do |global_options, options, args|
10
+ dir_path = global_options[:path]
11
+
12
+ is_directory = File.directory?(dir_path)
13
+
14
+ unless is_directory
15
+ Logger.error("Check failure, it is not a directory path: #{dir_path}")
16
+ exit()
17
+ end
18
+
19
+ kx_pods_path = File.expand_path("../kx_pods", dir_path)
20
+ # puts "kx_pods_path #{kx_pods_path}"
21
+ checkManger = PodsOrz::PodsCheckMerge.new()
22
+ checkManger.branchList(kx_pods_path)
23
+
24
+ end
25
+ end
26
+ end
27
+
28
+ end
@@ -0,0 +1,33 @@
1
+ require "podsorz/core/PodsOrz/pods_sort"
2
+ require "podsorz/core/Config/pod_orzconfig_parse"
3
+
4
+ module PodsOrz
5
+ def self.sort_command
6
+ desc "Prioritize the pods to be released and check for loops. Output the number of dependency"
7
+ command :sort do |sort|
8
+ sort.action do |global_options, options, args|
9
+ dir_path = global_options[:path]
10
+
11
+ is_directory = File.directory?(dir_path)
12
+
13
+ unless is_directory
14
+ Logger.error("Check failure, it is not a directory path: #{dir_path}")
15
+ exit()
16
+ end
17
+
18
+ kx_pods_path = File.expand_path("../kx_pods", dir_path)
19
+ @orzconfig_parse = PodsOrz::PodOrzconfigParse.new(dir_path)
20
+ pods_list = @orzconfig_parse.fix_pod_list
21
+ if pods_list.empty?
22
+ Logger.warning("fix_pods is empty nothing to do")
23
+ else
24
+ pods_sort = PodsOrz::PodsSort.new()
25
+ pods_list = pods_sort.sort(pods_list,kx_pods_path)
26
+
27
+ end
28
+
29
+ end
30
+ end
31
+ end
32
+
33
+ end
@@ -82,7 +82,7 @@ module PodsOrz
82
82
  binary_result = File.directory?(@kx_binary_path)
83
83
  unless binary_result
84
84
  Logger.warning("kx_binary directory not exist, generate default 'kx_binary' directory")
85
- Dir.mkdir(@kx_pods_path)
85
+ Dir.mkdir(@kx_binary_path)
86
86
  end
87
87
  end
88
88
  end
@@ -1,33 +1,31 @@
1
1
  module GitConfig
2
2
  #App 当前版本
3
- APP_RELEASE_VERSION = "2.0.8"
3
+ APP_RELEASE_VERSION = "2.0.12"
4
4
 
5
5
  #作者姓名xiangqi简写
6
6
  BRANCH_AUTHOR_SUFFIX = "xq"
7
7
  end
8
8
 
9
9
  #想要开发修改的的Pod
10
- $FIX_POD_LIST = [
10
+ $FIX_POD_LIST = [
11
11
  # "KXModuleOrz",
12
12
  # "KXModuleQuestionRepo",
13
- ]
13
+ ]
14
14
 
15
15
 
16
16
 
17
17
  #------Binary Static library------#
18
-
19
18
  #是否全部Pod以二进制静态库加载,false代表以源码显示【打包机】请用源码
20
- $is_all_binary = false
21
- #当is_all_binary = false 显示源码时,仍然希望部分Pod二进制静态库加载
22
- $static_lib_list = [
23
- # "AFNetworking",
24
- ]
25
-
26
-
19
+ $is_all_binary = false
20
+ #当is_all_binary = false 所有pod即将显示源码时,仍然希望部分Pod二进制静态库加载
21
+ $static_lib_list = [
22
+ # "AFNetworking",
23
+ ]
27
24
 
28
25
  #------Package Action------#
26
+ #当is_all_binary = false 并不是针对所有pod 打binary包,仍然希望部分pod打包成二进制静态库的Pod
27
+ $will_package_list = [
28
+ # "AFNetworking",
29
+ ]
29
30
 
30
- #即将要进行打包成二进制静态库的Pod
31
- $will_package_list = [
32
- # "AFNetworking",
33
- ]
31
+ #
@@ -41,7 +41,7 @@ module PodsOrz
41
41
  file_name = File.basename(file_path)
42
42
  directory = File.dirname(file_path)
43
43
  IO.popen("cd #{directory};touch #{file_name}") { |io|
44
- templet_config_path = File.expand_path("../core/orz_config_templet.rb", File.dirname(__FILE__))
44
+ templet_config_path = File.expand_path("./orz_config_templet.rb", File.dirname(__FILE__))
45
45
  File.open(templet_config_path, "r") { |templet_file|
46
46
  File.open(file_path, "w+") { |file|
47
47
  templet_file.readlines.each {|line|
@@ -0,0 +1,160 @@
1
+ require 'open3'
2
+ require 'pathname'
3
+ require "podsorz/util/git_operator"
4
+
5
+ module PodsOrz
6
+
7
+ class PodsCheckMerge
8
+
9
+ # def check_Podfile(filePath)
10
+ # # 返回 path 的绝对路径,扩展 ~ 为进程所有者的主目录,~user 为用户的主目录。相对路径是相对于 dir 指定的目录,如果 dir 被省略则相对于当前工作目录
11
+ # tempPath = File.expand_path("Podfile",filePath)
12
+ # result = File::exist?tempPath
13
+ # if result
14
+ # puts("存在-- #{tempPath}")
15
+ # else
16
+ # puts("不存在-- #{tempPath}")
17
+ # end
18
+ # tempPath
19
+ # end
20
+
21
+ def branchList(path)
22
+ list = []
23
+ # IO.popen("cd '#{path}';git branch -r") do |io|
24
+ # io.each do |line|
25
+ # puts("branch -- #{line}")
26
+ # # has_branch = true if line.include? branch_name
27
+ # end
28
+ # end
29
+
30
+ # Open3.popen3("cd '#{File.dirname(__FILE__ )}';git branch -r"){|stdin, stdout, stderr, wait_thr|
31
+ # while line = stdout.gets
32
+ # puts("branch- #{line}")
33
+ # end
34
+ # }
35
+ # @kx_pods_directory = File.expand_path("../kx_pods", File.dirname(__FILE__))
36
+ # puts "里层 #{@kx_pods_directory}"
37
+
38
+ # kx_pods_path /Users/yuyutao/Desktop/rubyGem/kx_pods
39
+ # 里层 /Library/Ruby/Gems/2.6.0/gems/podsorz-0.0.5/lib/podsorz/core/kx_pods
40
+
41
+ # dir = Dir.open("#{@kx_pods_directory}")
42
+ # while name = dir.read
43
+ # p name
44
+ # end
45
+ # dir.close
46
+
47
+ # @kx_pods_directory = "/Users/yuyutao/Desktop/rubyGem/kx_pods"
48
+
49
+ Dir.open("#{path}") do |dir|
50
+ tempAry = ['.','..']
51
+ dirAry = dir.to_a
52
+ ary = dirAry-tempAry
53
+ ary.each do |name|
54
+ dir_path = "#{path}/#{name}"
55
+ is_directory = File.directory?(dir_path)
56
+
57
+ if is_directory
58
+ localBranch("#{dir_path}",name)
59
+ else
60
+ # puts "#{name} 空文件"
61
+ end
62
+ end
63
+
64
+ end
65
+
66
+
67
+ end
68
+
69
+ # git log -n1 --format=format:"%H"
70
+ def localBranch(filePath,fileName)
71
+
72
+ @git_operator = PodsOrz::GitOperator.new()
73
+ has_changes = @git_operator.has_changes(filePath)
74
+ if has_changes
75
+ branch = @git_operator.current_branch(filePath)
76
+ Logger.error("【#{filePath}】 on branch: \"#{branch}\" has unstaged/uncommit changes, please staged and commit local first")
77
+ return
78
+ end
79
+
80
+ is_merge_all = true
81
+ branch = ""
82
+ Open3.popen3("cd '#{filePath}';git branch -l"){|stdin, stdout, stderr, wait_thr|
83
+ if stdout.gets
84
+ while line = stdout.gets
85
+
86
+ if line.include? "master"
87
+ # puts("master分支-#{fileName}")
88
+ elsif line.include? "develop"
89
+ # puts("develop分支-#{fileName}")
90
+ elsif line.include? "release"
91
+ # puts("release分支-#{fileName}")
92
+ else
93
+ # puts("#{fileName} branch- #{line}")
94
+ branch = line.strip
95
+ if branch.include? "*"
96
+ branch.delete!("*",)
97
+ end
98
+ is_merge_all = git_isMerged("#{branch}",filePath)
99
+ end
100
+
101
+ end
102
+
103
+ else
104
+ # puts("未发现本地分支-#{fileName}")
105
+ end
106
+ }
107
+
108
+ # puts("all commit success!") if is_merge_all
109
+ if is_merge_all
110
+
111
+ puts("check result: all commit success! #{filePath}")
112
+ else
113
+ Logger.warning("#{filePath} - #{branch} commit not merge")
114
+ end
115
+
116
+ end
117
+
118
+ def git_isMerged(branch,path)
119
+ merge_destination_branch = "origin/develop"
120
+ merge_source_branch = "#{branch}"
121
+ merge_base = ""
122
+ merge_current_commit = ""
123
+ is_merge_all = true
124
+ cmd = "cd '#{path}';git merge-base #{merge_destination_branch} #{branch}"
125
+ IO.popen(cmd) do |io|
126
+ io.each do |line|
127
+ if line
128
+ merge_base = line
129
+ else
130
+ puts("git merge-base 无hash值 #{path}")
131
+ end
132
+
133
+ end
134
+
135
+ end
136
+ cmd = "git rev-parse #{branch}"
137
+ IO.popen("cd '#{path}';#{cmd}") do |io|
138
+ io.each do |line|
139
+ if line
140
+ merge_current_commit = line
141
+ else
142
+ puts("git rev-parse 无hash值 #{path}")
143
+ end
144
+
145
+ end
146
+
147
+ end
148
+
149
+ if merge_base == merge_current_commit
150
+
151
+ else
152
+ is_merge_all = false
153
+ end
154
+
155
+ is_merge_all
156
+ end
157
+
158
+ end
159
+
160
+ end
@@ -3,6 +3,7 @@ require "podsorz/core/PodsOrz/pods_git_operator"
3
3
  require "podsorz/core/PodFile/podfile_io"
4
4
  require "podsorz/core/PodsOrz/pods_version"
5
5
  require "podsorz/core/PodsOrz/pods_repo"
6
+ require "podsorz/core/PodsOrz/pods_sort"
6
7
  require 'open3'
7
8
 
8
9
  module PodsOrz
@@ -199,8 +200,8 @@ module PodsOrz
199
200
  end
200
201
 
201
202
 
202
- #1.判断 release 是否存在新的commit内容
203
- newContent_pod_list = filter_newContent_pods()
203
+ #1.判断 release 和master 比较是否存在新的commit内容
204
+ newContent_pod_list = filter_master_newContent()
204
205
 
205
206
  if newContent_pod_list.empty?
206
207
  Logger.warning("All pods do not have new content to publish")
@@ -228,17 +229,37 @@ module PodsOrz
228
229
  #6.Update Podfile_orz
229
230
  update_publish_podfile_orz
230
231
 
231
- #7.Merge into develop
232
+ #7.diff content from develop branch
233
+ newContent_pod_list = filter_develop_newContent()
234
+
235
+ #8.Merge into develop
232
236
  publish_develop_branch(newContent_pod_list)
233
237
  end
234
238
 
235
- def filter_newContent_pods()
239
+ def filter_master_newContent()
236
240
  newContent_pod_list = []
237
241
  #filter action
238
242
  pods_list = @orzconfig_parse.fix_pod_list
239
243
  pods_list.each {|pod|
240
244
  command = Thread.new do
241
- is_new_publish = @pods_git_operator.has_new_publish(pod)
245
+ is_new_publish = @pods_git_operator.has_new_publish(pod, "master")
246
+ newContent_pod_list << pod if is_new_publish
247
+ end
248
+
249
+ command.join
250
+ Logger.separator
251
+ }
252
+
253
+ newContent_pod_list
254
+ end
255
+
256
+ def filter_develop_newContent()
257
+ newContent_pod_list = []
258
+ #filter action
259
+ pods_list = @orzconfig_parse.fix_pod_list
260
+ pods_list.each {|pod|
261
+ command = Thread.new do
262
+ is_new_publish = @pods_git_operator.has_new_publish(pod, "develop")
242
263
  newContent_pod_list << pod if is_new_publish
243
264
  end
244
265
 
@@ -355,8 +376,17 @@ module PodsOrz
355
376
 
356
377
  def pods_repo_push(is_swift)
357
378
  is_push_success = true
358
-
359
379
  pods_list = @orzconfig_parse.fix_pod_list
380
+
381
+ if pods_list.empty?
382
+ Logger.warning("fix_pods is empty nothing to do")
383
+ else
384
+ pods_sort = PodsOrz::PodsSort.new()
385
+ kx_pods_subPath = @pods_git_operator.get_pod_file_path("")
386
+ pods_list = pods_sort.sort(pods_list,kx_pods_subPath)
387
+
388
+ end
389
+
360
390
  pods_list.each {|pod|
361
391
  Logger.default("【#{pod}】check pod_version, git_tag, remote_version...")
362
392
 
@@ -425,7 +425,7 @@ module PodsOrz
425
425
 
426
426
  #Publish
427
427
 
428
- def has_new_publish(pod)
428
+ def has_new_publish(pod, branch_name)
429
429
  is_new_content = true
430
430
 
431
431
  is_new_content = is_publish_ready(pod)
@@ -437,7 +437,7 @@ module PodsOrz
437
437
 
438
438
  fetch_cmd_list = []
439
439
  fetch_cmd_list << "cd #{pod_file_path}"
440
- fetch_cmd_list << "git fetch origin master"
440
+ fetch_cmd_list << "git fetch origin #{branch_name}"
441
441
  IO.popen(fetch_cmd_list.join(";")) do |io|
442
442
  io.each do |line|
443
443
  puts line
@@ -446,16 +446,21 @@ module PodsOrz
446
446
  end
447
447
 
448
448
  diff_lines_list = []
449
- diff_lines_list = @git_operator.compare_branch(pod_file_path, current_branch, "origin/master")
449
+ diff_lines_list = @git_operator.compare_branch(pod_file_path, current_branch, "origin/#{branch_name}")
450
450
 
451
451
  if diff_lines_list.empty?
452
452
  is_new_content = false
453
453
  return is_new_content
454
454
  end
455
455
 
456
+ #filter Merge branch
457
+ diff_lines_list.delete_if {|item|
458
+ item.to_s.include? "Merge branch"
459
+ }
460
+
456
461
  is_new_content = false
457
462
 
458
- Logger.warning("#{pod} on branch:\'#{current_branch}\' -- compare branch:\'origin/master\'")
463
+ Logger.warning("#{pod} on branch:\'#{current_branch}\' -- compare branch:\'origin/#{branch_name}\'")
459
464
 
460
465
  should_show_detail = true
461
466
  limit_count = 10
@@ -190,9 +190,9 @@ module PodsOrz
190
190
  repo_push_cmd = []
191
191
  repo_push_cmd << "cd #{file_path}"
192
192
  if is_swift
193
- repo_push_cmd << "pod repo push #{@repo_name} #{pod}.podspec --sources=#{@repo_url} --allow-warnings --use-libraries --skip-import-validation --use-modular-headers --swift-version=5.0 --skip-tests --platforms=ios"
193
+ repo_push_cmd << "pod repo push #{@repo_name} #{pod}.podspec --sources=#{@repo_url} --allow-warnings --use-libraries --skip-import-validation --use-modular-headers --swift-version=5.0 --skip-tests"
194
194
  else
195
- repo_push_cmd << "pod repo push #{@repo_name} #{pod}.podspec --sources=#{@repo_url} --allow-warnings --use-libraries --skip-import-validation --skip-tests --platforms=ios"
195
+ repo_push_cmd << "pod repo push #{@repo_name} #{pod}.podspec --sources=#{@repo_url} --allow-warnings --use-libraries --skip-import-validation --skip-tests"
196
196
  end
197
197
 
198
198
 
@@ -212,10 +212,9 @@ module PodsOrz
212
212
  unless is_push_success
213
213
  puts error_info
214
214
  Logger.error("Fail: \'#{pod}\':#{pod_version} push repo remote fail")
215
- return is_push_success
215
+ else
216
+ Logger.highlight(%Q(#{pod}:#{pod_version} push repo success))
216
217
  end
217
-
218
- Logger.highlight(%Q(#{pod}:#{pod_version} push repo success))
219
218
  end
220
219
 
221
220
  command.join
@@ -0,0 +1,155 @@
1
+ require 'open3'
2
+ require 'pathname'
3
+
4
+ module PodsOrz
5
+
6
+ class PodsSort
7
+
8
+ def sort(pods_list,kx_pods_subPath)
9
+ # file priority 1 hash
10
+ @@fileHash = {}
11
+ # podspec hash
12
+ @@podspecHash = {}
13
+
14
+ @@filterHash = {}
15
+ pods_list.each { |fileName|
16
+ @@fileHash[fileName] = 1
17
+ }
18
+
19
+ pods_list.each { |fileName|
20
+ filePath = "#{kx_pods_subPath}/#{fileName}"
21
+ is_directory = File.directory?(filePath)
22
+ if is_directory
23
+ spec_with_path("#{filePath}/#{fileName}.podspec",fileName)
24
+ else
25
+ Logger.warning("#{filePath} is an empty file")
26
+ end
27
+ }
28
+ sort_with_hash()
29
+ @resultHash = {}
30
+
31
+ @@filterHash.each { |fileName,array|
32
+ # puts ("#{fileName},#{array}")
33
+ recursive_puts(fileName,array,[fileName])
34
+
35
+ }
36
+
37
+ @@fileHash.each {|file,priority|
38
+ # puts ("#{file} #{priority}")
39
+ if @resultHash.key?(priority)
40
+ array = @resultHash[priority]
41
+ array << file
42
+ @resultHash[priority] = array
43
+ else
44
+ @resultHash[priority] = [file]
45
+ end
46
+ }
47
+ sortList = []
48
+ checkHash = {}
49
+ # puts @resultHash
50
+ @resultHash.sort.sort!.each { |priority,array|
51
+ # puts ("#{priority},#{array}")
52
+ array.each { |line|
53
+ puts ("#{priority} -- #{line}")
54
+ checkHash[line] = priority
55
+ sortList << line
56
+ }
57
+ }
58
+
59
+ sortList.reverse!
60
+
61
+ end
62
+
63
+
64
+ def recursive_puts(key,array,pathArray)
65
+ # pathArray << key
66
+ totalArray = []
67
+ if array.empty?
68
+ # puts ("kong - #{key}")
69
+
70
+ else
71
+ array.each {|line|
72
+ pathArray << line
73
+ priority = @@fileHash[line] + 1
74
+ @@fileHash[line] = priority
75
+ tempArray = @@filterHash[line]
76
+ if tempArray.empty?
77
+ pathArray.pop
78
+ else
79
+
80
+ cycle = false
81
+ tempArray.each {|podsName|
82
+ if pathArray.include?(podsName)
83
+ cycle = true
84
+ Logger.error("path:#{pathArray} pod:#{podsName} has dependence cycle, please fix cycle")
85
+ exit()
86
+ end
87
+ # priorityN = @@fileHash[podsName] + 1
88
+ # puts("次数 podsName #{podsName} #{priorityN}")
89
+ # @@fileHash[podsName] = priorityN
90
+ }
91
+
92
+ if cycle
93
+ #包含
94
+ # puts pathArray
95
+
96
+ else
97
+ # puts ("#{key} #{line} #{pathArray}")
98
+ recursive_puts(line,tempArray,pathArray)
99
+ pathArray.pop
100
+ end
101
+
102
+ end
103
+
104
+ }
105
+
106
+ end
107
+
108
+
109
+ end
110
+
111
+ def sort_with_hash()
112
+
113
+ @@podspecHash.each { |fileName,specArray|
114
+ # puts "#{fileName} #{specArray}"
115
+ tempArray = []
116
+ @@fileHash.each {|file,priority|
117
+
118
+ specArray.each { |line|
119
+ if line.include? "dependency"
120
+
121
+ if line.include? file and file != fileName
122
+
123
+ priority += 1
124
+
125
+ # @@fileHash[file] = priority
126
+ tempArray << file
127
+ # puts "#{fileName},#{file},#{line}"
128
+
129
+ end
130
+ end
131
+ }
132
+
133
+ }
134
+ @@filterHash[fileName] = tempArray
135
+
136
+ }
137
+
138
+ end
139
+
140
+ def spec_with_path(path,fileName)
141
+ return if path.nil?
142
+ path = Pathname.new(path)
143
+ path = Pathname.new(Dir.pwd).join(path) unless path.absolute?
144
+ return unless path.exist?
145
+
146
+ @path = path.expand_path
147
+
148
+ arr = IO.readlines("#{@path}")
149
+ @@podspecHash[fileName] = arr
150
+
151
+ end
152
+
153
+ end
154
+
155
+ end
@@ -1,7 +1,7 @@
1
1
  require 'colorize'
2
2
 
3
3
  module Logger
4
- def self.default(sentence)
4
+ def self.default(sentence)
5
5
  puts format_output(sentence).colorize(:default)
6
6
  end
7
7
 
@@ -1,3 +1,3 @@
1
1
  module PodsOrz
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.10"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: podsorz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xiangqi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-25 00:00:00.000000000 Z
11
+ date: 2021-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gli
@@ -77,18 +77,22 @@ extensions: []
77
77
  extra_rdoc_files: []
78
78
  files:
79
79
  - ".gitignore"
80
+ - ".rspec"
80
81
  - Gemfile
81
82
  - Gemfile.lock
82
83
  - LICENSE.txt
84
+ - Podfile
83
85
  - README.md
84
86
  - Rakefile
85
87
  - bin/podsorz
86
88
  - lib/podsorz.rb
87
89
  - lib/podsorz/command/binary.rb
90
+ - lib/podsorz/command/check.rb
88
91
  - lib/podsorz/command/commit.rb
89
92
  - lib/podsorz/command/install.rb
90
93
  - lib/podsorz/command/publish.rb
91
94
  - lib/podsorz/command/setup.rb
95
+ - lib/podsorz/command/sort.rb
92
96
  - lib/podsorz/command/switch.rb
93
97
  - lib/podsorz/command/sync.rb
94
98
  - lib/podsorz/core/Binary/binary_builder.rb
@@ -100,10 +104,12 @@ files:
100
104
  - lib/podsorz/core/Config/pod_orzconfig_parse.rb
101
105
  - lib/podsorz/core/PodFile/podfile_io.rb
102
106
  - lib/podsorz/core/PodFile/podfile_model.rb
107
+ - lib/podsorz/core/PodsOrz/pods_check_merge.rb
103
108
  - lib/podsorz/core/PodsOrz/pods_detector.rb
104
109
  - lib/podsorz/core/PodsOrz/pods_git_manager.rb
105
110
  - lib/podsorz/core/PodsOrz/pods_git_operator.rb
106
111
  - lib/podsorz/core/PodsOrz/pods_repo.rb
112
+ - lib/podsorz/core/PodsOrz/pods_sort.rb
107
113
  - lib/podsorz/core/PodsOrz/pods_version.rb
108
114
  - lib/podsorz/core/Specs/podspec_model.rb
109
115
  - lib/podsorz/util/git_operator.rb