storazzo 0.3.8 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,10 +3,12 @@ module Storazzo::Media
3
3
  class Storazzo::RicDisk::GcsBucket
4
4
 
5
5
 
6
- def self.list_all
6
+ def self.list_all(config=nil)
7
7
  # get lisrts from Config singletone
8
8
  #puts " self.list_all: loading config "
9
- config = Storazzo::RicDiskConfig.instance # # ).get_config
9
+ config ||= Storazzo::RicDiskConfig.instance # # ).get_config
10
+
11
+ config.load # in case I need to load it for the first time
10
12
  #puts config['Config']['AdditionalMountDirs']
11
13
  #puts "TODO see config: #{config}"
12
14
  #[42, 43]
@@ -3,28 +3,26 @@
3
3
 
4
4
  module Storazzo::Media
5
5
  class Storazzo::Media::LocalFolder < Storazzo::Media::AbstractRicDisk
6
+ #extend Storazzo::Common
7
+ include Storazzo::Common
6
8
 
7
9
  attr_accessor :local_mountpoint, :wr
8
10
 
9
11
  def initialize(local_mount)
10
- puts "[Storazzo::Media::LocalFolder] initialize"
12
+ deb "[Storazzo::Media::LocalFolder] initialize"
11
13
 
12
14
  @local_mountpoint = File.expand_path(local_mount)
13
15
  raise "Sorry local mount doesnt exist!" unless File.exist?(@local_mountpoint)
14
16
  @wr = File.writable?(stats_filename_default_fullpath) # .writeable? stats_file_smart_fullpath
15
17
 
16
18
  #super.initialize(local_mount) rescue "SUPER_ERROR: #{$!}"
17
- super(local_mount) rescue "SUPER_ERROR: #{$!}"
19
+ super(local_mount) rescue "SUPER_ERROR(#{local_mount}): #{$!}"
18
20
  end
19
21
 
20
- def self.list_all
21
- # get lisrts from Config singletone
22
- #puts " self.list_all: loading config "
23
- config = Storazzo::RicDiskConfig.instance # # ).get_config
24
- #puts config['Config']['AdditionalMountDirs']
25
- #puts "TODO see config: #{config}"
26
- #[42, 43]
27
- #deb config.get_local_folders
22
+ def self.list_all(config=nil)
23
+ # get lists from Config singleton
24
+ config ||= Storazzo::RicDiskConfig.instance # # ).get_config
25
+ config.load
28
26
  config.get_local_folders
29
27
  end
30
28
 
@@ -1,4 +1,9 @@
1
1
  # TODO
2
+ module Storazzo::Media
3
+ class Storazzo::Media::MountPoint < Storazzo::Media::AbstractRicDisk
4
+ puts "[REMOVEME] Storazzo::Media::MountPoint being read. REMOVEME when you see this :)"
5
+ end
6
+ end
2
7
 
3
8
  # def writeable?
4
9
  #File.writable?(@local_mountpoint)
@@ -21,7 +21,7 @@ module Storazzo
21
21
  RicdiskVersion = '2.1'
22
22
  RicdiskHistory = [
23
23
  '2022-07-29 2.1 Added timestamp',
24
- '2022-07-28 2.0 Added tags, siz, unique_hash, cmputation_hostname, wr, ...',
24
+ '2022-07-28 2.0 Added tags, siz, unique_hash, computation_hostname, wr, ...',
25
25
  ]
26
26
  DefaultGemfileTestDiskFolder = Storazzo.root + "/var/test/disks/" # was: @@default_gemfile_test_disks_folder
27
27
  # Immutable
@@ -40,10 +40,21 @@ module Storazzo
40
40
  ## INSTANCE methods
41
41
  ################################
42
42
 
43
+ def initialize_old_way(path, opts={})
44
+ raise "Now I dont want a string in input, I want an OBJECT < Storazzo::Media::AbstractRicDisk"
45
+ end
46
+
43
47
 
