Sha256: c3f8c4b4aadf82ea7491bb797d7948bf0c62c46fc86e4806b26078d73407ba2c

Contents?: true

Size: 823 Bytes

Versions: 2

Compression:

Stored size: 823 Bytes

Contents

# frozen_string_literal: true
require 'dato/dump/dsl/root'
require 'dato/dump/operation/root'
require 'dato/dump/ssg_detector'
require 'dato/local/loader'

module Dato
  module Dump
    class Runner
      attr_reader :config_path, :client, :destination_path

      def initialize(config_path, client, destination_path = Dir.pwd)
        @config_path = config_path
        @client = client
        @destination_path = destination_path
      end

      def run
        loader.load

        Dsl::Root.new(
          File.read(config_path),
          loader.items_repo,
          operation
        )

        operation.perform
      end

      def operation
        @operation ||= Operation::Root.new(destination_path)
      end

      def loader
        @loader ||= Dato::Local::Loader.new(client)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dato-0.1.22 lib/dato/dump/runner.rb
dato-0.1.21 lib/dato/dump/runner.rb