Class: Avm::Git::LauncherStereotypes::GitSubtree

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

Defined Under Namespace

Classes: Publish, Warp

Class Method Summary collapse

Class Method Details

.colorObject



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

def color
  :green
end

.match?(path) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
14
15
16
17
18
19
# File 'lib/avm/git/launcher_stereotypes/git_subtree.rb', line 11

def match?(path)
  return false if other_git_stereotype?(path)
  return false unless other_nogit_stereotype?(path)

  parent = parent_git(path.parent_path)
  return false unless parent

  ::Git.open(parent.real).remote(path.real.basename).url ? true : false
end

.other_git_stereotype?(path) ⇒ Boolean

Returns:

  • (Boolean)


35
36
37
38
# File 'lib/avm/git/launcher_stereotypes/git_subtree.rb', line 35

def other_git_stereotype?(path)
  ::Avm::Git::LauncherStereotypes::Git.match?(path) ||
    ::Avm::Git::LauncherStereotypes::GitSubrepo.match?(path)
end

.other_nogit_stereotype?(path) ⇒ Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/avm/git/launcher_stereotypes/git_subtree.rb', line 40

def other_nogit_stereotype?(path)
  Avm::Launcher::Stereotype.nogit_stereotypes.any? { |s| s.match?(path) }
end

.parent_git(parent_path) ⇒ Object



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

def parent_git(parent_path)
  return nil unless parent_path

  if ::Avm::Git::LauncherStereotypes::Git.match?(parent_path)
    parent_path
  else
    parent_git(parent_path.parent_path)
  end
end