class Git::Remote
Attributes
name[RW]
url[RW]
Public Class Methods
add(remote_name, remote_url)
click to toggle source
# File lib/Git/Remote.rb, line 51 def add(remote_name, remote_url) system add_command(remote_name, remote_url) end
add_command(remote_name, remote_url)
click to toggle source
# File lib/Git/Remote.rb, line 47 def add_command(remote_name, remote_url) ['git remote add', remote_name, remote_url].join(' ') end
all()
click to toggle source
# File lib/Git/Remote.rb, line 37 def all remote_output.split("\n").collect do |remote| parse_line(remote) end.uniq{|remote| remote.name} end
exist?(remote_name)
click to toggle source
# File lib/Git/Remote.rb, line 63 def exist?(remote_name) !!find(remote_name) end
find(remote_name)
click to toggle source
# File lib/Git/Remote.rb, line 43 def find(remote_name) all.detect{|remote| remote.name == remote_name} end
new(name:, url:)
click to toggle source
# File lib/Git/Remote.rb, line 72 def initialize(name:, url:) @name = name @url = url end
parse_line(remote_output_line)
click to toggle source
# File lib/Git/Remote.rb, line 28 def parse_line(remote_output_line) name, url = remote_output_line.split new(name: name, url: url) end
remote_output()
click to toggle source
# File lib/Git/Remote.rb, line 33 def remote_output `git remote --verbose` end
remove(remote_name, remote_url)
click to toggle source
# File lib/Git/Remote.rb, line 59 def remove(remote_name, remote_url) system remove_command(remote_name) end
remove_command(remote_name)
click to toggle source
# File lib/Git/Remote.rb, line 55 def remove_command(remote_name) ['git remote remove', remote_name].join(' ') end
Public Instance Methods
remove()
click to toggle source
# File lib/Git/Remote.rb, line 77 def remove self.class.remove(@name, @url) end
Also aliased as: delete
to_s()
click to toggle source
# File lib/Git/Remote.rb, line 82 def to_s "#{@name} #{@url}" end