Sha256: 7f5fa87d160a84adca76def3c3a2c75e6bbe6439a345acb8ebe065727c259042

Contents?: true

Size: 1.2 KB

Versions: 69

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true

require 'avm/instances/configuration'
require 'avm/result'
require 'eac_ruby_utils/fs/temp'

module Avm
  module Git
    module Issue
      class Complete
        def test_result
          test_command = configuration.if_present(&:any_test_command)
          return ::Avm::Result.success('unconfigured') if test_command.blank?

          infom "Running test command \"#{test_command}\"..."
          result = test_command.execute
          test_result_log(result)
          if result.fetch(:exit_code).zero?
            ::Avm::Result.success('yes')
          else
            ::Avm::Result.error('no')
          end
        end

        private

        def test_result_log(result)
          stdout_file = ::EacRubyUtils::Fs::Temp.file
          stderr_file = ::EacRubyUtils::Fs::Temp.file
          stdout_file.write(result.fetch(:stdout))
          stderr_file.write(result.fetch(:stderr))
          infov '  * Exit code', result.fetch(:exit_code)
          infov '  * STDOUT', stdout_file.to_path
          infov '  * STDERR', stderr_file.to_path
        end

        def configuration_uncached
          ::Avm::Instances::Configuration.find_by_path(@git)
        end
      end
    end
  end
end

Version data entries

69 entries across 69 versions & 1 rubygems

Version Path
avm-tools-0.82.0 lib/avm/git/issue/complete/_test.rb
avm-tools-0.81.0 lib/avm/git/issue/complete/_test.rb
avm-tools-0.80.0 lib/avm/git/issue/complete/_test.rb
avm-tools-0.79.0 lib/avm/git/issue/complete/_test.rb
avm-tools-0.78.0 lib/avm/git/issue/complete/_test.rb
avm-tools-0.77.0 lib/avm/git/issue/complete/_test.rb
avm-tools-0.76.1 lib/avm/git/issue/complete/_test.rb
avm-tools-0.76.0 lib/avm/git/issue/complete/_test.rb
avm-tools-0.75.1 lib/avm/git/issue/complete/_test.rb
avm-tools-0.75.0 lib/avm/git/issue/complete/_test.rb
avm-tools-0.74.1 lib/avm/git/issue/complete/_test.rb
avm-tools-0.74.0 lib/avm/git/issue/complete/_test.rb
avm-tools-0.73.0 lib/avm/git/issue/complete/_test.rb
avm-tools-0.72.0 lib/avm/git/issue/complete/_test.rb
avm-tools-0.71.0 lib/avm/git/issue/complete/_test.rb
avm-tools-0.70.2 lib/avm/git/issue/complete/_test.rb
avm-tools-0.70.1 lib/avm/git/issue/complete/_test.rb
avm-tools-0.70.0 lib/avm/git/issue/complete/_test.rb
avm-tools-0.69.3 lib/avm/git/issue/complete/_test.rb
avm-tools-0.69.2 lib/avm/git/issue/complete/_test.rb