vvtool 0.1.3 → 0.1.4
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.
- checksums.yaml +5 -5
- data/.travis.yml +8 -0
- data/Gemfile.lock +2 -2
- data/README.md +1 -3
- data/lib/live_server.rb +19 -5
- data/lib/utils.rb +6 -0
- data/lib/version_checker.rb +26 -0
- data/lib/vvtool.rb +2 -1
- data/lib/vvtool/version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 74ed4763ed8caa9579aeff4f6806856408bc82ab01ae397e34be317f94f0713f
|
4
|
+
data.tar.gz: 531a928af8d8f42a79846db6abc66abc04efd02449b7c6e35702245c451c98de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f44f05746a501d8fb5296bdc2b63c8b3f8b81bac00fa9b032d91c0683938df389f66fb3a06c8f717de461b12ec6d2b5c9ea55bb6e3450b3025045ac53023ada
|
7
|
+
data.tar.gz: b0a8c34cdeb5950b15b0baaf294708ada8de017f4308ea98d6a41e6dcabe783fe6cbd7439a48be7a61f510f9f19f7c39dd685e3dd6d34bfef31fcbb97b8835c4
|
data/.travis.yml
ADDED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
# VVTool
|
2
|
-
|
3
|
-
[](https://rubygems.org/gems/vvtool)
|
1
|
+
# VVTool [](https://travis-ci.org/isaced/VVTool) [](https://rubygems.org/gems/vvtool)
|
4
2
|
|
5
3
|
这是一个加速开发 Virtual View 模版的小脚本,让你能脱离繁重的开发环境 Xcode 和 Android Studio,只需一个轻量级的文本编辑器如 VSCode/Atom/SublimeText 即可开始进入开发,并且提供热加载能力,大大加速提高开发调试效率。
|
6
4
|
|
data/lib/live_server.rb
CHANGED
@@ -10,6 +10,9 @@ require 'net/http'
|
|
10
10
|
require 'socket'
|
11
11
|
require 'rqrcode'
|
12
12
|
|
13
|
+
require_relative 'utils.rb'
|
14
|
+
require_relative "version_checker.rb"
|
15
|
+
|
13
16
|
# 路径
|
14
17
|
PropertiesFileName = 'templatelist.properties'
|
15
18
|
ConfigPropertiesFileName = 'config.properties'
|
@@ -23,12 +26,18 @@ VVConfigPropertiesFilePath = File.join(TemplatesPath, ConfigPropertiesFileName)
|
|
23
26
|
PropertiesFilePath = File.join(TemplatesPath, PropertiesFileName)
|
24
27
|
DirFilePath = File.join(TemplatesPath, '.dir')
|
25
28
|
|
29
|
+
# VV 编译器下载地址 URL
|
26
30
|
VVCompilerDownloadURL = 'https://raw.githubusercontent.com/alibaba/virtualview_tools/bb727ac668856732f66c3845b27646c1b4124fc8/compiler-tools/TemplateWorkSpace/compiler.jar'
|
31
|
+
# VV 默认的 config.properties 下载地址 URL
|
27
32
|
VVConfigPropertiesDownloadURL = 'https://raw.githubusercontent.com/alibaba/virtualview_tools/bb727ac668856732f66c3845b27646c1b4124fc8/compiler-tools/TemplateWorkSpace/config.properties'
|
28
33
|
|
29
|
-
|
34
|
+
# 获取本机 IP
|
35
|
+
LocalIP = get_first_public_ipv4()
|
36
|
+
|
37
|
+
# HTTP 服务端口号
|
30
38
|
HTTPServerPort = 7788
|
31
39
|
|
40
|
+
# 编译次数计数
|
32
41
|
$buildCount = 1
|
33
42
|
|
34
43
|
module VVPrepare
|
@@ -130,9 +139,11 @@ module VVPrepare
|
|
130
139
|
end
|
131
140
|
|
132
141
|
# 生成二维码
|
133
|
-
|
134
|
-
|
135
|
-
|
142
|
+
if LocalIP
|
143
|
+
qrcode = RQRCode::QRCode.new("http://#{LocalIP}:#{HTTPServerPort}/#{templateName}/data.json")
|
144
|
+
qrcodeFilePath = File.join(aTemplatePath, "#{templateName}_QR.png")
|
145
|
+
qrcode.as_png(file: qrcodeFilePath)
|
146
|
+
end
|
136
147
|
}
|
137
148
|
|
138
149
|
# 生成模版目录结构 .dir(HTTP Server 读取)
|
@@ -216,7 +227,7 @@ def live_server_run
|
|
216
227
|
http_server.start
|
217
228
|
}
|
218
229
|
|
219
|
-
puts "Start HTTP server: http://#{LocalIP}:#{HTTPServerPort}"
|
230
|
+
puts "Start HTTP server: http://#{LocalIP || '127.0.0.1'}:#{HTTPServerPort}"
|
220
231
|
|
221
232
|
# File Watch
|
222
233
|
listener = Listen.to(TemplatesPath, only: [/\.xml$/, /\.json$/]) { |modified, added, removed|
|
@@ -247,6 +258,9 @@ def live_server_run
|
|
247
258
|
exit 130
|
248
259
|
end
|
249
260
|
|
261
|
+
# 从 RubyGems 上检查新版本
|
262
|
+
check_new_version
|
263
|
+
|
250
264
|
sleep
|
251
265
|
end
|
252
266
|
|
data/lib/utils.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'net/http'
|
4
|
+
require 'json'
|
5
|
+
require_relative "vvtool/version.rb"
|
6
|
+
|
7
|
+
RubyGemsLatestVersionURL = 'https://rubygems.org/api/v1/versions/vvtool/latest.json'
|
8
|
+
|
9
|
+
def get_remote_version
|
10
|
+
begin
|
11
|
+
Thread.new {
|
12
|
+
response = Net::HTTP.get(URI(RubyGemsLatestVersionURL))
|
13
|
+
response = JSON.parse(response)
|
14
|
+
yield response['version']
|
15
|
+
}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def check_new_version
|
20
|
+
get_remote_version { |remoteVersion|
|
21
|
+
currentVersion = VVTool::VERSION
|
22
|
+
if currentVersion < remoteVersion
|
23
|
+
puts "VVTool 发现新版本 v#{remoteVersion}(当前 v#{currentVersion}),可以通过命令 `sudo gem install vvtool` 升级"
|
24
|
+
end
|
25
|
+
}
|
26
|
+
end
|
data/lib/vvtool.rb
CHANGED
data/lib/vvtool/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vvtool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- isaced
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -89,6 +89,7 @@ extensions: []
|
|
89
89
|
extra_rdoc_files: []
|
90
90
|
files:
|
91
91
|
- ".gitignore"
|
92
|
+
- ".travis.yml"
|
92
93
|
- Gemfile
|
93
94
|
- Gemfile.lock
|
94
95
|
- LICENSE.txt
|
@@ -96,6 +97,8 @@ files:
|
|
96
97
|
- Rakefile
|
97
98
|
- bin/vvtool
|
98
99
|
- lib/live_server.rb
|
100
|
+
- lib/utils.rb
|
101
|
+
- lib/version_checker.rb
|
99
102
|
- lib/vvtool.rb
|
100
103
|
- lib/vvtool/version.rb
|
101
104
|
- vvtool.gemspec
|
@@ -119,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
122
|
version: '0'
|
120
123
|
requirements: []
|
121
124
|
rubyforge_project:
|
122
|
-
rubygems_version: 2.
|
125
|
+
rubygems_version: 2.7.6
|
123
126
|
signing_key:
|
124
127
|
specification_version: 4
|
125
128
|
summary: VVTool - VirtualView 工具集.
|