storazzo 0.4.10 → 0.5.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5daaa9b1dd1c5fdb4add46ef4a555e11fc687af712abcdca960dda63f53a9a68
4
- data.tar.gz: 94e3cf858663fbda25ea5c5b88a48a5a739dda68f03d1cd0ae9bc5e6b8931416
3
+ metadata.gz: da35786810823eb035c7077b4e1428ac644a621f31ce6938a1c8e50d911e6734
4
+ data.tar.gz: 9a87268dc0dce5bb2046ce0032ef2c8b59bfad705267ca03ff3ca97f46993d23
5
5
  SHA512:
6
- metadata.gz: 78a52266ddbebde9fde082ba83d99c78dc1d13449c9f43e7616df1dba87f71e0ce2985c5027872b394ae4bbff1627bc9338e1539d1c18c8d39289c433d4bd058
7
- data.tar.gz: bfbf724e1726508fbc714ec1f068771f8f279bb475666137ae43771e26ccb3b4f6a87dd73a383e4404490987a1f756804e6956daed2209fa28d514dc148caa30
6
+ metadata.gz: 8690599753d47f243464c82b05bb949f7ee99d2ab87ccc3d9dee94957c35d89e78981bbf8c61f7f011ff8e72cd07885aaa8e5e6b76c2c7b29820b26bb286b75e
7
+ data.tar.gz: 1a9b7db1f5053701758ed3dd51ef7d6a142db4ba4e2c1c1aa9a5836e808ab5076f7aebeb06807e28170f9ca27600068a50f4847cf12c41402cd372f23bd126d8
data/Gemfile CHANGED
@@ -1,9 +1,10 @@
1
1
  source "https://rubygems.org"
2
2
 
3
3
  # to troubleshoot/debug things
4
- #gem 'rubocop'
4
+ gem 'rubocop'
5
+ gem "ruby-lsp", "~> 0.0.4", :group => :development
5
6
  gem 'rake'
6
- #gem 'pry'
7
+ # gem 'pry'
7
8
  gem 'pry', :group => :development
8
- #gem 'require_all' # yup I'm lazy: https://stackoverflow.com/questions/735073/best-way-to-require-all-files-from-a-directory-in-ruby
9
- #gem 'after_do' # To allow AFTER calling instance to do LOAD() automagically. Naah I can do without :)
9
+ # gem 'require_all' # yup I'm lazy: https://stackoverflow.com/questions/735073/best-way-to-require-all-files-from-a-directory-in-ruby
10
+ # gem 'after_do' # To allow AFTER calling instance to do LOAD() automagically. Naah I can do without :)
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- #require 'rake'
1
+ # require 'rake'
2
2
 
3
3
  # from hola: https://guides.rubygems.org/make-your-own-gem/#adding-an-executable
4
4
  require "rake/testtask"
@@ -9,8 +9,8 @@ Rake::TestTask.new(:test) do |t|
9
9
  t.libs << "test/media"
10
10
  # note this is only useful for this: https://chriskottom.com/articles/command-line-flags-for-minitest-in-the-raw/
11
11
  t.verbose = false
12
- t.warning = false
13
- #puts "[RiccardoOnly]: t.pattern: #{t.pattern}"
12
+ t.warning = false
13
+ # puts "[RiccardoOnly]: t.pattern: #{t.pattern}"
14
14
  t.pattern = 'test/**/test_*.rb'
15
15
  end
16
16
 
@@ -25,7 +25,7 @@ namespace :test do
25
25
  t.libs << "test"
26
26
  t.libs << "test/media"
27
27
  t.verbose = true
28
- t.warning = true
28
+ t.warning = true
29
29
  t.pattern = 'test/**/test_*.rb'
30
30
  $DEBUG = true
31
31
  end
@@ -38,7 +38,7 @@ end
38
38
  # t.pattern = 'test/**/test_*.rb'
39
39
  # end
40
40
  # end
41
- #Rake::Task['test:run'].enhance ["test:media"]
41
+ # Rake::Task['test:run'].enhance ["test:media"]
42
42
 
43
43
  # begin
44
44
  # require 'bundler/setup'
@@ -46,17 +46,14 @@ end
46
46
  # rescue LoadError
47
47
  # puts 'although not required, bundler is recommended for running the tests'
