storazzo 0.3.8 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +4 -2
- data/Makefile +14 -1
- data/README.md +18 -0
- data/Rakefile +33 -3
- data/VERSION +1 -1
- data/bin/ricdisk-magic +0 -1
- data/bin/stats-with-md5 +394 -0
- data/lib/storazzo/common.rb +28 -5
- data/lib/storazzo/media/abstract_ric_disk.rb +34 -7
- data/lib/storazzo/media/gcs_bucket.rb +4 -2
- data/lib/storazzo/media/local_folder.rb +8 -10
- data/lib/storazzo/media/mount_point.rb +5 -0
- data/lib/storazzo/ric_disk.rb +97 -37
- data/lib/storazzo/ric_disk_config.rb +52 -38
- data/lib/storazzo/ric_disk_sample_config.rb +2 -6
- data/lib/storazzo/ric_disk_statsfile.rb +0 -1
- data/lib/storazzo/ric_disk_ugly.rb +245 -245
- data/lib/storazzo.rb +10 -5
- data/storazzo.gemspec +5 -3
- data/test/media/test_abstract_ric_disk.rb +3 -0
- data/test/{test_gcs_bucket.rb → media/test_gcs_bucket.rb} +21 -22
- data/test/{test_local_folder.rb → media/test_local_folder.rb} +68 -12
- data/test/media/test_mount_point.rb +26 -0
- data/test/test_ric_disk.rb +19 -0
- data/test/test_ric_disk_config.rb +1 -8
- 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
- metadata +32 -6
@@ -1,18 +1,16 @@
|
|
1
1
|
require "minitest/autorun"
|
2
2
|
require "storazzo"
|
3
|
+
require 'storazzo/common'
|
3
4
|
require "storazzo/ric_disk"
|
4
5
|
require "storazzo/ric_disk_config"
|
5
6
|
require 'storazzo/colors'
|
6
7
|
require "storazzo/media/local_folder"
|
7
8
|
|
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
9
|
class LocalFolderTest < Minitest::Test
|
15
|
-
include Storazzo::Colors
|
10
|
+
# include Storazzo::Colors
|
11
|
+
# include Storazzo::Common
|
12
|
+
include Storazzo::Common
|
13
|
+
|
16
14
|
# def test_fail_on_purpOSE # test_storazzo_hi_with_argument
|
17
15
|
# assert_match 42, 42 , "change me when it failes from makefile"
|
18
16
|
# #"Hello from Storazzo", Storazzo::Main.hi("ruby this should fail")
|
@@ -21,8 +19,11 @@ class LocalFolderTest < Minitest::Test
|
|
21
19
|
def tear_up
|
22
20
|
include Storazzo::Colors
|
23
21
|
puts yellow("LocalFolderTest: tear up")
|
24
|
-
#$
|
25
|
-
|
22
|
+
#$config_useless = Storazzo::RicDiskConfig.instance()
|
23
|
+
$config = Storazzo::RicDiskSampleConfig.instance()
|
24
|
+
$config_load = $config.load()
|
25
|
+
puts $config.to_verbose_s
|
26
|
+
|
26
27
|
# my_class = Storazzo::RicDisk::LocalFolder
|
27
28
|
# my_obj = Storazzo::RicDisk::LocalFolder
|
28
29
|
end
|
@@ -43,7 +44,7 @@ class LocalFolderTest < Minitest::Test
|
|
43
44
|
|
44
45
|
# To only test this:
|
45
46
|
# $ ruby -I test test/test_local_folder.rb -n test_first_directory_parsing_actually_works
|
46
|
-
def
|
47
|
+
def TODO_test_1_first_directory_parsing_actually_works()
|
47
48
|
# include module
|
48
49
|
|
49
50
|
#p $vediamo_se_funge
|
@@ -62,7 +63,7 @@ class LocalFolderTest < Minitest::Test
|
|
62
63
|
stats_file = disk.stats_filename_default_fullpath
|
63
64
|
puts "stats_file: #{stats_file}"
|
64
65
|
disk.parse()
|
65
|
-
|
66
|
+
deb "config: ''#{config}''"
|
66
67
|
# config.iterate_through_file_list_for_disks([test_dir])
|
67
68
|
# assert(
|
68
69
|
# File.exists?(stats_file),
|
@@ -70,7 +71,12 @@ class LocalFolderTest < Minitest::Test
|
|
70
71
|
# )
|
71
72
|
end
|
72
73
|
|
73
|
-
def
|
74
|
+
def test_vars_transporeted_across_teraup_and_tests
|
75
|
+
puts $config_load
|
76
|
+
puts $config
|
77
|
+
end
|
78
|
+
|
79
|
+
def TODO_test_2_iterate_through_file_list_for_disks
|
74
80
|
#p $vediamo_se_funge
|
75
81
|
puts("(#{__FILE__}) WEIRD THING: This test is flaky. SKipping for now until I complete the LocalFolder.parse() code")
|
76
82
|
folders = Storazzo::Media::LocalFolder.list_all
|
@@ -96,4 +102,54 @@ class LocalFolderTest < Minitest::Test
|
|
96
102
|
"parse on LocalFolder should create file '#{stats_file}'"
|
97
103
|
)
|
98
104
|
end
|
105
|
+
|
106
|
+
def TODO_test_readonly_directory_creates_configfile_outside_of_dir
|
107
|
+
test_dir = "/etc/"
|
108
|
+
disk = Storazzo::Media::LocalFolder.new(test_dir)
|
109
|
+
stats_file = disk.stats_filename_default_fullpath
|
110
|
+
config = Storazzo::RicDiskSampleConfig.instance()
|
111
|
+
config.load
|
112
|
+
config.iterate_through_file_list_for_disks([test_dir])
|
113
|
+
assert(
|
114
|
+
not(File.exists?(stats_file)),
|
115
|
+
"parse on LocalFolder should NOT create file '#{stats_file}' but another in another TODO place"
|
116
|
+
)
|
117
|
+
# ...
|
118
|
+
end
|
119
|
+
|
120
|
+
def test_readonly_directory_is_indeed_readonly
|
121
|
+
test_dir = "/etc/"
|
122
|
+
readonly_rdisk = Storazzo::Media::LocalFolder.new(test_dir)
|
123
|
+
# stats_file = disk.stats_filename_default_fullpath
|
124
|
+
# config = Storazzo::RicDiskSampleConfig.instance()
|
125
|
+
# config.load
|
126
|
+
# config.iterate_through_file_list_for_disks([test_dir])
|
127
|
+
# assert(
|
128
|
+
# not(File.exists?(stats_file)),
|
129
|
+
# "parse on LocalFolder should NOT create file '#{stats_file}' but another in another TODO place"
|
130
|
+
# )
|
131
|
+
#readonly_rdisk = Storazzo::RicDisk.new(test_dir)
|
132
|
+
ppp(readonly_rdisk.to_verbose_s)
|
133
|
+
assert_equal(
|
134
|
+
readonly_rdisk.wr,
|
135
|
+
false,
|
136
|
+
"Folder #{test_dir} is NOT writeble to the author's knowledge."
|
137
|
+
)
|
138
|
+
# ...
|
139
|
+
end
|
140
|
+
|
141
|
+
|
142
|
+
def test_writeable_directory_is_indeed_writeable
|
143
|
+
test_dir = '/tmp/'
|
144
|
+
writeable_rdisk = Storazzo::Media::LocalFolder.new(test_dir)
|
145
|
+
#writeable_rdisk = Storazzo::RicDisk.new(test_dir)
|
146
|
+
assert_equal(
|
147
|
+
writeable_rdisk.wr,
|
148
|
+
true,
|
149
|
+
"Folder #{test_dir} is INDEED writeble to the author's knowledge, although triggers lot of noise."
|
150
|
+
)
|
151
|
+
|
152
|
+
end
|
153
|
+
|
154
|
+
|
99
155
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require "minitest/autorun"
|
2
|
+
require "storazzo"
|
3
|
+
|
4
|
+
#require 'pry' # must install the gem... but you ALWAYS want pry installed anyways
|
5
|
+
|
6
|
+
class MediaMountPointTest < Minitest::Test
|
7
|
+
|
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
|
+
|
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
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require "minitest/autorun"
|
2
|
+
require "storazzo"
|
3
|
+
|
4
|
+
class RicDiskTest < Minitest::Test
|
5
|
+
|
6
|
+
def test_factory_works_for_gcs
|
7
|
+
rd1 = 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
|
+
|
18
|
+
|
19
|
+
end
|
@@ -7,13 +7,6 @@
|
|
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
10
|
|
18
11
|
|
19
12
|
class RicDiskConfigTest < Minitest::Test
|
@@ -24,7 +17,7 @@ class RicDiskConfigTest < Minitest::Test
|
|
24
17
|
config_obj = Storazzo::RicDiskSampleConfig.instance()
|
25
18
|
puts "config_obj.class: #{config_obj.class}"
|
26
19
|
config = config_obj.load # _sample_version
|
27
|
-
|
20
|
+
pverbose true, "[test_load_sample_version] Config: #{pp config}"
|
28
21
|
#puts '[RicDiskConfigTest] TODO lets make sure the gem being imported is actually in /etc/storazz-config.smaple blah blah'
|
29
22
|
#puts "[RicDiskConfigTest] config_file: ", config_obj.config_file
|
30
23
|
assert_equal(
|
@@ -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
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: storazzo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Riccardo Carlesso
|
@@ -9,12 +9,27 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2022-07-29 00:00:00.000000000 Z
|
12
|
-
dependencies:
|
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
|
32
|
+
- stats-with-md5
|
18
33
|
extensions: []
|
19
34
|
extra_rdoc_files: []
|
20
35
|
files:
|
@@ -25,6 +40,7 @@ files:
|
|
25
40
|
- Rakefile
|
26
41
|
- VERSION
|
27
42
|
- bin/ricdisk-magic
|
43
|
+
- bin/stats-with-md5
|
28
44
|
- lib/storazzo.rb
|
29
45
|
- lib/storazzo/colors.rb
|
30
46
|
- lib/storazzo/common.rb
|
@@ -44,12 +60,18 @@ files:
|
|
44
60
|
- lib/storazzo/ric_disk_ugly.rb
|
45
61
|
- lib/storazzo/version.rb
|
46
62
|
- storazzo.gemspec
|
47
|
-
- test/
|
48
|
-
- test/
|
63
|
+
- test/media/test_abstract_ric_disk.rb
|
64
|
+
- test/media/test_gcs_bucket.rb
|
65
|
+
- test/media/test_local_folder.rb
|
66
|
+
- test/media/test_mount_point.rb
|
67
|
+
- test/test_ric_disk.rb
|
49
68
|
- test/test_ric_disk_config.rb
|
50
69
|
- test/test_ric_disk_stats_file.rb
|
51
70
|
- test/test_storazzo.rb
|
71
|
+
- var/dumps/file_stat.linux.yaml
|
72
|
+
- var/dumps/file_stat.macosx.yaml
|
52
73
|
- var/test/README.md
|
74
|
+
- var/test/disks/disk02-full/Rakefile
|
53
75
|
- var/test/disks/disk02-full/fake file.touch
|
54
76
|
- var/test/disks/disk02-full/ls.txt
|
55
77
|
homepage: https://rubygems.org/gems/storazzo
|
@@ -78,9 +100,13 @@ summary: storazzo is an amazing gem. Code is in https://github.com/palladius/sto
|
|
78
100
|
test_files:
|
79
101
|
- test/test_storazzo.rb
|
80
102
|
- test/test_ric_disk_stats_file.rb
|
103
|
+
- test/test_ric_disk.rb
|
81
104
|
- test/test_ric_disk_config.rb
|
82
|
-
- test/test_gcs_bucket.rb
|
83
|
-
- test/
|
105
|
+
- test/media/test_gcs_bucket.rb
|
106
|
+
- test/media/test_mount_point.rb
|
107
|
+
- test/media/test_abstract_ric_disk.rb
|
108
|
+
- test/media/test_local_folder.rb
|
84
109
|
- var/test/README.md
|
85
110
|
- var/test/disks/disk02-full/fake file.touch
|
86
111
|
- var/test/disks/disk02-full/ls.txt
|
112
|
+
- var/test/disks/disk02-full/Rakefile
|