Class: EacLauncher::Stereotypes::GitSubrepo

Inherits:
Object
  • Object
show all
Includes:
EacLauncher::Stereotype
Defined in:
lib/eac_launcher/stereotypes/git_subrepo.rb,
lib/eac_launcher/stereotypes/git_subrepo/warp.rb,
lib/eac_launcher/stereotypes/git_subrepo/publish.rb

Defined Under Namespace

Classes: Publish, Warp

Class Method Summary collapse

Methods included from EacLauncher::Stereotype

git_stereotypes, included, nogit_stereotypes

Class Method Details

.colorObject



16
17
18
# File 'lib/eac_launcher/stereotypes/git_subrepo.rb', line 16

def color
  :light_cyan
end

.match?(path) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/eac_launcher/stereotypes/git_subrepo.rb', line 12

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

.subrepo_url(path) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/eac_launcher/stereotypes/git_subrepo.rb', line 20

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 ::EacLauncher::Git::Error.new(path, '"remote = ... " not found')
end