48
48
  # end
49
-
49
+
50
50
  # task default: :spec
51
-
51
+
52
52
  # require 'rspec/core/rake_task'
53
53
  # RSpec::Core::RakeTask.new(:spec)
54
-
54
+
55
55
  # require 'rubocop/rake_task'
56
56
  # RuboCop::RakeTask.new do |task|
57
57
  # task.requires << 'rubocop-performance'
58
58
  # task.requires << 'rubocop-rspec'
59
59
  # end
60
-
61
-
62
-
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.10
1
+ 0.5.2
data/bin/hello-storazzo CHANGED
@@ -3,4 +3,3 @@
3
3
  require 'storazzo'
4
4
 
5
5
  Storazzo::Main.say_hi(ARGV[0])
6
-
data/bin/ricdisk-magic CHANGED
@@ -1,39 +1,35 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
-
4
-
5
- ############# ############# ############# ############# ############# ############# ############# #############
3
+ ############# ############# ############# ############# ############# ############# ############# #############
6
4
  # placeholder until i make it work..
7
5
  # https://guides.rubygems.org/make-your-own-gem/#adding-an-executable
8
- #require 'storazzo'
9
- #require_relative '../lib/storazzo'
6
+ # require 'storazzo'
7
+ # require_relative '../lib/storazzo'
10
8
  require 'fileutils'
11
9
  require 'yaml'
12
10
  require 'socket'
13
- require 'optparse' # http://ruby.about.com/od/advancedruby/a/optionparser.htm
11
+ require 'optparse' # http://ruby.about.com/od/advancedruby/a/optionparser.htm
14
12
 
15
13
  # Including local gem.
16
- #puts File.expand_path(FileUtils.pwd, "/../")
17
- #local_gem_path = File.expand_path(FileUtils.pwd, "/../")
18
- #gem 'storazzo', path: local_gem_path
14
+ # puts File.expand_path(FileUtils.pwd, "/../")
15
+ # local_gem_path = File.expand_path(FileUtils.pwd, "/../")
16
+ # gem 'storazzo', path: local_gem_path
19
17
  require 'storazzo'
20
- #include Storazzo
21
- #include Storazzo::Colors
18
+ # include Storazzo
19
+ # include Storazzo::Colors
22
20
  extend Storazzo::Colors
23
- include Storazzo::Common #instead
24
-
25
-
26
- #puts "First I need to figure out how to bring in all the libraries in here.."
27
- #Storazzo::Main.say_hi("ARGV is: #{ ARGV.join ', '}")
28
- #puts Storazzo.version
29
- ############# ############# ############# ############# ############# ############# ############# #############
21
+ include Storazzo::Common # instead
30
22
 
23
+ # puts "First I need to figure out how to bring in all the libraries in here.."
24
+ # Storazzo::Main.say_hi("ARGV is: #{ ARGV.join ', '}")
25
+ # puts Storazzo.version
26
+ ############# ############# ############# ############# ############# ############# ############# #############
31
27
 
32
28
  # I believe this is wrong
33
- #require 'storazzo'
29
+ # require 'storazzo'
34
30
  # required to have methods wiothout self.
35
- #include 'lib/ric_disk'
36
- #extend Storazzo::Colors
31
+ # include 'lib/ric_disk'
32
+ # extend Storazzo::Colors
37
33
 
38
34
  if RUBY_VERSION.split('.')[0] == 1
39
35
  puts "Refusing to launch a script form Ruby 1. Sorry Ric, its 2020 damn it!"
@@ -41,7 +37,7 @@ if RUBY_VERSION.split('.')[0] == 1
41
37
  end
42
38
 
43
39
  $PROG_VER = '0.4'
44
- $DEBUG = ENV['DEBUG'] == 'true' # (true/false)
40
+ $DEBUG = ENV['DEBUG'] == 'true' # (true/false)
45
41
  # p ENV['DEBUG']
46
42
  # p $DEBUG
47
43
 
@@ -65,24 +61,24 @@ BIG_LONG_MULTILINE
65
61
 
66
62
  =end
67
63
 
