Class: Rosette::Client::Repo

Inherits:
Object
  • Object
show all
Defined in:
lib/rosette/client/repo.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Repo

Returns a new instance of Repo.



9
10
11
# File 'lib/rosette/client/repo.rb', line 9

def initialize(path)
  @path = path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



7
8
9
# File 'lib/rosette/client/repo.rb', line 7

def path
  @path
end

Instance Method Details

#get_headObject



13
14
15
# File 'lib/rosette/client/repo.rb', line 13

def get_head
  execute_in_repo('git symbolic-ref --short HEAD').strip
end

#rev_parse(ref) ⇒ Object



17
18
19
20
# File 'lib/rosette/client/repo.rb', line 17

def rev_parse(ref)
  commit_id = execute_in_repo("git rev-parse #{ref}").strip
  commit_id ? commit_id : nil
end