furion 1.0.3 → 1.0.4

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: 6c3f0543d2d7b219bd294780c646db83d176be2e1420237d96a6f456e61e7416
4
- data.tar.gz: f8816a052bb7b96cbe15b1be41fc2686a684bd6fc8200ba3131f4f0a59872e4d
3
+ metadata.gz: ca26a733e31772883880213f408db1eced1b5e3f1a48a95c929a171c8ce80784
4
+ data.tar.gz: 653e973ed7f887dbeabc9f74ae5e829b0a632c3b26f2a8aa491a711025cf38b8
5
5
  SHA512:
6
- metadata.gz: 56663791bd9818cf38ccb4124335f56a76d985c8c0789abb7b52111e64e57c8d1312af2d68341077d1ac41267b33fc3b95d766e5a1bbab3f900e441ef94a3bf7
7
- data.tar.gz: 3d468ea7c109f11145427391308220a9fef89b1eb31a8f053572654da3309b9b2719d7a231a58ed2b29b8e9fca0ca313fa9b488a33a8638093488464c245732a
6
+ metadata.gz: bfd9649d727db6827a47c07188311fdfa02bdd39b711d1d2ce4c02166f0f1131d0f4fbb52da11f6498b02459b86ca3462091fbe69549ae164c3d1c7770229f15
7
+ data.tar.gz: 85ae79eeb1fb27bb225165546238791879d48d97e32ba0af5ea00b5c3cf69374c90c7fb600f5d538aebbc2b94fe5cc6c64da3c9d817332167bb481afd35e6ea1
data/bin/furion CHANGED
@@ -21,10 +21,10 @@ OptionParser.new do |opts|
21
21
  opts.on("-v", "--version", "Prints version") do |dh|
22
22
  puts "1.0.3"
23
23
  end
24
- opts.on("-init", "run wrapper pick workflow") do |dh|
24
+ opts.on("init", "run wrapper pick workflow") do |dh|
25
25
  Furion.makeConfig
26
26
  end
27
- opts.on("-create", "Create project") do |dh|
27
+ opts.on("create", "Create project") do |dh|
28
28
  puts "to be continue"
29
29
  end
30
30
  end.parse!
data/lib/furion.rb CHANGED
@@ -1,24 +1,33 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
1
2
 
2
3
  require 'json'
3
4
  require 'plist'
4
5
  require 'open-uri'
6
+ require 'furion/file_editor'
5
7
  class Furion
6
- def self.makeConfig
7
- uri = "https://git.huya.com/chenguohao2/FurionTemplateResource/raw/master/GenConfig.py"
8
- data = open(uri, 'User-Agent' => 'ruby'){|f| f.read}
9
- file = File.new "GenConfig.py", 'w+'
8
+
9
+ def self.fetchFile(fileName)
10
+ uri = "https://git.huya.com/chenguohao2/FurionTemplateResource/raw/master/"+fileName
11
+ data = open(uri){|f| f.read}
12
+ file = File.new fileName, 'w+'
10
13
  file.binmode
11
14
  file << data
12
15
  file.flush
13
16
  file.close
14
-
17
+ end
18
+
19
+ def self.makeConfig
20
+ self.fetchFile("GenConfig.py")
21
+ self.fetchFile("furionpod")
15
22
  result = `python GenConfig.py `
16
23
  File.write('data.json', result)
17
24
  puts "finish writting"
25
+ FileEditor.editPodfile
18
26
  `plutil -convert xml1 data.json -o MTPSDK.plist`
19
27
  File.delete('data.json')
20
28
  puts "Config finished, run 'pod install' to continue "
21
29
  end
22
30
  end
31
+ Furion.makeConfig
23
32
 
24
33
 
@@ -0,0 +1,64 @@
1
+
2
+ require 'json'
3
+ require 'plist'
4
+ require 'find'
5
+
6
+
7
+
8
+ class FileEditor
9
+ $wrapperGitUrl = "'https://git.huya.com/MTP/Wrapper-Specs.git'"
10
+ def self.getCuriOSProjName
11
+ Find.find(Dir::pwd) do |path|
12
+ if path.end_with? ".xcodeproj" and File.directory? path
13
+ return File.basename(path, ".*")
14
+ break
15
+ end
16
+ end
17
+ end
18
+
19
+ def self.editPodfile
20
+ projName = self.getCuriOSProjName
21
+ File.open("_Podfile", "w") do |out|
22
+ hasSource = false
23
+ hasAddRequire = false
24
+ File.foreach("Podfile") do |line|
25
+ if !hasAddRequire
26
+ out.puts "source " + $wrapperGitUrl
27
+ out.puts "load 'furionpod'"
28
+ hasAddRequire = true
29
+ end
30
+ out.puts line
31
+
32
+ # if line =~ /#*source +'[a-zA-z]+:\/\/[^\s]*'/
33
+ # hasSource = true
34
+ # puts "found it"
35
+ # else
36
+ # if hasSource
37
+ #
38
+ # end
39
+ # hasSource = false
40
+ # end
41
+
42
+ if line =~ /target +'#{projName}'/
43
+ puts "target "+projName
44
+ out.puts " loadFurionConfigPod()"
45
+ end
46
+ end
47
+
48
+ end
49
+ File.delete("Podfile")
50
+ File.rename("_Podfile","Podfile")
51
+ end
52
+
53
+ def loadWrapperExample
54
+
55
+
56
+ end
57
+ end
58
+
59
+
60
+
61
+
62
+
63
+
64
+
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.3
4
+ version: 1.0.4
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-10-16 00:00:00.000000000 Z
11
+ date: 2019-10-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: MTP Huya is the best!!!
14
14
  email: mtphuya@yandex.com
@@ -19,6 +19,7 @@ extra_rdoc_files: []
19
19
  files:
20
20
  - bin/furion
21
21
  - lib/furion.rb
22
+ - lib/furion/file_editor.rb
22
23
  homepage: https://rubygems.org/gems/furion
23
24
  licenses:
24
25
  - MIT