Sha256: dd8a64408b7726c2095499e60f040d95dcb9a733f2153b61b756eb05c162f982

Contents?: true

Size: 864 Bytes

Versions: 4

Compression:

Stored size: 864 Bytes

Contents

module InfinityTest
  class ContinuousTesting
    attr_accessor :application, :watchr, :global_commands

    def initialize
      @application = InfinityTest.application
      @watchr = InfinityTest.watchr
    end

    ##################
    # Watchr Methods #
    ##################

    def initialize_watchr!
      add_signal
      run_with_watchr!
    end
    alias :start! :initialize_watchr!

    def run_with_watchr!
      Watchr::Controller.new(@watchr, Watchr.handler.new).run
    end

    def add_signal
      Signal.trap 'INT' do
        if @sent_an_int then
           puts " Shutting down now"
           exit
        else
           puts " Interrupt a second time to quit"
           @sent_an_int = true
           Kernel.sleep 1.1
           @application.run_global_commands!
           @sent_an_int = false
        end
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
infinity_test-1.0.3 lib/infinity_test/continuous_testing.rb
infinity_test-1.0.2 lib/infinity_test/continuous_testing.rb
infinity_test-1.0.1 lib/infinity_test/continuous_testing.rb
infinity_test-1.0.0 lib/infinity_test/continuous_testing.rb