storazzo 0.4.9 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,141 +7,139 @@ require 'storazzo/colors'
7
7
  require "storazzo/media/local_folder"
8
8
 
9
9
  class LocalFolderTest < Minitest::Test
10
- # include Storazzo::Colors
11
- # include Storazzo::Common
12
- include Storazzo::Common
13
-
14
- # def test_fail_on_purpOSE # test_storazzo_hi_with_argument
15
- # assert_match 42, 42 , "change me when it failes from makefile"
16
- # #"Hello from Storazzo", Storazzo::Main.hi("ruby this should fail")
17
- # #assert_match "ruby this should fail", Storazzo::Main.hi("ruby this should fail")
18
- # end
19
- def tear_up
20
- 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
-
27
- # my_class = Storazzo::RicDisk::LocalFolder
28
- # my_obj = Storazzo::RicDisk::LocalFolder
29
- end
30
-
31
- def test_show_all_shouldnt_fail_and_should_return_a_non_empty_array
32
- assert_equal(Array, Storazzo::Media::LocalFolder.list_all.class, "Storazzo::RicDisk::LocalFolder.list_all should return an Array")
33
- assert(Storazzo::Media::LocalFolder.list_all.size >0, "Array size should be >0")
34
- #puts Storazzo::Media::LocalFolder.list_all
35
- end
36
-
37
- def test_list_all_returns_an_array_of_real_directories
38
- dirs = Storazzo::Media::LocalFolder.list_all
39
- dirs.each do |mydir|
40
- assert_equal(String, mydir.class, "Dir should be a String representing an existing directory")
41
- assert(File.directory?(mydir), "Dir should be a file of type 'directory'")
42
- end
43
- end
44
-
45
- # To only test this:
46
- # $ ruby -I test test/test_local_folder.rb -n test_first_directory_parsing_actually_works
47
- def test_1_first_directory_parsing_actually_works()
48
- # include module
49
-
50
- #p $vediamo_se_funge
51
- puts("(#{__FILE__}) WEIRD THING: This test is flaky. SKipping for now until I complete the LocalFolder.parse() code")
52
- folders = Storazzo::Media::LocalFolder.list_all
53
- puts "Folders: #{folders}"
54
- config = Storazzo::RicDiskSampleConfig.safe_instance()
55
- puts "config1: #{config}"
56
- puts "config2: #{config.load}"
57
- test_dir = folders.first
58
- puts "test_first_directory_parsing_actually_works() TestDir: #{test_dir}"
59
- puts yellow "TEST S:M:LF methods: #{folders}" # methods
60
-
61
- disk = Storazzo::Media::LocalFolder.new(test_dir)
62
- stats_file = disk.stats_filename_default_fullpath
63
- puts "stats_file: #{stats_file}"
64
- disk.parse()
65
- deb "config: ''#{config}''"
66
- # config.iterate_through_file_list_for_disks([test_dir])
67
- # assert(
68
- # File.exists?(stats_file),
69
- # "parse on LocalFolder should create file '#{stats_file}'"
70
- # )
71
- end
72
-
73
- def test_vars_transporeted_across_teraup_and_tests
74
- puts $config_load
75
- puts $config
76
- end
77
-
78
- def test_2_iterate_through_file_list_for_disks
79
- #puts("(#{__FILE__}) WEIRD THING: This test is flaky. SKipping for now until I complete the LocalFolder.parse() code")
80
- folders = Storazzo::Media::LocalFolder.list_all
81
- puts "Folders: #{folders}"
82
- config = Storazzo::RicDiskSampleConfig.safe_instance()
83
- config.load
84
- puts "config1: #{config}"
85
- puts "config2: #{config.load}"
86
- test_dir = folders.first
87
- puts "test_first_directory_parsing_actually_works() TestDir: #{test_dir}"
88
- puts "TEST S:M:LF methods: #{folders}" # methods
89
-
90
- disk = Storazzo::Media::LocalFolder.new(test_dir)
91
- stats_file = disk.stats_filename_default_fullpath
92
- #puts "stats_file: #{stats_file}"
93
- #disk.parse()
94
- #puts "[DEB] config: ''#{config}''"
95
-
96
- #TEST2: config + iterate
97
- config.iterate_through_file_list_for_disks([test_dir])
98
- assert(
99
- File.exists?(stats_file),
100
- "parse on LocalFolder should create file '#{stats_file}'"
101
- )
10
+ # include Storazzo::Colors
11
+ # include Storazzo::Common
12
+ include Storazzo::Common
13
+
14
+ # def test_fail_on_purpOSE # test_storazzo_hi_with_argument
15
+ # assert_match 42, 42 , "change me when it failes from makefile"
16
+ # #"Hello from Storazzo", Storazzo::Main.hi("ruby this should fail")
17
+ # #assert_match "ruby this should fail", Storazzo::Main.hi("ruby this should fail")
18
+ # end
19
+ def tear_up
20
+ 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
+
27
+ # my_class = Storazzo::RicDisk::LocalFolder
28
+ # my_obj = Storazzo::RicDisk::LocalFolder
29
+ end
30
+
31
+ def test_show_all_shouldnt_fail_and_should_return_a_non_empty_array
32
+ 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
+ # puts Storazzo::Media::LocalFolder.list_all
36
+ end
37
+
38
+ def test_list_all_returns_an_array_of_real_directories
39
+ dirs = Storazzo::Media::LocalFolder.list_all
40
+ dirs.each do |mydir|
41
+ assert_equal(String, mydir.class, "Dir should be a String representing an existing directory")
42
+ assert(File.directory?(mydir), "Dir should be a file of type 'directory'")
102
43
  end
