Sha256: d1f8e4e38ee891da8dcd1cadfca9787dff222c80b3ae218c28ddf34f8fe50b28

Contents?: true

Size: 975 Bytes

Versions: 8

Compression:

Stored size: 975 Bytes

Contents

module EacLauncher
  module Stereotypes
    class GitSubtree
      include EacLauncher::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(p)
          return nil unless p
          ::EacLauncher::Stereotypes::Git.match?(p) ? p : parent_git(p.parent_path)
        end

        def other_git_stereotype?(path)
          ::EacLauncher::Stereotypes::Git.match?(path) ||
            ::EacLauncher::Stereotypes::GitSubrepo.match?(path)
        end

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
eac_launcher-0.5.1 lib/eac_launcher/stereotypes/git_subtree.rb
eac_launcher-0.5.0 lib/eac_launcher/stereotypes/git_subtree.rb
eac_launcher-0.4.0 lib/eac_launcher/stereotypes/git_subtree.rb
eac_launcher-0.3.2 lib/eac_launcher/stereotypes/git_subtree.rb
eac_launcher-0.3.1 lib/eac_launcher/stereotypes/git_subtree.rb
eac_launcher-0.3.0 lib/eac_launcher/stereotypes/git_subtree.rb
eac_launcher-0.2.2 lib/eac_launcher/stereotypes/git_subtree.rb
eac_launcher-0.2.1 lib/eac_launcher/stereotypes/git_subtree.rb