storazzo 0.5.7 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +7 -5
  3. data/Makefile +8 -6
  4. data/Rakefile +15 -13
  5. data/VERSION +1 -1
  6. data/bin/hello-storazzo +1 -0
  7. data/bin/ricdisk-magic +33 -30
  8. data/bin/stats-with-md5 +182 -157
  9. data/bin/storazzo +112 -114
  10. data/bin/storazzo-symlink.rb +1 -0
  11. data/lib/storazzo/colors.rb +77 -36
  12. data/lib/storazzo/common.rb +72 -68
  13. data/lib/storazzo/debug.rb +2 -0
  14. data/lib/storazzo/hashify.rb +7 -5
  15. data/lib/storazzo/main.rb +59 -49
  16. data/lib/storazzo/media/abstract_ric_disk.rb +188 -179
  17. data/lib/storazzo/media/gcs_bucket.rb +76 -58
  18. data/lib/storazzo/media/local_folder.rb +56 -42
  19. data/lib/storazzo/media/mount_point.rb +20 -12
  20. data/lib/storazzo/ric_disk.rb +386 -383
  21. data/lib/storazzo/ric_disk_config.rb +227 -209
  22. data/lib/storazzo/ric_disk_sample_config.rb +26 -24
  23. data/lib/storazzo/ric_disk_statsfile.rb +19 -17
  24. data/lib/storazzo/ric_disk_ugly.rb +1 -0
  25. data/lib/storazzo/version.rb +3 -3
  26. data/lib/storazzo.rb +6 -7
  27. data/storazzo.gemspec +24 -16
  28. data/test/benchmark/for_future_use.rb +4 -2
  29. data/test/benchmark/test_hashing_functions-speed.rb +17 -0
  30. data/test/bin/new-idea.rb +17 -0
  31. data/test/bin/storazzo.rb +22 -25
  32. data/test/media/test_abstract_ric_disk.rb +5 -3
  33. data/test/media/test_gcs_bucket.rb +24 -23
  34. data/test/media/test_local_folder.rb +24 -23
  35. data/test/media/test_mount_point.rb +6 -5
  36. data/test/test_ric_disk.rb +6 -4
  37. data/test/test_ric_disk_config.rb +12 -11
  38. data/test/test_ric_disk_stats_file.rb +5 -3
  39. data/test/test_storazzo.rb +6 -4
  40. data/var/test/disks/disk02-full/Rakefile +7 -5
  41. data/var/test/disks/ricdisk_stats_v11.rds +11 -0
  42. metadata +13 -21
data/bin/storazzo CHANGED
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'storazzo'
4
- #gem 'storazzo', :path => File.expand_path("../lib", __FILE__)
5
+ # gem 'storazzo', :path => File.expand_path("../lib", __FILE__)
5
6
 
6
7
  require 'optparse'
7
8
 
@@ -9,152 +10,149 @@ extend Storazzo::Colors
9
10
  include Storazzo::Common # instead
10
11
 
11
12
  if RUBY_VERSION.split('.')[0] == 1
12
- puts "Refusing to launch a script form Ruby 1. Sorry Ric, its 2020 damn it!"
13
- exit 2020
14
- end
13
+ puts 'Refusing to launch a script form Ruby 1. Sorry Ric, its 2020 damn it!'
14
+ exit 2020
15
+ end
15
16
 
16
17
  $PROG_VER = '0.1'
17
18
  $DEBUG = ENV['DEBUG'] == 'true' # (true/false)
18
19
 
19
- $actions = %w{
20
- show auto help
21
- }.sort
22
-
20
+ $actions = %w[
21
+ show auto help
22
+ ].sort
23
23
 
24
24
  # you can't but love Ruby monkey-patching ability..
25
25
  class Array
26
26
  # puts "array drop"
27
- def tail
28
- drop(1) # https://stackoverflow.com/questions/3615700/ruby-what-is-the-easiest-way-to-remove-the-first-element-from-an-array
29
- end
27
+ def tail
28
+ drop(1) # https://stackoverflow.com/questions/3615700/ruby-what-is-the-easiest-way-to-remove-the-first-element-from-an-array
29
+ end
30
30
  end
