diskcatalog 1.2.0 → 1.2.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 +1 -0
- data/Gemfile.lock +1 -1
- data/build.sh +16 -10
- data/lib/diskcatalog/version.rb +1 -1
- data/lib/diskcatalog.rb +20 -17
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26a374df61fddd36c051c3267e53b0e3f09a035cbc618dbbbf0e722ff9307cfd
|
4
|
+
data.tar.gz: b36e80b8eecae674c36e10fefbd4c06dd8f4b5b5f495fc58294f0c7126385e1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86a9b0c5acd35dff29f4a8ca7b9d2ca81663a884d3bfd6ea13aa6565197716c20214890736e27261ac418ba27b8fe69d8293b37b3f7e217a40b7861bb9a4b9d1
|
7
|
+
data.tar.gz: 0e215f7367b9f8b3641aa7856bbeaa79e2b2ab2c741ea3fd1d0a26659036fa4ae166bbfae8609d1778a3e473f3b1d0d7d02e30e548cc22fae0bf70d6b06e8951
|
data/.idea/diskcatalog.iml
CHANGED
@@ -8,6 +8,7 @@
|
|
8
8
|
<sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
|
9
9
|
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
10
10
|
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
11
|
+
<excludeFolder url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/cache" />
|
11
12
|
</content>
|
12
13
|
<orderEntry type="inheritedJdk" />
|
13
14
|
<orderEntry type="sourceFolder" forTests="false" />
|
data/Gemfile.lock
CHANGED
data/build.sh
CHANGED
@@ -1,18 +1,24 @@
|
|
1
1
|
#!/bin/sh
|
2
2
|
# rmagick for sierra
|
3
|
-
export PKG_CONFIG_PATH=/usr/local/opt/imagemagick@6/lib/pkgconfig
|
3
|
+
#export PKG_CONFIG_PATH=/usr/local/opt/imagemagick@6/lib/pkgconfig
|
4
4
|
#export PATH=/usr/local/Cellar/imagemagick@6/6.9.7-5/bin:$PATH
|
5
5
|
|
6
6
|
bundle_dir=./vendor/bundle
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
bundle config --local path $bundle_dir
|
8
|
+
|
9
|
+
if [ "$1" = "clean" ]; then
|
10
|
+
echo "rm -rf $bundle_dir"
|
11
11
|
/bin/rm -rf "$bundle_dir"
|
12
|
-
|
12
|
+
/bin/rm Gemfile.lock
|
13
|
+
exit 0
|
13
14
|
fi
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
if [ -d "$bundle_dir" ] ; then
|
17
|
+
echo "bunlde update"
|
18
|
+
bundle update
|
19
|
+
bundle clean
|
20
|
+
else
|
21
|
+
echo "bundle install"
|
22
|
+
/bin/rm -rf "$bundle_dir"
|
23
|
+
bundle install
|
24
|
+
fi
|
data/lib/diskcatalog/version.rb
CHANGED
data/lib/diskcatalog.rb
CHANGED
@@ -110,8 +110,8 @@ module Diskcatalog
|
|
110
110
|
end
|
111
111
|
|
112
112
|
def list
|
113
|
-
puts "List catalog in #{@
|
114
|
-
Dir.glob(File.join(@
|
113
|
+
puts "List catalog in #{@option.catalogdir}"
|
114
|
+
Dir.glob(File.join(@option.catalogdir, "*.info")).each do |path|
|
115
115
|
puts File.basename(path)
|
116
116
|
end
|
117
117
|
end
|
@@ -153,14 +153,14 @@ module Diskcatalog
|
|
153
153
|
end
|
154
154
|
|
155
155
|
def initialize(option)
|
156
|
-
@
|
156
|
+
@option = option
|
157
157
|
end
|
158
158
|
|
159
159
|
def run
|
160
|
-
if @
|
160
|
+
if @option.list
|
161
161
|
list
|
162
162
|
else
|
163
|
-
unless @
|
163
|
+
unless @option.dir
|
164
164
|
raise "directory is not specified"
|
165
165
|
end
|
166
166
|
make_files
|
@@ -170,13 +170,13 @@ module Diskcatalog
|
|
170
170
|
|
171
171
|
private
|
172
172
|
def make_files
|
173
|
-
puts "Create catalog file for #{@
|
174
|
-
unless FileTest.directory?(@
|
173
|
+
puts "Create catalog file for #{@option.dir}: #{@option.output_files}"
|
174
|
+
unless FileTest.directory?(@option.dir)
|
175
175
|
raise RuntimeError
|
176
176
|
end
|
177
|
-
out = File.open(@
|
177
|
+
out = File.open(@option.output_files, "w:utf-8")
|
178
178
|
begin
|
179
|
-
MyFind.find(@
|
179
|
+
MyFind.find(@option.dir, ignore_error: true) do |f|
|
180
180
|
if FileTest.file?(f)
|
181
181
|
size = File.size(f)
|
182
182
|
mtime = File.mtime(f).strftime("%Y-%m-%d")
|
@@ -196,12 +196,12 @@ module Diskcatalog
|
|
196
196
|
end
|
197
197
|
|
198
198
|
def make_info
|
199
|
-
puts "Create info for #{@
|
200
|
-
unless FileTest.directory?(@
|
199
|
+
puts "Create info for #{@option.dir}: #{@option.output_info}"
|
200
|
+
unless FileTest.directory?(@option.dir)
|
201
201
|
raise RuntimeError
|
202
202
|
end
|
203
203
|
|
204
|
-
stat = Sys::Filesystem.stat(@
|
204
|
+
stat = Sys::Filesystem.stat(@option.dir)
|
205
205
|
free_bytes = Utils::number_to_human_size(stat.blocks_available * stat.block_size)
|
206
206
|
# puts number_to_human_size(free_bytes)
|
207
207
|
puts "total=#{stat.blocks * stat.block_size}"
|
@@ -209,10 +209,10 @@ module Diskcatalog
|
|
209
209
|
puts "total_bytes=#{total_bytes}"
|
210
210
|
#puts number_to_human_size(total_bytes)
|
211
211
|
|
212
|
-
out = File.open(@
|
212
|
+
out = File.open(@option.output_info, "w:utf-8")
|
213
213
|
created = Time.now.strftime("%Y-%m-%dT%H:%M:%S")
|
214
214
|
out.puts "Created: #{created}"
|
215
|
-
out.puts "Volume: #{@
|
215
|
+
out.puts "Volume: #{@option.dir}"
|
216
216
|
out.puts "Total: #{total_bytes}"
|
217
217
|
out.puts "Free: #{free_bytes}"
|
218
218
|
out.close if out
|
@@ -233,6 +233,7 @@ module Diskcatalog
|
|
233
233
|
end
|
234
234
|
opt.on('-v', '--verbose', 'verbose message') {|v| opts[:v] = v}
|
235
235
|
opt.on('--config=CONFIGFILE', 'Config file') {|v| opts[:c] = v }
|
236
|
+
opt.on('-d', '--debug', 'debug message') {|v| opts[:d] = v}
|
236
237
|
opt.parse!(argv)
|
237
238
|
config = load_yaml(opts[:c])
|
238
239
|
option = SearchOption.new(opts, argv, config)
|
@@ -249,11 +250,11 @@ module Diskcatalog
|
|
249
250
|
end
|
250
251
|
|
251
252
|
def initialize(option)
|
252
|
-
@
|
253
|
+
@option = option
|
253
254
|
end
|
254
255
|
|
255
256
|
def run
|
256
|
-
if @
|
257
|
+
if @option.list
|
257
258
|
list
|
258
259
|
else
|
259
260
|
search
|
@@ -261,7 +262,9 @@ module Diskcatalog
|
|
261
262
|
end
|
262
263
|
|
263
264
|
def search
|
264
|
-
|
265
|
+
cmd = "#{SEARCH_CMD} #{@option.search} #{@option.catalogdir}"
|
266
|
+
puts cmd if @option.debug
|
267
|
+
system(cmd)
|
265
268
|
end
|
266
269
|
end
|
267
270
|
end
|