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

Defined Under Namespace

Modules: Models Classes: CreateDb, Deleter, Opts, Reader, Stats

Constant Summary collapse

VERSION =

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

'1.6.0'

Class Method Summary collapse

Class Method Details



49
50
51
# File 'lib/worlddb.rb', line 49

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

.createObject



62
63
64
65
# File 'lib/worlddb.rb', line 62

def self.create
  CreateDb.new.up
  WorldDb::Models::Prop.create!( key: 'db.schema.world.version', value: VERSION )
end

.delete!Object

delete ALL records (use with care!)



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

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

.mainObject



57
58
59
60
# File 'lib/worlddb.rb', line 57

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

.propsObject



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

def self.props
  Stats.new.props
end

.read(ary, include_path) ⇒ Object



68
69
70
71
72
73
# File 'lib/worlddb.rb', line 68

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

.read_all(include_path, opts = {}) ⇒ Object

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



81
82
83
# File 'lib/worlddb.rb', line 81

def self.read_all( include_path, opts={} )  # load all builtins (using plain text reader); helper for convenience
  read_setup( 'setups/all', include_path, opts )
end

.read_setup(setup, include_path, opts = {}) ⇒ Object



76
77
78
79
# File 'lib/worlddb.rb', line 76

def self.read_setup( setup, include_path, opts={} )
  reader = Reader.new( include_path, opts )
  reader.load_setup( setup )
end

.rootObject



53
54
55
# File 'lib/worlddb.rb', line 53

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

.statsObject



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

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

.tablesObject



99
100
101
# File 'lib/worlddb.rb', line 99

def self.tables
  Stats.new.tables
end