Sha256: 83ada321367aed76467440b18233a8dc191e749adc6f063859ecd6c045de5d05

Contents?: true

Size: 1.29 KB

Versions: 171

Compression:

Stored size: 1.29 KB

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/core_ext'
require 'eac_fs/logs'
require 'eac_ruby_utils/listable'

module Avm
  module EacRubyBase1
    module Sources
      class Base
        include ::EacRubyUtils::Listable

        enable_simple_cache
        lists.add_string :result, :failed, :nonexistent, :successful

        common_constructor :gem

        def elegible?
          dependency_present? && gem.root.join(test_directory).exist?
        end

        def dependency_present?
          gem.gemfile_path.exist? && gem.gemfile_lock_gem_version(dependency_gem).present?
        end

        def name
          self.class.name.demodulize.gsub(/Test\z/, '')
        end

        def to_s
          "#{gem}[#{name}]"
        end

        private

        def logs_uncached
          ::EacFs::Logs.new.add(:stdout).add(:stderr)
        end

        def result_uncached
          return RESULT_NONEXISTENT unless elegible?

          exec_run_with_log ? RESULT_SUCCESSFUL : RESULT_FAILED
        end

        def exec_run
          gem.bundle('exec', *bundle_exec_args).chdir_root.execute
        end

        def exec_run_with_log
          r = exec_run
          logs[:stdout].write(r[:stdout])
          logs[:stderr].write(r[:stderr])
          r[:exit_code].zero?
        end
      end
    end
  end
end

Version data entries

171 entries across 171 versions & 2 rubygems

Version Path
avm-eac_ruby_base1-0.30.3 lib/avm/eac_ruby_base1/sources/tests/base.rb
eac_tools-0.65.1 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/tests/base.rb
eac_tools-0.65.0 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/tests/base.rb
eac_tools-0.64.0 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/tests/base.rb
eac_tools-0.63.0 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/tests/base.rb
eac_tools-0.62.1 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/tests/base.rb
eac_tools-0.62.0 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/tests/base.rb
eac_tools-0.61.1 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/tests/base.rb
eac_tools-0.61.0 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/tests/base.rb
avm-eac_ruby_base1-0.30.2 lib/avm/eac_ruby_base1/sources/tests/base.rb
eac_tools-0.60.3 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/tests/base.rb
eac_tools-0.60.2 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/tests/base.rb
eac_tools-0.60.1 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/tests/base.rb
eac_tools-0.60.0 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/tests/base.rb
eac_tools-0.59.0 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/tests/base.rb
avm-eac_ruby_base1-0.30.1 lib/avm/eac_ruby_base1/sources/tests/base.rb
eac_tools-0.58.0 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/tests/base.rb
eac_tools-0.57.0 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/tests/base.rb
eac_tools-0.56.1 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/tests/base.rb
eac_tools-0.56.0 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/tests/base.rb