storazzo 0.5.1 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +7 -5
  3. data/LICENSE +20 -1
  4. data/Makefile +9 -5
  5. data/Rakefile +22 -9
  6. data/VERSION +1 -1
  7. data/bin/hello-storazzo +1 -0
  8. data/bin/ricdisk-magic +33 -30
  9. data/bin/stats-with-md5 +146 -176
  10. data/bin/storazzo +158 -0
  11. data/bin/storazzo-symlink.rb +1 -0
  12. data/bin/storazzo-util +1 -0
  13. data/lib/storazzo/colors.rb +77 -36
  14. data/lib/storazzo/common.rb +72 -65
  15. data/lib/storazzo/debug.rb +2 -0
  16. data/lib/storazzo/hashify.rb +7 -5
  17. data/lib/storazzo/main.rb +59 -49
  18. data/lib/storazzo/media/abstract_ric_disk.rb +190 -161
  19. data/lib/storazzo/media/gcs_bucket.rb +78 -47
  20. data/lib/storazzo/media/local_folder.rb +56 -42
  21. data/lib/storazzo/media/mount_point.rb +22 -6
  22. data/lib/storazzo/ric_disk.rb +386 -383
  23. data/lib/storazzo/ric_disk_config.rb +229 -197
  24. data/lib/storazzo/ric_disk_sample_config.rb +26 -24
  25. data/lib/storazzo/ric_disk_statsfile.rb +19 -17
  26. data/lib/storazzo/ric_disk_ugly.rb +1 -0
  27. data/lib/storazzo/version.rb +3 -3
  28. data/lib/storazzo.rb +6 -7
  29. data/storazzo.gemspec +31 -19
  30. data/test/benchmark/for_future_use.rb +15 -0
  31. data/test/benchmark/test_hashing_functions-speed.rb +17 -0
  32. data/test/bin/new-idea.rb +17 -0
  33. data/test/bin/storazzo.rb +25 -0
  34. data/test/media/test_abstract_ric_disk.rb +6 -4
  35. data/test/media/test_gcs_bucket.rb +55 -21
  36. data/test/media/test_local_folder.rb +28 -29
  37. data/test/media/test_mount_point.rb +7 -5
  38. data/test/test_ric_disk.rb +8 -6
  39. data/test/test_ric_disk_config.rb +13 -12
  40. data/test/test_ric_disk_stats_file.rb +5 -3
  41. data/test/test_storazzo.rb +6 -4
  42. data/var/test/disks/disk02-full/Rakefile +7 -5
  43. data/var/test/disks/ricdisk_stats_v11.rds +11 -22
  44. metadata +22 -22
data/storazzo.gemspec CHANGED
@@ -1,23 +1,35 @@
1
+ # frozen_string_literal: true
2
+ # coding: utf-8
3
+
4
+
5
+ #gem.required_ruby_version = '2.7.5'
6
+
1
7
  Gem::Specification.new do |s|
2
- s.name = "storazzo"
3
- # TOSDO: copy approach from here to dry version calculating: https://github.com/rails/strong_parameters/blob/master/strong_parameters.gemspec#L15
4
- s.version = File.read("VERSION").chomp # TODO cat version File.read(@,.VERSION).chomp
5
- s.summary = "storazzo is an amazing gem. Code is in https://github.com/palladius/storazzo"
6
- s.description = "A simple gem to manage your external hard drives and extract MD5 and common stuff from them."
7
- s.authors = ["Riccardo Carlesso"]
8
- s.email = "name dot surname at popular Google-owned Mail"
8
+ s.required_ruby_version = '>= 2.7.5'
9
+ s.name = 'storazzo'
10
+ # TODO: copy approach from here to dry version calculating: https://github.com/rails/strong_parameters/blob/master/strong_parameters.gemspec#L15
11
+ s.version = File.read('VERSION').chomp # TODO: cat version File.read(@,.VERSION).chomp
12
+ s.summary = 'storazzo is an amazing gem. Code is in https://github.com/palladius/storazzo'
13
+ s.description = 'A simple gem to manage your external hard drives and extract MD5 and common stuff from them.'
14
+ s.authors = ['Riccardo Carlesso']
15
+ s.email = 'name dot surname at popular Google-owned Mail'
9
16
  # Autoglob as per https://stackoverflow.com/questions/11873294/determining-the-gems-list-of-files-for-the-specification
