Sha256: ef0e388a1674f25ade2bee63018166873c4fa402eceaa0a75b5663c41f2bd822

Contents?: true

Size: 1 KB

Versions: 37

Compression:

Stored size: 1 KB

Contents

module Autotest::Preload
  def self.glob
    @glob
  end

  def self.glob= o
    @glob = o
  end

  self.glob = "test/test_helper.rb"

  Autotest.add_hook :post_initialize do |at, *args|
    at.add_sigquit_handler

    warn "pre-loading initializers"
    t0 = Time.now
    Dir[self.glob].each do |path|
      require path
    end
    warn "done pre-loading initializers in %.2f seconds" % [Time.now - t0]

    false
  end
end

class Autotest
  alias :old_run_tests :run_tests

  def run_tests
    hook :run_command

    new_mtime = self.find_files_to_test
    return unless new_mtime
    self.last_mtime = new_mtime

    begin
      # TODO: deal with unit_diff and partial test runs later
      original_argv = ARGV.dup
      ARGV.clear

      @child = fork do
        trap "QUIT", "DEFAULT"
        trap "INT", "DEFAULT"
        files_to_test.keys.each do |file|
          load file
        end
      end
      Process.wait
    ensure
      @child = nil
      ARGV.replace original_argv
    end

    hook :ran_command
  end
end

Version data entries

37 entries across 37 versions & 9 rubygems

Version Path
ZenTest-4.9.3 lib/autotest/preload.rb
ZenTest-4.9.2 lib/autotest/preload.rb
ZenTest-4.9.1 lib/autotest/preload.rb
ZenTest-4.9.0 lib/autotest/preload.rb
ZenTest-4.8.4 lib/autotest/preload.rb
ZenTest-4.8.3 lib/autotest/preload.rb
ZenTest-4.8.2 lib/autotest/preload.rb
ZenTest-4.8.1 lib/autotest/preload.rb
ZenTest-4.8.0 lib/autotest/preload.rb
ZenTest-4.7.0 lib/autotest/preload.rb
radiant-1.0.0 ruby-debug/ruby/1.8/gems/ZenTest-4.6.0/lib/autotest/preload.rb
SlimZenTest-4.6.2 lib/autotest/preload.rb
ZenTest-4.6.2 lib/autotest/preload.rb
SlimTest-4.6.1.1 lib/autotest/preload.rb
ZenTest-4.6.1 lib/autotest/preload.rb
ZenTest-4.6.0 lib/autotest/preload.rb
ZenTest-4.5.0 lib/autotest/preload.rb