storazzo 0.5.7 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +7 -5
  3. data/Makefile +8 -6
  4. data/Rakefile +15 -13
  5. data/VERSION +1 -1
  6. data/bin/hello-storazzo +1 -0
  7. data/bin/ricdisk-magic +33 -30
  8. data/bin/stats-with-md5 +182 -157
  9. data/bin/storazzo +112 -114
  10. data/bin/storazzo-symlink.rb +1 -0
  11. data/lib/storazzo/colors.rb +77 -36
  12. data/lib/storazzo/common.rb +72 -68
  13. data/lib/storazzo/debug.rb +2 -0
  14. data/lib/storazzo/hashify.rb +7 -5
  15. data/lib/storazzo/main.rb +59 -49
  16. data/lib/storazzo/media/abstract_ric_disk.rb +188 -179
  17. data/lib/storazzo/media/gcs_bucket.rb +76 -58
  18. data/lib/storazzo/media/local_folder.rb +56 -42
  19. data/lib/storazzo/media/mount_point.rb +20 -12
  20. data/lib/storazzo/ric_disk.rb +386 -383
  21. data/lib/storazzo/ric_disk_config.rb +227 -209
  22. data/lib/storazzo/ric_disk_sample_config.rb +26 -24
  23. data/lib/storazzo/ric_disk_statsfile.rb +19 -17
  24. data/lib/storazzo/ric_disk_ugly.rb +1 -0
  25. data/lib/storazzo/version.rb +3 -3
  26. data/lib/storazzo.rb +6 -7
  27. data/storazzo.gemspec +24 -16
  28. data/test/benchmark/for_future_use.rb +4 -2
  29. data/test/benchmark/test_hashing_functions-speed.rb +17 -0
  30. data/test/bin/new-idea.rb +17 -0
  31. data/test/bin/storazzo.rb +22 -25
  32. data/test/media/test_abstract_ric_disk.rb +5 -3
  33. data/test/media/test_gcs_bucket.rb +24 -23
  34. data/test/media/test_local_folder.rb +24 -23
  35. data/test/media/test_mount_point.rb +6 -5
  36. data/test/test_ric_disk.rb +6 -4
  37. data/test/test_ric_disk_config.rb +12 -11
  38. data/test/test_ric_disk_stats_file.rb +5 -3
  39. data/test/test_storazzo.rb +6 -4
  40. data/var/test/disks/disk02-full/Rakefile +7 -5
  41. data/var/test/disks/ricdisk_stats_v11.rds +11 -0
  42. metadata +13 -21
data/lib/storazzo.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Inspired from https://guides.rubygems.org/make-your-own-gem/#introduction
2
4
 
3
5
  module Storazzo
@@ -5,17 +7,17 @@ module Storazzo
5
7
  # require 'storazzo/translator'
6
8
 
7
9
  def latest_parser_version
8
- "1.2"
10
+ '1.2'
9
11
  end
10
12
 
11
13
  # Finds RAILS_ROOT for Storazzo Gem. Copied from:
12
14
  # https://stackoverflow.com/questions/10132949/finding-the-gem-root
13
15
  def self.root
14
- File.expand_path '../..', __FILE__
16
+ File.expand_path '..', __dir__
15
17
  end
16
18
 
17
19
  def self.version
18
- File.read(self.root + '/VERSION').chomp # "10.0.0"
20
+ File.read("#{root}/VERSION").chomp # "10.0.0"
19
21
  end
20
22
 
21
23
  # alias_method :VERSION, :version
@@ -30,12 +32,9 @@ end
30
32
 
31
33
  # nice to paste nice output
32
34
  require 'pp'
33
- require 'require_all'
34
35
 
35
- # require_all './' , 'media/'
36
- # require_all 'lib/**/*.rb'
37
36
  # require_rel '.', 'media'
38
- Dir[File.dirname(__FILE__) + '/../lib/*.rb'].each do |file|
37
+ Dir["#{File.dirname(__FILE__)}/../lib/*.rb"].each do |file|
39
38
  puts "+ Requiring... #{file}"