10
- s.files = %w(Gemfile LICENSE README.md Makefile Rakefile storazzo.gemspec
11
- VERSION) + Dir["{bin,lib,test,var}/**/*"]
12
- s.test_files = Dir["test/**/*"] + Dir["var/test/**/*"]
13
- s.executables = [
14
- # todo: everything in bin/
15
- "ricdisk-magic",
16
- "stats-with-md5",
17
- "hello-storazzo",
18
- ]
19
- s.homepage = "https://rubygems.org/gems/storazzo" # maybe https://github.com/palladius/storazzo
20
- s.license = "MIT"
17
+ s.files = %w[Gemfile LICENSE README.md Makefile Rakefile storazzo.gemspec
18
+ VERSION] + Dir['{bin,lib,test,var}/**/*']
19
+ s.test_files = Dir['test/**/*'] + Dir['var/test/**/*']
20
+ s.executables = Dir['bin/*'].map do |full_path| # bin/blah-blah
21
+ full_path.gsub('bin/', '')
22
+ end
23
+ # [
24
+ # # todo: everything in bin/
25
+ # "ricdisk-magic",
26
+ # "stats-with-md5",
27
+ # "storazzo",
28
+ # "hello-storazzo",
29
+ # ]
30
+ s.homepage = 'https://rubygems.org/gems/storazzo' # maybe https://github.com/palladius/storazzo
31
+ s.license = 'MIT'
32
+
21
33
  # s.add_dependency "activesupport", "~> 3.0"
22
- s.add_dependency "pry" # , "~> 3.0"
34
+ #s.add_dependency 'pry' # , "~> 3.0"
23
35
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ # copied from https://github.com/minitest/minitest
4
+
5
+ # optionally run benchmarks, good for CI-only work!
6
+ require 'minitest/benchmark' if ENV['BENCHMARK']
7
+
8
+ class TestMeme < Minitest::Benchmark
9
+ # Override self.bench_range or default range is [1, 10, 100, 1_000, 10_000]
10
+ def bench_my_algorithm
11
+ assert_performance_linear 0.9999 do |n| # n is a range value
12
+ @obj.my_algorithm(n)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # thanks https://gist.github.com/morimori/1330095 !!
4
+
5
+ require 'digest/sha1'
6
+ require 'digest/sha2'
7
+ require 'benchmark'
8
+
9
+ SRC = File.read '/dev/urandom', 1024 * 1024
10
+
11
+ puts "SRC size: #{SRC.size}B"
12
+ Benchmark.bmbm do |bm|
13
+ bm.report('MD5') { 100_000.times { Digest::MD5.hexdigest SRC } }
14
+ bm.report('SHA1') { 100_000.times { Digest::SHA1.hexdigest SRC } }
15
+ bm.report('SHA2') { 100_000.times { Digest::SHA2.hexdigest SRC } }
16
+ # bm.report('SHA256') { 100000.times{ Digest::SHA256.hexdigest SRC } }
17
+ end
@@ -0,0 +1,17 @@
1
+ # # include the binary in ruby
2
+ # # like
3
+ # require_relative '../../lib/storazzo'
4
+ # # require 'storazzo-local'
5
+ # puts :should_include_loads_of_includez
6
+
7
+ require 'minitest/autorun'
8
+ # require_relative '../../bin/storazzo-symlink'
9
+
10
+ class BinStorazzoNewIdeaTest < Minitest::Test
11
+ # # and then call main or something?
12
+ # require_relative '../../bin/storazzo-symlink'
13
+
14
+ # # and then invoke this test via rake ?
15
+ end
16
+
17
+ puts 'Doesnt work dammit.'
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'English'
4
+ require 'minitest/autorun'
5
+ require 'storazzo'
6
+
7
+ class BinaryStorazzoTest < Minitest::Test
8
+ def test_binary_returns_error_with_random_argv
9
+ ret = `bin/storazzo aaa`
10
+ # puts ret
11
+ # puts "return code is '#{$?.exitstatus}'"
12
+ should_match_string = 'Unknown action1: aaa. Available actions:' # 'ERROR: Unknown action1: aaa. Available actions: ["auto", "help", "show"]'
13
+ assert_equal(
14
+ $CHILD_STATUS.exitstatus,
15
+ 13,
16
+ 'Wrong argument should return 13'
17
+ )
18
+ matches_expected_error = ret.match(should_match_string)
19
+ # puts "matches_expected_error: ''#{matches_expected_error}''"
20
+ assert(
21
+ !matches_expected_error.nil?,
22
+ "Binary should return a string which should contain this string: '#{should_match_string}'"
23
+ )
24
+ end
25
+ end
@@ -1,19 +1,21 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # TODO
2
- require "minitest/autorun"
3
- require "storazzo"
4
+ require 'minitest/autorun'
5
+ require 'storazzo'
4
6
 
