From 6d78bcc3f7bd32af0856ff78c751e224d6ee67eb Mon Sep 17 00:00:00 2001 From: 47erbot Date: Wed, 9 Sep 2020 05:07:37 +0000 Subject: [PATCH 1/2] Update scalafmt-core to 2.7.0 --- .scalafmt.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.scalafmt.conf b/.scalafmt.conf index 31d715dd..5807b2bd 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,4 +1,4 @@ -version = 2.5.3 +version = 2.7.0 style = defaultWithAlign maxColumn = 100 From 3c63ae6d2a856440b7a067c5772485af85f35aee Mon Sep 17 00:00:00 2001 From: 47erbot <47erbot@users.noreply.github.com> Date: Wed, 9 Sep 2020 05:12:36 +0000 Subject: [PATCH 2/2] Run formatter/linter --- src/main/scala/microsites/MicrositeKeys.scala | 29 +++++----- .../microsites/util/MicrositeHelper.scala | 57 +++++++++---------- 2 files changed, 40 insertions(+), 46 deletions(-) diff --git a/src/main/scala/microsites/MicrositeKeys.scala b/src/main/scala/microsites/MicrositeKeys.scala index 7a63eb08..6753bf8c 100644 --- a/src/main/scala/microsites/MicrositeKeys.scala +++ b/src/main/scala/microsites/MicrositeKeys.scala @@ -513,22 +513,21 @@ trait MicrositeAutoImportSettings extends MicrositeKeys { | * commitMessage: $commitMessage""".stripMargin) BlazeClientBuilder[IO](ec).resource - .use { - client => - val ghOps: GitHubOps[IO] = - new GitHubOps[IO](client, githubOwner, githubRepo, githubToken) - - if (noJekyll) FIO.touch(siteDir / ".nojekyll") - - ghOps - .commitDir(branch, commitMessage, siteDir) - .map(_ => log.info("Success committing files")) - .handleErrorWith { e => - IO { - e.printStackTrace() - log.error(s"Error committing files") - } + .use { client => + val ghOps: GitHubOps[IO] = + new GitHubOps[IO](client, githubOwner, githubRepo, githubToken) + + if (noJekyll) FIO.touch(siteDir / ".nojekyll") + + ghOps + .commitDir(branch, commitMessage, siteDir) + .map(_ => log.info("Success committing files")) + .handleErrorWith { e => + IO { + e.printStackTrace() + log.error(s"Error committing files") } + } } .unsafeRunSync() }) diff --git a/src/main/scala/microsites/util/MicrositeHelper.scala b/src/main/scala/microsites/util/MicrositeHelper.scala index a17d646d..a8ccf42e 100644 --- a/src/main/scala/microsites/util/MicrositeHelper.scala +++ b/src/main/scala/microsites/util/MicrositeHelper.scala @@ -126,25 +126,24 @@ class MicrositeHelper(config: MicrositeSettings) { val extraMdOutputDir = config.fileLocations.micrositeExtraMdFilesOutput extraMdOutputDir.mkdirs() - config.fileLocations.micrositeExtraMdFiles foreach { - case (sourceFile, targetFileConfig) => - println( - s"Copying from ${sourceFile.getAbsolutePath} to ${extraMdOutputDir.getAbsolutePath}/$targetFileConfig" - ) + config.fileLocations.micrositeExtraMdFiles foreach { case (sourceFile, targetFileConfig) => + println( + s"Copying from ${sourceFile.getAbsolutePath} to ${extraMdOutputDir.getAbsolutePath}/$targetFileConfig" + ) - val targetFileContent = - s"""--- + val targetFileContent = + s"""--- |layout: ${targetFileConfig.layout} - |${targetFileConfig.metaProperties map { - case (key, value) => "%s: %s" format (key, value) - } mkString ("", "\n", "")} + |${targetFileConfig.metaProperties map { case (key, value) => + "%s: %s" format (key, value) + } mkString ("", "\n", "")} |--- |${Source.fromFile(sourceFile.getAbsolutePath).mkString} |""".stripMargin - val outFile = extraMdOutputDir / targetFileConfig.fileName + val outFile = extraMdOutputDir / targetFileConfig.fileName - IO.write(outFile, targetFileContent) + IO.write(outFile, targetFileContent) } extraMdOutputDir @@ -179,8 +178,8 @@ class MicrositeHelper(config: MicrositeSettings) { createFile(targetPath) val content = config.visualSettings.palette - .map { - case (key, value) => s"""$$$key: $value;""" + .map { case (key, value) => + s"""$$$key: $value;""" } .mkString("\n") writeContentToFile(content, targetPath) @@ -204,22 +203,20 @@ class MicrositeHelper(config: MicrositeSettings) { "page" -> new PageLayout(config) ) - layoutList map { - case (layoutName, layout) => - val targetPath = s"$targetDir$jekyllDir/_layouts/$layoutName.html" - createFile(targetPath) + layoutList map { case (layoutName, layout) => + val targetPath = s"$targetDir$jekyllDir/_layouts/$layoutName.html" + createFile(targetPath) - writeContentToFile("" + layout.render.toString(), targetPath) - targetPath.toFile + writeContentToFile("" + layout.render.toString(), targetPath) + targetPath.toFile } } def createPartialLayout(targetDir: String): List[File] = - List("menu" -> new MenuPartialLayout(config)) map { - case (layoutName, layout) => - val targetPath = s"$targetDir$jekyllDir/_includes/$layoutName.html" - writeContentToFile(layout.render.toString(), targetPath) - targetPath.toFile + List("menu" -> new MenuPartialLayout(config)) map { case (layoutName, layout) => + val targetPath = s"$targetDir$jekyllDir/_includes/$layoutName.html" + writeContentToFile(layout.render.toString(), targetPath) + targetPath.toFile } def createFavicons(targetDir: String): List[File] = { @@ -233,13 +230,11 @@ class MicrositeHelper(config: MicrositeSettings) { createFile(sourceFile) (faviconFilenames zip faviconSizes) - .map { - case (name, size) => - (new File(s"$targetDir$jekyllDir/img/$name"), size) + .map { case (name, size) => + (new File(s"$targetDir$jekyllDir/img/$name"), size) } - .map { - case (file, (width, height)) => - Image.fromFile(sourceFile.toFile).scaleTo(width, height).output(file) + .map { case (file, (width, height)) => + Image.fromFile(sourceFile.toFile).scaleTo(width, height).output(file) } }