Sha256: c72f225983b8fecd1ffc4445751d6d31be9ac8cc4da9ce7bd97896ddb3428ccf

Contents?: true

Size: 1.2 KB

Versions: 3

Compression:

Stored size: 1.2 KB

Contents

require_relative 'storage_room_exporter'
require_relative 'contentful_importer'
require 'contentful/management'
require 'fileutils'

class Migrator
  attr_reader :storage_room_exporter, :contentful_importer

  MESSAGE = <<-eoruby
Actions:
  1. Export data from StorageRoom to JSON files.
  2. Convert StorageRoom field types to Contentful.
  3. Import collections to Contentful.
  4. Import entries to Contentful.
  5. Publish all entries on Contentful.
-> Choose on of the options:
  eoruby

  def run
    puts MESSAGE
    action_choice = gets.to_i
    case action_choice
      when 1
        storage_room_exporter.export_collections
        storage_room_exporter.export_entries
      when 2
        storage_room_exporter.mapping_collections_input_types
      when 3
        contentful_importer.create_space
        contentful_importer.import_content_types
        contentful_importer.find_symbol_type_in_collection
      when 4
        contentful_importer.import_entries
      when 5
        contentful_importer.publish_all_entries
    end
  end

  def storage_room_exporter
    @storage_room_exporter ||= StorageRoomExporter.new
  end

  def contentful_importer
    @contentful_importer ||= ContentfulImporter.new
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
storageroom-to-contentful-0.0.3 lib/migrator.rb
storageroom-to-contentful-0.0.2 lib/migrator.rb
storageroom-to-contentful-0.0.1 lib/migrator.rb