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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 74ed4763ed8caa9579aeff4f6806856408bc82ab01ae397e34be317f94f0713f
4
- data.tar.gz: 531a928af8d8f42a79846db6abc66abc04efd02449b7c6e35702245c451c98de
3
+ metadata.gz: 668a54ed11dccbb02442c07b01fb1f722a69c60e652c2a8ebac4a5f86ac656c3
4
+ data.tar.gz: 613fab98b7b3bcce11180134ef8cad3bdf54b6b1c143202fda37679f42b129eb
5
5
  SHA512:
6
- metadata.gz: 6f44f05746a501d8fb5296bdc2b63c8b3f8b81bac00fa9b032d91c0683938df389f66fb3a06c8f717de461b12ec6d2b5c9ea55bb6e3450b3025045ac53023ada
7
- data.tar.gz: b0a8c34cdeb5950b15b0baaf294708ada8de017f4308ea98d6a41e6dcabe783fe6cbd7439a48be7a61f510f9f19f7c39dd685e3dd6d34bfef31fcbb97b8835c4
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)
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.10)
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.4.2)
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.0)
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.16.4
36
+ 1.17.1
data/bin/vvtool CHANGED
@@ -1,3 +1,2 @@
1
1
  #!/usr/bin/env ruby
2
- require "vvtool.rb"
3
-
2
+ require "vvtool.rb"
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
- def firstBuild()
164
- # 0. Clean
165
- VVPrepare.clean
166
-
167
- # 0.1 检查编译器 - 没有则下载
168
- VVPrepare.checkVVCompiler
169
-
170
- # 0.2 检查 config.properties - 没有则下载
171
- VVPrepare.checkVVConfigProperties
172
-
173
- puts 'Start build templates...'
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
- # 1. 拷贝出来集中所有 .xml 模版文件
176
- VVPrepare.copyXML TemplatesPath
176
+ puts 'Start build templates...'
177
177
 
178
- # 2. 生成 compiler.jar 编译所需的 templatelist.properties 文件
179
- VVPrepare.generateProperties
178
+ # 1. 拷贝出来集中所有 .xml 模版文件
179
+ VVPrepare.copyXML TemplatesPath
180
180
 
181
- # 3. 编译
182
- VVPrepare.vvbuild
181
+ # 2. 生成 compiler.jar 编译所需的 templatelist.properties 文件
182
+ VVPrepare.generateProperties
183
183
 
184
- # 4. 生成 data.json
185
- VVPrepare.generateDataJSON TemplatesPath
184
+ # 3. 编译
185
+ VVPrepare.vvbuild
186
186
 
187
- # 5. Clean
188
- VVPrepare.clean
187
+ # 4. 生成 data.json
188
+ VVPrepare.generateDataJSON TemplatesPath
189
189
 
190
- puts 'All templates build finished.'
191
- end
190
+ # 5. Clean
191
+ VVPrepare.clean
192
192
 
193
- # 单次编译
194
- public def singleBuild(aTemplatePath)
195
- # 0. Clean
196
- VVPrepare.clean
193
+ puts 'All templates build finished.'
194
+ end
197
195
 
198
- # 1. 拷贝出来集中所有 .xml 模版文件
199
- VVPrepare.copyXML aTemplatePath
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
- # 3. 编译
206
- VVPrepare.vvbuild
205
+ # 2. 生成 compiler.jar 编译所需的 templatelist.properties 文件
206
+ VVPrepare.generateProperties
207
207
 
208
- # 4. 生成 data.json
209
- VVPrepare.generateDataJSON aTemplatePath
208
+ # 3. 编译
209
+ VVPrepare.vvbuild
210
210
 
211
- # 5. Clean
212
- VVPrepare.clean
213
- end
211
+ # 4. 生成 data.json
212
+ VVPrepare.generateDataJSON aTemplatePath
214
213
 
215
- def live_server_run
216
- firstBuild()
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
- puts "Start HTTP server: http://#{LocalIP || '127.0.0.1'}:#{HTTPServerPort}"
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
- # File Watch
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
- self.singleBuild thisTemplatePath
242
- VVPrepare.clean
243
- $buildCount += 1
244
- }
245
- }.start
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
- puts 'Start Watching...'
248
- puts ''
244
+ self.singleBuild thisTemplatePath
245
+ VVPrepare.clean
246
+ $buildCount += 1
247
+ }
248
+ }.start
249
249
 
250
- trap "SIGINT" do
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
- exit 130
259
- end
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
- # 从 RubyGems 上检查新版本
262
- check_new_version
261
+ exit 130
262
+ end
263
263
 
264
- sleep
265
- end
264
+ # 从 RubyGems 上检查新版本
265
+ check_new_version
266
+
267
+ sleep
268
+ end
266
269
 
267
- # live_server_run
270
+ module_function :live_server_run
271
+ module_function :firstBuild
272
+ module_function :singleBuild
273
+ end
File without changes
@@ -1,3 +1,3 @@
1
1
  module VVTool
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'net/http'
4
4
  require 'json'
5
- require_relative "vvtool/version.rb"
5
+ require 'vvtool/version.rb'
6
6
 
7
7
  RubyGemsLatestVersionURL = 'https://rubygems.org/api/v1/versions/vvtool/latest.json'
8
8
 
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
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-09-19 00:00:00.000000000 Z
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: