Class: Tester::Runner
- Inherits:
-
Object
- Object
- Tester::Runner
- Defined in:
- lib/tester/runner.rb
Instance Attribute Summary collapse
-
#checker ⇒ Object
readonly
Returns the value of attribute checker.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#started ⇒ Object
Returns the value of attribute started.
-
#testing ⇒ Object
Returns the value of attribute testing.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options) ⇒ Runner
constructor
A new instance of Runner.
- #start ⇒ Object
- #test(hash) ⇒ Object
- #test_if_updated ⇒ Object
Constructor Details
Instance Attribute Details
#checker ⇒ Object (readonly)
Returns the value of attribute checker.
7 8 9 |
# File 'lib/tester/runner.rb', line 7 def checker @checker end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
7 8 9 |
# File 'lib/tester/runner.rb', line 7 def config @config end |
#started ⇒ Object
Returns the value of attribute started.
8 9 10 |
# File 'lib/tester/runner.rb', line 8 def started @started end |
#testing ⇒ Object
Returns the value of attribute testing.
8 9 10 |
# File 'lib/tester/runner.rb', line 8 def testing @testing end |
Class Method Details
.start(options) ⇒ Object
3 4 5 |
# File 'lib/tester/runner.rb', line 3 def self.start() self.new().start end |
Instance Method Details
#start ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/tester/runner.rb', line 15 def start return if started Thread.start do loop do begin test_if_updated rescue Exception => e puts "#{e.}\n #{e.backtrace.join("\n ")}" ensure sleep config[:interval] end end end self.started = true end |
#test(hash) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/tester/runner.rb', line 42 def test(hash) process = TestProcess.new(config[:test_command]) process.start puts "#{hash} => #{process.status}" puts process.output Log[hash] = process.to_hash.merge( :hash => hash, :created_at => Time.now, :branch => config[:branch] ) end |
#test_if_updated ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/tester/runner.rb', line 31 def test_if_updated checker.if_updated do |hash| begin self.testing = true test(hash) ensure self.testing = false end end end |