Class: GitRepo

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename) ⇒ GitRepo

Returns a new instance of GitRepo.



3
4
5
6
# File 'lib/gitrepo.rb', line 3

def initialize(filename)
  @filename = filename
  @remote = ""
end

Instance Attribute Details

#filenameObject (readonly)

Returns the value of attribute filename.



2
3
4
# File 'lib/gitrepo.rb', line 2

def filename
  @filename
end

#remoteObject (readonly)

Returns the value of attribute remote.



2
3
4
# File 'lib/gitrepo.rb', line 2

def remote
  @remote
end

Instance Method Details

#find_remoteObject



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/gitrepo.rb', line 8

def find_remote()
  file = File.new(filename, "r")
  while (line = file.gets)
    if line.start_with?("[remote")
      @remote = file.gets.gsub("url = [email protected]:", "https://github.com/")
      break
    end
  end
  file.close
  @remote
end