luna-binary-uploader 0.1.19 → 0.1.23

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: d54b08da3ecda037f4a5f1aa25e67c35acbafe5cce340f63dc5f6bd0cda7fba9
4
- data.tar.gz: be02803fced8ac0fd75cb06f00df2a87be32e3e7ad707b4f32f1c6ee24995091
3
+ metadata.gz: 47fe909af5136d22d7c2642abc624ab081c03311aaa8ebad8424f352818bff50
4
+ data.tar.gz: 54a0f17c4875ef1077c6f91969cb7b829cf39274058b1a629a57c32cd8aaeae5
5
5
  SHA512:
6
- metadata.gz: 80dc36ef3a07ce52fcdc8e3ced23694281d2decd69d7d32a352922595a54c3101997eca0de3c0d56de0a4306ffa6b97ae69a921da0be605c2893b47fb53e461d
7
- data.tar.gz: 4c3360583f7a317f6fdda7b143ed57b78d584ff18e7815153579add4ba443b79c08cae8601af1bb5500c84c9204039c94023fe85ebdd25b6f7d85b87d769cad7
6
+ metadata.gz: 87c4dc963898cc01f4c3b4595e8a9d271455b424734185fdfce0ce60176d2580607c4b1278cdda081227a30e0c41ac2f1390d2d0e8fa4ce70f104127542ac57e
7
+ data.tar.gz: cf8f7d9b27934a26dc3b69963829e6b542484f2a9675eee3e59a33574aec53dcbd1c19f5c279d27fa60716ec3b1a3f7b10530ef3ce219772b8b4df25f56bbecf
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
@@ -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
@@ -188,6 +182,7 @@ class App
188
182
  obj.run
189
183
  else
190
184
  raise "缺少参数:1.xcworkspace 名称 eg:MyWorkSpace.xcworkspace 2.scheme eg: MyProject"
185
+ end
191
186
  end
192
187
  end
193
188
 
@@ -204,6 +199,22 @@ class App
204
199
  end
205
200
  end
206
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
215
+ end
216
+ end
217
+
207
218
  pre do |global,command,options,args|
208
219
  # Pre logic here
209
220
  # Return true to proceed; false to abort and not call the
@@ -0,0 +1,115 @@
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
+ i += 1
98
+ }
99
+
100
+ puts "normal average time: #{sum_time/i}" if sum_time > 0
101
+ i = 0
102
+ sum_time = 0
103
+ binary_time_arr.each { |item|
104
+ item.print
105
+ sum_time += item.delta
106
+ i += 1
107
+ }
108
+ puts "binary average time: #{sum_time/i}" if sum_time > 0
109
+ end
110
+ end
111
+
112
+
113
+ end
114
+ end
115
+
@@ -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.19"
4
+ VERSION = "0.1.23"
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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: luna-binary-uploader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.19
4
+ version: 0.1.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - 车德超
@@ -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