40
39
  require File.basename(file, File.extname(file))
41
40
  end
data/storazzo.gemspec CHANGED
@@ -1,18 +1,25 @@
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 = Dir["bin/*"].map{|full_path| # bin/blah-blah
14
- full_path.gsub("bin/", "")
15
- }
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
16
23
  # [
17
24
  # # todo: everything in bin/
18
25
  # "ricdisk-magic",
@@ -20,8 +27,9 @@ Gem::Specification.new do |s|
20
27
  # "storazzo",
21
28
  # "hello-storazzo",
22
29
  # ]
23
- s.homepage = "https://rubygems.org/gems/storazzo" # maybe https://github.com/palladius/storazzo
24
- s.license = "MIT"
30
+ s.homepage = 'https://rubygems.org/gems/storazzo' # maybe https://github.com/palladius/storazzo
31
+ s.license = 'MIT'
32
+
25
33
  # s.add_dependency "activesupport", "~> 3.0"
26
- s.add_dependency "pry" # , "~> 3.0"
34
+ #s.add_dependency 'pry' # , "~> 3.0"
27
35
  end
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # copied from https://github.com/minitest/minitest
2
4
 
3
5
  # optionally run benchmarks, good for CI-only work!
4
- require "minitest/benchmark" if ENV["BENCHMARK"]
6
+ require 'minitest/benchmark' if ENV['BENCHMARK']
5
7
 
6
8
  class TestMeme < Minitest::Benchmark
7
9
  # Override self.bench_range or default range is [1, 10, 100, 1_000, 10_000]
@@ -10,4 +12,4 @@ class TestMeme < Minitest::Benchmark
10
12
  @obj.my_algorithm(n)
11
13
  end
12
14
  end
13
- 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.'
data/test/bin/storazzo.rb CHANGED
@@ -1,28 +1,25 @@
1
+ # frozen_string_literal: true
1
2
 
2
-
3
-
4
-
5
- require "minitest/autorun"
6
- require "storazzo"
3
+ require 'English'
4
+ require 'minitest/autorun'
5
+ require 'storazzo'
7
6
 
8
7
  class BinaryStorazzoTest < Minitest::Test
9
-
10
- def test_binary_returns_error_with_random_argv
11
- ret = `bin/storazzo aaa`
12
- #puts ret
13
- #puts "return code is '#{$?.exitstatus}'"
14
- should_match_string = 'Unknown action1: aaa. Available actions:' # 'ERROR: Unknown action1: aaa. Available actions: ["auto", "help", "show"]'
15
- assert_equal(
16
- $?.exitstatus,
17
- 13,
18
- "Wrong argument should return 13"
19
- )
20
- matches_expected_error = ret.match(should_match_string)
21
- #puts "matches_expected_error: ''#{matches_expected_error}''"
22
- assert(
23
- not( matches_expected_error.nil?),
24
- "Binary should return a string which should contain this string: '#{should_match_string}'"
25
- )
26
- end
27
-
28
- end
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,6 +1,8 @@
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
 
@@ -13,7 +15,7 @@ class AbstractRicDiskTest < Minitest::Test
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,10 +1,12 @@
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"
7
- require "storazzo/media/gcs_bucket"
8
+ # require "storazzo/media/local_folder"
9
+ require 'storazzo/media/gcs_bucket'
8
10
 
9
11
  require 'pry' # must install the gem... but you ALWAYS want pry installed anyways
10
12
 
@@ -13,25 +15,26 @@ require 'pry' # must install the gem... but you ALWAYS want pry installed anyway
13
15
  class GcsBucketTest < Minitest::Test
14
16
  include Storazzo::Common
15
17
 
16
- def setup # tear_up
17
- deb "[GcsBucketTest] TEAR_UP with sample Config"
18
+ # tear_up
19
+ def setup
20
+ deb '[GcsBucketTest] TEAR_UP with sample Config'
18
21
  # removeme = Storazzo::RicDiskConfig.instance()