5
7
  # require 'pry' # must install the gem... but you ALWAYS want pry installed anyways
6
8
 
7
9
  class AbstractRicDiskTest < Minitest::Test
8
10
  include Storazzo::Common
9
11
 
10
- def TODO_test_super_duper_list_all_with_type_returns_something
12
+ def test_super_duper_list_all_with_type_returns_something
11
13
  deb "This would be already... something :) it means they're all implemented"
12
14
  ret = Storazzo::Media::AbstractRicDisk.super_duper_list_all_with_type
13
15
  assert(
14
16
  ret.class,
15
17
  Array,
16
- "test_super_duper_list_all_with_type_returns_something should return an array.."
18
+ 'test_super_duper_list_all_with_type_returns_something should return an array..'
17
19
  )
18
20
  end
19
21
  end
@@ -1,34 +1,40 @@
1
- require "minitest/autorun"
2
- require "storazzo"
3
- require "storazzo/ric_disk"
4
- require "storazzo/ric_disk_config"
1
+ # frozen_string_literal: true
2
+
3
+ require 'minitest/autorun'
4
+ require 'storazzo'
5
+ require 'storazzo/ric_disk'
6
+ require 'storazzo/ric_disk_config'
5
7
  require 'storazzo/colors'
6
- require "storazzo/media/local_folder"
8
+ # require "storazzo/media/local_folder"
9
+ require 'storazzo/media/gcs_bucket'
7
10
 
8
11
  require 'pry' # must install the gem... but you ALWAYS want pry installed anyways
9
12
 
13
+ # TEST: watch rake test TEST="test/media/test_gcs_bucket.rb"
14
+
10
15
  class GcsBucketTest < Minitest::Test
11
16
  include Storazzo::Common
12
17
 
13
- def setup # tear_up
14
- deb "[GcsBucketTest] TEAR_UP with sample Config"
18
+ # tear_up
19
+ def setup
20
+ deb '[GcsBucketTest] TEAR_UP with sample Config'
15
21
  # removeme = Storazzo::RicDiskConfig.instance()
16
- $sample_config_obj = Storazzo::RicDiskSampleConfig.instance()
17
- $sample_config_hash = $sample_config_obj.load()
18
- deb "[GcsBucketTest] TEAR_UP config_obj: '''#{$sample_config_obj}'''"
22
+ @sample_config_obj = Storazzo::RicDiskSampleConfig.instance
23
+ @sample_config_hash = @sample_config_obj.load
24
+ deb "[GcsBucketTest] TEAR_UP config_obj: '''#{@sample_config_obj}'''"
19
25
  end
20
26
 
21
- def test_buckets_are_the_two_i_know
27
+ def test_that_test_buckets_are_the_two_I_know
22
28
  # copied from etc/sample.yaml :)
23
- expected_list = %w{
29
+ expected_test_buckets_list = %w[
24
30
  gs://my-local-backup/storazzo/backups/
25
31
  gs://my-other-bucket/
26
- }
27
- actual_list = Storazzo::RicDisk::GcsBucket.list_all($sample_config_obj)
32
+ ]
33
+ actual_list = Storazzo::Media::GcsBucket.list_all(@sample_config_obj)
28
34
  assert_equal(
29
- expected_list.sort,
35
+ expected_test_buckets_list.sort,
30
36
  actual_list.sort,
31
- "These are the two lists from Sample Storazzo Config"
37
+ 'These are the two lists from Sample Storazzo Config'
32
38
  )
33
39
  end
34
40
 
@@ -41,18 +47,46 @@ class GcsBucketTest < Minitest::Test
41
47
  # puts Storazzo::RicDiskSampleConfig
42
48
  # config_obj = Storazzo::RicDiskSampleConfig.instance()
43
49
  if_deb? do
44
- Pry::ColorPrinter.pp($sample_config_obj.to_verbose_s())
50
+ Pry::ColorPrinter.pp(@sample_config_obj.to_verbose_s)
45
51
  end
46
52
  # pp green(config_obj.to_verbose_s())
47
53
 
48
- l = $sample_config_obj.load
54
+ l = @sample_config_obj.load
49
55
  Pry::ColorPrinter.pp(l) if $DEBUG
50
56
 
51
- puts "$sample_config_obj: #{$sample_config_obj}"
57
+ puts "@sample_config_obj: #{@sample_config_obj}"
52
58
  # config_obj.load # _sample_version
53
59
  end
54
60
 
