Class: Dod::GitHelper
- Inherits:
-
Object
- Object
- Dod::GitHelper
- Defined in:
- lib/dod/helpers/git_helper.rb
Instance Attribute Summary collapse
-
#g ⇒ Object
Returns the value of attribute g.
Instance Method Summary collapse
- #current_branch ⇒ Object
-
#initialize ⇒ GitHelper
constructor
A new instance of GitHelper.
- #project_name ⇒ Object
- #repo_name ⇒ Object
Constructor Details
#initialize ⇒ GitHelper
Returns a new instance of GitHelper.
8 9 10 |
# File 'lib/dod/helpers/git_helper.rb', line 8 def initialize @g = Git.open(".") end |
Instance Attribute Details
#g ⇒ Object
Returns the value of attribute g.
6 7 8 |
# File 'lib/dod/helpers/git_helper.rb', line 6 def g @g end |
Instance Method Details
#current_branch ⇒ Object
12 13 14 |
# File 'lib/dod/helpers/git_helper.rb', line 12 def current_branch g.current_branch end |
#project_name ⇒ Object
21 22 23 24 |
# File 'lib/dod/helpers/git_helper.rb', line 21 def project_name url_components = URI.parse(g.remote('origin').url) url_components.path.split('/')[2].upcase end |
#repo_name ⇒ Object
16 17 18 19 |
# File 'lib/dod/helpers/git_helper.rb', line 16 def repo_name url_components = URI.parse(g.remote('origin').url) url_components.path.split('/')[3].split('.').first end |