worlddb 0.8.0 → 1.0.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.
Files changed (110) hide show
  1. data/Manifest.txt +4 -98
  2. data/Rakefile +1 -6
  3. data/lib/worlddb/cli/main.rb +170 -0
  4. data/lib/worlddb/cli/opts.rb +24 -50
  5. data/lib/worlddb/data/fixtures.rb +168 -0
  6. data/lib/worlddb/deleter.rb +26 -0
  7. data/lib/worlddb/reader.rb +8 -61
  8. data/lib/worlddb/stats.rb +30 -0
  9. data/lib/worlddb/utils.rb +0 -60
  10. data/lib/worlddb/version.rb +1 -2
  11. data/lib/worlddb.rb +24 -184
  12. metadata +30 -108
  13. data/data/africa/1_codes/fifa.yml +0 -59
  14. data/data/africa/1_codes/internet.yml +0 -64
  15. data/data/africa/1_codes/iso3.yml +0 -57
  16. data/data/africa/2_names/de.yml +0 -10
  17. data/data/africa/3_more/en.wikipedia.yml +0 -30
  18. data/data/africa/3_more/lang.yml +0 -63
  19. data/data/africa/countries.txt +0 -92
  20. data/data/america/1_codes/fifa.yml +0 -41
  21. data/data/america/1_codes/internet.yml +0 -39
  22. data/data/america/1_codes/iso3.yml +0 -39
  23. data/data/america/1_codes/motor.yml +0 -26
  24. data/data/america/2_names/de.yml +0 -31
  25. data/data/america/2_names/es.yml +0 -30
  26. data/data/america/3_more/en.wikipedia.yml +0 -9
  27. data/data/america/3_more/lang.yml +0 -60
  28. data/data/america/br/regions.txt +0 -27
  29. data/data/america/ca/cities.txt +0 -48
  30. data/data/america/ca/regions.txt +0 -28
  31. data/data/america/countries.txt +0 -70
  32. data/data/america/mx/cities.txt +0 -32
  33. data/data/america/mx/regions.txt +0 -54
  34. data/data/america/us/cities.txt +0 -46
  35. data/data/america/us/regions.txt +0 -64
  36. data/data/america/ve/cities.txt +0 -358
  37. data/data/america/ve/regions.txt +0 -46
  38. data/data/asia/1_codes/fifa.yml +0 -53
  39. data/data/asia/1_codes/internet.yml +0 -51
  40. data/data/asia/1_codes/iso3.yml +0 -51
  41. data/data/asia/2_names/de.yml +0 -9
  42. data/data/asia/3_more/en.wikipedia.yml +0 -26
  43. data/data/asia/3_more/lang.yml +0 -55
  44. data/data/asia/countries.txt +0 -126
  45. data/data/asia/jp/cities.txt +0 -3
  46. data/data/europe/1_codes/fifa.yml +0 -60
  47. data/data/europe/1_codes/internet.yml +0 -59
  48. data/data/europe/1_codes/iso3.yml +0 -59
  49. data/data/europe/1_codes/motor.yml +0 -60
  50. data/data/europe/2_names/de.yml +0 -42
  51. data/data/europe/2_names/es.yml +0 -43
  52. data/data/europe/3_more/en.wikipedia.yml +0 -12
  53. data/data/europe/3_more/lang.yml +0 -47
  54. data/data/europe/at/cities.txt +0 -45
  55. data/data/europe/at/regions.txt +0 -26
  56. data/data/europe/be/cities.txt +0 -19
  57. data/data/europe/be/regions.txt +0 -23
  58. data/data/europe/bg/cities.txt +0 -4
  59. data/data/europe/by/cities.txt +0 -4
  60. data/data/europe/ch/cities.txt +0 -4
  61. data/data/europe/countries.txt +0 -123
  62. data/data/europe/cy/cities.txt +0 -1
  63. data/data/europe/cz/cities.txt +0 -26
  64. data/data/europe/cz/regions.txt +0 -32
  65. data/data/europe/de/cities.txt +0 -44
  66. data/data/europe/de/regions.txt +0 -16
  67. data/data/europe/dk/cities.txt +0 -6
  68. data/data/europe/ee/cities.txt +0 -2
  69. data/data/europe/en/cities.txt +0 -32
  70. data/data/europe/en/regions.txt +0 -21
  71. data/data/europe/es/cities.txt +0 -17
  72. data/data/europe/es/regions.txt +0 -26
  73. data/data/europe/fi/cities.txt +0 -2
  74. data/data/europe/fr/cities.txt +0 -15
  75. data/data/europe/fr/regions.txt +0 -32
  76. data/data/europe/gr/cities.txt +0 -6
  77. data/data/europe/hr/cities.txt +0 -1
  78. data/data/europe/hu/cities.txt +0 -2
  79. data/data/europe/ie/cities.txt +0 -3
  80. data/data/europe/it/cities.txt +0 -17
  81. data/data/europe/lt/cities.txt +0 -3
  82. data/data/europe/lv/cities.txt +0 -4
  83. data/data/europe/nl/cities.txt +0 -11
  84. data/data/europe/no/cities.txt +0 -3
  85. data/data/europe/pl/cities.txt +0 -12
  86. data/data/europe/pt/cities.txt +0 -6
  87. data/data/europe/ro/cities.txt +0 -4
  88. data/data/europe/rs/cities.txt +0 -3
  89. data/data/europe/ru/cities.txt +0 -14
  90. data/data/europe/sc/cities.txt +0 -3
  91. data/data/europe/se/cities.txt +0 -3
  92. data/data/europe/tr/cities.txt +0 -3
  93. data/data/europe/ua/cities.txt +0 -9
  94. data/data/europe/wa/cities.txt +0 -3
  95. data/data/langs.yml +0 -210
  96. data/data/oceania/1_codes/fifa.yml +0 -21
  97. data/data/oceania/1_codes/internet.yml +0 -17
  98. data/data/oceania/1_codes/iso3.yml +0 -17
  99. data/data/oceania/2_names/de.yml +0 -7
  100. data/data/oceania/3_more/en.wikipedia.yml +0 -11
  101. data/data/oceania/3_more/lang.yml +0 -17
  102. data/data/oceania/au/cities.txt +0 -2
  103. data/data/oceania/countries.txt +0 -40
  104. data/data/tags.1.yml +0 -40
  105. data/data/tags.3.yml +0 -23
  106. data/lib/worlddb/cli/runner.rb +0 -113
  107. data/lib/worlddb/readers/code_reader.rb +0 -34
  108. data/lib/worlddb/readers/hash_reader.rb +0 -81
  109. data/lib/worlddb/readers/line_reader.rb +0 -45
  110. data/lib/worlddb/readers/values_reader.rb +0 -171
