Class: Monolith::Repository

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/monolith/repository.rb

Direct Known Subclasses

Application

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#pathObject (readonly)

Returns the value of attribute path.



9
10
11
# File 'lib/monolith/repository.rb', line 9

def path
  @path
end

#urlObject (readonly)

Returns the value of attribute url.



9
10
11
# File 'lib/monolith/repository.rb', line 9

def url
  @url
end

Instance Method Details

#branchesObject



16
17
18
# File 'lib/monolith/repository.rb', line 16

def branches
  BranchFinder.new(self)
end

#cloneObject



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

def clone
  git.clone(url) unless cloned?
end

#nameObject



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_pathObject



32
33
34
# File 'lib/monolith/repository.rb', line 32

def relative_path
  @path.split("/").tap(&:shift).join("/")
end

#remote(repo) ⇒ Object



36
37
38
# File 'lib/monolith/repository.rb', line 36

def remote(repo)
  Remote.new(self, repo)
end