Class: Sleet::LocalRepo
- Inherits:
-
Object
- Object
- Sleet::LocalRepo
- Defined in:
- lib/sleet/local_repo.rb
Constant Summary collapse
- REMOTE_BRANCH_REGEX =
%r{^([^\/.]+)\/(.+)}.freeze
- CURRENT_BRANCH_REGEX =
%r{^refs\/heads\/}.freeze
- GITHUB_MATCH_REGEX =
%r{github.com[:\/](.+)\/(.+)\.git}.freeze
Instance Method Summary collapse
- #branch_name ⇒ Object
-
#initialize(source_dir:) ⇒ LocalRepo
constructor
A new instance of LocalRepo.
- #project ⇒ Object
- #username ⇒ Object
Constructor Details
#initialize(source_dir:) ⇒ LocalRepo
Returns a new instance of LocalRepo.
9 10 11 |
# File 'lib/sleet/local_repo.rb', line 9 def initialize(source_dir:) @source_dir = source_dir end |
Instance Method Details
#branch_name ⇒ Object
25 26 27 28 29 |
# File 'lib/sleet/local_repo.rb', line 25 def branch_name validate! current_branch.upstream.name.match(REMOTE_BRANCH_REGEX)[2] end |
#project ⇒ Object
19 20 21 22 23 |
# File 'lib/sleet/local_repo.rb', line 19 def project validate! github_match[2] end |
#username ⇒ Object
13 14 15 16 17 |
# File 'lib/sleet/local_repo.rb', line 13 def username validate! github_match[1] end |