Class: Flagit::Lookout
- Inherits:
-
Object
- Object
- Flagit::Lookout
- Defined in:
- lib/flagit/lookout.rb
Overview
The main Lookout driver
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
-
#repository ⇒ Object
Returns the value of attribute repository.
Instance Method Summary collapse
- #find_branch_by_name(branch_name) ⇒ Object
-
#initialize(path = '.') ⇒ Lookout
constructor
A new instance of Lookout.
- #last_commit(branch_name: nil, commit_depth: 20) ⇒ Object
Constructor Details
#initialize(path = '.') ⇒ Lookout
Returns a new instance of Lookout.
8 9 10 11 |
# File 'lib/flagit/lookout.rb', line 8 def initialize(path = '.') @path = path @repository = Git.open(path) end |
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
6 7 8 |
# File 'lib/flagit/lookout.rb', line 6 def path @path end |
#repository ⇒ Object
Returns the value of attribute repository.
6 7 8 |
# File 'lib/flagit/lookout.rb', line 6 def repository @repository end |
Instance Method Details
#find_branch_by_name(branch_name) ⇒ Object
18 19 20 21 |
# File 'lib/flagit/lookout.rb', line 18 def find_branch_by_name(branch_name) return current_or_master unless branch_is_remote(branch_name) @repository.branches[branch_name] end |
#last_commit(branch_name: nil, commit_depth: 20) ⇒ Object
13 14 15 16 |
# File 'lib/flagit/lookout.rb', line 13 def last_commit(branch_name: nil, commit_depth: 20) branch = find_branch_by_name(branch_name) @repository.log(commit_depth).select { |c| branch.contains? c.sha }.first end |