55
- # def teardown
56
- # puts :TEAR_DOWN_TODO
61
+ def test_super_duper_list_works
62
+ # we had a problem on GCS side
63
+ # Storazzo::Media::AbstractRicDisk.super_duper_list_all_with_type
64
+ expected_ret = [
65
+ [:config_gcs_bucket, 'gs://my-local-backup/storazzo/backups/'],
66
+ [:config_gcs_bucket, 'gs://my-other-bucket/']
67
+ ]
68
+ ret = Storazzo::Media::GcsBucket.list_all_with_type
69
+ Pry::ColorPrinter.pp(ret)
70
+ assert_equal(
71
+ ret.class,
72
+ Array,
73
+ 'test_super_duper_list_all_with_type_returns_something should return an array..'
74
+ )
75
+ assert_equal(ret, expected_ret, 'These are the two buckets I expect from test..')
76
+ end
77
+
78
+ def test_gsutil_returns_something
79
+ ret = Storazzo::Media::GcsBucket.list_available_buckets
80
+ Pry::ColorPrinter.pp(ret)
81
+ end
82
+
83
+ # def test_super_duper_list_all_with_type_returns_something
84
+ # deb "This would be already... something :) it means they're all implemented"
85
+ # ret = Storazzo::Media::AbstractRicDisk.super_duper_list_all_with_type
86
+ # assert(
87
+ # ret.class,
88
+ # Array,
89
+ # "test_super_duper_list_all_with_type_returns_something should return an array.."
90
+ # )
57
91
  # end
58
92
  end
@@ -1,10 +1,12 @@
1
- require "minitest/autorun"
2
- require "storazzo"
1
+ # frozen_string_literal: true
2
+
3
+ require 'minitest/autorun'
4
+ require 'storazzo'
3
5
  require 'storazzo/common'
4
- require "storazzo/ric_disk"
5
- require "storazzo/ric_disk_config"
6
+ require 'storazzo/ric_disk'
7
+ require 'storazzo/ric_disk_config'
6
8
  require 'storazzo/colors'
7
- require "storazzo/media/local_folder"
9
+ require 'storazzo/media/local_folder'
8
10
 
9
11
  class LocalFolderTest < Minitest::Test
10
12
  # include Storazzo::Colors
@@ -16,43 +18,40 @@ class LocalFolderTest < Minitest::Test
16
18
  # #"Hello from Storazzo", Storazzo::Main.hi("ruby this should fail")
17
19
  # #assert_match "ruby this should fail", Storazzo::Main.hi("ruby this should fail")
18
20
  # end
19
- def tear_up
21
+ # def tear_up
22
+ def setup
20
23
  include Storazzo::Colors
21
- puts yellow("LocalFolderTest: tear up")
22
- # $config_useless = Storazzo::RicDiskConfig.instance()
23
- $config = Storazzo::RicDiskSampleConfig.safe_instance()
24
- $config_load = $config.load()
25
- puts $config.to_verbose_s
26
-
24
+ puts yellow('LocalFolderTest: tear up')
25
+ # @config_useless = Storazzo::RicDiskConfig.instance()
26
+ @config = Storazzo::RicDiskSampleConfig.safe_instance
27
+ @config_load = @config.load
28
+ puts @config.to_verbose_s
27
29
  # my_class = Storazzo::RicDisk::LocalFolder
28
30
  # my_obj = Storazzo::RicDisk::LocalFolder
29
31
  end
30
32
 
31
33
  def test_show_all_shouldnt_fail_and_should_return_a_non_empty_array
32
34
  assert_equal(Array, Storazzo::Media::LocalFolder.list_all.class,
33
- "Storazzo::RicDisk::LocalFolder.list_all should return an Array")
34
- assert(Storazzo::Media::LocalFolder.list_all.size > 0, "Array size should be >0")
35
+ 'Storazzo::RicDisk::LocalFolder.list_all should return an Array')
36
+ assert(Storazzo::Media::LocalFolder.list_all.size.positive?, 'Array size should be >0')
35
37
  # puts Storazzo::Media::LocalFolder.list_all
36
38
  end
37
39
 
38
40
  def test_list_all_returns_an_array_of_real_directories
39
41
  dirs = Storazzo::Media::LocalFolder.list_all
40
42
  dirs.each do |mydir|
41
- assert_equal(String, mydir.class, "Dir should be a String representing an existing directory")
43
+ assert_equal(String, mydir.class, 'Dir should be a String representing an existing directory')
42
44
  assert(File.directory?(mydir), "Dir should be a file of type 'directory'")
43
45
  end
44
46
  end
45
47
 
46
48
  # To only test this:
