Module: WorldDB

Defined in:
lib/worlddb.rb,
lib/worlddb/stats.rb,
lib/worlddb/reader.rb,
lib/worlddb/schema.rb,
lib/worlddb/deleter.rb,
lib/worlddb/version.rb,
lib/worlddb/cli/opts.rb,
lib/worlddb/data/fixtures.rb

Defined Under Namespace

Modules: Fixtures, Models Classes: CreateDB, Deleter, Opts, Reader, Stats

Constant Summary collapse

VERSION =

sync version w/ sport.db - why? why not?

'1.0.1'

Class Method Summary collapse

Class Method Details



47
48
49
# File 'lib/worlddb.rb', line 47

def self.banner
  "worlddb #{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
end

.createObject



60
61
62
# File 'lib/worlddb.rb', line 60

def self.create
  CreateDB.up
end

.delete!Object

delete ALL records (use with care!)



95
96
97
98
# File 'lib/worlddb.rb', line 95

def self.delete!
  puts '*** deleting world table records/data...'
  Deleter.new.run
end

.mainObject



55
56
57
58
# File 'lib/worlddb.rb', line 55

def self.main
  require 'worlddb/cli/main'
  ## Runner.new.run(ARGV) - old code
end

.propsObject



111
112
113
# File 'lib/worlddb.rb', line 111

def self.props
  Stats.new.props
end

.read(ary, include_path) ⇒ Object



65
66
67
68
69
70
# File 'lib/worlddb.rb', line 65

def self.read( ary, include_path )
  reader = Reader.new
  ary.each do |name|
    reader.load_with_include_path( name, include_path )
  end
end

.read_all(include_path) ⇒ Object

load all builtins (using plain text reader); helper for convenience



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/worlddb.rb', line 72

def self.read_all( include_path )  # load all builtins (using plain text reader); helper for convenience
  reader = Reader.new

  # too big for heroku free db plan (10,000 record limit)
  #  - sorry, can't load by default
  fixture_excludes = [
    'america/ve/cities'
  ]
  
  ary = Fixtures.all - fixture_excludes
  
  ary.each do |name|
   reader.load_with_include_path( name, include_path )
  end # each name
end

.read_setup(setup, include_path) ⇒ Object



89
90
91
# File 'lib/worlddb.rb', line 89

def self.read_setup( setup, include_path )
  ## fix: to be done  (see sport.db.ruby)
end

.rootObject



51
52
53
# File 'lib/worlddb.rb', line 51

def self.root
  "#{File.expand_path( File.dirname(File.dirname(__FILE__)) )}"
end

.statsObject



101
102
103
104
105
# File 'lib/worlddb.rb', line 101

def self.stats
  stats = Stats.new
  stats.tables
  ### stats.props
end

.tablesObject



107
108
109
# File 'lib/worlddb.rb', line 107

def self.tables
  Stats.new.tables
end