VictoriaFreSh 2021.5.29 → 2021.7.31

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 +51 -22
  3. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 181c0e46a87735b681de13f9f8af8ef822138f189d75c7d83374bc61b16af9c2
4
- data.tar.gz: d5518f56834f85c3fd10a1b64fb20a14e34b64102d16ffe26eb4987748af351e
3
+ metadata.gz: a4d0010fe75ced288008ae971b82838a2609ef847ee25c11253869a9ed79f04e
4
+ data.tar.gz: 108db43b445c540443113bda9859c9b9a7ff007538e84f401cd954d66ecddf89
5
5
  SHA512:
6
- metadata.gz: 9d9d5b129dcc90b98cb33284b678c6289ec79b6f5ac840fe24314be289ef56b7d3221421122de148465367fdcf22d447a026e88c48da1bc0785764180e452ef4
7
- data.tar.gz: 0fa9ef18cfd6c02efcc27cd0e4532b04669ffe9d4a177c388b94a6299479c21f8bf5d0feea74d491b63189eef9de38c034f5ff09ee64513c23015dd3accd1bd7
6
+ metadata.gz: 97522a35b8fffa090357609ee1fa03cd482691e740177df23036700c91286578f4eb2dc6ad2b06877ed9ea806a8ca6b7c73b1de5b5f1b042b767f4c9304804eb
7
+ data.tar.gz: 70125c3bad87748ef4faf7599cb9946fc4ee741190173064b294218cfe26be5aeb815f7e3e59bb5a277a9bf8e523ac036bf8c94d6eb42b69c57691d9f70cb815
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) #写入文件
@@ -133,8 +140,8 @@ class VictoriaFresh
133
140
  File.lchmod(permissionNumber, pathToMake) #设置权限
134
141
  rescue NotImplementedError #未实现
135
142
  puts 'File.lchmod not implemented' #Debug
136
- rescue Errno::ENOENT => e
137
- puts "Rescued by Errno::ENOENT statement. #{pathToMake}" #报告错误
143
+ rescue Errno::ENOTSUP => e
144
+ puts "Rescued by Errno::ENOTSUP statement. #{pathToMake}" #报告错误
138
145
  end #begin #尝试修改链接本身的权限
139
146
  end #if (permissionNumber.nil?) #不带权限字段
140
147
  end #def makeSymlinkExternalDataFile(pathPrefix, packagedFile)
@@ -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,7 +406,9 @@ 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)
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.29
4
+ version: 2021.7.31
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-07-30 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: []