Sha256: 2ce99bfdc48b81507c41f48760c6d29667bdb3c8966f8ee8c4d9ff4105f98730

Contents?: true

Size: 1.07 KB

Versions: 87

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

require 'active_support/core_ext/object'

module EacLauncher
  module Git
    class Base < ::EacLauncher::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

Version data entries

87 entries across 87 versions & 2 rubygems

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