podsorz 0.0.10 → 0.0.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 728879be777d0fc735cb208e256f5397a4930a712ae2da103fdf971698cde73c
4
- data.tar.gz: 49e47437e30d2dbfa2ac8984ff0c8370e772c527c493183e0c6edd253ffc0797
3
+ metadata.gz: a4917923f5a634c8bf8f212ac3d6621ab13eab6c9442f189bf45143a88a25036
4
+ data.tar.gz: 4a3caaa94b2a16a5a05c2da94901fd18dd4c300a6f8e7239636516f9310a1e61
5
5
  SHA512:
6
- metadata.gz: 3627912e4815e19f3ac624017c952a581c9909d57140316e258f5d8e8162fd216fd67f45e1aca4221efcc1325a2223481e8ca7408e6773ac69545ec6d0ca7c9a
7
- data.tar.gz: aa28aaafbbe094033e71380bde262f01b9401fa2ee5a15b9e73f1a2b8d5fd266da70a0dda2ba79040032b8d9348ad912828fe0cd703266f904ea91ac888d9811
6
+ metadata.gz: bac63452c1fae9ad3d222f33f7b9e302b453431ae86d3578f8ec958364826a6c9a21aabc523925ab0d8160050726cb78549eca3a35905ae5f5b8b24b763f7991
7
+ data.tar.gz: 445fb40a279eb2a916d255b52fde91f6c343abf460673eeae81242c10aaa8b1b894d53100e91c92ede85669adc9a17d9a0bfccc9df90fb89e462e6582a290ca2
@@ -134,10 +134,17 @@ module PodsOrz
134
134
  end
135
135
  end
136
136
 
137
- Logger.highlight("[cmd:#{cmd_type}] Exist static library pods : \n #{exist_binary_list.inspect}")
137
+ Logger.highlight("[cmd:#{cmd_type}] Exist static library pods :")
138
+ exist_binary_list.each do |item|
139
+ puts item.colorize(:green)
140
+ end
141
+
138
142
  Logger.separator
139
- Logger.warning("[cmd:#{cmd_type}] Not exist static library pods: \n #{empty_binary_list.inspect}")
140
143
 
144
+ Logger.warning("[cmd:#{cmd_type}] Not exist static library pods:")
145
+ empty_binary_list.each do |item|
146
+ puts item.colorize(:yellow)
147
+ end
141
148
 
142
149
  result_hash[:binary] = has_binary_list
143
150
  result_hash[:package] = can_package_list
@@ -6,7 +6,7 @@ require "open3"
6
6
 
7
7
  module PodsOrz
8
8
  class BinaryBuilder
9
- attr_accessor :main_path, :kx_binary_path, :podfile_io, :pod_repo, :http_host
9
+ attr_accessor :main_path, :kx_binary_path, :podfile_io, :pod_repo, :http_host, :remote_binary_directory
10
10
 
11
11
  def initialize(main_path, podfile_io)
12
12
  @main_path = main_path
@@ -15,7 +15,8 @@ module PodsOrz
15
15
  @podfile_io = podfile_io
16
16
  @pod_repo = PodsOrz::PodsRepo.new()
17
17
 
18
- @http_host = "http://192.168.6.23:8080"
18
+ @http_host = "http://192.168.6.127:8899"
19
+ @remote_binary_directory = "binary_pod"
19
20
  end
20
21
 
21
22
  def start_package_pod(pod)
@@ -82,7 +83,7 @@ module PodsOrz
82
83
  binary_result = File.directory?(@kx_binary_path)
83
84
  unless binary_result
84
85
  Logger.warning("kx_binary directory not exist, generate default 'kx_binary' directory")
85
- Dir.mkdir(@kx_binary_path)
86
+ FileUtils.mkdir_p(@kx_binary_path, :mode => 0777)
86
87
  end
87
88
  end
88
89
  end
@@ -99,7 +100,7 @@ module PodsOrz
99
100
  pod_result = File.directory?(pod_path)
100
101
  unless pod_result
101
102
  Logger.warning("#{pod_path} directory not exist, generate default '#{pod_path}' directory")
102
- Dir.mkdir(pod_path)
103
+ FileUtils.mkdir_p(pod_path, :mode => 0777)
103
104
  end
104
105
  end
105
106
 
@@ -107,8 +108,8 @@ module PodsOrz
107
108
  pod_version_path = File.expand_path("#{pod}/#{pod_version}", @kx_binary_path)
108
109
  pod_version_result = File.directory?(pod_version_path)
109
110
  unless pod_version_result
110
- Logger.warning("#{pod_version_path} directory not exist, generate default '#{pod_version_path}' directory")
111
- Dir.mkdir(pod_version_path)
111
+ Logger.warning("#{pod_version_path} directory not exist, generate default '#{pod_version_path}' directory")
112
+ FileUtils.mkdir_p(pod_version_path, :mode => 0777)
112
113
  end