103
-
104
- def test_readonly_directory_creates_configfile_outside_of_dir
105
- test_dir = "/etc/ssh/"
106
- disk = Storazzo::Media::LocalFolder.new(test_dir)
107
- stats_file = disk.stats_filename_default_fullpath
108
- config = Storazzo::RicDiskSampleConfig.safe_instance()
109
- config.load
110
- config.iterate_through_file_list_for_disks([test_dir])
111
- assert(
112
- not(File.exists?(stats_file)),
113
- "parse on LocalFolder should NOT create file '#{stats_file}' but another in another TODO place"
114
- )
115
- # ...
116
- end
117
-
118
- def test_readonly_directory_is_indeed_readonly
119
- test_dir = "/etc/ssh"
120
- readonly_rdisk = Storazzo::Media::LocalFolder.new(test_dir)
121
- if_deb? do
122
- ppp(readonly_rdisk.to_verbose_s)
123
- end
124
- assert_equal(
125
- readonly_rdisk.wr,
126
- false,
127
- "Folder #{test_dir} is NOT writeble to the author's knowledge."
128
- )
129
- # ...
44
+ end
45
+
46
+ # To only test this:
47
+ # $ 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
52
+ puts("(#{__FILE__}) WEIRD THING: This test is flaky. SKipping for now until I complete the LocalFolder.parse() code")
53
+ folders = Storazzo::Media::LocalFolder.list_all
54
+ puts "Folders: #{folders}"
55
+ config = Storazzo::RicDiskSampleConfig.safe_instance()
56
+ puts "config1: #{config}"
57
+ puts "config2: #{config.load}"
58
+ test_dir = folders.first
59
+ puts "test_first_directory_parsing_actually_works() TestDir: #{test_dir}"
60
+ puts yellow "TEST S:M:LF methods: #{folders}" # methods
61
+
62
+ disk = Storazzo::Media::LocalFolder.new(test_dir)
63
+ stats_file = disk.stats_filename_default_fullpath
64
+ puts "stats_file: #{stats_file}"
65
+ disk.parse()
66
+ deb "config: ''#{config}''"
67
+ # config.iterate_through_file_list_for_disks([test_dir])
68
+ # assert(
69
+ # File.exists?(stats_file),
70
+ # "parse on LocalFolder should create file '#{stats_file}'"
71
+ # )
72
+ end
73
+
74
+ def test_vars_transporeted_across_teraup_and_tests
75
+ puts $config_load
76
+ puts $config
77
+ end
78
+
79
+ def test_2_iterate_through_file_list_for_disks
80
+ # puts("(#{__FILE__}) WEIRD THING: This test is flaky. SKipping for now until I complete the LocalFolder.parse() code")
81
+ folders = Storazzo::Media::LocalFolder.list_all
82
+ puts "Folders: #{folders}"
83
+ config = Storazzo::RicDiskSampleConfig.safe_instance()
84
+ config.load
85
+ puts "config1: #{config}"
86
+ puts "config2: #{config.load}"
87
+ test_dir = folders.first
88
+ puts "test_first_directory_parsing_actually_works() TestDir: #{test_dir}"
89
+ puts "TEST S:M:LF methods: #{folders}" # methods
90
+
91
+ disk = Storazzo::Media::LocalFolder.new(test_dir)
92
+ stats_file = disk.stats_filename_default_fullpath
93
+ # puts "stats_file: #{stats_file}"
94
+ # disk.parse()
95
+ # puts "[DEB] config: ''#{config}''"
96
+
97
+ # TEST2: config + iterate
98
+ config.iterate_through_file_list_for_disks([test_dir])
99
+ assert(
100
+ File.exists?(stats_file),
101
+ "parse on LocalFolder should create file '#{stats_file}'"
102
+ )
103
+ end
104
+
105
+ def test_readonly_directory_creates_configfile_outside_of_dir
106
+ test_dir = "/etc/ssh/"
107
+ disk = Storazzo::Media::LocalFolder.new(test_dir)
108
+ stats_file = disk.stats_filename_default_fullpath
109
+ config = Storazzo::RicDiskSampleConfig.safe_instance()
110
+ config.load
111
+ config.iterate_through_file_list_for_disks([test_dir])
112
+ assert(
113
+ not(File.exists?(stats_file)),
114
+ "parse on LocalFolder should NOT create file '#{stats_file}' but another in another TODO place"
115
+ )
116
+ # ...
117
+ end
118
+
119
+ def test_readonly_directory_is_indeed_readonly
120
+ test_dir = "/etc/ssh"
121
+ readonly_rdisk = Storazzo::Media::LocalFolder.new(test_dir)
122
+ if_deb? do
123
+ ppp(readonly_rdisk.to_verbose_s)
130
124
  end
