Sha256: 24f8c986085fd8edc717dfbb3f526200fd2986b34e20b29ed844d9dc0847a38b

Contents?: true

Size: 1.53 KB

Versions: 15

Compression:

Stored size: 1.53 KB

Contents

# frozen_string_literal: true

require 'eac_cli/default_runner'
require 'eac_git/local'
require 'eac_ruby_utils/console/docopt_runner'

module Avm
  module Tools
    class Runner
      class Git
        class Subrepo < ::EacRubyUtils::Console::DocoptRunner
          class Check < ::EacRubyUtils::Console::DocoptRunner
            include ::EacCli::DefaultRunner

            runner_definition do
              desc 'Check status of subrepos.'
              bool_opt '-a', '--all', 'Select all subrepos.'
              bool_opt '-f', '--fix-parent', 'Fix parent SHA1.'
              bool_opt '-n', '--no-error', 'Do not exit with error if check fails.'
              bool_opt '-r', '--remote', 'Check subrepos remote.'
              pos_arg :subrepos, repeat: true, optional: true
            end

            def run
              subrepo_checks.show_result
              return if options.fetch('--no-error')
              return unless subrepo_checks.result.error?

              fatal_error 'Failed'
            end

            private

            def subrepo_checks_uncached
              r = ::Avm::Git::SubrepoChecks.new(local_repos)
              r.check_remote = options.fetch('--remote')
              r.fix_parent = options.fetch('--fix-parent')
              r.add_all_subrepos if options.fetch('--all')
              r.add_subrepos(*options.fetch('<subrepos>'))
              r
            end

            def local_repos_uncached
              ::EacGit::Local.new(context(:git))
            end
          end
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
avm-tools-0.97.0 lib/avm/tools/runner/git/subrepo/check.rb
avm-tools-0.96.0 lib/avm/tools/runner/git/subrepo/check.rb
avm-tools-0.95.0 lib/avm/tools/runner/git/subrepo/check.rb
avm-tools-0.94.3 lib/avm/tools/runner/git/subrepo/check.rb
avm-tools-0.94.2 lib/avm/tools/runner/git/subrepo/check.rb
avm-tools-0.94.1 lib/avm/tools/runner/git/subrepo/check.rb
avm-tools-0.94.0 lib/avm/tools/runner/git/subrepo/check.rb
avm-tools-0.93.0 lib/avm/tools/runner/git/subrepo/check.rb
avm-tools-0.92.0 lib/avm/tools/runner/git/subrepo/check.rb
avm-tools-0.91.0 lib/avm/tools/runner/git/subrepo/check.rb
avm-tools-0.90.0 lib/avm/tools/runner/git/subrepo/check.rb
avm-tools-0.89.0 lib/avm/tools/runner/git/subrepo/check.rb
avm-tools-0.88.0 lib/avm/tools/runner/git/subrepo/check.rb
avm-tools-0.87.1 lib/avm/tools/runner/git/subrepo/check.rb
avm-tools-0.87.0 lib/avm/tools/runner/git/subrepo/check.rb