Class: Gitmirror::Repository

Inherits:
Object
  • Object
show all
Defined in:
lib/gitmirror/repository.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, path = nil) ⇒ Repository

Returns a new instance of Repository.



5
6
7
8
# File 'lib/gitmirror/repository.rb', line 5

def initialize url, path = nil
  @url= url
  @path = path ? File.expand_path(path) : default_path 
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



4
5
6
# File 'lib/gitmirror/repository.rb', line 4

def path
  @path
end

#urlObject (readonly)

Returns the value of attribute url.



4
5
6
# File 'lib/gitmirror/repository.rb', line 4

def url
  @url
end

Instance Method Details

#checkout(workdir, ref = 'master') ⇒ Object



15
16
17
# File 'lib/gitmirror/repository.rb', line 15

def checkout(workdir, ref = 'master')
  backend.checkout(path, File.expand_path(workdir), ref)
end

#mirror(credential = nil) ⇒ Object



10
11
12
13
# File 'lib/gitmirror/repository.rb', line 10

def mirror credential=nil
  backend.mirror(url, path, credential)
  path
end

#mirror_and_checkout(workdir, ref = 'master') ⇒ Object



19
20
21
22
# File 'lib/gitmirror/repository.rb', line 19

def mirror_and_checkout(workdir, ref = 'master')
  mirror
  checkout(workdir, ref)
end