Sha256: 81a1c81dcebd835a372d7817afd60eac4ab0ee66d2577a105d74d6188dc38026

Contents?: true

Size: 847 Bytes

Versions: 6

Compression:

Stored size: 847 Bytes

Contents

$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__))) unless $LOAD_PATH.include?(File.expand_path(File.dirname(__FILE__)))
module Spork
  SPEC_HELPER_FILE = File.join(Dir.pwd, "spec/spec_helper.rb")
  
  class << self
    def prefork(&block)
      return if @already_preforked
      @already_preforked = true
      yield
    end
  
    def each_run(&block)
      return if @state == :preforking || (@state != :not_using_spork && @already_run)
      @already_run = true
      yield
    end
  
    def preforking!
      @state = :preforking
    end
  
    def running!
      @state = :running
    end
  
    def state
      @state ||= :not_using_spork
    end
  
    def exec_prefork(helper_file)
      preforking!
      load(helper_file)
    end
  
    def exec_each_run(helper_file)
      running!
      load(helper_file)
    end
  end
end

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
bmabey-spork-0.4.4 lib/spork.rb
timcharper-spork-0.4.0 lib/spork.rb
timcharper-spork-0.4.2 lib/spork.rb
spork-0.4.1 lib/spork.rb
spork-0.4.0 lib/spork.rb
spork-0.4.2 lib/spork.rb