Sha256: 7eb7d71963d38cdb2f996996054039560c4439e9890099db594b7e6d0073dbb0

Contents?: true

Size: 1.14 KB

Versions: 109

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true

require 'active_support/core_ext/object'

module Avm
  module Launcher
    module Git
      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

109 entries across 109 versions & 2 rubygems

Version Path
eac_tools-0.6.0 sub/avm-tools/lib/avm/launcher/git/base/subrepo.rb
avm-tools-0.121.2 lib/avm/launcher/git/base/subrepo.rb
eac_tools-0.5.0 sub/avm-tools/lib/avm/launcher/git/base/subrepo.rb
eac_tools-0.4.0 sub/avm-tools/lib/avm/launcher/git/base/subrepo.rb
eac_tools-0.3.0 sub/avm-tools/lib/avm/launcher/git/base/subrepo.rb
eac_tools-0.2.2 sub/avm-tools/lib/avm/launcher/git/base/subrepo.rb
avm-tools-0.121.1 lib/avm/launcher/git/base/subrepo.rb
avm-tools-0.121.0 lib/avm/launcher/git/base/subrepo.rb
avm-tools-0.120.2 lib/avm/launcher/git/base/subrepo.rb
avm-tools-0.120.1 lib/avm/launcher/git/base/subrepo.rb
avm-tools-0.120.0 lib/avm/launcher/git/base/subrepo.rb
avm-tools-0.119.0 lib/avm/launcher/git/base/subrepo.rb
avm-tools-0.118.0 lib/avm/launcher/git/base/subrepo.rb
avm-tools-0.117.3 lib/avm/launcher/git/base/subrepo.rb
avm-tools-0.117.2 lib/avm/launcher/git/base/subrepo.rb
avm-tools-0.117.1 lib/avm/launcher/git/base/subrepo.rb
avm-tools-0.117.0 lib/avm/launcher/git/base/subrepo.rb
avm-tools-0.116.2 lib/avm/launcher/git/base/subrepo.rb
avm-tools-0.116.1 lib/avm/launcher/git/base/subrepo.rb
avm-tools-0.116.0 lib/avm/launcher/git/base/subrepo.rb