luna-binary-uploader 0.1.20 → 0.1.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/bin/lbu +18 -1
- data/lib/luna/binary/benchmark.rb +115 -0
- data/lib/luna/binary/uploader/version.rb +1 -1
- data/lib/luna-binary-uploader.rb +2 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c35f885ef76e95875084e78aef96e601a6ab189bfbaf12a3d8564bcf1997c1b6
|
4
|
+
data.tar.gz: 84241a1e0ef378017077aedde663beeda591d8348670b4c6a95142e32b9383f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd2e1662d7698405f2ca17f9296b689f319e1ac9f9da8ebd91c3f472539a4bed7395364758e97047857de27dbcc5c267d5aba7ec8f5abc28db03b6f803f8a27d
|
7
|
+
data.tar.gz: 7f80e36a16f32319013ea7f61f643e8582d39faaa79ef6bd28e421c5e22d7dd3756d1729fcd23875c459c981fb2fb81a679af070c0e0734fb4440716b81a3a4d
|
data/Gemfile.lock
CHANGED
data/bin/lbu
CHANGED
@@ -66,9 +66,10 @@ class App
|
|
66
66
|
arg_name '只接参数n, 表示不用二进制 '
|
67
67
|
command :install do |c|
|
68
68
|
c.action do |global_options,options,args|
|
69
|
-
is_open = "false"
|
70
69
|
if args[0] && args[0] != "n"
|
71
70
|
raise "只接参数n, 表示不用二进制"
|
71
|
+
elsif args[0] && args[0] == "n"
|
72
|
+
is_open = "false"
|
72
73
|
else
|
73
74
|
is_open = "true"
|
74
75
|
end
|
@@ -198,6 +199,22 @@ class App
|
|
198
199
|
end
|
199
200
|
end
|
200
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
|
+
|
201
218
|
pre do |global,command,options,args|
|
202
219
|
# Pre logic here
|
203
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
|
+
t = DogTimer.new()
|
67
|
+
t.start
|
68
|
+
Common.instance.command("xcodebuild -workspace #{workspace} -scheme #{scheme} -configuration Debug")
|
69
|
+
t.end
|
70
|
+
binary_time_arr << t
|
71
|
+
i = i + 1
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def run_no_binary
|
76
|
+
Common.instance.command("lbu install n")
|
77
|
+
i = 0
|
78
|
+
while i < times
|
79
|
+
t = DogTimer.new()
|
80
|
+
t.start
|
81
|
+
Common.instance.command("xcodebuild -workspace #{workspace} -scheme #{scheme} -configuration Debug")
|
82
|
+
t.end
|
83
|
+
normal_time_arr << t
|
84
|
+
i = i + 1
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
|
89
|
+
def print
|
90
|
+
i = 0
|
91
|
+
sum_time = 0
|
92
|
+
normal_time_arr.each { |item|
|
93
|
+
item.print
|
94
|
+
sum_time += item.delta
|
95
|
+
p sum_time
|
96
|
+
i += 1
|
97
|
+
}
|
98
|
+
|
99
|
+
puts "normal average time: #{sum_time/i}"
|
100
|
+
i = 0
|
101
|
+
sum_time = 0
|
102
|
+
binary_time_arr.each { |item|
|
103
|
+
item.print
|
104
|
+
sum_time += item.delta
|
105
|
+
p sum_time
|
106
|
+
i += 1
|
107
|
+
}
|
108
|
+
puts "binary average time: #{sum_time/i}"
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
data/lib/luna-binary-uploader.rb
CHANGED
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.
|
4
|
+
version: 0.1.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 车德超
|
@@ -141,6 +141,7 @@ files:
|
|
141
141
|
- bin/setup
|
142
142
|
- lib/luna-binary-uploader.rb
|
143
143
|
- lib/luna/binary/analysis.rb
|
144
|
+
- lib/luna/binary/benchmark.rb
|
144
145
|
- lib/luna/binary/build.rb
|
145
146
|
- lib/luna/binary/common/common.rb
|
146
147
|
- lib/luna/binary/delete.rb
|