class Contentful::Exporter::Drupal::Export

Attributes

boolean_columns[R]
config[R]

Public Class Methods

new(settings) click to toggle source
# File lib/drupal/export.rb, line 18
def initialize(settings)
  @config = settings
  @boolean_columns = []
end

Public Instance Methods

create_directory(path) click to toggle source
# File lib/drupal/export.rb, line 38
def create_directory(path)
  FileUtils.mkdir_p(path) unless File.directory?(path)
end
save_data_as_json() click to toggle source
# File lib/drupal/export.rb, line 23
def save_data_as_json
  boolean_columns << YAML.load_file(config.config['drupal_boolean_columns']) if config.config['drupal_boolean_columns']
  tags
  vocabularies
  users
  content_types
  files
end
write_json_to_file(path, data) click to toggle source
# File lib/drupal/export.rb, line 32
def write_json_to_file(path, data)
  File.open(path, 'w') do |file|
    file.write(JSON.pretty_generate(data))
  end
end

Private Instance Methods

content_types() click to toggle source
# File lib/drupal/export.rb, line 60
def content_types
  config.drupal_content_types.each do |content_type, schema|
    ContentType.new(self, config, content_type, schema).save_content_types_as_json
  end
end
files() click to toggle source
# File lib/drupal/export.rb, line 56
def files
  FileManaged.new(self, config).save_files_as_json
end
tags() click to toggle source
# File lib/drupal/export.rb, line 44
def tags
  Tag.new(self, config).save_tags_as_json
end
users() click to toggle source
# File lib/drupal/export.rb, line 52
def users
  User.new(self, config).save_users_as_json
end
vocabularies() click to toggle source
# File lib/drupal/export.rb, line 48
def vocabularies
  Vocabulary.new(self, config).save_vocabularies_as_json
end