VictoriaFreSh 2020.7.25 → 2020.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/filemessage_pb.rb +24 -0
- data/lib/victoriafresh.rb +28 -4
- metadata +12 -12
- data/lib/VictoriaFreSh/filemessage.pb.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78b9a5be98cca9663603cff168291eb02a63eb429ad3a4f8575037f8ddc05a31
|
4
|
+
data.tar.gz: 29aab5b992fa884e53d2ee529ec9cb30db298e45c9394be588df5af92966ed12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eccc46f251ca80e27f120d36f047613649a1423fde9ceb0bade67ed7f40d1d0d7b814825b372817c0d3cc5a5fb96796cbd20f6b7334624daeb22b814d2d2b6a9
|
7
|
+
data.tar.gz: 0e19df7de8314c4b3ba263941d23e4d0019203f7a79d1c48e206fb2012406fae793bbebd348e4d197269343c8fc0f120ce492cec9aebb41debc963a9dccd95cf
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: filemessage.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/protobuf/timestamp_pb'
|
7
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
8
|
+
add_message "com.stupidbeauty.victoriafresh.FileMessage" do
|
9
|
+
optional :name, :string, 1
|
10
|
+
repeated :sub_files, :message, 2, "com.stupidbeauty.victoriafresh.FileMessage"
|
11
|
+
optional :is_file, :bool, 3
|
12
|
+
optional :file_start_index, :int32, 5
|
13
|
+
optional :file_length, :int32, 6
|
14
|
+
optional :timestamp, :message, 8, "google.protobuf.Timestamp"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
module Com
|
19
|
+
module Stupidbeauty
|
20
|
+
module Victoriafresh
|
21
|
+
FileMessage = Google::Protobuf::DescriptorPool.generated_pool.lookup("com.stupidbeauty.victoriafresh.FileMessage").msgclass
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/victoriafresh.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
2
|
|
3
3
|
require 'pathname'
|
4
|
-
require File.dirname(__FILE__)+'/VictoriaFreSh/
|
4
|
+
require File.dirname(__FILE__)+'/VictoriaFreSh/filemessage_pb.rb'
|
5
5
|
|
6
6
|
class VictoriaFresh
|
7
7
|
def releaseFiles(victoriaFreshPackagedFileString, contentString) #释放目录树
|
@@ -22,13 +22,25 @@ class VictoriaFresh
|
|
22
22
|
end #writeFile(pathPrefix, packagedFile, contentString) #写入文件
|
23
23
|
|
24
24
|
def makeDirectory(pathPrefix, packagedFile) #创建目录
|
25
|
-
|
25
|
+
puts 'mkdir' #Debug
|
26
|
+
|
27
|
+
pathToMake=File.join(pathPrefix, packagedFile.name)
|
28
|
+
|
29
|
+
puts pathToMake #Debug.
|
30
|
+
|
31
|
+
if (Dir.exist?(pathToMake)) #目录已经存在
|
32
|
+
else #目录 不存在
|
33
|
+
Dir.mkdir(pathToMake) #=> 0
|
34
|
+
end #if (Dir.exist?(pathToMake)) #目录已经存在
|
35
|
+
|
26
36
|
|
27
37
|
end #makeDirectory(pathPrefix, packagedFile) #创建目录
|
28
38
|
|
29
39
|
def releaseFile( pathPrefix, packagedFile, contentString) #释放一个文件
|
30
40
|
puts packagedFile.name #Debug
|
31
41
|
|
42
|
+
puts packagedFile.timestamp #Debug
|
43
|
+
|
32
44
|
if packagedFile.is_file #是文件,则直接写入文件
|
33
45
|
writeFile(pathPrefix, packagedFile, contentString) #写入文件
|
34
46
|
else #是目录,则创建目录,并递归处理
|
@@ -46,8 +58,10 @@ class VictoriaFresh
|
|
46
58
|
end #def releaseFile(packagedFile, contentString) #释放一个文件
|
47
59
|
|
48
60
|
def checkOnce(directoryPath,startIndex=0) #打包一个目录树。
|
49
|
-
packagedFile=FileMessage.new #创建文件消息对象。
|
50
|
-
|
61
|
+
packagedFile=Com::Stupidbeauty::Victoriafresh::FileMessage.new #创建文件消息对象。
|
62
|
+
# packagedFile.sub_files=[] #初始化数组。
|
63
|
+
|
64
|
+
packagedFile.sub_files=Google::Protobuf::RepeatedField.new(Com::Stupidbeauty::Victoriafresh::FileMessage, []) #初始化数组
|
51
65
|
|
52
66
|
directoryPathName=Pathname.new(directoryPath) #构造路径名字对象。
|
53
67
|
|
@@ -59,6 +73,16 @@ class VictoriaFresh
|
|
59
73
|
packagedFile.is_file=isFile #设置属性,是否是文件。
|
60
74
|
packagedFile.file_start_index=startIndex #记录文件内容的开始位置。
|
61
75
|
|
76
|
+
|
77
|
+
#记录时间戳:
|
78
|
+
mtimeStamp=File.mtime(directoryPath) #获取时间戳
|
79
|
+
puts direcotryPath #Dbug.
|
80
|
+
puts mtimeStamp #Debug
|
81
|
+
|
82
|
+
packagedFile.timestamp={} #时间戳
|
83
|
+
packagedFile.timestamp.seconds=mtimeStamp.tv_sec #设置秒数
|
84
|
+
packagedFile.timestamp.nanos=mtimeStamp.tv_nsec #设置纳秒数
|
85
|
+
|
62
86
|
if (isFile) #是文件,不用再列出其子文件了。
|
63
87
|
packagedFile.file_length=directoryPathName.size #记录文件的内容长度。
|
64
88
|
|
metadata
CHANGED
@@ -1,42 +1,42 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: VictoriaFreSh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2020.7.
|
4
|
+
version: 2020.7.30
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hxcan Cai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: protobuf
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 1.2.0
|
20
17
|
- - "~>"
|
21
18
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
19
|
+
version: '3.10'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 3.10.2
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- - ">="
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 1.2.0
|
30
27
|
- - "~>"
|
31
28
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
29
|
+
version: '3.10'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 3.10.2
|
33
33
|
description: Virtual file system.
|
34
34
|
email: caihuosheng@gmail.com
|
35
35
|
executables: []
|
36
36
|
extensions: []
|
37
37
|
extra_rdoc_files: []
|
38
38
|
files:
|
39
|
-
- lib/VictoriaFreSh/
|
39
|
+
- lib/VictoriaFreSh/filemessage_pb.rb
|
40
40
|
- lib/victoriafresh.rb
|
41
41
|
- victoriafresh.example.rb
|
42
42
|
homepage: http://rubygems.org/gems/VictoriaFreSh
|
@@ -1,15 +0,0 @@
|
|
1
|
-
## Generated from filemessage.proto for com.stupidbeauty.victoriafresh
|
2
|
-
require "beefcake"
|
3
|
-
|
4
|
-
|
5
|
-
class FileMessage
|
6
|
-
include Beefcake::Message
|
7
|
-
end
|
8
|
-
|
9
|
-
class FileMessage
|
10
|
-
optional :name, :string, 1
|
11
|
-
repeated :sub_files, FileMessage, 2
|
12
|
-
optional :is_file, :bool, 3
|
13
|
-
optional :file_start_index, :int32, 5
|
14
|
-
optional :file_length, :int32, 6
|
15
|
-
end
|