47
49
  # $ ruby -I test test/test_local_folder.rb -n test_first_directory_parsing_actually_works
48
- def test_1_first_directory_parsing_actually_works()
49
- # include module
50
-
51
- # p $vediamo_se_funge
50
+ def test_1_first_directory_parsing_actually_works
52
51
  puts("(#{__FILE__}) WEIRD THING: This test is flaky. SKipping for now until I complete the LocalFolder.parse() code")
53
52
  folders = Storazzo::Media::LocalFolder.list_all
54
53
  puts "Folders: #{folders}"
55
- config = Storazzo::RicDiskSampleConfig.safe_instance()
54
+ config = Storazzo::RicDiskSampleConfig.safe_instance
56
55
  puts "config1: #{config}"
57
56
  puts "config2: #{config.load}"
58
57
  test_dir = folders.first
@@ -62,7 +61,7 @@ class LocalFolderTest < Minitest::Test
62
61
  disk = Storazzo::Media::LocalFolder.new(test_dir)
63
62
  stats_file = disk.stats_filename_default_fullpath
64
63
  puts "stats_file: #{stats_file}"
65
- disk.parse()
64
+ disk.parse
66
65
  deb "config: ''#{config}''"
67
66
  # config.iterate_through_file_list_for_disks([test_dir])
68
67
  # assert(
@@ -72,15 +71,15 @@ class LocalFolderTest < Minitest::Test
72
71
  end
73
72
 
74
73
  def test_vars_transporeted_across_teraup_and_tests
75
- puts $config_load
76
- puts $config
74
+ puts @config_load
75
+ puts @config
77
76
  end
78
77
 
79
78
  def test_2_iterate_through_file_list_for_disks
80
79
  # puts("(#{__FILE__}) WEIRD THING: This test is flaky. SKipping for now until I complete the LocalFolder.parse() code")
81
80
  folders = Storazzo::Media::LocalFolder.list_all
82
81
  puts "Folders: #{folders}"
83
- config = Storazzo::RicDiskSampleConfig.safe_instance()
82
+ config = Storazzo::RicDiskSampleConfig.safe_instance
84
83
  config.load
85
84
  puts "config1: #{config}"
86
85
  puts "config2: #{config.load}"
@@ -97,27 +96,27 @@ class LocalFolderTest < Minitest::Test
97
96
  # TEST2: config + iterate
98
97
  config.iterate_through_file_list_for_disks([test_dir])
99
98
  assert(
100
- File.exists?(stats_file),
99
+ File.exist?(stats_file),
101
100
  "parse on LocalFolder should create file '#{stats_file}'"
102
101
  )
103
102
  end
104
103
 
105
104
  def test_readonly_directory_creates_configfile_outside_of_dir
106
- test_dir = "/etc/ssh/"
105
+ test_dir = '/etc/ssh/'
107
106
  disk = Storazzo::Media::LocalFolder.new(test_dir)
108
107
  stats_file = disk.stats_filename_default_fullpath
109
- config = Storazzo::RicDiskSampleConfig.safe_instance()
108
+ config = Storazzo::RicDiskSampleConfig.safe_instance
110
109
  config.load
111
110
  config.iterate_through_file_list_for_disks([test_dir])
112
111
  assert(
113
- not(File.exists?(stats_file)),
112
+ !File.exist?(stats_file),
114
113
  "parse on LocalFolder should NOT create file '#{stats_file}' but another in another TODO place"
115
114
  )
116
115
  # ...
117
116
  end
118
117
 
119
118
  def test_readonly_directory_is_indeed_readonly
120
- test_dir = "/etc/ssh"
119
+ test_dir = '/etc/ssh'
121
120
  readonly_rdisk = Storazzo::Media::LocalFolder.new(test_dir)
122
121
  if_deb? do
123
122
  ppp(readonly_rdisk.to_verbose_s)
@@ -1,18 +1,20 @@
1
- require "minitest/autorun"
2
- require "storazzo"
1
+ # frozen_string_literal: true
2
+
3
+ require 'minitest/autorun'
4
+ require 'storazzo'
3
5
 
4
6
  # require 'pry' # must install the gem... but you ALWAYS want pry installed anyways
5
7
 
6
8
  class MediaMountPointTest < Minitest::Test
7
9
  def test_test_in_subfolder
8
10
  # raise "Does this even work?!?"
9
- puts "Looks like this only works if you run this: ruby -I test test/media/test_media_mount_point.rb"
11
+ puts 'Looks like this only works if you run this: ruby -I test test/media/test_media_mount_point.rb'
10
12
  end
11
13
 
