FEATURE: Import and export themes in a .tar.gz format (#6916)

This commit is contained in:
David Taylor
2019-01-23 14:40:21 +00:00
committed by GitHub
parent d0129b85f4
commit afd449089f
18 changed files with 431 additions and 133 deletions

View File

@@ -14,6 +14,8 @@ class ThemeStore::TgzImporter
Dir.chdir(@temp_folder) do
Discourse::Utils.execute_command("tar", "-xzvf", @filename, "--strip", "1")
end
rescue RuntimeError
raise RemoteTheme::ImportError, I18n.t("themes.import_error.unpack_failed")
end
def cleanup!
@@ -38,6 +40,12 @@ class ThemeStore::TgzImporter
end
end
def all_files
Dir.chdir(@temp_folder) do
Dir.glob("**/*").reject { |f| File.directory?(f) }
end
end
def [](value)
fullpath = real_path(value)
return nil unless fullpath