Sha256: 090add1d229314b6cf5e6b71b3a619782a8732783dd8f6734ea0c90b39417313

Contents?: true

Size: 1.14 KB

Versions: 14

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true

require 'active_support/core_ext/object'

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

14 entries across 14 versions & 2 rubygems

Version Path
avm-git-0.18.0 lib/avm/git/launcher/base/subrepo.rb
eac_tools-0.94.0 sub/avm-git/lib/avm/git/launcher/base/subrepo.rb
avm-git-0.17.0 lib/avm/git/launcher/base/subrepo.rb
eac_tools-0.86.5 sub/avm-git/lib/avm/git/launcher/base/subrepo.rb
avm-git-0.16.0 lib/avm/git/launcher/base/subrepo.rb
eac_tools-0.86.4 sub/avm-git/lib/avm/git/launcher/base/subrepo.rb
eac_tools-0.86.3 sub/avm-git/lib/avm/git/launcher/base/subrepo.rb
avm-git-0.15.0 lib/avm/git/launcher/base/subrepo.rb
eac_tools-0.86.2 sub/avm-git/lib/avm/git/launcher/base/subrepo.rb
eac_tools-0.84.0 sub/avm-git/lib/avm/git/launcher/base/subrepo.rb
eac_tools-0.83.0 sub/avm-git/lib/avm/git/launcher/base/subrepo.rb
eac_tools-0.82.0 sub/avm-git/lib/avm/git/launcher/base/subrepo.rb
avm-git-0.14.0 lib/avm/git/launcher/base/subrepo.rb
eac_tools-0.81.0 sub/avm-git/lib/avm/git/launcher/base/subrepo.rb