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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/dfb.rb +77 -20
  3. data/lib/dfb/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4637f7ab227526f728fc7005bdc70235b99c8dbffdedbcc78f21601b98713046
4
- data.tar.gz: de49e7531a512a10d16830f51b4766c796171540b69705db274d97b900496480
3
+ metadata.gz: 1d028ff9e593b7186dc61c4ba659314a87d940ea2b0b83e297c4781ee4129bf9
4
+ data.tar.gz: 0aef05e23f43ee9b53bb844d8ecfd90813c2132cef2f2f512736158d888fb1bd
5
5
  SHA512:
6
- metadata.gz: 9c1623b4b6cfa6984557d5bdc28f352df1315177df5d3fe82c027722d76c31a45b31ab632d3b50a54ea323d2e1ccd410ad59bad19b4e03e3770b71805d45df3f
7
- data.tar.gz: 4cb37fd08953c817f5dda7063e1f9eff84cc69344050d0ff431bd3b4c359bc270987bfd4d686c36119523335593021c2003f1c09191f58a764bc0c400bea8e70
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
- 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,16 +15,23 @@ 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环境"
31
+ puts "正在配置flutter环境"
21
32
  outputs = File.dirname(__FILE__)
22
33
  outputs = outputs.chop.chop.chop.chop #看到这行代码别骂作者,作者也不熟悉ruby,这个意思是说去除/lib
23
- p outputs
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 "cd ~/YDDictFlutter/YDNativeFlutterBridge/android_example;./gradlew assembleDebug;"
49
+ system self.cdPathWithAndroidExample + ";./gradlew assembleDebug;"
39
50
  #装载,运行
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/.MainActivity;"
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
- p "执行 flutter attach"
46
- system "cd ~/YDDictFlutter/YDNativeFlutterBridge/Embed/flutter_module;flutter attach;"
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
- p "创建flutter package"
52
- command = "cd ~/YDDictFlutter/YDNativeFlutterBridge/Embed/flutter_module/Business;flutter create --template=package " + packageName
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 "cd ~/YDDictFlutter/YDNativeFlutterBridge/Embed/flutter_module;sh flutter_pub_get.sh"
69
+ system self.cdPathWithFlutterModule + ";sh flutter_pub_get.sh"
59
70
  end
60
71
 
61
72
  def self.flutter_clean
62
- system "cd ~/YDDictFlutter/YDNativeFlutterBridge/Embed/flutter_module;flutter clean;"
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
- p '安装flutter...'
84
+ puts '安装flutter...'
74
85
  self.init_flutter
75
86
  else
76
- p '已安装flutter环境'
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
- p '工程已存在'
94
+ puts '工程已存在'
84
95
  else
85
- p '正在下载工程..'
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
+
@@ -1,3 +1,3 @@
1
1
  module Dfb
2
- VERSION = '1.0.8'
2
+ VERSION = '1.0.9'
3
3
  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.0.8
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - chedechao