Sha256: bea173ac7097664bd5e707fa8f59809047cca5163cbb186cc8db4cbd867c6953

Contents?: true

Size: 871 Bytes

Versions: 59

Compression:

Stored size: 871 Bytes

Contents

# frozen_string_literal: true

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

module Avm
  module Git
    module LauncherStereotypes
      class GitSubrepo
        require_sub __FILE__
        include Avm::Launcher::Stereotype

        CONFIG_SUBPATH = '.gitrepo'

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

          def color
            :light_cyan
          end

          def subrepo_url(path)
            File.read(path.subpath(CONFIG_SUBPATH)).each_line do |l|
              m = /remote\s*=\s(.+)/.match(l)
              return m[1] if m
            end
            raise ::Avm::Git::Launcher::Error.new(path, '"remote = ... " not found')
          end
        end
      end
    end
  end
end

Version data entries

59 entries across 59 versions & 2 rubygems

Version Path
avm-git-0.18.0 lib/avm/git/launcher_stereotypes/git_subrepo.rb
eac_tools-0.94.0 sub/avm-git/lib/avm/git/launcher_stereotypes/git_subrepo.rb
avm-git-0.17.0 lib/avm/git/launcher_stereotypes/git_subrepo.rb
eac_tools-0.86.5 sub/avm-git/lib/avm/git/launcher_stereotypes/git_subrepo.rb
avm-git-0.16.0 lib/avm/git/launcher_stereotypes/git_subrepo.rb
eac_tools-0.86.4 sub/avm-git/lib/avm/git/launcher_stereotypes/git_subrepo.rb
eac_tools-0.86.3 sub/avm-git/lib/avm/git/launcher_stereotypes/git_subrepo.rb
avm-git-0.15.0 lib/avm/git/launcher_stereotypes/git_subrepo.rb
eac_tools-0.86.2 sub/avm-git/lib/avm/git/launcher_stereotypes/git_subrepo.rb
eac_tools-0.84.0 sub/avm-git/lib/avm/git/launcher_stereotypes/git_subrepo.rb
eac_tools-0.83.0 sub/avm-git/lib/avm/git/launcher_stereotypes/git_subrepo.rb
eac_tools-0.82.0 sub/avm-git/lib/avm/git/launcher_stereotypes/git_subrepo.rb
avm-git-0.14.0 lib/avm/git/launcher_stereotypes/git_subrepo.rb
eac_tools-0.81.0 sub/avm-git/lib/avm/git/launcher_stereotypes/git_subrepo.rb
eac_tools-0.80.0 sub/avm-git/lib/avm/git/launcher_stereotypes/git_subrepo.rb
eac_tools-0.79.0 sub/avm-git/lib/avm/git/launcher_stereotypes/git_subrepo.rb
eac_tools-0.78.0 sub/avm-git/lib/avm/git/launcher_stereotypes/git_subrepo.rb
eac_tools-0.77.1 sub/avm-git/lib/avm/git/launcher_stereotypes/git_subrepo.rb
eac_tools-0.77.0 sub/avm-git/lib/avm/git/launcher_stereotypes/git_subrepo.rb
eac_tools-0.76.1 sub/avm-git/lib/avm/git/launcher_stereotypes/git_subrepo.rb