diskcatalog 1.3.0 → 1.3.2
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/.idea/diskcatalog.iml +2 -2
- data/Gemfile.lock +3 -1
- data/exe/dcatz +25 -0
- data/lib/diskcatalog/utils.rb +4 -0
- data/lib/diskcatalog/version.rb +1 -1
- data/lib/diskcatalog.rb +39 -8
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5dbf507ee9fe22be9b3784cb3b108d7684250654cec86cc110d18ffa8e7cbde0
|
4
|
+
data.tar.gz: e5f2983c5bc234cd8299365d97b28f232563079778a880c2fe6bb20dc40d15a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8a5604806a5fba58e2ce19d58a99dd8968707257e7fca1067afa4d9cbf221f4d227f35e2166b438ec90a632f2d230877f44b538dbaecef73a9ee349ab49d40e
|
7
|
+
data.tar.gz: 5a53c9d4caa12aca79ea9f413e3e6c2bd63706e96e0cc05dd851923145cad8bef2349587e29dfae78d107b8bb32d299b890c94a25a8d57afc6a6f1492d580a16
|
data/.idea/diskcatalog.iml
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
11
11
|
<excludeFolder url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/cache" />
|
12
12
|
</content>
|
13
|
-
<orderEntry type="
|
13
|
+
<orderEntry type="jdk" jdkName="rbenv: 3.2.6" jdkType="RUBY_SDK" />
|
14
14
|
<orderEntry type="sourceFolder" forTests="false" />
|
15
15
|
<orderEntry type="module-library">
|
16
16
|
<library name="ffi (v1.17.1) [path][gem]" type="rubylib">
|
@@ -204,6 +204,6 @@
|
|
204
204
|
</excluded>
|
205
205
|
</library>
|
206
206
|
</orderEntry>
|
207
|
-
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.4.19, rbenv: 3.2.
|
207
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.4.19, rbenv: 3.2.6) [gem]" level="application" />
|
208
208
|
</component>
|
209
209
|
</module>
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
diskcatalog (1.3.
|
4
|
+
diskcatalog (1.3.2)
|
5
5
|
sys-filesystem
|
6
6
|
zlib
|
7
7
|
|
@@ -17,6 +17,8 @@ GEM
|
|
17
17
|
|
18
18
|
PLATFORMS
|
19
19
|
arm64-darwin-22
|
20
|
+
arm64-darwin-24
|
21
|
+
x64-mingw-ucrt
|
20
22
|
x64-mingw32
|
21
23
|
x86_64-darwin-22
|
22
24
|
x86_64-darwin-24
|
data/exe/dcatz
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'zlib'
|
4
|
+
|
5
|
+
|
6
|
+
def zcat(filename)
|
7
|
+
return unless filename
|
8
|
+
return unless FileTest.file?(filename)
|
9
|
+
if filename =~ /\.gz$/
|
10
|
+
Zlib::GzipReader.open(filename) do |gz|
|
11
|
+
print gz.read
|
12
|
+
end
|
13
|
+
return
|
14
|
+
end
|
15
|
+
File.open(filename, 'rb') do |f|
|
16
|
+
while (line = f.gets)
|
17
|
+
print line
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
filename = ARGV[0]
|
23
|
+
zcat(filename)
|
24
|
+
|
25
|
+
|
data/lib/diskcatalog/utils.rb
CHANGED
data/lib/diskcatalog/version.rb
CHANGED
data/lib/diskcatalog.rb
CHANGED
@@ -13,7 +13,7 @@ require 'zlib'
|
|
13
13
|
|
14
14
|
module Diskcatalog
|
15
15
|
DEF_CONFIG = File.expand_path("~/.catalogrc")
|
16
|
-
SEARCH_CMD = "rg
|
16
|
+
SEARCH_CMD = "rg"
|
17
17
|
|
18
18
|
class Error < StandardError; end
|
19
19
|
|
@@ -88,9 +88,21 @@ module Diskcatalog
|
|
88
88
|
end
|
89
89
|
attr_reader :dir, :search, :debug, :output, :output_files, :output_info, :compress, :debug
|
90
90
|
|
91
|
-
def output_files
|
91
|
+
# def output_files
|
92
|
+
# if compress
|
93
|
+
# @output_files + '.gz'
|
94
|
+
# else
|
95
|
+
# @output_files
|
96
|
+
# end
|
97
|
+
# end
|
98
|
+
|
99
|
+
def compress_output_files
|
100
|
+
@output_files + '.gz'
|
101
|
+
end
|
102
|
+
|
103
|
+
def real_output_files
|
92
104
|
if compress
|
93
|
-
|
105
|
+
compress_output_files
|
94
106
|
else
|
95
107
|
@output_files
|
96
108
|
end
|
@@ -103,7 +115,7 @@ module Diskcatalog
|
|
103
115
|
@search = nil
|
104
116
|
if argv.size > 0
|
105
117
|
@search = argv[0]
|
106
|
-
end
|
118
|
+
end
|
107
119
|
raise "SEARCH is not specified" unless @search
|
108
120
|
end
|
109
121
|
attr_reader :search
|
@@ -184,13 +196,16 @@ module Diskcatalog
|
|
184
196
|
|
185
197
|
private
|
186
198
|
def make_files
|
187
|
-
puts "Create catalog file for #{@option.dir}: #{@option.
|
199
|
+
puts "Create catalog file for #{@option.dir}: #{@option.real_output_files}"
|
188
200
|
unless FileTest.directory?(@option.dir)
|
189
201
|
raise RuntimeError
|
190
202
|
end
|
191
203
|
|
204
|
+
File.unlink(@option.output_files) if FileTest.file?(@option.output_files)
|
205
|
+
File.unlink(@option.compress_output_files) if FileTest.file?(@option.compress_output_files)
|
206
|
+
|
192
207
|
if @option.compress
|
193
|
-
out = File.open(@option.
|
208
|
+
out = File.open(@option.compress_output_files, "w:utf-8")
|
194
209
|
out = Zlib::GzipWriter.open(out)
|
195
210
|
else
|
196
211
|
out = File.open(@option.output_files, "w:utf-8")
|
@@ -282,8 +297,24 @@ module Diskcatalog
|
|
282
297
|
end
|
283
298
|
end
|
284
299
|
|
285
|
-
|
286
|
-
|
300
|
+
# def write_zcat
|
301
|
+
# cmd = <<__EOM__
|
302
|
+
# ruby -rzlib -e 'print File.extname(ARGV[0])==".gz" ? Zlib::GzipReader.open(ARGV[0]).read : File.read(ARGV[0])' %1
|
303
|
+
# __EOM__
|
304
|
+
# zcat_path = File.join(@option.catalogdir, "zcat.bat")
|
305
|
+
# File.open(zcat_path, "w:utf-8") do |f|
|
306
|
+
# f.puts cmd
|
307
|
+
# end
|
308
|
+
# zcat_path
|
309
|
+
# end
|
310
|
+
|
311
|
+
def search
|
312
|
+
precmd = "-z"
|
313
|
+
if Diskcatalog::Utils.windows?
|
314
|
+
# zcat_path=write_zcat
|
315
|
+
precmd = "--pre=dcatz.bat" # .batを指定しないとエラーとなる。
|
316
|
+
end
|
317
|
+
cmd = "#{SEARCH_CMD} #{precmd} #{@option.search} #{@option.catalogdir}"
|
287
318
|
puts cmd if @option.debug
|
288
319
|
system(cmd)
|
289
320
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: diskcatalog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- src
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-04-
|
11
|
+
date: 2025-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sys-filesystem
|
@@ -45,6 +45,7 @@ executables:
|
|
45
45
|
- catalogsearch.cmd
|
46
46
|
- dcatc
|
47
47
|
- dcats
|
48
|
+
- dcatz
|
48
49
|
extensions: []
|
49
50
|
extra_rdoc_files: []
|
50
51
|
files:
|
@@ -70,6 +71,7 @@ files:
|
|
70
71
|
- exe/catalogsearch.cmd
|
71
72
|
- exe/dcatc
|
72
73
|
- exe/dcats
|
74
|
+
- exe/dcatz
|
73
75
|
- lib/diskcatalog.rb
|
74
76
|
- lib/diskcatalog/my_find.rb
|
75
77
|
- lib/diskcatalog/utils.rb
|