Class: MultiGit::RuggedBackend::Remote
- Inherits:
-
Object
- Object
- MultiGit::RuggedBackend::Remote
- Extended by:
- Forwardable
- Includes:
- MultiGit::Remote
- Defined in:
- lib/multi_git/rugged_backend/remote.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Persistent
Instance Attribute Summary collapse
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
Instance Method Summary collapse
- #fetch(*_) ⇒ Object
- #fetch_urls ⇒ Object
-
#initialize(repository, remote) ⇒ Remote
constructor
:nocov:.
- #push(*refspecs) ⇒ Object
- #push_urls ⇒ Object
- #save(name) ⇒ Object
Methods included from Utils::AbstractMethods
Constructor Details
#initialize(repository, remote) ⇒ Remote
:nocov:
31 32 33 34 |
# File 'lib/multi_git/rugged_backend/remote.rb', line 31 def initialize( repository, remote ) @repository = repository @rugged_remote = remote end |
Instance Attribute Details
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
10 11 12 |
# File 'lib/multi_git/rugged_backend/remote.rb', line 10 def repository @repository end |
Instance Method Details
#fetch(*_) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/multi_git/rugged_backend/remote.rb', line 50 def fetch(*refspecs) rs = parse_fetch_refspec(*refspecs) cl = Rugged::Remote.new(repository.__backend__, fetch_urls.first) cl.clear_refspecs rs.each do |spec| cl.add_fetch(spec.to_s) end cl.connect(:fetch) do |r| r.download end cl.update_tips! end |
#fetch_urls ⇒ Object
15 16 17 |
# File 'lib/multi_git/rugged_backend/remote.rb', line 15 def fetch_urls [rugged_remote.url] end |
#push(*refspecs) ⇒ Object
68 69 70 71 72 73 74 75 76 |
# File 'lib/multi_git/rugged_backend/remote.rb', line 68 def push(*refspecs) rs = parse_push_refspec(*refspecs).map(&:to_s) # rugged cannot push to multiple locations currently push_urls.each do | pu | cl = Rugged::Remote.new(repository.__backend__, pu) cl.clear_refspecs cl.push(rs) end end |
#push_urls ⇒ Object
21 22 23 |
# File 'lib/multi_git/rugged_backend/remote.rb', line 21 def push_urls [rugged_remote.push_url || rugged_remote.url] end |
#save(name) ⇒ Object
45 46 47 |
# File 'lib/multi_git/rugged_backend/remote.rb', line 45 def save( name ) rugged_remote.rename!( name ) end |