131
-
132
-
133
- def test_writeable_tmp_directory_is_indeed_writeable
134
- test_dir = '/tmp/'
135
- #test_dir = '~'
136
- writeable_rdisk = Storazzo::Media::LocalFolder.new(test_dir)
137
- #writeable_rdisk = Storazzo::RicDisk.new(test_dir)
138
- if_deb?{ ppp(writeable_rdisk.to_verbose_s) }
139
- assert_equal(
140
- true,
141
- writeable_rdisk.wr,
142
- "Folder #{test_dir} is INDEED writeble to the author's knowledge, although triggers lot of noise => wr=#{ writeable_rdisk.wr }"
143
- )
144
- end
145
-
146
-
147
- end
125
+ assert_equal(
126
+ readonly_rdisk.wr,
127
+ false,
128
+ "Folder #{test_dir} is NOT writeble to the author's knowledge."
129
+ )
130
+ # ...
131
+ end
132
+
133
+ def test_writeable_tmp_directory_is_indeed_writeable
134
+ test_dir = '/tmp/'
135
+ # test_dir = '~'
136
+ writeable_rdisk = Storazzo::Media::LocalFolder.new(test_dir)
137
+ # writeable_rdisk = Storazzo::RicDisk.new(test_dir)
138
+ if_deb? { ppp(writeable_rdisk.to_verbose_s) }
139
+ assert_equal(
140
+ true,
141
+ writeable_rdisk.wr,
142
+ "Folder #{test_dir} is INDEED writeble to the author's knowledge, although triggers lot of noise => wr=#{writeable_rdisk.wr}"
143
+ )
144
+ end
145
+ end
@@ -1,26 +1,25 @@
1
1
  require "minitest/autorun"
