Sha256: 2fafb478629b7fc744c09b6bd99b162259e2f453b1e092944a26d6321cd8b6c8

Contents?: true

Size: 884 Bytes

Versions: 9

Compression:

Stored size: 884 Bytes

Contents

module EacLauncher
  module Stereotypes
    class GitSubtree
      include EacLauncher::Stereotype

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

        def color
          :green
        end

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

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
eac_launcher-0.2.0 lib/eac_launcher/stereotypes/git_subtree.rb
eac_launcher-0.1.7 lib/eac_launcher/stereotypes/git_subtree.rb
eac_launcher-0.1.6 lib/eac_launcher/stereotypes/git_subtree.rb
eac_launcher-0.1.5 lib/eac_launcher/stereotypes/git_subtree.rb
eac_launcher-0.1.3 lib/eac_launcher/stereotypes/git_subtree.rb
eac_launcher-0.1.4 lib/eac_launcher/stereotypes/git_subtree.rb
eac_launcher-0.1.2 lib/eac_launcher/stereotypes/git_subtree.rb
eac_launcher-0.1.1 lib/eac_launcher/stereotypes/git_subtree.rb
eac_launcher-0.1.0 lib/eac_launcher/stereotypes/git_subtree.rb