diskcatalog 0.3.0 → 0.9.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 +4 -4
- data/.idea/.gitignore +8 -0
- data/.idea/misc.xml +6 -0
- data/.idea/vcs.xml +6 -0
- data/Gemfile.lock +1 -1
- data/build.cmd +14 -0
- data/data/.gitignore +0 -0
- data/data/ext.files +95654 -0
- data/diskcatalog.iml +84 -0
- data/exe/{diskcatalog → dcatc} +1 -1
- data/exe/{mkcat → dcats} +1 -1
- data/lib/diskcatalog/version.rb +1 -1
- data/lib/diskcatalog.rb +132 -31
- data/pkg/diskcatalog-0.1.0.gem +0 -0
- data/pkg/diskcatalog-0.2.0.gem +0 -0
- data/pkg/diskcatalog-0.3.0.gem +0 -0
- data/run_dcatc.cmd +5 -0
- data/run_dcatc.sh +5 -0
- data/run_dcats.cmd +5 -0
- data/run_dcats.sh +5 -0
- metadata +21 -8
- data/run_mkcat.sh +0 -5
- /data/{run_mkcat.cmd → test_diskcatalog.cmd} +0 -0
data/diskcatalog.iml
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
4
|
+
<exclude-output />
|
5
|
+
<content url="file://$MODULE_DIR$" />
|
6
|
+
<orderEntry type="inheritedJdk" />
|
7
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
8
|
+
<orderEntry type="module-library">
|
9
|
+
<library name="minitest (vbundled(5.19.0)) [path][gem]" type="rubylib">
|
10
|
+
<properties>
|
11
|
+
<option name="version" value="4" />
|
12
|
+
</properties>
|
13
|
+
<CLASSES>
|
14
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.1.0/gems/minitest-5.19.0/lib" />
|
15
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.1.0/gems/minitest-5.19.0/test" />
|
16
|
+
</CLASSES>
|
17
|
+
<JAVADOC />
|
18
|
+
<SOURCES>
|
19
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.1.0/gems/minitest-5.19.0/lib" />
|
20
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.1.0/gems/minitest-5.19.0/test" />
|
21
|
+
</SOURCES>
|
22
|
+
<excluded>
|
23
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.1.0/gems/minitest-5.19.0/test" />
|
24
|
+
</excluded>
|
25
|
+
</library>
|
26
|
+
</orderEntry>
|
27
|
+
<orderEntry type="module-library">
|
28
|
+
<library name="rake (vbundled(13.0.6)) [path][gem]" type="rubylib">
|
29
|
+
<properties>
|
30
|
+
<option name="version" value="4" />
|
31
|
+
</properties>
|
32
|
+
<CLASSES>
|
33
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/doc" />
|
34
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/exe" />
|
35
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib" />
|
36
|
+
</CLASSES>
|
37
|
+
<JAVADOC />
|
38
|
+
<SOURCES>
|
39
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/doc" />
|
40
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/exe" />
|
41
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib" />
|
42
|
+
</SOURCES>
|
43
|
+
<excluded>
|
44
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/doc" />
|
45
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/exe" />
|
46
|
+
</excluded>
|
47
|
+
</library>
|
48
|
+
</orderEntry>
|
49
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.4.10, rbenv: 3.1.4) [gem]" level="application" />
|
50
|
+
</component>
|
51
|
+
<component name="RakeTasksCache">
|
52
|
+
<option name="myRootTask">
|
53
|
+
<RakeTaskImpl id="rake">
|
54
|
+
<subtasks>
|
55
|
+
<RakeTaskImpl description="Build diskcatalog-0.3.0.gem into the pkg directory" fullCommand="build" id="build" />
|
56
|
+
<RakeTaskImpl id="build">
|
57
|
+
<subtasks>
|
58
|
+
<RakeTaskImpl description="Generate SHA512 checksum if diskcatalog-0.3.0.gem into the checksums directory" fullCommand="build:checksum" id="checksum" />
|
59
|
+
</subtasks>
|
60
|
+
</RakeTaskImpl>
|
61
|
+
<RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
|
62
|
+
<RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
|
63
|
+
<RakeTaskImpl description="Build and install diskcatalog-0.3.0.gem into system gems" fullCommand="install" id="install" />
|
64
|
+
<RakeTaskImpl id="install">
|
65
|
+
<subtasks>
|
66
|
+
<RakeTaskImpl description="Build and install diskcatalog-0.3.0.gem into system gems without network access" fullCommand="install:local" id="local" />
|
67
|
+
</subtasks>
|
68
|
+
</RakeTaskImpl>
|
69
|
+
<RakeTaskImpl description="Create tag v0.3.0 and build and push diskcatalog-0.3.0.gem to rubygems.org" fullCommand="release[remote]" id="release[remote]" />
|
70
|
+
<RakeTaskImpl description="Run tests" fullCommand="test" id="test" />
|
71
|
+
<RakeTaskImpl description="" fullCommand="default" id="default" />
|
72
|
+
<RakeTaskImpl description="" fullCommand="release" id="release" />
|
73
|
+
<RakeTaskImpl id="release">
|
74
|
+
<subtasks>
|
75
|
+
<RakeTaskImpl description="" fullCommand="release:guard_clean" id="guard_clean" />
|
76
|
+
<RakeTaskImpl description="" fullCommand="release:rubygem_push" id="rubygem_push" />
|
77
|
+
<RakeTaskImpl description="" fullCommand="release:source_control_push" id="source_control_push" />
|
78
|
+
</subtasks>
|
79
|
+
</RakeTaskImpl>
|
80
|
+
</subtasks>
|
81
|
+
</RakeTaskImpl>
|
82
|
+
</option>
|
83
|
+
</component>
|
84
|
+
</module>
|
data/exe/{diskcatalog → dcatc}
RENAMED
data/exe/{mkcat → dcats}
RENAMED
data/lib/diskcatalog/version.rb
CHANGED
data/lib/diskcatalog.rb
CHANGED
@@ -10,6 +10,9 @@ require 'yaml'
|
|
10
10
|
|
11
11
|
|
12
12
|
module Diskcatalog
|
13
|
+
DEF_CONFIG = File.expand_path("~/.catalogrc")
|
14
|
+
SEARCH_CMD = "rg"
|
15
|
+
|
13
16
|
class Error < StandardError; end
|
14
17
|
|
15
18
|
class Config
|
@@ -48,22 +51,72 @@ module Diskcatalog
|
|
48
51
|
attr_accessor :catalogdir
|
49
52
|
end
|
50
53
|
|
51
|
-
|
52
54
|
class Option
|
53
|
-
def initialize(opts,
|
55
|
+
def initialize(opts, argv, config)
|
54
56
|
@opts = opts
|
55
|
-
@
|
57
|
+
@argv = argv
|
56
58
|
@config = config
|
57
|
-
@debug = @opts[:d]
|
59
|
+
@debug = @opts[:d]
|
60
|
+
@list = false
|
61
|
+
if @opts[:l]
|
62
|
+
@list = true
|
63
|
+
end
|
64
|
+
end
|
65
|
+
attr_reader :debug, :list
|
66
|
+
def catalogdir
|
67
|
+
@config.catalogdir
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
class CreateOption < Option
|
72
|
+
def initialize(opts, argv, config)
|
73
|
+
super
|
74
|
+
@dir = nil
|
75
|
+
if argv.size > 0 && FileTest.directory?(argv[0])
|
76
|
+
@dir = argv[0]
|
77
|
+
end
|
78
|
+
|
58
79
|
@output = @opts[:o]
|
59
|
-
|
60
|
-
|
61
|
-
|
80
|
+
if @output
|
81
|
+
@output_files = File.join(catalogdir, @output + '.files')
|
82
|
+
@output_info = File.join(catalogdir, @output + '.info')
|
83
|
+
end
|
84
|
+
end
|
85
|
+
attr_reader :dir, :search, :debug, :output, :output_files, :output_info
|
86
|
+
end
|
87
|
+
|
88
|
+
class SearchOption < Option
|
89
|
+
def initialize(opts, argv, config)
|
90
|
+
super
|
91
|
+
@search = nil
|
92
|
+
if argv.size > 0
|
93
|
+
@search = argv[0]
|
94
|
+
end
|
62
95
|
end
|
63
|
-
attr_reader :
|
96
|
+
attr_reader :search
|
64
97
|
end
|
65
98
|
|
66
99
|
class Command
|
100
|
+
def self.load_yaml(config_file)
|
101
|
+
config_file ||= DEF_CONFIG
|
102
|
+
config_file = File.expand_path(config_file)
|
103
|
+
puts "Config: #{config_file}"
|
104
|
+
yaml = nil
|
105
|
+
if FileTest.file?(config_file)
|
106
|
+
yaml = YAML.load_file(config_file)
|
107
|
+
end
|
108
|
+
Config.create_from_yaml(yaml)
|
109
|
+
end
|
110
|
+
|
111
|
+
def list
|
112
|
+
puts "List catalog in #{@opt.catalogdir}"
|
113
|
+
Dir.glob(File.join(@opt.catalogdir, "*.info")).each do |path|
|
114
|
+
puts File.basename(path)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
class CreateCommand < Command
|
67
120
|
def self.run(argv)
|
68
121
|
STDOUT.sync = true
|
69
122
|
opts = {}
|
@@ -78,30 +131,23 @@ module Diskcatalog
|
|
78
131
|
opt.on('-v', '--verbose', 'verbose message') {|v| opts[:v] = v}
|
79
132
|
opt.on('-o FILENAME', '--output=FILENAME') {|v| opts[:o] = v}
|
80
133
|
opt.on('--config=CONFIGFILE', 'Config file') {|v| opts[:c] = v }
|
134
|
+
opt.on('-l', '--list') {|v| opts[:l] = v}
|
81
135
|
opt.parse!(argv)
|
82
|
-
if opts[:o].nil?
|
83
|
-
|
84
|
-
|
85
|
-
end
|
86
|
-
|
87
|
-
|
88
|
-
config_file = File.expand_path(config_file)
|
89
|
-
yaml = nil
|
90
|
-
if FileTest.file?(config_file)
|
91
|
-
yaml = YAML.load_file(config_file)
|
92
|
-
end
|
93
|
-
config = Config.create_from_yaml(yaml)
|
94
|
-
option = Option.new(opts, argv, config)
|
136
|
+
# if opts[:o].nil?
|
137
|
+
# puts opt.help
|
138
|
+
# exit
|
139
|
+
# end
|
140
|
+
config = load_yaml(opts[:c])
|
141
|
+
option = CreateOption.new(opts, argv, config)
|
95
142
|
begin
|
96
|
-
command =
|
143
|
+
command = CreateCommand.new(option)
|
97
144
|
command.run
|
98
145
|
rescue => e
|
146
|
+
puts e.message
|
99
147
|
if option.debug
|
100
|
-
|
101
|
-
p e.backtrace
|
148
|
+
puts e.backtrace
|
102
149
|
end
|
103
150
|
puts opt.help
|
104
|
-
exit
|
105
151
|
end
|
106
152
|
end
|
107
153
|
|
@@ -110,14 +156,20 @@ module Diskcatalog
|
|
110
156
|
end
|
111
157
|
|
112
158
|
def run
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
159
|
+
if @opt.list
|
160
|
+
list
|
161
|
+
else
|
162
|
+
unless @opt.dir
|
163
|
+
raise "directory is not specified"
|
164
|
+
end
|
165
|
+
make_files
|
166
|
+
make_info
|
167
|
+
end
|
117
168
|
end
|
118
169
|
|
119
170
|
private
|
120
171
|
def make_files
|
172
|
+
puts "Create catalog for #{@opt.dir}"
|
121
173
|
unless FileTest.directory?(@opt.dir)
|
122
174
|
raise RuntimeError
|
123
175
|
end
|
@@ -133,9 +185,12 @@ module Diskcatalog
|
|
133
185
|
end
|
134
186
|
end
|
135
187
|
rescue => e
|
136
|
-
p e.class
|
137
188
|
puts e.message
|
138
|
-
|
189
|
+
if option.debug
|
190
|
+
p e.backtrace
|
191
|
+
end
|
192
|
+
p e.class
|
193
|
+
end
|
139
194
|
out.close if out
|
140
195
|
end
|
141
196
|
|
@@ -146,4 +201,50 @@ module Diskcatalog
|
|
146
201
|
out.close if out
|
147
202
|
end
|
148
203
|
end
|
204
|
+
|
205
|
+
class SearchCommand < Command
|
206
|
+
def self.run(argv)
|
207
|
+
STDOUT.sync = true
|
208
|
+
opts = {}
|
209
|
+
opt = OptionParser.new(argv)
|
210
|
+
opt.version = VERSION
|
211
|
+
opt.banner = "Usage: #{opt.program_name} [options] <directory>"
|
212
|
+
opt.separator('Options')
|
213
|
+
opt.on_head('-h', '--help', 'show this message') do |v|
|
214
|
+
puts opt.help
|
215
|
+
exit
|
216
|
+
end
|
217
|
+
opt.on('-v', '--verbose', 'verbose message') {|v| opts[:v] = v}
|
218
|
+
opt.on('--config=CONFIGFILE', 'Config file') {|v| opts[:c] = v }
|
219
|
+
opt.parse!(argv)
|
220
|
+
config = load_yaml(opts[:c])
|
221
|
+
option = SearchOption.new(opts, argv, config)
|
222
|
+
begin
|
223
|
+
command = SearchCommand.new(option)
|
224
|
+
command.run
|
225
|
+
rescue => e
|
226
|
+
puts e.message
|
227
|
+
if option.debug
|
228
|
+
p e.backtrace
|
229
|
+
end
|
230
|
+
puts opt.help
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
def initialize(option)
|
235
|
+
@opt = option
|
236
|
+
end
|
237
|
+
|
238
|
+
def run
|
239
|
+
if @opt.list
|
240
|
+
list
|
241
|
+
else
|
242
|
+
search
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
def search
|
247
|
+
system("#{SEARCH_CMD} #{@opt.search} #{@opt.catalogdir}")
|
248
|
+
end
|
249
|
+
end
|
149
250
|
end
|
Binary file
|
Binary file
|
Binary file
|
data/run_dcatc.cmd
ADDED
data/run_dcatc.sh
ADDED
data/run_dcats.cmd
ADDED
data/run_dcats.sh
ADDED
metadata
CHANGED
@@ -1,43 +1,56 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: diskcatalog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- src
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-08-
|
11
|
+
date: 2023-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Create disk catalog.
|
14
14
|
email:
|
15
15
|
- src@srcw.net
|
16
16
|
executables:
|
17
17
|
- catalogsearch.cmd
|
18
|
-
-
|
19
|
-
-
|
18
|
+
- dcatc
|
19
|
+
- dcats
|
20
20
|
extensions: []
|
21
21
|
extra_rdoc_files: []
|
22
22
|
files:
|
23
|
+
- ".idea/.gitignore"
|
24
|
+
- ".idea/misc.xml"
|
25
|
+
- ".idea/vcs.xml"
|
23
26
|
- CODE_OF_CONDUCT.md
|
24
27
|
- Gemfile
|
25
28
|
- Gemfile.lock
|
26
29
|
- LICENSE.txt
|
27
30
|
- README.md
|
28
31
|
- Rakefile
|
32
|
+
- build.cmd
|
29
33
|
- build.sh
|
30
34
|
- catalogrc
|
35
|
+
- data/.gitignore
|
36
|
+
- data/ext.files
|
31
37
|
- diskcatalog.gemspec
|
38
|
+
- diskcatalog.iml
|
32
39
|
- exe/catalogsearch.cmd
|
33
|
-
- exe/
|
34
|
-
- exe/
|
40
|
+
- exe/dcatc
|
41
|
+
- exe/dcats
|
35
42
|
- lib/diskcatalog.rb
|
36
43
|
- lib/diskcatalog/my_find.rb
|
37
44
|
- lib/diskcatalog/version.rb
|
38
|
-
-
|
39
|
-
-
|
45
|
+
- pkg/diskcatalog-0.1.0.gem
|
46
|
+
- pkg/diskcatalog-0.2.0.gem
|
47
|
+
- pkg/diskcatalog-0.3.0.gem
|
48
|
+
- run_dcatc.cmd
|
49
|
+
- run_dcatc.sh
|
50
|
+
- run_dcats.cmd
|
51
|
+
- run_dcats.sh
|
40
52
|
- sig/diskcatalog.rbs
|
53
|
+
- test_diskcatalog.cmd
|
41
54
|
homepage: https://github.com/src256
|
42
55
|
licenses:
|
43
56
|
- MIT
|
data/run_mkcat.sh
DELETED
File without changes
|