44
- def initialize(path, opts={})
48
+ def initialize(ric_disk_object, opts={})
49
+ verbose = opts.fetch :verbose, true
50
+ pverbose verbose, "This needs an object of type Storazzo::Media::AbstractRicDisk now (this case: #{ric_disk_object.class})"
51
+ raise "Woopsie, not a Storazzo::Media::AbstractRicDisk! Intead its a #{ric_disk_object.class}" unless ric_disk_object.class.superclass == Storazzo::Media::AbstractRicDisk
52
+ # ok back to business, now path is a String :)
53
+ path = ric_disk_object.path
54
+ deb "RicDisk initialize.. path=#{path}"
45
55
  deb "RicDisk initialize.. path=#{path}"
46
56
  @local_mountpoint = File.expand_path(path)
57
+ @ard = ric_disk_object # AbstractRicDiskObject
47
58
  @description = "This is an automated RicDisk description from v.#{RicdiskVersion}. Created on #{Time.now}'"
48
59
  @ricdisk_version = RicdiskVersion
49
60
  @ricdisk_file = compute_ricdisk_file() # Storazzo::RicDisk.get_ricdisk_file(path)
@@ -53,7 +64,7 @@ module Storazzo
53
64
  #@wr = File.writable?("#{path}/#{ricdisk_file}" ) # .writeable?
54
65
  #@wr = writeable?
55
66
  @tags = ['ricdisk', 'storazzo']
56
- @size = `du -s '#{path}'`.split(/\s/)[0] # self.size
67
+ @size = _compute_size_could_take_long(path)
57
68
  @unique_hash = "MD5::" + Digest::MD5.hexdigest(File.expand_path(path)) # hash = Digest::MD5.hexdigest(File.expand_path(get_local_mountpoint))
58
69
  @computation_hostname = Socket.gethostname
59
70
  @created_at = Time.now
@@ -91,18 +102,31 @@ module Storazzo
91
102
  end
92
103
 
93
104
  def to_s
94
- "RicDisk(paz=#{path}, r/w=#{writeable?}, size=#{size}B, f=#{ricdisk_file}, v#{ricdisk_version})"
105
+ "RicDisk(paz=#{path}, r/w=#{writeable?}, size=#{size}B, f=#{ricdisk_file}, v#{ricdisk_version}, ard=#{@ard})"
95
106
  end
96
107
 
97
108
  # could take long..
98
109
  # def size
99
110
  # `du -s '#{path}'`.split(/\s/)[0]
100
111
  # end
112
+ def self._compute_size_could_take_long(my_path)
113
+ deb "Could take long. TODO(ricc): add some sort of cutoff/timeout to 5 seconds."
114
+ puts azure('could take long')
115
+ `du -s '#{my_path}' 2>/dev/null`.chomp.split(/\s/)[0] # self.size
116
+ end
101
117
 
102
118
  def writeable?()
119
+ #memoize
103
120
  return @wr unless @wr.nil?
104
- # Otherwise I can do an EXPENSIVE calculation
105
- puts yellow("TODO(ricc): Do expensive calculation if this FS is writeable: #{path}")
121
+ # NOW: CALCULATE it
122
+ # Now I can do ONCE an EXPENSIVE calculation
123
+ puts yellow("[RicDisk.writeable] TODO(ricc): Do expensive calculation if this FS is writeable: #{path} and write/memoize it on @wr once and for all")
124
+ puts yellow("[RicDisk.writeable] I have a feeling this should be delegated to praecipuus Storazzo::Media::Object we refer to (WR is different on GCS vs Local):") # infinite loop dammit #{self.to_verbose_s}")
125
+ puts("Dir: #{ azure path}")
126
+ puts("absolute_path: #{azure absolute_path}")
127
+ puts("File.writable?(absolute_path): #{azure File.writable?(absolute_path)}")
128
+ bash_output = `if [ -w "#{absolute_path}" ]; then echo "WRITABLE"; else echo "NOT WRITABLE"; fi`
129
+ puts("bash_output: #{azure bash_output}")
106
130
  #@wr = File.writable?(File.expand_path(@ricdisk_file)) # rescue false
