lib/learn_submit/submission.rb in learn-submit-1.0.13 vs lib/learn_submit/submission.rb in learn-submit-1.1.0
- old
+ new
@@ -1,8 +1,8 @@
module LearnSubmit
class Submission
- attr_reader :git, :client, :file_path
+ attr_reader :git, :client, :file_path, :message
def self.create(message: nil)
new(message: message).create
end
@@ -10,10 +10,11 @@
_login, token = Netrc.read['learn-config']
@client = LearnWeb::Client.new(token: token)
@git = LearnSubmit::Submission::GitInteractor.new(username: user.username, message: message)
@file_path = File.expand_path('~/.learn-submit-tmp')
+ @message = message
end
def create
setup_tmp_file
@@ -50,10 +51,10 @@
repo_name = git.repo_name
branch_name = git.branch_name
begin
pr_response = Timeout::timeout(15) do
- client.issue_pull_request(repo_name: repo_name, branch_name: branch_name)
+ client.issue_pull_request(repo_name: repo_name, branch_name: branch_name, message: message)
end
rescue Timeout::Error
if retries > 0
puts "It seems like there's a problem connecting to Learn. Trying again..."
submit!(retries-1)