Class: Linguist::Source::Repository

Inherits:
Object
  • Object
show all
Defined in:
lib/linguist/source/repository.rb

Overview

Repository is an interface for providing direct access to functionality in a repository of files whose contents can be scanned for language information.

Direct Known Subclasses

RuggedRepository

Instance Method Summary collapse

Instance Method Details

#diff(old_commit, new_commit) ⇒ Object

Public: compute the diff between the given old and new commits.

old_commit - the string unique identifier of the “before” state of the

diff, or nil (representing an empty tree).

new_commit - the string unique identifier of the “after” state of the

diff, or nil (representing an empty tree).

Returns a Source::Diff.

Raises:

  • (NotImplementedError)


59
60
61
# File 'lib/linguist/source/repository.rb', line 59

def diff(old_commit, new_commit)
  raise NotImplementedError
end

#get_tree_size(commit_id, limit = nil) ⇒ Object

Public: get the number of entries in the root tree of the given commit, with an optional maximum value.

commit_id - the string unique identifier of the commit to analyze. limit - (Optional) the integer maximum number of tree entries to

count.

Returns the number of entries in the tree or ‘limit’, whichever is smaller.

Raises:

  • (NotImplementedError)


16
17
18
# File 'lib/linguist/source/repository.rb', line 16

def get_tree_size(commit_id, limit = nil)
  raise NotImplementedError
end

#load_attributes_for_path(path, attr_names) ⇒ Object

Public: look up the attribute values for a given path.

path - the path for which we want attribute values. attr_names - the attributes to read for the given path.

Returns a Hash mapping attribute names to their corresponding values.

Raises:

  • (NotImplementedError)


47
48
49
# File 'lib/linguist/source/repository.rb', line 47

def load_attributes_for_path(path, attr_names)
  raise NotImplementedError
end

#load_blob(blob_id, max_size) ⇒ Object

Public: read the data and size information for the specified file blob.

blob_id - the string unique identifier of the blob to read. max_size - the integer maximum size in bytes to read from the blob.

Returns the (possibly truncated) byte string of blob content and the full, untruncated size of the blob.

Raises:

  • (NotImplementedError)


37
38
39
# File 'lib/linguist/source/repository.rb', line 37

def load_blob(blob_id, max_size)
  raise NotImplementedError
end

#set_attribute_source(commit_id) ⇒ Object

Public: set the commit whose .gitattributes file(s) should be used as the source of attribute information in ‘load_attributes_for_path’.

commit_id - the string unique identifier of the attribute source commit.

Returns nothing.

Raises:

  • (NotImplementedError)


26
27
28
# File 'lib/linguist/source/repository.rb', line 26

def set_attribute_source(commit_id)
  raise NotImplementedError
end