31
31
 
32
32
  HISTORY = <<-BIG_LONG_MULTILINE
33
33
  2022-0806 v0.1 First stesure
34
34
  BIG_LONG_MULTILINE
35
35
 
36
-
37
- $description = <<DESCRIPTION_HEREFILE.gsub(/\s+/, " ").strip
36
+ $description = <<DESCRIPTION_HEREFILE.gsub(/\s+/, ' ').strip
38
37
  This util shall expose all Storazzo aPIs via CLI: show-local-dirs, ...
39
38
  show GCS buckets, ...
40
39
 
41
40
  It's also my dream to add some nice icons which are joy to the eye, like
42
- some [ ] [x] before the list to show if its agood or bad directory and type also
41
+ some [ ] [x] before the list to show if its agood or bad directory and type also#{' '}
43
42
  DESCRIPTION_HEREFILE
44
43
  # >> "SELECT * FROM users ORDER BY users.id DESC"
45
44
 
46
45
  $myconf = {
47
- :app_name => "Storazzo CLI: #{$0}",
48
- :description => $description,
49
- # TODO move to some class default
50
- #:media_dirs => %w{/media/riccardo/ /Volumes/ /mnt/ ~/git/storazzo/var/test/
46
+ app_name: "Storazzo CLI: #{$PROGRAM_NAME}",
47
+ description: $description
48
+ # TODO: move to some class default
49
+ # :media_dirs => %w{/media/riccardo/ /Volumes/ /mnt/ ~/git/storazzo/var/test/
51
50
  # /sobenme/giusto/per/imparare/ad/ammutolire/gli/errori/},
52
- #:mount_types => %w{vfat ntfs},
51
+ # :mount_types => %w{vfat ntfs},
53
52
  }
54
53
 
55
54
  def usage(comment = nil)
56
- puts white($optparse.banner)
57
- puts($optparse.summarize)
58
- #puts("Description: " + gray($myconf[:description]))
59
- puts red("ERROR: " + comment) if comment
60
- # puts "Description: #{ $myconf[:description] }"
61
- exit 13
62
- end
55
+ puts white($optparse.banner)
56
+ puts($optparse.summarize)
57
+ # puts("Description: " + gray($myconf[:description]))
58
+ puts red("ERROR: #{comment}") if comment
59
+ # puts "Description: #{ $myconf[:description] }"
60
+ exit 13
61
+ end
63
62
 
64
63
  # include it in main if you want a custome one
65
- def init() # see lib_autoinit in lib/util.rb
66
- $opts = {}
67
- # setting defaults
68
- $opts[:verbose] = false
69
- $opts[:dryrun] = false
70
- $opts[:debug] = false
71
- $opts[:force] = false
72
-
73
- $optparse = OptionParser.new do |opts|
74
- opts.banner = "#{$0} v.#{$PROG_VER}\n Usage: #{File.basename $0} [options] ACTION [file1] [file2] ..."
75
- opts.separator "Actions: #{$actions.join ', '}"
76
- opts.separator " $0 show # show options and local folders "
77
- opts.separator " $0 auto # takes automated actions based on config and local disk. For lazy users"
78
- opts.separator "Options: "
79
- opts.on('-d', '--debug', 'enables debug (DFLT=false)') { $opts[:debug] = true; $DEBUG = true }
80
- opts.on('-f', '--force', 'force stuff (DFLT=false)') { $opts[:force] = true }
81
- opts.on('-h', '--help', 'Display this screen') { usage }
82
- # opts.on( '-j', '--jabba', 'Activates my Jabber powerful CLI' ) { $opts[:jabba] = true }
83
- opts.on('-n', '--dryrun', "Don't really execute code") { $opts[:dryrun] = true }
84
- opts.on('-l', '--logfile FILE', 'Write log to FILE') { |file| $opts[:logfile] = file }
85
- opts.on('-v', '--verbose', 'Output more information') { $opts[:verbose] = true }
86
- opts.separator("Description: " + gray($myconf[:description]))
87
- #opts.separator " -- "
64
+ # see lib_autoinit in lib/util.rb
65
+ def init
66
+ $opts = {}
67
+ # setting defaults
68
+ $opts[:verbose] = false
69
+ $opts[:dryrun] = false
70
+ $opts[:debug] = false
71
+ $opts[:force] = false
72
+
73
+ $optparse = OptionParser.new do |opts|
74
+ opts.banner = "#{$PROGRAM_NAME} v.#{$PROG_VER}\n Usage: #{File.basename $PROGRAM_NAME} [options] ACTION [file1] [file2] ..."
75
+ opts.separator "Actions: #{$actions.join ', '}"
76
+ opts.separator ' $0 show # show options and local folders '
77
+ opts.separator ' $0 auto # takes automated actions based on config and local disk. For lazy users'
78
+ opts.separator 'Options: '
79
+ opts.on('-d', '--debug', 'enables debug (DFLT=false)') do
80
+ $opts[:debug] = true
81
+ $DEBUG = true
88
82
  end
