Class: Contentful::Importer::ImportModel

Inherits:
Command
  • Object
show all
Defined in:
lib/contentful/importer/import_model.rb

Instance Attribute Summary

Attributes inherited from Command

#config, #converter, #importer, #json_validator

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

data_options, #initialize, space_options, thread_options

Constructor Details

This class inherits a constructor from Contentful::Importer::Command

Class Method Details

.import(settings, converter, importer) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/contentful/importer/import_model.rb', line 15

def self.import(settings, converter, importer)
	if settings['content_model_json']
		converter.convert_to_import_form
		converter.create_content_type_json
	end

	importer.create_contentful_model(settings)
end

.optionsObject



9
10
11
12
13
# File 'lib/contentful/importer/import_model.rb', line 9

def self.options
	[['--content_model_json=model.json',
		'Content model to use for import. Uses the data directory by default.']
		].concat(super).concat(data_options).concat(space_options).sort
end

Instance Method Details

#runObject



24
25
26
27
# File 'lib/contentful/importer/import_model.rb', line 24

def run
	super
	self.class.import(@settings, @converter, @importer)
end