module Buildr::Checks

Methods added to Project to allow checking the build.

Public Instance Methods

check(description) { ... } click to toggle source
check(subject, description) { ... }

Adds an expectation. The expectation is run against the project by the check task, executed after packaging. You can access any package created by the project.

An expectation is written using a subject, description and block to validate the expectation. For example:

For example:

check package(:jar), "should exist" do
  it.should exist
end
check package(:jar), "should contain a manifest" do
  it.should contain("META-INF/MANIFEST.MF")
end
check package(:jar).path("com/acme"), "should contain classes" do
  it.should_not be_empty
end
check package(:jar).entry("META-INF/MANIFEST"), "should be a recent license" do
  it.should contain(/Copyright (C) 2007/)
end

If you omit the subject, the project is used as the subject. If you omit the description, the subject is used as description.

During development you can write placeholder expectations by omitting the block. This will simply report the expectation as pending.

# File lib/buildr/core/checks.rb, line 188
def check(*args, &block)
  Buildr.ensure_rspec('check() method invoked in buildfile')
  expectations << Checks::Expectation.new(*args, &block)
end
expectations() → Expectation* click to toggle source

Returns a list of expectations (see check).

# File lib/buildr/core/checks.rb, line 197
def expectations()
  @expectations ||= []
end