lib/sportdb/models.rb in sportdb-models-1.10.1 vs lib/sportdb/models.rb in sportdb-models-1.11.0
- old
+ new
@@ -3,17 +3,13 @@
# core and stlibs (note: get included via worlddb-models gem; see worlddb-models gem/lib)
require 'worlddb/models' # NOTE: include worlddb-models gem (not cli tools gem, that is, worlddb)
-require 'persondb'
+require 'persondb/models'
-## todo: check if already included in worlddb ???
-## require 'fetcher' # for fetching/downloading fixtures via HTTP/HTTPS etc.
-
-
# our own code
require 'sportdb/version' # let version always go first
require 'sportdb/patterns'
@@ -37,11 +33,11 @@
require 'sportdb/models/person'
require 'sportdb/models/roster'
require 'sportdb/models/round'
require 'sportdb/models/season'
require 'sportdb/models/team'
-require 'sportdb/models/team_comp'
+require 'sportdb/models/team_compat' ### fix/todo: move to compat gem !!!!!
require 'sportdb/models/stats/alltime_standing'
require 'sportdb/models/stats/alltime_standing_entry'
require 'sportdb/models/stats/event_standing'
@@ -180,22 +176,18 @@
puts '*** update event fixtures...'
Updater.new.run
end
- def self.stats
- Stats.new.tables # NOTE: same as tables (remove??? why? why not??)
- end
-
def self.tables
Stats.new.tables
end
- def self.connect( db_config={} )
+ def self.connect( config={} )
- if db_config.empty?
+ if config.empty?
puts "ENV['DATBASE_URL'] - >#{ENV['DATABASE_URL']}<"
### change default to ./sport.db ?? why? why not?
db = URI.parse( ENV['DATABASE_URL'] || 'sqlite3:///sport.db' )
@@ -213,11 +205,9 @@
config = {
adapter: db.scheme, # sqlite3
database: db.path[1..-1] # sport.db (NB: cut off leading /, thus 1..-1)
}
end
- else
- config = db_config # use passed in config hash
end
## todo/check: use if defined?( JRUBY_VERSION ) instead ??
if RUBY_PLATFORM =~ /java/ && config[:adapter] == 'sqlite3'
# quick hack for JRuby sqlite3 support via jdbc