podsorz 0.0.8 → 0.0.9

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: d8deb47506256b4bef4309f5883e777e7062cceea144e70e506fb301fbb3b424
4
- data.tar.gz: b198d8604d2ea51dae2d735d54a70753e040d1948a485dabc018bea4d7794806
3
+ metadata.gz: 2610efa45ee23db5405e085732c5a468da2a0645d23471b9aa8d078e48eec811
4
+ data.tar.gz: f725d32f596a65c8f21b6da354bb145cc0ada6ad825acdde3dcb36532458d0b5
5
5
  SHA512:
6
- metadata.gz: 68e82ce404af05d8ffbf4368e7b662be5d7072df2b9c2c733685dc2427a6f622b57fa6e08a4c9f32f4313177ab595076297b959dbadea23361559347f0de99f7
7
- data.tar.gz: 534226be5f8aebb0f2124045fe79ee926652548a8fbea633752759a5acef0ca53529f3e53ca6b8772e7d8303064cd820a55abbaf40b923612a508aed3c8437d8
6
+ metadata.gz: 3ff8a612cc714cdf0ebe48003181fbefbe78d0304a934fdf9eab3eb809570d360716e964007d20a467fe69309f1d759fc3c263625aaffb7862f47b3a913686d1
7
+ data.tar.gz: 538edb9292fc7c4ca131d2364f03491945551e6f289451aeed3172059eb965cbeffb53459a762cc384f1ba077c29c6b9ef434a677cbd013b7daefa9197cbe6e1
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
@@ -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)
@@ -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/lib/podsorz.rb CHANGED
@@ -8,7 +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.rb"
11
+ require "podsorz/command/check"
12
+ require "podsorz/command/sort"
12
13
 
13
14
  require 'gli'
14
15
 
@@ -42,6 +43,7 @@ module PodsOrz
42
43
  sync_command()
43
44
  binary_command()
44
45
  check_command()
46
+ sort_command()
45
47
 
46
48
  desc "Show podsorz version"
47
49
  command :version do |version|
@@ -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
@@ -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()
240
+ newContent_pod_list = []
241
+ #filter action
242
+ pods_list = @orzconfig_parse.fix_pod_list
243
+ pods_list.each {|pod|
244
+ command = Thread.new do
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()
236
257
  newContent_pod_list = []
237
258
  #filter action
238
259
  pods_list = @orzconfig_parse.fix_pod_list
239
260
  pods_list.each {|pod|
240
261
  command = Thread.new do
241
- is_new_publish = @pods_git_operator.has_new_publish(pod)
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
+ return
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
@@ -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.8"
2
+ VERSION = "0.0.9"
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.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xiangqi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-11 00:00:00.000000000 Z
11
+ date: 2021-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gli
@@ -82,7 +82,6 @@ files:
82
82
  - Gemfile.lock
83
83
  - LICENSE.txt
84
84
  - Podfile
85
- - PodsOrzConfig.rb
86
85
  - README.md
87
86
  - Rakefile
88
87
  - bin/podsorz
@@ -93,6 +92,7 @@ files:
93
92
  - lib/podsorz/command/install.rb
94
93
  - lib/podsorz/command/publish.rb
95
94
  - lib/podsorz/command/setup.rb
95
+ - lib/podsorz/command/sort.rb
96
96
  - lib/podsorz/command/switch.rb
97
97
  - lib/podsorz/command/sync.rb
98
98
  - lib/podsorz/core/Binary/binary_builder.rb
@@ -109,8 +109,8 @@ files:
109
109
  - lib/podsorz/core/PodsOrz/pods_git_manager.rb
110
110
  - lib/podsorz/core/PodsOrz/pods_git_operator.rb
111
111
  - lib/podsorz/core/PodsOrz/pods_repo.rb
112
+ - lib/podsorz/core/PodsOrz/pods_sort.rb
112
113
  - lib/podsorz/core/PodsOrz/pods_version.rb
113
- - lib/podsorz/core/Specs/check_spec.rb
114
114
  - lib/podsorz/core/Specs/podspec_model.rb
115
115
  - lib/podsorz/util/git_operator.rb
116
116
  - lib/podsorz/util/logger.rb
data/PodsOrzConfig.rb DELETED
@@ -1,31 +0,0 @@
1
- module GitConfig
2
- #App 当前版本
3
- APP_RELEASE_VERSION = "2.0.12"
4
-
5
- #作者姓名xiangqi简写
6
- BRANCH_AUTHOR_SUFFIX = "xq"
7
- end
8
-
9
- #想要开发修改的的Pod
10
- $FIX_POD_LIST = [
11
- # "KXModuleOrz",
12
- # "KXModuleQuestionRepo",
13
- ]
14
-
15
-
16
-
17
- #------Binary Static library------#
18
- #是否全部Pod以二进制静态库加载,false代表以源码显示【打包机】请用源码
19
- $is_all_binary = false
20
- #当is_all_binary = false 所有pod即将显示源码时,仍然希望部分Pod二进制静态库加载
21
- $static_lib_list = [
22
- # "AFNetworking",
23
- ]
24
-
25
- #------Package Action------#
26
- #当is_all_binary = false 并不是针对所有pod 打binary包,仍然希望部分pod打包成二进制静态库的Pod
27
- $will_package_list = [
28
- # "AFNetworking",
29
- ]
30
-
31
- #
@@ -1,46 +0,0 @@
1
- # require File.expand_path('../../lib/yygem/string_calculator', __FILE__)
2
- require "/Users/yuyutao/Desktop/rubyGem/PodsOrz/lib/podsorz/core/PodsOrz/pods_check_merge.rb"
3
- require 'rspec'
4
-
5
- describe PodsCheckMerge do
6
-
7
- describe ".add" do
8
- # context "given an empty string" do
9
- # it "returns zero" do
10
- # expect(StringCalculator.add("")).to eq(0)
11
- # end
12
- # end
13
-
14
- context "given '4'" do
15
- it "returns 4" do
16
- expect(StringCalculator.add("4")).to eql(4)
17
- end
18
- end
19
-
20
- context "given '10'" do
21
- it "returns 10" do
22
- expect(StringCalculator.add("10")).to eql(10)
23
- end
24
- end
25
-
26
- context "two numbers" do
27
- context "given '2,4'" do
28
- # 输出内容 条件成立则绿色输出 否则红色 FAILED - 1 输出
29
- it "returns 6" do
30
- expect(StringCalculator.add("2,4")).to eql(6)
31
- end
32
- end
33
-
34
- context "given '17,100'" do
35
- StringCalculator.add("17,10")
36
- it "returns 117" do
37
- # StringCalculator.add("17,100")
38
- # eql 与写入期望的值进行对比 RSpec 中 eq、eql、be 有不同差别
39
- expect(StringCalculator.add("17,100")).to eql(17)
40
- end
41
- end
42
- end
43
-
44
-
45
- end
46
- end