Sha256: f4b7f6c0dd3809b468a639deae3b4571626889ce0ecf17c97a9bd7fe33e8b38b

Contents?: true

Size: 621 Bytes

Versions: 1

Compression:

Stored size: 621 Bytes

Contents

module Koine
  class TestRunner
    class CommandExecuter
      def execute(command)
        start = Time.now
        system(command.to_s)
        finish = Time.now
        elapsed = finish - start
        logger.info("#{command} => elapsed time: #{elapsed.round(2)}")
        puts "\nTook #{elapsed.round(2)} seconds"
        $?.exitstatus
      end

      def fail(reason)
        puts reason
        exit(1)
      end

      def execute_and_exit(command)
        puts command
        exit(execute(command))
      end

      def logger
        @logger ||= Logger.new('/tmp/test_runner.log')
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
koine-test_runner-0.4.0 lib/koine/test_runner/command_executer.rb