lib/sportdb/cli/main.rb in sportdb-1.9.11 vs lib/sportdb/cli/main.rb in sportdb-1.9.12

- old
+ new

@@ -126,14 +126,47 @@ SportDb.create SportDb.read_builtin # e.g. seasons.txt etc builder.read # builder step 2 - read all datasets - + puts 'Done.' end # action end # command setup + +desc "Build DB w/ quick starter Datafile templates" +arg_name 'NAME' # optional setup profile name +command [:new,:n] do |c| + + c.action do |g,o,args| + + ## 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' ) + + ## step 2: same as command build (todo - reuse code) + builder = SportDb::Builder.load_file( './Datafile' ) + builder.download # builder step 1 - download all datasets/zips + + connect_to_db( opts ) + + LogDb.create + ConfDb.create + TagDb.create + WorldDb.create + PersonDb.create + SportDb.create + + SportDb.read_builtin # e.g. seasons.txt etc + + builder.read # builder step 2 - read all datasets + + puts 'Done.' + end # action +end # command setup desc "Create DB schema 'n' load all world and sports data" arg_name 'NAME' # optional setup profile name \ No newline at end of file