storazzo 0.2.1 → 0.3.5

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.
data/lib/storazzo.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  # Inspired from https://guides.rubygems.org/make-your-own-gem/#introduction
2
2
 
3
-
4
3
  module Storazzo
5
4
  #VERSION = File.read('./VERSION').chomp # "10.0.0"
6
5
  #require 'storazzo/translator'
@@ -23,20 +22,30 @@ module Storazzo
23
22
  def self.VERSION
24
23
  version
25
24
  end
25
+
26
+ def self.storazzo_classes
27
+ [42, 43]
28
+ end
26
29
  end
27
30
 
28
31
  # nice to paste nice output
29
32
  require 'pp'
30
33
 
34
+ require 'storazzo'
31
35
  require 'storazzo/common'
32
36
  require 'storazzo/colors'
33
37
  require 'storazzo/hashify'
34
38
  require 'storazzo/ric_disk' # NEW and will build from ground up using multiple files..
39
+ #require 'storazzo/ric_disk/asbtract_ric_disk'
40
+ require 'storazzo/media/abstract_ric_disk'
41
+ require 'storazzo/media/gcs_bucket'
42
+ require 'storazzo/media/local_folder'
35
43
  require 'storazzo/ric_disk_ugly' # OLD and 90% working
36
- require 'storazzo/ric_disk_config'
44
+ require 'storazzo/ric_disk_config' # => RicDiskConfif
45
+ require 'storazzo/ric_disk_sample_config' # => NOTHING!!
46
+ require 'storazzo/ric_disk_config_example' # => NEW!!!
37
47
  require 'storazzo/ric_disk_statsfile'
38
48
  require 'storazzo/main'
39
49
  require 'storazzo/translator'
40
50
 
