require File.dirname(__FILE__) + '/shared' module DataCatalog module ImporterFramework class Handler include Shared def initialize(options) @options = options @counter = {} [:source, :organization].each do |resource| FileUtils.mkdir_p(folder(resource)) @counter[resource] = 1 end end def source(data) write_data(:source, data) end def organization(data) write_data(:organization, data) end def write_data(resource, data) file = folder(resource) + ("/%08i.yml" % @counter[resource]) Utility.write_yaml(file, data) @counter[resource] += 1 end end end end