unclekryon 0.4.9.pre.alpha → 0.4.12.pre.alpha

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.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +10 -26
  3. data/Gemfile.lock +20 -24
  4. data/README.md +3 -2
  5. data/Rakefile +11 -30
  6. data/bin/unclekryon +4 -15
  7. data/hax/kryon.yaml +28 -0
  8. data/hax/kryon_aums_2002-2005.yaml +460 -0
  9. data/hax/kryon_aums_2006.yaml +601 -0
  10. data/hax/kryon_aums_2007.yaml +1024 -0
  11. data/hax/kryon_aums_2008.yaml +950 -0
  12. data/hax/kryon_aums_2009.yaml +496 -0
  13. data/hax/kryon_aums_2010.yaml +1443 -0
  14. data/hax/kryon_aums_2011.yaml +1458 -0
  15. data/hax/kryon_aums_2012.yaml +2123 -0
  16. data/hax/kryon_aums_2013.yaml +1647 -0
  17. data/hax/kryon_aums_2014.yaml +2478 -0
  18. data/hax/kryon_aums_2015.yaml +3386 -0
  19. data/hax/kryon_aums_2016.yaml +3476 -0
  20. data/hax/kryon_aums_2017.yaml +3712 -0
  21. data/hax/kryon_aums_2018.yaml +3654 -0
  22. data/lib/unclekryon/data/album_data.rb +74 -82
  23. data/lib/unclekryon/data/artist_data.rb +24 -36
  24. data/lib/unclekryon/data/artist_data_data.rb +29 -41
  25. data/lib/unclekryon/data/aum_data.rb +20 -32
  26. data/lib/unclekryon/data/base_data.rb +27 -39
  27. data/lib/unclekryon/data/pic_data.rb +25 -37
  28. data/lib/unclekryon/data/release_data.rb +14 -26
  29. data/lib/unclekryon/data/social_data.rb +6 -18
  30. data/lib/unclekryon/data/timespan_data.rb +16 -28
  31. data/lib/unclekryon/dev_opts.rb +7 -19
  32. data/lib/unclekryon/hacker.rb +121 -135
  33. data/lib/unclekryon/iso/base_iso.rb +69 -81
  34. data/lib/unclekryon/iso/can_prov_terr.rb +34 -47
  35. data/lib/unclekryon/iso/country.rb +34 -51
  36. data/lib/unclekryon/iso/language.rb +84 -98
  37. data/lib/unclekryon/iso/region.rb +8 -29
  38. data/lib/unclekryon/iso/subregion.rb +8 -29
  39. data/lib/unclekryon/iso/usa_state.rb +28 -41
  40. data/lib/unclekryon/iso.rb +128 -138
  41. data/lib/unclekryon/jsoner.rb +31 -50
  42. data/lib/unclekryon/log.rb +34 -46
  43. data/lib/unclekryon/parsers/kryon_aum_year_album_parser.rb +163 -167
  44. data/lib/unclekryon/parsers/kryon_aum_year_parser.rb +122 -127
  45. data/lib/unclekryon/server.rb +8 -17
  46. data/lib/unclekryon/trainer.rb +68 -85
  47. data/lib/unclekryon/uploader.rb +8 -17
  48. data/lib/unclekryon/util.rb +80 -92
  49. data/lib/unclekryon/version.rb +4 -16
  50. data/lib/unclekryon.rb +166 -166
  51. data/train/kryon.yaml +6077 -0
  52. data/unclekryon.gemspec +49 -49
  53. metadata +50 -22
@@ -1,23 +1,11 @@
1
- #!/usr/bin/env ruby
2
1
  # encoding: UTF-8
3
2
  # frozen_string_literal: true
4
3
 
5
4
  #--
6
5
  # This file is part of UncleKryon-server.
