lib/sportdb/cli/main.rb in sportdb-1.9.14 vs lib/sportdb/cli/main.rb in sportdb-1.9.15
- old
+ new
@@ -82,12 +82,14 @@
}
## todo/check: use if defined?( JRUBY_VERSION ) instead ??
if RUBY_PLATFORM =~ /java/ && db_config[:adapter] == 'sqlite3'
# quick hack for JRuby sqlite3 support via jdbc
+ puts "jruby quick hack - adding jdbc libs for jruby sqlite3 database support"
require 'jdbc/sqlite3'
- ## todo: check if require for activerecord jdbc adapter for sqlite is required to
+ require 'active_record/connection_adapters/jdbc_adapter'
+ require 'active_record/connection_adapters/jdbcsqlite3_adapter'
end
puts "Connecting to db using settings: "
pp db_config
@@ -121,12 +123,11 @@
desc "Build DB (download/create/read); use ./Datafile - zips get downloaded to ./tmp"
command [:build,:b] do |c|
c.action do |g,o,args|
- builder = Datafile::Builder.load_file( './Datafile' )
- datafile = builder.datafile
+ datafile = Datafile::Datafile.load_file( './Datafile' )
datafile.download # datafile step 1 - download all datasets/zips
connect_to_db( opts )
LogDb.create
@@ -150,12 +151,11 @@
c.action do |g,o,args|
connect_to_db( opts )
- builder = Datafile::Builder.load_file( './Datafile' )
- datafile = builder.datafile
+ datafile = Datafile::Datafile.load_file( './Datafile' )
datafile.read
puts 'Done.'
end # action
end # command setup
@@ -165,12 +165,11 @@
c.action do |g,o,args|
# note: no database connection needed (check - needed for logs?? - not setup by default???)
- builder = Datafile::Builder.load_file( './Datafile' )
- datafile = builder.datafile
+ datafile = Datafile::Datafile.load_file( './Datafile' )
datafile.download
puts 'Done.'
end # action
end # command setup
@@ -184,14 +183,14 @@
## todo: required template name (defaults to worldcup2014)
setup = args[0] || 'worldcup2014'
worker = Fetcher::Worker.new
- worker.copy( "https://github.com/openfootball/datafile/raw/master/#{setup}.rb", './Datafile' )
+ ## note: lets use http:// instead of https:// for now - lets us use person proxy (NOT working w/ https for now)
+ worker.copy( "http://github.com/openfootball/datafile/raw/master/#{setup}.rb", './Datafile' )
## step 2: same as command build (todo - reuse code)
- builder = Datafile::Builder.load_file( './Datafile' )
- datafile = builder.datafile
+ datafile = Datafile::Datafile.load_file( './Datafile' )
datafile.download # datafile step 1 - download all datasets/zips
connect_to_db( opts ) ### todo: check let connect go first?? - for logging (logs) to db ???
LogDb.create
\ No newline at end of file