mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX/FEATURE: don't blow up when can't reach theme's repo, show problem themes on dashboard
This commit is contained in:
@@ -2,6 +2,7 @@ module ThemeStore; end
|
||||
|
||||
class ThemeStore::GitImporter
|
||||
|
||||
class ImportFailed < StandardError; end
|
||||
attr_reader :url
|
||||
|
||||
def initialize(url, private_key: nil)
|
||||
@@ -65,7 +66,11 @@ class ThemeStore::GitImporter
|
||||
protected
|
||||
|
||||
def import_public!
|
||||
Discourse::Utils.execute_command("git", "clone", @url, @temp_folder)
|
||||
begin
|
||||
Discourse::Utils.execute_command("git", "clone", @url, @temp_folder)
|
||||
rescue => err
|
||||
raise ImportFailed.new(err.message)
|
||||
end
|
||||
end
|
||||
|
||||
def import_private!
|
||||
@@ -77,9 +82,13 @@ class ThemeStore::GitImporter
|
||||
FileUtils.chmod(0600, 'id_rsa')
|
||||
end
|
||||
|
||||
Discourse::Utils.execute_command({
|
||||
'GIT_SSH_COMMAND' => "ssh -i #{ssh_folder}/id_rsa -o StrictHostKeyChecking=no"
|
||||
}, "git", "clone", @url, @temp_folder)
|
||||
begin
|
||||
Discourse::Utils.execute_command({
|
||||
'GIT_SSH_COMMAND' => "ssh -i #{ssh_folder}/id_rsa -o StrictHostKeyChecking=no"
|
||||
}, "git", "clone", @url, @temp_folder)
|
||||
rescue => err
|
||||
raise ImportFailed.new(err.message)
|
||||
end
|
||||
ensure
|
||||
FileUtils.rm_rf ssh_folder
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user