7
- # Copyright (c) 2017-2019 Jonathan Bradley Whited (@esotericpig)
8
- #
9
- # UncleKryon-server is free software: you can redistribute it and/or modify
10
- # it under the terms of the GNU General Public License as published by
11
- # the Free Software Foundation, either version 3 of the License, or
12
- # (at your option) any later version.
13
- #
14
- # UncleKryon-server is distributed in the hope that it will be useful,
15
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
- # GNU General Public License for more details.
18
- #
19
- # You should have received a copy of the GNU General Public License
20
- # along with UncleKryon-server. If not, see <https://www.gnu.org/licenses/>.
6
+ # Copyright (c) 2017-2021 Jonathan Bradley Whited
7
+ #
8
+ # SPDX-License-Identifier: GPL-3.0-or-later
21
9
  #++
22
10
 
23
11
 
@@ -27,83 +15,83 @@ require 'singleton'
27
15
  module UncleKryon
28
16
  class UncleKryonLogger < Logger
29
17
  def initialize
30
- super(STDOUT)
31
-
32
- @progname = self.class.to_s()
18
+ super($stdout)
19
+
20
+ @progname = self.class.to_s
33
21
  end
34
-
22
+
35
23
  def build_message(message,error: nil,**options)
36
24
  # Don't use mutable methods
37
- message += error.backtrace().map(){|e| "\n > " + e}.join('') if !error.nil?
38
-
25
+ message += error.backtrace.map{|e| "\n > " + e}.join('') if !error.nil?
26
+
39
27
  return message
40
28
  end
41
-
29
+
42
30
  def error(message,error: nil,**options)
43
31
  super(build_message(message,error: error,**options))
44
32
  end
45
-
33
+
46
34
  def fatal(message,error: nil,**options)
47
35
  super(build_message(message,error: error,**options))
48
36
  end
49
-
37
+
50
38
  def unknown(message,error: nil,**options)
51
39
  super(build_message(message,error: error,**options))
52
40
  end
53
-
41
+
54
42
  def warn(message,error: nil,**options)
55
43
  super(build_message(message,error: error,**options))
56
44
  end
57
45
  end
58
-
46
+
59
47
  # Global for non-class use
60
48
  class Log < UncleKryonLogger
61
49
  include Singleton
62
-
50
+
63
51
  # Do NOT define vars here; had problems with @dev/@test breaking this class
64
52
  end
65
-
53
+
66
54
  # Mixin for class use
67
55
  module Logging
68
- def init_log()
56
+ def init_log
69
57
  end
70
-
71
- def log()
58
+
59
+ def log
72
60
  if !@log
73
- @log = UncleKryonLogger.new()
74
- @log.progname = self.class.to_s()
75
-
76
- init_log()
61
+ @log = UncleKryonLogger.new
62
+ @log.progname = self.class.to_s
63
+
64
+ init_log
77
65
  end
78
66
  return @log
79
67
  end
80
68
  end
81
69
  end
82
70
 
83
- if $0 == __FILE__
71
+ if $PROGRAM_NAME == __FILE__
84
72
  class Tester
85
73
  include UncleKryon::Logging
86
-
87
- def init_log()
88
- @log.progname.prepend("[Risky]")
74
+
75
+ def init_log
76
+ @log.progname.prepend('[Risky]')
89
77
  end
90
-
91
- def take_risk()
78
+
79
+ def take_risk
92
80
  log.fatal('Risky! Risky! Risky!')
93
81
  end
94
82
  end
95
-
83
+
96
84
  begin
97
- t = Tester.new()
98
- t.take_risk()
99
-
85
+ t = Tester.new
86
+ t.take_risk
87
+
100
88
  raise 'Oops!'
101
89
  rescue StandardError => e
102
90
  UncleKryon::Log.instance.error(e.message,error: e)
103
91
  UncleKryon::Log.instance.fatal(e.message,error: e)
104
92
  UncleKryon::Log.instance.unknown(e.message,error: e)
105
93
  UncleKryon::Log.instance.warn(e.message,error: e)
106
-
94
+
107
95
  UncleKryon::Log.instance.warn("Don't Worry") do
108
96
  'This still works'
109
97
  end