Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/learn_open/lessons/base_lesson.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ def initialize(lesson_data, options = {})

@repo_path = lesson.clone_repo
@organization, @name = repo_path.split('/')
if @organization.empty? and not @name.empty?
raise "The repo path had an empty organization. Most likely, you need to link your Github account to your Learn account through the Learn website."
end

@git_server = lesson.git_server
@dot_learn = lesson.dot_learn
Expand Down
10 changes: 7 additions & 3 deletions lib/learn_open/services/lesson_downloader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ def fork_repo(retries = 3)
Timeout::timeout(15) do
client.fork_repo(repo_name: lesson.name)
end
rescue Timeout::Error
rescue Timeout::Error => e
if retries > 0
io.puts "There was a problem forking this lesson. Retrying..."
io.puts "Git had the following error:"
io.puts e
fork_repo(retries - 1)
else
io.puts "There is an issue connecting to Learn. Please try again."
Expand All @@ -63,9 +65,11 @@ def clone_repo(retries = 3)
Timeout::timeout(15) do
git_adapter.clone("git@#{lesson.git_server}:#{lesson.repo_path}.git", lesson.name, path: location)
end
rescue Git::GitExecuteError
rescue Git::GitExecuteError => e
if retries > 0
io.puts "There was a problem cloning this lesson. Retrying..." if retries > 1
io.puts "Git had the following error:"
io.puts e
sleep(1)
clone_repo(retries - 1)
else
Expand All @@ -75,7 +79,7 @@ def clone_repo(retries = 3)
end
rescue Timeout::Error
if retries > 0
io.puts "There was a problem cloning this lesson. Retrying..."
io.puts "There was a problem cloning this lesson (timed out). Retrying..."
clone_repo(retries - 1)
else
io.puts "Cannot clone this lesson right now. Please try again."
Expand Down