Class: ExtremeContinuousBuilder::Build

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Build

Returns a new instance of Build.



8
9
10
11
12
13
# File 'lib/extreme_continuous_builder.rb', line 8

def initialize(options = {})
  @options  = options
  @log_file_path  = options[:log_file_path]
  @lock_file_path = options[:lock_file_path]
  @status   = Status.new(log_file_path)
end

Instance Attribute Details

#outputObject (readonly)

Returns the value of attribute output.



6
7
8
# File 'lib/extreme_continuous_builder.rb', line 6

def output
  @output
end

#statusObject (readonly)

Returns the value of attribute status.



6
7
8
# File 'lib/extreme_continuous_builder.rb', line 6

def status
  @status
end

#successObject (readonly)

Returns the value of attribute success.



6
7
8
# File 'lib/extreme_continuous_builder.rb', line 6

def success
  @success
end

Instance Method Details

#cleanObject



34
35
36
37
# File 'lib/extreme_continuous_builder.rb', line 34

def clean
  File.delete log_file_path if File.exist? log_file_path
  File.delete lock_file_path if File.exist? lock_file_path
end

#runObject

Runs the tests, returns one of the fiollowing:

::failed:     The test started failing
::broken:     The test is still failing
::succesful:  The test is still working
::revived:    The test started working, you fixed it


20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/extreme_continuous_builder.rb', line 20

def run
  under_lock do
    previous_status = @status.recall
  
    if status = make
      @status.keep(:succesful)
      (previous_status == :succesful or previous_status == false) ? :succesful : :revived
    else
      @status.keep(:failed)
      previous_status == :failed ? :broken : :failed
    end
  end
end