Class: LearnSubmit::Submission::GitInteractor
- Inherits:
-
Object
- Object
- LearnSubmit::Submission::GitInteractor
- Defined in:
- lib/learn_submit/submission/git_interactor.rb
Constant Summary collapse
- LEARN_ORG_NAMES =
[ 'learn-co-curriculum', 'learn-co-students' ]
Instance Attribute Summary collapse
-
#git ⇒ Object
readonly
Returns the value of attribute git.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#old_remote_name ⇒ Object
Returns the value of attribute old_remote_name.
-
#old_url ⇒ Object
Returns the value of attribute old_url.
-
#remote_name ⇒ Object
Returns the value of attribute remote_name.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
- #branch_name ⇒ Object
- #commit_and_push ⇒ Object
-
#initialize(username:, message:) ⇒ GitInteractor
constructor
A new instance of GitInteractor.
- #repo_name ⇒ Object
Constructor Details
#initialize(username:, message:) ⇒ GitInteractor
Returns a new instance of GitInteractor.
12 13 14 15 16 |
# File 'lib/learn_submit/submission/git_interactor.rb', line 12 def initialize(username:, message:) @username = username @message = || 'Done.' @git = set_git end |
Instance Attribute Details
#git ⇒ Object (readonly)
Returns the value of attribute git.
4 5 6 |
# File 'lib/learn_submit/submission/git_interactor.rb', line 4 def git @git end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
4 5 6 |
# File 'lib/learn_submit/submission/git_interactor.rb', line 4 def @message end |
#old_remote_name ⇒ Object
Returns the value of attribute old_remote_name.
5 6 7 |
# File 'lib/learn_submit/submission/git_interactor.rb', line 5 def old_remote_name @old_remote_name end |
#old_url ⇒ Object
Returns the value of attribute old_url.
5 6 7 |
# File 'lib/learn_submit/submission/git_interactor.rb', line 5 def old_url @old_url end |
#remote_name ⇒ Object
Returns the value of attribute remote_name.
5 6 7 |
# File 'lib/learn_submit/submission/git_interactor.rb', line 5 def remote_name @remote_name end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
4 5 6 |
# File 'lib/learn_submit/submission/git_interactor.rb', line 4 def username @username end |
Instance Method Details
#branch_name ⇒ Object
31 32 33 |
# File 'lib/learn_submit/submission/git_interactor.rb', line 31 def branch_name git.branch.name end |
#commit_and_push ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/learn_submit/submission/git_interactor.rb', line 18 def commit_and_push check_remote add_changes commit_changes push! end |
#repo_name ⇒ Object
26 27 28 29 |
# File 'lib/learn_submit/submission/git_interactor.rb', line 26 def repo_name url = git.remote(remote_name).url url.match(/^.+\w+\/(.*?)(?:\.git)?$/)[1] end |