storazzo 0.3.7 → 0.3.8
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/VERSION +1 -1
 - data/lib/storazzo/ric_disk.rb +60 -22
 - data/lib/storazzo/ric_disk_config.rb +2 -2
 - data/lib/storazzo/ric_disk_sample_config.rb +1 -1
 - data/test/test_gcs_bucket.rb +7 -4
 - data/test/test_local_folder.rb +43 -13
 - data/test/test_storazzo.rb +9 -9
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 7af080e9d4d71c7ceb558b4b4cbd1f13345fa3c4dbea5d6060da8fb9d5b21cc0
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: fe4fd90e12756dbe535e96f0c7c42834ce44c452839890d381a0e43a78ce926e
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 7f753c4e14018803a731de9cf992dcfcf4f4cac601fb0b978de6d16c83c8ab0f06430e0cdd2a203b025a714f168c08f0e6107606b9b354fcf792e0041be8d727
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 072da4e8a2b24fedd83e1cd04b41f695a38a49e623cef5bd1643a11dfc8813604d32c7950976b6b5500839d2a2580293623ab7b32070d9e162db6a753f2d8d02
         
     | 
    
        data/VERSION
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            0.3. 
     | 
| 
      
 1 
     | 
    
         
            +
            0.3.8
         
     | 
    
        data/lib/storazzo/ric_disk.rb
    CHANGED
    
    | 
         @@ -16,8 +16,13 @@ module Storazzo 
     | 
|
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
                # in order of finding, so the first will be the one we actually READ and use. I could looknat the date but cmon...
         
     | 
| 
       18 
18 
     | 
    
         
             
                # These are the files I do accept.
         
     | 