data/Manifest.txt CHANGED
@@ -3,103 +3,12 @@ Manifest.txt
3
3
  README.md
4
4
  Rakefile
5
5
  bin/worlddb
6
- data/africa/1_codes/fifa.yml
7
- data/africa/1_codes/internet.yml
8
- data/africa/1_codes/iso3.yml
9
- data/africa/2_names/de.yml
10
- data/africa/3_more/en.wikipedia.yml
11
- data/africa/3_more/lang.yml
12
- data/africa/countries.txt
13
- data/america/1_codes/fifa.yml
14
- data/america/1_codes/internet.yml
15
- data/america/1_codes/iso3.yml
16
- data/america/1_codes/motor.yml
17
- data/america/2_names/de.yml
18
- data/america/2_names/es.yml
19
- data/america/3_more/en.wikipedia.yml
20
- data/america/3_more/lang.yml
21
- data/america/br/regions.txt
22
- data/america/ca/cities.txt
23
- data/america/ca/regions.txt
24
- data/america/countries.txt
25
- data/america/mx/cities.txt
26
- data/america/mx/regions.txt
27
- data/america/us/cities.txt
28
- data/america/us/regions.txt
29
- data/america/ve/cities.txt
30
- data/america/ve/regions.txt
31
- data/asia/1_codes/fifa.yml
32
- data/asia/1_codes/internet.yml
33
- data/asia/1_codes/iso3.yml
34
- data/asia/2_names/de.yml
35
- data/asia/3_more/en.wikipedia.yml
36
- data/asia/3_more/lang.yml
37
- data/asia/countries.txt
38
- data/asia/jp/cities.txt
39
- data/europe/1_codes/fifa.yml
40
- data/europe/1_codes/internet.yml
41
- data/europe/1_codes/iso3.yml
42
- data/europe/1_codes/motor.yml
43
- data/europe/2_names/de.yml
44
- data/europe/2_names/es.yml
45
- data/europe/3_more/en.wikipedia.yml
46
- data/europe/3_more/lang.yml
47
- data/europe/at/cities.txt
48
- data/europe/at/regions.txt
49
- data/europe/be/cities.txt
50
- data/europe/be/regions.txt
51
- data/europe/bg/cities.txt
52
- data/europe/by/cities.txt
53
- data/europe/ch/cities.txt
54
- data/europe/countries.txt
55
- data/europe/cy/cities.txt
56
- data/europe/cz/cities.txt
57
- data/europe/cz/regions.txt
58
- data/europe/de/cities.txt
59
- data/europe/de/regions.txt
60
- data/europe/dk/cities.txt
61
- data/europe/ee/cities.txt
62
- data/europe/en/cities.txt
63
- data/europe/en/regions.txt
64
- data/europe/es/cities.txt
65
- data/europe/es/regions.txt
66
- data/europe/fi/cities.txt
67
- data/europe/fr/cities.txt
68
- data/europe/fr/regions.txt
69
- data/europe/gr/cities.txt
70
- data/europe/hr/cities.txt
71
- data/europe/hu/cities.txt
72
- data/europe/ie/cities.txt
73
- data/europe/it/cities.txt
74
- data/europe/lt/cities.txt
75
- data/europe/lv/cities.txt
76
- data/europe/nl/cities.txt
77
- data/europe/no/cities.txt
78
- data/europe/pl/cities.txt
79
- data/europe/pt/cities.txt
80
- data/europe/ro/cities.txt
81
- data/europe/rs/cities.txt
82
- data/europe/ru/cities.txt
83
- data/europe/sc/cities.txt
84
- data/europe/se/cities.txt
85
- data/europe/tr/cities.txt
86
- data/europe/ua/cities.txt
87
- data/europe/wa/cities.txt
88
- data/langs.yml
89
- data/oceania/1_codes/fifa.yml
90
- data/oceania/1_codes/internet.yml
91
- data/oceania/1_codes/iso3.yml
92
- data/oceania/2_names/de.yml
93
- data/oceania/3_more/en.wikipedia.yml
94
- data/oceania/3_more/lang.yml
95
- data/oceania/au/cities.txt
96
- data/oceania/countries.txt
97
- data/tags.1.yml
98
- data/tags.3.yml
99
6
  lib/worlddb.rb
