dfb 1.0.8 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/dfb +8 -0
- data/dfb.gemspec +2 -1
- data/lib/YDImage +55 -0
- data/lib/dfb.rb +115 -30
- data/lib/dfb/version.rb +1 -1
- data/lib/path_manager.rb +55 -0
- metadata +3 -18
- data/dfb-0.0.1.gem +0 -0
- data/dfb-0.0.2.gem +0 -0
- data/dfb-0.0.3.gem +0 -0
- data/dfb-0.0.4.gem +0 -0
- data/dfb-0.0.5.gem +0 -0
- data/dfb-0.0.6.gem +0 -0
- data/dfb-0.0.7.gem +0 -0
- data/dfb-0.0.8.gem +0 -0
- data/dfb-0.0.9.gem +0 -0
- data/dfb-1.0.0.gem +0 -0
- data/dfb-1.0.1.gem +0 -0
- data/dfb-1.0.2.gem +0 -0
- data/dfb-1.0.3.gem +0 -0
- data/dfb-1.0.4.gem +0 -0
- data/dfb-1.0.5.gem +0 -0
- data/dfb-1.0.6.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b994b59f0df1aa6a82e96a6768e594d2c010fc34c280b20ec80c103ad0c8b6c9
|
4
|
+
data.tar.gz: dfa56b0c8523ccf462d7c84a8b5f285cc2f59defdba785d7d1891369bd453c96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f4b0ce060196517ec2ef276a7b140f402fd48ca27abaff681e38549e544d529933d37911835f9d44444d4004485153ba04d8b2e127611293a8157fbf96dcca9
|
7
|
+
data.tar.gz: 81f3debae0ddd252894016d075f6ee27155efadf13dc66dfdfb6c61be44cc871baff71ee7329c8f19321e5634cdf9a35edcece9059da93281a71d4c54b55ea83
|
data/bin/dfb
CHANGED
@@ -55,6 +55,14 @@ class App
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
+
desc '修改当前工程指向的目录'
|
59
|
+
arg_name 'Describe arguments to complete here'
|
60
|
+
command :change do |c|
|
61
|
+
c.action do |global_options,options,args|
|
62
|
+
Dfb.changePath
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
58
66
|
desc '配置flutter环境'
|
59
67
|
arg_name 'Describe arguments to add here'
|
60
68
|
command :init_flutter do |c|
|
data/dfb.gemspec
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# Ensure we require the local version and not one we might have installed already
|
2
2
|
require File.join([File.dirname(__FILE__),'lib','dfb','version.rb'])
|
3
|
+
require File.join([File.dirname(__FILE__),'lib','path_manager.rb'])
|
3
4
|
spec = Gem::Specification.new do |s|
|
4
5
|
s.name = 'dfb'
|
5
6
|
s.version = Dfb::VERSION
|
@@ -10,7 +11,7 @@ spec = Gem::Specification.new do |s|
|
|
10
11
|
s.summary = 'A description of your project'
|
11
12
|
s.files = `git ls-files`.split("
|
12
13
|
")
|
13
|
-
s.require_paths
|
14
|
+
s.require_paths = 'lib'
|
14
15
|
s.extra_rdoc_files = ['README.rdoc','dfb.rdoc']
|
15
16
|
s.rdoc_options << '--title' << 'dfb' << '--main' << 'README.rdoc' << '-ri'
|
16
17
|
s.bindir = 'bin'
|
data/lib/YDImage
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
module YDImagePath
|
6
|
+
|
7
|
+
def self.printAll(path, isdark = true)
|
8
|
+
system "mkdir " + path + "/image"
|
9
|
+
system "mkdir " + path + "/image/2.0x"
|
10
|
+
system "mkdir " + path + "/image/3.0x"
|
11
|
+
arr = Dir.children(path)
|
12
|
+
# puts arr
|
13
|
+
arr.each { |name|
|
14
|
+
# puts name
|
15
|
+
outputs = name.sub(/\..*/,"")
|
16
|
+
if File.ftype(path + "/" + name) == "directory"
|
17
|
+
next
|
18
|
+
end
|
19
|
+
|
20
|
+
if outputs =~ /(.*)@2x/ || outputs =~ /(.*)@3x/
|
21
|
+
if outputs =~ /(.*)@2x/
|
22
|
+
# puts outputs
|
23
|
+
FileUtils.cp(path + "/" + name, path + "/image/2.0x")
|
24
|
+
File.rename(path + "/image/2.0x/" + name, path + "/image/2.0x/" + name.sub(/\@2x/,isdark ? "_dark" : ""))
|
25
|
+
end
|
26
|
+
|
27
|
+
if outputs =~ /(.*)@3x/
|
28
|
+
# puts outputs
|
29
|
+
FileUtils.cp(path + "/" + name, path + "/image/3.0x")
|
30
|
+
File.rename(path + "/image/3.0x/" + name, path + "/image/3.0x/" + name.sub(/\@3x/, isdark ? "_dark" : "") )
|
31
|
+
end
|
32
|
+
else
|
33
|
+
FileUtils.cp(path + "/" + name, path + "/image")
|
34
|
+
if isdark
|
35
|
+
File.rename(path + "/image/" + name, path + "/image/" + name.sub(/\.png/, "_dark.png") )
|
36
|
+
end
|
37
|
+
|
38
|
+
puts "static const " + outputs + " = \"" + outputs + ".png\";"
|
39
|
+
end
|
40
|
+
}
|
41
|
+
arr.each { |name|
|
42
|
+
if File.ftype(path + "/" + name) == "directory"
|
43
|
+
next
|
44
|
+
end
|
45
|
+
name = name.sub(/\..*/,"")
|
46
|
+
if !(name =~ /(.*)@2x/ || name =~ /(.*)@3x/)
|
47
|
+
puts "var " + name + ";"
|
48
|
+
end
|
49
|
+
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
YDImagePath.printAll("/Users/chedch/Downloads/词典_单词本_切图/DarkMode",true)
|
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,55 +15,80 @@ 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
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
31
|
+
puts "正在配置flutter环境"
|
32
|
+
outputs = File.dirname(__FILE__)
|
33
|
+
outputs = outputs.chop.chop.chop.chop #看到这行代码别骂作者,作者也不熟悉ruby,这个意思是说去除/lib
|
34
|
+
puts outputs
|
35
|
+
system "sh " + outputs + "/install_flutter_env.sh"
|
25
36
|
end
|
26
37
|
|
27
38
|
def self.run_ios
|
28
|
-
|
39
|
+
#ideviceinstaller https://www.jianshu.com/p/92273e86ab2b
|
29
40
|
# system "pod install"
|
41
|
+
if self.isHasProject == false
|
42
|
+
return
|
43
|
+
end
|
30
44
|
p "还没有实现"
|
31
45
|
end
|
32
46
|
|
33
47
|
def self.run_android
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
48
|
+
#https://blog.csdn.net/tymatlab/article/details/80989769
|
49
|
+
if self.isHasProject == false
|
50
|
+
return
|
51
|
+
end
|
52
|
+
self.flutter_clean
|
53
|
+
self.pub_get
|
54
|
+
#打包
|
55
|
+
system self.cdPathWithAndroidExample + ";./gradlew assembleDebug;"
|
56
|
+
#装载,运行
|
57
|
+
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
58
|
|
42
59
|
end
|
43
60
|
|
44
61
|
def self.attach
|
45
|
-
|
46
|
-
|
62
|
+
if self.isHasProject == false
|
63
|
+
return
|
64
|
+
end
|
65
|
+
puts "执行 flutter attach"
|
66
|
+
system self.cdPathWithFlutterModule + ";flutter attach;"
|
47
67
|
end
|
48
68
|
|
49
69
|
def self.create_package(packageName)
|
70
|
+
if self.isHasProject == false
|
71
|
+
return
|
72
|
+
end
|
50
73
|
self.checkEnv
|
51
|
-
|
52
|
-
command = "
|
74
|
+
puts "创建flutter package"
|
75
|
+
command = self.cdPathWithFlutterModule + "/Business;flutter create --template=package " + packageName
|
76
|
+
p command
|
53
77
|
system command
|
54
|
-
p "~/YDDictFlutter/YDNativeFlutterBridge/Embed/flutter_module/Business/" + packageName
|
55
78
|
end
|
56
79
|
|
57
80
|
def self.pub_get
|
58
|
-
|
81
|
+
if self.isHasProject == false
|
82
|
+
return
|
83
|
+
end
|
84
|
+
system self.cdPathWithFlutterModule + ";sh flutter_pub_get.sh"
|
59
85
|
end
|
60
86
|
|
61
87
|
def self.flutter_clean
|
62
|
-
|
88
|
+
if self.isHasProject == false
|
89
|
+
return
|
90
|
+
end
|
91
|
+
system self.cdPathWithFlutterModule + ";flutter clean;"
|
63
92
|
end
|
64
93
|
|
65
94
|
def self.checkEnv
|
@@ -70,21 +99,77 @@ module Dfb
|
|
70
99
|
def self.checkFlutter
|
71
100
|
outputs = system 'flutter --version'
|
72
101
|
if outputs == nil
|
73
|
-
|
102
|
+
puts '安装flutter...'
|
74
103
|
self.init_flutter
|
75
104
|
else
|
76
|
-
|
105
|
+
puts '已安装flutter环境'
|
77
106
|
end
|
78
107
|
end
|
79
108
|
|
80
109
|
def self.checkProject
|
81
|
-
outputs = system
|
110
|
+
outputs = system self.cdPathWithFlutterModule + ";"
|
82
111
|
if outputs == false
|
83
|
-
|
112
|
+
puts '工程已存在'
|
84
113
|
else
|
85
|
-
|
114
|
+
puts '正在下载工程..'
|
86
115
|
self.clone
|
87
116
|
end
|
88
117
|
end
|
89
|
-
|
118
|
+
|
119
|
+
def self.isHasProject
|
120
|
+
outputs = system self.cdPathWithFlutterModule + ";"
|
121
|
+
if outputs == false
|
122
|
+
puts '工程不存在'
|
123
|
+
return false
|
124
|
+
else
|
125
|
+
return true
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
def self.changePath
|
130
|
+
puts "如果您的工程是YDNativeFlutterBridge 路径是 /Users/chedch/YDDictFlutter/YDNativeFlutterBridge,则输入此路径"
|
131
|
+
puts "请输入您的新的YDNativeFlutterBridge工程路径:"
|
132
|
+
|
133
|
+
val = gets
|
134
|
+
if val =~ /(.*)\/YDNativeFlutterBridge/
|
135
|
+
PathManager.inputPath(val.chop)
|
136
|
+
else
|
137
|
+
puts "'change path' fails"
|
138
|
+
end
|
139
|
+
|
140
|
+
end
|
141
|
+
|
142
|
+
def self.projectPath
|
143
|
+
return PathManager.outputPath
|
144
|
+
end
|
145
|
+
|
146
|
+
def self.cdPath(path)
|
147
|
+
if PathManager.containsPath
|
148
|
+
puts '当前目录:'
|
149
|
+
puts self.projectPath + path
|
150
|
+
return "cd " + self.projectPath + path
|
151
|
+
else
|
152
|
+
puts "路径有错误"
|
153
|
+
return ""
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
def self.cdPathWithFlutterModule
|
158
|
+
self.cdPath("/Embed/flutter_module")
|
159
|
+
end
|
160
|
+
|
161
|
+
def self.cdPathWithAndroidExample
|
162
|
+
self.cdPath("/android_example")
|
163
|
+
end
|
90
164
|
end
|
165
|
+
|
166
|
+
# 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")
|
167
|
+
# Dfb.systemCDInProject
|
168
|
+
# Dfb.attach
|
169
|
+
# Dfb.systemCDInProject
|
170
|
+
# Dfb.changePath
|
171
|
+
# Dfb.run_android
|
172
|
+
# Dfb.cdPathWithFlutterModule
|
173
|
+
# Dfb.cdPathWithAndroidExample
|
174
|
+
|
175
|
+
|
data/lib/dfb/version.rb
CHANGED
data/lib/path_manager.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
|
4
|
+
module PathManager
|
5
|
+
|
6
|
+
def self.inputPath(path)
|
7
|
+
if self.containsPath
|
8
|
+
puts "确定您的新路径?为" + path
|
9
|
+
puts "y/n"
|
10
|
+
val = gets
|
11
|
+
if val =~ /Y|y/
|
12
|
+
self.deletePathFile
|
13
|
+
self.storagePathFile(path)
|
14
|
+
return
|
15
|
+
else
|
16
|
+
p "结束"
|
17
|
+
return
|
18
|
+
end
|
19
|
+
end
|
20
|
+
self.storagePathFile(path)
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.outputPath
|
25
|
+
return IO.readlines(self.pathFileName)[0]
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.storagePathFile(path)
|
29
|
+
file = File.new(self.pathFileName,"w");
|
30
|
+
file << path
|
31
|
+
file.close;
|
32
|
+
puts "更改路径成功!路径为:" + path
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.deletePathFile
|
36
|
+
File.delete(self.pathFileName)
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.containsPath
|
40
|
+
if File.exists?(self.pathFileName)
|
41
|
+
puts '当前根目录: '
|
42
|
+
IO.foreach(self.pathFileName) { |c|
|
43
|
+
puts c
|
44
|
+
}
|
45
|
+
return true
|
46
|
+
else
|
47
|
+
puts "根目录不存在,请添加!"
|
48
|
+
return false
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.pathFileName
|
53
|
+
return "dfb_path_file"
|
54
|
+
end
|
55
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dfb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- chedechao
|
@@ -80,30 +80,16 @@ files:
|
|
80
80
|
- README.rdoc
|
81
81
|
- Rakefile
|
82
82
|
- bin/dfb
|
83
|
-
- dfb-0.0.1.gem
|
84
|
-
- dfb-0.0.2.gem
|
85
|
-
- dfb-0.0.3.gem
|
86
|
-
- dfb-0.0.4.gem
|
87
|
-
- dfb-0.0.5.gem
|
88
|
-
- dfb-0.0.6.gem
|
89
|
-
- dfb-0.0.7.gem
|
90
|
-
- dfb-0.0.8.gem
|
91
|
-
- dfb-0.0.9.gem
|
92
|
-
- dfb-1.0.0.gem
|
93
|
-
- dfb-1.0.1.gem
|
94
|
-
- dfb-1.0.2.gem
|
95
|
-
- dfb-1.0.3.gem
|
96
|
-
- dfb-1.0.4.gem
|
97
|
-
- dfb-1.0.5.gem
|
98
|
-
- dfb-1.0.6.gem
|
99
83
|
- dfb.gemspec
|
100
84
|
- dfb.rdoc
|
101
85
|
- features/dfb.feature
|
102
86
|
- features/step_definitions/dfb_steps.rb
|
103
87
|
- features/support/env.rb
|
104
88
|
- install_flutter_env.sh
|
89
|
+
- lib/YDImage
|
105
90
|
- lib/dfb.rb
|
106
91
|
- lib/dfb/version.rb
|
92
|
+
- lib/path_manager.rb
|
107
93
|
- test/default_test.rb
|
108
94
|
- test/test_helper.rb
|
109
95
|
homepage: https://github.com/YoudaoMobile/DictFlutterCommand.git
|
@@ -118,7 +104,6 @@ rdoc_options:
|
|
118
104
|
- "-ri"
|
119
105
|
require_paths:
|
120
106
|
- lib
|
121
|
-
- lib
|
122
107
|
required_ruby_version: !ruby/object:Gem::Requirement
|
123
108
|
requirements:
|
124
109
|
- - ">="
|
data/dfb-0.0.1.gem
DELETED
Binary file
|
data/dfb-0.0.2.gem
DELETED
Binary file
|
data/dfb-0.0.3.gem
DELETED
Binary file
|
data/dfb-0.0.4.gem
DELETED
Binary file
|
data/dfb-0.0.5.gem
DELETED
Binary file
|
data/dfb-0.0.6.gem
DELETED
Binary file
|
data/dfb-0.0.7.gem
DELETED
Binary file
|
data/dfb-0.0.8.gem
DELETED
Binary file
|
data/dfb-0.0.9.gem
DELETED
Binary file
|
data/dfb-1.0.0.gem
DELETED
Binary file
|
data/dfb-1.0.1.gem
DELETED
Binary file
|
data/dfb-1.0.2.gem
DELETED
Binary file
|
data/dfb-1.0.3.gem
DELETED
Binary file
|
data/dfb-1.0.4.gem
DELETED
Binary file
|
data/dfb-1.0.5.gem
DELETED
Binary file
|
data/dfb-1.0.6.gem
DELETED
Binary file
|