107
131
  raise "for some reason an important info (ricdisk_file='#{absolute_path}') is missing!" if ricdisk_file.nil?
108
132
  @wr = File.writable?(absolute_path) # rescue false
@@ -111,6 +135,16 @@ module Storazzo
111
135
  #false
112
136
  end
113
137
 
138
+ def to_verbose_s
139
+ h = {}
140
+ h[:to_s] = self.to_s
141
+ h[:wr] = self.wr
142
+ h[:inspect] = self.inspect
143
+ h[:writeable] = self.writeable?
144
+ h[:ard] = @ard
145
+ return h
146
+ end
147
+
114
148
  ################################
115
149
  ## CLASS methods
116
150
  ################################
@@ -154,8 +188,8 @@ module Storazzo
154
188
  x = Dir.glob('*').select {|f| File.directory? f}
155
189
  subdirs = x.map{|subdir| "#{dir}#{subdir}"}
156
190
  subdirs.each{|subdir|
157
- puts "DEB Subdir: #{subdir}"
158
- puts `ls -al "#{subdir}"`
191
+ deb "Subdir: #{subdir}"
192
+ puts `ls -al "#{subdir}"` # TODO refactor in exec
159
193
  active_dirs << subdir if ok_dir? # self.ok_dir?(subdir)
160
194
  }
161
195
  #puts(white x)
@@ -173,7 +207,7 @@ module Storazzo
173
207
  deb "[CACHE HIT] ricdisk_file (didnt have to recompute it - yay!)"
174
208
  return @ricdisk_file
175
209
  end
176
- warn "RICC_WARNING This requires cmputation I wanna do it almost once"
210
+ deb "[compute_ricdisk_file] RICC_WARNING This requires cmputation I wanna do it almost once"
177
211
  ConfigFiles.each do |papable_config_filename|
178
212
  #return ".ricdisk.yaml" if File.exist?("#{path}/.ricdisk.yaml") #and File.empty?( "#{path}/.ricdisk.yaml")
179
213
  #return ".ricdisk" if File.exist?("#{path}/.ricdisk") # and File.empty?( "#{path}/.ricdisk")
@@ -222,13 +256,13 @@ module Storazzo
222
256
  end
223
257
 
224
258
  # maybe move to a RiccFile class? Maybe even INHERIT from FILE?
225
- def self.obsolescence_seconds file_path
259
+ def obsolescence_seconds(file_path)
226
260
  creation_time = File.stat(file_path).ctime
227
261
  deb("[obsolescence_seconds] File #{file_path}: #{creation_time} - #{(Time.now - creation_time)} seconds ago")
228
262
  (Time.now - creation_time).to_i
229
263
  end
230
264
  # maybe move to a RiccFile class? Maybe even INHERIT from FILE?
231
- def self.obsolescence_days(file_path)
265
+ def obsolescence_days(file_path)
232
266
  return obsolescence_seconds(file_path) / 86400
233
267
  end
234
268
 
@@ -239,7 +273,7 @@ module Storazzo
239
273
  # given a path, if .ricdisk exists i do stuff with it..
240
274
  disk_info = nil
241
275
  unless ok_dir? # self.ok_dir?(subdir)
242
- puts("[write_config_yaml_to_disk] Nothing for me here: '#{subdir}'. Existing")
276
+ warn("[write_config_yaml_to_disk] Nothing for me here: '#{subdir}'. Existing")
243
277
  return
244
278
  end
245
279
  ConfigFiles.each do |papable_configfile_name|
@@ -258,7 +292,7 @@ module Storazzo
258
292
  # puts(yellow disk_info.to_yaml)
259
293
  # end
260
294
  if disk_info.is_a?(RicDisk)
261
- puts yellow("DEB disk_info.class: #{disk_info.class}")
295
+ deb yellow("disk_info.class: #{disk_info.class}")
262
296
  if File.empty?(disk_info.absolute_path) # and (disk_info.wr)
