Class: EacLauncher::Stereotypes::GitSubtree

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

Defined Under Namespace

Classes: Publish, Warp

Class Method Summary collapse

Methods included from EacLauncher::Stereotype

included, nogit_stereotypes

Class Method Details

.colorObject



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

def color
  :green
end

.match?(path) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
10
11
12
13
14
# File 'lib/eac_launcher/stereotypes/git_subtree.rb', line 7

def match?(path)
  return false if ::EacLauncher::Stereotypes::Git.match?(path) ||
                  ::EacLauncher::Stereotypes::GitSubrepo.match?(path)
  return false unless other_nogit_stereotype?(path)
  parent = parent_git(path.parent)
  return false unless parent
  ::Git.open(parent).remote(File.basename(path)).url ? true : false
end

.other_nogit_stereotype?(path) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/eac_launcher/stereotypes/git_subtree.rb', line 25

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

.parent_git(p) ⇒ Object



20
21
22
23
# File 'lib/eac_launcher/stereotypes/git_subtree.rb', line 20

def parent_git(p)
  return nil unless p
  ::EacLauncher::Stereotypes::Git.match?(p) ? p : parent_git(p.parent)
end