Class: Dragnet::MultiRepository

Inherits:
BaseRepository show all
Defined in:
lib/dragnet/multi_repository.rb

Overview

This is a dummy class that acts as a placeholder when Dragnet is executed on a multi-repo set-up. Since there is no Git repository in the directory where git-repo runs git commands cannot be executed there only in the inner repositories.

This class's job is to raise a particular error when a git operation is attempted directly on this directory so that Dragnet can recognize the cause of the error and display it correctly.

It also acts as a collection of repositories. It stores a collection of Dragnet::Repository objects, which point to the actual repositories (this is just so that the same repository isn't initialized multiple times).

Instance Attribute Summary collapse

Attributes inherited from BaseRepository

#path

Instance Method Summary collapse

Methods inherited from BaseRepository

#branch, #branches, #branches_with, #branches_with_head, #diff, #git, #head, #remote_uri_path

Constructor Details

#initialize(path:) ⇒ MultiRepository

Returns a new instance of MultiRepository.

Parameters:

  • path (Pathname)

    Path to the directory where the inner repositories reside.



23
24
25
26
# File 'lib/dragnet/multi_repository.rb', line 23

def initialize(path:)
  super
  @repositories = {}
end

Instance Attribute Details

#repositoriesObject (readonly)

Returns the value of attribute repositories.



19
20
21
# File 'lib/dragnet/multi_repository.rb', line 19

def repositories
  @repositories
end

Instance Method Details

#multi?TrueClass

Returns It always returns true.

Returns:

  • (TrueClass)

    It always returns true



29
30
31
# File 'lib/dragnet/multi_repository.rb', line 29

def multi?
  true
end