qdumpfs 1.5.3 → 1.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +6 -3
- data/.idea/.gitignore +10 -0
- data/.idea/inspectionProfiles/Project_Default.xml +16 -0
- data/.idea/misc.xml +4 -0
- data/.idea/modules.xml +8 -0
- data/.idea/qdumpfs.iml +91 -0
- data/.idea/vcs.xml +6 -0
- data/Gemfile.lock +4 -4
- data/lib/qdumpfs/option.rb +1 -0
- data/lib/qdumpfs/util.rb +17 -9
- data/lib/qdumpfs/version.rb +1 -1
- data/lib/qdumpfs.rb +28 -23
- data/test_qdumpfs.sh +2 -3
- metadata +9 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2912844a928c79223f682ec29561480c360c45bdc18ee9590b6623bbe04d95d
|
4
|
+
data.tar.gz: 9dac9f189d8948cbebf0a929a01763557300ac676679667bea3d6f2e0a652969
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6769d780454a153e62e455ded96760971d62b82533773b72b872165e6cd7ec8bb96f661f7e87652f543c6f5e3af5631597231f937a8a2b4f44d1011a58b2b6d9
|
7
|
+
data.tar.gz: 882a8b0d152355f900c8d48e02458a53c9c898dbd6ee1516b33383a54ba6e023b807e197b0a2b87578279e71a70255b31f4498bc5170e4edca5c7ec2eb5289cf
|
data/.gitignore
CHANGED
data/.idea/.gitignore
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
<component name="InspectionProjectProfileManager">
|
2
|
+
<profile version="1.0">
|
3
|
+
<option name="myName" value="Project Default" />
|
4
|
+
<inspection_tool class="RubyArgCount" enabled="false" level="ERROR" enabled_by_default="false" />
|
5
|
+
<inspection_tool class="RubyCaseWithoutElseBlockInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
6
|
+
<inspection_tool class="RubyTooManyInstanceVariablesInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
7
|
+
<inspection_tool class="RubyTooManyMethodsInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
8
|
+
<inspection_tool class="RubyUnnecessaryReturnStatement" enabled="false" level="WARNING" enabled_by_default="false" />
|
9
|
+
<inspection_tool class="RubyUnusedLocalVariable" enabled="false" level="WARNING" enabled_by_default="false" />
|
10
|
+
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
|
11
|
+
<option name="processCode" value="true" />
|
12
|
+
<option name="processLiterals" value="true" />
|
13
|
+
<option name="processComments" value="true" />
|
14
|
+
</inspection_tool>
|
15
|
+
</profile>
|
16
|
+
</component>
|
data/.idea/misc.xml
ADDED
data/.idea/modules.xml
ADDED
data/.idea/qdumpfs.iml
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="ModuleRunConfigurationManager">
|
4
|
+
<shared />
|
5
|
+
</component>
|
6
|
+
<component name="NewModuleRootManager">
|
7
|
+
<content url="file://$MODULE_DIR$">
|
8
|
+
<sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
|
9
|
+
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
10
|
+
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
11
|
+
<excludeFolder url="file://$MODULE_DIR$/.idea/copilot/chatSessions" />
|
12
|
+
</content>
|
13
|
+
<orderEntry type="inheritedJdk" />
|
14
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
15
|
+
<orderEntry type="module-library">
|
16
|
+
<library name="minitest (v5.22.3) [path][gem]" type="rubylib">
|
17
|
+
<properties>
|
18
|
+
<option name="version" value="4" />
|
19
|
+
</properties>
|
20
|
+
<CLASSES>
|
21
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.1.0/gems/minitest-5.22.3/lib" />
|
22
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.1.0/gems/minitest-5.22.3/test" />
|
23
|
+
</CLASSES>
|
24
|
+
<JAVADOC />
|
25
|
+
<SOURCES>
|
26
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.1.0/gems/minitest-5.22.3/lib" />
|
27
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.1.0/gems/minitest-5.22.3/test" />
|
28
|
+
</SOURCES>
|
29
|
+
<excluded>
|
30
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.1.0/gems/minitest-5.22.3/test" />
|
31
|
+
</excluded>
|
32
|
+
</library>
|
33
|
+
</orderEntry>
|
34
|
+
<orderEntry type="module-library">
|
35
|
+
<library name="rake (v13.1.0) [path][gem]" type="rubylib">
|
36
|
+
<properties>
|
37
|
+
<option name="version" value="4" />
|
38
|
+
</properties>
|
39
|
+
<CLASSES>
|
40
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.1.0/gems/rake-13.1.0/doc" />
|
41
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.1.0/gems/rake-13.1.0/exe" />
|
42
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.1.0/gems/rake-13.1.0/lib" />
|
43
|
+
</CLASSES>
|
44
|
+
<JAVADOC />
|
45
|
+
<SOURCES>
|
46
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.1.0/gems/rake-13.1.0/doc" />
|
47
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.1.0/gems/rake-13.1.0/exe" />
|
48
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.1.0/gems/rake-13.1.0/lib" />
|
49
|
+
</SOURCES>
|
50
|
+
<excluded>
|
51
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.1.0/gems/rake-13.1.0/doc" />
|
52
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.1.0/gems/rake-13.1.0/exe" />
|
53
|
+
</excluded>
|
54
|
+
</library>
|
55
|
+
</orderEntry>
|
56
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.4.20, rbenv: 3.1.3) [gem]" level="application" />
|
57
|
+
</component>
|
58
|
+
<component name="RakeTasksCache-v2">
|
59
|
+
<option name="myRootTask">
|
60
|
+
<RakeTaskImpl id="rake">
|
61
|
+
<subtasks>
|
62
|
+
<RakeTaskImpl description="Build qdumpfs-1.6.1.gem into the pkg directory" fullCommand="build" id="build" />
|
63
|
+
<RakeTaskImpl id="build">
|
64
|
+
<subtasks>
|
65
|
+
<RakeTaskImpl description="Generate SHA512 checksum if qdumpfs-1.6.1.gem into the checksums directory" fullCommand="build:checksum" id="checksum" />
|
66
|
+
</subtasks>
|
67
|
+
</RakeTaskImpl>
|
68
|
+
<RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
|
69
|
+
<RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
|
70
|
+
<RakeTaskImpl description="Build and install qdumpfs-1.6.1.gem into system gems" fullCommand="install" id="install" />
|
71
|
+
<RakeTaskImpl id="install">
|
72
|
+
<subtasks>
|
73
|
+
<RakeTaskImpl description="Build and install qdumpfs-1.6.1.gem into system gems without network access" fullCommand="install:local" id="local" />
|
74
|
+
</subtasks>
|
75
|
+
</RakeTaskImpl>
|
76
|
+
<RakeTaskImpl description="Create tag v1.6.1 and build and push qdumpfs-1.6.1.gem to rubygems.org" fullCommand="release[remote]" id="release[remote]" />
|
77
|
+
<RakeTaskImpl description="Run tests" fullCommand="test" id="test" />
|
78
|
+
<RakeTaskImpl description="" fullCommand="default" id="default" />
|
79
|
+
<RakeTaskImpl description="" fullCommand="release" id="release" />
|
80
|
+
<RakeTaskImpl id="release">
|
81
|
+
<subtasks>
|
82
|
+
<RakeTaskImpl description="" fullCommand="release:guard_clean" id="guard_clean" />
|
83
|
+
<RakeTaskImpl description="" fullCommand="release:rubygem_push" id="rubygem_push" />
|
84
|
+
<RakeTaskImpl description="" fullCommand="release:source_control_push" id="source_control_push" />
|
85
|
+
</subtasks>
|
86
|
+
</RakeTaskImpl>
|
87
|
+
</subtasks>
|
88
|
+
</RakeTaskImpl>
|
89
|
+
</option>
|
90
|
+
</component>
|
91
|
+
</module>
|
data/.idea/vcs.xml
ADDED
data/Gemfile.lock
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
qdumpfs (1.
|
4
|
+
qdumpfs (1.6.1)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
minitest (5.
|
10
|
-
rake (13.0
|
9
|
+
minitest (5.22.3)
|
10
|
+
rake (13.1.0)
|
11
11
|
|
12
12
|
PLATFORMS
|
13
13
|
x64-mingw32
|
@@ -20,4 +20,4 @@ DEPENDENCIES
|
|
20
20
|
rake (>= 12.3.3)
|
21
21
|
|
22
22
|
BUNDLED WITH
|
23
|
-
2.
|
23
|
+
2.4.20
|
data/lib/qdumpfs/option.rb
CHANGED
data/lib/qdumpfs/util.rb
CHANGED
@@ -35,7 +35,8 @@ class File
|
|
35
35
|
begin
|
36
36
|
File.unlink(dest) if File.anything_exist?(dest)
|
37
37
|
File.symlink(src, dest)
|
38
|
-
rescue
|
38
|
+
rescue
|
39
|
+
puts "force_symlink fails #{src} #{dest}"
|
39
40
|
end
|
40
41
|
end
|
41
42
|
|
@@ -65,10 +66,10 @@ module QdumpfsFind
|
|
65
66
|
def find(logger, *paths)
|
66
67
|
block_given? or return enum_for(__method__, *paths)
|
67
68
|
paths.collect!{|d|
|
68
|
-
raise Errno::ENOENT unless File.exist?(d)
|
69
|
+
raise Errno::ENOENT unless File.exist?(d)
|
69
70
|
d.dup
|
70
71
|
}
|
71
|
-
while file = paths.shift
|
72
|
+
while (file = paths.shift)
|
72
73
|
catch(:prune) do
|
73
74
|
yield file.dup.taint
|
74
75
|
begin
|
@@ -77,7 +78,7 @@ module QdumpfsFind
|
|
77
78
|
logger.print("File.lstat path=#{file} error=#{e.message}")
|
78
79
|
next
|
79
80
|
end
|
80
|
-
if s.directory?
|
81
|
+
if s.directory?
|
81
82
|
begin
|
82
83
|
fs = Dir.entries(file, :encoding=>'UTF-8')
|
83
84
|
rescue => e
|
@@ -116,12 +117,14 @@ module QdumpfsUtils
|
|
116
117
|
block = r.sysread(block_size)
|
117
118
|
w.syswrite(block)
|
118
119
|
i += 1
|
119
|
-
@
|
120
|
+
@write_bytes += block.size
|
120
121
|
end
|
121
122
|
}
|
122
123
|
}
|
123
|
-
rescue EOFError
|
124
|
-
#
|
124
|
+
rescue EOFError
|
125
|
+
# この実装だとファイルサイズがblock_sizeより小さい場合にEOFErrorが発生する
|
126
|
+
# それはしかたがないので無視する
|
127
|
+
# puts e.message
|
125
128
|
end
|
126
129
|
unless FileTest.file?(dest)
|
127
130
|
raise "copy_file fails #{dest}"
|
@@ -136,7 +139,12 @@ module QdumpfsUtils
|
|
136
139
|
File.utime(stat.atime, stat.mtime, dest)
|
137
140
|
File.chmod(stat.mode, dest) # not necessary. just to make sure
|
138
141
|
end
|
139
|
-
|
142
|
+
|
143
|
+
def link(src, dest)
|
144
|
+
@link_bytes += File.size(src)
|
145
|
+
File.force_link(src, dest)
|
146
|
+
end
|
147
|
+
|
140
148
|
def convert_bytes(bytes)
|
141
149
|
if bytes < 1024
|
142
150
|
sprintf("%dB", bytes)
|
@@ -189,7 +197,7 @@ module QdumpfsUtils
|
|
189
197
|
type = "new_file"
|
190
198
|
when "link"
|
191
199
|
type = "symlink"
|
192
|
-
|
200
|
+
end
|
193
201
|
end
|
194
202
|
end
|
195
203
|
return type
|
data/lib/qdumpfs/version.rb
CHANGED
data/lib/qdumpfs.rb
CHANGED
@@ -68,8 +68,8 @@ module Qdumpfs
|
|
68
68
|
command = Command.new(option)
|
69
69
|
command.run
|
70
70
|
rescue => e
|
71
|
+
puts e.message + "\n"
|
71
72
|
if option.debug
|
72
|
-
p e.message
|
73
73
|
p e.backtrace
|
74
74
|
end
|
75
75
|
puts opt.help
|
@@ -104,8 +104,9 @@ module Qdumpfs
|
|
104
104
|
private
|
105
105
|
def log_result(src, today, elapsed)
|
106
106
|
time = Time.now.strftime("%Y-%m-%dT%H:%M:%S")
|
107
|
-
|
108
|
-
|
107
|
+
write_bytes = convert_bytes(@write_bytes)
|
108
|
+
link_bytes = convert_bytes(@link_bytes)
|
109
|
+
msg = sprintf("%s: %s -> %s (in %.2f sec, %s write, %s link)\n", time, src, today, elapsed, write_bytes, link_bytes)
|
109
110
|
log(msg)
|
110
111
|
log("error files:\n")
|
111
112
|
i = 1
|
@@ -136,7 +137,7 @@ module Qdumpfs
|
|
136
137
|
when "directory"
|
137
138
|
FileUtils.mkpath(today)
|
138
139
|
when "unchanged"
|
139
|
-
|
140
|
+
link(latest, today)
|
140
141
|
when "updated"
|
141
142
|
copy(src, today)
|
142
143
|
when "new_file"
|
@@ -181,16 +182,17 @@ module Qdumpfs
|
|
181
182
|
# today: 差分バックアップ先ディレクトリ ex)j:/to/backup1/2019/05/10/home
|
182
183
|
dirs = {};
|
183
184
|
QdumpfsFind.find(@opt.logger, src) do |s| # path of the source file
|
184
|
-
if @opt.matcher.exclude?(s)
|
185
|
-
if File.lstat(s).directory? then Find.prune() else next end
|
186
|
-
end
|
187
|
-
# バックアップ元ファイルのパスからディレクトリ部分を削除
|
188
|
-
r = make_relative_path(s, src)
|
189
|
-
# 既存バックアップファイルのパス
|
190
|
-
l = File.join(latest, r) # path of the latest snapshot
|
191
|
-
# 新規バックアップファイルのパス
|
192
|
-
t = File.join(today, r) # path of the today's snapshot
|
193
185
|
begin
|
186
|
+
if @opt.matcher.exclude?(s)
|
187
|
+
if File.lstat(s).directory? then Find.prune else next end
|
188
|
+
end
|
189
|
+
# バックアップ元ファイルのパスからディレクトリ部分を削除
|
190
|
+
r = make_relative_path(s, src)
|
191
|
+
# 既存バックアップファイルのパス
|
192
|
+
l = File.join(latest, r) # path of the latest snapshot
|
193
|
+
# 新規バックアップファイルのパス
|
194
|
+
t = File.join(today, r) # path of the today's snapshot
|
195
|
+
|
194
196
|
# ファイルのアップデート
|
195
197
|
update_file(s, l, t)
|
196
198
|
dirs[t] = File.stat(s) if File.ftype(s) == "directory"
|
@@ -207,12 +209,13 @@ module Qdumpfs
|
|
207
209
|
def recursive_copy(src, dst)
|
208
210
|
dirs = {}
|
209
211
|
QdumpfsFind.find(@opt.logger, src) do |s|
|
210
|
-
if @opt.matcher.exclude?(s)
|
211
|
-
if File.lstat(s).directory? then Find.prune() else next end
|
212
|
-
end
|
213
|
-
r = make_relative_path(s, src)
|
214
|
-
t = File.join(dst, r)
|
215
212
|
begin
|
213
|
+
if @opt.matcher.exclude?(s)
|
214
|
+
if File.lstat(s).directory? then Find.prune else next end
|
215
|
+
end
|
216
|
+
r = make_relative_path(s, src)
|
217
|
+
t = File.join(dst, r)
|
218
|
+
|
216
219
|
type = detect_type(s)
|
217
220
|
report(type, s)
|
218
221
|
next if @opt.dry_run
|
@@ -227,7 +230,7 @@ module Qdumpfs
|
|
227
230
|
# just ignore it
|
228
231
|
else
|
229
232
|
raise "#{type}: shouldn't be reached here"
|
230
|
-
|
233
|
+
end
|
231
234
|
chown_if_root(type, s, t)
|
232
235
|
dirs[t] = File.stat(s) if File.ftype(s) == "directory"
|
233
236
|
rescue => e
|
@@ -311,7 +314,8 @@ module Qdumpfs
|
|
311
314
|
|
312
315
|
log("##### backup start #####")
|
313
316
|
|
314
|
-
@
|
317
|
+
@write_bytes = 0
|
318
|
+
@link_bytes = 0
|
315
319
|
@error_files = []
|
316
320
|
start_time = Time.now
|
317
321
|
if @opt.backup_at
|
@@ -362,7 +366,8 @@ module Qdumpfs
|
|
362
366
|
@opt.validate_directories(2)
|
363
367
|
|
364
368
|
start_time = Time.now
|
365
|
-
@
|
369
|
+
@write_bytes = 0
|
370
|
+
@link_bytes = 0
|
366
371
|
@error_files = []
|
367
372
|
src = @opt.src
|
368
373
|
dst = @opt.dst
|
@@ -421,7 +426,7 @@ module Qdumpfs
|
|
421
426
|
file = @opt.open_verifyfile
|
422
427
|
|
423
428
|
start_time = Time.now
|
424
|
-
|
429
|
+
log("##### verify start #{fmt(start_time)} #####")
|
425
430
|
|
426
431
|
src_count, dst_count = do_verify(src, dst)
|
427
432
|
|
@@ -432,7 +437,7 @@ module Qdumpfs
|
|
432
437
|
|
433
438
|
end_time = Time.now
|
434
439
|
diff = time_diff(start_time, end_time)
|
435
|
-
|
440
|
+
log("##### list end #{fmt(end_time)} diff=#{diff} #####")
|
436
441
|
|
437
442
|
file.close
|
438
443
|
end
|
data/test_qdumpfs.sh
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
#!/bin/sh
|
2
2
|
|
3
3
|
curdir=$(dirname $0)
|
4
|
-
bundle exec ruby $curdir/exe/qdumpfs $* ~/_qdumpfs/src ~/_qdumpfs/dst
|
5
|
-
|
6
|
-
|
4
|
+
#bundle exec ruby $curdir/exe/qdumpfs $* ~/_qdumpfs/src ~/_qdumpfs/dst
|
5
|
+
bundle exec ruby $curdir/exe/qdumpfs $* --exclude="/Users/sora/Documents/Virtual Machines.localized" /Users/sora /Volumes/qdumpfs/home
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qdumpfs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- src
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -62,6 +62,12 @@ extensions: []
|
|
62
62
|
extra_rdoc_files: []
|
63
63
|
files:
|
64
64
|
- ".gitignore"
|
65
|
+
- ".idea/.gitignore"
|
66
|
+
- ".idea/inspectionProfiles/Project_Default.xml"
|
67
|
+
- ".idea/misc.xml"
|
68
|
+
- ".idea/modules.xml"
|
69
|
+
- ".idea/qdumpfs.iml"
|
70
|
+
- ".idea/vcs.xml"
|
65
71
|
- ".travis.yml"
|
66
72
|
- ".vscode/settings.json"
|
67
73
|
- CODE_OF_CONDUCT.md
|
@@ -121,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
127
|
- !ruby/object:Gem::Version
|
122
128
|
version: '0'
|
123
129
|
requirements: []
|
124
|
-
rubygems_version: 3.
|
130
|
+
rubygems_version: 3.3.26
|
125
131
|
signing_key:
|
126
132
|
specification_version: 4
|
127
133
|
summary: qdumpfs
|