worlddb 0.7.0 → 0.7.1

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 (39) hide show
  1. data/Manifest.txt +0 -2
  2. data/data/africa/countries.txt +63 -73
  3. data/data/america/ca/cities.txt +35 -35
  4. data/data/america/countries.txt +29 -24
  5. data/data/america/mx/cities.txt +18 -18
  6. data/data/america/us/cities.txt +39 -39
  7. data/data/asia/countries.txt +74 -64
  8. data/data/europe/at/cities.txt +31 -31
  9. data/data/europe/at/regions.txt +6 -6
  10. data/data/europe/be/cities.txt +10 -10
  11. data/data/europe/countries.txt +71 -53
  12. data/data/europe/cz/cities.txt +16 -16
  13. data/data/europe/de/cities.txt +28 -28
  14. data/data/europe/en/cities.txt +21 -19
  15. data/data/europe/es/cities.txt +10 -10
  16. data/data/europe/fr/cities.txt +11 -11
  17. data/data/europe/it/cities.txt +14 -14
  18. data/data/europe/lt/cities.txt +2 -3
  19. data/data/europe/lv/cities.txt +3 -2
  20. data/data/europe/nl/cities.txt +3 -3
  21. data/data/europe/pl/cities.txt +3 -3
  22. data/data/europe/ru/cities.txt +5 -5
  23. data/data/europe/sc/cities.txt +1 -1
  24. data/data/europe/ua/cities.txt +5 -5
  25. data/data/europe/wa/cities.txt +1 -1
  26. data/data/oceania/1_codes/fifa.yml +1 -1
  27. data/data/oceania/1_codes/internet.yml +1 -1
  28. data/data/oceania/1_codes/iso3.yml +1 -1
  29. data/data/oceania/3_more/en.wikipedia.yml +1 -1
  30. data/data/oceania/countries.txt +24 -15
  31. data/lib/worlddb/cli/runner.rb +2 -5
  32. data/lib/worlddb/reader.rb +91 -2
  33. data/lib/worlddb/readers/hash_reader.rb +23 -8
  34. data/lib/worlddb/readers/values_reader.rb +86 -8
  35. data/lib/worlddb/version.rb +1 -1
  36. data/lib/worlddb.rb +1 -13
  37. metadata +4 -6
  38. data/data/america/br/cities.txt +0 -9971
  39. data/lib/worlddb/loader.rb +0 -55
@@ -1,55 +0,0 @@
1
- module WorldDB
2
-
3
- class Loader
4
-
5
- def initialize( logger=nil )
6
- if logger.nil?
7
- @logger = Logger.new(STDOUT)
8
- @logger.level = Logger::INFO
9
- else
10
- @logger = logger
11
- end
12
- end
13
-
14
- attr_reader :logger
15
-
16
-
17
- def run( opts, args )
18
-
19
- args.each do |arg|
20
- name = arg # File.basename( arg, '.*' )
21
-
22
- if opts.load?
23
- load_fixtures_builtin( name )
24
- else
25
- load_fixtures_with_include_path( name, opts.data_path )
26
- end
27
- end
28
-
29
- end # method run
30
-
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?)
39
- def load_fixtures_with_include_path( name, include_path ) # load from file system
40
- path = "#{include_path}/#{name}.rb"
41
-
42
- puts "*** loading data '#{name}' (#{path})..."
43
-
44
- CodeReader.new( logger, path ).eval( CodeContext )
45
-
46
- # Prop.create!( :key => "db.#{name}.version", :value => WorldDB::VERSION )
47
- end
48
-
49
- def load_fixtures_builtin( name ) # load from gem (built-in)
50
- load_fixtures_with_include_path( name, WorldDB.data_path )
51
- end
52
-
53
-
54
- end # class Loader
55
- end # module WorldDB