vvtool 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +5 -5
- data/bin/vvtool +1 -2
- data/lib/vvtool.rb +3 -2
- data/lib/{live_server.rb → vvtool/live_server.rb} +88 -82
- data/lib/{utils.rb → vvtool/utils.rb} +0 -0
- data/lib/vvtool/version.rb +1 -1
- data/lib/{version_checker.rb → vvtool/version_checker.rb} +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 668a54ed11dccbb02442c07b01fb1f722a69c60e652c2a8ebac4a5f86ac656c3
|
4
|
+
data.tar.gz: 613fab98b7b3bcce11180134ef8cad3bdf54b6b1c143202fda37679f42b129eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 170c5ee0a2d048e33cb0ab89cf757af1ba996ba19fa0d42c0bd7b3096ea4a020d8ce512edec487f7a2a973888a64b1334ba673b5651128bc7001d3b0be2f55be
|
7
|
+
data.tar.gz: be0181373e6a0f903989645971baf8420f0dd4f99ebea5b58b991a5ac4435299d54068a4fe39aa821f84dd2eebcbad6ebee3c860dd5746e92f088a98c90e7fea
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
vvtool (0.1.
|
4
|
+
vvtool (0.1.5)
|
5
5
|
listen (~> 3.0)
|
6
6
|
rqrcode (~> 0.10.0)
|
7
7
|
thor (~> 0.20)
|
@@ -9,20 +9,20 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
chunky_png (1.3.
|
12
|
+
chunky_png (1.3.11)
|
13
13
|
ffi (1.9.25)
|
14
14
|
listen (3.1.5)
|
15
15
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
16
16
|
rb-inotify (~> 0.9, >= 0.9.7)
|
17
17
|
ruby_dep (~> 1.2)
|
18
|
-
rake (10.
|
18
|
+
rake (10.5.0)
|
19
19
|
rb-fsevent (0.10.3)
|
20
20
|
rb-inotify (0.9.10)
|
21
21
|
ffi (>= 0.5.0, < 2)
|
22
22
|
rqrcode (0.10.1)
|
23
23
|
chunky_png (~> 1.0)
|
24
24
|
ruby_dep (1.5.0)
|
25
|
-
thor (0.20.
|
25
|
+
thor (0.20.3)
|
26
26
|
|
27
27
|
PLATFORMS
|
28
28
|
ruby
|
@@ -33,4 +33,4 @@ DEPENDENCIES
|
|
33
33
|
vvtool!
|
34
34
|
|
35
35
|
BUNDLED WITH
|
36
|
-
1.
|
36
|
+
1.17.1
|
data/bin/vvtool
CHANGED
data/lib/vvtool.rb
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
2
|
|
3
3
|
require "vvtool/version"
|
4
|
+
require "vvtool/live_server.rb"
|
4
5
|
require 'Thor'
|
5
6
|
|
6
|
-
require_relative "live_server.rb"
|
7
7
|
|
8
8
|
module VVTool
|
9
|
+
|
9
10
|
class CLI < Thor
|
10
11
|
desc "run", "启动 VirtualView 实时预览服务"
|
11
12
|
def runLiveServer
|
12
|
-
live_server_run
|
13
|
+
VVTool::live_server_run()
|
13
14
|
end
|
14
15
|
|
15
16
|
desc "about", "关于"
|
@@ -159,109 +159,115 @@ module VVPrepare
|
|
159
159
|
end
|
160
160
|
end
|
161
161
|
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
162
|
+
module VVTool
|
163
|
+
# 第一次
|
164
|
+
def firstBuild(check_dependency)
|
165
|
+
# 0. Clean
|
166
|
+
VVPrepare.clean
|
167
|
+
|
168
|
+
if check_dependency
|
169
|
+
# 0.1 检查编译器 - 没有则下载
|
170
|
+
VVPrepare.checkVVCompiler
|
171
|
+
|
172
|
+
# 0.2 检查 config.properties - 没有则下载
|
173
|
+
VVPrepare.checkVVConfigProperties
|
174
|
+
end
|
174
175
|
|
175
|
-
|
176
|
-
VVPrepare.copyXML TemplatesPath
|
176
|
+
puts 'Start build templates...'
|
177
177
|
|
178
|
-
|
179
|
-
|
178
|
+
# 1. 拷贝出来集中所有 .xml 模版文件
|
179
|
+
VVPrepare.copyXML TemplatesPath
|
180
180
|
|
181
|
-
|
182
|
-
|
181
|
+
# 2. 生成 compiler.jar 编译所需的 templatelist.properties 文件
|
182
|
+
VVPrepare.generateProperties
|
183
183
|
|
184
|
-
|
185
|
-
|
184
|
+
# 3. 编译
|
185
|
+
VVPrepare.vvbuild
|
186
186
|
|
187
|
-
|
188
|
-
|
187
|
+
# 4. 生成 data.json
|
188
|
+
VVPrepare.generateDataJSON TemplatesPath
|
189
189
|
|
190
|
-
|
191
|
-
|
190
|
+
# 5. Clean
|
191
|
+
VVPrepare.clean
|
192
192
|
|
193
|
-
|
194
|
-
|
195
|
-
# 0. Clean
|
196
|
-
VVPrepare.clean
|
193
|
+
puts 'All templates build finished.'
|
194
|
+
end
|
197
195
|
|
198
|
-
#
|
199
|
-
|
196
|
+
# 单次编译
|
197
|
+
def singleBuild(aTemplatePath)
|
198
|
+
# 0. Clean
|
199
|
+
VVPrepare.clean
|
200
200
|
|
201
|
+
# 1. 拷贝出来集中所有 .xml 模版文件
|
202
|
+
VVPrepare.copyXML aTemplatePath
|
201
203
|
|
202
|
-
# 2. 生成 compiler.jar 编译所需的 templatelist.properties 文件
|
203
|
-
VVPrepare.generateProperties
|
204
204
|
|
205
|
-
|
206
|
-
|
205
|
+
# 2. 生成 compiler.jar 编译所需的 templatelist.properties 文件
|
206
|
+
VVPrepare.generateProperties
|
207
207
|
|
208
|
-
|
209
|
-
|
208
|
+
# 3. 编译
|
209
|
+
VVPrepare.vvbuild
|
210
210
|
|
211
|
-
|
212
|
-
|
213
|
-
end
|
211
|
+
# 4. 生成 data.json
|
212
|
+
VVPrepare.generateDataJSON aTemplatePath
|
214
213
|
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
puts TemplatesPath
|
219
|
-
# HTTP Server
|
220
|
-
Thread.new {
|
221
|
-
http_server = WEBrick::HTTPServer.new(
|
222
|
-
:Port => HTTPServerPort,
|
223
|
-
:DocumentRoot => TemplatesPath,
|
224
|
-
:Logger => WEBrick::Log.new(VVBuildLogFilePath),
|
225
|
-
:AccessLog => []
|
226
|
-
)
|
227
|
-
http_server.start
|
228
|
-
}
|
214
|
+
# 5. Clean
|
215
|
+
VVPrepare.clean
|
216
|
+
end
|
229
217
|
|
230
|
-
|
218
|
+
def live_server_run(check_dependency = true)
|
219
|
+
self.firstBuild(check_dependency)
|
220
|
+
|
221
|
+
puts TemplatesPath
|
222
|
+
# HTTP Server
|
223
|
+
Thread.new {
|
224
|
+
http_server = WEBrick::HTTPServer.new(
|
225
|
+
:Port => HTTPServerPort,
|
226
|
+
:DocumentRoot => TemplatesPath,
|
227
|
+
:Logger => WEBrick::Log.new(VVBuildLogFilePath),
|
228
|
+
:AccessLog => []
|
229
|
+
)
|
230
|
+
http_server.start
|
231
|
+
}
|
231
232
|
|
232
|
-
|
233
|
-
listener = Listen.to(TemplatesPath, only: [/\.xml$/, /\.json$/]) { |modified, added, removed|
|
234
|
-
(modified + added).each { |filePath|
|
235
|
-
thisTemplatePath = Pathname.new(filePath).dirname
|
236
|
-
thisTemplateName = File.basename filePath, '.*'
|
237
|
-
thisTemplateNameAndExt = File.basename filePath
|
238
|
-
next if thisTemplateNameAndExt == 'data.json'
|
239
|
-
puts "[#{ Time.now.strftime("%H:%M:%S") }] Update template: #{thisTemplateName} (#{thisTemplateNameAndExt})"
|
233
|
+
puts "Start HTTP server: http://#{LocalIP || '127.0.0.1'}:#{HTTPServerPort}"
|
240
234
|
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
235
|
+
# File Watch
|
236
|
+
listener = Listen.to(TemplatesPath, only: [/\.xml$/, /\.json$/]) { |modified, added, removed|
|
237
|
+
(modified + added).each { |filePath|
|
238
|
+
thisTemplatePath = Pathname.new(filePath).dirname
|
239
|
+
thisTemplateName = File.basename filePath, '.*'
|
240
|
+
thisTemplateNameAndExt = File.basename filePath
|
241
|
+
next if thisTemplateNameAndExt == 'data.json'
|
242
|
+
puts "[#{ Time.now.strftime("%H:%M:%S") }] Update template: #{thisTemplateName} (#{thisTemplateNameAndExt})"
|
246
243
|
|
247
|
-
|
248
|
-
|
244
|
+
self.singleBuild thisTemplatePath
|
245
|
+
VVPrepare.clean
|
246
|
+
$buildCount += 1
|
247
|
+
}
|
248
|
+
}.start
|
249
249
|
|
250
|
-
|
250
|
+
puts 'Start Watching...'
|
251
251
|
puts ''
|
252
|
-
puts "Bye, see you next time, build count: #{$buildCount}"
|
253
|
-
|
254
|
-
# clean
|
255
|
-
FileUtils.rm_f VVBuildLogFilePath
|
256
|
-
FileUtils.rm_f DirFilePath
|
257
252
|
|
258
|
-
|
259
|
-
|
253
|
+
trap "SIGINT" do
|
254
|
+
puts ''
|
255
|
+
puts "Bye, see you next time, build count: #{$buildCount}"
|
256
|
+
|
257
|
+
# clean
|
258
|
+
FileUtils.rm_f VVBuildLogFilePath
|
259
|
+
FileUtils.rm_f DirFilePath
|
260
260
|
|
261
|
-
|
262
|
-
|
261
|
+
exit 130
|
262
|
+
end
|
263
263
|
|
264
|
-
|
265
|
-
|
264
|
+
# 从 RubyGems 上检查新版本
|
265
|
+
check_new_version
|
266
|
+
|
267
|
+
sleep
|
268
|
+
end
|
266
269
|
|
267
|
-
|
270
|
+
module_function :live_server_run
|
271
|
+
module_function :firstBuild
|
272
|
+
module_function :singleBuild
|
273
|
+
end
|
File without changes
|
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.5
|
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-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -96,11 +96,11 @@ files:
|
|
96
96
|
- README.md
|
97
97
|
- Rakefile
|
98
98
|
- bin/vvtool
|
99
|
-
- lib/live_server.rb
|
100
|
-
- lib/utils.rb
|
101
|
-
- lib/version_checker.rb
|
102
99
|
- lib/vvtool.rb
|
100
|
+
- lib/vvtool/live_server.rb
|
101
|
+
- lib/vvtool/utils.rb
|
103
102
|
- lib/vvtool/version.rb
|
103
|
+
- lib/vvtool/version_checker.rb
|
104
104
|
- vvtool.gemspec
|
105
105
|
homepage: https://github.com/isaced/VVTool
|
106
106
|
licenses:
|