Skip to content

Cogent Build

Cogent Build is a plugin that increases the power of your build. In particular, it adds a rake task called cogent:build that executes the following tasks in order:

      notes
      notes:spec
      simian:all
      saikuro
      saikuro:publish
      flog
      db:test:reset
      spec:unit
      spec:unit:publish
      spec:unit:verify_coverage
      db:test:load_fixtures
      spec:functional

This task is designed to be used in a continuous integration tool. To execute it, simply run:

      rake cogent:build

Database Tasks

In order to get the overall Cogent Build to hang together correctly, some additional rake tasks were created for the test database. These can all be used independently.

To drop the test database, run:

      rake db:test:drop

To create the test database, run:

      rake db:test:create

To run migrations against the test database, run:

      rake db:test:migrate

To reset the test database (ie. to drop it, re-create it and run migratons), run:

      rake db:test:reset

To load fixture data into the test database, run:

      rake db:test:load_fixtures

Notes Tasks

Rails comes with some built in tasks to find and notes in the application code base, but doesn’t support finding the same things in your specs or tests. The Cogent Build plugin provides these tasks.

To find TODO notes in your tests or specs, run:

      rake notes:spec:todo

To find FIXME notes in your tests or specs, run:

      rake notes:spec:fixme

To find OPTIMIZE notes in your tests or specs, run:

      rake notes:spec:optimize

To find notes of any type (TODO, FIXME or OPTIMIZE) in your tests or specs, run:

      rake notes:spec

Rspec Tasks

In order to measure the coverage of unit tests, and to be able to run functional tests separately, the Cogent Build plugin provides some additional rake tasks around rspec.

To run all specs, except functional specs, whilst measuring coverage, run:

      rake spec:unit

To run functional specs only, run:

      rake spec:functional

To verify that the coverage of your unit specs meets the minimum coverage threshold (defaulted to 99%), run:

      rake spec:unit:verify_coverage

If you have a continuous integration build running via cruisecontrol.rb, you can publish the report generated by Rcov into the build artifacts directory by running:

  rake spec:unit:publish

Dependencies

  • Simian (simian)
  • Cogent Saikuro (cogent_saikuro)
  • Cogent Flog (cogent_flog)
  • Rspec (rspec)
  • Rspec on Rails (rspec_on_rails)
  • Rcov

Installation

EDGE

To install using SVN:
ruby script/plugin install svn://rubyforge.org/var/svn/cogent-rails/trunk/plugins/cogent_build

or using HTTP:
ruby script/plugin install http://cogent-rails.rubyforge.org/svn/trunk/plugins/cogent_build

Stable

To install using SVN:
ruby script/plugin install svn://rubyforge.org/var/svn/cogent-rails/branches/stable/plugins/cogent_build

or using HTTP:
ruby script/plugin install http://cogent-rails.rubyforge.org/svn/branches/stable/plugins/cogent_build