class DeltaTest::Generator

Public Instance Methods

hook_on_exit() click to toggle source

Hook teardown! on exit

# File lib/delta_test/generator.rb, line 85
def hook_on_exit
  at_exit { teardown! }
end
setup!() click to toggle source

Setup table

# File lib/delta_test/generator.rb, line 19
def setup!
  return unless DeltaTest.active?

  return if @_setup
  @_setup = true

  DeltaTest.log('--- setup!')

  @table = DependenciesTable.new

  @current_spec_file = nil
end
start!(spec_file) click to toggle source

Start profiler for the spec file

@params {String} spec_file

# File lib/delta_test/generator.rb, line 37
def start!(spec_file)
  return unless DeltaTest.active?

  DeltaTest.log('--- start!(%s)' % spec_file)

  @current_spec_file = Utils.regulate_filepath(spec_file, DeltaTest.config.base_path).to_s

  Profiler.start!
end
stop!() click to toggle source

Stop profiler and update table

# File lib/delta_test/generator.rb, line 50
def stop!
  return unless DeltaTest.active?

  Profiler.stop!

  DeltaTest.log('--- stop!')

  spec_file = @current_spec_file
  @current_spec_file = nil

  if spec_file
    Profiler.last_result.each do |file|
      @table.add(spec_file, file)
    end
  end

  DeltaTest::Profiler.clean!
end
teardown!() click to toggle source

Save table to the file

# File lib/delta_test/generator.rb, line 72
def teardown!
  return unless @_setup
  return if @_teardown
  @_teardown = true

  DeltaTest.log('--- teardown!')
  Profiler.clean!
  @table.dump(DeltaTest.config.tmp_table_file)
end