Class: Turn::Controller

Inherits:
Object
  • Object
show all
Defined in:
lib/turn/controller.rb

Overview

Controller

– TODO: Add support to test run loggging. ++

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#excludeObject

Files globs to specially exclude.



29
30
31
# File 'lib/turn/controller.rb', line 29

def exclude
  @exclude
end

#liveObject

Test against live install (i.e. Don’t use loadpath option)



44
45
46
# File 'lib/turn/controller.rb', line 44

def live
  @live
end

#loadpathObject

Add these folders to the $LOAD_PATH.



32
33
34
# File 'lib/turn/controller.rb', line 32

def loadpath
  @loadpath
end

#logObject

Log results? May be true/false or log file name. (TODO)



47
48
49
# File 'lib/turn/controller.rb', line 47

def log
  @log
end

#reporterObject

Instance of Reporter.



38
39
40
# File 'lib/turn/controller.rb', line 38

def reporter
  @reporter
end

#requiresObject

Libs to require when running tests.



35
36
37
# File 'lib/turn/controller.rb', line 35

def requires
  @requires
end

#runnerObject

Insatance of Runner.



41
42
43
# File 'lib/turn/controller.rb', line 41

def runner
  @runner
end

#testsObject

File glob pattern of tests to run. Can be an array of files/globs.



26
27
28
# File 'lib/turn/controller.rb', line 26

def tests
  @tests
end

#verboseObject

Verbose output?



50
51
52
# File 'lib/turn/controller.rb', line 50

def verbose
  @verbose
end

Instance Method Details

#filesObject



116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/turn/controller.rb', line 116

def files
  @files ||= (
    fs = tests.map do |t|
      File.directory?(t) ? Dir[File.join(t, '**', '*')] : Dir[t]
    end
    fs = fs.flatten.reject{ |f| File.directory?(f) }
    ex = exclude.map do |x|
      File.directory?(x) ? Dir[File.join(x, '**', '*')] : Dir[x]
    end
    ex = ex.flatten.reject{ |f| File.directory?(f) }
    (fs - ex).uniq
  )
end

#live?Boolean

Returns:

  • (Boolean)


53
# File 'lib/turn/controller.rb', line 53

def live?    ; @live    ; end

#requries=(paths) ⇒ Object



112
113
114
# File 'lib/turn/controller.rb', line 112

def requries=(paths)
  @requries = list_option(paths)
end

#startObject



130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/turn/controller.rb', line 130

def start
  @files = nil  # reset files just in case

  if files.empty?
    $stderr.puts "No tests."
    return
  end

  testrun = runner.new(self)

  testrun.start
end

#verbose?Boolean

Returns:

  • (Boolean)


52
# File 'lib/turn/controller.rb', line 52

def verbose? ; @verbose ; end