Sha256: cc4714442ce9d4e74d1103b3eae8b0f2fdbc762834b8562a315fc2b7dcc8acb4
Contents?: true
Size: 1.24 KB
Versions: 1
Compression:
Stored size: 1.24 KB
Contents
require 'open3' module Retest class Command def self.for(test_command) if test_command.include? '<test>' VariableCommand else HardcodedCommand end.new test_command end class VariableCommand attr_reader :command, :repository, :cached_test_file def initialize(command, repository: nil) @repository = repository || Repository.new @command = command end def ==(obj) command == obj.command end def run(file_changed) if @cached_test_file = test_file(file_changed) stdout_and_stderr_str, _ = Open3.capture2e command.gsub('<test>', cached_test_file) Retest.log "Test File Selected: #{cached_test_file}" Retest.log stdout_and_stderr_str else Retest.log <<~ERROR 404 - Test File Not Found Retest could not find a matching test file to run. ERROR end end def test_file(file_changed) repository.find_test(file_changed) || cached_test_file end end HardcodedCommand = Struct.new(:command) do def run(_) stdout_and_stderr_str, _ = Open3.capture2e(command) Retest.log stdout_and_stderr_str end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
retest-0.6.0.pre | lib/retest/command.rb |