luna-binary-uploader 0.1.18 → 0.1.22

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: 15f450a18337c0c82b31cc9ecff5dab7355a1df77cadfb9af1858f354f2afaee
4
- data.tar.gz: 293deab2e53041b1fe237a4fbcd41dd8bcf147970db3abb14769ecdfddd52b74
3
+ metadata.gz: 5ab024fbb7a3b9e093e0a37de5bb3c3581197ce5c67943a0fee70b981dccca01
4
+ data.tar.gz: 1f420170477e16c1a7b56da71320aae01c6275f3d82326222d87e26ac54e78d7
5
5
  SHA512:
6
- metadata.gz: 12a3ef832a2115213a758f6fee2a74fcb2095568c8f11e6fb1ad7ee56ae798c6be1156882ad78519113f6b28e2b911ffbfe830a15da623c12e6110dd69cffb96
7
- data.tar.gz: a172e4b94bb6996548bd2ce6c593b9f1ac2409f9db4abd9a7b37de6bade6f17ad3e14dad5744bb70bfd95b9a050bb5a7d540146862825755f99ce9bb2a9ed7d3
6
+ metadata.gz: 47182ea6cfd515f8e4ca0f4811bd6a42616aed2aba61af174c065738ec24702f0577a3349998990cd2e58f12ee582dcb3e6818b972d3a2da5c5dd742a285e30a
7
+ data.tar.gz: 68110efcaae4606c56a2528dc0554c69796872880af060b7ca16297d95f04c8a191f2b6dc0dce7116537b4568b8ae1c2f8b513698740dd1ff5004ce66e8888b9
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- luna-binary-uploader (0.1.17)
4
+ luna-binary-uploader (0.1.21)
5
5
  cocoapods
6
6
  cocoapods-generate (~> 2.0.1)
7
7
  cocoapods-imy-bin (= 0.3.1.3)
data/bin/lbu CHANGED
@@ -1,14 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require "bundler/setup"
4
- require "luna/binary/uploader"
5
- require "luna/binary/delete"
6
- require "luna/binary/analysis"
7
- require "luna/binary/refresh"
8
- require "luna/binary/build"
9
- require "luna/binary/update"
10
- require "luna/binary/install"
11
- require "luna/binary/init"
4
+ require "luna-binary-uploader"
12
5
  require 'gli'
13
6
 
14
7
  # You can add fixtures and/or initialization code here to make experimenting
@@ -21,7 +14,7 @@ require 'gli'
21
14
  class App
22
15
  extend GLI::App
23
16
 
24
- program_desc 'luna cocopods-imy-bin自定义二进制上传'
17
+ program_desc 'luna-binary-uploader 自定义二进制上传'
25
18
 
26
19
  version Luna::Binary::Uploader::VERSION
27
20
 
@@ -73,9 +66,10 @@ class App
73
66
  arg_name '只接参数n, 表示不用二进制 '
74
67
  command :install do |c|
75
68
  c.action do |global_options,options,args|
76
- is_open = "false"
77
69
  if args[0] && args[0] != "n"
78
70
  raise "只接参数n, 表示不用二进制"
71
+ elsif args[0] && args[0] == "n"
72
+ is_open = "false"
79
73
  else
80
74
  is_open = "true"
81
75
  end
@@ -84,7 +78,7 @@ class App
84
78
  end
85
79
 
86
80
  desc '单个上传二进制文件'
87
- arg_name '1.模块名 git地址 git节点 xcode编译的缓存地址 \n 2.模块名 版本号 xcode编译的缓存地址 \n 3.模块名 本地podspec地址 xcode编译的缓存地址'
81
+ arg_name 'a.模块名 git地址 git节点 xcode编译的缓存地址 \n b.模块名 版本号 xcode编译的缓存地址 \n c.模块名 本地podspec地址 xcode编译的缓存地址'
88
82
  command :single do |c|
89
83
  c.action do |global_options,options,args|
90
84
  if args[3] #模式1
@@ -123,10 +117,14 @@ class App
123
117
  end
124
118
 
125
119
  desc '单个删除repo 里的podspec & 服务二进制文件'
126
- arg_name '模块名 版本号'
120
+ arg_name '1.模块名 2.版本号'
127
121
  command :del do |c|
128
122
  c.action do |global_options,options,args|
129
- Luna::Binary::Delete.new(args[0],args[1]).delete
123
+ if args[0] && args[1]
124
+ Luna::Binary::Delete.new(args[0],args[1]).delete
125
+ else
126
+ raise "缺少参数:1.模块名 2.版本号"
127
+ end
130
128
  end