41
- puts Storazzo::Main.hi
42
-
51
+ #puts Storazzo::Main.say_hi
@@ -0,0 +1,58 @@
1
+ require "minitest/autorun"
2
+ require "storazzo"
3
+ require "storazzo/ric_disk"
4
+ require "storazzo/ric_disk_config"
5
+ require 'storazzo/colors'
6
+ require "storazzo/media/local_folder"
7
+ require "storazzo/ric_disk_config_example"
8
+
9
+ #require "storazzo/ric_disk_config"
10
+ #require "storazzo/ric_disk_sample_config"
11
+ #require 'storazzo/ric_disk_sample_config' # => NOTHING!!
12
+ #require 'storazzo/ric_disk_config_sample' # => NOTHING!!
13
+
14
+ #require "storazzo/ric_disk"
15
+ #require "lib/storazzo/ric_disk_sample_config"
16
+ #require "storazzo/media/local_folder"
17
+ #require "storazzo/ric_disk/gcs_bucket"
18
+ #require "storazzo/media/local_folder"
19
+
20
+ class GcsBucketTest < Minitest::Test
21
+
22
+ include Storazzo::Common
23
+
24
+ def TODO_RENAME_MEsetup # tear_up
25
+ deb "[GcsBucketTest] TEAR_UP with sample Config"
26
+ removeme = Storazzo::RicDiskConfig.instance()
27
+ config_obj = Storazzo::RicDiskSampleConfig.instance()
28
+ deb "[GcsBucketTest] TEAR_UP config_obj: '''#{config_obj}'''"
29
+ end
30
+
31
+ def TODO_RENAME_MEtest_buckets_are_the_two_i_know
32
+ expected_list = %w{
33
+ gs://my-local-backup/storazzo/backups/
34
+ gs://my-other-bucket/
35
+ }
36
+ actual_list = Storazzo::RicDisk::GcsBucket.list_all
37
+ assert_equal(expected_list, actual_list,
38
+ "These are the two lists from Sample Storazzo Config")
39
+ end
40
+
41
+ def test_import
42
+ require "storazzo/ric_disk_sample_config" rescue nil
43
+ require "storazzo/ric_disk_config"
44
+
45
+ #puts Storazzo.class
46
+ puts Storazzo.constants
47
+ #puts Storazzo::RicDiskSampleConfig
48
+ config_obj = Storazzo::RicDiskSampleConfig.instance()
49
+ puts config_obj
50
+ config_obj.load # _sample_version
51
+ end
52
+
53
+
54
+ def teardown
55
+ #puts :TEAR_DOWN_TODO
56
+ end
57
+
58
+ end
@@ -0,0 +1,65 @@
1
+ require "minitest/autorun"
2
+ require "storazzo"
3
+ require "storazzo/ric_disk"
4
+ require "storazzo/ric_disk_config"
5
+ require 'storazzo/colors'
6
+ require "storazzo/media/local_folder"
7
+
8
+ #require "storazzo/ric_disk/gcs_bucket"
9
+ #require "storazzo/media/local_folder"
10
+
11
+
12
+ #puts yellow("DISABLING FOR NOW TODO restore")
13
+
14
+ class LocalFolderTest < Minitest::Test
15
+ extend Storazzo::Colors
16
+ # def test_fail_on_purpOSE # test_storazzo_hi_with_argument
17
+ # assert_match 42, 42 , "change me when it failes from makefile"
18
+ # #"Hello from Storazzo", Storazzo::Main.hi("ruby this should fail")
19
+ # #assert_match "ruby this should fail", Storazzo::Main.hi("ruby this should fail")
20
+ # end
21
+ def tear_up
22
+ include Storazzo::Colors
23
+ puts yellow("LocalFolderTest: tear up")
24
+ #$config = Storazzo::RicDiskConfig.instance()
25
+ #$vediamo_se_funge = 42
26
+ # my_class = Storazzo::RicDisk::LocalFolder
27
+ # my_obj = Storazzo::RicDisk::LocalFolder
28
+ end
29
+
30
+ def test_show_all_shouldnt_fail_and_should_return_a_non_empty_array
31
+ assert_equal(Array, Storazzo::Media::LocalFolder.list_all.class, "Storazzo::RicDisk::LocalFolder.list_all should return an Array")
32
+ assert(Storazzo::Media::LocalFolder.list_all.size >0, "Array size should be >0")
33
+ #puts Storazzo::Media::LocalFolder.list_all
34
+ end
35
+
36
+ def test_list_all_returns_an_array_of_real_directories
37
+ dirs = Storazzo::Media::LocalFolder.list_all
38
+ dirs.each do |mydir|
39
+ assert_equal(String, mydir.class, "Dir should be a String representing an existing directory")
40
+ assert(File.directory?(mydir), "Dir should be a file of type 'directory'")
41
+ end
42
+ end
43
+
44
+ def test_first_directory_parsing_actually_works()
45
+ # include module
46
+
47
+ #p $vediamo_se_funge
48
+ puts("(#{__FILE__}) WEIRD THING: This test is flaky. SKipping for now until I complete the LocalFolder.parse() code")
49
+ folders = Storazzo::Media::LocalFolder.list_all
50
+ config = Storazzo::RicDiskConfig.instance()
51
+ test_dir = folders.first
52
+ # puts "test_first_directory_parsing_actually_works() TestDir: #{test_dir}"
53
+ # puts yellow "TEST S:M:LF methods: #{folders}" # methods
54
+ # disk = Storazzo::Media::LocalFolder.new(test_dir)
55
+ # stats_file = disk.stats_filename_default_fullpath
56
+ # puts "stats_file: #{stats_file}"
57
+ # disk.parse()
58
+ puts "[DEB] config: ''#{config}''"
59
+ config.iterate_through_file_list_for_disks( [test_dir])
60
+ # assert(
61
+ # File.exists?(stats_file),
62
+ # "parse on LocalFolder should create file '#{stats_file}'"
63
+ # )
64
+ end
65
+ end
@@ -0,0 +1,40 @@
1
+ =begin
2
+ to just test this file, try:
3
+
4
+ `ruby -I test test/test_ric_disk_config.rb`
5
+
6
+ =end
7
+
8
+ require "minitest/autorun"
9
+ require "storazzo"
10
+ #require "storazzo/ric_disk_config"
11
+ #require "storazzo/ric_disk_sample_config"
12
+ #require "storazzo/ric_disk_config_example"
13
+
14
+ # require "storazzo/media/local_folder"
15
+ #require "storazzo/ric_disk/gcs_bucket"
16
+ #require "storazzo/media/local_folder"
17
+
18
+ puts :TODO
19
+
20
+ class RicDiskConfigTest < Minitest::Test
21
+
22
+ def test_load_sample_version # test_sample_config_is_within_gems_boundaries
23
+ #config_obj = Storazzo::RicDiskConfig.instance()
24
+ #puts :sofar_so_good
25
+ config_obj = Storazzo::RicDiskSampleConfig.instance()
26
+ puts "config_obj.class: #{config_obj.class}"
27
+ l = config_obj.load # _sample_version
28
+ puts l
29
+ #puts '[RicDiskConfigTest] TODO lets make sure the gem being imported is actually in /etc/storazz-config.smaple blah blah'
30
+ #puts "[RicDiskConfigTest] config_file: ", config_obj.config_file
31
+ assert_equal(
32
+ config_obj.config_file,
33
+ # Rails.root +
34
+ "etc/",
35
+ "Config file expected to be here.."
36
+ )
37
+ end
38
+
39
+
40
+ end
@@ -0,0 +1,36 @@
1
+ require "storazzo/ric_disk_statsfile"
2
+
3
+ class RicDiskStatsFileTest < Minitest::Test
4
+
5
+ def test_version
6
+ version = Storazzo::RicDiskStatsFile.version
7
+ assert(version.is_a?(String),
8
+ "version should produce a bloody string :P")
9
+ end
10
+
11
+ def test_default_name
12
+ dname = Storazzo::RicDiskStatsFile.default_name
13
+ assert(dname.is_a?(String),
14
+ "DefaultName should produce a bloody string :P")
15
+ end
16
+ end
17
+ # module Storazzo
18
+ # class Storazzo::RicDiskStatsFile
19
+ # # Please keep these two in sync, until you fix them and DRY the behaviour.
20
+ # #@@default_name
21
+ # DefaultName = "ricdisk_stats_v11.rds" # => RicDiskStatsFile
22
+ # Version = "1.1" # @@version
23
+
24
+ # # AttrAccessor for class - thanks StackOverflow from Android since Im in roaming :)
25
+ # class << self
26
+ # attr_accessor :default_name, :version
27
+ # end
28
+
29
+ # def self.default_name
30
+ # DefaultName
31
+ # end
32
+ # def self.version
33
+ # Version
34
+ # end
35
+ # end
36
+ # end
@@ -1,34 +1,34 @@
1
- require "minitest/autorun"
2
- require "storazzo"
1
+ # require "minitest/autorun"
2
+ # require "storazzo"
3
3
 
