worlddb 0.2.1 → 0.2.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.
- data/Manifest.txt +39 -25
- data/db/africa/countries.rb +19 -0
- data/db/africa/de.countries.yml +10 -0
- data/db/{ca → america/ca}/cities.rb +0 -0
- data/db/america/countries.rb +44 -0
- data/db/america/de.countries.yml +31 -0
- data/db/america/es.countries.yml +30 -0
- data/db/{mx → america/mx}/cities.rb +0 -0
- data/db/{us → america/us}/cities.rb +0 -0
- data/db/america/ve/cities.rb +2 -0
- data/db/asia/countries.rb +22 -0
- data/db/asia/de.countries.yml +9 -0
- data/db/asia/jp/cities.rb +3 -0
- data/db/{at → europe/at}/cities.rb +0 -0
- data/db/{be → europe/be}/cities.rb +0 -0
- data/db/{by → europe/by}/cities.rb +0 -0
- data/db/{ch → europe/ch}/cities.rb +0 -0
- data/db/{en.countries.rb → europe/countries.rb} +18 -60
- data/db/{cy → europe/cy}/cities.rb +0 -0
- data/db/europe/de.countries.yml +42 -0
- data/db/{de → europe/de}/cities.rb +0 -0
- data/db/{dk → europe/dk}/cities.rb +0 -0
- data/db/{en → europe/en}/cities.rb +0 -0
- data/db/europe/es.countries.yml +43 -0
- data/db/{es → europe/es}/cities.rb +0 -0
- data/db/{fr → europe/fr}/cities.rb +0 -0
- data/db/{gr → europe/gr}/cities.rb +0 -0
- data/db/{hr → europe/hr}/cities.rb +0 -0
- data/db/{it → europe/it}/cities.rb +0 -0
- data/db/{nl → europe/nl}/cities.rb +0 -0
- data/db/{pt → europe/pt}/cities.rb +0 -0
- data/db/{ro → europe/ro}/cities.rb +0 -0
- data/db/{ru → europe/ru}/cities.rb +0 -0
- data/db/{sc → europe/sc}/cities.rb +0 -0
- data/db/{tr → europe/tr}/cities.rb +0 -0
- data/db/{ua → europe/ua}/cities.rb +0 -0
- data/db/oceania/au/cities.rb +2 -0
- data/db/oceania/countries.rb +14 -0
- data/db/oceania/de.countries.yml +7 -0
- data/db/tags.rb +8 -0
- data/lib/worlddb/models/country.rb +24 -0
- data/lib/worlddb/schema.rb +1 -0
- data/lib/worlddb/version.rb +1 -1
- metadata +43 -29
- data/db/de.countries.rb +0 -114
data/Manifest.txt
CHANGED
@@ -3,31 +3,45 @@ Manifest.txt
|
|
3
3
|
README.markdown
|
4
4
|
Rakefile
|
5
5
|
bin/worlddb
|
6
|
-
db/
|
7
|
-
db/
|
8
|
-
db/
|
9
|
-
db/
|
10
|
-
db/
|
11
|
-
db/
|
12
|
-
db/
|
13
|
-
db/
|
14
|
-
db/
|
15
|
-
db/
|
16
|
-
db/
|
17
|
-
db/
|
18
|
-
db/
|
19
|
-
db/
|
20
|
-
db/
|
21
|
-
db/
|
22
|
-
db/
|
23
|
-
db/
|
24
|
-
db/
|
25
|
-
db/
|
26
|
-
db/
|
27
|
-
db/
|
28
|
-
db/
|
29
|
-
db/
|
30
|
-
db/
|
6
|
+
db/africa/countries.rb
|
7
|
+
db/africa/de.countries.yml
|
8
|
+
db/america/ca/cities.rb
|
9
|
+
db/america/countries.rb
|
10
|
+
db/america/de.countries.yml
|
11
|
+
db/america/es.countries.yml
|
12
|
+
db/america/mx/cities.rb
|
13
|
+
db/america/us/cities.rb
|
14
|
+
db/america/ve/cities.rb
|
15
|
+
db/asia/countries.rb
|
16
|
+
db/asia/de.countries.yml
|
17
|
+
db/asia/jp/cities.rb
|
18
|
+
db/europe/at/cities.rb
|
19
|
+
db/europe/be/cities.rb
|
20
|
+
db/europe/by/cities.rb
|
21
|
+
db/europe/ch/cities.rb
|
22
|
+
db/europe/countries.rb
|
23
|
+
db/europe/cy/cities.rb
|
24
|
+
db/europe/de.countries.yml
|
25
|
+
db/europe/de/cities.rb
|
26
|
+
db/europe/dk/cities.rb
|
27
|
+
db/europe/en/cities.rb
|
28
|
+
db/europe/es.countries.yml
|
29
|
+
db/europe/es/cities.rb
|
30
|
+
db/europe/fr/cities.rb
|
31
|
+
db/europe/gr/cities.rb
|
32
|
+
db/europe/hr/cities.rb
|
33
|
+
db/europe/it/cities.rb
|
34
|
+
db/europe/nl/cities.rb
|
35
|
+
db/europe/pt/cities.rb
|
36
|
+
db/europe/ro/cities.rb
|
37
|
+
db/europe/ru/cities.rb
|
38
|
+
db/europe/sc/cities.rb
|
39
|
+
db/europe/tr/cities.rb
|
40
|
+
db/europe/ua/cities.rb
|
41
|
+
db/oceania/au/cities.rb
|
42
|
+
db/oceania/countries.rb
|
43
|
+
db/oceania/de.countries.yml
|
44
|
+
db/tags.rb
|
31
45
|
lib/worlddb.rb
|
32
46
|
lib/worlddb/cli/opts.rb
|
33
47
|
lib/worlddb/cli/runner.rb
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
##################################
|
4
|
+
## africa
|
5
|
+
##
|
6
|
+
|
7
|
+
countries = [
|
8
|
+
[ 'dz', 'Algeria', 'ALG' ],
|
9
|
+
[ 'ci', "Côte d'Ivoire", 'CIV' ],
|
10
|
+
[ 'gh', 'Ghana', 'GHA' ],
|
11
|
+
[ 'cm', 'Cameroon', 'CMR' ],
|
12
|
+
[ 'ng', 'Nigeria', 'NGA' ],
|
13
|
+
[ 'za', 'South Africa', 'RSA' ]
|
14
|
+
]
|
15
|
+
|
16
|
+
Country.create_from_ary!( countries )
|
17
|
+
|
18
|
+
|
19
|
+
Prop.create!( key: 'db.countries.africa.version', value: '1' )
|
File without changes
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
###################################################
|
4
|
+
## north/central/south america & caribbean islands
|
5
|
+
|
6
|
+
|
7
|
+
countries = [
|
8
|
+
|
9
|
+
#####################
|
10
|
+
#### north america
|
11
|
+
|
12
|
+
# area (in sq km), pop(ulation)
|
13
|
+
|
14
|
+
[ 'ca', 'Canada', 'CAN', 9984670, 34278406, 'motor:CDN', 'tags:north america|en|fr' ],
|
15
|
+
[ 'mx', 'Mexico', 'MEX', 1972550, 112322757, 'motor:MEX', 'tags:north america|en' ],
|
16
|
+
[ 'us', 'United States', 'USA', 9629091, 314167157, 'motor:USA', 'tags:north america|es' ],
|
17
|
+
|
18
|
+
#####################
|
19
|
+
## central america & caribbean islands
|
20
|
+
|
21
|
+
[ 'cr', 'Costa Rica', 'CRC' ],
|
22
|
+
[ 'hn', 'Honduras', 'HON' ],
|
23
|
+
[ 'sv', 'El Salvador', 'SLV' ],
|
24
|
+
|
25
|
+
##############
|
26
|
+
## south america
|
27
|
+
|
28
|
+
[ 'ar', 'Argentina', 'ARG', 2780400, 40518425, 'motor:RA', 'tags:south america|es' ],
|
29
|
+
[ 'bo', 'Bolivia', 'BOL', 1098581, 10907778, 'motor:BOL', 'tags:south america|es' ],
|
30
|
+
[ 'br', 'Brazil', 'BRA', 8514215, 192380000, 'motor:BR', 'tags:south america|pt' ],
|
31
|
+
[ 'cl', 'Chile', 'CHI', 755696, 16763470, 'motor:RCH', 'tags:south america|es' ],
|
32
|
+
[ 'co', 'Colombia', 'COL', 1138748, 46413791, 'motor:CO', 'tags:south america|es' ],
|
33
|
+
[ 'ec', 'Ecuador', 'ECU', 258238, 15007343, 'motor:EC', 'tags:south america|es' ],
|
34
|
+
[ 'gy', 'Guyana', 'GUY', 214970, 752940, 'motor:GUY', 'tags:south america|en' ],
|
35
|
+
[ 'pe', 'Peru', 'PER', 1285220, 29546963, 'motor:PE', 'tags:south america|es' ],
|
36
|
+
[ 'sr', 'Suriname', 'SUR', 163820, 492829, 'motor:SME', 'tags:south america|nl'],
|
37
|
+
[ 'py', 'Paraguay', 'PAR', 406752, 6375830, 'motor:PY', 'tags:south america|es' ],
|
38
|
+
[ 'uy', 'Uruguay', 'URU', 176215, 3510386, 'motor:ROU', 'tags:south america|es' ],
|
39
|
+
[ 've', 'Venezuela', 'VEN', 916445, 28833845, 'motor:YV', 'tags:south america|es' ]
|
40
|
+
]
|
41
|
+
|
42
|
+
Country.create_from_ary!( countries )
|
43
|
+
|
44
|
+
Prop.create!( key: 'db.countries.america.version', value: '1' )
|
@@ -0,0 +1,31 @@
|
|
1
|
+
###################################################
|
2
|
+
## north/central/south america & caribbean islands
|
3
|
+
|
4
|
+
|
5
|
+
#####################
|
6
|
+
#### north america
|
7
|
+
|
8
|
+
ca: Kanada
|
9
|
+
mx: Mexiko
|
10
|
+
us: United States
|
11
|
+
|
12
|
+
#####################
|
13
|
+
#### central america & caribbean islands
|
14
|
+
|
15
|
+
hn: Honduras
|
16
|
+
cr: Costa Rica
|
17
|
+
sv: El Salvador
|
18
|
+
|
19
|
+
|
20
|
+
##############
|
21
|
+
## south america
|
22
|
+
|
23
|
+
ar: Argentinien
|
24
|
+
br: Brasilien
|
25
|
+
cl: Chile
|
26
|
+
gy: Guyana
|
27
|
+
py: Paraguay
|
28
|
+
uy: Uruguay
|
29
|
+
ec: Ecuador
|
30
|
+
co: Colombia
|
31
|
+
ve: Venezuela
|
@@ -0,0 +1,30 @@
|
|
1
|
+
###################################################
|
2
|
+
## north/central/south america & caribbean islands
|
3
|
+
|
4
|
+
|
5
|
+
#####################
|
6
|
+
#### north america
|
7
|
+
|
8
|
+
ca: Canadá
|
9
|
+
mx: México
|
10
|
+
us: Estados Unidos
|
11
|
+
|
12
|
+
#####################
|
13
|
+
#### central america & caribbean islands
|
14
|
+
|
15
|
+
hn: Honduras
|
16
|
+
cr: Costa Rica
|
17
|
+
sv: El Salvador
|
18
|
+
|
19
|
+
##############
|
20
|
+
## south america
|
21
|
+
|
22
|
+
ar: Argentina
|
23
|
+
br: Brasil
|
24
|
+
co: Colombia
|
25
|
+
cl: Chile
|
26
|
+
ec: Ecuador
|
27
|
+
gy: Guyana
|
28
|
+
py: Paraguay
|
29
|
+
uy: Uruguay
|
30
|
+
ve: Venezuela
|
File without changes
|
File without changes
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
##################################
|
4
|
+
### asia (includes middle east)
|
5
|
+
##
|
6
|
+
|
7
|
+
## NB: uefa country kazakhstan is listed here
|
8
|
+
## NB: australia is listed in oceania (w/ australia)
|
9
|
+
|
10
|
+
|
11
|
+
countries = [
|
12
|
+
[ 'jp', 'Japan', 'JPN' ],
|
13
|
+
[ 'kp', 'North Korea', 'PRK' ],
|
14
|
+
[ 'kr', 'South Korea', 'KOR' ],
|
15
|
+
[ 'in', 'India', 'IND' ],
|
16
|
+
[ 'kz', 'Kazakhstan', 'KAZ', 'tags:uefa' ]
|
17
|
+
]
|
18
|
+
|
19
|
+
|
20
|
+
Country.create_from_ary!( countries )
|
21
|
+
|
22
|
+
Prop.create!( key: 'db.countries.asia.version', value: '1' )
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,5 +1,18 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
+
####################
|
4
|
+
### europe
|
5
|
+
|
6
|
+
|
7
|
+
## NB:
|
8
|
+
#
|
9
|
+
# countries also include:
|
10
|
+
# england (en), scotland (sc)
|
11
|
+
#
|
12
|
+
# also turkey, russia, georiga, etc.
|
13
|
+
# note: the uefa country kazachstan is listed in asia
|
14
|
+
|
15
|
+
|
3
16
|
## NB: for keys use internet domain/iso two letter code
|
4
17
|
#
|
5
18
|
# more info about iso country codes:
|
@@ -13,21 +26,15 @@
|
|
13
26
|
# -> differences (fifa,ioc,iso) -> http://en.wikipedia.org/wiki/Comparison_of_IOC,_FIFA,_and_ISO_3166_country_codes
|
14
27
|
|
15
28
|
|
16
|
-
### english version
|
17
|
-
|
18
29
|
countries = [
|
19
|
-
|
20
|
-
####################
|
21
|
-
### europe
|
22
|
-
|
23
30
|
[ 'ad', 'Andorra', 'AND' ],
|
24
31
|
[ 'al', 'Albania', 'ALB' ],
|
25
32
|
[ 'am', 'Armenia', 'ARM' ],
|
26
|
-
[ 'at', 'Austria',
|
27
|
-
[ 'be', 'Belgium', 'BEL' ],
|
33
|
+
[ 'at', 'Austria', 'AUT', 'tags:europe|uefa|eu|un' ],
|
34
|
+
[ 'be', 'Belgium', 'BEL', 'tags:europe|uefa|eu|un|benelux' ],
|
28
35
|
[ 'bg', 'Bulgaria', 'BUL' ], # NB: ISO (BGR) <> FIFA (BUL)
|
29
36
|
[ 'by', 'Belarus', 'BLR' ],
|
30
|
-
[ 'ch', 'Switzerland', 'SUI' ], # NB: ISO (CHE) <> FIFA (SUI)
|
37
|
+
[ 'ch', 'Switzerland', 'SUI', 'tags:europe|uefa|un' ], # NB: ISO (CHE) <> FIFA (SUI)
|
31
38
|
[ 'cy', 'Cyprus', 'CYP' ],
|
32
39
|
[ 'cz', 'Czech Republic', 'CZE' ],
|
33
40
|
[ 'de', 'Germany', 'GER' ], # NB: ISO (DEU) <> FIFA (GER)
|
@@ -43,7 +50,6 @@ countries = [
|
|
43
50
|
[ 'hu', 'Hungary', 'HUN' ],
|
44
51
|
[ 'ie', 'Irland', 'IRL' ],
|
45
52
|
[ 'it', 'Italy', 'ITA' ],
|
46
|
-
[ 'kz', 'Kazakhstan', 'KAZ' ],
|
47
53
|
[ 'mt', 'Malta', 'MLT' ],
|
48
54
|
[ 'nl', 'Netherlands', 'NED' ], # NB: ISO (NLD) <> FIFA (NED)
|
49
55
|
[ 'pl', 'Poland', 'POL' ],
|
@@ -59,57 +65,9 @@ countries = [
|
|
59
65
|
[ 'ua', 'Ukraine', 'UKR' ],
|
60
66
|
[ 'mk', 'Macedonia', 'MKD' ],
|
61
67
|
[ 'no', 'Norway', 'NOR' ],
|
62
|
-
[ 'is', 'Iceland', 'ISL' ]
|
63
|
-
|
64
|
-
##############
|
65
|
-
## south america
|
66
|
-
|
67
|
-
[ 'ar', 'Argentina', 'ARG' ],
|
68
|
-
[ 'br', 'Brazil', 'BRA' ],
|
69
|
-
[ 'cl', 'Chile', 'CHI' ],
|
70
|
-
[ 'py', 'Paraguay', 'PAR' ],
|
71
|
-
[ 'uy', 'Uruguay', 'URU' ],
|
72
|
-
[ 'ec', 'Ecuador', 'ECU' ],
|
73
|
-
[ 'co', 'Colombia', 'COL' ],
|
74
|
-
|
75
|
-
#####################
|
76
|
-
#### north/central america & caribbean islands
|
77
|
-
|
78
|
-
[ 'ca', 'Canada', 'CAN' ],
|
79
|
-
[ 'mx', 'Mexico', 'MEX' ],
|
80
|
-
[ 'us', 'United States', 'USA' ],
|
81
|
-
[ 'hn', 'Honduras', 'HON' ],
|
82
|
-
[ 'cr', 'Costa Rica', 'CRC' ],
|
83
|
-
[ 'sv', 'El Salvador', 'SLV' ],
|
84
|
-
[ 'gy', 'Guyana', 'GUY' ],
|
85
|
-
|
86
|
-
########################
|
87
|
-
## africa
|
88
|
-
|
89
|
-
[ 'dz', 'Algeria', 'ALG' ],
|
90
|
-
[ 'ci', "Côte d'Ivoire", 'CIV' ],
|
91
|
-
[ 'gh', 'Ghana', 'GHA' ],
|
92
|
-
[ 'cm', 'Cameroon', 'CMR' ],
|
93
|
-
[ 'ng', 'Nigeria', 'NGA' ],
|
94
|
-
[ 'za', 'South Africa', 'RSA' ],
|
95
|
-
|
96
|
-
#############################
|
97
|
-
## asia w/ australia
|
98
|
-
|
99
|
-
[ 'au', 'Australia', 'AUS' ],
|
100
|
-
[ 'jp', 'Japan', 'JPN' ],
|
101
|
-
[ 'kp', 'North Korea', 'PRK' ],
|
102
|
-
[ 'kr', 'South Korea', 'KOR' ],
|
103
|
-
[ 'in', 'India', 'IND' ],
|
104
|
-
|
105
|
-
###############################
|
106
|
-
## oceania
|
107
|
-
|
108
|
-
[ 'nz', 'New Zealand', 'NZL' ]
|
68
|
+
[ 'is', 'Iceland', 'ISL' ]
|
109
69
|
]
|
110
70
|
|
111
|
-
|
112
71
|
Country.create_from_ary!( countries )
|
113
72
|
|
114
|
-
|
115
|
-
Prop.create!( key: 'db.countries.version', value: '1' )
|
73
|
+
Prop.create!( key: 'db.countries.europe.version', value: '1' )
|
File without changes
|
@@ -0,0 +1,42 @@
|
|
1
|
+
####################
|
2
|
+
## europe
|
3
|
+
|
4
|
+
ad: Andorra
|
5
|
+
al: Albanien
|
6
|
+
am: Armenien
|
7
|
+
at: Österreich
|
8
|
+
be: Belgien
|
9
|
+
bg: Bulgarien
|
10
|
+
by: Weißrussland
|
11
|
+
ch: Schweiz
|
12
|
+
cy: Zypern
|
13
|
+
cz: Tschechien
|
14
|
+
de: Deutschland
|
15
|
+
dk: Dänemark
|
16
|
+
en: England
|
17
|
+
es: Spanien
|
18
|
+
fi: Finnland
|
19
|
+
fo: Färöer
|
20
|
+
fr: Frankreich
|
21
|
+
ge: Georgien
|
22
|
+
gr: Griechenland
|
23
|
+
hr: Kroatien
|
24
|
+
hu: Ungarn
|
25
|
+
ie: Irland
|
26
|
+
it: Italien
|
27
|
+
mt: Malta
|
28
|
+
nl: Niederlande
|
29
|
+
pl: Polen
|
30
|
+
pt: Portugal
|
31
|
+
ro: Rumänien
|
32
|
+
rs: Serbien
|
33
|
+
ru: Russland
|
34
|
+
sc: Schottland
|
35
|
+
se: Schweden
|
36
|
+
si: Slowenien
|
37
|
+
sk: Slowakei
|
38
|
+
tr: Türkei
|
39
|
+
ua: Ukraine
|
40
|
+
mk: Mazedonien
|
41
|
+
no: Norwegen
|
42
|
+
is: Island
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,43 @@
|
|
1
|
+
####################
|
2
|
+
## europe
|
3
|
+
|
4
|
+
ad: Andorra
|
5
|
+
al: Albania
|
6
|
+
am: Armenia
|
7
|
+
at: Austria
|
8
|
+
be: Bélgica
|
9
|
+
bg: Bulgaria
|
10
|
+
by: Bielorrusia
|
11
|
+
ch: Suiza
|
12
|
+
cy: Chipre
|
13
|
+
## República Checa
|
14
|
+
cz: Chequia
|
15
|
+
de: Alemania
|
16
|
+
dk: Dinamarca
|
17
|
+
en: Inglaterra
|
18
|
+
es: España
|
19
|
+
fi: Finlandia
|
20
|
+
fo: Islas Feroe
|
21
|
+
fr: Francia
|
22
|
+
ge: Georgia
|
23
|
+
gr: Grecia
|
24
|
+
hr: Croacia
|
25
|
+
hu: Hungría
|
26
|
+
ie: Irlanda
|
27
|
+
it: Italia
|
28
|
+
mt: Malta
|
29
|
+
nl: Países Bajos
|
30
|
+
pl: Polonia
|
31
|
+
pt: Portugal
|
32
|
+
ro: Rumania
|
33
|
+
rs: Serbia
|
34
|
+
ru: Rusia
|
35
|
+
sc: Escocia
|
36
|
+
se: Suecia
|
37
|
+
si: Eslovenia
|
38
|
+
sk: Eslovaquia
|
39
|
+
tr: Turquía
|
40
|
+
ua: Ucrania
|
41
|
+
mk: Macedonia
|
42
|
+
no: Noruega
|
43
|
+
is: Islandia
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
###############################
|
4
|
+
## australia & oceania
|
5
|
+
|
6
|
+
countries = [
|
7
|
+
[ 'au', 'Australia', 'AUS' ],
|
8
|
+
[ 'nz', 'New Zealand', 'NZL' ]
|
9
|
+
]
|
10
|
+
|
11
|
+
Country.create_from_ary!( countries )
|
12
|
+
|
13
|
+
|
14
|
+
Prop.create!( key: 'db.countries.oceania.version', value: '1' )
|
data/db/tags.rb
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
|
2
|
+
## some tags
|
3
|
+
|
4
|
+
continents = ['europe','america','asia','africa','oceania']
|
5
|
+
americas = ['north america', 'south america', 'central america', 'caribbean islands']
|
6
|
+
orgs = ['un', 'eu', 'mercosur', 'nafta']
|
7
|
+
football = ['uefa', 'afc', 'ofc', 'caf', 'csf', 'concacaf']
|
8
|
+
regions = ['benelux']
|
@@ -18,6 +18,30 @@ class Country < ActiveRecord::Base
|
|
18
18
|
:tag => values[2]
|
19
19
|
}
|
20
20
|
|
21
|
+
value_numbers = []
|
22
|
+
|
23
|
+
## check for optional values
|
24
|
+
values[3..-1].each do |value|
|
25
|
+
if value.is_a? Numeric
|
26
|
+
value_numbers << value
|
27
|
+
elsif value =~ /^motor:/
|
28
|
+
value_motor = value[6..-1] ## cut off region: motor
|
29
|
+
attr[ :motor ] = value_motor
|
30
|
+
elsif value =~ /^tags:/
|
31
|
+
value_tags = value[5..-1] ## cut off tags: prefix
|
32
|
+
# do nothing now
|
33
|
+
else
|
34
|
+
# issue warning: unknown type for value
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
if value_numbers.size > 0
|
39
|
+
attr[ :area ] = value_numbers[0] # NB: area for countries goes first
|
40
|
+
attr[ :pop ] = value_numbers[1]
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
|
21
45
|
Country.create!( attr )
|
22
46
|
end # each country
|
23
47
|
end
|
data/lib/worlddb/schema.rb
CHANGED
@@ -15,6 +15,7 @@ create_table :countries do |t|
|
|
15
15
|
t.string :key, :null => false
|
16
16
|
t.string :tag, :null => false # short three letter tag (FIFA country code)
|
17
17
|
t.string :synonyms # comma separated list of synonyms
|
18
|
+
t.string :motor # optional auto motor (vehicle) licene plate
|
18
19
|
t.integer :pop # optional population count
|
19
20
|
t.integer :area # optional area in square km (sq. km)
|
20
21
|
t.timestamps
|
data/lib/worlddb/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: worlddb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 2
|
10
|
+
version: 0.2.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Gerald Bauer
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-11-
|
18
|
+
date: 2012-11-08 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: activerecord
|
@@ -76,31 +76,45 @@ files:
|
|
76
76
|
- README.markdown
|
77
77
|
- Rakefile
|
78
78
|
- bin/worlddb
|
79
|
-
- db/
|
80
|
-
- db/
|
81
|
-
- db/
|
82
|
-
- db/
|
83
|
-
- db/
|
84
|
-
- db/
|
85
|
-
- db/
|
86
|
-
- db/
|
87
|
-
- db/
|
88
|
-
- db/
|
89
|
-
- db/
|
90
|
-
- db/
|
91
|
-
- db/
|
92
|
-
- db/
|
93
|
-
- db/
|
94
|
-
- db/
|
95
|
-
- db/
|
96
|
-
- db/
|
97
|
-
- db/
|
98
|
-
- db/
|
99
|
-
- db/
|
100
|
-
- db/
|
101
|
-
- db/
|
102
|
-
- db/
|
103
|
-
- db/
|
79
|
+
- db/africa/countries.rb
|
80
|
+
- db/africa/de.countries.yml
|
81
|
+
- db/america/ca/cities.rb
|
82
|
+
- db/america/countries.rb
|
83
|
+
- db/america/de.countries.yml
|
84
|
+
- db/america/es.countries.yml
|
85
|
+
- db/america/mx/cities.rb
|
86
|
+
- db/america/us/cities.rb
|
87
|
+
- db/america/ve/cities.rb
|
88
|
+
- db/asia/countries.rb
|
89
|
+
- db/asia/de.countries.yml
|
90
|
+
- db/asia/jp/cities.rb
|
91
|
+
- db/europe/at/cities.rb
|
92
|
+
- db/europe/be/cities.rb
|
93
|
+
- db/europe/by/cities.rb
|
94
|
+
- db/europe/ch/cities.rb
|
95
|
+
- db/europe/countries.rb
|
96
|
+
- db/europe/cy/cities.rb
|
97
|
+
- db/europe/de.countries.yml
|
98
|
+
- db/europe/de/cities.rb
|
99
|
+
- db/europe/dk/cities.rb
|
100
|
+
- db/europe/en/cities.rb
|
101
|
+
- db/europe/es.countries.yml
|
102
|
+
- db/europe/es/cities.rb
|
103
|
+
- db/europe/fr/cities.rb
|
104
|
+
- db/europe/gr/cities.rb
|
105
|
+
- db/europe/hr/cities.rb
|
106
|
+
- db/europe/it/cities.rb
|
107
|
+
- db/europe/nl/cities.rb
|
108
|
+
- db/europe/pt/cities.rb
|
109
|
+
- db/europe/ro/cities.rb
|
110
|
+
- db/europe/ru/cities.rb
|
111
|
+
- db/europe/sc/cities.rb
|
112
|
+
- db/europe/tr/cities.rb
|
113
|
+
- db/europe/ua/cities.rb
|
114
|
+
- db/oceania/au/cities.rb
|
115
|
+
- db/oceania/countries.rb
|
116
|
+
- db/oceania/de.countries.yml
|
117
|
+
- db/tags.rb
|
104
118
|
- lib/worlddb.rb
|
105
119
|
- lib/worlddb/cli/opts.rb
|
106
120
|
- lib/worlddb/cli/runner.rb
|
data/db/de.countries.rb
DELETED
@@ -1,114 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
## NB: for keys use internet domain/iso two letter code
|
4
|
-
#
|
5
|
-
# more info about iso country codes:
|
6
|
-
# -> http://en.wikipedia.org/wiki/ISO_3166-1
|
7
|
-
# two letter codes -> http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
|
8
|
-
# three letter codes -> http://en.wikipedia.org/wiki/ISO_3166-1_alpha-3
|
9
|
-
#
|
10
|
-
# for three letter codes use fifa code or iso code
|
11
|
-
# - fifa three letter country codes
|
12
|
-
# -> http://en.wikipedia.org/wiki/List_of_FIFA_country_codes
|
13
|
-
# -> differences (fifa,ioc,iso) -> http://en.wikipedia.org/wiki/Comparison_of_IOC,_FIFA,_and_ISO_3166_country_codes
|
14
|
-
|
15
|
-
|
16
|
-
countries = [
|
17
|
-
|
18
|
-
####################
|
19
|
-
### europe
|
20
|
-
|
21
|
-
[ 'ad', 'Andorra', 'AND' ],
|
22
|
-
[ 'al', 'Albanien', 'ALB' ],
|
23
|
-
[ 'am', 'Armenien', 'ARM' ],
|
24
|
-
[ 'at', 'Österreich', 'AUT' ],
|
25
|
-
[ 'be', 'Belgien', 'BEL' ],
|
26
|
-
[ 'bg', 'Bulgarien', 'BUL' ], # NB: ISO (BGR) <> FIFA (BUL)
|
27
|
-
[ 'by', 'Weißrussland', 'BLR' ],
|
28
|
-
[ 'ch', 'Schweiz', 'SUI' ], # NB: ISO (CHE) <> FIFA (SUI)
|
29
|
-
[ 'cy', 'Zypern', 'CYP' ],
|
30
|
-
[ 'cz', 'Tschechien', 'CZE' ],
|
31
|
-
[ 'de', 'Deutschland', 'GER' ], # NB: ISO (DEU) <> FIFA (GER)
|
32
|
-
[ 'dk', 'Dänemark', 'DEN' ], # NB: ISO (DNK) <> FIFA (DEN)
|
33
|
-
[ 'en', 'England', 'ENG' ], # NB: FIFA (ENG); not a valid iso country n internet domain / it's uk - what to use - anything better?
|
34
|
-
[ 'es', 'Spanien', 'ESP' ],
|
35
|
-
[ 'fi', 'Finnland', 'FIN' ],
|
36
|
-
[ 'fo', 'Färöer', 'FRO' ],
|
37
|
-
[ 'fr', 'Frankreich', 'FRA' ],
|
38
|
-
[ 'ge', 'Georgien', 'GEO' ],
|
39
|
-
[ 'gr', 'Griechenland', 'GRE' ], # NB: ISO (GRC) <> FIFA (GRE)
|
40
|
-
[ 'hr', 'Kroatien', 'CRO' ], # NB: ISO (HRV) <> FIFA (CRO); local name: Hrvatska
|
41
|
-
[ 'hu', 'Ungarn', 'HUN' ],
|
42
|
-
[ 'ie', 'Irland', 'IRL' ],
|
43
|
-
[ 'it', 'Italien', 'ITA' ],
|
44
|
-
[ 'kz', 'Kasachstan', 'KAZ' ],
|
45
|
-
[ 'mt', 'Malta', 'MLT' ],
|
46
|
-
[ 'nl', 'Niederlande', 'NED' ], # NB: ISO (NLD) <> FIFA (NED)
|
47
|
-
[ 'pl', 'Polen', 'POL' ],
|
48
|
-
[ 'pt', 'Portugal', 'POR' ], # NB: ISO (PRT) <> FIFA (POR)
|
49
|
-
[ 'ro', 'Rumänien', 'ROU' ],
|
50
|
-
[ 'rs', 'Serbien', 'SRB' ],
|
51
|
-
[ 'ru', 'Russland', 'RUS' ],
|
52
|
-
[ 'sc', 'Schottland', 'SCO' ], # NB: FIFA (SCO); not a valid iso country/internet domain - it's uk - what to use - anything better?
|
53
|
-
[ 'se', 'Schweden', 'SWE' ],
|
54
|
-
[ 'si', 'Slowenien', 'SVN' ],
|
55
|
-
[ 'sk', 'Slowakei', 'SVK' ],
|
56
|
-
[ 'tr', 'Türkei', 'TUR' ],
|
57
|
-
[ 'ua', 'Ukraine', 'UKR' ],
|
58
|
-
[ 'mk', 'Mazedonien', 'MKD' ],
|
59
|
-
[ 'no', 'Norwegen', 'NOR' ],
|
60
|
-
[ 'is', 'Island', 'ISL' ],
|
61
|
-
|
62
|
-
|
63
|
-
##############
|
64
|
-
## south america
|
65
|
-
|
66
|
-
[ 'ar', 'Argentinien', 'ARG' ],
|
67
|
-
[ 'br', 'Brasilien', 'BRA' ],
|
68
|
-
[ 'cl', 'Chile', 'CHI' ],
|
69
|
-
[ 'py', 'Paraguay', 'PAR' ],
|
70
|
-
[ 'uy', 'Uruguay', 'URU' ],
|
71
|
-
[ 'ec', 'Ecuador', 'ECU' ],
|
72
|
-
[ 'co', 'Colombia', 'COL' ],
|
73
|
-
|
74
|
-
#####################
|
75
|
-
#### north/central america & caribbean islands
|
76
|
-
|
77
|
-
[ 'ca', 'Kanada', 'CAN' ],
|
78
|
-
[ 'mx', 'Mexiko', 'MEX' ],
|
79
|
-
[ 'us', 'United States', 'USA' ],
|
80
|
-
[ 'hn', 'Honduras', 'HON' ],
|
81
|
-
[ 'cr', 'Costa Rica', 'CRC' ],
|
82
|
-
[ 'sv', 'El Salvador', 'SLV' ],
|
83
|
-
[ 'gy', 'Guyana', 'GUY' ],
|
84
|
-
|
85
|
-
########################
|
86
|
-
## africa
|
87
|
-
|
88
|
-
[ 'dz', 'Algerien', 'ALG' ],
|
89
|
-
[ 'ci', 'Elfenbeinküste', 'CIV' ],
|
90
|
-
[ 'gh', 'Ghana', 'GHA' ],
|
91
|
-
[ 'cm', 'Kamerun', 'CMR' ],
|
92
|
-
[ 'ng', 'Nigeria', 'NGA' ],
|
93
|
-
[ 'za', 'Südafrika', 'RSA' ],
|
94
|
-
|
95
|
-
#############################
|
96
|
-
## asia w/ australia
|
97
|
-
|
98
|
-
[ 'au', 'Australien', 'AUS' ],
|
99
|
-
[ 'jp', 'Japan', 'JPN' ],
|
100
|
-
[ 'kp', 'Nordkorea', 'PRK' ],
|
101
|
-
[ 'kr', 'Südkorea', 'KOR' ],
|
102
|
-
[ 'in', 'Indien', 'IND' ],
|
103
|
-
|
104
|
-
###############################
|
105
|
-
## oceania
|
106
|
-
|
107
|
-
[ 'nz', 'Neuseeland', 'NZL' ]
|
108
|
-
]
|
109
|
-
|
110
|
-
|
111
|
-
Country.create_from_ary!( countries )
|
112
|
-
|
113
|
-
|
114
|
-
Prop.create!( key: 'db.countries.version', value: '1' )
|