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.96.0 lib/avm/git/issue/complete/_test.rb
avm-tools-0.95.0 lib/avm/git/issue/complete/_test.rb
avm-tools-0.94.3 lib/avm/git/issue/complete/_test.rb
avm-tools-0.94.2 lib/avm/git/issue/complete/_test.rb
avm-tools-0.94.1 lib/avm/git/issue/complete/_test.rb
avm-tools-0.94.0 lib/avm/git/issue/complete/_test.rb
avm-tools-0.93.0 lib/avm/git/issue/complete/_test.rb
avm-tools-0.92.0 lib/avm/git/issue/complete/_test.rb
avm-tools-0.91.0 lib/avm/git/issue/complete/_test.rb
avm-tools-0.90.0 lib/avm/git/issue/complete/_test.rb
avm-tools-0.89.0 lib/avm/git/issue/complete/_test.rb
avm-tools-0.88.0 lib/avm/git/issue/complete/_test.rb
avm-tools-0.87.1 lib/avm/git/issue/complete/_test.rb
avm-tools-0.87.0 lib/avm/git/issue/complete/_test.rb
avm-tools-0.86.0 lib/avm/git/issue/complete/_test.rb
avm-tools-0.85.1 lib/avm/git/issue/complete/_test.rb
avm-tools-0.85.0 lib/avm/git/issue/complete/_test.rb
avm-tools-0.84.0 lib/avm/git/issue/complete/_test.rb
avm-tools-0.83.0 lib/avm/git/issue/complete/_test.rb
avm-tools-0.82.1 lib/avm/git/issue/complete/_test.rb