Class: Space::Model::Repo::Git
- Inherits:
-
Object
- Object
- Space::Model::Repo::Git
show all
- Includes:
- Source
- Defined in:
- lib/space/model/repo/git.rb
Instance Attribute Summary (collapse)
Attributes included from Source
#path, #results
Instance Method Summary
(collapse)
Methods included from Source
#commands, included, #refresh, #update
Methods included from Events
events, notify, #notify, sources, subscribe, subscriptions
Constructor Details
- (Git) initialize(repo)
15
16
17
18
|
# File 'lib/space/model/repo/git.rb', line 15
def initialize(repo)
@repo = repo
super(repo.path)
end
|
Instance Attribute Details
- (Object) repo
Returns the value of attribute repo
13
14
15
|
# File 'lib/space/model/repo/git.rb', line 13
def repo
@repo
end
|
Instance Method Details
- (Object) ahead
44
45
46
|
# File 'lib/space/model/repo/git.rb', line 44
def ahead
result(:status) =~ /Your branch is ahead of .* by (\d+) commits?\./ ? $1.to_i : 0
end
|
- (Boolean) ahead?
40
41
42
|
# File 'lib/space/model/repo/git.rb', line 40
def ahead?
ahead > 0
end
|
- (Object) branch
20
21
22
|
# File 'lib/space/model/repo/git.rb', line 20
def branch
result(:branch) =~ /^\* (.+)/ && $1.strip
end
|
- (Boolean) clean?
36
37
38
|
# File 'lib/space/model/repo/git.rb', line 36
def clean?
result(:status) =~ /working directory clean/m
end
|
- (Object) commit
24
25
26
|
# File 'lib/space/model/repo/git.rb', line 24
def commit
result(:commit) =~ /^commit (\S{7})/ && $1
end
|
- (Boolean) dirty?
32
33
34
|
# File 'lib/space/model/repo/git.rb', line 32
def dirty?
!clean?
end
|
- (Object) status
28
29
30
|
# File 'lib/space/model/repo/git.rb', line 28
def status
dirty? ? :dirty : (ahead? ? :ahead : :clean)
end
|