Hi,
I am currently playing with a few different buildr extensions and I
desire to make use of the test infrastructure part of buildr proper.
What is the typical approach to doing this sort of thing? Currently I
have gone with adding something like the following into my spec_helper
/ test_helper
------------------------------------------------------------------------------------------------
# TODO: If we are installed as a gem we should just add dependency on
buildr gem and find dir based on that
DEFAULT_BUILDR_DIR=File.expand_path(File.dirname(__FILE__) + '/../../buildr')
BUILDR_DIR=ENV['BUILDR_DIR'] || DEFAULT_BUILDR_DIR
unless File.exist?("#{BUILDR_DIR}/buildr.gemspec")
raise "Unable to find buildr.gemspec in #{BUILDR_DIR ==
DEFAULT_BUILDR_DIR ? 'guessed' : 'specified'} $BUILD_DIR
(#{BUILDR_DIR})"
end
require 'rubygems'
# For testing we use the gem requirements specified on the buildr.gemspec
Gem::Specification.load(File.expand_path("#{BUILDR_DIR}/buildr.gemspec",
File.dirname(__FILE__))).
dependencies.each { |dep| gem dep.name, dep.requirement.to_s }
------------------------------------------------------------------------------------------------
Then depending on what types of tests I am running adding something
like the following a bit later.
require "#{BUILDR_DIR}/spec/spec_helpers.rb"
You can see an example in
http://github.com/rockninja/buildr-iidea/blob/master/spec/spec_helper.rb
My main goal is to be able to test the plugin against trunk buildr and
against the last release. Down the track I will also want it to work
if/when the extension is released as a gem.
So has anyone got a recommend approach to do this sort of thing? Is
what I am doing the right way of doing things or am I going to run
into issues?
--
Cheers,
Peter Donald