worlddb 0.6.8 → 0.7.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.
- data/Manifest.txt +1 -0
- data/Rakefile +54 -6
- data/lib/worlddb/loader.rb +12 -32
- data/lib/worlddb/models/prop.rb +27 -1
- data/lib/worlddb/reader.rb +45 -70
- data/lib/worlddb/readers/code_reader.rb +34 -0
- data/lib/worlddb/readers/hash_reader.rb +9 -1
- data/lib/worlddb/utils.rb +0 -15
- data/lib/worlddb/version.rb +1 -1
- data/lib/worlddb.rb +99 -75
- metadata +6 -5
data/Manifest.txt
CHANGED
@@ -102,6 +102,7 @@ lib/worlddb/models/region.rb
|
|
102
102
|
lib/worlddb/models/tag.rb
|
103
103
|
lib/worlddb/models/tagging.rb
|
104
104
|
lib/worlddb/reader.rb
|
105
|
+
lib/worlddb/readers/code_reader.rb
|
105
106
|
lib/worlddb/readers/hash_reader.rb
|
106
107
|
lib/worlddb/readers/line_reader.rb
|
107
108
|
lib/worlddb/readers/values_reader.rb
|
data/Rakefile
CHANGED
@@ -1,9 +1,17 @@
|
|
1
|
+
require 'pp'
|
1
2
|
require 'hoe'
|
2
3
|
require './lib/worlddb/version.rb'
|
3
4
|
|
4
5
|
## NB: plugin (hoe-manifest) not required; just used for future testing/development
|
5
6
|
Hoe::plugin :manifest # more options for manifests (in the future; not yet)
|
6
7
|
|
8
|
+
|
9
|
+
###########
|
10
|
+
#### NB: if you try this script at home
|
11
|
+
# you need to create a (symbolic) link to the world.db fixtures
|
12
|
+
# e.g. use ln -s ../world.db data or similar
|
13
|
+
|
14
|
+
|
7
15
|
Hoe.spec 'worlddb' do
|
8
16
|
|
9
17
|
self.version = WorldDB::VERSION
|
@@ -15,11 +23,6 @@ Hoe.spec 'worlddb' do
|
|
15
23
|
|
16
24
|
self.author = 'Gerald Bauer'
|
17
25
|
self.email = 'opensport@googlegroups.com'
|
18
|
-
|
19
|
-
# switch extension to .markdown for gihub formatting
|
20
|
-
# - auto-added from Manifest.txt (see define_spec in class Hoe)
|
21
|
-
# self.readme_file = 'README.md'
|
22
|
-
# self.history_file = 'History.md'
|
23
26
|
|
24
27
|
self.extra_deps = [
|
25
28
|
['activerecord', '~> 3.2'] # NB: will include activesupport,etc.
|
@@ -32,4 +35,49 @@ Hoe.spec 'worlddb' do
|
|
32
35
|
:required_ruby_version => '>= 1.9.2'
|
33
36
|
}
|
34
37
|
|
35
|
-
end
|
38
|
+
end
|
39
|
+
|
40
|
+
##############################
|
41
|
+
## for testing
|
42
|
+
##
|
43
|
+
## NB: use rake -I ./lib dev:test # fresh import (starts w/ clean wipe out)
|
44
|
+
|
45
|
+
namespace :dev do
|
46
|
+
|
47
|
+
BUILD_DIR = "./build"
|
48
|
+
|
49
|
+
WORLD_DB_PATH = "#{BUILD_DIR}/world.db"
|
50
|
+
|
51
|
+
DB_CONFIG = {
|
52
|
+
:adapter => 'sqlite3',
|
53
|
+
:database => WORLD_DB_PATH
|
54
|
+
}
|
55
|
+
|
56
|
+
directory BUILD_DIR
|
57
|
+
|
58
|
+
task :clean do
|
59
|
+
rm WORLD_DB_PATH if File.exists?( WORLD_DB_PATH )
|
60
|
+
end
|
61
|
+
|
62
|
+
task :env => BUILD_DIR do
|
63
|
+
require './lib/worlddb.rb'
|
64
|
+
|
65
|
+
pp DB_CONFIG
|
66
|
+
ActiveRecord::Base.establish_connection( DB_CONFIG )
|
67
|
+
end
|
68
|
+
|
69
|
+
task :create => :env do
|
70
|
+
WorldDB.create
|
71
|
+
end
|
72
|
+
|
73
|
+
task :import => :env do
|
74
|
+
WorldDB.read_all # populate world tables
|
75
|
+
WorldDB.stats
|
76
|
+
end
|
77
|
+
|
78
|
+
|
79
|
+
desc 'worlddb - test loading of builtin fixtures'
|
80
|
+
task :test => [:clean, :create, :import]
|
81
|
+
|
82
|
+
|
83
|
+
end # namespace :dev
|
data/lib/worlddb/loader.rb
CHANGED
@@ -2,11 +2,6 @@ module WorldDB
|
|
2
2
|
|
3
3
|
class Loader
|
4
4
|
|
5
|
-
## make models available in worlddb module by default with namespace
|
6
|
-
# e.g. lets you use City instead of Models::City
|
7
|
-
include WorldDB::Models
|
8
|
-
|
9
|
-
|
10
5
|
def initialize( logger=nil )
|
11
6
|
if logger.nil?
|
12
7
|
@logger = Logger.new(STDOUT)
|
@@ -34,42 +29,27 @@ class Loader
|
|
34
29
|
end # method run
|
35
30
|
|
36
31
|
|
32
|
+
class CodeContext
|
33
|
+
## make models available in worlddb module by default with namespace
|
34
|
+
# e.g. lets you use City instead of Models::City
|
35
|
+
include WorldDB::Models
|
36
|
+
end
|
37
|
+
|
38
|
+
### todo: rename to load_fixtures_w_include_path (a little shorter - why? why not?)
|
37
39
|
def load_fixtures_with_include_path( name, include_path ) # load from file system
|
38
40
|
path = "#{include_path}/#{name}.rb"
|
39
41
|
|
40
42
|
puts "*** loading data '#{name}' (#{path})..."
|
41
43
|
|
42
|
-
|
43
|
-
|
44
|
-
load_fixtures_worker( code )
|
45
|
-
end
|
46
|
-
|
47
|
-
def load_fixtures_builtin( name ) # load from gem (built-in)
|
48
|
-
path = "#{WorldDB.root}/data/#{name}.rb"
|
44
|
+
CodeReader.new( logger, path ).eval( CodeContext )
|
49
45
|
|
50
|
-
|
46
|
+
# Prop.create!( :key => "db.#{name}.version", :value => WorldDB::VERSION )
|
47
|
+
end
|
51
48
|
|
52
|
-
|
53
|
-
|
54
|
-
load_fixtures_worker( code )
|
49
|
+
def load_fixtures_builtin( name ) # load from gem (built-in)
|
50
|
+
load_fixtures_with_include_path( name, WorldDB.data_path )
|
55
51
|
end
|
56
|
-
|
57
52
|
|
58
|
-
private
|
59
|
-
def load_fixtures_worker( code )
|
60
|
-
|
61
|
-
self.class_eval( code )
|
62
53
|
|
63
|
-
# NB: same as
|
64
|
-
#
|
65
|
-
# module WorldDB
|
66
|
-
# include WorldDB::Models
|
67
|
-
# <code here>
|
68
|
-
# end
|
69
|
-
|
70
|
-
# Prop.create!( :key => "db.#{name}.version", :value => SportDB::VERSION )
|
71
|
-
|
72
|
-
end
|
73
|
-
|
74
54
|
end # class Loader
|
75
55
|
end # module WorldDB
|
data/lib/worlddb/models/prop.rb
CHANGED
@@ -3,7 +3,33 @@
|
|
3
3
|
module WorldDB::Models
|
4
4
|
|
5
5
|
class Prop < ActiveRecord::Base
|
6
|
+
|
7
|
+
def self.create_from_worlddb_fixture!( name, path )
|
8
|
+
key = "db.#{fixture_name_to_prop_key(name)}.version"
|
6
9
|
|
7
|
-
|
10
|
+
if path.starts_with?( WorldDB.data_path )
|
11
|
+
value = "world.yml.#{WorldDB::VERSION}" # assume builtin
|
12
|
+
else
|
13
|
+
value = "file.txt.#{File.mtime(path).strftime('%Y.%m.%d')}"
|
14
|
+
end
|
15
|
+
|
16
|
+
Prop.create!( key: key, value: value )
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
# helper
|
22
|
+
# change at/2012_13/bl to at.2012/13.bl
|
23
|
+
# or quali_2012_13_europe_c to quali.2012/13.europe.c
|
8
24
|
|
25
|
+
def self.fixture_name_to_prop_key( name )
|
26
|
+
prop_key = name.gsub( '/', '.' )
|
27
|
+
prop_key = prop_key.gsub( /(\d{4})_(\d{2})/, '\1/\2' ) # 2012_13 => 2012/13
|
28
|
+
prop_key = prop_key.gsub( '_', '.' )
|
29
|
+
prop_key
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
end # class Prop
|
34
|
+
|
9
35
|
end # module WorldDB::Models
|
data/lib/worlddb/reader.rb
CHANGED
@@ -23,25 +23,33 @@ class Reader
|
|
23
23
|
args.each do |arg|
|
24
24
|
name = arg # File.basename( arg, '.*' )
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
data_path = opts.load? ? WorldDB.data_path : opts.data_path
|
27
|
+
|
28
|
+
if opts.countries?
|
29
|
+
load_countries_with_include_path( name, data_path )
|
30
|
+
elsif opts.regions?
|
31
|
+
load_regions_with_include_path( opts.country, name, data_path )
|
32
|
+
elsif opts.cities?
|
33
|
+
load_cities_with_include_path( opts.country, name, data_path )
|
30
34
|
else
|
31
|
-
|
32
|
-
load_regions_with_include_path( opts.country, name, opts.data_path ) if opts.regions?
|
33
|
-
load_cities_with_include_path( opts.country, name, opts.data_path ) if opts.cities?
|
35
|
+
## todo: issue a warning here; no fixture type specified; assume country?
|
34
36
|
end
|
35
|
-
end
|
37
|
+
end # each arg
|
36
38
|
|
37
39
|
end
|
38
40
|
|
39
41
|
|
40
|
-
############################
|
41
|
-
# load from file system
|
42
|
-
|
43
42
|
def load_with_include_path( name, include_path )
|
44
|
-
|
43
|
+
|
44
|
+
if name =~ /\/fifa/
|
45
|
+
load_xxx_with_include_path( 'fifa', name, include_path )
|
46
|
+
elsif name =~ /\/iso3/
|
47
|
+
load_xxx_with_include_path( 'iso3', name, include_path )
|
48
|
+
elsif name =~ /\/internet/
|
49
|
+
load_xxx_with_include_path( 'net', name, include_path )
|
50
|
+
elsif name =~ /\/motor/
|
51
|
+
load_xxx_with_include_path( 'motor', name, include_path )
|
52
|
+
elsif name =~ /^([a-z]{3,})\/countries/ # e.g. africa/countries or america/countries
|
45
53
|
## auto-add continent (from folder structure) as tag
|
46
54
|
load_countries_with_include_path( name, include_path, :tags => $1 )
|
47
55
|
elsif name =~ /\/([a-z]{2})\/cities/
|
@@ -56,71 +64,46 @@ class Reader
|
|
56
64
|
end
|
57
65
|
end
|
58
66
|
|
67
|
+
def load_builtin( name ) ## convenience helper (requires proper named files w/ convention)
|
68
|
+
load_with_include_path( name, WorldDB.data_path )
|
69
|
+
end
|
70
|
+
|
71
|
+
|
59
72
|
def load_countries_with_include_path( name, include_path, more_values={} )
|
60
73
|
load_fixtures_with_include_path_for( Country, name, include_path, more_values )
|
61
74
|
end
|
62
75
|
|
63
|
-
def
|
64
|
-
|
65
|
-
puts "Country #{country.key} >#{country.title} (#{country.code})<"
|
66
|
-
|
67
|
-
load_fixtures_with_include_path_for( Region, name, include_path, country_id: country.id )
|
76
|
+
def load_countries_builtin( name, more_values={} )
|
77
|
+
load_countries_with_include_path( name, WorldDB.data_path, more_values )
|
68
78
|
end
|
69
79
|
|
70
|
-
|
80
|
+
|
81
|
+
def load_regions_with_include_path( country_key, name, include_path )
|
71
82
|
country = Country.find_by_key!( country_key )
|
72
83
|
puts "Country #{country.key} >#{country.title} (#{country.code})<"
|
73
84
|
|
74
|
-
load_fixtures_with_include_path_for(
|
85
|
+
load_fixtures_with_include_path_for( Region, name, include_path, country_id: country.id )
|
75
86
|
end
|
76
|
-
|
77
|
-
##################################
|
78
|
-
# load from gem (built-in)
|
79
87
|
|
80
|
-
def
|
81
|
-
|
82
|
-
if name =~ /\/fifa/
|
83
|
-
load_xxx_builtin( 'fifa', name )
|
84
|
-
elsif name =~ /\/iso3/
|
85
|
-
load_xxx_builtin( 'iso3', name )
|
86
|
-
elsif name =~ /\/internet/
|
87
|
-
load_xxx_builtin( 'net', name )
|
88
|
-
elsif name =~ /\/motor/
|
89
|
-
load_xxx_builtin( 'motor', name )
|
90
|
-
elsif name =~ /^([a-z]{3,})\/countries/ # e.g. africa/countries or america/countries
|
91
|
-
## auto-add continent (from folder structure) as tag
|
92
|
-
load_countries_builtin( name, :tags => $1 )
|
93
|
-
elsif name =~ /\/([a-z]{2})\/cities/
|
94
|
-
load_cities_builtin( $1, name )
|
95
|
-
elsif name =~ /\/([a-z]{2})\/regions/
|
96
|
-
load_regions_builtin( $1, name )
|
97
|
-
else
|
98
|
-
puts "*** error: unknown world.db fixture type >#{name}<"
|
99
|
-
# todo/fix: exit w/ error
|
100
|
-
end
|
88
|
+
def load_regions_builtin( country_key, name )
|
89
|
+
load_regions_with_include_path( country_key, name, WorldDB.data_path )
|
101
90
|
end
|
102
91
|
|
103
|
-
def load_countries_builtin( name, more_values )
|
104
|
-
load_fixtures_builtin_for( Country, name, more_values )
|
105
|
-
end
|
106
92
|
|
107
|
-
def
|
93
|
+
def load_cities_with_include_path( country_key, name, include_path )
|
108
94
|
country = Country.find_by_key!( country_key )
|
109
95
|
puts "Country #{country.key} >#{country.title} (#{country.code})<"
|
110
|
-
|
111
|
-
|
96
|
+
|
97
|
+
load_fixtures_with_include_path_for( City, name, include_path, country_id: country.id )
|
112
98
|
end
|
113
|
-
|
114
|
-
def load_cities_builtin( country_key, name )
|
115
|
-
country = Country.find_by_key!( country_key )
|
116
|
-
puts "Country #{country.key} >#{country.title} (#{country.code})<"
|
117
99
|
|
118
|
-
|
100
|
+
def load_cities_builtin( country_key, name )
|
101
|
+
load_cities_with_include_path( country_key, name, WorldDB.data_path )
|
119
102
|
end
|
120
103
|
|
121
104
|
|
122
|
-
def
|
123
|
-
path = "#{
|
105
|
+
def load_xxx_with_include_path( xxx, name, include_path )
|
106
|
+
path = "#{include_path}/#{name}.yml"
|
124
107
|
|
125
108
|
puts "*** parsing data '#{name}' (#{path})..."
|
126
109
|
|
@@ -132,7 +115,11 @@ class Reader
|
|
132
115
|
country.save!
|
133
116
|
end
|
134
117
|
|
135
|
-
Prop.
|
118
|
+
Prop.create_from_worlddb_fixture!( name, path )
|
119
|
+
end
|
120
|
+
|
121
|
+
def load_xxx_builtin( xxx, name )
|
122
|
+
load_xxx_with_include_path( xxx, name, WorldDB.data_path )
|
136
123
|
end
|
137
124
|
|
138
125
|
|
@@ -146,19 +133,7 @@ private
|
|
146
133
|
|
147
134
|
load_fixtures_worker_for( clazz, reader )
|
148
135
|
|
149
|
-
Prop.
|
150
|
-
end
|
151
|
-
|
152
|
-
def load_fixtures_builtin_for( clazz, name, more_values={} ) # load from gem (built-in)
|
153
|
-
path = "#{WorldDB.root}/data/#{name}.txt"
|
154
|
-
|
155
|
-
puts "*** parsing data '#{name}' (#{path})..."
|
156
|
-
|
157
|
-
reader = ValuesReader.new( logger, path, more_values )
|
158
|
-
|
159
|
-
load_fixtures_worker_for( clazz, reader )
|
160
|
-
|
161
|
-
Prop.create!( key: "db.#{fixture_name_to_prop_key(name)}.version", value: "world.txt.#{WorldDB::VERSION}" )
|
136
|
+
Prop.create_from_worlddb_fixture!( name, path )
|
162
137
|
end
|
163
138
|
|
164
139
|
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
class CodeReader
|
4
|
+
|
5
|
+
def initialize( logger=nil, path )
|
6
|
+
if logger.nil?
|
7
|
+
@logger = Logger.new(STDOUT)
|
8
|
+
@logger.level = Logger::INFO
|
9
|
+
else
|
10
|
+
@logger = logger
|
11
|
+
end
|
12
|
+
|
13
|
+
@path = path
|
14
|
+
|
15
|
+
## nb: assume/enfore utf-8 encoding (with or without BOM - byte order mark)
|
16
|
+
## - see worlddb/utils.rb
|
17
|
+
|
18
|
+
@code = File.read_utf8( @path )
|
19
|
+
end
|
20
|
+
|
21
|
+
def eval( klass )
|
22
|
+
klass.class_eval( @code )
|
23
|
+
|
24
|
+
# NB: same as
|
25
|
+
#
|
26
|
+
# module WorldDB
|
27
|
+
# include WorldDB::Models
|
28
|
+
# <code here>
|
29
|
+
# end
|
30
|
+
end
|
31
|
+
|
32
|
+
attr_reader :logger
|
33
|
+
|
34
|
+
end # class CodeReader
|
@@ -15,7 +15,15 @@ class HashReader
|
|
15
15
|
|
16
16
|
## nb: assume/enfore utf-8 encoding (with or without BOM - byte order mark)
|
17
17
|
## - see worlddb/utils.rb
|
18
|
-
|
18
|
+
|
19
|
+
text = File.read_utf8( @path )
|
20
|
+
### hack for syck yaml parser (e.g.ruby 1.9.2) (cannot handle !!null)
|
21
|
+
## change it to !null to get plain nil
|
22
|
+
## w/ both syck and psych/libyml
|
23
|
+
|
24
|
+
text = text.gsub( '!!null', '!null' )
|
25
|
+
|
26
|
+
@hash = YAML.load( text )
|
19
27
|
end
|
20
28
|
|
21
29
|
attr_reader :logger
|
data/lib/worlddb/utils.rb
CHANGED
@@ -26,21 +26,6 @@ class File
|
|
26
26
|
end
|
27
27
|
end # class File
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
##
|
32
|
-
# fix/todo: share helper w/ other readers
|
33
|
-
|
34
|
-
# helper
|
35
|
-
# change at/2012_13/bl to at.2012/13.bl
|
36
|
-
# or quali_2012_13_europe_c to quali.2012/13.europe.c
|
37
|
-
|
38
|
-
def fixture_name_to_prop_key( name )
|
39
|
-
prop_key = name.gsub( '/', '.' )
|
40
|
-
prop_key = prop_key.gsub( /(\d{4})_(\d{2})/, '\1/\2' ) # 2012_13 => 2012/13
|
41
|
-
prop_key = prop_key.gsub( '_', '.' )
|
42
|
-
prop_key
|
43
|
-
end
|
44
29
|
|
45
30
|
############
|
46
31
|
### fix/todo: share helper for all text readers/parsers- where to put it?
|
data/lib/worlddb/version.rb
CHANGED
data/lib/worlddb.rb
CHANGED
@@ -30,6 +30,7 @@ require 'worlddb/models/tag'
|
|
30
30
|
require 'worlddb/models/tagging'
|
31
31
|
require 'worlddb/schema' # NB: requires worlddb/models (include WorldDB::Models)
|
32
32
|
require 'worlddb/utils'
|
33
|
+
require 'worlddb/readers/code_reader'
|
33
34
|
require 'worlddb/readers/line_reader'
|
34
35
|
require 'worlddb/readers/values_reader'
|
35
36
|
require 'worlddb/readers/hash_reader'
|
@@ -47,6 +48,11 @@ module WorldDB
|
|
47
48
|
def self.root
|
48
49
|
"#{File.expand_path( File.dirname(File.dirname(__FILE__)) )}"
|
49
50
|
end
|
51
|
+
|
52
|
+
# builtin path to fixture data
|
53
|
+
def self.data_path
|
54
|
+
"#{root}/data"
|
55
|
+
end
|
50
56
|
|
51
57
|
def self.main
|
52
58
|
Runner.new.run(ARGV)
|
@@ -67,82 +73,100 @@ module WorldDB
|
|
67
73
|
end
|
68
74
|
|
69
75
|
def self.fixtures # all builtin fixtures; helper for covenience
|
76
|
+
africa_fixtures +
|
77
|
+
america_fixtures +
|
78
|
+
europe_fixtures +
|
79
|
+
asia_fixtures +
|
80
|
+
oceania_fixtures
|
81
|
+
end
|
82
|
+
|
83
|
+
def self.africa_fixtures
|
84
|
+
['countries',
|
85
|
+
'1_codes/fifa',
|
86
|
+
'1_codes/internet',
|
87
|
+
'1_codes/iso3'].map { |path| "africa/#{path}" }
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.america_fixtures
|
91
|
+
['countries',
|
92
|
+
'1_codes/fifa',
|
93
|
+
'1_codes/internet',
|
94
|
+
'1_codes/iso3',
|
95
|
+
'1_codes/motor',
|
96
|
+
'br/regions',
|
97
|
+
'br/cities',
|
98
|
+
'ca/regions',
|
99
|
+
'ca/cities',
|
100
|
+
'mx/regions',
|
101
|
+
'mx/cities',
|
102
|
+
'us/regions',
|
103
|
+
'us/cities',
|
104
|
+
've/regions',
|
105
|
+
've/cities'].map { |path| "america/#{path}" }
|
106
|
+
end
|
107
|
+
|
108
|
+
def self.asia_fixtures
|
109
|
+
['countries',
|
110
|
+
'1_codes/fifa',
|
111
|
+
'1_codes/internet',
|
112
|
+
'1_codes/iso3',
|
113
|
+
'jp/cities'].map { |path| "asia/#{path}" }
|
114
|
+
end
|
115
|
+
|
116
|
+
def self.europe_fixtures
|
117
|
+
['countries',
|
118
|
+
'1_codes/fifa',
|
119
|
+
'1_codes/internet',
|
120
|
+
'1_codes/iso3',
|
121
|
+
'1_codes/motor',
|
122
|
+
'at/regions',
|
123
|
+
'at/cities',
|
124
|
+
'be/regions',
|
125
|
+
'be/cities',
|
126
|
+
'bg/cities',
|
127
|
+
'by/cities',
|
128
|
+
'ch/cities',
|
129
|
+
'cy/cities',
|
130
|
+
'cz/regions',
|
131
|
+
'cz/cities',
|
132
|
+
'de/regions',
|
133
|
+
'de/cities',
|
134
|
+
'dk/cities',
|
135
|
+
'ee/cities',
|
136
|
+
'en/regions',
|
137
|
+
'en/cities',
|
138
|
+
'es/regions',
|
139
|
+
'es/cities',
|
140
|
+
'fi/cities',
|
141
|
+
'fr/regions',
|
142
|
+
'fr/cities',
|
143
|
+
'gr/cities',
|
144
|
+
'hr/cities',
|
145
|
+
'hu/cities',
|
146
|
+
'ie/cities',
|
147
|
+
'it/cities',
|
148
|
+
'lt/cities',
|
149
|
+
'lv/cities',
|
150
|
+
'nl/cities',
|
151
|
+
'no/cities',
|
152
|
+
'pl/cities',
|
153
|
+
'pt/cities',
|
154
|
+
'ro/cities',
|
155
|
+
'rs/cities',
|
156
|
+
'ru/cities',
|
157
|
+
'sc/cities',
|
158
|
+
'se/cities',
|
159
|
+
'tr/cities',
|
160
|
+
'ua/cities',
|
161
|
+
'wa/cities'].map { |path| "europe/#{path}" }
|
162
|
+
end
|
70
163
|
|
71
|
-
|
72
|
-
'
|
73
|
-
'
|
74
|
-
'
|
75
|
-
'
|
76
|
-
'
|
77
|
-
'america/1_codes/internet',
|
78
|
-
'america/1_codes/iso3',
|
79
|
-
'america/1_codes/motor',
|
80
|
-
'america/br/regions',
|
81
|
-
'america/br/cities',
|
82
|
-
'america/ca/regions',
|
83
|
-
'america/ca/cities',
|
84
|
-
'america/mx/regions',
|
85
|
-
'america/mx/cities',
|
86
|
-
'america/us/regions',
|
87
|
-
'america/us/cities',
|
88
|
-
'america/ve/regions',
|
89
|
-
'america/ve/cities',
|
90
|
-
'asia/countries',
|
91
|
-
'asia/1_codes/fifa',
|
92
|
-
'asia/1_codes/internet',
|
93
|
-
'asia/1_codes/iso3',
|
94
|
-
'asia/jp/cities',
|
95
|
-
'europe/countries',
|
96
|
-
'europe/1_codes/fifa',
|
97
|
-
'europe/1_codes/internet',
|
98
|
-
'europe/1_codes/iso3',
|
99
|
-
'europe/1_codes/motor',
|
100
|
-
'europe/at/regions',
|
101
|
-
'europe/at/cities',
|
102
|
-
'europe/be/regions',
|
103
|
-
'europe/be/cities',
|
104
|
-
'europe/bg/cities',
|
105
|
-
'europe/by/cities',
|
106
|
-
'europe/ch/cities',
|
107
|
-
'europe/cy/cities',
|
108
|
-
'europe/cz/regions',
|
109
|
-
'europe/cz/cities',
|
110
|
-
'europe/de/regions',
|
111
|
-
'europe/de/cities',
|
112
|
-
'europe/dk/cities',
|
113
|
-
'europe/ee/cities',
|
114
|
-
'europe/en/regions',
|
115
|
-
'europe/en/cities',
|
116
|
-
'europe/es/regions',
|
117
|
-
'europe/es/cities',
|
118
|
-
'europe/fi/cities',
|
119
|
-
'europe/fr/regions',
|
120
|
-
'europe/fr/cities',
|
121
|
-
'europe/gr/cities',
|
122
|
-
'europe/hr/cities',
|
123
|
-
'europe/hu/cities',
|
124
|
-
'europe/ie/cities',
|
125
|
-
'europe/it/cities',
|
126
|
-
'europe/lt/cities',
|
127
|
-
'europe/lv/cities',
|
128
|
-
'europe/nl/cities',
|
129
|
-
'europe/no/cities',
|
130
|
-
'europe/pl/cities',
|
131
|
-
'europe/pt/cities',
|
132
|
-
'europe/ro/cities',
|
133
|
-
'europe/rs/cities',
|
134
|
-
'europe/ru/cities',
|
135
|
-
'europe/sc/cities',
|
136
|
-
'europe/se/cities',
|
137
|
-
'europe/tr/cities',
|
138
|
-
'europe/ua/cities',
|
139
|
-
'europe/wa/cities',
|
140
|
-
'oceania/countries',
|
141
|
-
'oceania/1_codes/fifa',
|
142
|
-
'oceania/1_codes/internet',
|
143
|
-
'oceania/1_codes/iso3',
|
144
|
-
'oceania/au/cities'
|
145
|
-
]
|
164
|
+
def self.oceania_fixtures
|
165
|
+
['countries',
|
166
|
+
'1_codes/fifa',
|
167
|
+
'1_codes/internet',
|
168
|
+
'1_codes/iso3',
|
169
|
+
'au/cities'].map { |path| "oceania/#{path}" }
|
146
170
|
end
|
147
171
|
|
148
172
|
|
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: 3
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 7
|
9
|
+
- 0
|
10
|
+
version: 0.7.0
|
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-12-
|
18
|
+
date: 2012-12-05 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: activerecord
|
@@ -175,6 +175,7 @@ files:
|
|
175
175
|
- lib/worlddb/models/tag.rb
|
176
176
|
- lib/worlddb/models/tagging.rb
|
177
177
|
- lib/worlddb/reader.rb
|
178
|
+
- lib/worlddb/readers/code_reader.rb
|
178
179
|
- lib/worlddb/readers/hash_reader.rb
|
179
180
|
- lib/worlddb/readers/line_reader.rb
|
180
181
|
- lib/worlddb/readers/values_reader.rb
|