Sha256: ef2230edd100005806f809e3dd666527c45a7c85cf5b7882e9d611c93692bb26

Contents?: true

Size: 1.14 KB

Versions: 86

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true

require 'active_support/core_ext/object'

module Avm
  module Git
    module Launcher
      class Base < ::Avm::Launcher::Paths::Real
        module Subrepo
          def subrepo_status(subrepo_path)
            s = execute!('subrepo', 'status', subrepo_path.gsub(%r{\A/}, ''))
            raise s.strip.to_s if s.include?('is not a subrepo')

            r = subrepo_status_parse_output(s)
            raise "Empty subrepo status for |#{s}|\n" unless r.any?

            r
          end

          def subrepo_remote_url(subrepo_path)
            h = subrepo_status(subrepo_path)
            url = h['Remote URL']
            return url if url.present?

            raise "Remote URL is blank for subrepo \"#{subrepo_path}\" (Subrepo status: #{h})"
          end

          private

          def subrepo_status_parse_output(output)
            r = {}.with_indifferent_access
            output.each_line do |l|
              m = /\A([^\:]+)\:(.*)\z/.match(l.strip)
              next unless m && m[2].present?

              r[m[1].strip] = m[2].strip
            end
            r
          end
        end
      end
    end
  end
end

Version data entries

86 entries across 86 versions & 2 rubygems

Version Path
eac_tools-0.80.0 sub/avm-git/lib/avm/git/launcher/base/subrepo.rb
eac_tools-0.79.0 sub/avm-git/lib/avm/git/launcher/base/subrepo.rb
eac_tools-0.78.0 sub/avm-git/lib/avm/git/launcher/base/subrepo.rb
eac_tools-0.77.1 sub/avm-git/lib/avm/git/launcher/base/subrepo.rb
eac_tools-0.77.0 sub/avm-git/lib/avm/git/launcher/base/subrepo.rb
eac_tools-0.76.1 sub/avm-git/lib/avm/git/launcher/base/subrepo.rb
eac_tools-0.76.0 sub/avm-git/lib/avm/git/launcher/base/subrepo.rb
eac_tools-0.75.2 sub/avm-git/lib/avm/git/launcher/base/subrepo.rb
avm-git-0.13.4 lib/avm/git/launcher/base/subrepo.rb
eac_tools-0.75.1 sub/avm-git/lib/avm/git/launcher/base/subrepo.rb
eac_tools-0.75.0 sub/avm-git/lib/avm/git/launcher/base/subrepo.rb
eac_tools-0.74.1 sub/avm-git/lib/avm/git/launcher/base/subrepo.rb
eac_tools-0.74.0 sub/avm-git/lib/avm/git/launcher/base/subrepo.rb
eac_tools-0.73.0 sub/avm-git/lib/avm/git/launcher/base/subrepo.rb
eac_tools-0.72.0 sub/avm-git/lib/avm/git/launcher/base/subrepo.rb
eac_tools-0.70.1 sub/avm-git/lib/avm/git/launcher/base/subrepo.rb
eac_tools-0.70.0 sub/avm-git/lib/avm/git/launcher/base/subrepo.rb
eac_tools-0.69.1 sub/avm-git/lib/avm/git/launcher/base/subrepo.rb
eac_tools-0.69.0 sub/avm-git/lib/avm/git/launcher/base/subrepo.rb
eac_tools-0.68.0 sub/avm-git/lib/avm/git/launcher/base/subrepo.rb