Class: IOCheck::Tester
- Inherits:
-
Object
- Object
- IOCheck::Tester
- Defined in:
- lib/iocheck/tester.rb
Instance Method Summary collapse
- #<<(test) ⇒ Object
- #create_lock_tasks ⇒ Object
-
#initialize ⇒ Tester
constructor
A new instance of Tester.
- #ready ⇒ Object
- #run! ⇒ Object
- #update! ⇒ Object
Constructor Details
#initialize ⇒ Tester
Returns a new instance of Tester.
8 9 10 |
# File 'lib/iocheck/tester.rb', line 8 def initialize @tests = [] end |
Instance Method Details
#<<(test) ⇒ Object
12 13 14 |
# File 'lib/iocheck/tester.rb', line 12 def <<(test) @tests << test end |
#create_lock_tasks ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/iocheck/tester.rb', line 40 def create_lock_tasks locked = @tests.select { |t| t.locked? } unlocked = @tests.select { |t| ! t.locked? } dir = ::IOCheck::Env["dir"] namespace "iocheck" do desc( "lock all unlocked files." ) task "lock" => unlocked.map { |t| "iocheck:lock:#{t.name}" } unlocked.each do |t| namespace "lock" do task t.name do dest = dir + "/" + "lock" mv ::IOCheck.readfile(t.name), dest end end end desc( "unlock all locked files." ) task "unlock" => locked.map { |t| "iocheck:unlock:#{t.name}" } locked.each do |t| namespace "unlock" do task t.name do dest = dir + "/" + "unlock" mv ::IOCheck.readfile(t.name), dest end end end end end |
#ready ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/iocheck/tester.rb', line 24 def ready @tests.each do |t| t.ready end namespace "iocheck" do desc( "update all the tests except locked ones" ) task "update" => @tests.map { |t| "iocheck:update:#{t.name}" } end desc( "run all the tests" ) task "iocheck" do run! show end create_lock_tasks end |
#run! ⇒ Object
16 17 18 |
# File 'lib/iocheck/tester.rb', line 16 def run! @tests.each { |t| t.run! } end |
#update! ⇒ Object
20 21 22 |
# File 'lib/iocheck/tester.rb', line 20 def update! @tests.each { |t| t.update! } end |