Sha256: 9cde3b5f082840d272d199e562a5d7c811c9a2dc1e974e022461f68de5568d61

Contents?: true

Size: 1.17 KB

Versions: 5

Compression:

Stored size: 1.17 KB

Contents

require 'active_support/core_ext/hash'
module Contentful
  module Importer
    class Configuration
      attr_reader :space_id,
                  :config,
                  :data_dir,
                  :collections_dir,
                  :entries_dir,
                  :assets_dir,
                  :log_files_dir,
                  :threads_dir,
                  :imported_entries,
                  :published_entries,
                  :published_assets,
                  :space_id

      def initialize(settings)
        @config = settings
        validate_required_parameters
        @data_dir = settings['data_dir']
        @collections_dir = "#{data_dir}/collections"
        @entries_dir = "#{data_dir}/entries"
        @assets_dir = "#{data_dir}/assets"
        @log_files_dir = "#{data_dir}/logs"
        @threads_dir = "#{data_dir}/threads"
        @imported_entries = []
        @published_entries = []
        @published_assets = []
        @space_id = settings['space_id']
      end

      def validate_required_parameters
        fail ArgumentError, 'Set PATH to data_dir. Folder where all data will be stored. View README' if config['data_dir'].nil?
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
contentful-importer-0.2.2 lib/contentful/importer/configuration.rb
contentful-importer-0.2.1 lib/contentful/importer/configuration.rb
contentful-importer-0.2.0 lib/contentful/importer/configuration.rb
contentful-importer-0.1.1 lib/contentful/importer/configuration.rb
contentful-importer-0.1.0 lib/contentful/importer/configuration.rb