dfb 1.0.9 → 1.1.4
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 +48 -20
- 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: 2937ebc5d7cead24394a325193db9af93866758a6fac1b433405f8e34a50e0ce
|
4
|
+
data.tar.gz: b927beb5b92c9cc7b4efc0d3895f0caf3e9dcf8a1384540ed9ae83c54cc1470b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 798be36c950f4a289652a85b0cb555b37f3d6d433a74b7bef3b375c63c29177ddd0912c1fdeb65fe0734962f1fc4b22e01460b2c87085b4118513a84a79c3019
|
7
|
+
data.tar.gz: bcb9dba3b3e9457ea0daacc2b0654055e3d057fbd9d8ee7aa442cdda9a4d21ff54b0770d023338e4271b11fa704fa6f7be86242b6b7f3a04454c3d2e2d393a33
|
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,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
2
|
|
3
3
|
require 'dfb/version.rb'
|
4
|
-
require '
|
4
|
+
require 'path_manager.rb'
|
5
5
|
|
6
6
|
# Add requires for other files you add to your project here, so
|
7
7
|
# you just need to require this one file in your bin file
|
@@ -28,36 +28,48 @@ module Dfb
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def self.init_flutter
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
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"
|
36
36
|
end
|
37
37
|
|
38
38
|
def self.run_ios
|
39
|
-
|
39
|
+
#ideviceinstaller https://www.jianshu.com/p/92273e86ab2b
|
40
40
|
# system "pod install"
|
41
|
+
if self.isHasProject == false
|
42
|
+
return
|
43
|
+
end
|
41
44
|
p "还没有实现"
|
42
45
|
end
|
43
46
|
|
44
47
|
def self.run_android
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
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;"
|
52
58
|
|
53
59
|
end
|
54
60
|
|
55
61
|
def self.attach
|
62
|
+
if self.isHasProject == false
|
63
|
+
return
|
64
|
+
end
|
56
65
|
puts "执行 flutter attach"
|
57
|
-
|
66
|
+
system self.cdPathWithFlutterModule + ";flutter attach;"
|
58
67
|
end
|
59
68
|
|
60
69
|
def self.create_package(packageName)
|
70
|
+
if self.isHasProject == false
|
71
|
+
return
|
72
|
+
end
|
61
73
|
self.checkEnv
|
62
74
|
puts "创建flutter package"
|
63
75
|
command = self.cdPathWithFlutterModule + "/Business;flutter create --template=package " + packageName
|
@@ -66,10 +78,16 @@ module Dfb
|
|
66
78
|
end
|
67
79
|
|
68
80
|
def self.pub_get
|
81
|
+
if self.isHasProject == false
|
82
|
+
return
|
83
|
+
end
|
69
84
|
system self.cdPathWithFlutterModule + ";sh flutter_pub_get.sh"
|
70
85
|
end
|
71
86
|
|
72
87
|
def self.flutter_clean
|
88
|
+
if self.isHasProject == false
|
89
|
+
return
|
90
|
+
end
|
73
91
|
system self.cdPathWithFlutterModule + ";flutter clean;"
|
74
92
|
end
|
75
93
|
|
@@ -89,7 +107,7 @@ module Dfb
|
|
89
107
|
end
|
90
108
|
|
91
109
|
def self.checkProject
|
92
|
-
outputs = system
|
110
|
+
outputs = system self.cdPathWithFlutterModule + ";"
|
93
111
|
if outputs == false
|
94
112
|
puts '工程已存在'
|
95
113
|
else
|
@@ -98,11 +116,21 @@ module Dfb
|
|
98
116
|
end
|
99
117
|
end
|
100
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
|
+
|
101
129
|
def self.changePath
|
102
130
|
puts "如果您的工程是YDNativeFlutterBridge 路径是 /Users/chedch/YDDictFlutter/YDNativeFlutterBridge,则输入此路径"
|
103
131
|
puts "请输入您的新的YDNativeFlutterBridge工程路径:"
|
104
132
|
|
105
|
-
val = gets
|
133
|
+
val = STDIN.gets
|
106
134
|
if val =~ /(.*)\/YDNativeFlutterBridge/
|
107
135
|
PathManager.inputPath(val.chop)
|
108
136
|
else
|
@@ -137,10 +165,10 @@ module Dfb
|
|
137
165
|
|
138
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")
|
139
167
|
# Dfb.systemCDInProject
|
140
|
-
# Dfb.
|
168
|
+
# Dfb.attach
|
141
169
|
# Dfb.systemCDInProject
|
142
|
-
|
143
|
-
Dfb.run_android
|
170
|
+
Dfb.changePath
|
171
|
+
# Dfb.run_android
|
144
172
|
# Dfb.cdPathWithFlutterModule
|
145
173
|
# Dfb.cdPathWithAndroidExample
|
146
174
|
|
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.4
|
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
|