require "canvas_sync" require "inst_data_shipper/version" require "inst_data_shipper/engine" require "inst_data_shipper/record" module InstDataShipper class << self def alias_destination(from, to) @destination_aliases ||= {} @destination_aliases[from.to_s] = to.to_s end def resolve_destination(destination) return destination if destination.is_a?(Class) if destination.is_a?(String) && destination.include?("://") type, rest = destination.split("://", 2) destination = @destination_aliases[type] elsif destination.is_a?(Hash) type = destination[:type] || destination["type"] destination = @destination_aliases[type] end safe_constantize(destination) end def start_basic_dump(*args, **kwargs, &block) BasicDumper.perform_dump(*args, **kwargs, &block) end def logger return @logger if defined? @logger @logger = Logger.new(STDOUT) @logger.level = Logger::DEBUG @logger end def redis(*args, &blk) CanvasSync::JobBatches::Batch.redis(*args, &blk) end def redis_prefix pfx = "hdd" pfx = "#{Apartment::Tenant.current}:#{pfx}" if defined?(Apartment) pfx end end end Dir[File.dirname(__FILE__) + "/inst_data_shipper/concerns/**/*.rb"].each { |file| require file } require "inst_data_shipper/schema_builder" require "inst_data_shipper/jobs/base" Dir[File.dirname(__FILE__) + "/inst_data_shipper/jobs/**/*.rb"].each { |file| require file } require "inst_data_shipper/data_sources/base" Dir[File.dirname(__FILE__) + "/inst_data_shipper/data_sources/**/*.rb"].each { |file| require file } require "inst_data_shipper/destinations/base" Dir[File.dirname(__FILE__) + "/inst_data_shipper/destinations/concerns/*.rb"].each { |file| require file } Dir[File.dirname(__FILE__) + "/inst_data_shipper/destinations/*.rb"].each do |file| require file basename = File.basename(file, ".rb") next if basename == "base" InstDataShipper.alias_destination(basename.dasherize, "InstDataShipper::Destinations::#{basename.classify}") end