storazzo 0.4.2 → 0.4.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -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")
@@ -22,7 +20,7 @@ class LocalFolderTest < Minitest::Test
22
20
  include Storazzo::Colors
23
21
  puts yellow("LocalFolderTest: tear up")
24
22
  #$config_useless = Storazzo::RicDiskConfig.instance()
25
- $config = Storazzo::RicDiskSampleConfig.instance()
23
+ $config = Storazzo::RicDiskSampleConfig.safe_instance()
26
24
  $config_load = $config.load()
27
25
  puts $config.to_verbose_s
28
26
 
@@ -46,16 +44,15 @@ class LocalFolderTest < Minitest::Test
46
44
 
47
45
  # To only test this:
48
46
  # $ 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()
47
+ def test_1_first_directory_parsing_actually_works()
50
48
  # include module
51
49
 
52
50
  #p $vediamo_se_funge
53
51
  puts("(#{__FILE__}) WEIRD THING: This test is flaky. SKipping for now until I complete the LocalFolder.parse() code")
54
52
  folders = Storazzo::Media::LocalFolder.list_all
55
53
  puts "Folders: #{folders}"
56
- config = Storazzo::RicDiskSampleConfig.instance()
54
+ config = Storazzo::RicDiskSampleConfig.safe_instance()
57
55
  puts "config1: #{config}"
58
- config.load
59
56
  puts "config2: #{config.load}"
60
57
  test_dir = folders.first
61
58
  puts "test_first_directory_parsing_actually_works() TestDir: #{test_dir}"
@@ -65,7 +62,7 @@ class LocalFolderTest < Minitest::Test
65
62
  stats_file = disk.stats_filename_default_fullpath
66
63
  puts "stats_file: #{stats_file}"
67
64
  disk.parse()
68
- puts "[DEB] config: ''#{config}''"
65
+ deb "config: ''#{config}''"
69
66
  # config.iterate_through_file_list_for_disks([test_dir])
70
67
  # assert(
71
68
  # File.exists?(stats_file),
@@ -78,14 +75,13 @@ class LocalFolderTest < Minitest::Test
78
75
  puts $config
79
76
  end
80
77
 
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")
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")
84
80
  folders = Storazzo::Media::LocalFolder.list_all
85
81
  puts "Folders: #{folders}"
86
- config = Storazzo::RicDiskSampleConfig.instance()
87
- puts "config1: #{config}"
82
+ config = Storazzo::RicDiskSampleConfig.safe_instance()
88
83
  config.load
84
+ puts "config1: #{config}"
89
85
  puts "config2: #{config.load}"
90
86
  test_dir = folders.first
91
87
  puts "test_first_directory_parsing_actually_works() TestDir: #{test_dir}"
@@ -105,11 +101,11 @@ class LocalFolderTest < Minitest::Test
105
101
  )
106
102
  end
107
103
 
108
- def test_readonly_folder
109
- test_dir = "/etc/"
104
+ def test_readonly_directory_creates_configfile_outside_of_dir
105
+ test_dir = "/etc/ssh/"
110
106
  disk = Storazzo::Media::LocalFolder.new(test_dir)
111
107
  stats_file = disk.stats_filename_default_fullpath
112
- config = Storazzo::RicDiskSampleConfig.instance()
108
+ config = Storazzo::RicDiskSampleConfig.safe_instance()
113
109
  config.load
114
110
  config.iterate_through_file_list_for_disks([test_dir])
115
111
  assert(
@@ -118,4 +114,34 @@ class LocalFolderTest < Minitest::Test
118
114
  )
119
115
  # ...
120
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
+ # ...
130
+ 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
+
121
147
  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,18 @@
1
+ require "minitest/autorun"
2
+ require "storazzo"
3
+
4
+ class RicDiskTest < Minitest::Test
5
+
6
+ def TODO_test_factory_works_for_gcs
7
+ #actual_list = Storazzo::RicDisk::GcsBucket.list_all($sample_config_obj)
8
+ rd1 = Storazzo::RicDisk.new('Doesnt accept a string, should be a Gcs Something... Plus why is this test here and not under TestGcsBucket?!?')
9
+ hash = rd1.to_verbose_s()
10
+ pp hash
11
+ assert_equal(
12
+ hash.class,
13
+ Hash,
14
+ "rd1.to_verbose_s should return a Hash"
15
+ )
16
+ end
17
+
18
+ end
@@ -7,24 +7,19 @@
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
20
13
 
14
+ include Storazzo::Common
15
+
21
16
  def test_load_sample_version # test_sample_config_is_within_gems_boundaries
22
17
  #config_obj = Storazzo::RicDiskConfig.instance()
23
18
  #puts :sofar_so_good
