active_brainz 0.1.0 → 0.2.0
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 +4 -4
- data/config/inflections.rb +1 -0
- data/lib/active_brainz.rb +11 -2
- data/lib/active_brainz/models/area/area.rb +9 -9
- data/lib/active_brainz/models/iso/iso_3166_1.rb +29 -0
- data/lib/active_brainz/models/iso/iso_3166_2.rb +29 -0
- data/lib/active_brainz/models/iso/iso_3166_3.rb +29 -0
- data/lib/active_brainz/version.rb +1 -1
- metadata +6 -6
- data/lib/active_brainz/models/concerns/has_begin_end_date.rb +0 -27
- data/lib/active_brainz/models/concerns/has_gid.rb +0 -15
- data/lib/active_brainz/models/concerns/has_parent_children.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a1e585d51875bf9beedf59eeb0613f3975a129b56f2c83f37361a7280fe0246
|
4
|
+
data.tar.gz: 4992719023292e5e2c0cbfd0a285438ef9c1e1e49f29578c189c7c28a41e5eae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 493edeae2350c68c9b0ebe59eac8b1d96c3045ad5bf87be2d46b5d49b67736f6a0134cd9587ce5b6a358625910d4ccb4e1dd39a5cf08ec0bba207906ed3b2dd3
|
7
|
+
data.tar.gz: 13f0cc6c665d3ea16cb619224e8c9e136f658e440d14b1571b608f4251df2aacac36a88a03bd12376c225b4e75418876715059ef8cab7d26b12f1262be9a7343
|
data/config/inflections.rb
CHANGED
data/lib/active_brainz.rb
CHANGED
@@ -13,6 +13,7 @@ module ActiveBrainz
|
|
13
13
|
@root ||= Pathname.new(File.expand_path(File.join("..", ".."), __FILE__))
|
14
14
|
end
|
15
15
|
|
16
|
+
# rubocop:disable Metrics/AbcSize
|
16
17
|
def setup
|
17
18
|
@loader = Zeitwerk::Loader.for_gem
|
18
19
|
|
@@ -21,8 +22,15 @@ module ActiveBrainz
|
|
21
22
|
|
22
23
|
# Set up code loader
|
23
24
|
loader.enable_reloading if ENV["ACTIVE_BRAINZ_ENV"] == "development"
|
24
|
-
|
25
|
-
loader.collapse("lib/active_brainz/
|
25
|
+
|
26
|
+
loader.collapse(root.join("lib/active_brainz/concerns"))
|
27
|
+
loader.collapse(root.join("lib/active_brainz/models"))
|
28
|
+
loader.collapse(root.join("lib/active_brainz/models/*"))
|
29
|
+
|
30
|
+
# Do not eager load models, because they will try and connect to the database
|
31
|
+
# This fails in Rails apps, because gems are loaded before the configuration
|
32
|
+
# is initialized.
|
33
|
+
loader.do_not_eager_load(root.join("lib/active_brainz/models"))
|
26
34
|
|
27
35
|
loader.setup
|
28
36
|
loader.eager_load
|
@@ -30,6 +38,7 @@ module ActiveBrainz
|
|
30
38
|
# Load initializers
|
31
39
|
Dir[root.join("config/initializers/*.rb")].sort.each { |f| require f }
|
32
40
|
end
|
41
|
+
# rubocop:enable Metrics/AbcSize
|
33
42
|
end
|
34
43
|
end
|
35
44
|
|
@@ -60,17 +60,17 @@ module ActiveBrainz
|
|
60
60
|
# class_name: "Editor",
|
61
61
|
# foreign_key: "area"
|
62
62
|
|
63
|
-
|
64
|
-
|
65
|
-
|
63
|
+
has_one :area_iso_3166_1,
|
64
|
+
class_name: "ISO31661",
|
65
|
+
foreign_key: "area"
|
66
66
|
|
67
|
-
|
68
|
-
|
69
|
-
|
67
|
+
has_one :area_iso_3166_2,
|
68
|
+
class_name: "ISO31662",
|
69
|
+
foreign_key: "area"
|
70
70
|
|
71
|
-
|
72
|
-
|
73
|
-
|
71
|
+
has_one :area_iso_3166_3,
|
72
|
+
class_name: "ISO31663",
|
73
|
+
foreign_key: "area"
|
74
74
|
|
75
75
|
has_many :area_labels,
|
76
76
|
class_name: "Label",
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActiveBrainz
|
4
|
+
class ISO31661 < Base
|
5
|
+
self.table_name = "iso_3166_1"
|
6
|
+
self.primary_key = "code"
|
7
|
+
|
8
|
+
belongs_to :iso_3166_1_area,
|
9
|
+
class_name: "Area",
|
10
|
+
foreign_key: "area",
|
11
|
+
optional: true
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# == Schema Information
|
16
|
+
#
|
17
|
+
# Table name: iso_3166_1
|
18
|
+
#
|
19
|
+
# area :integer not null
|
20
|
+
# code :string(2) not null, primary key
|
21
|
+
#
|
22
|
+
# Indexes
|
23
|
+
#
|
24
|
+
# iso_3166_1_idx_area (area)
|
25
|
+
#
|
26
|
+
# Foreign Keys
|
27
|
+
#
|
28
|
+
# iso_3166_1_fk_area (area => area.id)
|
29
|
+
#
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActiveBrainz
|
4
|
+
class ISO31662 < Base
|
5
|
+
self.table_name = "iso_3166_2"
|
6
|
+
self.primary_key = "code"
|
7
|
+
|
8
|
+
belongs_to :iso_3166_2_area,
|
9
|
+
class_name: "Area",
|
10
|
+
foreign_key: "area",
|
11
|
+
optional: true
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# == Schema Information
|
16
|
+
#
|
17
|
+
# Table name: iso_3166_2
|
18
|
+
#
|
19
|
+
# area :integer not null
|
20
|
+
# code :string(10) not null, primary key
|
21
|
+
#
|
22
|
+
# Indexes
|
23
|
+
#
|
24
|
+
# iso_3166_2_idx_area (area)
|
25
|
+
#
|
26
|
+
# Foreign Keys
|
27
|
+
#
|
28
|
+
# iso_3166_2_fk_area (area => area.id)
|
29
|
+
#
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActiveBrainz
|
4
|
+
class ISO31663 < Base
|
5
|
+
self.table_name = "iso_3166_3"
|
6
|
+
self.primary_key = "code"
|
7
|
+
|
8
|
+
belongs_to :iso_3166_3_area,
|
9
|
+
class_name: "Area",
|
10
|
+
foreign_key: "area",
|
11
|
+
optional: true
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# == Schema Information
|
16
|
+
#
|
17
|
+
# Table name: iso_3166_3
|
18
|
+
#
|
19
|
+
# area :integer not null
|
20
|
+
# code :string(4) not null, primary key
|
21
|
+
#
|
22
|
+
# Indexes
|
23
|
+
#
|
24
|
+
# iso_3166_3_idx_area (area)
|
25
|
+
#
|
26
|
+
# Foreign Keys
|
27
|
+
#
|
28
|
+
# iso_3166_3_fk_area (area => area.id)
|
29
|
+
#
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_brainz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Dejonckheere
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -325,12 +325,12 @@ files:
|
|
325
325
|
- lib/active_brainz/models/artist/artist_credit_name.rb
|
326
326
|
- lib/active_brainz/models/artist/artist_type.rb
|
327
327
|
- lib/active_brainz/models/base.rb
|
328
|
-
- lib/active_brainz/models/concerns/has_begin_end_date.rb
|
329
|
-
- lib/active_brainz/models/concerns/has_gid.rb
|
330
|
-
- lib/active_brainz/models/concerns/has_parent_children.rb
|
331
328
|
- lib/active_brainz/models/gender/gender.rb
|
332
329
|
- lib/active_brainz/models/genre/genre.rb
|
333
330
|
- lib/active_brainz/models/genre/genre_alias.rb
|
331
|
+
- lib/active_brainz/models/iso/iso_3166_1.rb
|
332
|
+
- lib/active_brainz/models/iso/iso_3166_2.rb
|
333
|
+
- lib/active_brainz/models/iso/iso_3166_3.rb
|
334
334
|
- lib/active_brainz/models/label/label.rb
|
335
335
|
- lib/active_brainz/models/label/label_alias.rb
|
336
336
|
- lib/active_brainz/models/label/label_alias_type.rb
|
@@ -365,7 +365,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
365
365
|
- !ruby/object:Gem::Version
|
366
366
|
version: '0'
|
367
367
|
requirements: []
|
368
|
-
rubygems_version: 3.2
|
368
|
+
rubygems_version: 3.1.2
|
369
369
|
signing_key:
|
370
370
|
specification_version: 4
|
371
371
|
summary: MusicBrainz ActiveRecord integration
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module ActiveBrainz
|
4
|
-
module HasBeginEndDate
|
5
|
-
extend ActiveSupport::Concern
|
6
|
-
|
7
|
-
included do
|
8
|
-
attribute :begin_date_year, :integer
|
9
|
-
attribute :begin_date_month, :integer
|
10
|
-
attribute :begin_date_day, :integer
|
11
|
-
|
12
|
-
attribute :end_date_year, :integer
|
13
|
-
attribute :end_date_month, :integer
|
14
|
-
attribute :end_date_day, :integer
|
15
|
-
|
16
|
-
attribute :ended, :boolean
|
17
|
-
|
18
|
-
def begin_date
|
19
|
-
@begin_date ||= Date.new(*[begin_date_year, begin_date_month, begin_date_day].compact)
|
20
|
-
end
|
21
|
-
|
22
|
-
def end_date
|
23
|
-
@end_date ||= Date.new(*[end_date_year, end_date_month, end_date_day].compact)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module ActiveBrainz
|
4
|
-
module HasParentChildren
|
5
|
-
extend ActiveSupport::Concern
|
6
|
-
|
7
|
-
included do
|
8
|
-
has_many :children,
|
9
|
-
class_name: name.demodulize,
|
10
|
-
foreign_key: "parent"
|
11
|
-
|
12
|
-
belongs_to :parent,
|
13
|
-
class_name: name.demodulize,
|
14
|
-
foreign_key: "parent",
|
15
|
-
optional: true
|
16
|
-
|
17
|
-
attribute :child_order, :integer
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|