diskcatalog 0.9.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5598122f882a50aa00d77dd73ee3a1501e609778d85ee5b5bb7d149dbd226ed9
4
- data.tar.gz: 372b530e449db5d333067e3ca82949dfef4b3297ea7dd76cac495ab39d98bf7f
3
+ metadata.gz: 414e1fe751ff983423e939d71fb2bddd859525037bef14e26e7af88260237648
4
+ data.tar.gz: 74661cd8cb23f3c2632bea94433d517e930b802a294e651e731f37c7e4b8ae1b
5
5
  SHA512:
6
- metadata.gz: f739b3fbafff3bc58adbe9dfd274b14860c105267d007551cf290c7a0edd659e825f3e16b621b93ad0d58e21ed2aa1fc75c8a17fa0c8e498a769bbcc30318571
7
- data.tar.gz: 9705f8b4e95317eab5a4693922dfb7a00d30642105d6036f4cbccba3bb6655df6839df745c0592c85af5354d54f65e2bce34d3babfb981f7080ddb28fce166e2
6
+ metadata.gz: 1cd1dab0bc31a9ed6d949a3c60d41f5ac4f2a5409b9d06cd1648a68ec4a9162f8c2eae471fef7c40b8b3acdf913283fba49a480139a04376b312bb4d2f958423
7
+ data.tar.gz: 36f7f924b4c63bfb4b99f476ce2170c28990627e492484b111b13daa23779952fef43dd2e8313ca8445a070ab3a1e9b085de7a67ffacaa6901f3da34c18ac09b
data/Gemfile.lock CHANGED
@@ -1,13 +1,18 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- diskcatalog (0.9.0)
4
+ diskcatalog (1.1.0)
5
+ sys-filesystem
5
6
 
6
7
  GEM
7
8
  remote: https://rubygems.org/
8
9
  specs:
10
+ ffi (1.15.5)
11
+ ffi (1.15.5-x64-mingw32)
9
12
  minitest (5.19.0)
10
13
  rake (13.0.6)
14
+ sys-filesystem (1.4.3)
15
+ ffi (~> 1.1)
11
16
 
12
17
  PLATFORMS
13
18
  arm64-darwin-22
data/diskcatalog.gemspec CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.bindir = "exe"
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
33
  # Uncomment to register a new dependency of your gem
34
34
  # spec.add_dependency "example-gem", "~> 1.0"
35
35
 
data/diskcatalog.iml CHANGED
@@ -5,80 +5,11 @@
5
5
  <content url="file://$MODULE_DIR$" />
6
6
  <orderEntry type="inheritedJdk" />
7
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" />
8
+ <orderEntry type="library" scope="PROVIDED" name="rake (v13.0.6, rbenv: 3.1.4) [gem]" level="application" />
50
9
  </component>
51
10
  <component name="RakeTasksCache">
52
11
  <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>
12
+ <RakeTaskImpl id="rake" />
82
13
  </option>
83
14
  </component>
84
15
  </module>
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Diskcatalog
4
- VERSION = "0.9.0"
4
+ VERSION = "1.1.0"
5
5
  end
data/lib/diskcatalog.rb CHANGED
@@ -6,8 +6,7 @@ require_relative "diskcatalog/version"
6
6
  require 'optparse'
7
7
  require 'fileutils'
8
8
  require 'yaml'
9
-
10
-
9
+ require 'sys/filesystem'
11
10
 
12
11
  module Diskcatalog
13
12
  DEF_CONFIG = File.expand_path("~/.catalogrc")
@@ -169,7 +168,7 @@ module Diskcatalog
169
168
 
170
169
  private
171
170
  def make_files
172
- puts "Create catalog for #{@opt.dir}"
171
+ puts "Create catalog file for #{@opt.dir}: #{@opt.output_files}"
173
172
  unless FileTest.directory?(@opt.dir)
174
173
  raise RuntimeError
175
174
  end
@@ -195,11 +194,44 @@ module Diskcatalog
195
194
  end
196
195
 
197
196
  def make_info
197
+ puts "Create info for #{@opt.dir}: #{@opt.output_info}"
198
+ unless FileTest.directory?(@opt.dir)
199
+ raise RuntimeError
200
+ end
201
+
202
+ stat = Sys::Filesystem.stat(@opt.dir)
203
+ free_bytes = number_to_human_size(stat.blocks_available * stat.block_size)
204
+ # puts number_to_human_size(free_bytes)
205
+ total_bytes = number_to_human_size(stat.blocks * stat.block_size)
206
+ #puts number_to_human_size(total_bytes)
207
+
198
208
  out = File.open(@opt.output_info, "w:utf-8")
199
209
  created = Time.now.strftime("%Y-%m-%dT%H:%M:%S")
200
210
  out.puts "Created: #{created}"
211
+ out.puts "Volume: #{@opt.dir}"
212
+ out.puts "Total: #{total_bytes}"
213
+ out.puts "Free: #{free_bytes}"
201
214
  out.close if out
202
215
  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
203
235
  end
204
236
 
205
237
  class SearchCommand < Command
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diskcatalog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 1.1.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-22 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2023-08-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sys-filesystem
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  description: Create disk catalog.
14
28
  email:
15
29
  - src@srcw.net