module EacLauncher::Git::Base::Subrepo

Public Instance Methods

subrepo_remote_url(subrepo_path) click to toggle source
# File lib/eac_launcher/git/base/subrepo.rb, line 19
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
subrepo_status(subrepo_path) click to toggle source
# File lib/eac_launcher/git/base/subrepo.rb, line 9
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

Private Instance Methods

subrepo_status_parse_output(output) click to toggle source
# File lib/eac_launcher/git/base/subrepo.rb, line 29
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