Class: Migrator
- Inherits:
-
Object
- Object
- Migrator
- Defined in:
- lib/migrator.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#converter ⇒ Object
readonly
Returns the value of attribute converter.
-
#exporter ⇒ Object
readonly
Returns the value of attribute exporter.
Instance Method Summary collapse
-
#initialize(settings) ⇒ Migrator
constructor
A new instance of Migrator.
- #run(action) ⇒ Object
Constructor Details
#initialize(settings) ⇒ Migrator
Returns a new instance of Migrator.
9 10 11 12 13 |
# File 'lib/migrator.rb', line 9 def initialize(settings) @config = Contentful::Configuration.new(settings) @exporter = Contentful::Exporter::Database::Export.new(config) @converter = Contentful::Converter::ContentfulModelToJson.new(config) end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
7 8 9 |
# File 'lib/migrator.rb', line 7 def config @config end |
#converter ⇒ Object (readonly)
Returns the value of attribute converter.
7 8 9 |
# File 'lib/migrator.rb', line 7 def converter @converter end |
#exporter ⇒ Object (readonly)
Returns the value of attribute exporter.
7 8 9 |
# File 'lib/migrator.rb', line 7 def exporter @exporter end |
Instance Method Details
#run(action) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/migrator.rb', line 15 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 |