12
14
  def test_mount_point_creation
13
15
  # x = Storazzo::Media::MountPoint.new
14
16
  # assert class inherits from ...
15
- skip "TODO Code is still missing but TODO implement that this class inherits from **ther class"
17
+ skip 'TODO Code is still missing but TODO implement that this class inherits from **ther class'
16
18
  # assert(
17
19
  # false,
18
20
  # "TODO Code is still missing but TODO implement that this class inherits from **ther class"
@@ -20,6 +22,6 @@ class MediaMountPointTest < Minitest::Test
20
22
  end
21
23
 
22
24
  def test_what_skip_means
23
- skip 'Check for affiliate link, credit card details, pledge history. Foujnd example online. Please Riccardo fix'
25
+ skip 'Check for blah blah blah. Found example online. Please Riccardo fix. This is just an example of how to SKIP a test :)'
24
26
  end
25
27
  end
@@ -1,16 +1,18 @@
1
- require "minitest/autorun"
2
- require "storazzo"
1
+ # frozen_string_literal: true
2
+
3
+ require 'minitest/autorun'
4
+ require 'storazzo'
3
5
 
4
6
  class RicDiskTest < Minitest::Test
5
- def TODO_test_factory_works_for_gcs
6
- # actual_list = Storazzo::RicDisk::GcsBucket.list_all($sample_config_obj)
7
+ def test_factory_works_for_gcs
8
+ # actual_list = Storazzo::Media::GcsBucket.list_all($sample_config_obj)
7
9
  rd1 = Storazzo::RicDisk.new('Doesnt accept a string, should be a Gcs Something... Plus why is this test here and not under TestGcsBucket?!?')
8
- hash = rd1.to_verbose_s()
10
+ hash = rd1.to_verbose_s
9
11
  pp hash
10
12
  assert_equal(
11
13
  hash.class,
12
14
  Hash,
13
- "rd1.to_verbose_s should return a Hash"
15
+ 'rd1.to_verbose_s should return a Hash'
14
16
  )
15
17
  end
16
18
  end
@@ -1,29 +1,30 @@
1
- =begin
2
- to just test this file, try:
1
+ # frozen_string_literal: true
3
2
 
4
- `ruby -I test test/test_ric_disk_config.rb`
3
+ # to just test this file, try:
4
+ #
5
+ # `ruby -I test test/test_ric_disk_config.rb`
6
+ #
5
7
 
6
- =end
7
-
8
- require "minitest/autorun"
9
- require "storazzo"
8
+ require 'minitest/autorun'
9
+ require 'storazzo'
10
10
 
11
11
  class RicDiskConfigTest < Minitest::Test
12
12
  include Storazzo::Common
13
13
 
14
- def test_load_sample_version # test_sample_config_is_within_gems_boundaries
14
+ # test_sample_config_is_within_gems_boundaries
15
+ def test_load_sample_version
15
16
  # config_obj = Storazzo::RicDiskConfig.instance()
16
17
  # puts :sofar_so_good
17
- config_obj = Storazzo::RicDiskSampleConfig.instance()
18
+ config_obj = Storazzo::RicDiskSampleConfig.instance
18
19
  puts "config_obj.class: #{config_obj.class}"
19
20
  config = config_obj.load # _sample_version
20
- pverbose true, "[test_load_sample_version] Config: #{pp config}"
21
+ pverbose $DEBUG, "[test_load_sample_version] Config: #{pp config}"
21
22
  # puts '[RicDiskConfigTest] TODO lets make sure the gem being imported is actually in /etc/storazz-config.smaple blah blah'
22
23
  # puts "[RicDiskConfigTest] config_file: ", config_obj.config_file
23
24
  assert_equal(
24
25
  config_obj.config_file,
25
- Storazzo.root + "/etc/storazzo_config.sample.yaml",
26
- "Config file expected to be here.."
26
+ "#{Storazzo.root}/etc/storazzo_config.sample.yaml",
27
+ 'Config file expected to be here..'
27
28
  )
28
29
  end
29
30
  end
@@ -1,16 +1,18 @@
1
- require "storazzo/ric_disk_statsfile"
1
+ # frozen_string_literal: true
2
+
3
+ require 'storazzo/ric_disk_statsfile'
2
4
 
3
5
  class RicDiskStatsFileTest < Minitest::Test
4
6
  def test_version
5
7
  version = Storazzo::RicDiskStatsFile.version
6
8
  assert(version.is_a?(String),
7
- "version should produce a bloody string :P")
9
+ 'version should produce a bloody string :P')
8
10
  end
9
11
 
