module Rustic

Constants

VERSION

Public Class Methods

define(run: true, &block) click to toggle source
# File lib/rustic.rb, line 17
def define(run: true, &block)
  Sync do
    config = Rustic::Config.new
    config.instance_eval(&block)
    validate!(config)
    Rustic::Application.new(config).tap do |app|
      app.run(ARGV) if run
    end
  end
end

Private Class Methods

validate!(config) click to toggle source
# File lib/rustic.rb, line 30
def validate!(config)
  errors, warnings = Rustic::Validator.new(config).validate
  warnings.each do |warning|
    # TODO: print warning
  end

  raise ValidationError, errors.join("\n") if errors.any?
end