68
-
69
64
  $myconf = {
70
- :app_name => "RicDisk Magic should be sth like #{$0}",
71
- :description => "
65
+ :app_name => "RicDisk Magic should be sth like #{$0}",
66
+ :description => "
72
67
  This program is loosely inspired to ricdisk-magic.sh but its much better.
73
- The idea is: iterate through all ARGV elements and build a DB of all files with length and MD5.
68
+ The idea is: iterate through all ARGV elements and build a DB of all files with length and MD5.
74
69
  Then if folder is writeable, put this list INSIDE IT as its so conveniente.
75
- If not, put in a ENV-var-defined folder which defaults to ./.storazzo/ :)
76
-
70
+ If not, put in a ENV-var-defined folder which defaults to ./.storazzo/ :)
71
+
77
72
  And maybe someday - add a nice protobuf and an entity in lib/.
78
73
 
79
74
  Note. This software is part of the Storazzo gem ('sai chi ti saluta un casino?'):
80
75
 
81
76
  $ gem install storazzo
82
77
  ".strip.gsub(/^\s+/, "").gsub(/\s+$/, ""),
83
- # TODO move to some class default
84
- :media_dirs => %w{ /media/riccardo/ /Volumes/ /mnt/ ~/git/storazzo/var/test/ /sobenme/giusto/per/imparare/ad/ammutolire/gli/errori/ },
85
- :mount_types => %w{ vfat ntfs },
78
+ # TODO move to some class default
79
+ :media_dirs => %w{/media/riccardo/ /Volumes/ /mnt/ ~/git/storazzo/var/test/
80
+ /sobenme/giusto/per/imparare/ad/ammutolire/gli/errori/},
81
+ :mount_types => %w{vfat ntfs},
86
82
  }
87
83
  $stats_file = "ricdisk_stats_v11.rds" # => RicDiskStatsFile
88
84
  $gcs_bucket = 'TODO-CHANGE-CONFIG-palladius'
@@ -92,18 +88,17 @@ $gcs_bucket = 'TODO-CHANGE-CONFIG-palladius'
92
88
  # 2022-04-26 2.1.0 Historical momemnt: removed gem 'ric' dependency
93
89
  $TEMPLATE_VER = '2.1.1'
94
90
 
95
-
96
- def usage(comment=nil)
91
+ def usage(comment = nil)
97
92
  puts white($optparse.banner)
98
93
  puts($optparse.summarize)
99
94
  puts("Description: " + gray($myconf[:description]))
100
95
  puts red(comment) if comment
101
- #puts "Description: #{ $myconf[:description] }"
96
+ # puts "Description: #{ $myconf[:description] }"
102
97
  exit 13
103
98
  end
104
99
 
105
100
  # include it in main if you want a custome one
106
- def init() # see lib_autoinit in lib/util.rb
101
+ def init() # see lib_autoinit in lib/util.rb
107
102
  $opts = {}
108
103
  # setting defaults
109
104
  $opts[:verbose] = false
@@ -113,19 +108,19 @@ def init() # see lib_autoinit in lib/util.rb
113
108
 
114
109
  $optparse = OptionParser.new do |opts|
115
110
  opts.banner = "#{$0} v.#{$PROG_VER}\n Usage: #{File.basename $0} [options] file1 file2 ..."
116
- opts.on( '-d', '--debug', 'enables debug (DFLT=false)' ) { $opts[:debug] = true ; $DEBUG = true }
117
- opts.on( '-f', '--force', 'force stuff (DFLT=false)' ) { $opts[:force] = true }
118
- opts.on( '-h', '--help', 'Display this screen' ) { usage }
119
- #opts.on( '-j', '--jabba', 'Activates my Jabber powerful CLI' ) { $opts[:jabba] = true }
120
- opts.on( '-n', '--dryrun', "Don't really execute code" ) { $opts[:dryrun] = true }
121
- opts.on( '-l', '--logfile FILE', 'Write log to FILE' ) {|file| $opts[:logfile] = file }
122
- opts.on( '-v', '--verbose', 'Output more information' ) { $opts[:verbose] = true}
111
+ opts.on('-d', '--debug', 'enables debug (DFLT=false)') { $opts[:debug] = true; $DEBUG = true }
112
+ opts.on('-f', '--force', 'force stuff (DFLT=false)') { $opts[:force] = true }
113
+ opts.on('-h', '--help', 'Display this screen') { usage }
114
+ # opts.on( '-j', '--jabba', 'Activates my Jabber powerful CLI' ) { $opts[:jabba] = true }
115
+ opts.on('-n', '--dryrun', "Don't really execute code") { $opts[:dryrun] = true }
116
+ opts.on('-l', '--logfile FILE', 'Write log to FILE') { |file| $opts[:logfile] = file }
117
+ opts.on('-v', '--verbose', 'Output more information') { $opts[:verbose] = true }
123
118
  end
