public static void CreateEdxCourseArchive(string baseDir, string courseName) { Environment.CurrentDirectory = baseDir; var outputTarFilename = $"{courseName}.tar.gz"; Console.WriteLine($"Creating archive {outputTarFilename}"); Utils.DeleteFileIfExists(outputTarFilename); ArchiveManager.CreateTar(outputTarFilename, "olx"); }
public static void CreateEdxCourseArchive(string baseDir, string courseName, bool gzipped = false) { var extension = gzipped ? ".tar.gz" : ".tar"; Environment.CurrentDirectory = baseDir; var outputTarFilename = $"{courseName}{extension}"; Console.WriteLine($"Creating archive {outputTarFilename}"); Utils.DeleteFileIfExists(outputTarFilename); if (gzipped) { ArchiveManager.CreateTarGz(outputTarFilename, "olx"); } else { ArchiveManager.CreateTar(outputTarFilename, "olx"); } }
public static void Upload(string baseDir, string courseName, Config config, string edxStudioUrl, Credentials credentials) { Environment.CurrentDirectory = baseDir; Utils.DeleteDirectoryIfExists("temp"); if (Directory.Exists(courseName)) { Directory.Move(courseName, "temp"); } Utils.DirectoryCopy("olx", courseName, true); Utils.DeleteFileIfExists(courseName + ".tar.gz"); Console.WriteLine("Creating {0}.tar.gz...", courseName); ArchiveManager.CreateTar(courseName + ".tar.gz", courseName); Utils.DeleteDirectoryIfExists(courseName); if (Directory.Exists("temp")) { Directory.Move("temp", courseName); } Console.WriteLine("Uploading {0}.tar.gz to {1}", courseName, edxStudioUrl); Upload(edxStudioUrl, credentials.Email, credentials.GetPassword(), config.Organization, config.CourseNumber, config.CourseRun, courseName + ".tar.gz"); Utils.DeleteFileIfExists(courseName + ".tar.gz"); }