89
- $optparse.parse!
83
+ opts.on('-f', '--force', 'force stuff (DFLT=false)') { $opts[:force] = true }
84
+ opts.on('-h', '--help', 'Display this screen') { usage }
85
+ # opts.on( '-j', '--jabba', 'Activates my Jabber powerful CLI' ) { $opts[:jabba] = true }
86
+ opts.on('-n', '--dryrun', "Don't really execute code") { $opts[:dryrun] = true }
87
+ opts.on('-l', '--logfile FILE', 'Write log to FILE') { |file| $opts[:logfile] = file }
88
+ opts.on('-v', '--verbose', 'Output more information') { $opts[:verbose] = true }
89
+ opts.separator("Description: #{gray($myconf[:description])}")
90
+ # opts.separator " -- "
90
91
  end
92
+ $optparse.parse!
93
+ end
91
94
 
92
- def show_action(argv)
93
- deb "ARGV remaning is: #{argv}"
94
- deb("TODO show_action")
95
- #puts(white("1. Config"))
96
- #Pry::ColorPrinter.pp $config.to_verbose_s
97
- puts(white("2. Mounts/Dirs"))
98
- Pry::ColorPrinter.pp Storazzo::Media::GcsBucket.list_all_with_type
99
- pp Storazzo::Media::AbstractRicDisk.super_duper_list_all_with_type
100
-
101
- end
102
-
103
- def real_program
104
- deb("Hello world from a templated '#{yellow $0}'")
105
- deb "+ Options are: #{gray $opts}"
106
- deb "+ Depured args: #{azure ARGV}"
107
- deb "+ Script-specifig super-cool conf: #{green $prog_conf_d}"
108
- deb "+ Your configuration: #{purple $myconf.inspect}"
109
-
110
- # Your code goes here...
111
- puts white("Hello world from #{$myconf[:app_name]}!")
112
- puts "Description: '''#{white $myconf[:description]}'''"
113
- Storazzo::Main.say_hi("Note: if the version of this storazzo is behind local version youre probably using a old library.
114
- I still need to learn how to call the binary with local/current lib/: bundle exec stiKazzi?")
115
-
116
- $config = Storazzo::RicDiskConfig.instance()
117
- $config.load
118
- deb "StorazzoConfig: #{$config}"
119
- # config.load # auto_sbrodola(ARGV)
120
- puts yellow("ARGV: #{ARGV}")
121
- #config.iterate_through_file_list_for_disks(ARGV)
122
-
123
- if_deb? { Storazzo::Main.say_hi("ARGV: #{ARGV}") }
95
+ def show_action(argv)
96
+ deb "ARGV remaning is: #{argv}"
97
+ deb('TODO show_action')
98
+ # puts(white("1. Config"))
99
+ # Pry::ColorPrinter.pp $config.to_verbose_s
100
+ puts(white('2. Mounts/Dirs'))
101
+ Pry::ColorPrinter.pp Storazzo::Media::GcsBucket.list_all_with_type
102
+ pp Storazzo::Media::AbstractRicDisk.super_duper_list_all_with_type
103
+ end
124
104
 
125
- if (ARGV == [])
126
- usage("I need at least one argument (storazzo ACTION)")
127
- end
128
- argv_action = ARGV[0]
129
- case argv_action # first argment - action
130
- when "show", "list"
131
- show_action(ARGV.tail)
132
- when "auto"
133
- auto_action(ARGV.tail)
134
- when "help"
135
- usage("There you go, here's your HELP :)")
136
- when String
137
- usage("Unknown action1: #{argv_action}. Available actions: #{$actions}")
138
- else
139
- usage("Unknown action2, really strange!: '#{argv_action}'. Actions: #{$actions}")
140
- end
105
+ def real_program
106
+ deb("Hello world from a templated '#{yellow $PROGRAM_NAME}'")
107
+ deb "+ Options are: #{gray $opts}"
108
+ deb "+ Depured args: #{azure ARGV}"
109
+ deb "+ Script-specifig super-cool conf: #{green $prog_conf_d}"
110
+ deb "+ Your configuration: #{purple $myconf.inspect}"
111
+
112
+ # Your code goes here...
113
+ puts white("Hello world from #{$myconf[:app_name]}!")
114
+ puts "Description: '''#{white $myconf[:description]}'''"
115
+ Storazzo::Main.say_hi("Note: if the version of this storazzo is behind local version youre probably using a old library.
116
+ I still need to learn how to call the binary with local/current lib/: bundle exec stiKazzi?")
141
117
 
118
+ $config = Storazzo::RicDiskConfig.instance
119
+ $config.load
120
+ deb "StorazzoConfig: #{$config}"
121
+ # config.load # auto_sbrodola(ARGV)
122
+ puts yellow("ARGV: #{ARGV}")
123
+ # config.iterate_through_file_list_for_disks(ARGV)
124
+
125
+ if_deb? { Storazzo::Main.say_hi("ARGV: #{ARGV}") }
126
+
127
+ usage('I need at least one argument (storazzo ACTION)') if ARGV == []
128
+ argv_action = ARGV[0]
129
+ case argv_action # first argment - action
130
+ when 'show', 'list'
131
+ show_action(ARGV.tail)
132
+ when 'auto'
133
+ auto_action(ARGV.tail)
134
+ when 'help'
135
+ usage("There you go, here's your HELP :)")
136
+ when String
137
+ usage("Unknown action1: #{argv_action}. Available actions: #{$actions}")
138
+ else
139
+ usage("Unknown action2, really strange!: '#{argv_action}'. Actions: #{$actions}")
142
140
  end
143
-
144
- def main(filename)
145
- deb "I'm called by #{white filename}"
146
- deb "HISTORY: #{gray HISTORY}"
147
- init # Enable this to have command line parsing capabilities!
148
- puts white("$DEBUG is #{$DEBUG}. Tu turn on, call me with -d") unless $DEBUG
149
- # warn "[warn] template v#{$TEMPLATE_VER }: proviamo il warn che magari depreca il DEB"
150
- real_program
151
-
152
- if_deb? do
153
- puts "First I need to figure out how to bring in all the libraries in here.."
154
- Storazzo::Main.say_hi("ARGV is: #{ARGV.join ', '}")
155
- puts Storazzo.version
156
- end
141
+ end
142
+
143
+ def main(filename)
144
+ deb "I'm called by #{white filename}"
145
+ deb "HISTORY: #{gray HISTORY}"
146
+ init # Enable this to have command line parsing capabilities!
147
+ puts white("$DEBUG is #{$DEBUG}. Tu turn on, call me with -d") unless $DEBUG
148
+ # warn "[warn] template v#{$TEMPLATE_VER }: proviamo il warn che magari depreca il DEB"
149
+ real_program
150
+
151
+ if_deb? do
152
+ puts 'First I need to figure out how to bring in all the libraries in here..'
153
+ Storazzo::Main.say_hi("ARGV is: #{ARGV.join ', '}")
154
+ puts Storazzo.version
157
155
  end
158
-
156
+ end
159
157
 
160
- main(__FILE__)
158
+ main(__FILE__)
@@ -0,0 +1 @@
1
+ bin/storazzo
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Use EXTEND vs INCLUDE and magically the Class will inherit instead of instance. Magical! :)
2
4
  # http://www.railstips.org/blog/archives/2009/05/15/include-vs-extend-in-ruby/
3
5
  #
@@ -9,41 +11,80 @@ module Storazzo
9
11
  # needs to be defined before
10
12
  end
11
13
 
12
- module Storazzo::Colors
13
- PREPEND_ME = "[Storazzo::Colors] "
14
-
15
- def deb2(s);
16
- puts "#DEB_OBSOLETE #{gray(s)} [include Storazzo::Common instead]" if $DEBUG; end # Use the Common instead
17
-
18
- # colors 16
19
- def yellow(s) "\033[1;33m#{s}\033[0m"; end
20
- def gray(s) "\033[1;30m#{s}\033[0m"; end
21
- def green(s) "\033[1;32m#{s}\033[0m"; end
22
- def red(s) "\033[1;31m#{s}\033[0m"; end
23
- def blue(s) "\033[1;34m#{s}\033[0m"; end
24
- def purple(s) "\033[1;35m#{s}\033[0m"; end
25
- def azure(s) "\033[1;36m#{s}\033[0m"; end
26
- def white(s) "\033[1;37m#{s}\033[0m"; end
27
-
28
- # colors 64k
29
- def orange(s) "\033[38;5;208m#{s}\033[0m"; end
30
-
31
- # i dont undertstand why i need self :/
32
- # SELF version because I'm just stupid or lazy or both.
33
- # def self.yellow(s) "#{PREPEND_ME}\033[1;33m#{s}\033[0m" ; end
34
- # def self.green(s) "#{PREPEND_ME}\033[1;32m#{s}\033[0m" ; end
35
- # def self.gray(s) "#{PREPEND_ME}\033[1;30m#{s}\033[0m" ; end
36
- # def self.green(s) "#{PREPEND_ME}\033[1;32m#{s}\033[0m" ; end
37
- # def self.red(s) "#{PREPEND_ME}\033[1;31m#{s}\033[0m" ; end
38
- # def self.blue(s) "#{PREPEND_ME}\033[1;34m#{s}\033[0m" ; end
39
- # def self.purple(s) "#{PREPEND_ME}\033[1;35m#{s}\033[0m" ; end
40
- # def self.azure(s) "#{PREPEND_ME}\033[1;36m#{s}\033[0m" ; end
41
- # def self.white(s) "#{PREPEND_ME}\033[1;37m#{s}\033[0m" ; end
42
-
43
- # p<COLOR> Carlessian functions..
44
- def pwhite(s) puts(white(s)); end
45
- def pgreen(s) puts(green(s)); end
46
- def pred(s) puts(red(s)); end
47
- def pyellow(s) puts(yellow(s)); end
14
+ module Storazzo
15
+ module Colors
16
+ PREPEND_ME = '[Storazzo::Colors] '
17
+
18
+ def deb2(s)
19
+ puts "#DEB_OBSOLETE #{gray(s)} [include Storazzo::Common instead]" if $DEBUG
20
+ end
21
+
22
+ # colors 16
23
+ def yellow(s)
24
+ "\033[1;33m#{s}\033[0m"
25
+ end
26
+
27
+ def gray(s)
28
+ "\033[1;30m#{s}\033[0m"
29
+ end
30
+
31
+ def green(s)
32
+ "\033[1;32m#{s}\033[0m"
33
+ end
34
+
35
+ def red(s)
36
+ "\033[1;31m#{s}\033[0m"
37
+ end
38
+
39
+ def blue(s)
40
+ "\033[1;34m#{s}\033[0m"
41
+ end
42
+
43
+ def purple(s)
44
+ "\033[1;35m#{s}\033[0m"
45
+ end
46
+
47
+ def azure(s)
48
+ "\033[1;36m#{s}\033[0m"
49
+ end
50
+
51
+ def white(s)
52
+ "\033[1;37m#{s}\033[0m"
53
+ end
54
+
55
+ # colors 64k
56
+ def orange(s)
57
+ "\033[38;5;208m#{s}\033[0m"
58
+ end
59
+
60
+ # i dont undertstand why i need self :/
61
+ # SELF version because I'm just stupid or lazy or both.
62
+ # def self.yellow(s) "#{PREPEND_ME}\033[1;33m#{s}\033[0m" ; end
63
+ # def self.green(s) "#{PREPEND_ME}\033[1;32m#{s}\033[0m" ; end
64
+ # def self.gray(s) "#{PREPEND_ME}\033[1;30m#{s}\033[0m" ; end
65
+ # def self.green(s) "#{PREPEND_ME}\033[1;32m#{s}\033[0m" ; end
66
+ # def self.red(s) "#{PREPEND_ME}\033[1;31m#{s}\033[0m" ; end
67
+ # def self.blue(s) "#{PREPEND_ME}\033[1;34m#{s}\033[0m" ; end
68
+ # def self.purple(s) "#{PREPEND_ME}\033[1;35m#{s}\033[0m" ; end
69
+ # def self.azure(s) "#{PREPEND_ME}\033[1;36m#{s}\033[0m" ; end
70
+ # def self.white(s) "#{PREPEND_ME}\033[1;37m#{s}\033[0m" ; end
71
+
72
+ # p<COLOR> Carlessian functions..
73
+ def pwhite(s)
74
+ puts(white(s))
75
+ end
76
+
77
+ def pgreen(s)
78
+ puts(green(s))
79
+ end
80
+
81
+ def pred(s)
82
+ puts(red(s))
83
+ end
84
+
85
+ def pyellow(s)
86
+ puts(yellow(s))
87
+ end
88
+ end
48
89
  end
49
90
  # end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Ric common stuff! :)
2
4
  #
3
5
  # Usage:
@@ -5,89 +7,91 @@
5
7
  # or
6
8
  # extend Storazzo::Common (def to def self.XX)
7
9
  #
8
- =begin
9
- Emoji to copy:
10
- 👍 👎 👌 ✌ 👋 🤝 👏 🤘 🤟 🤙 🤏 🙌 🙏 🖖 🤞 ✋ 🤚 🖐 🖑 🤲 👐 👊 🤛 🤜 🖕
11
- 👈 👉 👆 👇
12
- 😃 😄 😅 😆 😊 😎 😇 😈 😏 🤣 🤩 🤪 🥳 😁 😀 😂 🤠 🤡 🤑 🤓 🤖 kiss
13
- 😗 😚 😘 😙 flirting
14
- 😉 🤗 😍 🥰 🤤 😋 😛 😜 😝 neutral
15
- 😶 🙃 😐 😑 🤔 🤨 🧐 hush
16
- 🤭 🤫 😯 🤐 😌 😖 😕 😳 😔 🤥 🥴 shocked
17
- 😮 😲 🤯 tired
18
- 😩 😫 🥱 😪 😴 😵 sad
19
- 😦 😞 😥 😟 cry
20
- 😢 😭 sick
21
- 🤢 🤮 😷 🤒 🤕 🥵 🥶 fear
22
- 🥺 😬 😓 😰 😨 😱 angry
23
- 😒 😠 😡 😤 😣 😧 🤬 😸 😹 😺 😻 😼 😽 😾 😿 🙀 🙈 🙉 🙊
24
- [see Animal Emoji 🐰] gesture
25
- 🤦 🤷 🙅 🙆 🙋 🙌 🙍 🙎 🙇 🙏 activity
26
- 👯 💃 🕺 🤳 💇 💈 💆 🧖 🧘 🧍 🧎 👰 🤰 🤱 faces
27
- 👶 🧒 👦 👧 👩 👨 🧑 🧔 🧓 👴 👵 👤 👥 👪 👫 👬 👭 👱 👳 👲 🧕 👸 🤴 🎅 🤶 disabled
28
- 🧏 🦻 🦮 🦯 🦺 🦼 🦽 🦾 🦿 🤵 👮 👷 💁 💂 🕴 🕵 🦸 🦹 🧙 🧚 🧜 🧝 🧞 🧛 🧟 👼 👿 👻 👹 👺 👽 👾 🛸 💀 ☠ 🕱 🧠 🦴 👁 👀 👂 👃 👄 🗢 👅 🦷 🦵 🦶 💭 🗬 🗭 💬 🗨 🗩 🗪 🗫 🗰 🗱 🗮 🗯 🗣 🗤 🗥 🗦 🗧 💦 💧 💢 💫 💤 💨 💥 💪 🗲 🔥 💡 💩 💯 🔟 🔰 🕲
29
- =end
10
+ # Emoji to copy:
11
+ # 👍 👎 👌 ✌ 👋 🤝 👏 🤘 🤟 🤙 🤏 🙌 🙏 🖖 🤞 ✋ 🤚 🖐 🖑 🤲 👐 👊 🤛 🤜 🖕
12
+ # 👈 👉 👆 👇
13
+ # 😃 😄 😅 😆 😊 😎 😇 😈 😏 🤣 🤩 🤪 🥳 😁 😀 😂 🤠 🤡 🤑 🤓 🤖 kiss
14
+ # 😗 😚 😘 😙 flirting
15
+ # 😉 🤗 😍 🥰 🤤 😋 😛 😜 😝 neutral
16
+ # 😶 🙃 😐 😑 🤔 🤨 🧐 hush
17
+ # 🤭 🤫 😯 🤐 😌 😖 😕 😳 😔 🤥 🥴 shocked
18
+ # 😮 😲 🤯 tired
19
+ # 😩 😫 🥱 😪 😴 😵 sad
20
+ # 😦 😞 😥 😟 cry
21
+ # 😢 😭 sick
22
+ # 🤢 🤮 😷 🤒 🤕 🥵 🥶 fear
23
+ # 🥺 😬 😓 😰 😨 😱 angry
24
+ # 😒 😠 😡 😤 😣 😧 🤬 😸 😹 😺 😻 😼 😽 😾 😿 🙀 🙈 🙉 🙊
25
+ # [see Animal Emoji 🐰] gesture
26
+ # 🤦 🤷 🙅 🙆 🙋 🙌 🙍 🙎 🙇 🙏 activity
27
+ # 👯 💃 🕺 🤳 💇 💈 💆 🧖 🧘 🧍 🧎 👰 🤰 🤱 faces
28
+ # 👶 🧒 👦 👧 👩 👨 🧑 🧔 🧓 👴 👵 👤 👥 👪 👫 👬 👭 👱 👳 👲 🧕 👸 🤴 🎅 🤶 disabled
29
+ # 🧏 🦻 🦮 🦯 🦺 🦼 🦽 🦾 🦿 🤵 👮 👷 💁 💂 🕴 🕵 🦸 🦹 🧙 🧚 🧜 🧝 🧞 🧛 🧟 👼 👿 👻 👹 👺 👽 👾 🛸 💀 ☠ 🕱 🧠 🦴 👁 👀 👂 👃 👄 🗢 👅 🦷 🦵 🦶 💭 🗬 🗭 💬 🗨 🗩 🗪 🗫 🗰 🗱 🗮 🗯 🗣 🗤 🗥 🗦 🗧 💦 💧 💢 💫 💤 💨 💥 💪 🗲 🔥 💡 💩 💯 🔟 🔰 🕲
30
30
  require_relative 'colors'
31
31
  require 'pry'
32
32
 
33
- module Storazzo::Common
34
- include Storazzo::Colors
33
+ module Storazzo
34
+ module Common
35
+ include Storazzo::Colors
35
36
 
36
- def deb(s)
37
- #useless: put logic in _debug_true() # return if ENV['RUBYOPT'] == "-W0"
38
- puts "[DEB👀] #{yellow(s)}" if _debug_true() # $DEBUG
39
- end
37
+ def deb(s)
38
+ # useless: put logic in _debug_true() # return if ENV['RUBYOPT'] == "-W0"
39
+ puts "[DEB👀] #{yellow(s)}" if _debug_true # $DEBUG
40
+ end
40
41
 
41
- # this has a yield
42
- def if_deb?()
43
- if _debug_true # $DEBUG
44
- deb "== yield START =="
45
- yield
46
- deb "== yield END =="
42
+ # this has a yield
43
+ def if_deb?
44
+ if _debug_true # $DEBUG
45
+ deb '== yield START =='
46
+ yield
47
+ deb '== yield END =='
48
+ end
47
49
  end
48
- end
49
50
 
50
- def warn(s)
51
- puts "[W⚠️RN] #{azure(s)}"
52
- end
51
+ def warn(s)
52
+ puts "[W⚠️RN] #{azure(s)}"
53
+ end
53
54
 
54
- def err(str)
55
- puts "[ERR👎] #{red(s)}" # ⛔
56
- end
55
+ def err(_str)
56
+ puts "[ERR👎] #{red(s)}" # ⛔
57
+ end
57
58
 
58
- def bug(s)
59
- puts "[🐛] #{gray s}"
60
- end
59
+ def bug(s)
60
+ puts "[🐛] #{gray s}"
61
+ end
61
62
 
62
- def pverbose(is_verbose, str)
63
- # puts "[V📚RB💀S📚] #{gray str}"
64
- return if ENV['RUBYOPT'] == "-W0"
65
- puts "[🦋🐛🐝🐞🐜🕷🕸🦂🦗🦟] #{gray str}" # insects: http://xahlee.info/comp/unicode_insects.html
66
- end
63
+ def pverbose(_is_verbose, str)
64
+ # puts "[V📚RB💀S📚] #{gray str}"
65
+ return if ENV['RUBYOPT'] == '-W0'
67
66
 
68
- def ppp(complex_object_to_colorize)
69
- # TODO i need to learn to return without printing..
70
- Pry::ColorPrinter.pp(complex_object_to_colorize)
71
- end
67
+ puts "[🦋🐛🐝🐞🐜🕷🕸🦂🦗🦟] #{gray str}" # insects: http://xahlee.info/comp/unicode_insects.html
68
+ end
72
69
 
73
- def fatal(s)
74
- raise "[F💀TAL] #{red s}"
75
- end
70
+ def ppp(complex_object_to_colorize)
71
+ # TODO: i need to learn to return without printing..
72
+ Pry::ColorPrinter.pp(complex_object_to_colorize)
73
+ end
76
74
 
77
- def mac?
78
- `uname`.chomp == 'Darwin'
79
- end
75
+ def fatal(s)
76
+ raise "[F💀TAL] #{red s}"
77
+ end
80
78
 
81
- def linux?
82
- `uname`.chomp == 'Linux'
83
- end
79
+ def mac?
80
+ `uname`.chomp == 'Darwin'
81
+ end
84
82
 
85
- private
83
+ def linux?
84
+ `uname`.chomp == 'Linux'
85
+ end
86
86
 
87
- def _debug_true
88
- return false if ENV["RUBYOPT"] == "-W0"
89
- $DEBUG or ENV["DEBUG"] == 'true' # but FALSE isor _debug_true
90
- end
87
+ private
88
+
89
+ def _debug_true
90
+ return false if ENV['RUBYOPT'] == '-W0'
91
91
 
92
- # puts "[DEBUG ENABLED!]" if _debug_true
92
+ $DEBUG or ENV['DEBUG'] == 'true' # but FALSE isor _debug_true
93
+ end
94
+
95
+ # puts "[DEBUG ENABLED!]" if _debug_true
96
+ end
93
97
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # idea from https://medium.com/@leo_hetsch/ruby-modules-include-vs-prepend-vs-extend-f09837a5b073
2
4
  module Debug
3
5
  def log(message)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # copied from https://dev.to/ayushn21/how-to-generate-yaml-from-ruby-objects-without-type-annotations-4fli
2
4
  module Storazzo
3
5
  module Hashify
@@ -20,19 +22,19 @@ module Storazzo
20
22
  value = instance_variable_get(var)
21
23
  value = value.map(&:to_hash) if value.is_a? Array
22
24
 
23
- hash[var.to_s.delete("@")] = value
25
+ hash[var.to_s.delete('@')] = value
24
26
  end
25
27
 
26
- return hash
28
+ hash
27
29
  end
28
30
 
29
31
  def obj_to_hash
30
32
  h = {}
31
33
  puts self
32
- self.instance_variables.each { |var|
34
+ instance_variables.each do |var|
33
35
  # puts var
34
- h[var.to_s.delete('@')] = self.instance_variable_get(var) # send(var.to_s.delete('@'))
35
- }
36
+ h[var.to_s.delete('@')] = instance_variable_get(var) # send(var.to_s.delete('@'))
37
+ end
36
38
  h
37
39
  end
38
40