124
119
  $optparse.parse!
125
120
  end
126
121
 
127
122
  def real_program
128
- deb("Hello world from a templated '#{yellow $0 }'")
123
+ deb("Hello world from a templated '#{yellow $0}'")
129
124
  deb "+ Options are: #{gray $opts}"
130
125
  deb "+ Depured args: #{azure ARGV}"
131
126
  deb "+ Script-specifig super-cool conf: #{green $prog_conf_d}"
@@ -133,50 +128,49 @@ def real_program
133
128
 
134
129
  # Your code goes here...
135
130
  puts white("Hello world from #{$myconf[:app_name]}!")
136
- puts "Description: '''#{white $myconf[:description] }'''"
131
+ puts "Description: '''#{white $myconf[:description]}'''"
137
132
 
138
- config = Storazzo::RicDiskConfig.instance()
133
+ config = Storazzo::RicDiskConfig.instance()
139
134
  config.load
140
135
  puts "StorazzoConfig: #{config}"
141
- #config.load # auto_sbrodola(ARGV)
136
+ # config.load # auto_sbrodola(ARGV)
142
137
  puts yellow("ARGV: #{ARGV}")
143
138
  config.iterate_through_file_list_for_disks(ARGV)
144
139
 
145
140
  # if ARGV == [] # empty -> ALL
146
141
  # dirs = RicDisk.find_active_dirs()
147
- # dirs.each {|dir|
142
+ # dirs.each {|dir|
148
143
  # RicDisk.sbrodola_ricdisk(dir)
149
144
  # RicDisk.calculate_stats_files(dir) # dir is inutile
150
145
  # } # TODO refactor in option sbrodola_afterwards=true. :)
151
146
  # else
152
147
  # deb "I consider ARGV come la lista di directories da parsare :)"
153
148
  # dirs = RicDisk.find_active_dirs()
154
- # ARGV.each{ |dir|
149
+ # ARGV.each{ |dir|
155
150
  # dir = File.expand_path(dir)
156
151
  # if dirs.include?(dir)
157
152
  # deb "Legit dir: #{green dir}"
158
153
  # RicDisk.sbrodola_ricdisk(dir)
159
154
  # RicDisk.calculate_stats_files(dir) # dir is inutile
160
155
  # else
161
- # deb "Figghiu ri buttana: doesnt exist #{red dir}"
156
+ # deb "Figghiu ri buttana: doesnt exist #{red dir}"
162
157
  # end
163
158
  # }
164
159
  # end #/if aRGV
165
-
166
160
  end
167
161
 
168
162
  def main(filename)
169
163
  deb "I'm called by #{white filename}"
170
164
  deb "HISTORY: #{gray HISTORY}"
171
- init # Enable this to have command line parsing capabilities!
172
- puts white("$DEBUG is #{$DEBUG }. Tu turn on, call me with -d") unless $DEBUG
173
- #warn "[warn] template v#{$TEMPLATE_VER }: proviamo il warn che magari depreca il DEB"
165
+ init # Enable this to have command line parsing capabilities!
166
+ puts white("$DEBUG is #{$DEBUG}. Tu turn on, call me with -d") unless $DEBUG
167
+ # warn "[warn] template v#{$TEMPLATE_VER }: proviamo il warn che magari depreca il DEB"
174
168
  real_program
175
169
 
176
- if ($DEBUG)
170
+ if ($DEBUG)
177
171
  puts "First I need to figure out how to bring in all the libraries in here.."
178
- Storazzo::Main.say_hi("ARGV is: #{ ARGV.join ', '}")
179
- puts Storazzo.version
172
+ Storazzo::Main.say_hi("ARGV is: #{ARGV.join ', '}")
173
+ puts Storazzo.version
180
174
  end
181
175
  end
182
176