Class: RepoMiner::Repository
- Inherits:
-
Object
- Object
- RepoMiner::Repository
- Defined in:
- lib/repo_miner/repository.rb
Instance Attribute Summary collapse
-
#branch ⇒ Object
readonly
Returns the value of attribute branch.
-
#repo_path ⇒ Object
readonly
Returns the value of attribute repo_path.
Instance Method Summary collapse
- #analyse(branch = 'master', since = nil) ⇒ Object
-
#initialize(repo_path) ⇒ Repository
constructor
A new instance of Repository.
- #rugged_repository ⇒ Object
- #walk(branch, since = nil) ⇒ Object
Constructor Details
#initialize(repo_path) ⇒ Repository
Returns a new instance of Repository.
6 7 8 |
# File 'lib/repo_miner/repository.rb', line 6 def initialize(repo_path) @repo_path = repo_path end |
Instance Attribute Details
#branch ⇒ Object (readonly)
Returns the value of attribute branch.
4 5 6 |
# File 'lib/repo_miner/repository.rb', line 4 def branch @branch end |
#repo_path ⇒ Object (readonly)
Returns the value of attribute repo_path.
3 4 5 |
# File 'lib/repo_miner/repository.rb', line 3 def repo_path @repo_path end |
Instance Method Details
#analyse(branch = 'master', since = nil) ⇒ Object
22 23 24 25 26 |
# File 'lib/repo_miner/repository.rb', line 22 def analyse(branch = 'master', since = nil) walk(branch, since).map do |commit| Commit.new(self, commit).analyse end end |
#rugged_repository ⇒ Object
10 11 12 |
# File 'lib/repo_miner/repository.rb', line 10 def rugged_repository @repository ||= Rugged::Repository.new(repo_path) end |
#walk(branch, since = nil) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/repo_miner/repository.rb', line 14 def walk(branch, since = nil) @walker = Rugged::Walker.new(rugged_repository) @walker.sorting(Rugged::SORT_TOPO | Rugged::SORT_REVERSE) @walker.hide(rugged_repository.lookup(since)) if since @walker.push(rugged_repository.branches[branch].target_id) @walker end |