dfb 1.0.8 → 1.0.9
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 +4 -4
- data/lib/dfb.rb +77 -20
- data/lib/dfb/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d028ff9e593b7186dc61c4ba659314a87d940ea2b0b83e297c4781ee4129bf9
|
4
|
+
data.tar.gz: 0aef05e23f43ee9b53bb844d8ecfd90813c2132cef2f2f512736158d888fb1bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32ba80199b0bfff18d455f6a9742c1caf2b1cb4698d1d617e1091fc28df04a0e83f0f56a7f82ac9f2c089036b5abbe7819d1d28b27b1e78aabbec27f1910330c
|
7
|
+
data.tar.gz: d21b03d71894e612c02120291d3e3afc31874e9e2fe3d48b9b0c0d505c693d9a0f963be77937fc36682810651ff8be8e485ad93a1117b022a555f61bdfefcc3b
|
data/lib/dfb.rb
CHANGED
@@ -1,8 +1,12 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
1
3
|
require 'dfb/version.rb'
|
4
|
+
require './path_manager.rb'
|
2
5
|
|
3
6
|
# Add requires for other files you add to your project here, so
|
4
7
|
# you just need to require this one file in your bin file
|
5
|
-
|
8
|
+
# https://www.cnblogs.com/rubylouvre/archive/2011/04/04/2005122.html
|
9
|
+
module Dfb
|
6
10
|
# Your code goes here...
|
7
11
|
def self.hello
|
8
12
|
p "hello world"
|
@@ -11,16 +15,23 @@ module Dfb
|
|
11
15
|
end
|
12
16
|
|
13
17
|
def self.clone
|
14
|
-
|
15
|
-
|
16
|
-
|
18
|
+
puts "请输入您要放此工程的位置:"
|
19
|
+
val = gets
|
20
|
+
val = val.chop
|
21
|
+
path = val + "/YDNativeFlutterBridge"
|
22
|
+
puts "您的工程的路径为" + val + path
|
23
|
+
PathManager.inputPath(path)
|
24
|
+
puts "git clone ..."
|
25
|
+
|
26
|
+
system 'cd ' + val +'; git clone git@gitlab.corp.youdao.com:luna-dev/YDNativeFlutterBridge.git;'
|
27
|
+
system 'cd ' + path + ';git submodule init;git submodule update;'
|
17
28
|
end
|
18
29
|
|
19
30
|
def self.init_flutter
|
20
|
-
|
31
|
+
puts "正在配置flutter环境"
|
21
32
|
outputs = File.dirname(__FILE__)
|
22
33
|
outputs = outputs.chop.chop.chop.chop #看到这行代码别骂作者,作者也不熟悉ruby,这个意思是说去除/lib
|
23
|
-
|
34
|
+
puts outputs
|
24
35
|
system "sh " + outputs + "/install_flutter_env.sh"
|
25
36
|
end
|
26
37
|
|
@@ -35,31 +46,31 @@ module Dfb
|
|
35
46
|
self.flutter_clean
|
36
47
|
self.pub_get
|
37
48
|
#打包
|
38
|
-
system "
|
49
|
+
system self.cdPathWithAndroidExample + ";./gradlew assembleDebug;"
|
39
50
|
#装载,运行
|
40
|
-
system "
|
51
|
+
system self.cdPathWithAndroidExample + "/app/build/outputs/apk/debug/;adb install -r app-debug.apk;adb shell am start -n com.example.android_example/.MainActivity;"
|
41
52
|
|
42
53
|
end
|
43
54
|
|
44
55
|
def self.attach
|
45
|
-
|
46
|
-
system "
|
56
|
+
puts "执行 flutter attach"
|
57
|
+
system self.cdPathWithFlutterModule + ";flutter attach;"
|
47
58
|
end
|
48
59
|
|
49
60
|
def self.create_package(packageName)
|
50
61
|
self.checkEnv
|
51
|
-
|
52
|
-
command = "
|
62
|
+
puts "创建flutter package"
|
63
|
+
command = self.cdPathWithFlutterModule + "/Business;flutter create --template=package " + packageName
|
64
|
+
p command
|
53
65
|
system command
|
54
|
-
p "~/YDDictFlutter/YDNativeFlutterBridge/Embed/flutter_module/Business/" + packageName
|
55
66
|
end
|
56
67
|
|
57
68
|
def self.pub_get
|
58
|
-
system "
|
69
|
+
system self.cdPathWithFlutterModule + ";sh flutter_pub_get.sh"
|
59
70
|
end
|
60
71
|
|
61
72
|
def self.flutter_clean
|
62
|
-
system "
|
73
|
+
system self.cdPathWithFlutterModule + ";flutter clean;"
|
63
74
|
end
|
64
75
|
|
65
76
|
def self.checkEnv
|
@@ -70,21 +81,67 @@ module Dfb
|
|
70
81
|
def self.checkFlutter
|
71
82
|
outputs = system 'flutter --version'
|
72
83
|
if outputs == nil
|
73
|
-
|
84
|
+
puts '安装flutter...'
|
74
85
|
self.init_flutter
|
75
86
|
else
|
76
|
-
|
87
|
+
puts '已安装flutter环境'
|
77
88
|
end
|
78
89
|
end
|
79
90
|
|
80
91
|
def self.checkProject
|
81
92
|
outputs = system 'cd ~;mkdir YDDictFlutter'
|
82
93
|
if outputs == false
|
83
|
-
|
94
|
+
puts '工程已存在'
|
84
95
|
else
|
85
|
-
|
96
|
+
puts '正在下载工程..'
|
86
97
|
self.clone
|
87
98
|
end
|
88
99
|
end
|
89
|
-
|
100
|
+
|
101
|
+
def self.changePath
|
102
|
+
puts "如果您的工程是YDNativeFlutterBridge 路径是 /Users/chedch/YDDictFlutter/YDNativeFlutterBridge,则输入此路径"
|
103
|
+
puts "请输入您的新的YDNativeFlutterBridge工程路径:"
|
104
|
+
|
105
|
+
val = gets
|
106
|
+
if val =~ /(.*)\/YDNativeFlutterBridge/
|
107
|
+
PathManager.inputPath(val.chop)
|
108
|
+
else
|
109
|
+
puts "'change path' fails"
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
113
|
+
|
114
|
+
def self.projectPath
|
115
|
+
return PathManager.outputPath
|
116
|
+
end
|
117
|
+
|
118
|
+
def self.cdPath(path)
|
119
|
+
if PathManager.containsPath
|
120
|
+
puts '当前目录:'
|
121
|
+
puts self.projectPath + path
|
122
|
+
return "cd " + self.projectPath + path
|
123
|
+
else
|
124
|
+
puts "路径有错误"
|
125
|
+
return ""
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
def self.cdPathWithFlutterModule
|
130
|
+
self.cdPath("/Embed/flutter_module")
|
131
|
+
end
|
132
|
+
|
133
|
+
def self.cdPathWithAndroidExample
|
134
|
+
self.cdPath("/android_example")
|
135
|
+
end
|
90
136
|
end
|
137
|
+
|
138
|
+
# Dfb.changePath("/user/asdfadfasdf/sdfasdf/user/asdfadfasdf/sdfasdf/user/asdfadfasdf/sdfasdf/user/asdfadfasdf/sdfasdf/user/asdfadfasdf/sdfasdf/user/asdfadfasdf/sdfasdf/user/asdfadfasdf/sdfasdf/user/asdfadfasdf/sdfasdf/user/asdfadfasdf/sdfasdf")
|
139
|
+
# Dfb.systemCDInProject
|
140
|
+
# Dfb.clone
|
141
|
+
# Dfb.systemCDInProject
|
142
|
+
# Dfb.changePath
|
143
|
+
Dfb.run_android
|
144
|
+
# Dfb.cdPathWithFlutterModule
|
145
|
+
# Dfb.cdPathWithAndroidExample
|
146
|
+
|
147
|
+
|
data/lib/dfb/version.rb
CHANGED