10
12
  def test_default_name
11
13
  dname = Storazzo::RicDiskStatsFile.default_name
12
14
  assert(dname.is_a?(String),
13
- "DefaultName should produce a bloody string :P")
15
+ 'DefaultName should produce a bloody string :P')
14
16
  end
15
17
  end
16
18
  # module Storazzo
@@ -1,10 +1,12 @@
1
- require "minitest/autorun"
2
- require "storazzo"
1
+ # frozen_string_literal: true
2
+
3
+ require 'minitest/autorun'
4
+ require 'storazzo'
3
5
 
4
6
  class StorazzoTest < Minitest::Test
5
7
  def test_storazzo_hi_with_argument
6
- assert_match "Hello from Storazzo", Storazzo::Main.say_hi("ruby this should fail")
7
- assert_match "ruby this should fail", Storazzo::Main.say_hi("ruby this should fail")
8
+ assert_match 'Hello from Storazzo', Storazzo::Main.say_hi('ruby this should fail')
9
+ assert_match 'ruby this should fail', Storazzo::Main.say_hi('ruby this should fail')
8
10
  end
9
11
  # def test_storazzo_hi_without_argument
10
12
  # assert_match "Hello from Storazzo", Storazzo::Main.say_hi()
@@ -1,13 +1,15 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # I fell in love with this: https://stackoverflow.com/questions/9274205/rake-watch-for-changes
2
4
 
3
- file 'main.o' => ["main.c", "greet.h"] do
4
- sh "cc -c -o main.o main.c"
5
+ file 'main.o' => ['main.c', 'greet.h'] do
6
+ sh 'cc -c -o main.o main.c'
5
7
  end
6
8
 
7
9
  file 'greet.o' => ['greet.c'] do
8
- sh "cc -c -o greet.o greet.c"
10
+ sh 'cc -c -o greet.o greet.c'
9
11
  end
10
12
 
11
- file "hello" => ["main.o", "greet.o"] do
12
- sh "cc -o hello main.o greet.o"
13
+ file 'hello' => ['main.o', 'greet.o'] do
14
+ sh 'cc -o hello main.o greet.o'
13
15
  end
