Sha256: de8566323198c166dff899949d16a88d17dcaeadc44e8174abc6643fe90d55b9

Contents?: true

Size: 1.28 KB

Versions: 2

Compression:

Stored size: 1.28 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.
  6. Test credentials.
-> 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
      when 6
        contentful_importer.test_credentials
    end
  end

  def storage_room_exporter
    @storage_room_exporter ||= StorageRoomExporter.new
  end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
storageroom-to-contentful-0.0.5 lib/migrator.rb
storageroom-to-contentful-0.0.4 lib/migrator.rb