Class: GitWrapper::Commands::Remote
- Inherits:
-
Git
- Object
- Git
- GitWrapper::Commands::Remote
show all
- Defined in:
- lib/git_wrapper/commands/remote.rb
Instance Attribute Summary
Attributes inherited from Git
#error, #location_folder, #output
Instance Method Summary
collapse
Methods inherited from Git
#execute, #initialize, #to_relative_path
Instance Method Details
#add(url) ⇒ Object
10
11
12
13
14
|
# File 'lib/git_wrapper/commands/remote.rb', line 10
def add(url)
@url = url
@mode = :add
self
end
|
#command ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/git_wrapper/commands/remote.rb', line 26
def command
command = "remote "
if @mode == :add
command += "add #{@name} \"#{@url}\""
elsif @mode == :remove
command += "rm #{@name}"
elsif @mode == :list
command += "show"
else
raise "Unespecified remote mode"
end
command
end
|
#list ⇒ Object
21
22
23
24
|
# File 'lib/git_wrapper/commands/remote.rb', line 21
def list
@mode = :list
self
end
|
#name(name) ⇒ Object
5
6
7
8
|
# File 'lib/git_wrapper/commands/remote.rb', line 5
def name(name)
@name = name
self
end
|
#remove ⇒ Object
16
17
18
19
|
# File 'lib/git_wrapper/commands/remote.rb', line 16
def remove
@mode = :remove
self
end
|
#result ⇒ Object
42
43
44
45
|
# File 'lib/git_wrapper/commands/remote.rb', line 42
def result
return @output.split(/\n/) if @mode == :list
super
end
|