131
129
  end
132
130
 
@@ -177,10 +175,14 @@ class App
177
175
  arg_name '1.xcworkspace 名称 eg:MyWorkSpace.xcworkspace 2.scheme eg: MyProject'
178
176
  command :build do |c|
179
177
  c.action do |global_options,options,args|
178
+ if args[0] && args[1]
180
179
  obj = Luna::Binary::Build.new()
181
180
  obj.workspace=args[0]
182
181
  obj.scheme=args[1]
183
182
  obj.run
183
+ else
184
+ raise "缺少参数:1.xcworkspace 名称 eg:MyWorkSpace.xcworkspace 2.scheme eg: MyProject"
185
+ end
184
186
  end
185
187
  end
186
188
 
@@ -188,8 +190,28 @@ class App
188
190
  arg_name '1.armPath 2.x86path'
189
191
  command :merge do |c|
190
192
  c.action do |global_options,options,args|
193
+ if args[0] && args[1]
191
194
  obj = Luna::Binary::Build.new()
192
195
  obj.mergeFrameWorks(args[0], args[1])
196
+ else
197
+ raise "缺少参数:1.armPath 2.x86path"
198
+ end
199
+ end
200
+ end
201
+
202
+ desc 'benchmark 二进制和非二进制'
203
+ arg_name '1.跑工程几次 2.workspace 3.scheme 4.normal正常模式下 binary二进制模式下,不传的话都跑'
204
+ command :benchmark do |c|
205
+ c.action do |global_options,options,args|
206
+ obj = Luna::Binary::BenchMark.new(Integer(args[0]), args[1], args[2])
207
+ if args[3] == "normal"
208
+ obj.run_no_binary
209
+ elsif args[3] == "binary"
210
+ obj.run_binary
211
+ else
212
+ obj.run
213
+ end
214
+ obj.print
193
215
  end
194
216
  end
195
217
 
@@ -0,0 +1,117 @@
1
+ require 'date'
2
+ require "luna/binary/uploader/version"
3
+ require "cocoapods"
4
+ require 'cocoapods-imy-bin/native/sources_manager'
5
+ require 'cocoapods-imy-bin/config/config'
6
+ require 'cocoapods-imy-bin'
7
+ require 'json'
8
+ require 'luna/binary/common/common'
9
+
10
+
11
+ module Luna
12
+ module Binary
13
+
14
+ class DogTimer
15
+
16
+ attr_accessor :start_time
17
+ attr_accessor :end_time
18
+ attr_accessor :delta_time
19
+ def initialize()
20
+
21
+ end
22
+
23
+ def start
24
+ @start_time = Time.now()
25
+ puts start_time
26
+ end
27
+
28
+ def end
29
+ @end_time = Time.now()
30
+ puts end_time
31
+ end
32
+
33
+ def delta
34
+ @delta_time = @end_time - @start_time
35
+ end
36
+
37
+ def print
38
+ puts "start time: #{start_time.inspect} end time: #{end_time.inspect} delta time: #{delta}s ".yellow
39
+ end
40
+ end
41
+
42
+ class BenchMark
43
+ attr_reader :times
44
+ attr_reader :workspace
45
+ attr_reader :scheme
46
+ attr_reader :binary_time_arr
47
+ attr_reader :normal_time_arr
48
+
49
+ def initialize(times, workspace, scheme)
50
+ @times = times
51
+ @workspace = workspace
52
+ @scheme = scheme
53
+ @binary_time_arr = []
54
+ @normal_time_arr = []
55
+ end
56
+
57
+ def run
58
+ run_binary
59
+ run_no_binary
60
+ end
61
+
62
+ def run_binary
63
+ i = 0
64
+ Common.instance.command("lbu install")
65
+ while i < times
66
+ Common.instance.command("xcodebuild clean -quiet -workspace #{workspace} -scheme #{scheme} -configuration Debug")
67
+ t = DogTimer.new()
68
+ t.start
69
+ Common.instance.command("xcodebuild -workspace #{workspace} -scheme #{scheme} -configuration Debug")
70
+ t.end
71
+ binary_time_arr << t
72
+ i = i + 1
73
+ end
74
+ end
75
+
76
+ def run_no_binary
77
+ Common.instance.command("lbu install n")
78
+ i = 0
79
+ while i < times
80
+ Common.instance.command("xcodebuild clean -quiet -workspace #{workspace} -scheme #{scheme} -configuration Debug")
81
+ t = DogTimer.new()
82
+ t.start
83
+ Common.instance.command("xcodebuild -workspace #{workspace} -scheme #{scheme} -configuration Debug")
84
+ t.end
85
+ normal_time_arr << t
86
+ i = i + 1
87
+ end
88
+ end
89
+
90
+
91
+ def print
92
+ i = 0
93
+ sum_time = 0
94
+ normal_time_arr.each { |item|
95
+ item.print
96
+ sum_time += item.delta
97
+ p sum_time
98
+ i += 1
99
+ }
100
+
101
+ puts "normal average time: #{sum_time/i}"
102
+ i = 0
103
+ sum_time = 0
104
+ binary_time_arr.each { |item|
105
+ item.print
106
+ sum_time += item.delta
107
+ p sum_time
108
+ i += 1
109
+ }
110
+ puts "binary average time: #{sum_time/i}"
111
+ end
112
+ end
113
+
114
+
115
+ end
116
+ end
117
+
@@ -26,9 +26,7 @@ module Luna
26
26
  def createFrameworks
