vvtool 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +8 -0
- data/lib/live_server.rb +25 -2
- data/lib/vvtool.rb +7 -1
- data/lib/vvtool/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 860598aed5ceab6001c8827ce31925ec1cd6ebe9
|
4
|
+
data.tar.gz: 4100c06820521ee5c174dd44f2f1281cde165290
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3fd961fab848c747add5357bdc762c7d295ae6ebd6f0b7db4d85a28cc7bb173192c3c883e75dfabd8275ad07705aeaedeba06b0be0ec04d5375943014c4c8ae3
|
7
|
+
data.tar.gz: f984de4f2da67fccf91d0063093b70300c8b944beb47b0a7b9866853ebf3706b57f6840cbb7085c5103ee56a0a2082c4b8bb4b890f13c93c7d1cd91a18d5ad49
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# VVTool
|
2
2
|
|
3
|
+
![Gem](https://img.shields.io/gem/v/vvtool.svg)
|
4
|
+
|
3
5
|
这是一个加速开发 Virtual View 模版的小脚本,让你能脱离繁重的开发环境 Xcode 和 Android Studio,只需一个轻量级的文本编辑器如 VSCode/Atom/SublimeText 即可开始进入开发,并且提供热加载能力,大大加速提高开发调试效率。
|
4
6
|
|
5
7
|
![screen_record.gif](https://raw.githubusercontent.com/alibaba/virtualview_tools/master/compiler-tools/RealtimePreview/screenshot.gif)
|
@@ -14,6 +16,8 @@ gem install vvtool
|
|
14
16
|
|
15
17
|
> 因为 VV 模版的编译器需要 Java 环境,所以另外需要 java 环境支持。
|
16
18
|
|
19
|
+
[![asciicast](https://asciinema.org/a/rtmYrXUexTG67RNpuGfGdvvGQ.png)](https://asciinema.org/a/rtmYrXUexTG67RNpuGfGdvvGQ)
|
20
|
+
|
17
21
|
## 运行
|
18
22
|
|
19
23
|
切换到你的模版列表目录,然后执行如下命令即可:
|
@@ -56,3 +60,7 @@ vvtool run
|
|
56
60
|
## 二维码扫描
|
57
61
|
|
58
62
|
每个模版目录下会生成类似 `xx_QR.png` 的二维码图片,指向当前模版对应的本地HTTP 地址,如 *http://127.0.0.1:7788/helloworld/data.json* ,对应 iOS/Android Playground 应用可通过二维码扫描读取该路径中的模版和数据,然后在客户端加载。
|
63
|
+
|
64
|
+
## 原理
|
65
|
+
|
66
|
+
![source](https://i.loli.net/2018/08/02/5b630f232a97e.png)
|
data/lib/live_server.rb
CHANGED
@@ -10,16 +10,19 @@ require 'net/http'
|
|
10
10
|
|
11
11
|
# 路径
|
12
12
|
PropertiesFileName = 'templatelist.properties'
|
13
|
+
ConfigPropertiesFileName = 'config.properties'
|
13
14
|
CompilerFileName = '.compiler.jar'
|
14
15
|
TemplatesPath = Dir.pwd
|
15
16
|
TemplatePath = File.join(TemplatesPath, 'template')
|
16
17
|
VVBuildPath = File.join(TemplatesPath, 'build')
|
17
18
|
VVBuildLogFilePath = File.join(TemplatesPath, '.vvbuild.log')
|
18
19
|
VVCompilerFilePath = File.join(TemplatesPath, CompilerFileName)
|
20
|
+
VVConfigPropertiesFilePath = File.join(TemplatesPath, ConfigPropertiesFileName)
|
19
21
|
PropertiesFilePath = File.join(TemplatesPath, PropertiesFileName)
|
20
22
|
DirFilePath = File.join(TemplatesPath, '.dir')
|
21
23
|
|
22
|
-
VVCompilerDownloadURL = 'https://raw.githubusercontent.com/alibaba/virtualview_tools/
|
24
|
+
VVCompilerDownloadURL = 'https://raw.githubusercontent.com/alibaba/virtualview_tools/bb727ac668856732f66c3845b27646c1b4124fc8/compiler-tools/TemplateWorkSpace/compiler.jar'
|
25
|
+
VVConfigPropertiesDownloadURL = 'https://raw.githubusercontent.com/alibaba/virtualview_tools/bb727ac668856732f66c3845b27646c1b4124fc8/compiler-tools/TemplateWorkSpace/config.properties'
|
23
26
|
|
24
27
|
$buildCount = 1
|
25
28
|
|
@@ -43,6 +46,7 @@ module VVPrepare
|
|
43
46
|
}
|
44
47
|
end
|
45
48
|
|
49
|
+
# 检查和下载 VV 编译器
|
46
50
|
def self.checkVVCompiler()
|
47
51
|
if File.exist? VVCompilerFilePath
|
48
52
|
puts 'Check VV compiler ok.'
|
@@ -58,6 +62,22 @@ module VVPrepare
|
|
58
62
|
end
|
59
63
|
end
|
60
64
|
|
65
|
+
# 检查和下载 config.properties
|
66
|
+
def self.checkVVConfigProperties()
|
67
|
+
if File.exist? VVConfigPropertiesFilePath
|
68
|
+
puts 'Check VV config.properties ok.'
|
69
|
+
else
|
70
|
+
puts 'Start downloading VV config.properties...'
|
71
|
+
File.write(VVConfigPropertiesFilePath, Net::HTTP.get(URI.parse(VVConfigPropertiesDownloadURL)))
|
72
|
+
if File.exist? VVConfigPropertiesFilePath
|
73
|
+
puts 'VV config.properties download success.'
|
74
|
+
else
|
75
|
+
puts 'VV config.properties download fail.'
|
76
|
+
exit
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
61
81
|
# 编译
|
62
82
|
def self.vvbuild()
|
63
83
|
system "java -jar #{VVCompilerFilePath} jarBuild > #{VVBuildLogFilePath}"
|
@@ -124,7 +144,10 @@ def firstBuild()
|
|
124
144
|
VVPrepare.clean
|
125
145
|
|
126
146
|
# 0.1 检查编译器 - 没有则下载
|
127
|
-
VVPrepare.checkVVCompiler
|
147
|
+
VVPrepare.checkVVCompiler
|
148
|
+
|
149
|
+
# 0.2 检查 config.properties - 没有则下载
|
150
|
+
VVPrepare.checkVVConfigProperties
|
128
151
|
|
129
152
|
puts 'Start build templates...'
|
130
153
|
|
data/lib/vvtool.rb
CHANGED
@@ -13,7 +13,13 @@ module VVTool
|
|
13
13
|
|
14
14
|
desc "about", "关于"
|
15
15
|
def about
|
16
|
-
puts "这个命令主要用于 VirtualView 实时预览"
|
16
|
+
puts "这个命令主要用于 VirtualView 实时预览 - https://github.com/isaced/VVTool"
|
17
|
+
end
|
18
|
+
|
19
|
+
map %w[--version -v] => :__print_version
|
20
|
+
desc "--version, -v", "版本"
|
21
|
+
def __print_version
|
22
|
+
puts VVTool::VERSION
|
17
23
|
end
|
18
24
|
end
|
19
25
|
end
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- isaced
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|