Sha256: df694182db83069a6e3c1b0be3f6a676a91f233893a8ed41e168d56468e6deb6

Contents?: true

Size: 1.32 KB

Versions: 98

Compression:

Stored size: 1.32 KB

Contents

# frozen_string_literal: true

require 'avm/launcher/stereotype'
require 'avm/git/launcher_stereotypes/git'
require 'eac_ruby_utils/core_ext'

module Avm
  module Git
    module LauncherStereotypes
      class GitSubtree
        require_sub __FILE__
        include Avm::Launcher::Stereotype

        class << self
          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

          def color
            :green
          end

          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

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

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

Version data entries

98 entries across 98 versions & 2 rubygems

Version Path
avm-git-0.18.0 lib/avm/git/launcher_stereotypes/git_subtree.rb
eac_tools-0.94.0 sub/avm-git/lib/avm/git/launcher_stereotypes/git_subtree.rb
avm-git-0.17.0 lib/avm/git/launcher_stereotypes/git_subtree.rb
eac_tools-0.86.5 sub/avm-git/lib/avm/git/launcher_stereotypes/git_subtree.rb
avm-git-0.16.0 lib/avm/git/launcher_stereotypes/git_subtree.rb
eac_tools-0.86.4 sub/avm-git/lib/avm/git/launcher_stereotypes/git_subtree.rb
eac_tools-0.86.3 sub/avm-git/lib/avm/git/launcher_stereotypes/git_subtree.rb
avm-git-0.15.0 lib/avm/git/launcher_stereotypes/git_subtree.rb
eac_tools-0.86.2 sub/avm-git/lib/avm/git/launcher_stereotypes/git_subtree.rb
eac_tools-0.84.0 sub/avm-git/lib/avm/git/launcher_stereotypes/git_subtree.rb
eac_tools-0.83.0 sub/avm-git/lib/avm/git/launcher_stereotypes/git_subtree.rb
eac_tools-0.82.0 sub/avm-git/lib/avm/git/launcher_stereotypes/git_subtree.rb
avm-git-0.14.0 lib/avm/git/launcher_stereotypes/git_subtree.rb
eac_tools-0.81.0 sub/avm-git/lib/avm/git/launcher_stereotypes/git_subtree.rb
eac_tools-0.80.0 sub/avm-git/lib/avm/git/launcher_stereotypes/git_subtree.rb
eac_tools-0.79.0 sub/avm-git/lib/avm/git/launcher_stereotypes/git_subtree.rb
eac_tools-0.78.0 sub/avm-git/lib/avm/git/launcher_stereotypes/git_subtree.rb
eac_tools-0.77.1 sub/avm-git/lib/avm/git/launcher_stereotypes/git_subtree.rb
eac_tools-0.77.0 sub/avm-git/lib/avm/git/launcher_stereotypes/git_subtree.rb
eac_tools-0.76.1 sub/avm-git/lib/avm/git/launcher_stereotypes/git_subtree.rb