Class: Rant::Generators::NUnitTest

Inherits:
Object
  • Object
show all
Defined in:
lib/rant/import/nunittest.rb

Overview

Generator for running NUnit tests

Class Method Summary collapse

Class Method Details

.process_dlls(rant, dlls) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/rant/import/nunittest.rb', line 22

def self.process_dlls(rant, dlls)
  if dlls.respond_to?(:arglist)
    dlls = dlls.arglist 
  elsif dlls.kind_of?(Array)
    dlls = dlls.collect{|x| rant.context.sys.sp(x)}.join(" ")
  else
    dlls = rant.context.sys.sp(dlls)
  end
  dlls
end

.rant_gen(rant, ch, args, &block) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rant/import/nunittest.rb', line 3

def self.rant_gen(rant, ch, args, &block)
  target = args.shift
  gen_args = args.shift

  # Verify arguments
  rant.abort_at(ch, "NUnitTest requires a task name") if !target ||
                                                          target.empty?
  rant.abort_at(ch, "NUnitTest requires dlls") if !gen_args[:dlls] || 
                                                   gen_args[:dlls].empty?

  # Define test task
  rant.task target do |t|
    gen_args[:bin] ||= "nunit-console /nologo"
    dlls = process_dlls(rant, gen_args[:dlls])

    rant.context.sys.sh "#{gen_args[:bin]} #{dlls}"
  end
end