dfb 1.0.6 → 1.1.1

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: 234c2e18d0800b70833e88d64c19c6cbec9092bdbbd828ac636033853a1dcfc2
4
- data.tar.gz: cf812f6f496d55d89470513e7c19a07d05517d1cad6b05c7388c71b65d3276f1
3
+ metadata.gz: f81b3f500087438651df8fb1300c9bfe3c3f107413adb1d92f26ef8481a39431
4
+ data.tar.gz: e6d6edb4b254ebfc2a080e0a1cd4d2b0b06e382ce439c6950f350c3dd41718ae
5
5
  SHA512:
6
- metadata.gz: b0030740c37e5fceb4f25d690b0de256b3bd4d94b8334cd02d96513db89f814ee93dc797429516462e161ba9fd029a3a274dc3e27a3f36bb49586673fa9bcc1e
7
- data.tar.gz: c68ff98fecade1c430d4121815773b0cd24a1ecba9979a5caa1baabcf65dbca3c5614e4d536ac56b1b0fc3bc0dee6375f42a0fff4dee329b42c27d172f0703e7
6
+ metadata.gz: 688f8b8df3a3574b37f2c6a79f40ba4a7404f17e64eeaebb6982fd24b55c8763006dfc4fea336d1c6f33a1379f95c752baf91aa4653050be2c3967e703f4fe67
7
+ data.tar.gz: 7b9f0401ef3e90b9aefcdb41bca3fdb772a2f38999b4ff97fc100c6fdc00623c636b92855f0296c3fd215d3f702ebf9b326bbc87e44e04052f4ef9425d778886
data/bin/dfb CHANGED
@@ -47,6 +47,14 @@ class App
47
47
  end
48
48
  end
49
49
 
50
+ desc '修改当前工程指向的目录'
51
+ arg_name 'Describe arguments to complete here'
52
+ command :clone do |c|
53
+ c.action do |global_options,options,args|
54
+ Dfb.changePath
55
+ end
56
+ end
57
+
50
58
  desc '下载词典flutter工程'
51
59
  arg_name 'Describe arguments to complete here'
52
60
  command :clone do |c|
data/dfb-1.0.1.gem ADDED
Binary file
data/dfb-1.0.2.gem ADDED
Binary file
data/dfb-1.0.3.gem ADDED
Binary file
data/dfb-1.0.4.gem ADDED
Binary file
data/dfb-1.0.5.gem ADDED
Binary file
data/dfb-1.0.6.gem ADDED
Binary file
data/dfb-1.0.7.gem ADDED
Binary file
data/dfb-1.0.8.gem ADDED
Binary file
data/dfb-1.0.9.gem ADDED
Binary file
data/dfb-1.1.0.gem ADDED
Binary file
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 << 'lib'
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
- module Dfb
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
- p "git clone ..."
15
- system 'mkdir ~/YDDictFlutter; cd ~/YDDictFlutter;git clone git@gitlab.corp.youdao.com:luna-dev/YDNativeFlutterBridge.git;'
16
- system "cd ~/YDDictFlutter/YDNativeFlutterBridge;git submodule init;git submodule update;"
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
- p "正在配置flutter环境"
21
- outputs = File.dirname(__FILE__)
22
- outputs = outputs.chop.chop.chop.chop
23
- p outputs
24
- system "sh " + outputs + "/install_flutter_env.sh"
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
- #ideviceinstaller https://www.jianshu.com/p/92273e86ab2b
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
- #https://blog.csdn.net/tymatlab/article/details/80989769
35
- self.flutter_clean
36
- self.pub_get
37
- #打包
38
- system "cd ~/YDDictFlutter/YDNativeFlutterBridge/android_example;./gradlew assembleDebug;"
39
- #装载,运行
40
- system "cd ~/YDDictFlutter/YDNativeFlutterBridge/android_example/app/build/outputs/apk/debug/;adb install -r app-debug.apk;adb shell am start -n com.example.android_example/com.youdao.flutter.FlutterBaseActivity;"
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
- p "执行 flutter attach"
46
- system "cd ~/YDDictFlutter/YDNativeFlutterBridge/Embed/flutter_module;flutter attach;"
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
- p "创建flutter package"
52
- command = "cd ~/YDDictFlutter/YDNativeFlutterBridge/Embed/flutter_module/Business;flutter create --template=package " + packageName
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
- system "cd ~/YDDictFlutter/YDNativeFlutterBridge/Embed/flutter_module;sh flutter_pub_get.sh"
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
- system "cd ~/YDDictFlutter/YDNativeFlutterBridge/Embed/flutter_module;flutter clean;"
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
- p '安装flutter...'
102
+ puts '安装flutter...'
74
103
  self.init_flutter
75
104
  else
76
- p '已安装flutter环境'
105
+ puts '已安装flutter环境'
77
106
  end
78
107
  end
79
108
 
80
109
  def self.checkProject
81
- outputs = system 'cd ~;mkdir YDDictFlutter'
110
+ outputs = system self.cdPathWithFlutterModule + ";"
82
111
  if outputs == false
83
- p '工程已存在'
112
+ puts '工程已存在'
84
113
  else
85
- p '正在下载工程..'
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
@@ -1,3 +1,3 @@
1
1
  module Dfb
2
- VERSION = '1.0.6'
2
+ VERSION = '1.1.1'
3
3
  end
@@ -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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dfb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - chedechao
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-13 00:00:00.000000000 Z
11
+ date: 2019-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -90,14 +90,26 @@ files:
90
90
  - dfb-0.0.8.gem
91
91
  - dfb-0.0.9.gem
92
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
+ - dfb-1.0.7.gem
100
+ - dfb-1.0.8.gem
101
+ - dfb-1.0.9.gem
102
+ - dfb-1.1.0.gem
93
103
  - dfb.gemspec
94
104
  - dfb.rdoc
95
105
  - features/dfb.feature
96
106
  - features/step_definitions/dfb_steps.rb
97
107
  - features/support/env.rb
98
108
  - install_flutter_env.sh
109
+ - lib/YDImage
99
110
  - lib/dfb.rb
100
111
  - lib/dfb/version.rb
112
+ - lib/path_manager.rb
101
113
  - test/default_test.rb
102
114
  - test/test_helper.rb
103
115
  homepage: https://github.com/YoudaoMobile/DictFlutterCommand.git
@@ -112,7 +124,6 @@ rdoc_options:
112
124
  - "-ri"
113
125
  require_paths:
114
126
  - lib
115
- - lib
116
127
  required_ruby_version: !ruby/object:Gem::Requirement
117
128
  requirements:
118
129
  - - ">="