Class: Avm::Projects::Stereotypes::GitSubrepo

Inherits:
Object
  • Object
show all
Includes:
Avm::Projects::Stereotype
Defined in:
lib/avm/projects/stereotypes/git_subrepo.rb,
lib/avm/projects/stereotypes/git_subrepo/warp.rb,
lib/avm/projects/stereotypes/git_subrepo/publish.rb

Defined Under Namespace

Classes: Publish, Warp

Class Method Summary collapse

Methods included from Avm::Projects::Stereotype

git_stereotypes, included, nogit_stereotypes

Class Method Details

.colorObject



19
20
21
# File 'lib/avm/projects/stereotypes/git_subrepo.rb', line 19

def color
  :light_cyan
end

.match?(path) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/avm/projects/stereotypes/git_subrepo.rb', line 15

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

.subrepo_url(path) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/avm/projects/stereotypes/git_subrepo.rb', line 23

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