furion 1.0.9 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/furion +22 -1
- data/lib/furion.rb +14 -0
- data/lib/furion/project_generate.rb +63 -0
- data/lib/furion/ver_conflict_detector.rb +50 -14
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33e050630738005972a285c19d87fae626442832a08048feec1d27406d628f1f
|
4
|
+
data.tar.gz: '068fa164b18a1d937ffb31269c217fec0031c24e9c96fc6a47c25556a7e40ad1'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80f2baf81d9f32d026a3188b275ecbb2c771712c1b6470222aaeeb4a76f91559acb456f866204975d46a5f1d4f903b418665deddb18e2cbe729ca49962a4e159
|
7
|
+
data.tar.gz: 8a0b25c6ed61ee1e34e14ad0f27688de12e5e7ef5d12cf2a3b98f32c287db672d65888d9680109f8d6538ae7ca39921476546a87d38603023ec3f218d880e8a0
|
data/bin/furion
CHANGED
@@ -13,10 +13,11 @@ OptionParser.new do |opts|
|
|
13
13
|
-h : print the help message
|
14
14
|
init : run wrapper-pick work flow in existed project
|
15
15
|
update : update the config of sdk-wrapper
|
16
|
+
create
|
16
17
|
"
|
17
18
|
end
|
18
19
|
opts.on("-v", "--version", "Prints version") do |dh|
|
19
|
-
puts "1.0.9"
|
20
|
+
puts "1.0.9.1"
|
20
21
|
end
|
21
22
|
|
22
23
|
|
@@ -26,6 +27,26 @@ if ARGV[0] == "init"
|
|
26
27
|
Furion.makeConfig
|
27
28
|
end
|
28
29
|
|
30
|
+
if ARGV[0] == "create"
|
31
|
+
name = ARGV[1]
|
32
|
+
if name == nil
|
33
|
+
puts "please input project name"
|
34
|
+
else
|
35
|
+
if name.length > 1
|
36
|
+
Furion.genProj(name)
|
37
|
+
puts Dir.pwd
|
38
|
+
Dir.chdir name
|
39
|
+
puts Dir.pwd
|
40
|
+
Furion.makeConfig
|
41
|
+
system("open .")
|
42
|
+
else
|
43
|
+
puts "project name too short "
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
29
50
|
if ARGV[0] == "confdet"
|
30
51
|
Furion.detectConflict
|
31
52
|
end
|
data/lib/furion.rb
CHANGED
@@ -4,7 +4,9 @@ require 'json'
|
|
4
4
|
require 'plist'
|
5
5
|
require 'open-uri'
|
6
6
|
require 'furion/file_editor'
|
7
|
+
require 'zip'
|
7
8
|
require 'furion/ver_conflict_detector'
|
9
|
+
require 'furion/project_generate'
|
8
10
|
class Furion
|
9
11
|
|
10
12
|
def self.fetchFile(fileName)
|
@@ -73,6 +75,16 @@ class Furion
|
|
73
75
|
ConflictDetector.detectConflict
|
74
76
|
end
|
75
77
|
|
78
|
+
def self.genProj(name)
|
79
|
+
fileName = "FurionExample.zip"
|
80
|
+
self.fetchFile(fileName)
|
81
|
+
system("unzip", fileName)
|
82
|
+
File.delete(fileName)
|
83
|
+
ProjectGenerater.setupProject("FurionExample",name)
|
84
|
+
FileUtils.rm_rf("FurionExample")
|
85
|
+
end
|
86
|
+
|
87
|
+
|
76
88
|
def self.runCMD
|
77
89
|
cmd = ARGV[0]
|
78
90
|
if cmd == "init"
|
@@ -84,3 +96,5 @@ class Furion
|
|
84
96
|
end
|
85
97
|
end
|
86
98
|
end
|
99
|
+
|
100
|
+
|
@@ -0,0 +1,63 @@
|
|
1
|
+
|
2
|
+
$placeHolderStr = "FurionExample"
|
3
|
+
$createInfo = "// Created by $AUTHOR on $DATE."
|
4
|
+
$copyrightInfo = "// Copyright © $YEAR $PROJECT. All rights reserved."
|
5
|
+
$zipCodeUri = "https://git.huya.com/chenguohao2/FurionTemplateResource/raw/master/iOS/FurionExample.zip"
|
6
|
+
class ProjectGenerater
|
7
|
+
|
8
|
+
def self.fetchExampleCode
|
9
|
+
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.setupProject(projPath,newName)
|
13
|
+
Find.find(projPath) do |path|
|
14
|
+
puts "[o]"+path
|
15
|
+
newPath = path.gsub($placeHolderStr,newName)
|
16
|
+
puts "[*]"+newPath
|
17
|
+
if File.file?(path)
|
18
|
+
copyUpdateFile(path,newPath,$placeHolderStr,newName)
|
19
|
+
else
|
20
|
+
Dir.mkdir(newPath)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
def self.copyUpdateFile(oldPath,newPath,oldName,newName)
|
27
|
+
File.open(newPath, "w") do |out|
|
28
|
+
File.foreach(oldPath) do |line|
|
29
|
+
|
30
|
+
content = self.updateCopyRight(line,newName)
|
31
|
+
content = self.updateCreatedInfo(content)
|
32
|
+
if content.include?oldName
|
33
|
+
newLine = content.gsub(oldName,newName)
|
34
|
+
out.puts newLine
|
35
|
+
else
|
36
|
+
out.puts content
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.updateCopyRight(content,projName)
|
43
|
+
if content.include? $copyrightInfo
|
44
|
+
current_year = Time.new.year
|
45
|
+
year_content = content.sub("$YEAR",String(current_year))
|
46
|
+
result = year_content.sub("$PROJECT",projName)
|
47
|
+
return result
|
48
|
+
end
|
49
|
+
return content
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.updateCreatedInfo(content)
|
53
|
+
if content.include? $createInfo
|
54
|
+
curTime = Time.now.strftime("%Y/%m/%d")
|
55
|
+
time_content = content.sub("$DATE",curTime)
|
56
|
+
author = Etc.getpwuid(Process.uid).name
|
57
|
+
result = time_content.sub("$AUTHOR",author)
|
58
|
+
return result
|
59
|
+
end
|
60
|
+
return content
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
@@ -1,5 +1,8 @@
|
|
1
1
|
require 'cocoapods'
|
2
2
|
require 'etc'
|
3
|
+
require 'net/http'
|
4
|
+
require 'digest/sha1'
|
5
|
+
require 'date'
|
3
6
|
class ConflictDetector
|
4
7
|
def self.detectConflict
|
5
8
|
@openingSpec = []
|
@@ -7,6 +10,7 @@ class ConflictDetector
|
|
7
10
|
# dict = Plist::parse_xml("MTPSDK.plist")
|
8
11
|
file = File.read('sdkConfig.json')
|
9
12
|
dict = JSON.parse(file)
|
13
|
+
|
10
14
|
# "sdk":{"hypushsdk": {"wrapperVersion": "0.1.13-dev", "sdkVersion": "*", "wrapper": "pushsdk-wrapper"}
|
11
15
|
sdkDict = {}
|
12
16
|
sdkWrapperDict = dict["sdk"]
|
@@ -58,7 +62,6 @@ class ConflictDetector
|
|
58
62
|
|
59
63
|
if path.length == 0
|
60
64
|
# 如果在wrapper也没找到就说明找不到
|
61
|
-
puts "[FurionError]:spec load Error in "+path
|
62
65
|
return
|
63
66
|
end
|
64
67
|
|
@@ -69,13 +72,21 @@ class ConflictDetector
|
|
69
72
|
return
|
70
73
|
end
|
71
74
|
|
75
|
+
dependencies = ret.dependencies
|
76
|
+
|
77
|
+
for spec in ret.subspecs
|
78
|
+
subDependencies = spec.dependencies
|
79
|
+
for item in subDependencies
|
80
|
+
dependencies.append(item)
|
81
|
+
end
|
82
|
+
end
|
72
83
|
|
73
|
-
for item in
|
84
|
+
for item in dependencies
|
74
85
|
requireStr = String(item.requirement)
|
75
86
|
self.recordDependancy(item.name,requireStr,specName)
|
76
87
|
if self.isVersionSpecific(requireStr) == 0
|
77
|
-
content = self.wrapSpecificVersion(requireStr)
|
78
|
-
self.
|
88
|
+
content = self.wrapSpecificVersion(requireStr) # 去掉空格和等号,只剩下大于/小于
|
89
|
+
self.loadSpec(item.name,content)
|
79
90
|
end
|
80
91
|
end
|
81
92
|
end
|
@@ -107,12 +118,6 @@ class ConflictDetector
|
|
107
118
|
return content
|
108
119
|
end
|
109
120
|
|
110
|
-
def self.readSpecFromRepo(specName,version)
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
self.loadSpec(specName,version)
|
115
|
-
end
|
116
121
|
|
117
122
|
|
118
123
|
def self.getSpecFromSDK(groupPath,sdkName,version)
|
@@ -189,6 +194,7 @@ class ConflictDetector
|
|
189
194
|
else
|
190
195
|
if min == max
|
191
196
|
if containMax == 0 || containMin == 0
|
197
|
+
|
192
198
|
isConflict = 1
|
193
199
|
end
|
194
200
|
end
|
@@ -233,7 +239,7 @@ class ConflictDetector
|
|
233
239
|
end
|
234
240
|
|
235
241
|
varNumArray2 = String(otherVersion).split("-")
|
236
|
-
verNum2 =
|
242
|
+
verNum2 = varNumArray2[0]
|
237
243
|
if varNumArray2.length() > 1
|
238
244
|
verExt2 = varNumArray2[1]
|
239
245
|
else
|
@@ -241,10 +247,11 @@ class ConflictDetector
|
|
241
247
|
end
|
242
248
|
|
243
249
|
|
244
|
-
if Gem::Version.new(verNum1) > Gem::Version.new(
|
250
|
+
if Gem::Version.new(verNum1) > Gem::Version.new(verNum2)
|
251
|
+
|
245
252
|
return 1
|
246
253
|
else
|
247
|
-
if Gem::Version.new(verNum1) == Gem::Version.new(
|
254
|
+
if Gem::Version.new(verNum1) == Gem::Version.new(verNum2)
|
248
255
|
if verExt1 == '*' && verExt2 != '*'
|
249
256
|
return 1
|
250
257
|
end
|
@@ -253,7 +260,36 @@ class ConflictDetector
|
|
253
260
|
return 0
|
254
261
|
end
|
255
262
|
|
256
|
-
def self.getLastVersionFromDir(dirPath)
|
257
263
|
|
264
|
+
|
265
|
+
# clientType=1&name=yome&projectCode=yome&type=1
|
266
|
+
def self.requestVersionDependancy
|
267
|
+
|
268
|
+
Find.find(Dir::pwd) do |path|
|
269
|
+
puts path
|
270
|
+
end
|
271
|
+
|
272
|
+
appId = "mtpwebservices"
|
273
|
+
token = "43010711d680a54c"
|
274
|
+
time = DateTime.now.strftime('%Q')
|
275
|
+
content = token + appId + String(time)
|
276
|
+
puts content
|
277
|
+
sign = Digest::SHA1.hexdigest(content)
|
278
|
+
url = URI('http://aplus.local.web.hy/open-api/1.0/dependency/get?')
|
279
|
+
# 设置请求参数
|
280
|
+
params = {'clientType':0,'type':1}
|
281
|
+
url.query = URI.encode_www_form(params)
|
282
|
+
puts url
|
283
|
+
http = Net::HTTP.new(url.host, url.port)
|
284
|
+
|
285
|
+
|
286
|
+
# 设置请求头
|
287
|
+
header = {'X-APLUS-APP':appId,
|
288
|
+
'X-APLUS-SIGN':sign,
|
289
|
+
'X-APLUS-TS':String(time)}
|
290
|
+
puts header
|
291
|
+
|
292
|
+
response = http.get(url, header)
|
293
|
+
puts response.body
|
258
294
|
end
|
259
295
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: furion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MTP Huya
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: MTP Huya is the best!!!
|
14
14
|
email: mtphuya@yandex.com
|
@@ -20,6 +20,7 @@ files:
|
|
20
20
|
- bin/furion
|
21
21
|
- lib/furion.rb
|
22
22
|
- lib/furion/file_editor.rb
|
23
|
+
- lib/furion/project_generate.rb
|
23
24
|
- lib/furion/ver_conflict_detector.rb
|
24
25
|
homepage: https://rubygems.org/gems/furion
|
25
26
|
licenses:
|