19
- @sample_config_obj = Storazzo::RicDiskSampleConfig.instance()
20
- @sample_config_hash = @sample_config_obj.load()
22
+ @sample_config_obj = Storazzo::RicDiskSampleConfig.instance
23
+ @sample_config_hash = @sample_config_obj.load
21
24
  deb "[GcsBucketTest] TEAR_UP config_obj: '''#{@sample_config_obj}'''"
22
25
  end
23
26
 
24
27
  def test_that_test_buckets_are_the_two_I_know
25
28
  # copied from etc/sample.yaml :)
26
- expected_test_buckets_list = %w{
29
+ expected_test_buckets_list = %w[
27
30
  gs://my-local-backup/storazzo/backups/
28
31
  gs://my-other-bucket/
29
- }
32
+ ]
30
33
  actual_list = Storazzo::Media::GcsBucket.list_all(@sample_config_obj)
31
34
  assert_equal(
32
35
  expected_test_buckets_list.sort,
33
36
  actual_list.sort,
34
- "These are the two lists from Sample Storazzo Config"
37
+ 'These are the two lists from Sample Storazzo Config'
35
38
  )
36
39
  end
37
40
 
@@ -44,7 +47,7 @@ class GcsBucketTest < Minitest::Test
44
47
  # puts Storazzo::RicDiskSampleConfig
45
48
  # config_obj = Storazzo::RicDiskSampleConfig.instance()
46
49
  if_deb? do
47
- Pry::ColorPrinter.pp(@sample_config_obj.to_verbose_s())
50
+ Pry::ColorPrinter.pp(@sample_config_obj.to_verbose_s)
48
51
  end
49
52
  # pp green(config_obj.to_verbose_s())
50
53
 
@@ -57,24 +60,23 @@ class GcsBucketTest < Minitest::Test
57
60
 
58
61
  def test_super_duper_list_works
59
62
  # we had a problem on GCS side
60
- #Storazzo::Media::AbstractRicDisk.super_duper_list_all_with_type
63
+ # Storazzo::Media::AbstractRicDisk.super_duper_list_all_with_type
61
64
  expected_ret = [
62
- [:config_gcs_bucket, "gs://my-local-backup/storazzo/backups/"],
63
- [:config_gcs_bucket, "gs://my-other-bucket/"]
65
+ [:config_gcs_bucket, 'gs://my-local-backup/storazzo/backups/'],
66
+ [:config_gcs_bucket, 'gs://my-other-bucket/']
64
67
  ]
65
- ret = Storazzo::Media::GcsBucket.list_all_with_type()
68
+ ret = Storazzo::Media::GcsBucket.list_all_with_type
66
69
  Pry::ColorPrinter.pp(ret)
67
70
  assert_equal(
68
71
  ret.class,
69
72
  Array,
70
- "test_super_duper_list_all_with_type_returns_something should return an array.."
71
- )
72
- assert_equal(ret,expected_ret,"These are the two buckets I expect from test.."
73
+ 'test_super_duper_list_all_with_type_returns_something should return an array..'
73
74
  )
75
+ assert_equal(ret, expected_ret, 'These are the two buckets I expect from test..')
74
76
  end
75
77
 
76
78
  def test_gsutil_returns_something
77
- ret = Storazzo::Media::GcsBucket.list_available_buckets()
79
+ ret = Storazzo::Media::GcsBucket.list_available_buckets
78
80
  Pry::ColorPrinter.pp(ret)
79
81
  end
80
82
 
@@ -87,5 +89,4 @@ class GcsBucketTest < Minitest::Test
87
89
  # "test_super_duper_list_all_with_type_returns_something should return an array.."
88
90
  # )
89
91
  # end
90
-
91
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,13 +18,13 @@ 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
20
22
  def setup
21
- include Storazzo::Colors
22
- puts yellow("LocalFolderTest: tear up")
23
+ include Storazzo::Colors
24
+ puts yellow('LocalFolderTest: tear up')
23
25
  # @config_useless = Storazzo::RicDiskConfig.instance()
24
- @config = Storazzo::RicDiskSampleConfig.safe_instance()
25
- @config_load = @config.load()
26
+ @config = Storazzo::RicDiskSampleConfig.safe_instance
27
+ @config_load = @config.load
26
28
  puts @config.to_verbose_s
