Class: Rosette::Client::Repo
- Inherits:
-
Object
- Object
- Rosette::Client::Repo
- Defined in:
- lib/rosette/client/repo.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #get_head ⇒ Object
-
#initialize(path) ⇒ Repo
constructor
A new instance of Repo.
- #rev_parse(ref) ⇒ Object
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
#path ⇒ Object (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_head ⇒ Object
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 |