27
27
  isNext = true
28
28
  puts "请将二进制开关关闭,确保每个模块都是源码运行,因为二进制的因素有可能source缓存还是会引入二进制".yellow
29
- command("rm -rf #{Dir.pwd}/Pods")
30
-
31
- isNext = command("pod install")
29
+ Install.new(false)
32
30
  Common.instance.deleteDirectory(binary_path_arm)
33
31
  tempLunaUploaderPath = Common.instance.tempLunaUploaderPath
34
32
  isNext = command("xcodebuild -workspace #{workspace} -scheme #{scheme} -configuration Debug -derivedDataPath '#{tempLunaUploaderPath}/build/arm/temp'") if isNext == true
@@ -14,7 +14,12 @@ module Luna
14
14
  attr_accessor :version, :state
15
15
  attr_accessor :podFilePath
16
16
  attr_accessor :lockfile
17
-
17
+ attr_reader :bin_dev
18
+ attr_reader :binary_repo_url
19
+ attr_reader :binary_upload_url
20
+ attr_reader :binary_download_url
21
+ attr_reader :download_file_type
22
+
18
23
  def initialize()
19
24
  end
20
25
 
@@ -22,7 +27,7 @@ module Luna
22
27
  sources = Pod::Config.instance.sources_manager.all
23
28
  repoPath = nil
24
29
  sources.each { |item|
25
- if item.url == CBin.config.binary_repo_url
30
+ if item.url == Common.instance.binary_repo_url
26
31
  repoPath = item.repo
27
32
  end
28
33
  }
@@ -95,7 +100,7 @@ module Luna
95
100
  end
96
101
 
97
102
  def request_result_hash
98
- command = "curl #{CBin.config.binary_upload_url}"
103
+ command = "curl #{Common.instance.binary_upload_url}"
99
104
  p command
