Sha256: 6d1789f6cf7b1d69ef884e6b5253ab6f364e4ff6ab0006d823b480832ae30b75

Contents?: true

Size: 569 Bytes

Versions: 4

Compression:

Stored size: 569 Bytes

Contents

# encoding: utf-8

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

    def self.from_file(filename)
      dsl = new
      dsl.instance_eval File.read(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

4 entries across 4 versions & 1 rubygems

Version Path
nanoc-4.0.0b2 lib/nanoc/extra/checking/dsl.rb
nanoc-4.0.0b1 lib/nanoc/extra/checking/dsl.rb
nanoc-4.0.0a2 lib/nanoc/extra/checking/dsl.rb
nanoc-4.0.0a1 lib/nanoc/extra/checking/dsl.rb