diskcatalog 1.2.2 → 1.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 26a374df61fddd36c051c3267e53b0e3f09a035cbc618dbbbf0e722ff9307cfd
4
- data.tar.gz: b36e80b8eecae674c36e10fefbd4c06dd8f4b5b5f495fc58294f0c7126385e1f
3
+ metadata.gz: 0a4c33e246e2738c6f822206c8dbb98392aff3534186cb1bde3913c3dacded5e
4
+ data.tar.gz: eaac4cb7ff83a101ddefe3604ff0cdffe71b193bd8d94aa80f8dc897995df8ee
5
5
  SHA512:
6
- metadata.gz: 86a9b0c5acd35dff29f4a8ca7b9d2ca81663a884d3bfd6ea13aa6565197716c20214890736e27261ac418ba27b8fe69d8293b37b3f7e217a40b7861bb9a4b9d1
7
- data.tar.gz: 0e215f7367b9f8b3641aa7856bbeaa79e2b2ab2c741ea3fd1d0a26659036fa4ae166bbfae8609d1778a3e473f3b1d0d7d02e30e548cc22fae0bf70d6b06e8951
6
+ metadata.gz: b26d641ce336e2e7b9c9652969df0786945e77204879c0b638650592a8c46a2e72c417bf736e6f4c9b2c3818f0f14bb77255edbb16e602bf35ec149d5ecd832a
7
+ data.tar.gz: 858ade4f1d4bcbd5772dc442c09ac9dbaa38a628d49ba5b82e7cda66c5f1c7dfeb34271f530d8f955d9bc6903403109a1efc3f71b6209fc9762742173aeb5056
@@ -56,7 +56,7 @@
56
56
  </library>
57
57
  </orderEntry>
58
58
  <orderEntry type="module-library">
59
- <library name="minitest (v5.25.4) [path][gem]" type="rubylib">
59
+ <library name="minitest (v5.25.5) [path][gem]" type="rubylib">
60
60
  <properties>
61
61
  <option name="additionalInfo">
62
62
  <AdditionalInfo>
@@ -73,20 +73,20 @@
73
73
  <option value="lib" />
74
74
  </list>
75
75
  </option>
76
- <option name="url" value="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/minitest-5.25.4" />
77
- <option name="version" value="5.25.4" />
76
+ <option name="url" value="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/minitest-5.25.5" />
77
+ <option name="version" value="5.25.5" />
78
78
  </properties>
79
79
  <CLASSES>
80
- <root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/minitest-5.25.4/lib" />
81
- <root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/minitest-5.25.4/test" />
80
+ <root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/minitest-5.25.5/lib" />
81
+ <root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/minitest-5.25.5/test" />
82
82
  </CLASSES>
83
83
  <JAVADOC />
84
84
  <SOURCES>
85
- <root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/minitest-5.25.4/lib" />
86
- <root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/minitest-5.25.4/test" />
85
+ <root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/minitest-5.25.5/lib" />
86
+ <root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/minitest-5.25.5/test" />
87
87
  </SOURCES>
88
88
  <excluded>
89
- <root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/minitest-5.25.4/test" />
89
+ <root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/minitest-5.25.5/test" />
90
90
  </excluded>
91
91
  </library>
92
92
  </orderEntry>
@@ -169,6 +169,41 @@
169
169
  </excluded>
170
170
  </library>
171
171
  </orderEntry>
172
+ <orderEntry type="module-library">
173
+ <library name="zlib (v3.2.1) [path][gem]" type="rubylib">
174
+ <properties>
175
+ <option name="additionalInfo">
176
+ <AdditionalInfo>
177
+ <option name="authors" value="該当なし" />
178
+ <option name="email" value="該当なし" />
179
+ <option name="homepage" value="該当なし" />
180
+ <option name="summary" value="該当なし" />
181
+ </AdditionalInfo>
182
+ </option>
183
+ <option name="fromPath" value="true" />
184
+ <option name="name" value="zlib" />
185
+ <option name="requirePaths">
186
+ <list>
187
+ <option value="lib" />
188
+ </list>
189
+ </option>
190
+ <option name="url" value="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/zlib-3.2.1" />
191
+ <option name="version" value="3.2.1" />
192
+ </properties>
193
+ <CLASSES>
194
+ <root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/zlib-3.2.1/ext" />
195
+ <root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/zlib-3.2.1/lib" />
196
+ </CLASSES>
197
+ <JAVADOC />
198
+ <SOURCES>
199
+ <root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/zlib-3.2.1/ext" />
200
+ <root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/zlib-3.2.1/lib" />
201
+ </SOURCES>
202
+ <excluded>
203
+ <root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/zlib-3.2.1/ext" />
204
+ </excluded>
205
+ </library>
206
+ </orderEntry>
172
207
  <orderEntry type="library" scope="PROVIDED" name="bundler (v2.4.19, rbenv: 3.2.5) [gem]" level="application" />
173
208
  </component>
174
209
  </module>
data/Gemfile.lock CHANGED
@@ -1,17 +1,19 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- diskcatalog (1.2.2)
4
+ diskcatalog (1.3.0)
5
5
  sys-filesystem
6
+ zlib
6
7
 
7
8
  GEM
8
9
  remote: https://rubygems.org/
9
10
  specs:
10
11
  ffi (1.17.1)
11
- minitest (5.25.4)
12
+ minitest (5.25.5)
12
13
  rake (13.2.1)
13
14
  sys-filesystem (1.5.3)
