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
avm-tools-0.140.0 lib/avm/launcher/git/base/subrepo.rb
eac_tools-0.36.0 sub/avm-tools/lib/avm/launcher/git/base/subrepo.rb
avm-tools-0.139.0 lib/avm/launcher/git/base/subrepo.rb
eac_tools-0.35.0 sub/avm-tools/lib/avm/launcher/git/base/subrepo.rb
avm-tools-0.138.0 lib/avm/launcher/git/base/subrepo.rb
eac_tools-0.34.0 sub/avm-tools/lib/avm/launcher/git/base/subrepo.rb
avm-tools-0.137.0 lib/avm/launcher/git/base/subrepo.rb
eac_tools-0.33.0 sub/avm-tools/lib/avm/launcher/git/base/subrepo.rb
eac_tools-0.32.0 sub/avm-tools/lib/avm/launcher/git/base/subrepo.rb
avm-tools-0.136.2 lib/avm/launcher/git/base/subrepo.rb
eac_tools-0.31.1 sub/avm-tools/lib/avm/launcher/git/base/subrepo.rb
eac_tools-0.31.0 sub/avm-tools/lib/avm/launcher/git/base/subrepo.rb
avm-tools-0.136.1 lib/avm/launcher/git/base/subrepo.rb
eac_tools-0.30.0 sub/avm-tools/lib/avm/launcher/git/base/subrepo.rb
eac_tools-0.29.0 sub/avm-tools/lib/avm/launcher/git/base/subrepo.rb
avm-tools-0.136.0 lib/avm/launcher/git/base/subrepo.rb
eac_tools-0.28.0 sub/avm-tools/lib/avm/launcher/git/base/subrepo.rb
eac_tools-0.27.2 sub/avm-tools/lib/avm/launcher/git/base/subrepo.rb
eac_tools-0.27.1 sub/avm-tools/lib/avm/launcher/git/base/subrepo.rb
avm-tools-0.135.0 lib/avm/launcher/git/base/subrepo.rb