Class: Migrator

Inherits:
Object
  • Object
show all
Defined in:
lib/migrator.rb

Constant Summary collapse

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#contentful_importerObject (readonly)

Returns the value of attribute contentful_importer.



7
8
9
# File 'lib/migrator.rb', line 7

def contentful_importer
  @contentful_importer
end

#storage_room_exporterObject (readonly)

Returns the value of attribute storage_room_exporter.



7
8
9
# File 'lib/migrator.rb', line 7

def storage_room_exporter
  @storage_room_exporter
end

Instance Method Details

#runObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/migrator.rb', line 20

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