unclekryon 0.4.9.pre.alpha → 0.4.12.pre.alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +10 -26
- data/Gemfile.lock +20 -24
- data/README.md +3 -2
- data/Rakefile +11 -30
- data/bin/unclekryon +4 -15
- data/hax/kryon.yaml +28 -0
- data/hax/kryon_aums_2002-2005.yaml +460 -0
- data/hax/kryon_aums_2006.yaml +601 -0
- data/hax/kryon_aums_2007.yaml +1024 -0
- data/hax/kryon_aums_2008.yaml +950 -0
- data/hax/kryon_aums_2009.yaml +496 -0
- data/hax/kryon_aums_2010.yaml +1443 -0
- data/hax/kryon_aums_2011.yaml +1458 -0
- data/hax/kryon_aums_2012.yaml +2123 -0
- data/hax/kryon_aums_2013.yaml +1647 -0
- data/hax/kryon_aums_2014.yaml +2478 -0
- data/hax/kryon_aums_2015.yaml +3386 -0
- data/hax/kryon_aums_2016.yaml +3476 -0
- data/hax/kryon_aums_2017.yaml +3712 -0
- data/hax/kryon_aums_2018.yaml +3654 -0
- data/lib/unclekryon/data/album_data.rb +74 -82
- data/lib/unclekryon/data/artist_data.rb +24 -36
- data/lib/unclekryon/data/artist_data_data.rb +29 -41
- data/lib/unclekryon/data/aum_data.rb +20 -32
- data/lib/unclekryon/data/base_data.rb +27 -39
- data/lib/unclekryon/data/pic_data.rb +25 -37
- data/lib/unclekryon/data/release_data.rb +14 -26
- data/lib/unclekryon/data/social_data.rb +6 -18
- data/lib/unclekryon/data/timespan_data.rb +16 -28
- data/lib/unclekryon/dev_opts.rb +7 -19
- data/lib/unclekryon/hacker.rb +121 -135
- data/lib/unclekryon/iso/base_iso.rb +69 -81
- data/lib/unclekryon/iso/can_prov_terr.rb +34 -47
- data/lib/unclekryon/iso/country.rb +34 -51
- data/lib/unclekryon/iso/language.rb +84 -98
- data/lib/unclekryon/iso/region.rb +8 -29
- data/lib/unclekryon/iso/subregion.rb +8 -29
- data/lib/unclekryon/iso/usa_state.rb +28 -41
- data/lib/unclekryon/iso.rb +128 -138
- data/lib/unclekryon/jsoner.rb +31 -50
- data/lib/unclekryon/log.rb +34 -46
- data/lib/unclekryon/parsers/kryon_aum_year_album_parser.rb +163 -167
- data/lib/unclekryon/parsers/kryon_aum_year_parser.rb +122 -127
- data/lib/unclekryon/server.rb +8 -17
- data/lib/unclekryon/trainer.rb +68 -85
- data/lib/unclekryon/uploader.rb +8 -17
- data/lib/unclekryon/util.rb +80 -92
- data/lib/unclekryon/version.rb +4 -16
- data/lib/unclekryon.rb +166 -166
- data/train/kryon.yaml +6077 -0
- data/unclekryon.gemspec +49 -49
- metadata +50 -22
data/lib/unclekryon/log.rb
CHANGED
@@ -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-
|
8
|
-
#
|
9
|
-
#
|
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(
|
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
|
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 $
|
71
|
+
if $PROGRAM_NAME == __FILE__
|
84
72
|
class Tester
|
85
73
|
include UncleKryon::Logging
|
86
|
-
|
87
|
-
def init_log
|
88
|
-
@log.progname.prepend(
|
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
|