storazzo 0.4.2 → 0.5.0
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.
- checksums.yaml +4 -4
- data/Gemfile +7 -4
- data/Makefile +20 -1
- data/README.md +23 -0
- data/Rakefile +35 -8
- data/VERSION +1 -1
- data/bin/hello-storazzo +5 -0
- data/bin/ricdisk-magic +50 -57
- data/bin/stats-with-md5 +268 -297
- data/lib/storazzo/colors.rb +43 -45
- data/lib/storazzo/common.rb +80 -17
- data/lib/storazzo/debug.rb +5 -8
- data/lib/storazzo/hashify.rb +44 -43
- data/lib/storazzo/main.rb +44 -40
- data/lib/storazzo/media/abstract_ric_disk.rb +163 -104
- data/lib/storazzo/media/gcs_bucket.rb +51 -15
- data/lib/storazzo/media/local_folder.rb +43 -46
- data/lib/storazzo/media/mount_point.rb +12 -2
- data/lib/storazzo/ric_disk.rb +223 -251
- data/lib/storazzo/ric_disk_config.rb +230 -193
- data/lib/storazzo/ric_disk_sample_config.rb +12 -16
- data/lib/storazzo/ric_disk_statsfile.rb +17 -16
- data/lib/storazzo/ric_disk_ugly.rb +35 -38
- data/lib/storazzo/version.rb +7 -7
- data/lib/storazzo.rb +34 -29
- data/storazzo.gemspec +22 -20
- data/test/media/test_abstract_ric_disk.rb +19 -0
- data/test/media/test_gcs_bucket.rb +58 -0
- data/test/media/test_local_folder.rb +145 -0
- data/test/media/test_mount_point.rb +25 -0
- data/test/test_ric_disk.rb +16 -0
- data/test/test_ric_disk_config.rb +20 -29
- data/test/test_ric_disk_stats_file.rb +13 -14
- data/test/test_storazzo.rb +26 -26
- data/var/dumps/file_stat.linux.yaml +15 -0
- data/var/dumps/file_stat.macosx.yaml +15 -0
- data/var/test/disks/disk02-full/Rakefile +13 -0
- data/var/test/disks/ricdisk_stats_v11.rds +11 -0
- metadata +38 -10
- data/test/test_gcs_bucket.rb +0 -70
- data/test/test_local_folder.rb +0 -121
@@ -1,38 +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
|
-
#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
10
|
|
19
11
|
class RicDiskConfigTest < Minitest::Test
|
12
|
+
include Storazzo::Common
|
20
13
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
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
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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
|
data/test/test_storazzo.rb
CHANGED
@@ -2,33 +2,33 @@ require "minitest/autorun"
|
|
2
2
|
require "storazzo"
|
3
3
|
|
4
4
|
class StorazzoTest < Minitest::Test
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
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
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# On Linux:
|
2
|
+
<File::Stat
|
3
|
+
dev=0xfe01,
|
4
|
+
ino=6293055,
|
5
|
+
mode=0100644 (file rw-r--r--),
|
6
|
+
nlink=1,
|
7
|
+
uid=164825 (ricc),
|
8
|
+
gid=89939 (primarygroup),
|
9
|
+
rdev=0x0 (0, 0),
|
10
|
+
size=7,
|
11
|
+
blksize=4096,
|
12
|
+
blocks=8,
|
13
|
+
atime=2022-06-27 08:49:38.586706861 +0200 (1656312578),
|
14
|
+
mtime=2022-03-23 14:28:45 +0100 (1648042125),
|
15
|
+
ctime=2022-05-30 10:12:10.381629305 +0200 (1653898330)>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# On Mac:
|
2
|
+
<File::Stat
|
3
|
+
dev=0x100000f,
|
4
|
+
ino=1247768,
|
5
|
+
mode=0100644 (file rw-r--r--),
|
6
|
+
nlink=1,
|
7
|
+
uid=164825 (ricc),
|
8
|
+
gid=89939 (primarygroup),
|
9
|
+
rdev=0x0 (0, 0),
|
10
|
+
size=564,
|
11
|
+
blksize=4096,
|
12
|
+
blocks=8,
|
13
|
+
atime=2022-03-05 22:36:48.373362127 +0100 (1646516208),
|
14
|
+
mtime=2022-03-05 22:36:48.176789949 +0100 (1646516208),
|
15
|
+
ctime=2022-03-05 22:36:48.176789949 +0100 (1646516208)>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# I fell in love with this: https://stackoverflow.com/questions/9274205/rake-watch-for-changes
|
2
|
+
|
3
|
+
file 'main.o' => ["main.c", "greet.h"] do
|
4
|
+
sh "cc -c -o main.o main.c"
|
5
|
+
end
|
6
|
+
|
7
|
+
file 'greet.o' => ['greet.c'] do
|
8
|
+
sh "cc -c -o greet.o greet.c"
|
9
|
+
end
|
10
|
+
|
11
|
+
file "hello" => ["main.o", "greet.o"] do
|
12
|
+
sh "cc -o hello main.o greet.o"
|
13
|
+
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
|
+
[1;33mNote. 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 :/[0m
|
metadata
CHANGED
@@ -1,21 +1,36 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: storazzo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Riccardo Carlesso
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-07-
|
12
|
-
dependencies:
|
11
|
+
date: 2022-07-31 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: pry
|
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: A simple gem to manage your external hard drives and extract MD5 and
|
14
28
|
common stuff from them.
|
15
29
|
email: name dot surname at popular Google-owned Mail
|
16
30
|
executables:
|
17
31
|
- ricdisk-magic
|
18
32
|
- stats-with-md5
|
33
|
+
- hello-storazzo
|
19
34
|
extensions: []
|
20
35
|
extra_rdoc_files: []
|
21
36
|
files:
|
@@ -25,6 +40,7 @@ files:
|
|
25
40
|
- README.md
|
26
41
|
- Rakefile
|
27
42
|
- VERSION
|
43
|
+
- bin/hello-storazzo
|
28
44
|
- bin/ricdisk-magic
|
29
45
|
- bin/stats-with-md5
|
30
46
|
- lib/storazzo.rb
|
@@ -46,19 +62,26 @@ files:
|
|
46
62
|
- lib/storazzo/ric_disk_ugly.rb
|
47
63
|
- lib/storazzo/version.rb
|
48
64
|
- storazzo.gemspec
|
49
|
-
- test/
|
50
|
-
- test/
|
65
|
+
- test/media/test_abstract_ric_disk.rb
|
66
|
+
- test/media/test_gcs_bucket.rb
|
67
|
+
- test/media/test_local_folder.rb
|
68
|
+
- test/media/test_mount_point.rb
|
69
|
+
- test/test_ric_disk.rb
|
51
70
|
- test/test_ric_disk_config.rb
|
52
71
|
- test/test_ric_disk_stats_file.rb
|
53
72
|
- test/test_storazzo.rb
|
73
|
+
- var/dumps/file_stat.linux.yaml
|
74
|
+
- var/dumps/file_stat.macosx.yaml
|
54
75
|
- var/test/README.md
|
76
|
+
- var/test/disks/disk02-full/Rakefile
|
55
77
|
- var/test/disks/disk02-full/fake file.touch
|
56
78
|
- var/test/disks/disk02-full/ls.txt
|
79
|
+
- var/test/disks/ricdisk_stats_v11.rds
|
57
80
|
homepage: https://rubygems.org/gems/storazzo
|
58
81
|
licenses:
|
59
82
|
- MIT
|
60
83
|
metadata: {}
|
61
|
-
post_install_message:
|
84
|
+
post_install_message:
|
62
85
|
rdoc_options: []
|
63
86
|
require_paths:
|
64
87
|
- lib
|
@@ -74,15 +97,20 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
97
|
version: '0'
|
75
98
|
requirements: []
|
76
99
|
rubygems_version: 3.1.6
|
77
|
-
signing_key:
|
100
|
+
signing_key:
|
78
101
|
specification_version: 4
|
79
102
|
summary: storazzo is an amazing gem. Code is in https://github.com/palladius/storazzo
|
80
103
|
test_files:
|
81
104
|
- test/test_storazzo.rb
|
82
105
|
- test/test_ric_disk_stats_file.rb
|
106
|
+
- test/test_ric_disk.rb
|
83
107
|
- test/test_ric_disk_config.rb
|
84
|
-
- test/test_gcs_bucket.rb
|
85
|
-
- test/
|
108
|
+
- test/media/test_gcs_bucket.rb
|
109
|
+
- test/media/test_mount_point.rb
|
110
|
+
- test/media/test_abstract_ric_disk.rb
|
111
|
+
- test/media/test_local_folder.rb
|
86
112
|
- var/test/README.md
|
113
|
+
- var/test/disks/ricdisk_stats_v11.rds
|
87
114
|
- var/test/disks/disk02-full/fake file.touch
|
88
115
|
- var/test/disks/disk02-full/ls.txt
|
116
|
+
- var/test/disks/disk02-full/Rakefile
|
data/test/test_gcs_bucket.rb
DELETED
@@ -1,70 +0,0 @@
|
|
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 'pry' # must install the gem... but you ALWAYS want pry installed anyways
|
10
|
-
|
11
|
-
#require "storazzo/ric_disk_config"
|
12
|
-
#require "storazzo/ric_disk_sample_config"
|
13
|
-
#require 'storazzo/ric_disk_sample_config' # => NOTHING!!
|
14
|
-
#require 'storazzo/ric_disk_config_sample' # => NOTHING!!
|
15
|
-
|
16
|
-
#require "storazzo/ric_disk"
|
17
|
-
#require "lib/storazzo/ric_disk_sample_config"
|
18
|
-
#require "storazzo/media/local_folder"
|
19
|
-
#require "storazzo/ric_disk/gcs_bucket"
|
20
|
-
#require "storazzo/media/local_folder"
|
21
|
-
|
22
|
-
class GcsBucketTest < Minitest::Test
|
23
|
-
|
24
|
-
include Storazzo::Common
|
25
|
-
|
26
|
-
def setup # tear_up
|
27
|
-
deb "[GcsBucketTest] TEAR_UP with sample Config"
|
28
|
-
#removeme = Storazzo::RicDiskConfig.instance()
|
29
|
-
$sample_config_obj = Storazzo::RicDiskSampleConfig.instance()
|
30
|
-
$sample_config_hash = $sample_config_obj.load()
|
31
|
-
deb "[GcsBucketTest] TEAR_UP config_obj: '''#{$sample_config_obj}'''"
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_buckets_are_the_two_i_know
|
35
|
-
# copied from etc/sample.yaml :)
|
36
|
-
expected_list = %w{
|
37
|
-
gs://my-local-backup/storazzo/backups/
|
38
|
-
gs://my-other-bucket/
|
39
|
-
}
|
40
|
-
actual_list = Storazzo::RicDisk::GcsBucket.list_all($sample_config_obj)
|
41
|
-
assert_equal(
|
42
|
-
expected_list.sort,
|
43
|
-
actual_list.sort,
|
44
|
-
"These are the two lists from Sample Storazzo Config")
|
45
|
-
end
|
46
|
-
|
47
|
-
def test_import_sample_class_correctly
|
48
|
-
#require "storazzo/ric_disk_sample_config" rescue nil
|
49
|
-
#require "storazzo/ric_disk_config"
|
50
|
-
|
51
|
-
#puts Storazzo.class
|
52
|
-
deb " Storazzo.constants: #{ Storazzo.constants}"
|
53
|
-
#puts Storazzo::RicDiskSampleConfig
|
54
|
-
#config_obj = Storazzo::RicDiskSampleConfig.instance()
|
55
|
-
Pry::ColorPrinter.pp($sample_config_obj.to_verbose_s())
|
56
|
-
#pp green(config_obj.to_verbose_s())
|
57
|
-
|
58
|
-
l = $sample_config_obj.load
|
59
|
-
Pry::ColorPrinter.pp(l)
|
60
|
-
|
61
|
-
puts "$sample_config_obj: #{$sample_config_obj}"
|
62
|
-
#config_obj.load # _sample_version
|
63
|
-
end
|
64
|
-
|
65
|
-
|
66
|
-
# def teardown
|
67
|
-
# puts :TEAR_DOWN_TODO
|
68
|
-
# end
|
69
|
-
|
70
|
-
end
|
data/test/test_local_folder.rb
DELETED
@@ -1,121 +0,0 @@
|
|
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
|
-
include 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_useless = Storazzo::RicDiskConfig.instance()
|
25
|
-
$config = Storazzo::RicDiskSampleConfig.instance()
|
26
|
-
$config_load = $config.load()
|
27
|
-
puts $config.to_verbose_s
|
28
|
-
|
29
|
-
# my_class = Storazzo::RicDisk::LocalFolder
|
30
|
-
# my_obj = Storazzo::RicDisk::LocalFolder
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_show_all_shouldnt_fail_and_should_return_a_non_empty_array
|
34
|
-
assert_equal(Array, Storazzo::Media::LocalFolder.list_all.class, "Storazzo::RicDisk::LocalFolder.list_all should return an Array")
|
35
|
-
assert(Storazzo::Media::LocalFolder.list_all.size >0, "Array size should be >0")
|
36
|
-
#puts Storazzo::Media::LocalFolder.list_all
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_list_all_returns_an_array_of_real_directories
|
40
|
-
dirs = Storazzo::Media::LocalFolder.list_all
|
41
|
-
dirs.each do |mydir|
|
42
|
-
assert_equal(String, mydir.class, "Dir should be a String representing an existing directory")
|
43
|
-
assert(File.directory?(mydir), "Dir should be a file of type 'directory'")
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
# To only test this:
|
48
|
-
# $ ruby -I test test/test_local_folder.rb -n test_first_directory_parsing_actually_works
|
49
|
-
def TODO_test_1_first_directory_parsing_actually_works()
|
50
|
-
# include module
|
51
|
-
|
52
|
-
#p $vediamo_se_funge
|
53
|
-
puts("(#{__FILE__}) WEIRD THING: This test is flaky. SKipping for now until I complete the LocalFolder.parse() code")
|
54
|
-
folders = Storazzo::Media::LocalFolder.list_all
|
55
|
-
puts "Folders: #{folders}"
|
56
|
-
config = Storazzo::RicDiskSampleConfig.instance()
|
57
|
-
puts "config1: #{config}"
|
58
|
-
config.load
|
59
|
-
puts "config2: #{config.load}"
|
60
|
-
test_dir = folders.first
|
61
|
-
puts "test_first_directory_parsing_actually_works() TestDir: #{test_dir}"
|
62
|
-
puts yellow "TEST S:M:LF methods: #{folders}" # methods
|
63
|
-
|
64
|
-
disk = Storazzo::Media::LocalFolder.new(test_dir)
|
65
|
-
stats_file = disk.stats_filename_default_fullpath
|
66
|
-
puts "stats_file: #{stats_file}"
|
67
|
-
disk.parse()
|
68
|
-
puts "[DEB] config: ''#{config}''"
|
69
|
-
# config.iterate_through_file_list_for_disks([test_dir])
|
70
|
-
# assert(
|
71
|
-
# File.exists?(stats_file),
|
72
|
-
# "parse on LocalFolder should create file '#{stats_file}'"
|
73
|
-
# )
|
74
|
-
end
|
75
|
-
|
76
|
-
def test_vars_transporeted_across_teraup_and_tests
|
77
|
-
puts $config_load
|
78
|
-
puts $config
|
79
|
-
end
|
80
|
-
|
81
|
-
def TODO_test_2_iterate_through_file_list_for_disks
|
82
|
-
#p $vediamo_se_funge
|
83
|
-
puts("(#{__FILE__}) WEIRD THING: This test is flaky. SKipping for now until I complete the LocalFolder.parse() code")
|
84
|
-
folders = Storazzo::Media::LocalFolder.list_all
|
85
|
-
puts "Folders: #{folders}"
|
86
|
-
config = Storazzo::RicDiskSampleConfig.instance()
|
87
|
-
puts "config1: #{config}"
|
88
|
-
config.load
|
89
|
-
puts "config2: #{config.load}"
|
90
|
-
test_dir = folders.first
|
91
|
-
puts "test_first_directory_parsing_actually_works() TestDir: #{test_dir}"
|
92
|
-
puts "TEST S:M:LF methods: #{folders}" # methods
|
93
|
-
|
94
|
-
disk = Storazzo::Media::LocalFolder.new(test_dir)
|
95
|
-
stats_file = disk.stats_filename_default_fullpath
|
96
|
-
#puts "stats_file: #{stats_file}"
|
97
|
-
#disk.parse()
|
98
|
-
#puts "[DEB] config: ''#{config}''"
|
99
|
-
|
100
|
-
#TEST2: config + iterate
|
101
|
-
config.iterate_through_file_list_for_disks([test_dir])
|
102
|
-
assert(
|
103
|
-
File.exists?(stats_file),
|
104
|
-
"parse on LocalFolder should create file '#{stats_file}'"
|
105
|
-
)
|
106
|
-
end
|
107
|
-
|
108
|
-
def test_readonly_folder
|
109
|
-
test_dir = "/etc/"
|
110
|
-
disk = Storazzo::Media::LocalFolder.new(test_dir)
|
111
|
-
stats_file = disk.stats_filename_default_fullpath
|
112
|
-
config = Storazzo::RicDiskSampleConfig.instance()
|
113
|
-
config.load
|
114
|
-
config.iterate_through_file_list_for_disks([test_dir])
|
115
|
-
assert(
|
116
|
-
not(File.exists?(stats_file)),
|
117
|
-
"parse on LocalFolder should NOT create file '#{stats_file}' but another in another TODO place"
|
118
|
-
)
|
119
|
-
# ...
|
120
|
-
end
|
121
|
-
end
|