| 
       19 
     | 
    
         
            -
                ConfigFiles = %W{ ricdisk.yaml .ricdisk 
     | 
| 
       20 
     | 
    
         
            -
                 
     | 
| 
      
 19 
     | 
    
         
            +
                ConfigFiles = %W{ ricdisk.yaml .ricdisk storazzo.yaml } 
         
     | 
| 
      
 20 
     | 
    
         
            +
                DefaultConfigFile = "storazzo.yaml" # .ricdisk } 
         
     | 
| 
      
 21 
     | 
    
         
            +
                RicdiskVersion = '2.1'
         
     | 
| 
      
 22 
     | 
    
         
            +
                RicdiskHistory = [
         
     | 
| 
      
 23 
     | 
    
         
            +
                  '2022-07-29 2.1 Added timestamp',
         
     | 
| 
      
 24 
     | 
    
         
            +
                  '2022-07-28 2.0 Added tags, siz, unique_hash, cmputation_hostname, wr, ...',
         
     | 
| 
      
 25 
     | 
    
         
            +
              ]
         
     | 
| 
       21 
26 
     | 
    
         
             
                DefaultGemfileTestDiskFolder = Storazzo.root + "/var/test/disks/" # was: @@default_gemfile_test_disks_folder
         
     | 
| 
       22 
27 
     | 
    
         
             
                # Immutable
         
     | 
| 
       23 
28 
     | 
    
         
             
                DefaultMediaFolders = %w{ 
         
     | 
| 
         @@ -26,7 +31,7 @@ module Storazzo 
     | 
|
| 
       26 
31 
     | 
    
         
             
                 }.append(DefaultGemfileTestDiskFolder ).append("/media/#{ENV["USER"]}/" )
         
     | 
| 
       27 
32 
     | 
    
         | 
| 
       28 
33 
     | 
    
         
             
                 #     # todo substitute with protobuf..
         
     | 
| 
       29 
     | 
    
         
            -
                attr_accessor :name, :description, :ricdisk_file 
     | 
| 
      
 34 
     | 
    
         
            +
                attr_accessor :name, :description, :ricdisk_file, :ricdisk_file_full, :local_mountpoint, :wr, :path, 
         
     | 
| 
       30 
35 
     | 
    
         
             
                              :ricdisk_file_empty, :size, :active_dirs, :ricdisk_version, 
         
     | 
| 
       31 
36 
     | 
    
         
             
                              :unique_hash # new 202207
         
     | 
| 
       32 
37 
     | 
    
         | 
| 
         @@ -38,7 +43,6 @@ module Storazzo 
     | 
|
| 
       38 
43 
     | 
    
         | 
| 
       39 
44 
     | 
    
         
             
                def initialize(path, opts={})
         
     | 
| 
       40 
45 
     | 
    
         
             
                  deb "RicDisk initialize.. path=#{path}"
         
     | 
| 
       41 
     | 
    
         
            -
            #      @local_mountpoint = path
         
     | 
| 
       42 
46 
     | 
    
         
             
                  @local_mountpoint = File.expand_path(path)
         
     | 
| 
       43 
47 
     | 
    
         
             
                  @description = "This is an automated RicDisk description from v.#{RicdiskVersion}. Created on #{Time.now}'"
         
     | 
| 
       44 
48 
     | 
    
         
             
                  @ricdisk_version = RicdiskVersion
         
     | 
| 
         @@ -52,6 +56,7 @@ module Storazzo 
     | 
|
| 
       52 
56 
     | 
    
         
             
                  @size = `du -s '#{path}'`.split(/\s/)[0] # self.size
         
     | 
| 
       53 
57 
     | 
    
         
             
                  @unique_hash = "MD5::" + Digest::MD5.hexdigest(File.expand_path(path)) #   hash = Digest::MD5.hexdigest(File.expand_path(get_local_mountpoint))
         
     | 
| 
       54 
58 
     | 
    
         
             
                  @computation_hostname = Socket.gethostname
         
     | 
| 
      
 59 
     | 
    
         
            +
                  @created_at = Time.now
         
     | 
| 
       55 
60 
     | 
    
         | 
| 
       56 
61 
     | 
    
         
             
                  @ricdisk_file_empty = ricdisk_file_empty?
         
     | 
| 
       57 
62 
     | 
    
         | 
| 
         @@ -97,8 +102,10 @@ module Storazzo 
     | 
|
| 
       97 
102 
     | 
    
         
             
                def writeable?() 
         
     | 
| 
       98 
103 
     | 
    
         
             
                  return @wr unless @wr.nil? 
         
     | 
| 
       99 
104 
     | 
    
         
             
                  # Otherwise I can do an EXPENSIVE calculation
         
     | 
| 
       100 
     | 
    
         
            -
                  puts "TODO(ricc): Do expensive calculation if this FS is writeable: #{path}"
         
     | 
| 
       101 
     | 
    
         
            -
                   
     | 
| 
      
 105 
     | 
    
         
            +
                  puts yellow("TODO(ricc): Do expensive calculation if this FS is writeable: #{path}")
         
     | 
| 
      
 106 
     | 
    
         
            +
                  #@wr = File.writable?(File.expand_path(@ricdisk_file)) # rescue false
         
     | 
| 
      
 107 
     | 
    
         
            +
                  raise "for some reason an important info (ricdisk_file='#{absolute_path}') is missing!" if ricdisk_file.nil?
         
     | 
| 
      
 108 
     | 
    
         
            +
                  @wr = File.writable?(absolute_path) # rescue false
         
     | 
| 
       102 
109 
     | 
    
         
             
                  return @wr
         
     | 
| 
       103 
110 
     | 
    
         
             
                  #:boh_todo_fix_me_and_compute
         
     | 
| 
       104 
111 
     | 
    
         
             
                  #false
         
     | 
| 
         @@ -123,9 +130,9 @@ module Storazzo 
     | 
|
| 
       123 
130 
     | 
    
         
             
                end
         
     | 
| 
       124 
131 
     | 
    
         | 
| 
       125 
132 
     | 
    
         
             
                def absolute_path
         
     | 
| 
       126 
     | 
    
         
            -
                   
     | 
| 
      
 133 
     | 
    
         
            +
                  #@local_mountpoint + "/" +  @ricdisk_file
         
     | 
| 
      
 134 
     | 
    
         
            +
                  "#{local_mountpoint}/#{ricdisk_file}"
         
     | 
| 
       127 
135 
     | 
    
         
             
                end
         
     | 
| 
       128 
     | 
    
         
            -
             
     | 
| 
       129 
136 
     | 
    
         | 
| 
       130 
137 
     | 
    
         
             
                def self.find_active_dirs(base_dirs=nil, also_mountpoints=true)
         
     | 
| 
       131 
138 
     | 
    
         
             
                  if base_dirs.nil?
         
     | 
| 
         @@ -172,9 +179,26 @@ module Storazzo 
     | 
|
| 
       172 
179 
     | 
    
         
             
                    #return ".ricdisk" if File.exist?("#{path}/.ricdisk") # and File.empty?( "#{path}/.ricdisk")
         
     | 
| 
       173 
180 
     | 
    
         
             
                    return papable_config_filename if File.exist?("#{path}/#{papable_config_filename}") # and File.empty?( "#{path}/.ricdisk")
         
     | 
| 
       174 
181 
     | 
    
         
             
                  end
         
     | 
| 
       175 
     | 
    
         
            -
                   
     | 
| 
      
 182 
     | 
    
         
            +
                  deb "File not found! Neither #{ConfigFiles} exist.."
         
     | 
| 
      
 183 
     | 
    
         
            +
            #      return nil
         
     | 
| 
      
 184 
     | 
    
         
            +
                  return DefaultConfigFile
         
     | 
| 
       176 
185 
     | 
    
         
             
                end
         
     | 
| 
       177 
186 
     | 
    
         | 
| 
      
 187 
     | 
    
         
            +
             
     | 
| 
      
 188 
     | 
    
         
            +
                # def self.compute_ricdisk_file_by_path_once(path)
         
     | 
| 
      
 189 
     | 
    
         
            +
                #   # unless @ricdisk_file.nil?
         
     | 
| 
      
 190 
     | 
    
         
            +
                #   #   deb "[CACHE HIT] ricdisk_file (didnt have to recompute it - yay!)"
         
     | 
| 
      
 191 
     | 
    
         
            +
                #   #   return @ricdisk_file
         
     | 
| 
      
 192 
     | 
    
         
            +
                #   # end
         
     | 
| 
      
 193 
     | 
    
         
            +
                #   warn "RICC_WARNING This requires cmputation I wanna do it almost once"
         
     | 
| 
      
 194 
     | 
    
         
            +
                #   ConfigFiles.each do |papable_config_filename|
         
     | 
| 
      
 195 
     | 
    
         
            +
                #     #return ".ricdisk.yaml" if File.exist?("#{path}/.ricdisk.yaml") #and File.empty?( "#{path}/.ricdisk.yaml")
         
     | 
| 
      
 196 
     | 
    
         
            +
                #     #return ".ricdisk" if File.exist?("#{path}/.ricdisk") # and File.empty?( "#{path}/.ricdisk")
         
     | 
| 
      
 197 
     | 
    
         
            +
                #     return papable_config_filename if File.exist?("#{path}/#{papable_config_filename}") # and File.empty?( "#{path}/.ricdisk")
         
     | 
| 
      
 198 
     | 
    
         
            +
                #   end
         
     | 
| 
      
 199 
     | 
    
         
            +
                #   return nil
         
     | 
| 
      
 200 
     | 
    
         
            +
                # end
         
     | 
| 
      
 201 
     | 
    
         
            +
             
     | 
| 
       178 
202 
     | 
    
         | 
| 
       179 
203 
     | 
    
         
             
                # # new
         
     | 
| 
       180 
204 
     | 
    
         
             
                # def self.get_ricdisk_file_obsolete(path)
         
     | 
| 
         @@ -234,11 +258,16 @@ module Storazzo 
     | 
|
| 
       234 
258 
     | 
    
         
             
                  #   puts(yellow disk_info.to_yaml)
         
     | 
| 
       235 
259 
     | 
    
         
             
                  # end
         
     | 
| 
       236 
260 
     | 
    
         
             
                  if disk_info.is_a?(RicDisk)
         
     | 
| 
       237 
     | 
    
         
            -
                     
     | 
| 
       238 
     | 
    
         
            -
                    if File.empty?(disk_info.absolute_path) and (disk_info.wr)
         
     | 
| 
      
 261 
     | 
    
         
            +
                    puts yellow("DEB disk_info.class: #{disk_info.class}")
         
     | 
| 
      
 262 
     | 
    
         
            +
                    if File.empty?(disk_info.absolute_path) # and (disk_info.wr)
         
     | 
| 
       239 
263 
     | 
    
         
             
                      puts(green("yay, we can now write the file '#{disk_info.absolute_path}' (which is R/W, I just checked!) with proper YAML content.."))
         
     | 
| 
       240 
     | 
    
         
            -
                       
     | 
| 
       241 
     | 
    
         
            -
             
     | 
| 
      
 264 
     | 
    
         
            +
                      if disk_info.wr
         
     | 
| 
      
 265 
     | 
    
         
            +
                        ret = File.write(disk_info.absolute_path, disk_info.obj_to_yaml)
         
     | 
| 
      
 266 
     | 
    
         
            +
                        puts green("Written file! ret=#{ret}")
         
     | 
| 
      
 267 
     | 
    
         
            +
                      else
         
     | 
| 
      
 268 
     | 
    
         
            +
                        raise "TODO_IMPLEMENT: write in proper place in config dir"
         
     | 
| 
      
 269 
     | 
    
         
            +
                        puts red("TODO implement me")
         
     | 
| 
      
 270 
     | 
    
         
            +
                      end
         
     | 
| 
       242 
271 
     | 
    
         
             
                    else
         
     | 
| 
       243 
272 
     | 
    
         
             
                      puts(red("Something not right here: either file is NOT empty or disk is NOT writeable.. #{File.empty?(disk_info.absolute_path)}"))
         
     | 
| 
       244 
273 
     | 
    
         
             
                      puts("File size: #{File.size(disk_info.absolute_path)}")
         
     | 
| 
         @@ -246,28 +275,37 @@ module Storazzo 
     | 
|
| 
       246 
275 
     | 
    
         
             
                      puts(disk_info.obj_to_hash)
         
     | 
| 
       247 
276 
     | 
    
         
             
                      puts(disk_info.obj_to_yaml)
         
     | 
| 
       248 
277 
     | 
    
         
             
                    end
         
     | 
| 
       249 
     | 
    
         
            -
                  else 
         
     | 
| 
      
 278 
     | 
    
         
            +
                  else # not a RicDisk..
         
     | 
| 
       250 
279 
     | 
    
         
             
                    puts "[write_config_yaml_to_disk] No DiskInfo found across #{ConfigFiles}. I leave this function empty-handed."
         
     | 
| 
       251 
280 
     | 
    
         
             
                  end
         
     | 
| 
       252 
     | 
    
         
            -
             
     | 
| 
       253 
     | 
    
         
            -
             
     | 
| 
       254 
     | 
    
         
            -
             
     | 
| 
       255 
     | 
    
         
            -
                   
     | 
| 
       256 
     | 
    
         
            -
             
     | 
| 
       257 
     | 
    
         
            -
             
     | 
| 
       258 
     | 
    
         
            -
                   
     | 
| 
      
 281 
     | 
    
         
            +
             
     | 
| 
      
 282 
     | 
    
         
            +
                  #disk_info.absolute_path
         
     | 
| 
      
 283 
     | 
    
         
            +
                  #if File.exists?( "#{subdir}/.ricdisk") and ! File.empty?( "#{subdir}/.ricdisk")
         
     | 
| 
      
 284 
     | 
    
         
            +
                  # if File.exists?(disk_info.absolute_path) and ! File.empty?(disk_info.absolute_path)
         
     | 
| 
      
 285 
     | 
    
         
            +
                  #   puts("Config File found with old-style name: '#{subdir}/.ricdisk' ! Please move it to .ricdisk.yaml!")
         
     | 
| 
      
 286 
     | 
    
         
            +
                  #   puts(white `cat "#{disk_info.absolute_path}"`)
         
     | 
| 
      
 287 
     | 
    
         
            +
                  # else
         
     | 
| 
      
 288 
     | 
    
         
            +
                  #   puts "WRITING NOW. [I BELIEVE THIS IS DUPE CODE - see a few lines above!] disk_info.obj_to_yaml .. to #{compute_ricdisk_file}"
         
     | 
| 
      
 289 
     | 
    
         
            +
                  #   File.open(ricdisk_file_full, 'w').write(disk_info.obj_to_yaml)
         
     | 
| 
      
 290 
     | 
    
         
            +
                  # end
         
     | 
| 
       259 
291 
     | 
    
         
             
                end
         
     | 
| 
       260 
292 
     | 
    
         | 
| 
       261 
293 
     | 
    
         
             
                # TODO obsolete this as i should NOT be calling it from clas, but from method.
         
     | 
| 
       262 
294 
     | 
    
         
             
                def self.ok_dir?(subdir)
         
     | 
| 
       263 
295 
     | 
    
         
             
                  File.exists?( "#{subdir}/.ricdisk") or File.exists?( "#{subdir}/.ricdisk.yaml")
         
     | 
| 
       264 
296 
     | 
    
         
             
                end
         
     | 
| 
      
 297 
     | 
    
         
            +
             
     | 
| 
      
 298 
     | 
    
         
            +
                def compute_stats_files(opts={})
         
     | 
| 
      
 299 
     | 
    
         
            +
                  puts azure("TODO implement natively. Now I'm being lazy")
         
     | 
| 
      
 300 
     | 
    
         
            +
                  Storazzo::RicDisk.calculate_stats_files(path, opts)
         
     | 
| 
      
 301 
     | 
    
         
            +
                end
         
     | 
| 
       265 
302 
     | 
    
         | 
| 
       266 
303 
     | 
    
         | 
| 
       267 
304 
     | 
    
         | 
| 
       268 
305 
     | 
    
         
             
                # Create RDS file.
         
     | 
| 
       269 
306 
     | 
    
         
             
                def self.calculate_stats_files(dir, opts={})
         
     | 
| 
       270 
     | 
    
         
            -
                  opts_upload_to_gcs = opts.fetch :upload_to_gcs, true 
     | 
| 
      
 307 
     | 
    
         
            +
                  opts_upload_to_gcs = opts.fetch :upload_to_gcs, true
         
     | 
| 
      
 308 
     | 
    
         
            +
                  
         
     | 
| 
       271 
309 
     | 
    
         
             
                  full_file_path = "#{dir}/#{$stats_file}"
         
     | 
| 
       272 
310 
     | 
    
         
             
                  return "This refacgtor is for another day"
         
     | 
| 
       273 
311 
     | 
    
         | 
| 
         @@ -41,7 +41,7 @@ public 
     | 
|
| 
       41 
41 
     | 
    
         
             
                        verbose = opts.fetch :verbose, false
         
     | 
| 
       42 
42 
     | 
    
         | 
| 
       43 
43 
     | 
    
         
             
                        if already_loaded? # and not self.config.nil?
         
     | 
| 
       44 
     | 
    
         
            -
                            puts "[#{self.class}] load: already loaded"
         
     | 
| 
      
 44 
     | 
    
         
            +
                            puts "[#{self.class}] VERBOSE load: already loaded" if verbose
         
     | 
| 
       45 
45 
     | 
    
         
             
                            return self.config
         
     | 
| 
       46 
46 
     | 
    
         
             
                        end
         
     | 
| 
       47 
47 
     | 
    
         | 
| 
         @@ -175,7 +175,7 @@ public 
     | 
|
| 
       175 
175 
     | 
    
         
             
                                    rd.write_config_yaml_to_disk(dir)
         
     | 
| 
       176 
176 
     | 
    
         
             
                                    #RicDisk.write_config_yaml_to_disk(dir)
         
     | 
| 
       177 
177 
     | 
    
         
             
                                    #RicDisk.calculate_stats_files (CLASS) => will become OBJECT compute_stats_files
         
     | 
| 
       178 
     | 
    
         
            -
                                    compute_stats_files( 
     | 
| 
      
 178 
     | 
    
         
            +
                                    rd.compute_stats_files() # dir is inutile # TODO
         
     | 
| 
       179 
179 
     | 
    
         
             
                                else
         
     | 
| 
       180 
180 
     | 
    
         
             
                                    deb red("Doesnt seem a legit dir to me: #{dir}")
         
     | 
| 
       181 
181 
     | 
    
         
             
                                #     deb "Figghiu ri buttana: doesnt exist #{red dir}" 
         
     | 
| 
         @@ -21,7 +21,7 @@ module Storazzo 
     | 
|
| 
       21 
21 
     | 
    
         | 
| 
       22 
22 
     | 
    
         
             
                    public
         
     | 
| 
       23 
23 
     | 
    
         
             
                    def load # _sample_version
         
     | 
| 
       24 
     | 
    
         
            -
                         
     | 
| 
      
 24 
     | 
    
         
            +
                        deb("[RicDiskSampleConfig] Wheew 1! We're NOT destroying the world here. We're actually instancing a second Singleton which is a child of the mother, and this time doing things nicely and Rubily.")
         
     | 
| 
       25 
25 
     | 
    
         
             
            #            super.load DefaultGemLocationForTests #super.load(DefaultGemLocationForTests, :verbose => true )
         
     | 
| 
       26 
26 
     | 
    
         
             
                        super(DefaultGemLocationForTests, :verbose => false )
         
     | 
| 
       27 
27 
     | 
    
         
             
                    end
         
     | 
    
        data/test/test_gcs_bucket.rb
    CHANGED
    
    | 
         @@ -21,24 +21,27 @@ class GcsBucketTest < Minitest::Test 
     | 
|
| 
       21 
21 
     | 
    
         | 
| 
       22 
22 
     | 
    
         
             
                include Storazzo::Common
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
                def  
     | 
| 
      
 24 
     | 
    
         
            +
                def setup # tear_up 
         
     | 
| 
       25 
25 
     | 
    
         
             
                    deb "[GcsBucketTest] TEAR_UP with sample Config"
         
     | 
| 
       26 
26 
     | 
    
         
             
                    #removeme = Storazzo::RicDiskConfig.instance()
         
     | 
| 
       27 
27 
     | 
    
         
             
                    config_obj = Storazzo::RicDiskSampleConfig.instance()
         
     | 
| 
      
 28 
     | 
    
         
            +
                    config_obj.load()
         
     | 
| 
       28 
29 
     | 
    
         
             
                    deb "[GcsBucketTest] TEAR_UP config_obj: '''#{config_obj}'''"
         
     | 
| 
       29 
30 
     | 
    
         
             
                end
         
     | 
| 
       30 
31 
     | 
    
         | 
| 
       31 
     | 
    
         
            -
                def  
     | 
| 
      
 32 
     | 
    
         
            +
                def test_buckets_are_the_two_i_know
         
     | 
| 
       32 
33 
     | 
    
         
             
                    expected_list = %w{
         
     | 
| 
       33 
34 
     | 
    
         
             
                        gs://my-local-backup/storazzo/backups/
         
     | 
| 
       34 
35 
     | 
    
         
             
                        gs://my-other-bucket/
         
     | 
| 
       35 
36 
     | 
    
         
             
                    }
         
     | 
| 
       36 
37 
     | 
    
         
             
                    actual_list = Storazzo::RicDisk::GcsBucket.list_all
         
     | 
| 
       37 
     | 
    
         
            -
                    assert_equal( 
     | 
| 
      
 38 
     | 
    
         
            +
                    assert_equal(
         
     | 
| 
      
 39 
     | 
    
         
            +
                        expected_list.sort, 
         
     | 
| 
      
 40 
     | 
    
         
            +
                        actual_list.sort,
         
     | 
| 
       38 
41 
     | 
    
         
             
                        "These are the two lists from Sample Storazzo Config")
         
     | 
| 
       39 
42 
     | 
    
         
             
                end
         
     | 
| 
       40 
43 
     | 
    
         | 
| 
       41 
     | 
    
         
            -
                def  
     | 
| 
      
 44 
     | 
    
         
            +
                def test_import_sample_class_correctly
         
     | 
| 
       42 
45 
     | 
    
         
             
                    #require "storazzo/ric_disk_sample_config" rescue nil
         
     | 
| 
       43 
46 
     | 
    
         
             
                    #require "storazzo/ric_disk_config"
         
     | 
| 
       44 
47 
     | 
    
         | 
    
        data/test/test_local_folder.rb
    CHANGED
    
    | 
         @@ -11,8 +11,8 @@ require "storazzo/media/local_folder" 
     | 
|
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
            #puts yellow("DISABLING FOR NOW TODO restore")
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
            class LocalFolderTest  
     | 
| 
       15 
     | 
    
         
            -
                 
     | 
| 
      
 14 
     | 
    
         
            +
            class LocalFolderTest < Minitest::Test
         
     | 
| 
      
 15 
     | 
    
         
            +
                include Storazzo::Colors
         
     | 
| 
       16 
16 
     | 
    
         
             
                # def test_fail_on_purpOSE # test_storazzo_hi_with_argument
         
     | 
| 
       17 
17 
     | 
    
         
             
                #     assert_match 42, 42 , "change me when it failes from makefile" 
         
     | 
| 
       18 
18 
     | 
    
         
             
                #     #"Hello from Storazzo", Storazzo::Main.hi("ruby this should fail")
         
     | 
| 
         @@ -43,27 +43,57 @@ class LocalFolderTest # < Minitest::Test 
     | 
|
| 
       43 
43 
     | 
    
         | 
| 
       44 
44 
     | 
    
         
             
                # To only test this:
         
     | 
| 
       45 
45 
     | 
    
         
             
                # $ ruby -I test test/test_local_folder.rb -n test_first_directory_parsing_actually_works
         
     | 
| 
       46 
     | 
    
         
            -
                def  
     | 
| 
      
 46 
     | 
    
         
            +
                def test_1_first_directory_parsing_actually_works()
         
     | 
| 
       47 
47 
     | 
    
         
             
                    # include module 
         
     | 
| 
       48 
48 
     | 
    
         | 
| 
       49 
49 
     | 
    
         
             
                    #p $vediamo_se_funge
         
     | 
| 
       50 
50 
     | 
    
         
             
                    puts("(#{__FILE__}) WEIRD THING: This test is flaky. SKipping for now until I complete the LocalFolder.parse() code")
         
     | 
| 
       51 
51 
     | 
    
         
             
                    folders = Storazzo::Media::LocalFolder.list_all
         
     | 
| 
       52 
52 
     | 
    
         
             
                    puts "Folders: #{folders}"
         
     | 
| 
       53 
     | 
    
         
            -
                    config = Storazzo:: 
     | 
| 
       54 
     | 
    
         
            -
                    puts " 
     | 
| 
      
 53 
     | 
    
         
            +
                    config = Storazzo::RicDiskSampleConfig.instance()
         
     | 
| 
      
 54 
     | 
    
         
            +
                    puts "config1: #{config}"
         
     | 
| 
      
 55 
     | 
    
         
            +
                    config.load
         
     | 
| 
      
 56 
     | 
    
         
            +
                    puts "config2: #{config.load}"
         
     | 
| 
       55 
57 
     | 
    
         
             
                    test_dir = folders.first
         
     | 
| 
       56 
     | 
    
         
            -
                     
     | 
| 
       57 
     | 
    
         
            -
                     
     | 
| 
       58 
     | 
    
         
            -
                     
     | 
| 
       59 
     | 
    
         
            -
                     
     | 
| 
       60 
     | 
    
         
            -
                     
     | 
| 
       61 
     | 
    
         
            -
                    # 
     | 
| 
      
 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()
         
     | 
| 
       62 
65 
     | 
    
         
             
                    puts "[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_2_iterate_through_file_list_for_disks
         
     | 
| 
      
 74 
     | 
    
         
            +
                    #p $vediamo_se_funge
         
     | 
| 
      
 75 
     | 
    
         
            +
                    puts("(#{__FILE__}) WEIRD THING: This test is flaky. SKipping for now until I complete the LocalFolder.parse() code")
         
     | 
| 
      
 76 
     | 
    
         
            +
                    folders = Storazzo::Media::LocalFolder.list_all
         
     | 
| 
      
 77 
     | 
    
         
            +
                    puts "Folders: #{folders}"
         
     | 
| 
      
 78 
     | 
    
         
            +
                    config = Storazzo::RicDiskSampleConfig.instance()
         
     | 
| 
      
 79 
     | 
    
         
            +
                    puts "config1: #{config}"
         
     | 
| 
      
 80 
     | 
    
         
            +
                    config.load
         
     | 
| 
      
 81 
     | 
    
         
            +
                    puts "config2: #{config.load}"
         
     | 
| 
      
 82 
     | 
    
         
            +
                    test_dir = folders.first
         
     | 
| 
      
 83 
     | 
    
         
            +
                    puts "test_first_directory_parsing_actually_works() TestDir: #{test_dir}"
         
     | 
| 
      
 84 
     | 
    
         
            +
                    puts "TEST S:M:LF methods: #{folders}"  # methods
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
      
 86 
     | 
    
         
            +
                    disk = Storazzo::Media::LocalFolder.new(test_dir)
         
     | 
| 
      
 87 
     | 
    
         
            +
                    stats_file = disk.stats_filename_default_fullpath
         
     | 
| 
      
 88 
     | 
    
         
            +
                    #puts "stats_file: #{stats_file}"
         
     | 
| 
      
 89 
     | 
    
         
            +
                    #disk.parse()
         
     | 
| 
      
 90 
     | 
    
         
            +
                    #puts "[DEB] config: ''#{config}''"
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
                    #TEST2: config + iterate
         
     | 
| 
       63 
93 
     | 
    
         
             
                    config.iterate_through_file_list_for_disks([test_dir])
         
     | 
| 
       64 
94 
     | 
    
         
             
                    assert(
         
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
      
 95 
     | 
    
         
            +
                        File.exists?(stats_file),
         
     | 
| 
      
 96 
     | 
    
         
            +
                        "parse on LocalFolder should create file '#{stats_file}'"
         
     | 
| 
       67 
97 
     | 
    
         
             
                    )
         
     | 
| 
       68 
98 
     | 
    
         
             
                end
         
     | 
| 
       69 
99 
     | 
    
         
             
            end
         
     | 
    
        data/test/test_storazzo.rb
    CHANGED
    
    | 
         @@ -1,11 +1,11 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            require "minitest/autorun"
         
     | 
| 
      
 2 
     | 
    
         
            +
            require "storazzo"
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
      
 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 
9 
     | 
    
         
             
            #     def test_storazzo_hi_without_argument
         
     | 
| 
       10 
10 
     | 
    
         
             
            #         assert_match "Hello from Storazzo", Storazzo::Main.say_hi()
         
     | 
| 
       11 
11 
     | 
    
         
             
            #     end
         
     | 
| 
         @@ -30,5 +30,5 @@ 
     | 
|
| 
       30 
30 
     | 
    
         
             
            # #   def test_spanish_hello
         
     | 
| 
       31 
31 
     | 
    
         
             
            # #     assert_equal "hola mundo",
         
     | 
| 
       32 
32 
     | 
    
         
             
            # #       Hola.hi("spanish")
         
     | 
| 
       33 
     | 
    
         
            -
            # 
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
      
 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.3. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.3.8
         
     | 
| 
       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- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2022-07-29 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.
         
     |