263
297
  puts(green("yay, we can now write the file '#{disk_info.absolute_path}' (which is R/W, I just checked!) with proper YAML content.."))
264
298
  if disk_info.wr
@@ -296,8 +330,32 @@ module Storazzo
296
330
  end
297
331
 
298
332
  def compute_stats_files(opts={})
299
- puts azure("TODO implement natively. Now I'm being lazy")
300
- Storazzo::RicDisk.calculate_stats_files(path, opts)
333
+ puts azure("[compute_stats_files] TODO implement natively. Now I'm being lazy")
334
+ #Storazzo::RicDisk.calculate_stats_files(path, opts)
335
+ opts_upload_to_gcs = opts.fetch :upload_to_gcs, true
336
+ dir = path
337
+
338
+ full_file_path = "#{dir}/#{$stats_file}"
339
+ #return "This refactor is for another day"
340
+
341
+ puts("compute_stats_files(#{white dir}): #{white full_file_path}")
342
+ puts "TEST1 DIR EXISTS: #{dir} -> #{File.directory? dir}"
343
+ Dir.chdir(dir)
344
+ if File.exists?(full_file_path) and ($opts[:force] == false)
345
+ puts "File '#{$stats_file}' exists already." # - now should see if its too old, like more than 1 week old"
346
+ # TODO check for file time...
347
+ print "Lines found: #{yellow `wc -l "#{full_file_path}" `.chomp }. File obsolescence (days): #{yellow obsolescence_days(full_file_path)}."
348
+ if obsolescence_days(full_file_path) > 7
349
+ puts("*** ACHTUNG *** FIle is pretty old. You might consider rotating: #{yellow "mv #{full_file_path} #{full_file_path}_old"}. Or invoke with --force")
350
+ end
351
+ upload_to_gcs(full_file_path) if opts_upload_to_gcs
352
+ else
353
+ puts "Crunching data stats from '#{dir}' into '#{$stats_file}' ... please bear with me.. [maybe file didnt exist, maybe $opts[:force] is true]"
354
+ command = "find . -print0 | xargs -0 stats-with-md5 --no-color | tee '#{full_file_path}'"
355
+ puts("[#{`pwd`.chomp}] Executing: #{azure command}")
356
+ ret = backquote_execute(command)
357
+ puts "Done. #{ret.split("\n").count} files processed."
358
+ end
301
359
  end
302
360
 
303
361
 
@@ -307,7 +365,7 @@ module Storazzo
307
365
  opts_upload_to_gcs = opts.fetch :upload_to_gcs, true
308
366
 
309
367
  full_file_path = "#{dir}/#{$stats_file}"
310
- return "This refacgtor is for another day"
368
+ return "This refactor is for another day"
311
369
 
312
370
  puts("calculate_stats_files(#{white dir}): #{white full_file_path}")
313
371
  puts "TEST1 DIR EXISTS: #{dir} -> #{File.directory? dir}"
@@ -322,7 +380,7 @@ module Storazzo
322
380
  upload_to_gcs(full_file_path) if opts_upload_to_gcs
323
381
  else
324
382
  puts "Crunching data stats from '#{dir}' into '#{$stats_file}' ... please bear with me.. [maybe file didnt exist, maybe $opts[:force] is true]"
325
- command = "find . -print0 | xargs -0 stats-with-md5.rb --no-color | tee '#{full_file_path}'"
383
+ command = "find . -print0 | xargs -0 stats-with-md5 --no-color | tee '#{full_file_path}'"
326
384
  puts("[#{`pwd`.chomp}] Executing: #{azure command}")
327
385
  ret = backquote_execute command
328
386
  puts "Done. #{ret.split("\n").count} files processed."
@@ -432,25 +490,27 @@ end #/Module
432
490
 
433
491
 
434
492
 
435
- # def self.backquote_execute(cmd)
436
- # # executed a command wrapped by dryrun though
437
- # return "DRYRUN backquote_execute(#{cmd})" if $opts[:dryrun]
438
- # `#{cmd}`
439
- # end
493
+ def backquote_execute(cmd, opts={})
494
+ dryrun = opts.fetch :dryrun, false
495
+ # executed a command wrapped by dryrun though
496
+ return "DRYRUN backquote_execute(#{cmd})" if dryrun # $opts[:dryrun]
497
+ `#{cmd}`
498
+ end
440
499
 
441
- # def self.upload_to_gcs(file, opts={})
442
- # deb("upload_to_gcs(#{file}). TODO(ricc) after breafast upload to GCS : #{file}")
443
- # mount_name = file.split('/')[-2]
444
- # filename = "#{mount_name}-#{File.basename file}"
445
- # hostname = Socket.gethostname[/^[^.]+/]
446
- # command = "gsutil cp '#{file}' gs://#{$gcs_bucket}/backup/ricdisk-magic/#{ hostname }-#{filename}"
447
- # deb("Command: #{command}")
448
- # ret = backquote_execute(command)
449
- # # if $opts[:debug] do
450
- # # puts "+ Current list of files:"
451
- # # ret = backquote_execute("gsutil ls -al gs://#{$gcs_bucket}/backup/ricdisk-magic/")
452
- # # puts ret
453
- # # end
454
- # ret
455
- # end
500
+ def upload_to_gcs(file, opts={})
501
+ deb("upload_to_gcs(#{file}). TODO(ricc) after breafast upload to GCS : #{file}")
502
+ mount_name = file.split('/')[-2]
503
+ filename = "#{mount_name}-#{File.basename file}"
504
+ hostname = Socket.gethostname[/^[^.]+/]
505
+ command = "gsutil cp '#{file}' gs://#{$gcs_bucket}/backup/ricdisk-magic/#{ hostname }-#{filename}"
506
+ deb("Command: #{command}")
507
+ puts azure("GCS upload disabled until I know if it works :) command='#{command}'")
508
+ ret = backquote_execute(command, :dryrun => true)
509
+ # if $opts[:debug] do
510
+ # puts "+ Current list of files:"
511
+ # ret = backquote_execute("gsutil ls -al gs://#{$gcs_bucket}/backup/ricdisk-magic/")
512
+ # puts ret
513
+ # end
514
+ ret
515
+ end
456
516
 
@@ -1,6 +1,13 @@
1
1
  require 'singleton'
2
2
  require 'yaml'
3
3
 
4
+ #require 'storazzo/media/abstract_ric_disk'
5
+ Dir[File.dirname(__FILE__) + '/../lib/*.rb'].each do |file|
6
+ require File.basename(file, File.extname(file))
7
+ end
8
+ #require_all 'media/directory'
9
+
10
+
4
11
  =begin
5
12
  This is a singleton class. You call me this way..
6
13
  You call me with:
@@ -20,18 +27,16 @@ module Storazzo
20
27
  include Storazzo::Common
21
28
  include Storazzo::Colors
22
29
 
23
- #@@default_config_location = "~/.storazzo.yaml"
24
30
  DefaultConfigLocation = File.expand_path "~/.storazzo.yaml"
25
- # @@default_config_locations = [
26
- # "~/.storazzo.yaml" , # HOME
27
- # "./.storazzo.yaml" , # LOCAL DIR
28
- # ]
31
+
29
32
  DefaultConfigLocations = [
30
33
  File.expand_path("~/.storazzo.yaml") , # HOME
31
34
  File.expand_path("./.storazzo.yaml") , # LOCAL DIR
32
35
  ]
33
- #@@default_gem_location_for_tests
34
- DefaultGemLocationForTests = File.expand_path('../../../', __FILE__) + "/etc/storazzo_config.sample.yaml"
36
+
37
+ DefaultGemLocationForTests =
38
+ File.expand_path('../../../', __FILE__) +
39
+ "/etc/storazzo_config.sample.yaml"
35
40
 
36
41
  attr_accessor :config, :config_file, :load_called
37
42
 
@@ -41,23 +46,22 @@ public
41
46
  verbose = opts.fetch :verbose, false
42
47
 
43
48
  if already_loaded? # and not self.config.nil?
44
- puts "[#{self.class}] VERBOSE load: already loaded" if verbose
49
+ pverbose verbose, "[#{self.class}] VERBOSE load: already loaded"
45
50
  return self.config
46
51
  end
47
-
48
- puts "[VERBOSE] Storazzo::RicDiskConfig.load(): BEGIN " if verbose
52
+ pverbose verbose, "Storazzo::RicDiskConfig.load(): BEGIN"
49
53
  # trying default location
50
54
  raise "DefaultConfigLocation is not a string" unless DefaultConfigLocation.is_a?(String)
51
- possible_locations = DefaultConfigLocations # [ @@default_config_location , "./.storazzo.yaml"]
52
- puts "DEB possible_locations: #{possible_locations}"
53
- if config_path.is_a?(String)
55
+ possible_locations = DefaultConfigLocations # [ default_config_locations .. , "./.storazzo.yaml"]
56
+ deb "[Config.load] Possible Locations: #{possible_locations}"
57
+ if config_path.is_a?(String)
54
58
  #possible_locations = [config_path] + possible_locations # .append()
55
59
  possible_locations = possible_locations.unshift(config_path) # append to front
56
60
  #OR: possible_locations.instert(0, config_path)
57
- puts "[LOAD] possible_locations: #{possible_locations}" if verbose
61
+ pverbose verbose, "[LOAD] possible_locations: #{possible_locations}"
58
62
  end
59
63
  puts "[VERBOSE] Searching these paths in order: #{possible_locations}" if verbose
60
- bug "This is not always an array of sTRINGS."
64
+ #bug "This is not always an array of sTRINGS."
61
65
  raise "possible_locations is not an array" unless possible_locations.is_a?(Array)
62
66
  possible_locations.each do |possible_path|
63
67
  # ASSERT is a string
@@ -90,9 +94,7 @@ public
90
94
 
91
95
  # Obsolete, call another class instead.
92
96
  def load_sample_version
93
- # puts("Warning! We're destroying the world here. We're taking a Singletong and changing the way it behaves by moving the config file by under her feet. Don't be mad at me if this misbehaves. You saw it coming, my friends. This is why I would NEVER hire you as a Software Developer in my Company.")
94
97
  raise "DEPRECATED! USE SampleRicDiskConfig.load() instead!"
95
- # load(DefaultGemLocationForTests, :verbose => true )
96
98
  end
97
99
 
98
100
  def config_ver
@@ -116,6 +118,18 @@ public
116
118
  "POLY_#{self.class}_(ver=#{config_ver}, file=#{config_file}), #{white(size)} bytes" # - config_default_folder=#{self.config_default_folder}"
117
119
  end
118
120
 
121
+ def to_verbose_s
122
+ h = {}
123
+ h[:description] = "This is a Verbose Hash describing a RicDiskConfig or its child RicDiskSampleConfig to understand why it keeps failing.."
124
+ h[:to_s] = self.to_s
125
+ h[:class] = self.class
126
+ h[:file] = __FILE__
127
+ h[:id] = self.object_id
128
+ h[:get_bucket_paths] = self.get_bucket_paths()
129
+ h[:get_local_folders] = self.get_local_folders()
130
+ return h
131
+ end
132
+
119
133
  def get_config(opts={})
120
134
  return load(opts) if @config.nil?
121
135
  @config
@@ -150,7 +164,9 @@ public
150
164
 
151
165
  # UGLY CODE, copipasted from binary for ARGV, ex autosbrodola
152
166
  def iterate_through_file_list_for_disks(files_list=[], opts={})
153
- verbose = opts.fetch :verbose, true
167
+ verbose = opts.fetch :verbose, false
168
+ raise "[iterate_through_file_list_for_disks] Wrong input, I need an array here: #{files_list} " unless files_list.is_a?(Array)
169
+
154
170
  # I decided i wont accept an emopty list, this is not how you use the gem, you lazy XXX!
155
171
  # if files_list == [] # or files_list.nil? # empty -> ALL
156
172
  # deb "iterate_through_file_list_for_disks(): no args provided"
@@ -160,27 +176,25 @@ public
160
176
  # RicDisk.write_config_yaml_to_disk(dir)
161
177
  # RicDisk.calculate_stats_files(dir) # dir is inutile
162
178
  # } # TODO refactor in option sbrodola_afterwards=true. :)
163
- # else
164
- raise "Wrong input: #{files_list} " unless files_list.is_a?(Array)
165
-
166
- puts "iterate_through_file_list_for_disks(): I consider files_list as a list of directories to parse :)" if verbose
167
-
168
- #dirs = RicDisk.find_active_dirs()
169
- files_list.each do |dir|
170
- dir = File.expand_path(dir)
171
- if File.directory?(dir)
172
- #if dirs.include?(dir)
173
- puts "iterate_through_file_list_for_disks() Legit dir: #{green dir}" if verbose
174
- rd = RicDisk.new(dir)
175
- rd.write_config_yaml_to_disk(dir)
176
- #RicDisk.write_config_yaml_to_disk(dir)
177
- #RicDisk.calculate_stats_files (CLASS) => will become OBJECT compute_stats_files
178
- rd.compute_stats_files() # dir is inutile # TODO
179
- else
180
- deb red("Doesnt seem a legit dir to me: #{dir}")
181
- # deb "Figghiu ri buttana: doesnt exist #{red dir}"
182
- end
179
+ # else
180
+ puts "iterate_through_file_list_for_disks(): I consider files_list as a list of directories to parse :)" if verbose
181
+
182
+ #dirs = RicDisk.find_active_dirs()
183
+ files_list.each do |dir|
184
+ dir = File.expand_path(dir)
185
+ if File.directory?(dir)
186
+ #if dirs.include?(dir)
187
+ puts "iterate_through_file_list_for_disks() Legit dir: #{green dir}" if verbose
188
+ rd = RicDisk.new(Storazzo::Media::AbstractRicDisk.DirFactory(dir))
189
+ pverbose true, "RicDisk from Factory (woohoo): #{rd}"
190
+ rd.write_config_yaml_to_disk(dir)
191
+ #RicDisk.write_config_yaml_to_disk(dir)
192
+ #RicDisk.calculate_stats_files (CLASS) => will become OBJECT compute_stats_files
193
+ rd.compute_stats_files() # dir is inutile # TODO
194
+ else
195
+ raise("Doesnt seem a dir to me, quitting: #{dir}")
183
196
  end
197
+ end
184
198
  #end
185
199
  end #/iterate_through_file_list_for_disks
186
200
 
@@ -13,20 +13,16 @@ require_relative "./ric_disk_config"
13
13
  =end
14
14
 
15
15
  module Storazzo
16
-
17
16
  class Storazzo::RicDiskSampleConfig < Storazzo::RicDiskConfig
18
17
  #include Storazzo::Common
19
18
 
20
- #include Singleton
21
-
22
- public
19
+ public
23
20
  def load # _sample_version
24
21
  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
- # super.load DefaultGemLocationForTests #super.load(DefaultGemLocationForTests, :verbose => true )
26
22
  super(DefaultGemLocationForTests, :verbose => false )
27
23
  end
28
24
  def load_sample_version
29
- puts white("[RicDiskSampleConfig] Wheew 2! 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
+ deb white("[RicDiskSampleConfig] Wheew 2! 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.")
30
26
  super(DefaultGemLocationForTests, :verbose => false )
31
27
  end
32
28
  end
@@ -3,7 +3,6 @@
3
3
  module Storazzo
4
4
  class Storazzo::RicDiskStatsFile
5
5
  # Please keep these two in sync, until you fix them and DRY the behaviour.
6
- #@@default_name
7
6
  DefaultName = "ricdisk_stats_v11.rds" # => RicDiskStatsFile
8
7
  Version = "1.1" # @@version
9
8