Class: MultiRepo::ConfigEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/multirepo/files/config-entry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repo) ⇒ ConfigEntry

Returns a new instance of ConfigEntry.



19
20
21
22
23
# File 'lib/multirepo/files/config-entry.rb', line 19

def initialize(repo)
  @id = SecureRandom.uuid
  @path = repo.path
  @url = repo.exists? ? repo.remote('origin').url : nil
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



8
9
10
# File 'lib/multirepo/files/config-entry.rb', line 8

def id
  @id
end

#pathObject

Returns the value of attribute path.



9
10
11
# File 'lib/multirepo/files/config-entry.rb', line 9

def path
  @path
end

#repoObject

Returns the value of attribute repo.



11
12
13
# File 'lib/multirepo/files/config-entry.rb', line 11

def repo
  @repo
end

#urlObject

Returns the value of attribute url.



10
11
12
# File 'lib/multirepo/files/config-entry.rb', line 10

def url
  @url
end

Instance Method Details

#==(other) ⇒ Object



25
26
27
28
29
# File 'lib/multirepo/files/config-entry.rb', line 25

def ==(other)
  other_path = Pathname.new(other.path)
  self_path = Pathname.new(path)
  other_path.exist? && self_path.exist? && other_path.realpath == self_path.realpath
end

#encode_with(coder) ⇒ Object



13
14
15
16
17
# File 'lib/multirepo/files/config-entry.rb', line 13

def encode_with(coder)
  coder["id"] = @id
  coder["path"] = @path
  coder["url"] = @url
end

#nameObject



35
36
37
# File 'lib/multirepo/files/config-entry.rb', line 35

def name
  repo.basename
end