class Linguist::Repository
- Linguist::Repository
- Reference
- Object
Overview
A Repository is an abstraction of a Grit::Repo or a basic file system tree. It holds a list of paths pointing to Blobish objects.
Its primary purpose is for gathering language statistics across the entire project.
Defined in:
linguist/repository.crConstant Summary
-
MAX_TREE_SIZE =
100000
Constructors
-
.new(repo : Git::Repository, commit_oid : Git::Oid | String)
Public: Initialize a new Repository to be analyzed for language data
Class Method Summary
-
.incremental(repo, commit_oid, old_commit_oid, old_stats)
Public: Create a new Repository based on the stats of an existing one
Instance Method Summary
-
#breakdown_by_file
Public: Return the language breakdown of this repository by file
-
#cache
Public: Return the cached results of the analysis
- #compute_stats(old_commit_oid, cache = nil)
- #current_tree
- #detector(blob, name)
- #get_first_commit
-
#language
Public: Get primary Language of repository.
-
#languages
Public: Returns a breakdown of language stats.
-
#load_existing_stats(old_commit_oid : Git::Oid | String, old_stats : Nil | Hash(String, Tuple(Nil | ::Linguist::Language, Int32 | Int64)))
Public: Load the results of a previous analysis on this repository to speed up the new scan.
- #repository : Git::Repository
-
#size : Int32
Public: Get the total size of the repository.
Constructor Detail
Public: Initialize a new Repository to be analyzed for language data
repo - a Rugged::Repository object commit_oid - the sha1 of the commit that will be analyzed; this is usually the master branch
Returns a Repository
Class Method Detail
Public: Create a new Repository based on the stats of an existing one
Instance Method Detail
Public: Return the language breakdown of this repository by file
Returns a map of language names => [filenames...]
Public: Return the cached results of the analysis
This is a per-file breakdown that can be passed to other instances of Linguist::Repository to perform incremental scans
Returns a map of filename => [language, size]
Public: Returns a breakdown of language stats.
Examples
=> { 'Ruby' => 46319,
'JavaScript' => 258 }
Returns a Hash of language names and Integer size values.
Public: Load the results of a previous analysis on this repository to speed up the new scan.
The new analysis will be performed incrementally as to only take into account the file changes since the last time the repository was scanned
old_commit_oid - the sha1 of the commit that was previously analyzed old_stats - the result of the previous analysis, obtained by calling Repository#cache on the old repository
Returns nothing