Sha256: e69c3974136de758459a9f35835b6c0ff82798c2ac52ebeca90ec3c876d042fc

Contents?: true

Size: 623 Bytes

Versions: 2

Compression:

Stored size: 623 Bytes

Contents

module Nanoc::Extra::Checking
  # @api private
  class DSL
    attr_reader :deploy_checks

    def self.from_file(filename)
      dsl = new
      absolute_filename = File.expand_path(filename)
      dsl.instance_eval(File.read(filename), absolute_filename)
      dsl
    end

    def initialize
      @deploy_checks = []
    end

    def check(identifier, &block)
      klass = Class.new(::Nanoc::Extra::Checking::Check)
      klass.send(:define_method, :run, &block)
      klass.send(:identifier, identifier)
    end

    def deploy_check(*identifiers)
      identifiers.each { |i| @deploy_checks << i }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nanoc-4.3.7 lib/nanoc/extra/checking/dsl.rb
nanoc-4.3.6 lib/nanoc/extra/checking/dsl.rb