diskcatalog 1.1.0 → 1.2.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 +4 -4
- data/.idea/diskcatalog.iml +173 -0
- data/.idea/inspectionProfiles/Project_Default.xml +17 -0
- data/.idea/misc.xml +1 -3
- data/.idea/modules.xml +8 -0
- data/Gemfile.lock +7 -7
- data/build.sh +16 -10
- data/lib/diskcatalog/my_find.rb +48 -48
- data/lib/diskcatalog/utils.rb +23 -0
- data/lib/diskcatalog/version.rb +1 -1
- data/lib/diskcatalog.rb +27 -40
- data/tag +32 -0
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c66790a692cd160c66dd12bfc25f6fdba9b4039bccf8ffab53dd488ef450adaf
|
4
|
+
data.tar.gz: 8aef14d9eff6091a6b003113a707cf73a6016fcd80ae8a73f2d0115498af0797
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32196c77bf1e17792f6ba06c16578d77cf02d8553719931eba98a27806882c0381f79b0e765e3693cd4f9f8d63e91e48d801f961ea85feab85fa5d9105830834
|
7
|
+
data.tar.gz: f099226645be2a1323d7dbe8c27e4cd95e2f7f16b42d367511f5f84cc2e8e95a9eca440443b06c17ad1a8e327606bd86a96a06a2563f1a8c331434f0b183c577
|
@@ -0,0 +1,173 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="ModuleRunConfigurationManager">
|
4
|
+
<shared />
|
5
|
+
</component>
|
6
|
+
<component name="NewModuleRootManager">
|
7
|
+
<content url="file://$MODULE_DIR$">
|
8
|
+
<sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
|
9
|
+
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
10
|
+
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
11
|
+
</content>
|
12
|
+
<orderEntry type="inheritedJdk" />
|
13
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
14
|
+
<orderEntry type="module-library">
|
15
|
+
<library name="ffi (v1.17.1) [path][gem]" type="rubylib">
|
16
|
+
<properties>
|
17
|
+
<option name="additionalInfo">
|
18
|
+
<AdditionalInfo>
|
19
|
+
<option name="authors" value="該当なし" />
|
20
|
+
<option name="email" value="該当なし" />
|
21
|
+
<option name="homepage" value="該当なし" />
|
22
|
+
<option name="summary" value="該当なし" />
|
23
|
+
</AdditionalInfo>
|
24
|
+
</option>
|
25
|
+
<option name="fromPath" value="true" />
|
26
|
+
<option name="name" value="ffi" />
|
27
|
+
<option name="requirePaths">
|
28
|
+
<list>
|
29
|
+
<option value="lib" />
|
30
|
+
</list>
|
31
|
+
</option>
|
32
|
+
<option name="url" value="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/ffi-1.17.1" />
|
33
|
+
<option name="version" value="1.17.1" />
|
34
|
+
</properties>
|
35
|
+
<CLASSES>
|
36
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/ffi-1.17.1/ext" />
|
37
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/ffi-1.17.1/lib" />
|
38
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/ffi-1.17.1/sig" />
|
39
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/ffi-1.17.1/rakelib" />
|
40
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/ffi-1.17.1/samples" />
|
41
|
+
</CLASSES>
|
42
|
+
<JAVADOC />
|
43
|
+
<SOURCES>
|
44
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/ffi-1.17.1/ext" />
|
45
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/ffi-1.17.1/lib" />
|
46
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/ffi-1.17.1/sig" />
|
47
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/ffi-1.17.1/rakelib" />
|
48
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/ffi-1.17.1/samples" />
|
49
|
+
</SOURCES>
|
50
|
+
<excluded>
|
51
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/ffi-1.17.1/ext" />
|
52
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/ffi-1.17.1/rakelib" />
|
53
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/ffi-1.17.1/samples" />
|
54
|
+
</excluded>
|
55
|
+
</library>
|
56
|
+
</orderEntry>
|
57
|
+
<orderEntry type="module-library">
|
58
|
+
<library name="minitest (v5.25.4) [path][gem]" type="rubylib">
|
59
|
+
<properties>
|
60
|
+
<option name="additionalInfo">
|
61
|
+
<AdditionalInfo>
|
62
|
+
<option name="authors" value="該当なし" />
|
63
|
+
<option name="email" value="該当なし" />
|
64
|
+
<option name="homepage" value="該当なし" />
|
65
|
+
<option name="summary" value="該当なし" />
|
66
|
+
</AdditionalInfo>
|
67
|
+
</option>
|
68
|
+
<option name="fromPath" value="true" />
|
69
|
+
<option name="name" value="minitest" />
|
70
|
+
<option name="requirePaths">
|
71
|
+
<list>
|
72
|
+
<option value="lib" />
|
73
|
+
</list>
|
74
|
+
</option>
|
75
|
+
<option name="url" value="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/minitest-5.25.4" />
|
76
|
+
<option name="version" value="5.25.4" />
|
77
|
+
</properties>
|
78
|
+
<CLASSES>
|
79
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/minitest-5.25.4/lib" />
|
80
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/minitest-5.25.4/test" />
|
81
|
+
</CLASSES>
|
82
|
+
<JAVADOC />
|
83
|
+
<SOURCES>
|
84
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/minitest-5.25.4/lib" />
|
85
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/minitest-5.25.4/test" />
|
86
|
+
</SOURCES>
|
87
|
+
<excluded>
|
88
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/minitest-5.25.4/test" />
|
89
|
+
</excluded>
|
90
|
+
</library>
|
91
|
+
</orderEntry>
|
92
|
+
<orderEntry type="module-library">
|
93
|
+
<library name="rake (v13.2.1) [path][gem]" type="rubylib">
|
94
|
+
<properties>
|
95
|
+
<option name="additionalInfo">
|
96
|
+
<AdditionalInfo>
|
97
|
+
<option name="authors" value="該当なし" />
|
98
|
+
<option name="email" value="該当なし" />
|
99
|
+
<option name="homepage" value="該当なし" />
|
100
|
+
<option name="summary" value="該当なし" />
|
101
|
+
</AdditionalInfo>
|
102
|
+
</option>
|
103
|
+
<option name="fromPath" value="true" />
|
104
|
+
<option name="name" value="rake" />
|
105
|
+
<option name="requirePaths">
|
106
|
+
<list>
|
107
|
+
<option value="lib" />
|
108
|
+
</list>
|
109
|
+
</option>
|
110
|
+
<option name="url" value="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/rake-13.2.1" />
|
111
|
+
<option name="version" value="13.2.1" />
|
112
|
+
</properties>
|
113
|
+
<CLASSES>
|
114
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/rake-13.2.1/doc" />
|
115
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/rake-13.2.1/exe" />
|
116
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/rake-13.2.1/lib" />
|
117
|
+
</CLASSES>
|
118
|
+
<JAVADOC />
|
119
|
+
<SOURCES>
|
120
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/rake-13.2.1/doc" />
|
121
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/rake-13.2.1/exe" />
|
122
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/rake-13.2.1/lib" />
|
123
|
+
</SOURCES>
|
124
|
+
<excluded>
|
125
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/rake-13.2.1/doc" />
|
126
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/rake-13.2.1/exe" />
|
127
|
+
</excluded>
|
128
|
+
</library>
|
129
|
+
</orderEntry>
|
130
|
+
<orderEntry type="module-library">
|
131
|
+
<library name="sys-filesystem (v1.5.3) [path][gem]" type="rubylib">
|
132
|
+
<properties>
|
133
|
+
<option name="additionalInfo">
|
134
|
+
<AdditionalInfo>
|
135
|
+
<option name="authors" value="該当なし" />
|
136
|
+
<option name="email" value="該当なし" />
|
137
|
+
<option name="homepage" value="該当なし" />
|
138
|
+
<option name="summary" value="該当なし" />
|
139
|
+
</AdditionalInfo>
|
140
|
+
</option>
|
141
|
+
<option name="fromPath" value="true" />
|
142
|
+
<option name="name" value="sys-filesystem" />
|
143
|
+
<option name="requirePaths">
|
144
|
+
<list>
|
145
|
+
<option value="lib" />
|
146
|
+
</list>
|
147
|
+
</option>
|
148
|
+
<option name="url" value="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/sys-filesystem-1.5.3" />
|
149
|
+
<option name="version" value="1.5.3" />
|
150
|
+
</properties>
|
151
|
+
<CLASSES>
|
152
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/sys-filesystem-1.5.3/lib" />
|
153
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/sys-filesystem-1.5.3/spec" />
|
154
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/sys-filesystem-1.5.3/certs" />
|
155
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/sys-filesystem-1.5.3/examples" />
|
156
|
+
</CLASSES>
|
157
|
+
<JAVADOC />
|
158
|
+
<SOURCES>
|
159
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/sys-filesystem-1.5.3/lib" />
|
160
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/sys-filesystem-1.5.3/spec" />
|
161
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/sys-filesystem-1.5.3/certs" />
|
162
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/sys-filesystem-1.5.3/examples" />
|
163
|
+
</SOURCES>
|
164
|
+
<excluded>
|
165
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/sys-filesystem-1.5.3/spec" />
|
166
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/sys-filesystem-1.5.3/certs" />
|
167
|
+
<root url="file://$MODULE_DIR$/vendor/bundle/ruby/3.2.0/gems/sys-filesystem-1.5.3/examples" />
|
168
|
+
</excluded>
|
169
|
+
</library>
|
170
|
+
</orderEntry>
|
171
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.4.19, rbenv: 3.2.5) [gem]" level="application" />
|
172
|
+
</component>
|
173
|
+
</module>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<component name="InspectionProjectProfileManager">
|
2
|
+
<profile version="1.0">
|
3
|
+
<option name="myName" value="Project Default" />
|
4
|
+
<inspection_tool class="RbsMissingTypeSignature" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
5
|
+
<inspection_tool class="RubyCaseWithoutElseBlockInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
6
|
+
<inspection_tool class="RubyClassVariableUsageInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
7
|
+
<inspection_tool class="RubyMismatchedArgumentType" enabled="false" level="WARNING" enabled_by_default="false" />
|
8
|
+
<inspection_tool class="RubyTooManyInstanceVariablesInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
9
|
+
<inspection_tool class="RubyUnnecessaryReturnStatement" enabled="false" level="WARNING" enabled_by_default="false" />
|
10
|
+
<inspection_tool class="RubyUnusedLocalVariable" enabled="false" level="WARNING" enabled_by_default="false" />
|
11
|
+
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
|
12
|
+
<option name="processCode" value="true" />
|
13
|
+
<option name="processLiterals" value="true" />
|
14
|
+
<option name="processComments" value="true" />
|
15
|
+
</inspection_tool>
|
16
|
+
</profile>
|
17
|
+
</component>
|
data/.idea/misc.xml
CHANGED
@@ -1,6 +1,4 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
2
|
<project version="4">
|
3
|
-
<component name="ProjectRootManager" version="2" project-jdk-name="rbenv: 3.
|
4
|
-
<output url="file://$PROJECT_DIR$/out" />
|
5
|
-
</component>
|
3
|
+
<component name="ProjectRootManager" version="2" project-jdk-name="rbenv: 3.2.5" project-jdk-type="RUBY_SDK" />
|
6
4
|
</project>
|
data/.idea/modules.xml
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ProjectModuleManager">
|
4
|
+
<modules>
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/diskcatalog.iml" filepath="$PROJECT_DIR$/.idea/diskcatalog.iml" />
|
6
|
+
</modules>
|
7
|
+
</component>
|
8
|
+
</project>
|
data/Gemfile.lock
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
diskcatalog (1.1
|
4
|
+
diskcatalog (1.2.1)
|
5
5
|
sys-filesystem
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
ffi (1.
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
sys-filesystem (1.4.3)
|
10
|
+
ffi (1.17.1)
|
11
|
+
minitest (5.25.4)
|
12
|
+
rake (13.2.1)
|
13
|
+
sys-filesystem (1.5.3)
|
15
14
|
ffi (~> 1.1)
|
16
15
|
|
17
16
|
PLATFORMS
|
18
17
|
arm64-darwin-22
|
19
18
|
x64-mingw32
|
20
19
|
x86_64-darwin-22
|
20
|
+
x86_64-darwin-24
|
21
21
|
|
22
22
|
DEPENDENCIES
|
23
23
|
diskcatalog!
|
@@ -25,4 +25,4 @@ DEPENDENCIES
|
|
25
25
|
rake (~> 13.0)
|
26
26
|
|
27
27
|
BUNDLED WITH
|
28
|
-
2.4.
|
28
|
+
2.4.19
|
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/my_find.rb
CHANGED
@@ -1,61 +1,61 @@
|
|
1
1
|
module MyFind
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
3
|
+
#
|
4
|
+
# Calls the associated block with the name of every file and directory listed
|
5
|
+
# as arguments, then recursively on their subdirectories, and so on.
|
6
|
+
#
|
7
|
+
# Returns an enumerator if no block is given.
|
8
|
+
#
|
9
|
+
# See the +Find+ module documentation for an example.
|
10
|
+
#
|
11
|
+
def find(*paths, ignore_error: true) # :yield: path
|
12
|
+
block_given? or return enum_for(__method__, *paths, ignore_error: ignore_error)
|
13
|
+
|
14
|
+
fs_encoding = Encoding.find("filesystem")
|
15
|
+
|
16
|
+
paths.collect!{|d| raise Errno::ENOENT, d unless File.exist?(d); d.dup}.each do |path|
|
17
|
+
path = path.to_path if path.respond_to? :to_path
|
18
|
+
enc = path.encoding == Encoding::US_ASCII ? fs_encoding : path.encoding
|
19
|
+
ps = [path]
|
20
|
+
while file = ps.shift
|
21
|
+
catch(:prune) do
|
22
|
+
yield file.dup
|
23
|
+
begin
|
24
|
+
s = File.lstat(file)
|
25
|
+
rescue Errno::ENOENT, Errno::EACCES, Errno::ENOTDIR, Errno::ELOOP, Errno::ENAMETOOLONG, Errno::EPERM
|
26
|
+
raise unless ignore_error
|
27
|
+
next
|
28
|
+
end
|
29
|
+
if s.directory? then
|
23
30
|
begin
|
24
|
-
|
31
|
+
fs = Dir.children(file, encoding: enc)
|
25
32
|
rescue Errno::ENOENT, Errno::EACCES, Errno::ENOTDIR, Errno::ELOOP, Errno::ENAMETOOLONG, Errno::EPERM
|
26
33
|
raise unless ignore_error
|
27
34
|
next
|
28
35
|
end
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
next
|
35
|
-
end
|
36
|
-
fs.sort!
|
37
|
-
fs.reverse_each {|f|
|
38
|
-
f = File.join(file, f)
|
39
|
-
ps.unshift f
|
40
|
-
}
|
41
|
-
end
|
36
|
+
fs.sort!
|
37
|
+
fs.reverse_each {|f|
|
38
|
+
f = File.join(file, f)
|
39
|
+
ps.unshift f
|
40
|
+
}
|
42
41
|
end
|
43
42
|
end
|
44
43
|
end
|
45
|
-
nil
|
46
44
|
end
|
45
|
+
nil
|
46
|
+
end
|
47
47
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
48
|
+
#
|
49
|
+
# Skips the current file or directory, restarting the loop with the next
|
50
|
+
# entry. If the current file is a directory, that directory will not be
|
51
|
+
# recursively entered. Meaningful only within the block associated with
|
52
|
+
# Find::find.
|
53
|
+
#
|
54
|
+
# See the +Find+ module documentation for an example.
|
55
|
+
#
|
56
|
+
def prune
|
57
|
+
throw :prune
|
58
|
+
end
|
59
59
|
|
60
|
-
|
61
|
-
|
60
|
+
module_function :find, :prune
|
61
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Diskcatalog
|
2
|
+
class Utils
|
3
|
+
def self.number_to_human_size(size)
|
4
|
+
kb = 1024
|
5
|
+
mb = 1024**2
|
6
|
+
gb = 1024**3
|
7
|
+
tb = 1024**4
|
8
|
+
case
|
9
|
+
when size < 1024
|
10
|
+
'%d Bytes' % size
|
11
|
+
when size < kb
|
12
|
+
'%.1f KB' % (size / kb)
|
13
|
+
when size < mb
|
14
|
+
'%.1f MB' % (size / mb)
|
15
|
+
when size < 1024**4
|
16
|
+
'%.1f GB' % (size / gb)
|
17
|
+
else
|
18
|
+
'%.1f TB' % (size / tb)
|
19
|
+
end.sub('.0', '')
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
data/lib/diskcatalog/version.rb
CHANGED
data/lib/diskcatalog.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
require "diskcatalog/version"
|
4
|
+
require "diskcatalog/my_find"
|
5
|
+
require "diskcatalog/utils"
|
6
|
+
|
5
7
|
|
6
8
|
require 'optparse'
|
7
9
|
require 'fileutils'
|
@@ -108,8 +110,8 @@ module Diskcatalog
|
|
108
110
|
end
|
109
111
|
|
110
112
|
def list
|
111
|
-
puts "List catalog in #{@
|
112
|
-
Dir.glob(File.join(@
|
113
|
+
puts "List catalog in #{@option.catalogdir}"
|
114
|
+
Dir.glob(File.join(@option.catalogdir, "*.info")).each do |path|
|
113
115
|
puts File.basename(path)
|
114
116
|
end
|
115
117
|
end
|
@@ -151,14 +153,14 @@ module Diskcatalog
|
|
151
153
|
end
|
152
154
|
|
153
155
|
def initialize(option)
|
154
|
-
@
|
156
|
+
@option = option
|
155
157
|
end
|
156
158
|
|
157
159
|
def run
|
158
|
-
if @
|
160
|
+
if @option.list
|
159
161
|
list
|
160
162
|
else
|
161
|
-
unless @
|
163
|
+
unless @option.dir
|
162
164
|
raise "directory is not specified"
|
163
165
|
end
|
164
166
|
make_files
|
@@ -168,13 +170,13 @@ module Diskcatalog
|
|
168
170
|
|
169
171
|
private
|
170
172
|
def make_files
|
171
|
-
puts "Create catalog file for #{@
|
172
|
-
unless FileTest.directory?(@
|
173
|
+
puts "Create catalog file for #{@option.dir}: #{@option.output_files}"
|
174
|
+
unless FileTest.directory?(@option.dir)
|
173
175
|
raise RuntimeError
|
174
176
|
end
|
175
|
-
out = File.open(@
|
177
|
+
out = File.open(@option.output_files, "w:utf-8")
|
176
178
|
begin
|
177
|
-
MyFind.find(@
|
179
|
+
MyFind.find(@option.dir, ignore_error: true) do |f|
|
178
180
|
if FileTest.file?(f)
|
179
181
|
size = File.size(f)
|
180
182
|
mtime = File.mtime(f).strftime("%Y-%m-%d")
|
@@ -194,44 +196,27 @@ module Diskcatalog
|
|
194
196
|
end
|
195
197
|
|
196
198
|
def make_info
|
197
|
-
puts "Create info for #{@
|
198
|
-
unless FileTest.directory?(@
|
199
|
+
puts "Create info for #{@option.dir}: #{@option.output_info}"
|
200
|
+
unless FileTest.directory?(@option.dir)
|
199
201
|
raise RuntimeError
|
200
202
|
end
|
201
203
|
|
202
|
-
stat = Sys::Filesystem.stat(@
|
203
|
-
free_bytes = number_to_human_size(stat.blocks_available * stat.block_size)
|
204
|
+
stat = Sys::Filesystem.stat(@option.dir)
|
205
|
+
free_bytes = Utils::number_to_human_size(stat.blocks_available * stat.block_size)
|
204
206
|
# puts number_to_human_size(free_bytes)
|
205
|
-
|
207
|
+
puts "total=#{stat.blocks * stat.block_size}"
|
208
|
+
total_bytes = Utils::number_to_human_size(stat.blocks * stat.block_size)
|
209
|
+
puts "total_bytes=#{total_bytes}"
|
206
210
|
#puts number_to_human_size(total_bytes)
|
207
211
|
|
208
|
-
out = File.open(@
|
212
|
+
out = File.open(@option.output_info, "w:utf-8")
|
209
213
|
created = Time.now.strftime("%Y-%m-%dT%H:%M:%S")
|
210
214
|
out.puts "Created: #{created}"
|
211
|
-
out.puts "Volume: #{@
|
215
|
+
out.puts "Volume: #{@option.dir}"
|
212
216
|
out.puts "Total: #{total_bytes}"
|
213
217
|
out.puts "Free: #{free_bytes}"
|
214
218
|
out.close if out
|
215
219
|
end
|
216
|
-
|
217
|
-
def number_to_human_size(size)
|
218
|
-
kb = 1024
|
219
|
-
mb = 1024**2
|
220
|
-
gb = 1024**3
|
221
|
-
tb = 1024**4
|
222
|
-
case
|
223
|
-
when size < 1024
|
224
|
-
'%d Bytes' % size
|
225
|
-
when size < kb
|
226
|
-
'%.1f KB' % (size / kb)
|
227
|
-
when size < mb
|
228
|
-
'%.1f MB' % (size / mb)
|
229
|
-
when size < 1024**4
|
230
|
-
'%.1f GB' % (size / gb)
|
231
|
-
else
|
232
|
-
'%.1f TB' % (size / tb)
|
233
|
-
end.sub('.0', '')
|
234
|
-
end
|
235
220
|
end
|
236
221
|
|
237
222
|
class SearchCommand < Command
|
@@ -264,11 +249,11 @@ module Diskcatalog
|
|
264
249
|
end
|
265
250
|
|
266
251
|
def initialize(option)
|
267
|
-
@
|
252
|
+
@option = option
|
268
253
|
end
|
269
254
|
|
270
255
|
def run
|
271
|
-
if @
|
256
|
+
if @option.list
|
272
257
|
list
|
273
258
|
else
|
274
259
|
search
|
@@ -276,7 +261,9 @@ module Diskcatalog
|
|
276
261
|
end
|
277
262
|
|
278
263
|
def search
|
279
|
-
|
264
|
+
cmd = "#{SEARCH_CMD} #{@option.search} #{@option.catalogdir}"
|
265
|
+
puts cmd if @option.debug
|
266
|
+
system(cmd)
|
280
267
|
end
|
281
268
|
end
|
282
269
|
end
|
data/tag
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
def find_version
|
4
|
+
file = File.expand_path(File.dirname(__FILE__) + '/lib/diskcatalog/version.rb')
|
5
|
+
File.readlines(file).each do |line|
|
6
|
+
# puts line
|
7
|
+
if line =~ /VERSION\s*=\s*['"]([^'"]+)['"]/
|
8
|
+
return $1
|
9
|
+
end
|
10
|
+
end
|
11
|
+
return nil
|
12
|
+
end
|
13
|
+
|
14
|
+
def run_cmd(cmd)
|
15
|
+
puts cmd
|
16
|
+
system(cmd)
|
17
|
+
end
|
18
|
+
|
19
|
+
version = find_version
|
20
|
+
if version.nil?
|
21
|
+
puts "Version not found"
|
22
|
+
exit(1)
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
tagname = "v#{version}"
|
27
|
+
cmd = "git tag #{tagname}"
|
28
|
+
run_cmd(cmd)
|
29
|
+
cmd = "git push origin #{tagname}"
|
30
|
+
run_cmd(cmd)
|
31
|
+
|
32
|
+
#
|
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.1
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- src
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sys-filesystem
|
@@ -35,7 +35,10 @@ extensions: []
|
|
35
35
|
extra_rdoc_files: []
|
36
36
|
files:
|
37
37
|
- ".idea/.gitignore"
|
38
|
+
- ".idea/diskcatalog.iml"
|
39
|
+
- ".idea/inspectionProfiles/Project_Default.xml"
|
38
40
|
- ".idea/misc.xml"
|
41
|
+
- ".idea/modules.xml"
|
39
42
|
- ".idea/vcs.xml"
|
40
43
|
- CODE_OF_CONDUCT.md
|
41
44
|
- Gemfile
|
@@ -55,6 +58,7 @@ files:
|
|
55
58
|
- exe/dcats
|
56
59
|
- lib/diskcatalog.rb
|
57
60
|
- lib/diskcatalog/my_find.rb
|
61
|
+
- lib/diskcatalog/utils.rb
|
58
62
|
- lib/diskcatalog/version.rb
|
59
63
|
- pkg/diskcatalog-0.1.0.gem
|
60
64
|
- pkg/diskcatalog-0.2.0.gem
|
@@ -64,6 +68,7 @@ files:
|
|
64
68
|
- run_dcats.cmd
|
65
69
|
- run_dcats.sh
|
66
70
|
- sig/diskcatalog.rbs
|
71
|
+
- tag
|
67
72
|
- test_diskcatalog.cmd
|
68
73
|
homepage: https://github.com/src256
|
69
74
|
licenses:
|
@@ -87,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
92
|
- !ruby/object:Gem::Version
|
88
93
|
version: '0'
|
89
94
|
requirements: []
|
90
|
-
rubygems_version: 3.
|
95
|
+
rubygems_version: 3.4.19
|
91
96
|
signing_key:
|
92
97
|
specification_version: 4
|
93
98
|
summary: Create disk catalog.
|