2
2
  require "storazzo"
3
3
 
4
- #require 'pry' # must install the gem... but you ALWAYS want pry installed anyways
4
+ # require 'pry' # must install the gem... but you ALWAYS want pry installed anyways
5
5
 
6
6
  class MediaMountPointTest < Minitest::Test
7
+ def test_test_in_subfolder
8
+ # 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"
10
+ end
7
11
 
8
- def test_test_in_subfolder
9
- #raise "Does this even work?!?"
10
- puts "Looks like this only works if you run this: ruby -I test test/media/test_media_mount_point.rb"
11
- end
12
+ def test_mount_point_creation
13
+ # x = Storazzo::Media::MountPoint.new
14
+ # assert class inherits from ...
15
+ skip "TODO Code is still missing but TODO implement that this class inherits from **ther class"
16
+ # assert(
17
+ # false,
18
+ # "TODO Code is still missing but TODO implement that this class inherits from **ther class"
19
+ # )
20
+ end
12
21
 
13
- def test_mount_point_creation
14
- #x = Storazzo::Media::MountPoint.new
15
- #assert class inherits from ...
16
- skip "TODO Code is still missing but TODO implement that this class inherits from **ther class"
17
- # assert(
18
- # false,
19
- # "TODO Code is still missing but TODO implement that this class inherits from **ther class"
20
- # )
21
- end
22
-
23
- def test_what_skip_means
24
- skip 'Check for affiliate link, credit card details, pledge history. Foujnd example online. Please Riccardo fix'
25
- end
26
- end
22
+ def test_what_skip_means
23
+ skip 'Check for affiliate link, credit card details, pledge history. Foujnd example online. Please Riccardo fix'
24
+ end
25
+ end
@@ -2,16 +2,15 @@ require "minitest/autorun"
2
2
  require "storazzo"
3
3
 
4
4
  class RicDiskTest < Minitest::Test
5
-
6
- def test_factory_works_for_gcs
7
- rd1 = Storazzo::RicDisk.new('/tmp')
8
- hash = rd1.to_verbose_s()
9
- pp hash
10
- assert_equal(
11
- hash.class,
12
- Hash,
13
- "rd1.to_verbose_s should return a Hash"
14
- )
15
- end
16
-
17
- end
5
+ def TODO_test_factory_works_for_gcs
6
+ # actual_list = Storazzo::RicDisk::GcsBucket.list_all($sample_config_obj)
7
+ 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()
9
+ pp hash
10
+ assert_equal(
11
+ hash.class,
12
+ Hash,
13
+ "rd1.to_verbose_s should return a Hash"
14
+ )
15
+ end
16
+ end
@@ -1,33 +1,29 @@
1
1
  =begin
2
2
  to just test this file, try:
3
-
4
- `ruby -I test test/test_ric_disk_config.rb`
5
-
3
+
4
+ `ruby -I test test/test_ric_disk_config.rb`
5
+
6
6
  =end
7
7
 
8
8
  require "minitest/autorun"
9
9
  require "storazzo"
10
10
 
11
-
12
11
  class RicDiskConfigTest < Minitest::Test
12
+ include Storazzo::Common
13
13
 
