storazzo 0.4.9 → 0.4.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 927e612eb67cd979a514fd123ad7c693ce89743f6c59b25c51ed71dfdf0a66f4
4
- data.tar.gz: 0f10a5abd99ef8592a34fbc572f94b59828b453b80089838e4ba50bcfb5f5837
3
+ metadata.gz: 5daaa9b1dd1c5fdb4add46ef4a555e11fc687af712abcdca960dda63f53a9a68
4
+ data.tar.gz: 94e3cf858663fbda25ea5c5b88a48a5a739dda68f03d1cd0ae9bc5e6b8931416
5
5
  SHA512:
6
- metadata.gz: 413fc87ce3e29403cce9736dc22152d95ee07dbfe734795403c60a27df5dc5441f497c18a2c51ff49a8b5441cde3433002e741ede8df0cbf5820a44fe0947d33
7
- data.tar.gz: 662d4f33d5638c85954808e9eb574596cc28cbbf6722d3d54bf4b44a08357f88a1780c407b450002c2d0d2d38a8f44bf805c490ec507a6262fd826b5c7b91864
6
+ metadata.gz: 78a52266ddbebde9fde082ba83d99c78dc1d13449c9f43e7616df1dba87f71e0ce2985c5027872b394ae4bbff1627bc9338e1539d1c18c8d39289c433d4bd058
7
+ data.tar.gz: bfbf724e1726508fbc714ec1f068771f8f279bb475666137ae43771e26ccb3b4f6a87dd73a383e4404490987a1f756804e6956daed2209fa28d514dc148caa30
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.9
1
+ 0.4.10
data/bin/stats-with-md5 CHANGED
@@ -110,8 +110,8 @@ def compute_stats_and_md5(file)
110
110
  begin
111
111
  stats = File.stat(file)
112
112
  ret[:stats_object] = stats # TODO deprecate
113
- deb("Stats methods: #{stats.methods.sort.join(', ')}")
114
- deb(stats.ctime)
113
+ #deb("Stats methods: #{stats.methods.sort.join(', ')}")
114
+ #deb(stats.ctime)
115
115
  #puts(stats.birthtime rescue (stats.ctime))
116
116
  # On Mac/Linux: see test/dumps/***.yaml
117
117
  ret[:size] = stats.size
@@ -142,7 +142,7 @@ def compute_stats_and_md5(file)
142
142
  ret
143
143
  end
144
144
 
145
- $print_stats_and_md5_version = "1.1a_220624_F" # files
145
+ $print_stats_and_md5_version = "1.1b_220805_F" # files
146
146
  $print_stats_and_md5_counter = 0
147
147
  $print_stats_and_md5_for_gcs_version = "1.1alpha_220628_G" #GCS bucket
148
148
 
@@ -330,16 +330,22 @@ def autowrite_to_dir_or_gcs(fs_type, path, opts={})
330
330
  return :ok
331
331
  end
332
332
 
333
- def print_stats_and_md5_for_directory(directory_to_explore_recursively, opts={})
334
- puts "# [print_stats_and_md5_for_directory] DIR to explore (make sure you glob also): #{directory_to_explore_recursively }"
335
- puts "# DEB Options: #{opts}"
336
-
333
+ def print_stats_and_md5_for_directory_from_cli(directory_to_explore_recursively, opts={})
334
+ puts "# [print_stats_and_md5_for_directory_from_cli] v#{$print_stats_and_md5_version}] DIR to explore (make sure you glob also): #{directory_to_explore_recursively }"
337
335
  opts_autowrite = opts.fetch :autowrite, false
336
+ opts_verbose = opts.fetch( :verbose, $opts[:verbose])
337
+ opts_debug = opts.fetch :debug, $opts[:debug]
338
+ opts_color = opts.fetch :color, $opts[:color]
339
+ if opts_debug
340
+ puts "# DEB Options1 opts (FUNC) BAD: s #{opts}" # probably useless since this is invoked by CLI and has ful fledged options.
341
+ puts "# DEB Options2 $opts (ARGV) GOOD: #{$opts}" # This is what we ewant in this CLI. TODO(ricc): if you move this function to be used as function invert the priority...
342
+ puts("# DEB version=#{$print_stats_and_md5_version} host=#{Socket.gethostname}(#{`uname`.chomp}) created_on=#{Time.now}") # if ARGV.size > 0
343
+ end
338
344
 
339
345
  Dir.glob("#{(directory_to_explore_recursively)}/**/*") do |globbed_filename|
340
346
  # Do work on files & directories ending in .rb
341
347
  #puts "[deb] #{globbed_filename}"
342
- print_stats_and_md5(globbed_filename, :color => $opts[:color], :verbose => $opts[:verbose], :autowrite => $opts[:autowrite])
348
+ print_stats_and_md5(globbed_filename, :color => opts_color, :verbose => opts_verbose, :autowrite => opts_autowrite)
343
349
  end
344
350
 
345
351
  autowrite_to_dir_or_gcs(:dir, directory_to_explore_recursively) if opts_autowrite
@@ -365,13 +371,13 @@ def real_program
365
371
  if smells_like_gcs?(directory_to_explore_recursively)
366
372
  print_stats_and_md5_for_gcs(directory_to_explore_recursively, common_opts)
367
373
  else # normal file..
368
- print_stats_and_md5_for_directory(directory_to_explore_recursively, common_opts)
374
+ print_stats_and_md5_for_directory_from_cli(directory_to_explore_recursively, common_opts)
369
375
  end
370
376
  elsif ARGV.size > 1
371
377
  deb "2. I expect a lot of single files or directories:"
372
378
  for arg in ARGV
373
379
  if File.directory?(arg)
374
- print_stats_and_md5_for_directory(arg, common_opts )
380
+ print_stats_and_md5_for_directory_from_cli(arg, common_opts )
375
381
  else
376
382
  print_stats_and_md5(arg, common_opts)
377
383
  end
@@ -381,7 +387,9 @@ def real_program
381
387
  exit 41
382
388
  end
383
389
  tf = Time.now
384
- puts "# [#{File.basename $0}] Time taken for processing #{stats_and_md5_number_of_files_processed} files: #{tf-t0}"
390
+ #rounding to 3 decimals
391
+ approx_delta = (tf-t0).round(3)
392
+ puts "# [#{File.basename $0}] Time taken for processing #{stats_and_md5_number_of_files_processed} files: #{approx_delta} seconds"
385
393
  end
386
394
 
387
395
  def main(filename)
@@ -10,9 +10,9 @@ class AbstractRicDiskTest < Minitest::Test
10
10
 
11
11
  include Storazzo::Common
12
12
 
13
- def test_super_duper_list_all_with_type_returns_something
13
+ def TODO_test_super_duper_list_all_with_type_returns_something
14
14
  deb "This would be already... something :) it means they're all implemented"
15
- ret =
15
+ ret = Storazzo::Media::AbstractRicDisk.super_duper_list_all_with_type
16
16
  assert(
17
17
  ret.class,
18
18
  Array,
@@ -3,8 +3,9 @@ require "storazzo"
3
3
 
4
4
  class RicDiskTest < Minitest::Test
5
5
 
6
- def test_factory_works_for_gcs
7
- rd1 = Storazzo::RicDisk.new('/tmp')
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?!?')
8
9
  hash = rd1.to_verbose_s()
9
10
  pp hash
10
11
  assert_equal(
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.4.9
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-31 00:00:00.000000000 Z
11
+ date: 2022-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry