Class: Monolith::Repository
- Inherits:
-
Object
- Object
- Monolith::Repository
- Extended by:
- Forwardable
- Defined in:
- lib/monolith/repository.rb
Direct Known Subclasses
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
- #branches ⇒ Object
- #clone ⇒ Object
-
#initialize(path, url = nil) ⇒ Repository
constructor
A new instance of Repository.
- #name ⇒ Object
- #prepare(branch) ⇒ Object
- #relative_path ⇒ Object
- #remote(repo) ⇒ Object
Constructor Details
#initialize(path, url = nil) ⇒ Repository
Returns a new instance of Repository.
11 12 13 14 |
# File 'lib/monolith/repository.rb', line 11 def initialize(path, url = nil) @path = path @url = url end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
9 10 11 |
# File 'lib/monolith/repository.rb', line 9 def path @path end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
9 10 11 |
# File 'lib/monolith/repository.rb', line 9 def url @url end |
Instance Method Details
#branches ⇒ Object
16 17 18 |
# File 'lib/monolith/repository.rb', line 16 def branches BranchFinder.new(self) end |
#clone ⇒ Object
20 21 22 |
# File 'lib/monolith/repository.rb', line 20 def clone git.clone(url) unless cloned? end |
#name ⇒ Object
24 25 26 |
# File 'lib/monolith/repository.rb', line 24 def name @path.split("/").last end |
#prepare(branch) ⇒ Object
28 29 30 |
# File 'lib/monolith/repository.rb', line 28 def prepare(branch) BranchPreparer.new(self, branch).prepare end |
#relative_path ⇒ Object
32 33 34 |
# File 'lib/monolith/repository.rb', line 32 def relative_path @path.split("/").tap(&:shift).join("/") end |