100
105
  result = %x(#{command})
101
106
  request_result_hash = JSON.parse(result)
@@ -105,7 +110,7 @@ module Luna
105
110
 
106
111
  def createNeedFrameworkMapper
107
112
  spec_repo_binary = {}
108
- puts "二进制repo地址 : #{CBin.config.binary_repo_url}".yellow
113
+ puts "二进制repo地址 : #{Common.instance.binary_repo_url}".yellow
109
114
  use_framework_list.each { |item|
110
115
  name = item.split('/').first
111
116
  if spec_repo_binary[name] == nil
@@ -214,6 +219,42 @@ module Luna
214
219
  return lockfile.dependencies.map { |item| [item.name.split("/").first, item]}.to_h
215
220
  end
216
221
 
222
+ def bin_dev
223
+ if @bin_dev == nil
224
+ @bin_dev = YAML.load_file("#{Pod::Config.instance.home_dir}/bin_dev.yml")
225
+ end
226
+ return @bin_dev
227
+ end
228
+
229
+ def binary_repo_url
230
+ if @binary_repo_url == nil
231
+ @binary_repo_url = bin_dev["binary_repo_url"]
232
+ end
233
+ return @binary_repo_url
234
+ end
235
+
236
+ def binary_upload_url
237
+ if @binary_upload_url == nil
238
+ cut_string = "/%s/%s/zip"
239
+ @binary_upload_url = binary_download_url[0,binary_download_url.length - cut_string.length]
240
+ end
241
+ return @binary_upload_url
242
+ end
243
+
244
+ def binary_download_url
245
+ if @binary_download_url == nil
246
+ @binary_download_url = bin_dev["binary_download_url"]
247
+ end
248
+ return @binary_download_url
249
+ end
250
+
251
+ def download_file_type
252
+ if @download_file_type == nil
253
+ @download_file_type = bin_dev["download_file_type"]
254
+ end
255
+ return @download_file_type
256
+ end
257
+
217
258
  end
218
259
  end
219
260
  end
@@ -41,7 +41,7 @@ module Luna
41
41
  end
42
42
 
43
43
  def deleteBinaryFramework
44
- command = "curl -X 'DELETE' #{CBin.config.binary_upload_url}/#{name}/#{version}"
44
+ command = "curl -X 'DELETE' #{Common.instance.binary_upload_url}/#{name}/#{version}"
45
45
  p command
46
46
  system command
47
47
  end
@@ -17,7 +17,7 @@ module Luna
17
17
 
18
18
  def run
19
19
  Common.instance.command("curl -o #{Pod::Config.instance.home_dir}/bin_dev.yml #{url}")
20
- Common.instance.command("pod repo add z-ios-framework-spec-repo #{CBin.config.binary_repo_url}")
20
+ Common.instance.command("pod repo add z-ios-framework-spec-repo #{Common.instance.binary_repo_url}")
21
21
  end
22
22
 
23
23
  end
@@ -1,7 +1,7 @@
1
1
  module Luna
2
2
  module Binary
3
3
  module Uploader
4
- VERSION = "0.1.18"
4
+ VERSION = "0.1.22"
5
5
  end
6
6
  end
7
7
  end
@@ -322,7 +322,7 @@ module Luna
322
322
  end
323
323
 
324
324
  def binary_source
325
- { http: format(CBin.config.binary_download_url, specification.root.name, specification.version), type: CBin.config.download_file_type }
325
+ { http: format(Common.instance.binary_download_url, specification.root.name, specification.version), type: Common.instance.download_file_type }
326
326
  end
327
327
 
328
328
  def source_files(suffix)
@@ -385,7 +385,7 @@ module Luna
385
385
  end
386
386
 
387
387
  def isHasFrameworkInService
388
- command = "curl #{format(CBin.config.binary_download_url, specification.root.name, specification.version).sub("#{CBin.config.download_file_type}","")}"
388
+ command = "curl #{format(Common.instance.binary_download_url, specification.root.name, specification.version).sub("#{Common.instance.download_file_type}","")}"
389
389
  p command
390
390
  result = %x(#{command})
391
391
  resultHash = JSON.parse(result)
@@ -405,7 +405,7 @@ module Luna
405
405
  zipCommand = "cd #{rootName};zip -r #{specification.root.name}.zip #{specification.root.name}"
406
406
  p zipCommand
407
407
  system zipCommand
408
- command = "cd #{rootName};curl #{CBin.config.binary_upload_url} -F \"name=#{specification.root.name}\" -F \"version=#{specification.version}\" -F \"annotate=#{specification.root.name}_#{specification.version}_log\" -F \"file=@#{specification.root.name}.zip\""
408
+ command = "cd #{rootName};curl #{Common.instance.binary_upload_url} -F \"name=#{specification.root.name}\" -F \"version=#{specification.version}\" -F \"annotate=#{specification.root.name}_#{specification.version}_log\" -F \"file=@#{specification.root.name}.zip\""
409
409
  p command
410
410
  system command
411
411
  end
@@ -0,0 +1,10 @@
1
+ require "luna/binary/uploader"
2
+ require "luna/binary/delete"
3
+ require "luna/binary/analysis"
4
+ require "luna/binary/refresh"
5
+ require "luna/binary/build"
6
+ require "luna/binary/update"
7
+ require "luna/binary/install"
8
+ require "luna/binary/init"
9
+ require "luna/binary/common/common"
10
+ require "luna/binary/benchmark"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: luna-binary-uploader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.18
4
+ version: 0.1.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - 车德超
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-22 00:00:00.000000000 Z
11
+ date: 2021-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -139,7 +139,9 @@ files:
139
139
  - Rakefile
140
140
  - bin/lbu
141
141
  - bin/setup
142
+ - lib/luna-binary-uploader.rb
142
143
  - lib/luna/binary/analysis.rb
144
+ - lib/luna/binary/benchmark.rb
143
145
  - lib/luna/binary/build.rb
144
146
  - lib/luna/binary/common/common.rb
145
147
  - lib/luna/binary/delete.rb