Sha256: 24c2e7e43e68acc42f3832d0eca869fdacc3d497a64f58e34b054e398a0f03e8

Contents?: true

Size: 697 Bytes

Versions: 5

Compression:

Stored size: 697 Bytes

Contents

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

module Dato
  module Dump
    class Runner
      attr_reader :config_path, :api_token

      def initialize(config_path, api_token)
        @config_path = config_path
        @api_token = api_token
      end

      def run
        site.load

        root = Operation::Root.new(Dir.pwd)

        Dsl::Root.new(
          File.read(config_path),
          site.items_repo,
          root
        )

        root.perform
      end

      def site
        @site ||= Dato::Local::Site.new(client)
      end

      def client
        @client ||= Dato::Site::Client.new(api_token)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dato-0.1.12 lib/dato/dump/runner.rb
dato-0.1.11 lib/dato/dump/runner.rb
dato-0.1.10 lib/dato/dump/runner.rb
dato-0.1.9 lib/dato/dump/runner.rb
dato-0.1.8 lib/dato/dump/runner.rb