Class: GitWrapper::Commands::RevList
- Inherits:
-
Git
- Object
- Git
- GitWrapper::Commands::RevList
show all
- Defined in:
- lib/git_wrapper/commands/rev_list.rb
Instance Attribute Summary
Attributes inherited from Git
#error, #location_folder, #output
Instance Method Summary
collapse
Methods inherited from Git
#execute, #initialize, #success?
Instance Method Details
#author(author) ⇒ Object
5
6
7
8
|
# File 'lib/git_wrapper/commands/rev_list.rb', line 5
def author(author)
@author = author
self
end
|
#command ⇒ Object
35
36
37
38
39
40
41
42
43
|
# File 'lib/git_wrapper/commands/rev_list.rb', line 35
def command
command = "rev-list HEAD -i #{@count ? ' --count ' : ''}"
command += " --author \"#{@author}\"" if @author
command += " --since \"#{@since}\"" if @since
command += " --until \"#{@until}\"" if @until
command += " --grep \"#{@grep}\"" if @grep
command += " #{@files.map{|f| "\"#{f}\"" }.join(' ')}" if @files
command
end
|
#count ⇒ Object
25
26
27
28
|
# File 'lib/git_wrapper/commands/rev_list.rb', line 25
def count
@count = true
self
end
|
#files(files) ⇒ Object
30
31
32
33
|
# File 'lib/git_wrapper/commands/rev_list.rb', line 30
def files(files)
@files = files.map { |f| to_relative_path(f) }
self
end
|
#grep(grep) ⇒ Object
10
11
12
13
|
# File 'lib/git_wrapper/commands/rev_list.rb', line 10
def grep(grep)
@grep = grep
self
end
|
#result ⇒ Object
45
46
47
48
|
# File 'lib/git_wrapper/commands/rev_list.rb', line 45
def result
return nil unless success?
@count ? output.to_i : output.split(/\n/)
end
|
#since(date) ⇒ Object
15
16
17
18
|
# File 'lib/git_wrapper/commands/rev_list.rb', line 15
def since(date)
@since = date
self
end
|
#until(date) ⇒ Object
20
21
22
23
|
# File 'lib/git_wrapper/commands/rev_list.rb', line 20
def until(date)
@until = date
self
end
|