113
114
 
114
115
  pod_version_path
@@ -241,7 +242,7 @@ module PodsOrz
241
242
  unless sentence_content.start_with?("#")
242
243
  mt = /.*s.source = /.match(sentence)
243
244
  unless mt.nil?
244
- sentence = mt[0] + "{:http => \'#{http_host}/#{pod}/#{pod_version}/#{pod}.framework.zip\'}"
245
+ sentence = mt[0] + "{:http => \'#{@http_host}/#{remote_binary_directory}/#{pod}/#{pod_version}/#{pod}.framework.zip\'}"
245
246
  end
246
247
 
247
248
  mt = /.*s.ios.vendored_framework = /.match(sentence)
@@ -150,7 +150,11 @@ module PodsOrz
150
150
  dest_dir = @binary_builder.detect_version_directory(pod, pod_version)
151
151
 
152
152
  each_result = @binary_repo.push_binary_remote(pod, dest_dir, pod_version, false)
153
- is_publish_success = false unless each_result
153
+ unless each_result
154
+ is_publish_success = false
155
+ Logger.error("#{pod}(#{pod_version}) publish failure!")
156
+ end
157
+
154
158
  end
155
159
 
156
160
  command.join
@@ -1,14 +1,16 @@
1
1
  require "podsorz/util/logger"
2
2
  require 'open3'
3
+ require "podsorz/core/Binary/binary_server"
3
4
 
4
5
  module PodsOrz
5
6
  class BinaryRepo
6
- attr_accessor :repo_name, :repo_url
7
+ attr_accessor :repo_name, :repo_url, :binary_server
7
8
 
8
9
  def initialize()
9
10
  @repo_name = "kuxiu_binary_specs"
10
11
  @repo_url = "git@gitlab.91banban.com:ios_pods/binary-specs.git"
11
12
  @source_code_repo_url = "git@gitlab.91banban.com:ios_pods/Specs.git"
13
+ @binary_server = PodsOrz::BinaryServer.new()
12
14
  end
13
15
 
14
16
  def check_binary_repo_exist()
@@ -132,6 +134,19 @@ module PodsOrz
132
134
  def push_binary_remote(pod, file_path, pod_version, is_swift)
133
135
  is_push_success = false
134
136
 
137
+ #1.上传文件到服务器
138
+ is_push_success = @binary_server.upload_pod_file(pod, file_path, pod_version)
139
+ return is_push_success unless is_push_success
140
+
141
+ #2.发布到binary_repo
142
+ is_push_success = start_publish_binary(pod, file_path, pod_version, is_swift)
143
+
144
+ is_push_success
145
+ end
146
+
147
+ def start_publish_binary(pod, file_path, pod_version, is_swift)
148
+ is_push_success = false
149
+
135
150
  command = Thread.new do
136
151
  repo_push_cmd = []
137
152
  repo_push_cmd << "cd #{file_path}"
@@ -168,9 +183,6 @@ module PodsOrz
168
183
  is_push_success
169
184
  end
170
185
 
171
-
172
-
173
-
174
186
  #Class End
175
187
 
176
188
  end
@@ -1,21 +1,120 @@
1
1
  require "podsorz/util/logger"
2
+ require "open3"
3
+ require "thread"
2
4
 
3
5
 
4
6
  module PodsOrz
5
7
  class BinaryServer
6
- attr_accessor :remote_host
8
+ attr_accessor :http_host
7
9
 
8
10
  def initialize()
9
- @remote_host = "http://192.168.6.23:8080"
11
+ @http_host = "http://192.168.6.127:8899"
10
12
  end
11
13
 
14
+ def upload_pod_file(pod, file_path, pod_version)
15
+ is_upload_success = false
12
16
 
13
- def has_remote_source(pod, version)
14
-
17
+ # uplaod zip
18
+ is_upload_success = __action_upload(pod,file_path,pod_version,".framework.zip")
19
+ return is_upload_success unless is_upload_success
20
+
21
+ # upload .podspec
22
+ is_upload_success = __action_upload(pod,file_path,pod_version,".podspec")
15
23
 