7
+ lib/worlddb/cli/main.rb
100
8
  lib/worlddb/cli/opts.rb
101
- lib/worlddb/cli/runner.rb
102
9
  lib/worlddb/console.rb
10
+ lib/worlddb/data/fixtures.rb
11
+ lib/worlddb/deleter.rb
103
12
  lib/worlddb/models/city.rb
104
13
  lib/worlddb/models/country.rb
105
14
  lib/worlddb/models/lang.rb
@@ -109,10 +18,7 @@ lib/worlddb/models/tag.rb
109
18
  lib/worlddb/models/tagging.rb
110
19
  lib/worlddb/models/usage.rb
111
20
  lib/worlddb/reader.rb
112
- lib/worlddb/readers/code_reader.rb
113
- lib/worlddb/readers/hash_reader.rb
114
- lib/worlddb/readers/line_reader.rb
115
- lib/worlddb/readers/values_reader.rb
116
21
  lib/worlddb/schema.rb
22
+ lib/worlddb/stats.rb
117
23
  lib/worlddb/utils.rb
118
24
  lib/worlddb/version.rb
data/Rakefile CHANGED
@@ -6,12 +6,6 @@ require './lib/worlddb/version.rb'
6
6
  Hoe::plugin :manifest # more options for manifests (in the future; not yet)
