Sha256: 4d702c99bf962e51b31f5c8192537680535c7f851158a7be69aba2f04a2d6a68

Contents?: true

Size: 836 Bytes

Versions: 2

Compression:

Stored size: 836 Bytes

Contents

require_relative 'database/export'
require_relative 'configuration'
require_relative 'converters/contentful_model_to_json'

class Migrator

  attr_reader :exporter, :config, :converter

  def initialize(settings)
    @config = Contentful::Configuration.new(settings)
    @exporter = Contentful::Exporter::Database::Export.new(config)
    @converter = Contentful::Converter::ContentfulModelToJson.new(config)
  end

  def run(action)
    case action.to_s
      when '--extract-to-json'
        exporter.save_data_as_json
      when '--create-content-model-from-json'
        converter.create_content_type_json
      when '--prepare-json'
        exporter.create_data_relations
      when '--list-tables'
        exporter.tables_name
      when '--convert-content-model-to-json'
        converter.convert_to_import_form
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
database-exporter-0.0.2 lib/migrator.rb
database-exporter-0.0.1 lib/migrator.rb