24
+ is_upload_success
25
+ end
26
+
27
+ def __action_upload(pod, file_path, pod_version, extension)
28
+ is_upload_success = false
29
+
30
+ file_name = "#{pod}#{extension}"
31
+ file_name_path = File.expand_path(file_name, file_path)
32
+
33
+ unless File.exist?(file_name_path)
34
+ Logger.error("#{file_name_path} not exist!")
35
+ is_upload_success = false
36
+ return is_upload_success
37
+ end
38
+
39
+ mutex = Mutex.new()
40
+ condition_var = ConditionVariable.new
41
+
42
+ wait_thread = Thread.new do
43
+ mutex.synchronize {
44
+ condition_var.wait(mutex, 30)
45
+ }
46
+ end
47
+
48
+ command = Thread.new do
49
+ mutex.synchronize {
50
+ upload_cmd = "curl #{@http_host}/upload -F \"podname=#{pod}\" -F \"version=#{pod_version}\" -F \"file=@#{file_name_path};filename=#{file_name}\""
51
+
52
+ Logger.warning("upload #{file_name}...\n #{upload_cmd}")
53
+
54
+ IO.popen(upload_cmd) do |io|
55
+ io_lines = io.readlines
56
+ io_lines.each do |line|
57
+ puts line
58
+ if line.include? "\"success\":"
59
+ is_upload_success = true if line.include? "true"
60
+ condition_var.signal
61
+ end
62
+ end
63
+ io.close
64
+ end
65
+ }
66
+ end
67
+
68
+ wait_thread.join()
69
+
70
+ Logger.error("upload #{file_name} failure!") unless is_upload_success
71
+
72
+ is_upload_success
16
73
  end
17
74
 
75
+ def delete_pod_file(pod, pod_version)
76
+ is_delete_success = false
77
+
78
+ mutex = Mutex.new()
79
+ condition_var = ConditionVariable.new
80
+
81
+ wait_thread = Thread.new do
82
+ mutex.synchronize {
83
+ condition_var.wait(mutex, 2)
84
+ }
85
+ end
86
+
87
+ command = Thread.new do
88
+ mutex.synchronize {
89
+ delete_cmd = ""
90
+ if pod_version && pod_version.length > 0
91
+ delete_cmd = "curl #{@http_host}/delete -d \"podname=#{pod}\";\"version=#{pod_version}\""
92
+ else
93
+ delete_cmd = "curl #{@http_host}/delete -d \"podname=#{pod}\""
94
+ end
95
+
96
+ Logger.warning("delete #{pod}...\n #{delete_cmd}")
97
+
98
+ Open3.popen3(delete_cmd) do |stdin , stdout , stderr, wait_thr|
99
+ while line = stdout.gets
100
+ puts line
101
+ if line.include? "\"success\":"
102
+ is_delete_success = true if line.include? "true"
103
+ condition_var.signal
104
+ end
105
+ end
106
+ end
107
+ }
108
+ end
109
+
110
+ wait_thread.join()
111
+
112
+ Logger.error("delete #{pod} failure!") unless is_delete_success
113
+
114
+ is_delete_success
115
+ end
18
116
 
117
+ #Class end
19
118
  end
20
119
 
21
120
  end
@@ -4,11 +4,12 @@ require "podsorz/core/PodFile/podfile_model"
4
4
  module PodsOrz
5
5
 
6
6
  class PodfileIO
7
- attr_accessor :main_path, :total_sentences, :usable_sentences, :total_pod_models, :http_host
7
+ attr_accessor :main_path, :total_sentences, :usable_sentences, :total_pod_models, :http_host, :remote_binary_directory
8
8
 
9
9
  def initialize(main_path)
10
10
  @main_path = main_path
11
- @http_host = "http://192.168.6.23:8080"
11
+ @http_host = "http://192.168.6.127:8899"
12
+ @remote_binary_directory = "binary_pod"
12
13
 
13
14
  self.parse_podfile_orz
14
15
  end
@@ -314,7 +315,7 @@ module PodsOrz
314
315
  pod_name_list.each do |podname|
315
316
  @total_pod_models.map { |model|
316
317
  if model.name.start_with? podname.to_s
317
- model.podspec = "#{@http_host}/#{model.name}/#{model.version}/#{model.name}.podspec" unless model.version.nil?
318
+ model.podspec = "#{@http_host}/#{remote_binary_directory}/#{model.name}/#{model.version}/#{model.name}.podspec" unless model.version.nil?
318
319
  end
319
320
  }
320
321
  end
@@ -27,7 +27,7 @@ module PodsOrz
27
27
  pods_result = File.directory?(@kx_pods_path)
28
28
  unless pods_result
29
29
  Logger.warning("kx_pods directory not exist, generate default 'kx_pods' directory")
30
- Dir.mkdir(@kx_pods_path)
30
+ FileUtils.mkdir_p(@kx_pods_path, :mode => 0777)
31
31
  end
32
32
  end
33
33
  end
@@ -383,8 +383,7 @@ module PodsOrz
383
383
  else
384
384
  pods_sort = PodsOrz::PodsSort.new()
385
385
  kx_pods_subPath = @pods_git_operator.get_pod_file_path("")
386
- pods_list = pods_sort.sort(pods_list,kx_pods_subPath)
387
-
386
+ pods_list = pods_sort.sort(pods_list,kx_pods_subPath)
388
387
  end
389
388
 
390
389
  pods_list.each {|pod|
@@ -1,3 +1,3 @@
1
1
  module PodsOrz
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.12"
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.10
4
+ version: 0.0.12
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-29 00:00:00.000000000 Z
11
+ date: 2021-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gli