4
- class StorazzoTest < Minitest::Test
5
- def test_storazzo_hi_with_argument
6
- assert_match "Hello from Storazzo", Storazzo::Main.hi("ruby this should fail")
7
- assert_match "ruby this should fail", Storazzo::Main.hi("ruby this should fail")
8
- end
9
- def test_storazzo_hi_without_argument
10
- assert_match "Hello from Storazzo", Storazzo::Main.hi()
11
- end
4
+ # class StorazzoTest < Minitest::Test
5
+ # 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
+ # end
9
+ # def test_storazzo_hi_without_argument
10
+ # assert_match "Hello from Storazzo", Storazzo::Main.say_hi()
11
+ # end
12
12
 
13
- def test_storazzo_version_should_have_3_numbers_and_2_dots
14
- # puts Storazzo::version
15
- assert_equal Storazzo::version.split('.').size , 3, "should be 3 parts, like A.B.C"
16
- #major, minor, minuscule = Storazzo::VERSION.split('.')
17
- # assert_match Storazzo::VERSION, "....."
18
- end
13
+ # def test_storazzo_version_should_have_3_numbers_and_2_dots
14
+ # # puts Storazzo::version
15
+ # assert_equal Storazzo::version.split('.').size , 3, "should be 3 parts, like A.B.C"
16
+ # #major, minor, minuscule = Storazzo::VERSION.split('.')
17
+ # # assert_match Storazzo::VERSION, "....."
18
+ # end
19
19
 
