Sha256: dd81c2f685fc593aa4cba17b8ae4635fffc9ee301a734286e53a40fc27996de1

Contents?: true

Size: 1006 Bytes

Versions: 8

Compression:

Stored size: 1006 Bytes

Contents

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(s)
          r = {}.with_indifferent_access
          s.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

8 entries across 8 versions & 1 rubygems

Version Path
eac_launcher-0.5.1 lib/eac_launcher/git/base/subrepo.rb
eac_launcher-0.5.0 lib/eac_launcher/git/base/subrepo.rb
eac_launcher-0.4.0 lib/eac_launcher/git/base/subrepo.rb
eac_launcher-0.3.2 lib/eac_launcher/git/base/subrepo.rb
eac_launcher-0.3.1 lib/eac_launcher/git/base/subrepo.rb
eac_launcher-0.3.0 lib/eac_launcher/git/base/subrepo.rb
eac_launcher-0.2.2 lib/eac_launcher/git/base/subrepo.rb
eac_launcher-0.2.1 lib/eac_launcher/git/base/subrepo.rb