27
29
  # my_class = Storazzo::RicDisk::LocalFolder
28
30
  # my_obj = Storazzo::RicDisk::LocalFolder
@@ -30,27 +32,26 @@ class LocalFolderTest < Minitest::Test
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
-
50
+ def test_1_first_directory_parsing_actually_works
50
51
  puts("(#{__FILE__}) WEIRD THING: This test is flaky. SKipping for now until I complete the LocalFolder.parse() code")
51
52
  folders = Storazzo::Media::LocalFolder.list_all
52
53
  puts "Folders: #{folders}"
53
- config = Storazzo::RicDiskSampleConfig.safe_instance()
54
+ config = Storazzo::RicDiskSampleConfig.safe_instance
54
55
  puts "config1: #{config}"
55
56
  puts "config2: #{config.load}"
56
57
  test_dir = folders.first
@@ -60,7 +61,7 @@ class LocalFolderTest < Minitest::Test
60
61
  disk = Storazzo::Media::LocalFolder.new(test_dir)
61
62
  stats_file = disk.stats_filename_default_fullpath
62
63
  puts "stats_file: #{stats_file}"
63
- disk.parse()
64
+ disk.parse
64
65
  deb "config: ''#{config}''"
65
66
  # config.iterate_through_file_list_for_disks([test_dir])
66
67
  # assert(
@@ -78,7 +79,7 @@ class LocalFolderTest < Minitest::Test
78
79
  # puts("(#{__FILE__}) WEIRD THING: This test is flaky. SKipping for now until I complete the LocalFolder.parse() code")
79
80
  folders = Storazzo::Media::LocalFolder.list_all
80
81
  puts "Folders: #{folders}"
81
- config = Storazzo::RicDiskSampleConfig.safe_instance()
82
+ config = Storazzo::RicDiskSampleConfig.safe_instance
82
83
  config.load
83
84
  puts "config1: #{config}"
84
85
  puts "config2: #{config.load}"
@@ -95,27 +96,27 @@ class LocalFolderTest < Minitest::Test
95
96
  # TEST2: config + iterate
96
97
  config.iterate_through_file_list_for_disks([test_dir])
97
98
  assert(
98
- File.exists?(stats_file),
99
+ File.exist?(stats_file),
99
100
  "parse on LocalFolder should create file '#{stats_file}'"
100
101
  )
101
102
  end
102
103
 
103
104
  def test_readonly_directory_creates_configfile_outside_of_dir
104
- test_dir = "/etc/ssh/"
105
+ test_dir = '/etc/ssh/'
105
106
  disk = Storazzo::Media::LocalFolder.new(test_dir)
106
107
  stats_file = disk.stats_filename_default_fullpath
107
- config = Storazzo::RicDiskSampleConfig.safe_instance()
108
+ config = Storazzo::RicDiskSampleConfig.safe_instance
108
109
  config.load
109
110
  config.iterate_through_file_list_for_disks([test_dir])
110
111
  assert(
111
- not(File.exists?(stats_file)),
112
+ !File.exist?(stats_file),
112
113
  "parse on LocalFolder should NOT create file '#{stats_file}' but another in another TODO place"
113
114
  )
114
115
  # ...
115
116
  end
116
117
 
117
118
  def test_readonly_directory_is_indeed_readonly
118
- test_dir = "/etc/ssh"
119
+ test_dir = '/etc/ssh'
119
120
  readonly_rdisk = Storazzo::Media::LocalFolder.new(test_dir)
120
121
  if_deb? do
121
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"
@@ -22,5 +24,4 @@ class MediaMountPointTest < Minitest::Test
22
24
  def test_what_skip_means
23
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
-
26
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
7
  def test_factory_works_for_gcs
6
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,20 +1,21 @@
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
21
  pverbose $DEBUG, "[test_load_sample_version] Config: #{pp config}"
@@ -22,8 +23,8 @@ class RicDiskConfigTest < Minitest::Test
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
@@ -0,0 +1,11 @@
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 :/