Skip to content

Commit

Permalink
Add show cmta progress (#280)
Browse files Browse the repository at this point in the history
- Add some progress feedback for `cmta studentify`, `cmta linearize`,
  and `cmta delinearize` commands
  • Loading branch information
eloots authored Aug 16, 2023
1 parent e241fea commit aeba697
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions cmt-core/src/main/scala/com/lunatech/cmt/Helpers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ object Helpers:
def hideExercises(cleanedMainRepo: File, solutionsFolder: File, exercises: Vector[String])(config: CMTaConfig): Unit =
val now: Option[Long] = Some(java.time.Instant.now().toEpochMilli())
for (exercise <- exercises)
print(s".")
zipAndDeleteOriginal(cleanedMainRepo / config.mainRepoExerciseFolder, solutionsFolder, exercise, now)
end hideExercises

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ object Delinearize:

_ <- putBackToMain(mainRepository.value, linearizedRootFolder, exercisesAndSHAsInLinearized)(config)

successMessage <- Right(s"Successfully delinearised ${options.linearizeBaseDirectory.value.getPath}")
successMessage <- Right(s"\nSuccessfully delinearised ${options.linearizeBaseDirectory.value.getPath}")
} yield successMessage
}

Expand Down Expand Up @@ -114,6 +114,7 @@ object Delinearize:
exercisesAndSHAs: Seq[ExerciseNameAndSHA]): Either[CmtError, Unit] =
exercisesAndSHAs match
case ExerciseNameAndSHA(exercise, sha) +: remaining =>
print(".")
s"git checkout $sha"
.toProcessCmd(linearizedRepo)
.runWithStatus(toConsoleRed(s"Unable to checkout commit($sha) corresponding to exercise: $exercise")) match
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ object Linearize:
_ <- commitExercises(cleanedMainRepo, exercises, linearizedRootFolder, config)

_ = sbtio.delete(tmpFolder)
successMessage <- Right(s"Successfully linearized ${mainRepository.value.getPath}")
successMessage <- Right(s"\nSuccessfully linearized ${mainRepository.value.getPath}")

} yield successMessage
}
Expand All @@ -91,6 +91,7 @@ object Linearize:

exercises match
case exercise +: remainingExercises =>
print(".")
val from = cleanedMainRepo / config.mainRepoExerciseFolder / exercise
val linearizedCodeFolder = linearizedRootFolder / config.linearizedRepoActiveExerciseFolder
sbtio.delete(linearizedCodeFolder)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ object Studentify:

ExercisesMetadata(prefix, exercises, exerciseNumbers) <- getExerciseMetadata(mainRepository.value)(config)

_ = buildStudentifiedRepository(
buildResult = buildStudentifiedRepository(
cleanedMainRepo,
exercises,
studentifiedRootFolder,
Expand All @@ -108,7 +108,7 @@ object Studentify:
options.initGit,
tmpFolder)

successMessage <- Right(exercises.mkString("Processed exercises:\n ", "\n ", "\n"))
successMessage <- buildResult

} yield successMessage
}
Expand Down Expand Up @@ -139,7 +139,7 @@ object Studentify:
generatorInfo)
writeStudentifiedCMTBookmark(studentifiedRootFolder / config.studentifiedRepoBookmarkFile, exercises.head)

val successMessage = exercises.mkString("Processed exercises:\n ", "\n ", "\n")
val successMessage = exercises.mkString("\nProcessed exercises:\n ", "\n ", "\n")
if initializeAsGitRepo.value then
val dotIgnoreFile = cleanedMainRepo / ".gitignore"
if dotIgnoreFile.exists then sbtio.copyFile(dotIgnoreFile, studentifiedRootFolder / ".gitignore")
Expand Down

0 comments on commit aeba697

Please sign in to comment.