24
19
  config_obj = Storazzo::RicDiskSampleConfig.instance()
25
20
  puts "config_obj.class: #{config_obj.class}"
26
21
  config = config_obj.load # _sample_version
27
- puts "Config: #{config}"
22
+ pverbose true, "[test_load_sample_version] Config: #{pp config}"
28
23
  #puts '[RicDiskConfigTest] TODO lets make sure the gem being imported is actually in /etc/storazz-config.smaple blah blah'
29
24
  #puts "[RicDiskConfigTest] config_file: ", config_obj.config_file
30
25
  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
@@ -0,0 +1,22 @@
1
+ # [print_stats_and_md5_for_directory] DIR to explore (make sure you glob also): .
2
+ # DEB Options: {:max_files=>nil, :color=>false, :verbose=>false, :autowrite=>false}
3
+ [file_v1.2] d41d8cd98f00b204e9800998ecf8427e 100644 f 2022-07-30T11:54:42+02:00 0 [text/plain] ./ricdisk_stats_v11.rds
4
+ [file_v1.2] ______________NONE______________ 040755 d 2022-07-28T12:11:48+02:00 200 [inode/directory] ./disk01-empty
5
+ [file_v1.2] ______________NONE______________ 040755 d 2022-07-29T19:00:54+02:00 300 [inode/directory] ./disk02-full
6
+ [file_v1.2] d41d8cd98f00b204e9800998ecf8427e 100644 f 2022-07-24T06:38:25+02:00 0 [inode/x-empty] ./disk02-full/fake file.touch
7
+ [file_v1.2] f344106fac7926960912486256a56af9 100644 f 2022-07-24T06:38:25+02:00 454 [text/plain] ./disk02-full/ls.txt
8
+ [file_v1.2] 437b184a6b045975f0fb6c8c978f28ad 100644 f 2022-07-29T19:01:26+02:00 507 [text/plain] ./disk02-full/Rakefile
9
+ # [print_stats_and_md5_for_directory] DIR to explore (make sure you glob also): ./disk01-empty
10
+ # DEB Options: {:max_files=>nil, :color=>false, :verbose=>false, :autowrite=>false}
11
+ [file_v1.2] f8382af52d00023dc4ee9e9029b367b9 100644 f 2022-07-28T14:30:46+02:00 1022 [text/plain] ./disk01-empty/.ricdisk
12
+ [file_v1.2] d41d8cd98f00b204e9800998ecf8427e 100644 f 2022-07-24T06:38:25+02:00 0 [inode/x-empty] ./disk01-empty/.keep
13
+ # [print_stats_and_md5_for_directory] DIR to explore (make sure you glob also): ./disk02-full
14
+ # DEB Options: {:max_files=>nil, :color=>false, :verbose=>false, :autowrite=>false}
15
+ [file_v1.2] d41d8cd98f00b204e9800998ecf8427e 100644 f 2022-07-24T06:38:25+02:00 0 [inode/x-empty] ./disk02-full/fake file.touch
16
+ [file_v1.2] f344106fac7926960912486256a56af9 100644 f 2022-07-24T06:38:25+02:00 454 [text/plain] ./disk02-full/ls.txt
17
+ [file_v1.2] 437b184a6b045975f0fb6c8c978f28ad 100644 f 2022-07-29T19:01:26+02:00 507 [text/plain] ./disk02-full/Rakefile
18
+ [file_v1.2] d41d8cd98f00b204e9800998ecf8427e 100644 f 2022-07-24T06:38:25+02:00 0 [inode/x-empty] ./disk02-full/.ricdisk
19
+ [file_v1.2] d41d8cd98f00b204e9800998ecf8427e 100644 f 2022-07-24T06:38:25+02:00 0 [inode/x-empty] ./disk02-full/fake file.touch
20
+ [file_v1.2] f344106fac7926960912486256a56af9 100644 f 2022-07-24T06:38:25+02:00 454 [text/plain] ./disk02-full/ls.txt
21
+ [file_v1.2] 437b184a6b045975f0fb6c8c978f28ad 100644 f 2022-07-29T19:01:26+02:00 507 [text/plain] ./disk02-full/Rakefile
22
+ # [stats-with-md5] Time taken for processing 15 files: 0.35655
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.2
4
+ version: 0.4.10
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-29 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2022-08-05 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,14 +62,21 @@ files:
46
62
  - lib/storazzo/ric_disk_ugly.rb
47
63
  - lib/storazzo/version.rb
48
64
  - storazzo.gemspec
49
- - test/test_gcs_bucket.rb
50
- - test/test_local_folder.rb
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
@@ -80,9 +103,14 @@ summary: storazzo is an amazing gem. Code is in https://github.com/palladius/sto
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/test_local_folder.rb
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