Class: Avm::Git::LauncherStereotypes::GitSubrepo

Inherits:
Object
  • Object
show all
Includes:
Launcher::Stereotype
Defined in:
lib/avm/git/launcher_stereotypes/git_subrepo.rb,
lib/avm/git/launcher_stereotypes/git_subrepo/warp.rb,
lib/avm/git/launcher_stereotypes/git_subrepo/publish.rb

Defined Under Namespace

Classes: Publish, Warp

Constant Summary collapse

CONFIG_SUBPATH =
'.gitrepo'

Class Method Summary collapse

Class Method Details

.colorObject



21
22
23
# File 'lib/avm/git/launcher_stereotypes/git_subrepo.rb', line 21

def color
  :light_cyan
end

.match?(path) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/avm/git/launcher_stereotypes/git_subrepo.rb', line 17

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

.subrepo_url(path) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/avm/git/launcher_stereotypes/git_subrepo.rb', line 25

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