20
- # def test_english_hello
21
- # assert_equal "hello world",
22
- # Hola.hi("english")
23
- # end
20
+ # # def test_english_hello
21
+ # # assert_equal "hello world",
22
+ # # Hola.hi("english")
23
+ # # end
24
24
 
25
- # def test_any_hello
26
- # assert_equal "hello world",
27
- # Hola.hi("ruby")
28
- # end
25
+ # # def test_any_hello
26
+ # # assert_equal "hello world",
27
+ # # Hola.hi("ruby")
28
+ # # end
29
29
 
30
- # def test_spanish_hello
31
- # assert_equal "hola mundo",
32
- # Hola.hi("spanish")
33
- # end
34
- end
30
+ # # def test_spanish_hello
31
+ # # assert_equal "hola mundo",
32
+ # # Hola.hi("spanish")
33
+ # # end
34
+ # end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: storazzo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Riccardo Carlesso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-13 00:00:00.000000000 Z
11
+ date: 2022-07-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A simple gem to manage your external hard drives and extract MD5 and
14
14
  common stuff from them.
@@ -31,14 +31,25 @@ files:
31
31
  - lib/storazzo/debug.rb
32
32
  - lib/storazzo/hashify.rb
33
33
  - lib/storazzo/main.rb
34
+ - lib/storazzo/media/README.md
35
+ - lib/storazzo/media/abstract_ric_disk.rb
36
+ - lib/storazzo/media/gcs_bucket.rb
37
+ - lib/storazzo/media/local_folder.rb
38
+ - lib/storazzo/media/mount_point.rb
34
39
  - lib/storazzo/parser/parser.rb
35
40
  - lib/storazzo/ric_disk.rb
36
41
  - lib/storazzo/ric_disk_config.rb
42
+ - lib/storazzo/ric_disk_config_example.rb
43
+ - lib/storazzo/ric_disk_sample_config.rb
37
44
  - lib/storazzo/ric_disk_statsfile.rb
38
45
  - lib/storazzo/ric_disk_ugly.rb
39
46
  - lib/storazzo/translator.rb
40
47
  - lib/storazzo/version.rb
41
48
  - storazzo.gemspec
49
+ - test/test_gcs_bucket.rb
50
+ - test/test_local_folder.rb
51
+ - test/test_ric_disk_config.rb
52
+ - test/test_ric_disk_stats_file.rb
42
53
  - test/test_storazzo.rb
43
54
  - var/test/README.md
44
55
  - var/test/disks/disk02-full/fake file.touch
@@ -62,12 +73,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
73
  - !ruby/object:Gem::Version
63
74
  version: '0'
64
75
  requirements: []
65
- rubygems_version: 3.1.4
76
+ rubygems_version: 3.1.6
66
77
  signing_key:
67
78
  specification_version: 4
68
79
  summary: storazzo is an amazing gem. Code is in https://github.com/palladius/storazzo
69
80
  test_files:
70
81
  - test/test_storazzo.rb
82
+ - test/test_ric_disk_stats_file.rb
83
+ - test/test_ric_disk_config.rb
84
+ - test/test_gcs_bucket.rb
85
+ - test/test_local_folder.rb
71
86
  - var/test/README.md
72
87
  - var/test/disks/disk02-full/fake file.touch
73
88
  - var/test/disks/disk02-full/ls.txt