qdumpfs 1.2.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d148306a793bd1f61a3ed05f115859f0bca1dcb44ff53c560e5e331f0aa24df0
4
- data.tar.gz: 12ee6edac7b57c310a319c67edfe5c962c4c0a0e52d87976c0e0cd700061cb42
3
+ metadata.gz: 746f891d45e46211730999dcd18ec7e7105034d8cccfb8e6a705d698c8acbb15
4
+ data.tar.gz: bb7e0780b8215c4464ee9bce3638d3b4ba6ea68c1c9054707d09182632e40dbb
5
5
  SHA512:
6
- metadata.gz: a0ebdf2405bba933b7df4eaf3e551d8f2c6024e5c91db085fb212a82f674290a47d3f64d9590fea78aa25a39cdeefeb03ce0897fcbfd19e8825838bc51954c13
7
- data.tar.gz: 6235f457cc58b9323a2a8b366d62facfbddb1f12b54cf82ab15015e1ddf38514c228b4952a6d4a15804b3505c4ec012af3315ebd7bc2753d8a34468e8684e81a
6
+ metadata.gz: 845532cdbe48a97aa83bc80747f0f479a330342760051cd768c67e07ff29c3ef3d473d53359e6c616a586e4c058250be979599c93db4bb588d395c5fefcd6550
7
+ data.tar.gz: 5a5b1ecf506959cf24f485504b633a921e23c86613dad0fddf0bea30d00a94811ce1642ebf7480229ede00d4f40075d5eaa6c1d4d5379d84a1057f5abb73c378
data/Gemfile.lock CHANGED
@@ -1,16 +1,17 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- qdumpfs (1.2.0)
4
+ qdumpfs (1.5.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- minitest (5.15.0)
9
+ minitest (5.19.0)
10
10
  rake (13.0.6)
11
11
 
12
12
  PLATFORMS
13
- x86_64-darwin-21
13
+ x64-mingw32
14
+ x86_64-darwin-22
14
15
 
15
16
  DEPENDENCIES
16
17
  bundler (~> 2.0)
@@ -19,4 +20,4 @@ DEPENDENCIES
19
20
  rake (>= 12.3.3)
20
21
 
21
22
  BUNDLED WITH
22
- 2.3.8
23
+ 2.2.33
data/build.cmd CHANGED
@@ -1,6 +1,6 @@
1
1
  @echo off
2
2
 
3
- call uru 265p114
3
+ call uru 306p216
4
4
 
5
5
  set bundle_dir=./vendor/bundle
6
6
 
@@ -152,6 +152,10 @@ module Qdumpfs
152
152
  attr_reader :logger, :matcher, :reporter, :interval_proc
153
153
  attr_reader :delete_from, :delete_to, :delete_dirs, :backup_at
154
154
  attr_reader :debug
155
+
156
+ def close
157
+ @logger.close
158
+ end
155
159
 
156
160
  def report(type, filename)
157
161
  if @opts[:v]
@@ -210,13 +214,13 @@ module Qdumpfs
210
214
  @dirs.each do |dir|
211
215
  validate_directory(dir)
212
216
  end
213
- if @dirs.size == 2 && windows?
214
- # ディレクトリが2つだけ指定されている場合、コピー先はntfsである必要がある
215
- unless ntfs?(dst)
216
- fstype = get_filesystem_type(dst)
217
- raise sprintf("only NTFS is supported but %s is %s.", dst, fstype)
218
- end
219
- end
217
+ # if @dirs.size == 2 && windows?
218
+ # # ディレクトリが2つだけ指定されている場合、コピー先はntfsである必要がある
219
+ # unless ntfs?(dst)
220
+ # fstype = get_filesystem_type(dst)
221
+ # raise sprintf("only NTFS is supported but %s is %s.", dst, fstype)
222
+ # end
223
+ # end
220
224
  if @dirs.size < min_count
221
225
  raise "#{min_count} directories required."
222
226
  end
data/lib/qdumpfs/util.rb CHANGED
@@ -171,7 +171,7 @@ module QdumpfsUtils
171
171
  case File.ftype(src)
172
172
  when "file"
173
173
  same_file = same_file?(src, latest)
174
- # p "same_file? #{src} #{latest} result=#{same_file}"
174
+ # puts "same_file? #{src} #{latest} result=#{same_file}"
175
175
  if same_file
176
176
  type = "unchanged"
177
177
  else
@@ -183,6 +183,7 @@ module QdumpfsUtils
183
183
  type = "symlink"
184
184
  end
185
185
  else
186
+ # puts "latest=#{latest}"
186
187
  case File.ftype(src)
187
188
  when "file"
188
189
  type = "new_file"
@@ -1,4 +1,4 @@
1
1
  module Qdumpfs
2
- VERSION = "1.2.0"
2
+ VERSION = "1.5.0"
3
3
  end
4
4
 
data/lib/qdumpfs/win32.rb CHANGED
@@ -4,143 +4,3 @@ def windows?
4
4
  /mswin32|cygwin|mingw|bccwin/.match(RUBY_PLATFORM)
5
5
  end
6
6
 
7
- if windows?
8
- # http://www.virtuouscode.com/2011/08/25/temporarily-disabling-warnings-in-ruby/
9
-
10
- # https://stackoverflow.com/questions/39051793/can-i-hide-the-warning-message-dl-is-deprecated-please-use-fiddle-in-ruby
11
- original_verbose = $VERBOSE
12
- $VERBOSE = nil
13
-
14
- require 'Win32API'
15
- require "win32ole"
16
-
17
- $VERBOSE = original_verbose
18
-
19
- if RUBY_VERSION < "1.8.0"
20
- CreateHardLinkA = Win32API.new("kernel32", "CreateHardLinkA", "ppl", 'i')
21
- def File.link(l, t)
22
- result = CreateHardLinkA.call(t, l, 0)
23
-
24
- raise Errno::EACCES if result == 0
25
- end
26
- end
27
-
28
- def expand_special_folders(dir)
29
- specials = %w[(?:AllUsers)?(?:Desktop|Programs|Start(?:Menu|up)) Favorites
30
- Fonts MyDocuments NetHood PrintHood Recent SendTo Templates]
31
-
32
- pattern = Regexp.compile(sprintf('^@(%s)', specials.join('|')))
33
-
34
- dir.sub(pattern) do |match|
35
- WIN32OLE.new("WScript.Shell").SpecialFolders(match)
36
- end.tr('\\', File::SEPARATOR)
37
- end
38
-
39
- GetVolumeInformation = Win32API.new("kernel32", "GetVolumeInformation", "PPLPPPPL", "I")
40
- def get_filesystem_type(path)
41
- return nil unless(FileTest.exist?(path))
42
-
43
- drive = File.expand_path(path)[0..2]
44
- buff = "\0" * 1024
45
- GetVolumeInformation.call(drive, nil, 0, nil, nil, nil, buff, 1024)
46
-
47
- buff.sub(/\000+/, '')
48
- end
49
-
50
- def ntfs?(dir)
51
- get_filesystem_type(dir) == "NTFS"
52
- end
53
-
54
- GetLocaltime = Win32API.new("kernel32", "GetLocalTime", "P", 'V')
55
- SystemTimeToFileTime = Win32API.new("kernel32", "SystemTimeToFileTime", "PP", 'I')
56
- def get_file_time(time)
57
- pSYSTEMTIME = ' ' * 2 * 8 # 2byte x 8
58
- pFILETIME = ' ' * 2 * 8 # 2byte x 8
59
-
60
- GetLocaltime.call(pSYSTEMTIME)
61
- t1 = pSYSTEMTIME.unpack("S8")
62
- t1[0..1] = time.year, time.month
63
- t1[3..6] = time.day, time.hour, time.min, time.sec
64
-
65
- SystemTimeToFileTime.call(t1.pack("S8"), pFILETIME)
66
-
67
- pFILETIME
68
- end
69
-
70
- GENERIC_WRITE = 0x40000000
71
- OPEN_EXISTING = 3
72
- FILE_FLAG_BACKUP_SEMANTICS = 0x02000000
73
-
74
- class << File
75
- alias_method(:utime_orig, :utime)
76
- end
77
-
78
- CreateFile = Win32API.new("kernel32", "CreateFileA","PLLLLLL", "L")
79
- SetFileTime = Win32API.new("kernel32", "SetFileTime", "LPPP", "I")
80
- CloseHandle = Win32API.new("kernel32", "CloseHandle", "L", "I")
81
-
82
- def File.utime(a, m, dir)
83
- File.utime_orig(a, m, dir) unless(File.directory?(dir))
84
-
85
- atime = get_file_time(a.dup.utc)
86
- mtime = get_file_time(m.dup.utc)
87
-
88
- hDir = CreateFile.Call(dir.dup, GENERIC_WRITE, 0, 0, OPEN_EXISTING,
89
- FILE_FLAG_BACKUP_SEMANTICS, 0)
90
- SetFileTime.call(hDir, 0, atime, mtime)
91
- CloseHandle.Call(hDir)
92
-
93
- return 0
94
- end
95
-
96
- LOCALE_USER_DEFAULT = 0x400
97
- LOCALE_SABBREVLANGNAME = 3
98
- LOCALE_USE_CP_ACP = 0x40000000
99
- GetLocaleInfo = Win32API.new("kernel32", "GetLocaleInfo", "IIPI", "I")
100
-
101
- def get_locale_name
102
- locale_name = " " * 32
103
- status = GetLocaleInfo.call(LOCALE_USER_DEFAULT,
104
- LOCALE_SABBREVLANGNAME | LOCALE_USE_CP_ACP,
105
- locale_name, 32)
106
- if status == 0
107
- return nil
108
- else
109
- return locale_name.split("\x00").first
110
- end
111
- end
112
-
113
- SW_HIDE = 0
114
- SW_SHOWNORMAL = 1
115
-
116
- ShellExecute = Win32API.new("shell32", "ShellExecute", "LPPPPL", 'L')
117
- LoadIcon = Win32API.new("user32", "LoadIcon", "II", "I")
118
- GetModuleFileName = Win32API.new("kernel32", "GetModuleFileName","IPI","I")
119
-
120
- def get_exe_file_name
121
- path = "\0" * 1024
122
- length = GetModuleFileName.call(0 ,path, path.length)
123
- return path[0, length].tr('\\', File::SEPARATOR)
124
- end
125
-
126
- def get_program_file_name
127
- exe_file_name = get_exe_file_name
128
- if File.basename(exe_file_name) == "ruby.exe"
129
- return File.expand_path($0).gsub('\\', File::SEPARATOR)
130
- else
131
- return exe_file_name
132
- end
133
- end
134
-
135
- def get_program_directory
136
- program_file_name = get_program_file_name
137
- return File.dirname(program_file_name)
138
- end
139
-
140
- def init
141
- locale_name = get_locale_name
142
- # $KCODE = "SJIS" if locale_name == "JPN"
143
- end
144
-
145
- init
146
- end
data/lib/qdumpfs.rb CHANGED
@@ -73,7 +73,9 @@ module Qdumpfs
73
73
  p e.backtrace
74
74
  end
75
75
  puts opt.help
76
- exit
76
+ exit
77
+ ensure
78
+ option.close
77
79
  end
78
80
  end
79
81
 
@@ -239,15 +241,15 @@ module Qdumpfs
239
241
 
240
242
  def sync_latest(src, dst, base = nil)
241
243
  # pdumpfsのバックアップフォルダを同期する
242
-
244
+
243
245
  #コピー元のスナップショット
244
246
  src_snapshots = BackupDir.scan_backup_dirs(src)
245
247
  @opt.detect_expire_dirs(src_snapshots)
246
-
248
+
247
249
  # コピー先の最新スナップショット
248
250
  dst_snapshots = BackupDir.scan_backup_dirs(dst)
249
251
  dst_snapshot = dst_snapshots[-1]
250
-
252
+
251
253
  # コピー元フォルダの決定
252
254
  src_snapshot = nil
253
255
  src_snapshots.each do |snapshot|
@@ -257,7 +259,7 @@ module Qdumpfs
257
259
  break
258
260
  end
259
261
  end
260
-
262
+
261
263
  if src_snapshot.nil?
262
264
  return false, nil, nil
263
265
  end
data/run_sync.cmd CHANGED
@@ -1,6 +1,6 @@
1
1
  @echo off
2
2
 
3
- call uru 265p114
3
+ call uru 306p216
4
4
 
5
- bundle exec ruby exe/qdumpfs --command sync d:/test2 d:/test3
5
+ bundle exec ruby exe/qdumpfs --command sync --keep=10Y0M0W0D r:/pc1/pdumpfs/opt v:/pc1/pdumpfs/opt
6
6
 
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.2.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - src
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-04-21 00:00:00.000000000 Z
11
+ date: 2023-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  - !ruby/object:Gem::Version
121
121
  version: '0'
122
122
  requirements: []
123
- rubygems_version: 3.2.22
123
+ rubygems_version: 3.2.33
124
124
  signing_key:
125
125
  specification_version: 4
126
126
  summary: qdumpfs