vvtool 0.1.2 → 0.1.3

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
  SHA1:
3
- metadata.gz: 860598aed5ceab6001c8827ce31925ec1cd6ebe9
4
- data.tar.gz: 4100c06820521ee5c174dd44f2f1281cde165290
3
+ metadata.gz: 981351ccbf3b6a5f9d3ef72442bf39a1bd840e42
4
+ data.tar.gz: 83a5df6b83dff552eb741e2aeee91803d212d54d
5
5
  SHA512:
6
- metadata.gz: 3fd961fab848c747add5357bdc762c7d295ae6ebd6f0b7db4d85a28cc7bb173192c3c883e75dfabd8275ad07705aeaedeba06b0be0ec04d5375943014c4c8ae3
7
- data.tar.gz: f984de4f2da67fccf91d0063093b70300c8b944beb47b0a7b9866853ebf3706b57f6840cbb7085c5103ee56a0a2082c4b8bb4b890f13c93c7d1cd91a18d5ad49
6
+ metadata.gz: 39e1e7b7936756acaf6cb6338da61d103e36c7d802447489212141129d16285716e1de0f17c1fbee399db1bad359ed5ffca6553fad85c7c521e107f9bfa9fd6d
7
+ data.tar.gz: dc94ba76391e984eec238f8c68ded2800c053b5724b10b8dd31996a9888611270eb3a2b302df53bbdce4521f47a3933eada38249f64742f11b010daf7bf7059d
data/Gemfile.lock CHANGED
@@ -3,11 +3,13 @@ PATH
3
3
  specs:
4
4
  vvtool (0.1.2)
5
5
  listen (~> 3.0)
6
+ rqrcode (~> 0.10.0)
6
7
  thor (~> 0.20)
7
8
 
8
9
  GEM
9
10
  remote: https://rubygems.org/
10
11
  specs:
12
+ chunky_png (1.3.10)
11
13
  ffi (1.9.25)
12
14
  listen (3.1.5)
13
15
  rb-fsevent (~> 0.9, >= 0.9.4)
@@ -17,6 +19,8 @@ GEM
17
19
  rb-fsevent (0.10.3)
18
20
  rb-inotify (0.9.10)
19
21
  ffi (>= 0.5.0, < 2)
22
+ rqrcode (0.10.1)
23
+ chunky_png (~> 1.0)
20
24
  ruby_dep (1.5.0)
21
25
  thor (0.20.0)
22
26
 
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # VVTool
2
2
 
3
- ![Gem](https://img.shields.io/gem/v/vvtool.svg)
3
+ [![Gem](https://img.shields.io/gem/v/vvtool.svg)](https://rubygems.org/gems/vvtool)
4
4
 
5
5
  这是一个加速开发 Virtual View 模版的小脚本,让你能脱离繁重的开发环境 Xcode 和 Android Studio,只需一个轻量级的文本编辑器如 VSCode/Atom/SublimeText 即可开始进入开发,并且提供热加载能力,大大加速提高开发调试效率。
6
6
 
@@ -15,6 +15,8 @@ gem install vvtool
15
15
  ```
16
16
 
17
17
  > 因为 VV 模版的编译器需要 Java 环境,所以另外需要 java 环境支持。
18
+ >
19
+ > 如果安装很慢或者超时,可以尝试切换下 RubyGems 源:https://gems.ruby-china.org/
18
20
 
19
21
  [![asciicast](https://asciinema.org/a/rtmYrXUexTG67RNpuGfGdvvGQ.png)](https://asciinema.org/a/rtmYrXUexTG67RNpuGfGdvvGQ)
20
22
 
@@ -64,3 +66,5 @@ vvtool run
64
66
  ## 原理
65
67
 
66
68
  ![source](https://i.loli.net/2018/08/02/5b630f232a97e.png)
69
+
70
+ > 编译工具依赖 [alibaba/virtualview_tools](https://github.com/alibaba/virtualview_tools)
data/lib/live_server.rb CHANGED
@@ -7,6 +7,8 @@ require 'Listen'
7
7
  require 'base64'
8
8
  require 'json'
9
9
  require 'net/http'
10
+ require 'socket'
11
+ require 'rqrcode'
10
12
 
11
13
  # 路径
12
14
  PropertiesFileName = 'templatelist.properties'
@@ -24,6 +26,9 @@ DirFilePath = File.join(TemplatesPath, '.dir')
24
26
  VVCompilerDownloadURL = 'https://raw.githubusercontent.com/alibaba/virtualview_tools/bb727ac668856732f66c3845b27646c1b4124fc8/compiler-tools/TemplateWorkSpace/compiler.jar'
25
27
  VVConfigPropertiesDownloadURL = 'https://raw.githubusercontent.com/alibaba/virtualview_tools/bb727ac668856732f66c3845b27646c1b4124fc8/compiler-tools/TemplateWorkSpace/config.properties'
26
28
 
29
+ LocalIP = Socket::getaddrinfo(Socket.gethostname,"echo",Socket::AF_INET)[0][3]
30
+ HTTPServerPort = 7788
31
+
27
32
  $buildCount = 1
28
33
 
29
34
  module VVPrepare
@@ -123,6 +128,11 @@ module VVPrepare
123
128
  f.write(JSON.pretty_generate dataHash)
124
129
  }
125
130
  end
131
+
132
+ # 生成二维码
133
+ qrcode = RQRCode::QRCode.new("http://#{LocalIP}:#{HTTPServerPort}/#{templateName}/data.json")
134
+ qrcodeFilePath = File.join(aTemplatePath, "#{templateName}_QR.png")
135
+ qrcode.as_png(file: qrcodeFilePath)
126
136
  }
127
137
 
128
138
  # 生成模版目录结构 .dir(HTTP Server 读取)
@@ -198,7 +208,7 @@ def live_server_run
198
208
  # HTTP Server
199
209
  Thread.new {
200
210
  http_server = WEBrick::HTTPServer.new(
201
- :Port => 7788,
211
+ :Port => HTTPServerPort,
202
212
  :DocumentRoot => TemplatesPath,
203
213
  :Logger => WEBrick::Log.new(VVBuildLogFilePath),
204
214
  :AccessLog => []
@@ -206,7 +216,7 @@ def live_server_run
206
216
  http_server.start
207
217
  }
208
218
 
209
- puts 'Start HTTP server: http://127.0.0.1:7788'
219
+ puts "Start HTTP server: http://#{LocalIP}:#{HTTPServerPort}"
210
220
 
211
221
  # File Watch
212
222
  listener = Listen.to(TemplatesPath, only: [/\.xml$/, /\.json$/]) { |modified, added, removed|
@@ -238,4 +248,6 @@ def live_server_run
238
248
  end
239
249
 
240
250
  sleep
241
- end
251
+ end
252
+
253
+ # live_server_run
@@ -1,3 +1,3 @@
1
1
  module VVTool
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
data/vvtool.gemspec CHANGED
@@ -28,4 +28,5 @@ Gem::Specification.new do |spec|
28
28
 
29
29
  spec.add_dependency "thor", "~> 0.20"
30
30
  spec.add_dependency "listen", "~> 3.0"
31
+ spec.add_dependency "rqrcode", "~> 0.10.0"
31
32
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vvtool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - isaced
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rqrcode
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.10.0
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.10.0
69
83
  description: 目前可用于结合 VVPlayground 支持 VirtualView 模版开发实时预览.
70
84
  email:
71
85
  - isaced@163.com