Class: Gitmirror::Repository
- Inherits:
-
Object
- Object
- Gitmirror::Repository
- Defined in:
- lib/gitmirror/repository.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #checkout(workdir, ref = 'master') ⇒ Object
-
#initialize(url, path = nil) ⇒ Repository
constructor
A new instance of Repository.
- #mirror(credential = nil) ⇒ Object
- #mirror_and_checkout(workdir, ref = 'master') ⇒ Object
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.(path) : default_path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
4 5 6 |
# File 'lib/gitmirror/repository.rb', line 4 def path @path end |
#url ⇒ Object (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.(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 |