7
7
 
8
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
-
15
9
  Hoe.spec 'worlddb' do
16
10
 
17
11
  self.version = WorldDB::VERSION
@@ -25,6 +19,7 @@ Hoe.spec 'worlddb' do
25
19
  self.email = 'opensport@googlegroups.com'
26
20
 
27
21
  self.extra_deps = [
22
+ ['textutils', '~> 0.3.0'],
28
23
  ['activerecord', '~> 3.2'] # NB: will include activesupport,etc.
29
24
  ### ['sqlite3', '~> 1.3'] # NB: install on your own; remove dependency
30
25
  ]
@@ -0,0 +1,170 @@
1
+ # encoding: utf-8
2
+
3
+ require 'commander/import'
4
+
5
+ require 'worlddb/cli/opts'
6
+
7
+
8
+
9
+ program :name, 'worlddb'
10
+ program :version, WorldDB::VERSION
11
+ program :description, "world.db command line tool, version #{WorldDB::VERSION}"
12
+
13
+
14
+ # default_command :help
15
+ default_command :load
16
+
17
+ program :help_formatter, Commander::HelpFormatter::TerminalCompact
18
+
19
+ ## program :help, 'Examples', 'yada yada -try multi line later'
20
+
21
+ =begin
22
+ ### add to help use new sections
23
+
24
+ Examples:
25
+ worlddb at/cities # import austrian cities
26
+ worlddb --create # create database schema
27
+
28
+ More Examples:
29
+ worlddb # show stats (table counts, table props)
30
+
31
+ Further information:
32
+ http://geraldb.github.com/world.db=end
33
+ =end
34
+
35
+
36
+ ## todo: find a better name e.g. change to settings? config? safe_opts? why? why not?
37
+ myopts = WorldDB::Opts.new
38
+
39
+ ### global option (required)
40
+ ## todo: add check that path is valid?? possible?
41
+
42
+ global_option '-i', '--include PATH', String, "Data path (default is #{myopts.data_path})"
43
+ global_option '-d', '--dbpath PATH', String, "Database path (default is #{myopts.db_path})"
44
+ global_option '-n', '--dbname NAME', String, "Database name (datault is #{myopts.db_name})"
45
+
46
+
47
+ def connect_to_db( options )
48
+ puts WorldDB.banner
49
+
50
+ puts "working directory: #{Dir.pwd}"
51
+
52
+ db_config = {
53
+ :adapter => 'sqlite3',
54
+ :database => "#{options.db_path}/#{options.db_name}"
55
+ }
56
+
57
+ puts "Connecting to db using settings: "
58
+ pp db_config
59
+
60
+ ActiveRecord::Base.establish_connection( db_config )
61
+ end
62
+
63
+
64
+ command :create do |c|
65
+ c.syntax = 'worlddb create [options]'
66
+ c.description = 'Create DB schema'
67
+ c.action do |args, options|
68
+ myopts.merge_commander_options!( options.__hash__ )
69
+ connect_to_db( myopts )
70
+
71
+ LogDB.create
72
+ WorldDB.create
73
+ puts 'Done.'
74
+ end # action
75
+ end # command create
76
+
77
+ command :setup do |c|
78
+ c.syntax = 'worlddb setup [options]'
79
+ c.description = "Create DB schema 'n' load all data"
80
+
81
+ c.option '--delete', 'Delete all records'
82
+
83
+ c.action do |args, options|
84
+ myopts.merge_commander_options!( options.__hash__ )
85
+ connect_to_db( myopts )
86
+
87
+ if options.delete.present?
88
+ # w/ delete flag assume tables already exit
89
+ WorldDB.delete!
90
+ else
91
+ LogDB.create
92
+ WorldDB.create
93
+ end
94
+
95
+ WorldDB.read_all( myopts.data_path )
96
+ puts 'Done.'
97
+ end # action
98
+ end # command setup
99
+
100
+ command :load do |c|
101
+ ## todo: how to specify many fixutes <>... ??? in syntax
102
+ c.syntax = 'worlddb load [options] <fixtures>'
103
+ c.description = 'Load fixtures'
104
+
105
+ c.option '--country KEY', String, "Default country for regions 'n' cities"
106
+
107
+ ### todd/check - type flags still needed? dispatch using name and convention?
108
+ c.option '--countries', 'Use country plain text fixture reader'
109
+ c.option '--regions', 'Use regions plain text fixture reader'
110
+ c.option '--cities', 'Use cities plain text fixture reader'
111
+
112
+ c.option '--delete', 'Delete all records'
113
+
114
+ c.action do |args, options|
115
+ myopts.merge_commander_options!( options.__hash__ )
116
+ connect_to_db( myopts )
117
+
118
+ WorldDB.delete! if options.delete.present?
119
+
120
+ # read plain text country/region/city fixtures
121
+ reader = WorldDB::Reader.new # todo: add logger here?
122
+ args.each do |arg|
123
+ name = arg # File.basename( arg, '.*' )
124
+
125
+ if myopts.countries?
126
+ reader.load_countries_with_include_path( name, myopts.data_path )
127
+ elsif myopts.regions?
128
+ reader.load_regions_with_include_path( myopts.country, name, myopts.data_path )
129
+ elsif myopts.cities?
130
+ reader.load_cities_with_include_path( myopts.country, name, myopts.data_path )
131
+ else
132
+ reader.load_with_include_path( name, myopts.data_path )
133
+ ## todo: issue a warning here; no fixture type specified; assume country?
134
+ end
135
+
136
+ end # each arg
137
+
138
+ puts 'Done.'
139
+ end
140
+ end # command load
141
+
142
+
143
+ command :stats do |c|
144
+ c.syntax = 'worlddb stats [options]'
145
+ c.description = 'Show stats'
146
+ c.action do |args, options|
147
+ myopts.merge_commander_options!( options.__hash__ )
148
+ connect_to_db( myopts )
149
+
150
+ WorldDB.stats
151
+
152
+ puts 'Done.'
153
+ end
154
+ end
155
+
156
+
157
+ command :test do |c|
158
+ c.syntax = 'worlddb test [options]'
159
+ c.description = 'Debug/test command suite'
160
+ c.action do |args, options|
161
+ puts "hello from test command"
162
+ puts "args (#{args.class.name}):"
163
+ pp args
164
+ puts "options:"
165
+ pp options
166
+ puts "options.__hash__:"
167
+ pp options.__hash__
168
+ puts 'Done.'
169
+ end
170
+ end
@@ -2,6 +2,30 @@ module WorldDB
2
2
 