14
- include Storazzo::Common
15
-
16
- def test_load_sample_version # test_sample_config_is_within_gems_boundaries
17
- #config_obj = Storazzo::RicDiskConfig.instance()
18
- #puts :sofar_so_good
19
- config_obj = Storazzo::RicDiskSampleConfig.instance()
20
- puts "config_obj.class: #{config_obj.class}"
21
- config = config_obj.load # _sample_version
22
- pverbose true, "[test_load_sample_version] Config: #{pp config}"
23
- #puts '[RicDiskConfigTest] TODO lets make sure the gem being imported is actually in /etc/storazz-config.smaple blah blah'
24
- #puts "[RicDiskConfigTest] config_file: ", config_obj.config_file
25
- assert_equal(
26
- config_obj.config_file,
27
- Storazzo.root + "/etc/storazzo_config.sample.yaml",
28
- "Config file expected to be here.."
29
- )
30
- end
31
-
32
-
33
- end
14
+ def test_load_sample_version # test_sample_config_is_within_gems_boundaries
15
+ # config_obj = Storazzo::RicDiskConfig.instance()
16
+ # puts :sofar_so_good
17
+ config_obj = Storazzo::RicDiskSampleConfig.instance()
18
+ puts "config_obj.class: #{config_obj.class}"
19
+ config = config_obj.load # _sample_version
20
+ pverbose true, "[test_load_sample_version] Config: #{pp config}"
21
+ # puts '[RicDiskConfigTest] TODO lets make sure the gem being imported is actually in /etc/storazz-config.smaple blah blah'
22
+ # puts "[RicDiskConfigTest] config_file: ", config_obj.config_file
23
+ assert_equal(
24
+ config_obj.config_file,
25
+ Storazzo.root + "/etc/storazzo_config.sample.yaml",
26
+ "Config file expected to be here.."
27
+ )
28
+ end
29
+ end
@@ -1,18 +1,17 @@
1
1
  require "storazzo/ric_disk_statsfile"
2
2
 
3
3
  class RicDiskStatsFileTest < Minitest::Test
4
+ def test_version
5
+ version = Storazzo::RicDiskStatsFile.version
6
+ assert(version.is_a?(String),
7
+ "version should produce a bloody string :P")
8
+ end
4
9
 
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
10
+ def test_default_name
11
+ dname = Storazzo::RicDiskStatsFile.default_name
12
+ assert(dname.is_a?(String),
13
+ "DefaultName should produce a bloody string :P")
14
+ end
16
15
  end
17
16
  # module Storazzo
18
17
  # class Storazzo::RicDiskStatsFile
@@ -22,10 +21,10 @@ end
22
21
  # Version = "1.1" # @@version
23
22
 
24
23
  # # AttrAccessor for class - thanks StackOverflow from Android since Im in roaming :)
25
- # class << self
24
+ # class << self
26
25
  # attr_accessor :default_name, :version
27
26
  # end
28
-
27
+
29
28
  # def self.default_name
30
29
  # DefaultName
31
30
  # end
@@ -33,4 +32,4 @@ end
33
32
  # Version
34
33
  # end
35
34
  # end
36
- # end
35
+ # end
@@ -2,33 +2,33 @@ require "minitest/autorun"
2
2
  require "storazzo"
3
3
 
4
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
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
@@ -1,13 +1,13 @@
1
1
  # I fell in love with this: https://stackoverflow.com/questions/9274205/rake-watch-for-changes
2
2
 
3
3
  file 'main.o' => ["main.c", "greet.h"] do
4
- sh "cc -c -o main.o main.c"
4
+ sh "cc -c -o main.o main.c"
5
5
  end
6
6
 
7
7
  file 'greet.o' => ['greet.c'] do
8
- sh "cc -c -o greet.o greet.c"
8
+ sh "cc -c -o greet.o greet.c"
9
9
  end
10
10
 
11
11
  file "hello" => ["main.o", "greet.o"] do
12
- sh "cc -o hello main.o greet.o"
13
- end
12
+ sh "cc -o hello main.o greet.o"
13
+ 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.4.9
4
+ version: 0.5.1
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-31 00:00:00.000000000 Z
11
+ date: 2022-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry