diskcatalog 1.3.0 → 1.3.1

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: 0a4c33e246e2738c6f822206c8dbb98392aff3534186cb1bde3913c3dacded5e
4
- data.tar.gz: eaac4cb7ff83a101ddefe3604ff0cdffe71b193bd8d94aa80f8dc897995df8ee
3
+ metadata.gz: 4e0ad770b5bfab040d17787bfe39cb4f58b6a529c97ef1794bfa02cae9dc2534
4
+ data.tar.gz: cf0fab667155ab200608b10727f56efbf360cdb947ade106bd5b9065a3c9087a
5
5
  SHA512:
6
- metadata.gz: b26d641ce336e2e7b9c9652969df0786945e77204879c0b638650592a8c46a2e72c417bf736e6f4c9b2c3818f0f14bb77255edbb16e602bf35ec149d5ecd832a
7
- data.tar.gz: 858ade4f1d4bcbd5772dc442c09ac9dbaa38a628d49ba5b82e7cda66c5f1c7dfeb34271f530d8f955d9bc6903403109a1efc3f71b6209fc9762742173aeb5056
6
+ metadata.gz: 2474841f69413fc77f299293088b19ce423faa63dea352d47927b24f28eeaa6cdc54a38f044e458e08f6ed1eaf401966c59e45b9816c6b60992e8c9ef82b3570
7
+ data.tar.gz: 0e6f952649a11a2cfc851262a71c3654af582eaa9f334680c98015e6ede2968794c10ba3e7e8b2b2c1dcf3fd38da73fd7378c4e394dff12a482abb396a4d24a2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- diskcatalog (1.3.0)
4
+ diskcatalog (1.3.1)
5
5
  sys-filesystem
6
6
  zlib
7
7
 
@@ -17,6 +17,7 @@ GEM
17
17
 
18
18
  PLATFORMS
19
19
  arm64-darwin-22
20
+ x64-mingw-ucrt
20
21
  x64-mingw32
21
22
  x86_64-darwin-22
22
23
  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
+
@@ -18,6 +18,10 @@ module Diskcatalog
18
18
  '%.1f TB' % (size / tb)
19
19
  end.sub('.0', '')
20
20
  end
21
+
22
+ def self.windows?
23
+ RUBY_PLATFORM =~ /mswin|mingw|bccwin|cygwin/
24
+ end
21
25
  end
22
26
  end
23
27
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Diskcatalog
4
- VERSION = "1.3.0"
4
+ VERSION = "1.3.1"
5
5
  end
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 -z"
16
+ SEARCH_CMD = "rg"
17
17
 
18
18
  class Error < StandardError; end
19
19
 
@@ -103,7 +103,7 @@ module Diskcatalog
103
103
  @search = nil
104
104
  if argv.size > 0
105
105
  @search = argv[0]
106
- end
106
+ end
107
107
  raise "SEARCH is not specified" unless @search
108
108
  end
109
109
  attr_reader :search
@@ -282,8 +282,24 @@ module Diskcatalog
282
282
  end
283
283
  end
284
284
 
285
- def search
286
- cmd = "#{SEARCH_CMD} #{@option.search} #{@option.catalogdir}"
285
+ # def write_zcat
286
+ # cmd = <<__EOM__
287
+ # ruby -rzlib -e 'print File.extname(ARGV[0])==".gz" ? Zlib::GzipReader.open(ARGV[0]).read : File.read(ARGV[0])' %1
288
+ # __EOM__
289
+ # zcat_path = File.join(@option.catalogdir, "zcat.bat")
290
+ # File.open(zcat_path, "w:utf-8") do |f|
291
+ # f.puts cmd
292
+ # end
293
+ # zcat_path
294
+ # end
295
+
296
+ def search
297
+ precmd = "-z"
298
+ if Diskcatalog::Utils.windows?
299
+ # zcat_path=write_zcat
300
+ precmd = "--pre=dcatz.bat" # .batを指定しないとエラーとなる。
301
+ end
302
+ cmd = "#{SEARCH_CMD} #{precmd} #{@option.search} #{@option.catalogdir}"
287
303
  puts cmd if @option.debug
288
304
  system(cmd)
289
305
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diskcatalog
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - src
@@ -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