3
3
  class Opts
4
4
 
5
+ def merge_commander_options!( options = {} )
6
+ @db_path = options[:dbpath] if options[:dbpath].present?
7
+ @db_name = options[:dbname] if options[:dbname].present?
8
+
9
+ @data_path = options[:include] if options[:include].present?
10
+
11
+ @country = options[:country] if options[:country].present?
12
+
13
+ @countries = options[:countries] if options[:countries].present?
14
+ @regions = options[:regions] if options[:regions].present?
15
+ @cities = options[:cities] if options[:cities].present?
16
+ end
17
+
18
+
19
+ def db_path
20
+ @db_path || '.'
21
+ end
22
+
23
+ def db_name
24
+ @db_name || 'world.db'
25
+ end
26
+
27
+
28
+
5
29
  def country=(value)
6
30
  @country = value
7
31
  end
@@ -37,56 +61,6 @@ class Opts
37
61
  return false if @cities.nil? # default cities flag is false
38
62
  @cities == true
39
63
  end
40
-
41
-
42
- def create=(boolean)
43
- @create = boolean
44
- end
45
-
46
- def create?
47
- return false if @create.nil? # default create flag is false
48
- @create == true
49
- end
50
-
51
-
52
- def setup=(boolean)
53
- @setup = boolean
54
- end
55
-
56
- def setup?
57
- return false if @setup.nil? # default create flag is false
58
- @setup == true
59
- end
60
-
61
-
62
- def delete=(boolean)
63
- @delete = boolean
64
- end
65
-
66
- def delete?
67
- return false if @delete.nil? # default create flag is false
68
- @delete == true
69
- end
70
-
71
-
72
- # use loader? (that is, built-in seed data)
73
- def load=(boolean)
74
- @load = boolean
75
- end
76
-
77
- def load?
78
- return false if @load.nil? # default create flag is false
79
- @load == true
80
- end
81
-
82
-
83
- def output_path=(value)
84
- @output_path = value
85
- end
86
-
87
- def output_path
88
- @output_path || '.'
89
- end
90
64
 