@@ -1,22 +1,11 @@
1
- # [print_stats_and_md5_for_directory] DIR to explore (make sure you glob also): .
2
- # DEB Options: {:max_files=>nil, :color=>false, :verbose=>false, :autowrite=>false}
3
- [file_v1.2] d41d8cd98f00b204e9800998ecf8427e 100644 f 2022-07-30T11:54:42+02:00 0 [text/plain] ./ricdisk_stats_v11.rds
4
- [file_v1.2] ______________NONE______________ 040755 d 2022-07-28T12:11:48+02:00 200 [inode/directory] ./disk01-empty
5
- [file_v1.2] ______________NONE______________ 040755 d 2022-07-29T19:00:54+02:00 300 [inode/directory] ./disk02-full
6
- [file_v1.2] d41d8cd98f00b204e9800998ecf8427e 100644 f 2022-07-24T06:38:25+02:00 0 [inode/x-empty] ./disk02-full/fake file.touch
7
- [file_v1.2] f344106fac7926960912486256a56af9 100644 f 2022-07-24T06:38:25+02:00 454 [text/plain] ./disk02-full/ls.txt
8
- [file_v1.2] 437b184a6b045975f0fb6c8c978f28ad 100644 f 2022-07-29T19:01:26+02:00 507 [text/plain] ./disk02-full/Rakefile
9
- # [print_stats_and_md5_for_directory] DIR to explore (make sure you glob also): ./disk01-empty
10
- # DEB Options: {:max_files=>nil, :color=>false, :verbose=>false, :autowrite=>false}
11
- [file_v1.2] f8382af52d00023dc4ee9e9029b367b9 100644 f 2022-07-28T14:30:46+02:00 1022 [text/plain] ./disk01-empty/.ricdisk
12
- [file_v1.2] d41d8cd98f00b204e9800998ecf8427e 100644 f 2022-07-24T06:38:25+02:00 0 [inode/x-empty] ./disk01-empty/.keep
13
- # [print_stats_and_md5_for_directory] DIR to explore (make sure you glob also): ./disk02-full
14
- # DEB Options: {:max_files=>nil, :color=>false, :verbose=>false, :autowrite=>false}
15
- [file_v1.2] d41d8cd98f00b204e9800998ecf8427e 100644 f 2022-07-24T06:38:25+02:00 0 [inode/x-empty] ./disk02-full/fake file.touch
16
- [file_v1.2] f344106fac7926960912486256a56af9 100644 f 2022-07-24T06:38:25+02:00 454 [text/plain] ./disk02-full/ls.txt
17
- [file_v1.2] 437b184a6b045975f0fb6c8c978f28ad 100644 f 2022-07-29T19:01:26+02:00 507 [text/plain] ./disk02-full/Rakefile
18
- [file_v1.2] d41d8cd98f00b204e9800998ecf8427e 100644 f 2022-07-24T06:38:25+02:00 0 [inode/x-empty] ./disk02-full/.ricdisk
19
- [file_v1.2] d41d8cd98f00b204e9800998ecf8427e 100644 f 2022-07-24T06:38:25+02:00 0 [inode/x-empty] ./disk02-full/fake file.touch
20
- [file_v1.2] f344106fac7926960912486256a56af9 100644 f 2022-07-24T06:38:25+02:00 454 [text/plain] ./disk02-full/ls.txt
21
- [file_v1.2] 437b184a6b045975f0fb6c8c978f28ad 100644 f 2022-07-29T19:01:26+02:00 507 [text/plain] ./disk02-full/Rakefile
22
- # [stats-with-md5] Time taken for processing 15 files: 0.35655
1
+ [SwM2]
2
+ [SwM2] 16777231 23334173 drwxr-xr-x 5 ricc primarygroup 0 160 "Jul 13 07:17:42 2022" "Jul 31 21:42:24 2022" "Jul 31 21:42:24 2022" "Jul 13 07:16:58 2022" 4096 0 0 .
3
+ [SwM2] 16777231 23334181 drwxr-xr-x 4 ricc primarygroup 0 128 "Jul 31 21:36:14 2022" "Jul 31 21:36:04 2022" "Jul 31 21:36:04 2022" "Jul 13 07:17:04 2022" 4096 0 0 ./disk01-empty
4
+ [SwM2] f8382af52d00023dc4ee9e9029b367b9 16777231 28549475 -rw-r--r-- 1 ricc primarygroup 0 530 "Jul 31 21:36:04 2022" "Jul 31 21:36:04 2022" "Jul 31 21:36:04 2022" "Jul 31 21:36:04 2022" 4096 8 0 ./disk01-empty/.ricdisk
5
+ [SwM2] d41d8cd98f00b204e9800998ecf8427e 16777231 23334222 -rw-r--r-- 1 ricc primarygroup 0 0 "Jul 13 07:17:25 2022" "Jul 13 07:17:25 2022" "Jul 13 07:17:25 2022" "Jul 13 07:17:25 2022" 4096 0 0 ./disk01-empty/.keep
6
+ [SwM2] 16777231 23334190 drwxr-xr-x 6 ricc primarygroup 0 192 "Jul 31 21:36:14 2022" "Jul 31 21:36:04 2022" "Jul 31 21:36:04 2022" "Jul 13 07:17:08 2022" 4096 0 0 ./disk02-full
7
+ [SwM2] d41d8cd98f00b204e9800998ecf8427e 16777231 23334254 -rw-r--r-- 1 ricc primarygroup 0 0 "Jul 13 07:17:47 2022" "Jul 13 07:17:47 2022" "Jul 13 07:17:47 2022" "Jul 13 07:17:47 2022" 4096 0 0 ./disk02-full/.ricdisk
8
+ [SwM2] d41d8cd98f00b204e9800998ecf8427e 16777231 23334280 -rw-r--r-- 1 ricc primarygroup 0 0 "Jul 13 07:18:06 2022" "Jul 13 07:18:06 2022" "Jul 13 07:18:06 2022" "Jul 13 07:18:06 2022" 4096 0 0 ./disk02-full/fake file.touch
9
+ [SwM2] f344106fac7926960912486256a56af9 16777231 23334298 -rw-r--r-- 1 ricc primarygroup 0 300 "Jul 13 07:58:56 2022" "Jul 13 07:18:16 2022" "Jul 13 07:18:16 2022" "Jul 13 07:18:16 2022" 4096 8 0 ./disk02-full/ls.txt
10
+ [SwM2] e2eaeec3f8904fc46094e59f24031ced 16777231 28549476 -rw-r--r-- 1 ricc primarygroup 0 322 "Jul 31 21:40:44 2022" "Jul 31 21:39:31 2022" "Jul 31 21:39:31 2022" "Jul 31 21:36:04 2022" 4096 8 0 ./disk02-full/Rakefile
11
+ Note. Im obsoleting this in favor of stats-with-md5.rb. Why? Mac and Linux produce 2 different outputs with this one due to different 'stats' output :/