VictoriaFreSh 2021.5.28 → 2021.7.30
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.
- checksums.yaml +4 -4
- data/lib/victoriafresh.rb +53 -22
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68a7f71cfa42efd3573dd7298e0d579b45e4d6af7e46d8fbd7b15cae24c8c89b
|
4
|
+
data.tar.gz: 9128f0401e38595100de90f021d58958f531b37fea424db7df50a8b1bf9eb7f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8914a283371b1c65cfc4a5e50bb63e5a5193fe3e112b5ebbf34b0e76ab2462768cc794a6e25bde45ac612999f8e92ec0c1e7e328d6ed3c1c9531510dcf647bf
|
7
|
+
data.tar.gz: 2094cec3f9179bf6cfdf621f8550c30d568e01082bbfae680b6ddab7f0a0cdfb55c647af8722c64b602bf73343f869adfece058a263d6afdcbf7ce9bac6734e3
|
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
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
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
|
-
|
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) #写入文件
|
@@ -117,8 +124,12 @@ class VictoriaFresh
|
|
117
124
|
pathToMake=pathPrefix + '/' + packagedFile['name'] #构造文件名
|
118
125
|
|
119
126
|
puts("data: #{victoriaFreshData}, path: #{pathToMake}") #Debug
|
120
|
-
|
121
|
-
|
127
|
+
|
128
|
+
begin #创建符号链接
|
129
|
+
FileUtils.symlink(victoriaFreshData, pathToMake, force: true) #创建符号链接
|
130
|
+
rescue Errno::EACCES => e #权限受限
|
131
|
+
puts "Rescued by Errno::EACCES statement. #{pathToMake}" #报告错误
|
132
|
+
end #begin #创建符号链接
|
122
133
|
|
123
134
|
permissionNumber=packagedFile['permission'] #获取权限数字
|
124
135
|
|
@@ -129,8 +140,8 @@ class VictoriaFresh
|
|
129
140
|
File.lchmod(permissionNumber, pathToMake) #设置权限
|
130
141
|
rescue NotImplementedError #未实现
|
131
142
|
puts 'File.lchmod not implemented' #Debug
|
132
|
-
rescue Errno::
|
133
|
-
puts "Rescued by Errno::
|
143
|
+
rescue Errno::ENOTSUP => e
|
144
|
+
puts "Rescued by Errno::ENOTSUP statement. #{pathToMake}" #报告错误
|
134
145
|
end #begin #尝试修改链接本身的权限
|
135
146
|
end #if (permissionNumber.nil?) #不带权限字段
|
136
147
|
end #def makeSymlinkExternalDataFile(pathPrefix, packagedFile)
|
@@ -187,17 +198,37 @@ class VictoriaFresh
|
|
187
198
|
|
188
199
|
if (Dir.exist?(pathToMake)) #目录已经存在
|
189
200
|
else #目录 不存在
|
201
|
+
begin
|
190
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
|
+
|
191
208
|
end #if (Dir.exist?(pathToMake)) #目录已经存在
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
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
|
+
|
196
218
|
permissionNumber=packagedFile['permission'] #获取权限数字
|
197
219
|
|
198
220
|
if (permissionNumber.nil?) #不带权限字段
|
199
221
|
elsif #带权限字段
|
200
|
-
|
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
|
+
|
201
232
|
end #if (permissionNumber.nil?) #不带权限字段
|
202
233
|
end #makeDirectory(pathPrefix, packagedFile) #创建目录
|
203
234
|
|
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.
|
4
|
+
version: 2021.7.30
|
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-
|
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.
|
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: []
|