namespace :sync do task :records => :environment do system_setting = SystemSetting.singleton puts system_setting.sync end task :gamespy => :environment do puts "Fetching server info..." geo = ENV['NOGEO'] ? "" : nil puts "Pings and Countries: #{geo.nil?}" puts q = Six::Query::GamespyMaster.new(geo) h = q.process puts puts "Received #{h.size} servers" puts puts "Updating database..." h.each_pair do |key, e| Queryserver.import(e) end puts "Pruning database..." Queryserver.prune puts "Cleaning database..." Queryserver.clean end task :system => :environment do Six::Dbmanager.reload_system end task :data => :environment do Six::Dbmanager.reload_data end end task :export => :environment do if ENV.include?("preset") config = Sixconfig.find(ENV['preset'].to_i) File.open(File.join(SixUpdaterWeb::DATA_PATH, 'six-updater.yml'), 'w') do |file| file.puts config.to_updater_yml end else puts "Error: No preset selected" end end