Sha256: 30599384ef6693e1220fe86f898698f09a9169c4a007d1b26e2362e2c0a611d3

Contents?: true

Size: 823 Bytes

Versions: 109

Compression:

Stored size: 823 Bytes

Contents

# frozen_string_literal: true

require 'avm/launcher/git/error'
require 'eac_ruby_utils/core_ext'
require 'avm/projects/stereotype'

module Avm
  module Projects
    module Stereotypes
      class GitSubrepo
        require_sub __FILE__
        include Avm::Projects::Stereotype

        class << self
          def match?(path)
            File.exist?(path.real.subpath('.gitrepo')) && subrepo_url(path.real) != 'none'
          end

          def color
            :light_cyan
          end

          def subrepo_url(path)
            File.read(path.subpath('.gitrepo')).each_line do |l|
              m = /remote\s*=\s(.+)/.match(l)
              return m[1] if m
            end
            raise ::Avm::Launcher::Git::Error.new(path, '"remote = ... " not found')
          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/projects/stereotypes/git_subrepo.rb
eac_tools-0.36.0 sub/avm-tools/lib/avm/projects/stereotypes/git_subrepo.rb
avm-tools-0.139.0 lib/avm/projects/stereotypes/git_subrepo.rb
eac_tools-0.35.0 sub/avm-tools/lib/avm/projects/stereotypes/git_subrepo.rb
avm-tools-0.138.0 lib/avm/projects/stereotypes/git_subrepo.rb
eac_tools-0.34.0 sub/avm-tools/lib/avm/projects/stereotypes/git_subrepo.rb
avm-tools-0.137.0 lib/avm/projects/stereotypes/git_subrepo.rb
eac_tools-0.33.0 sub/avm-tools/lib/avm/projects/stereotypes/git_subrepo.rb
eac_tools-0.32.0 sub/avm-tools/lib/avm/projects/stereotypes/git_subrepo.rb
avm-tools-0.136.2 lib/avm/projects/stereotypes/git_subrepo.rb
eac_tools-0.31.1 sub/avm-tools/lib/avm/projects/stereotypes/git_subrepo.rb
eac_tools-0.31.0 sub/avm-tools/lib/avm/projects/stereotypes/git_subrepo.rb
avm-tools-0.136.1 lib/avm/projects/stereotypes/git_subrepo.rb
eac_tools-0.30.0 sub/avm-tools/lib/avm/projects/stereotypes/git_subrepo.rb
eac_tools-0.29.0 sub/avm-tools/lib/avm/projects/stereotypes/git_subrepo.rb
avm-tools-0.136.0 lib/avm/projects/stereotypes/git_subrepo.rb
eac_tools-0.28.0 sub/avm-tools/lib/avm/projects/stereotypes/git_subrepo.rb
eac_tools-0.27.2 sub/avm-tools/lib/avm/projects/stereotypes/git_subrepo.rb
eac_tools-0.27.1 sub/avm-tools/lib/avm/projects/stereotypes/git_subrepo.rb
avm-tools-0.135.0 lib/avm/projects/stereotypes/git_subrepo.rb