Sha256: 6d603d4deb8944d1494a227bb430c743bfd72dfd502363946fcc0d67ec221e44

Contents?: true

Size: 1.32 KB

Versions: 69

Compression:

Stored size: 1.32 KB

Contents

# frozen_string_literal: true

require 'eac_launcher/git/base'
require 'eac_ruby_utils/core_ext'

module Avm
  module Git
    class SubrepoChecks
      enable_console_speaker
      enable_simple_cache
      attr_accessor :check_remote, :fix_parent
      common_constructor :repository

      def add_all_subrepos
        add_subrepos(
          *repository.command('subrepo', '-q', 'status').execute!.split("\n").map(&:strip)
          .select(&:present?)
        )
      end

      def add_subrepos(*subpath_list)
        subpath_list.each do |subpath|
          subpaths.add(subpath)
        end
        reset_cache
        self
      end

      def check_options
        { fix_parent: fix_parent, check_remote: check_remote }
      end

      def show_result
        checks.each(&:show_result)
        infov 'Result', result.label
      end

      private

      def checks_uncached
        subpaths.map do |subpath|
          ::Avm::Git::SubrepoCheck.new(repository.subrepo(subpath), check_options)
        end
      end

      def result_uncached
        error_count = checks.count { |check| check.result.error? }
        ::Avm::Result.success_or_error(
          error_count.zero?,
          "#{error_count} of #{checks.count} subrepos failed"
        )
      end

      def subpaths
        @subpaths ||= ::Set.new
      end
    end
  end
end

Version data entries

69 entries across 69 versions & 1 rubygems

Version Path
avm-tools-0.98.0 lib/avm/git/subrepo_checks.rb
avm-tools-0.97.0 lib/avm/git/subrepo_checks.rb
avm-tools-0.96.0 lib/avm/git/subrepo_checks.rb
avm-tools-0.95.0 lib/avm/git/subrepo_checks.rb
avm-tools-0.94.3 lib/avm/git/subrepo_checks.rb
avm-tools-0.94.2 lib/avm/git/subrepo_checks.rb
avm-tools-0.94.1 lib/avm/git/subrepo_checks.rb
avm-tools-0.94.0 lib/avm/git/subrepo_checks.rb
avm-tools-0.93.0 lib/avm/git/subrepo_checks.rb
avm-tools-0.92.0 lib/avm/git/subrepo_checks.rb
avm-tools-0.91.0 lib/avm/git/subrepo_checks.rb
avm-tools-0.90.0 lib/avm/git/subrepo_checks.rb
avm-tools-0.89.0 lib/avm/git/subrepo_checks.rb
avm-tools-0.88.0 lib/avm/git/subrepo_checks.rb
avm-tools-0.87.1 lib/avm/git/subrepo_checks.rb
avm-tools-0.87.0 lib/avm/git/subrepo_checks.rb
avm-tools-0.86.0 lib/avm/git/subrepo_checks.rb
avm-tools-0.85.1 lib/avm/git/subrepo_checks.rb
avm-tools-0.85.0 lib/avm/git/subrepo_checks.rb
avm-tools-0.84.0 lib/avm/git/subrepo_checks.rb