VictoriaFreSh 2021.5.30 → 2021.8.5

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/victoriafresh.rb +54 -20
  3. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8200dd9c707cfe64b4d442832bf3bee665e462e13df81b4c150c2ebb362083c6
4
- data.tar.gz: ff8d5014e0f0c50fd1e1b35ac7c020b6db66a78257945a920c5ce1ebad2d430e
3
+ metadata.gz: 56420350be0775983147211bbc1e063e84d70d3beb248435905d464e3a7c9ee8
4
+ data.tar.gz: 909ba2d147d8c77b8fd9ec1cc5ca355a3096b1e49db3be728a89d0e273e7d6a3
5
5
  SHA512:
6
- metadata.gz: 1badbf8fc68845f9147f8f0dee25a49d381a4d82823e34d8b3f54347fe782737732f2eb643af371a0ad1e7bbcef78162c6ddd9292bd4c451ee29115d2507eb00
7
- data.tar.gz: 8e623bb685ca8de357e99af359938dbc0baba26be36d1be464ed3db9e7979dd45710db8ab92768651c62637af19bb21c93f44424847822a54fb9eed4313dd6a6
6
+ metadata.gz: a9ec26c94028f210384ab83f02ea7514a0c3be06c7d06bb6b35477b5f379fc82ee06d2c5034ff28a03b926f10d247b1755a61140c0bec3c5a80942761c3ed814
7
+ data.tar.gz: be48ed2e3e0f1c3999172c9b71f79601033d12cfc63bdbfc3642c98a19d930712df052dc4e360ebe531fb74d2cd1c98b8c429a9496828526fe9c8cc328b940c6
data/lib/victoriafresh.rb CHANGED
@@ -66,20 +66,27 @@ class VictoriaFresh
66
66
 
67
67
  # pathToMake=pathPrefix + '/' + packagedFile.name #构造文件名
68
68
  pathToMake=pathPrefix + '/' + packagedFile['name'] #构造文件名
69
-
70
- victoriaFreshDataFile=File.new(pathToMake , "wb", packagedFile['permission']) #数据文件。
71
- victoriaFreshDataFile.syswrite(victoriaFreshData) #写入文件。
72
- victoriaFreshDataFile.close #关闭文件。
73
-
74
- FileUtils.touch pathToMake, :mtime => timeObject #设置修改时间
75
-
76
- permissionNumber=packagedFile['permission'] #获取权限数字
77
-
78
- if (permissionNumber.nil?) #不带权限字段
79
- elsif #带权限字段
69
+
70
+ begin
71
+ victoriaFreshDataFile=File.new(pathToMake , "wb", packagedFile['permission']) #数据文件。
72
+ victoriaFreshDataFile.syswrite(victoriaFreshData) #写入文件。
73
+ victoriaFreshDataFile.close #关闭文件。
74
+
75
+ FileUtils.touch pathToMake, :mtime => timeObject #设置修改时间
76
+
77
+ permissionNumber=packagedFile['permission'] #获取权限数字
78
+
79
+ if (permissionNumber.nil?) #不带权限字段
80
+ elsif #带权限字段
80
81
  File.chmod(permissionNumber, pathToMake) #设置权限
81
- end #if (permissionNumber.nil?) #不带权限字段
82
-
82
+ end #if (permissionNumber.nil?) #不带权限字段
83
+
84
+
85
+ rescue Errno::ENOENT # File not exist
86
+ puts "Rescued by Errno::ENOENT statement. #{pathToMake}" #报告错误
87
+ rescue Errno::EACCES # File permission error
88
+ puts "Rescued by Errno::EACCES statement. #{pathToMake}" #报告错误
89
+ end
83
90
  end #def writeFileExternalDataFile(pathPrefix, packagedFile) #写入文件
84
91
 
85
92
  def writeFile(pathPrefix, packagedFile, contentString) #写入文件
@@ -191,17 +198,37 @@ class VictoriaFresh
191
198
 
192
199
  if (Dir.exist?(pathToMake)) #目录已经存在
193
200
  else #目录 不存在
201
+ begin
194
202
  Dir.mkdir(pathToMake) #=> 0
203
+ rescue Errno::EILSEQ => e # File name invalid
204
+ puts "Rescued by Errno::EILSEQ statement. #{pathToMake}" # 报告错误
205
+
206
+ end
207
+
195
208
  end #if (Dir.exist?(pathToMake)) #目录已经存在