14
15
  ffi (~> 1.1)
16
+ zlib (3.2.1)
15
17
 
16
18
  PLATFORMS
17
19
  arm64-darwin-22
data/diskcatalog.gemspec CHANGED
@@ -30,6 +30,7 @@ Gem::Specification.new do |spec|
30
30
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
31
31
  spec.require_paths = ["lib"]
32
32
  spec.add_dependency "sys-filesystem"
33
+ spec.add_dependency "zlib"
33
34
  # Uncomment to register a new dependency of your gem
34
35
  # spec.add_dependency "example-gem", "~> 1.0"
35
36
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Diskcatalog
4
- VERSION = "1.2.2"
4
+ VERSION = "1.3.0"
5
5
  end
data/lib/diskcatalog.rb CHANGED
@@ -9,10 +9,11 @@ require 'optparse'
9
9
  require 'fileutils'
10
10
  require 'yaml'
11
11
  require 'sys/filesystem'
12
+ require 'zlib'
12
13
 
13
14
  module Diskcatalog
14
15
  DEF_CONFIG = File.expand_path("~/.catalogrc")
15
- SEARCH_CMD = "rg"
16
+ SEARCH_CMD = "rg -z"
16
17
 
17
18
  class Error < StandardError; end
18
19
 
@@ -77,13 +78,23 @@ module Diskcatalog
77
78
  @dir = argv[0]
78
79
  end
79
80
 
81
+ @debug = @opts[:d]
82
+ @compress = @opts[:z]
80
83
  @output = @opts[:o]
81
84
  if @output
82
85
  @output_files = File.join(catalogdir, @output + '.files')
83
86
  @output_info = File.join(catalogdir, @output + '.info')
84
87
  end
85
88
  end
86
- attr_reader :dir, :search, :debug, :output, :output_files, :output_info
89
+ attr_reader :dir, :search, :debug, :output, :output_files, :output_info, :compress, :debug
90
+
91
+ def output_files
92
+ if compress
93
+ @output_files + '.gz'
94
+ else
95
+ @output_files
96
+ end
97
+ end
87
98
  end
88
99
 
89
100
  class SearchOption < Option
@@ -93,6 +104,7 @@ module Diskcatalog
93
104
  if argv.size > 0
94
105
  @search = argv[0]
95
106
  end
107
+ raise "SEARCH is not specified" unless @search
96
108
  end
97
109
  attr_reader :search
98
110
  end
@@ -132,6 +144,8 @@ module Diskcatalog
132
144
  opt.on('-v', '--verbose', 'verbose message') {|v| opts[:v] = v}
133
145
  opt.on('-o FILENAME', '--output=FILENAME') {|v| opts[:o] = v}
134
146
  opt.on('--config=CONFIGFILE', 'Config file') {|v| opts[:c] = v }
147
+ opt.on('-d', '--debug', 'debug message') {|v| opts[:d] = v}
148
+ opt.on('-z', '--gzip', 'compress with gzip') {|v| opts[:z] = v}
135
149
  opt.on('-l', '--list') {|v| opts[:l] = v}
136
150
  opt.parse!(argv)
137
151
  # if opts[:o].nil?
@@ -174,7 +188,14 @@ module Diskcatalog
174
188
  unless FileTest.directory?(@option.dir)
175
189
  raise RuntimeError
176
190
  end
177
- out = File.open(@option.output_files, "w:utf-8")
191
+
192
+ if @option.compress
193
+ out = File.open(@option.output_files, "w:utf-8")
194
+ out = Zlib::GzipWriter.open(out)
195
+ else
196
+ out = File.open(@option.output_files, "w:utf-8")
197
+ end
198
+
178
199
  begin
179
200
  MyFind.find(@option.dir, ignore_error: true) do |f|
180
201
  if FileTest.file?(f)
@@ -189,8 +210,8 @@ module Diskcatalog
189
210
  puts e.message
190
211
  if option.debug
191
212
  p e.backtrace
213
+ p e.class
192
214
  end
193
- p e.class
194
215
  end
195
216
  out.close if out
196
217
  end
@@ -225,7 +246,7 @@ module Diskcatalog
225
246
  opts = {}
226
247
  opt = OptionParser.new(argv)
227
248
  opt.version = VERSION
228
- opt.banner = "Usage: #{opt.program_name} [options] <directory>"
249
+ opt.banner = "Usage: #{opt.program_name} [options] SEARCH <directory>"
229
250
  opt.separator('Options')
230
251
  opt.on_head('-h', '--help', 'show this message') do |v|
231
252
  puts opt.help
@@ -236,14 +257,14 @@ module Diskcatalog
236
257
  opt.on('-d', '--debug', 'debug message') {|v| opts[:d] = v}
237
258
  opt.parse!(argv)
238
259
  config = load_yaml(opts[:c])
239
- option = SearchOption.new(opts, argv, config)
240
260
  begin
261
+ option = SearchOption.new(opts, argv, config)
241
262
  command = SearchCommand.new(option)
242
263
  command.run
243
264
  rescue => e
244
265
  puts e.message
245
- if option.debug
246
- p e.backtrace
266
+ if opts[:d]
267
+ puts e.backtrace
247
268
  end
248
269
  puts opt.help
249
270
  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.2.2
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - src
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-02-11 00:00:00.000000000 Z
11
+ date: 2025-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sys-filesystem
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: zlib
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  description: Create disk catalog.
28
42
  email:
29
43
  - src@srcw.net