91
65
 
92
66
  def data_path=(value)
@@ -0,0 +1,168 @@
1
+ # encoding: utf-8
2
+
3
+
4
+ def find_world_db_path_from_gemfile_gitref!
5
+ puts "[debug] find_world_db_path..."
6
+ puts "load path:"
7
+ pp $LOAD_PATH
8
+
9
+ candidates = []
10
+ $LOAD_PATH.each do |path|
11
+
12
+ # nb: avoid matching /world.db.ruby/ (e.g. gem "worlddb", "0.10.0", :path => "../world.db.ruby")
13
+
14
+ if path =~ /\/(world\.db-[a-z0-9]+)|(world\.db)\//
15
+ candidates << path.dup
16
+ end
17
+ end
18
+
19
+ puts "found candidates:"
20
+ pp candidates
21
+
22
+ cand = candidates[0]
23
+
24
+ puts "cand before: #{cand}"
25
+
26
+ ## nb: *? is non-greedy many operator
27
+
28
+ ## todo: why not just cut off trailing /lib - is it good enough??
29
+ # it's easier
30
+
31
+ regex = /(\/world\.db.*?)(\/.*)/
32
+ cand = cand.sub( regex ) do |_|
33
+ puts "cutting off >>#{$2}<<"
34
+ $1
35
+ end
36
+
37
+ puts "cand after: #{cand}"
38
+
39
+ ## todo:exit with error if not found!!!
40
+
41
+ cand
42
+ end
43
+
44
+
45
+
46
+ module WorldDB
47
+
48
+ module Fixtures # use shortcut/alias Fx?
49
+
50
+ def self.all # all builtin fixtures; helper for covenience
51
+ tag_fixtures +
52
+ country_fixtures +
53
+ lang_fixtures +
54
+ africa_fixtures +
55
+ america_fixtures +
56
+ europe_fixtures +
57
+ asia_fixtures +
58
+ oceania_fixtures
59
+ end
60
+
61
+ def self.tag_fixtures
62
+ ['tags.1', 'tags.3']
63
+ end
64
+
65
+ def self.country_fixtures
66
+ ['africa/countries',
67
+ 'america/countries',
68
+ 'asia/countries',
69
+ 'europe/countries',
70
+ 'oceania/countries']
71
+ end
72
+
73
+ def self.lang_fixtures
74
+ ['langs',
75
+ 'africa/3_more/lang',
76
+ 'america/3_more/lang',
77
+ 'asia/3_more/lang',
78
+ 'europe/3_more/lang',
79
+ 'oceania/3_more/lang'
80
+ ]
81
+ end
82
+
83
+ def self.africa_fixtures
84
+ ['1_codes/fifa',
85
+ '1_codes/internet',
86
+ '1_codes/iso3'].map { |path| "africa/#{path}" }
87
+ end
88
+
89
+ def self.america_fixtures
90
+ ['1_codes/fifa',
91
+ '1_codes/internet',
92
+ '1_codes/iso3',
93
+ '1_codes/motor',
94
+ 'br/regions',
95
+ 'ca/regions',
96
+ 'ca/cities',
97
+ 'mx/regions',
98
+ 'mx/cities',
99
+ 'us/regions',
100
+ 'us/cities',
101
+ 've/regions',
102
+ 've/cities'].map { |path| "america/#{path}" }
103
+ end
104
+
105
+ def self.asia_fixtures
106
+ ['1_codes/fifa',
107
+ '1_codes/internet',
108
+ '1_codes/iso3',
109
+ 'jp/cities'].map { |path| "asia/#{path}" }
110
+ end
111
+
112
+ def self.europe_fixtures
113
+ ['1_codes/fifa',
114
+ '1_codes/internet',
115
+ '1_codes/iso3',
116
+ '1_codes/motor',
117
+ 'at/regions',
118
+ 'at/cities',
119
+ 'be/regions',
120
+ 'be/cities',
121
+ 'bg/cities',
122
+ 'by/cities',
123
+ 'ch/cities',
124
+ 'cy/cities',
125
+ 'cz/regions',
126
+ 'cz/cities',
127
+ 'de/regions',
128
+ 'de/cities',
129
+ 'dk/cities',
130
+ 'ee/cities',
131
+ 'en/regions',
132
+ 'en/cities',
133
+ 'es/regions',
134
+ 'es/cities',
135
+ 'fi/cities',
136
+ 'fr/regions',
137
+ 'fr/cities',
138
+ 'gr/cities',
139
+ 'hr/cities',
140
+ 'hu/cities',
141
+ 'ie/cities',
142
+ 'it/cities',
143
+ 'lt/cities',
144
+ 'lv/cities',
145
+ 'nl/cities',
146
+ 'no/cities',
147
+ 'pl/cities',
148
+ 'pt/cities',
149
+ 'ro/cities',
150
+ 'rs/cities',
151
+ 'ru/cities',
152
+ 'sc/cities',
153
+ 'se/cities',
154
+ 'tr/cities',
155
+ 'ua/cities',
156
+ 'wa/cities'].map { |path| "europe/#{path}" }
157
+ end
158
+
159
+ def self.oceania_fixtures
160
+ ['1_codes/fifa',
161
+ '1_codes/internet',
162
+ '1_codes/iso3',
163
+ 'au/cities'].map { |path| "oceania/#{path}" }
164
+ end
165
+
166
+ end # module Fixtures
167
+
168
+ end # module WorldDB
@@ -0,0 +1,26 @@
1
+ # encoding: utf-8
2
+
3
+ module WorldDB
4
+
5
+ class Deleter
6
+
7
+ ## make models available in worlddb module by default with namespace
8
+ # e.g. lets you use City instead of Models::City
9
+ include WorldDB::Models
10
+
11
+ def run
12
+ # for now delete all tables
13
+
14
+ Tagging.delete_all
15
+ Tag.delete_all
16
+ City.delete_all
17
+ Region.delete_all
18
+ Country.delete_all
19
+ Usage.delete_all
20
+ Lang.delete_all
21
+ Prop.delete_all
22
+ end
23
+
24
+ end # class Deleter
25
+
26
+ end # module WorldDB