196
-
197
-
198
- FileUtils.touch pathToMake, :mtime => timeObject #设置修改时间
199
-
209
+
210
+ begin
211
+ FileUtils.touch pathToMake, :mtime => timeObject # 设置修改时间
212
+ rescue Errno::EILSEQ => e # File name invalid
213
+ puts "Rescued by Errno::EILSEQ statement. #{pathToMake}" # 报告错误
214
+
215
+ end
216
+
217
+
200
218
  permissionNumber=packagedFile['permission'] #获取权限数字
201
219
 
202
220
  if (permissionNumber.nil?) #不带权限字段
203
221
  elsif #带权限字段
204
- File.chmod(permissionNumber, pathToMake) #设置权限
222
+
223
+
224
+ begin
225
+ File.chmod(permissionNumber, pathToMake) #设置权限
226
+ rescue Errno::ENOENT => e # File not exist
227
+ puts "Rescued by Errno::ENOENT statement. #{pathToMake}" # 报告错误
228
+
229
+ end
230
+
231
+
205
232
  end #if (permissionNumber.nil?) #不带权限字段
206
233
  end #makeDirectory(pathPrefix, packagedFile) #创建目录
207
234
 
@@ -348,7 +375,7 @@ class VictoriaFresh
348
375
  rescue Errno::EACCES #权限受限
349
376
  end #begin #读取时间戳
350
377
 
351
- if (isFile) #是文件,不用再列出其子文件了。
378
+ if isFile #是文件,不用再列出其子文件了。
352
379
  packagedFile['file_length']=directoryPathName.size #记录文件的内容长度。
353
380
 
354
381
  #读取文件内容:
@@ -379,10 +406,14 @@ class VictoriaFresh
379
406
  subFileStartIndex=startIndex #子文件的起始位置,以此目录的起始位置为基准。
380
407
 
381
408
  packagedFile['file_length']=0 #本目录的内容长度。
382
-
409
+
410
+ puts "Listing for #{directoryPathName}" # Debug
411
+
383
412
  directoryPathName.each_child do |subFile| #一个个文件地处理。
384
413
  # puts("sub file: #{subFile}, class: #{subFile.class}, symlink: #{subFile.symlink?}, expand_path: #{subFile.expand_path}, file?: #{subFile.file?}") #Debug.
385
414
  # checkMemoryUsage(221)
415
+
416
+ begin
386
417
  realPath=subFile.expand_path #获取绝对路径。
387
418
 
388
419
  packagedSubFile,subFileContent=checkOnce(realPath,subFileStartIndex, layer+1) #打包这个子文件。
@@ -403,6 +434,9 @@ class VictoriaFresh
403
434
  # puts("237, content string length: #{contentString.length}") #Debug
404
435
 
405
436
  packagedFile['file_length']+=packagedSubFile['file_length'] #随着子文件的打包而更新本目录的总长度。
437
+ rescue Errno::EMFILE # File not exist
438
+ puts "Rescued by Errno::EMFILE statement. #{subFile}" #报告错误
439
+ end
406
440
  end #directoryPathName.each_child do |subFile| #一个个文件地处理。
407
441
  end #if (isFile) #是文件,不用再列出其子文件了。
408
442
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: VictoriaFreSh
3
3
  version: !ruby/object:Gem::Version
4
- version: 2021.5.30
4
+ version: 2021.8.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hxcan Cai
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-28 00:00:00.000000000 Z
11
+ date: 2021-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cbor
@@ -57,7 +57,7 @@ homepage: http://rubygems.org/gems/VictoriaFreSh
57
57
  licenses:
58
58
  - MIT
59
59
  metadata: {}
60
- post_install_message:
60
+ post_install_message:
61
61
  rdoc_options: []
62
62
  require_paths:
63
63
  - lib
@@ -72,8 +72,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
72
  - !ruby/object:Gem::Version
73
73
  version: '0'
74
74
  requirements: []
75
- rubygems_version: 3.2.15
76
- signing_key:
75
+ rubygems_version: 3.0.3
76
+ signing_key:
77
77
  specification_version: 4
78
78
  summary: VictoriaFreSh
79
79
  test_files: []