Class: Git::Remote

Inherits:
Path
  • Object
show all
Defined in:
lib/git/remote.rb

Instance Attribute Summary collapse

Attributes inherited from Path

#path

Instance Method Summary collapse

Methods inherited from Path

#readable?, #writable?

Constructor Details

#initialize(base, name) ⇒ Remote

Returns a new instance of Remote.



8
9
10
11
12
13
14
# File 'lib/git/remote.rb', line 8

def initialize(base, name)
  @base = base
  config = @base.lib.config_remote(name)
  @name = name
  @url = config['url']
  @fetch_opts = config['fetch']
end

Instance Attribute Details

#fetch_optsObject

Returns the value of attribute fetch_opts.



4
5
6
# File 'lib/git/remote.rb', line 4

def fetch_opts
  @fetch_opts
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/git/remote.rb', line 4

def name
  @name
end

#urlObject

Returns the value of attribute url.



4
5
6
# File 'lib/git/remote.rb', line 4

def url
  @url
end

Instance Method Details

#branch(branch = 'master') ⇒ Object



29
30
31
# File 'lib/git/remote.rb', line 29

def branch(branch = 'master')
  Git::Branch.new(@base, "#{@name}/#{branch}")
end

#fetchObject



20
21
22
# File 'lib/git/remote.rb', line 20

def fetch
  @base.fetch(@name)
end

#merge(branch = 'master') ⇒ Object

merge this remote locally



25
26
27
# File 'lib/git/remote.rb', line 25

def merge(branch = 'master')
  @base.merge("#{@name}/#{branch}")
end

#removeObject



16
17
18
# File 'lib/git/remote.rb', line 16

def remove
  @base.remote_remove(@name)
end

#to_sObject



37
38
39
# File 'lib/git/remote.rb', line 37

def to_s
  @name
end